From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH 1/3] ethdev: New API to free consumed buffers in TX ring Date: Fri, 16 Dec 2016 08:28:54 -0800 Message-ID: <20161216082854.48238355@xeon-e3> 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 Cc: thomas.monjalon@6wind.com, wenzhuo.lu@intel.com, dev@dpdk.org To: Billy McFall 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) In-Reply-To: <20161216124851.2640-2-bmcfall@redhat.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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.