On Fri, 16 Dec 2016 07:48:49 -0500 Billy McFall <bmcf...@redhat.com> 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.