[dpdk-dev] [v1] ethdev: support Tx queue used count

Morten Brørup mb at smartsharesystems.com
Fri Jan 12 13:29:58 CET 2024


> From: Ferruh Yigit [mailto:ferruh.yigit at amd.com]
> Sent: Friday, 12 January 2024 12.34
> 
> On 1/11/2024 3:17 PM, jerinj at marvell.com wrote:
> > From: Jerin Jacob <jerinj at marvell.com>
> >
> > Introduce a new API to retrieve the number of used descriptors
> > in a Tx queue. Applications can leverage this API in the fast path to
> > inspect the Tx queue occupancy and take appropriate actions based on
> the
> > available free descriptors.
> >
> > A notable use case could be implementing Random Early Discard (RED)
> > in software based on Tx queue occupancy.

[...]

> > +/**
> > + * @warning
> > + * @b EXPERIMENTAL: this API may change, or be removed, without
> prior notice
> > + *
> > + * Get the number of used descriptors of a Tx queue
> > + *
> > + * This function retrieves the number of used descriptors of a
> transmit queue.
> > + * Applications can use this API in the fast path to inspect Tx
> queue occupancy and take
> > + * appropriate actions based on the available free descriptors.
> > + * An example action could be implementing the Random Early Discard
> (RED).
> >
> 
> Above is good, but do you think does it help to mention that intended
> usacase is QoS, to address the risk Bruce mentioned?

A better way to address the risk is to mention that:
1. there is no need to call this function before rte_eth_tx_burst(), and
2. tx_descriptor_status() has better performance for checking a threshold than this function.

> >  /**
> >   * @internal
> >   * Structure used to hold opaque pointers to internal ethdev Rx/Tx
> > @@ -116,7 +119,9 @@ struct rte_eth_fp_ops {
> >  	eth_tx_descriptor_status_t tx_descriptor_status;
> >  	/** Copy used mbufs from Tx mbuf ring into Rx. */
> >  	eth_recycle_tx_mbufs_reuse_t recycle_tx_mbufs_reuse;
> > -	uintptr_t reserved2[2];
> > +	/** Get the number of used Tx descriptors. */
> > +	eth_tx_queue_count_t tx_queue_count;
> >
> 
> Similarly, can you please move it above 'tx_descriptor_status'?

No. I think struct rte_eth_fp_ops is part of the public API, so moving down tx_descriptor_status and recycle_tx_mbufs_reuse would break the API.

> 
> 
> > +	uintptr_t reserved2[1];
> >  	/**@}*/
> >
> >  } __rte_cache_aligned;



More information about the dev mailing list