[dpdk-dev] [PATCH v2 1/3] ethdev: new API to free consumed buffers in Tx ring
stephen at networkplumber.org
Thu Jan 12 02:41:17 CET 2017
On Wed, 11 Jan 2017 15:03:21 -0500
Billy McFall <bmcfall at 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. It is the
> + * application's responsibity to ensure rte_eth_tx_buffer_flush(..) is
> + * called if needed.
> + *
> + * @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.
> + * @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)
Extra white space.
> + struct rte_eth_dev *dev = &rte_eth_devices[port_id];
> + /* Validate Input Data. Bail if not valid or not supported. */
> + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
> + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_done_cleanup, -ENOTSUP);
> + /* Call driver to free pending mbufs. */
> + return (*dev->dev_ops->tx_done_cleanup)(dev->data->tx_queues[queue_id],
> + free_cnt);
It doesn't look like this is something that needs to be in critical
path. Therefore it makes no sense to inline it.
More information about the dev