From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f42.google.com (mail-pg0-f42.google.com [74.125.83.42]) by dpdk.org (Postfix) with ESMTP id 973BCF91C for ; Fri, 16 Dec 2016 17:29:02 +0100 (CET) Received: by mail-pg0-f42.google.com with SMTP id a1so10914473pgf.1 for ; Fri, 16 Dec 2016 08:29:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ytVzvTgV2cEqzb8SpmH95yNLwn/CBj9Yy9ewWOUTwDs=; b=1mgnpO9ZaJUpqqqOrp6VS2mWfnb40+2DqSFP2ALCFmUF+96pZyyQIEDj9yh304fL/3 +nbbPbZBp/K+GwN7RsQjWSG7OlQf2gE61BLp16hNEruYpUT+2Fy3C0i5nn+VCiAWnqh9 YFfa/2IJzmDBQSZ1uMoFrwj/TFrNap8klk3ayGGAUe5e+8NommRPSuYDQ+JN5RWzy9Xn 3okqyze6ko7aPdMnqIkkyWuTk4F7JUtKOpaqCTFg4ZFp5Xay4Vsr2zBciCecJqQy0VlV +Qw83sqvQVTEMZnLv8qQjDg6ktJAYbzIVlbgRG54AU45FZ2uZAVK/cgmHeo2XdeGwNWa R9kA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ytVzvTgV2cEqzb8SpmH95yNLwn/CBj9Yy9ewWOUTwDs=; b=tE64R3PiXrQMqMjTLeH+xU5GuHVcPaM9SxhSts8GzNwR4+hJqAego+kA6gifYlK6KC ZIUGml+S7zwlv3CwKPeymmhUP+RtJHwtLrXc9zPy4ZZrkiqCSfMpBfQnGUGvouj9PZTZ FRLTuhHWNImP6sUTPL53bLNAYFIOGOVD9DlD5uVwQD/imC2vdv5mR+b65WkjJRLUioYW GJtcRgeWcyL7NajT6TsewDPmsOTkY2x3LOcZRq/yYrZe12n1cKrgxShVeEcRAXRPuzyp 9XbPGzN7/UAvaWV8P6JvF1Dok7919LjgOdpFpvFsx42HVzj6guBZRTeuogbdZP91Qtot 6Chg== X-Gm-Message-State: AKaTC00Ddlpm0w8JXIs8X15A+gPP/vsGpKr0eUXTEloiKeZ31ld1sBZXvSe9F/OJu7l7KA== X-Received: by 10.84.216.6 with SMTP id m6mr8761502pli.130.1481905741822; Fri, 16 Dec 2016 08:29:01 -0800 (PST) Received: from xeon-e3 (204-195-18-65.wavecable.com. [204.195.18.65]) by smtp.gmail.com with ESMTPSA id v1sm13121035pgv.33.2016.12.16.08.29.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 16 Dec 2016 08:29:01 -0800 (PST) Date: Fri, 16 Dec 2016 08:28:54 -0800 From: Stephen Hemminger To: Billy McFall Cc: thomas.monjalon@6wind.com, wenzhuo.lu@intel.com, dev@dpdk.org Message-ID: <20161216082854.48238355@xeon-e3> In-Reply-To: <20161216124851.2640-2-bmcfall@redhat.com> References: <20161216124851.2640-1-bmcfall@redhat.com> <20161216124851.2640-2-bmcfall@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH 1/3] ethdev: New API to free consumed buffers in TX ring X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Dec 2016 16:29:03 -0000 On Fri, 16 Dec 2016 07:48:49 -0500 Billy McFall wrote: > /** > + * Request the driver to free mbufs currently cached by the driver. The > + * driver will only free the mbuf if it is no longer in use. > + * > + * @param port_id > + * The port identifier of the Ethernet device. > + * @param queue_id > + * The index of the transmit queue through which output packets must be > + * sent. > + * The value must be in the range [0, nb_tx_queue - 1] previously supplied > + * to rte_eth_dev_configure(). > + * @param free_cnt > + * Maximum number of packets to free. Use 0 to indicate all possible packets > + * should be freed. Note that a packet may be using multiple mbufs. > + * @param buffer > + * Buffer used to collect packets to be sent. If provided, the buffer will > + * be flushed, even if the current length is less than buffer->size. Pass NULL > + * if buffer has already been flushed. > + * @param sent > + * Pointer to return number of packets sent if buffer has packets to be sent. > + * If *buffer is supplied, *sent must also be supplied. > + * @return > + * Failure: < 0 > + * -ENODEV: Invalid interface > + * -ENOTSUP: Driver does not support function > + * Success: >= 0 > + * 0-n: Number of packets freed. More packets may still remain in ring that > + * are in use. > + */ > + > +static inline int > +rte_eth_tx_done_cleanup(uint8_t port_id, uint16_t queue_id, uint32_t free_cnt, > + struct rte_eth_dev_tx_buffer *buffer, uint16_t *sent) This API is more complex than it needs to be. For the typical use case of OOM kind of cleanup, this is overkill. There is no need for: free_cnt - device driver should just free all buffer/param - the application should not care. The DPDK model is that once mbuf's are passed to device, the device "owns" the mbuf. I think changing that model is just going to break things for no gain. It does make sense to have a "please cleanup your mbufs" call. If application is using special mbuf's then it can use the normal callback on done model.