[dpdk-dev] [PATCH 19.11 V3 02/12] ethdev: fix description of tx descriptor status

Andrew Rybchenko arybchenko at solarflare.com
Thu Aug 8 12:37:30 CEST 2019

On 8/8/19 11:22 AM, Thierry Herbelot wrote:
> From: Olivier Matz <olivier.matz at 6wind.com>
> The API comment of rte_eth_tx_descriptor_status() was incorrect. The
> reference descriptor (when offset = 0) is not where the next packet
> will be sent, but where the latest packet has been enqueued.
> Fixes: 52f5cdd2e897 ("ethdev: add descriptor status API")
> Cc: stable at dpdk.org
> Signed-off-by: Olivier Matz <olivier.matz at 6wind.com>
> ---
>   lib/librte_ethdev/rte_ethdev.h | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
> index dc6596bc93b4..b423e71050e9 100644
> --- a/lib/librte_ethdev/rte_ethdev.h
> +++ b/lib/librte_ethdev/rte_ethdev.h
> @@ -4245,8 +4245,8 @@ rte_eth_rx_descriptor_status(uint16_t port_id, uint16_t queue_id,
>    * @param queue_id
>    *  A valid Tx queue identifier on this port.
>    * @param offset
> - *  The offset of the descriptor starting from tail (0 is the place where
> - *  the next packet will be send).
> + *  The offset of the descriptor starting from tail (0 is the last written
> + *  descriptor).
>    *
>    * @return
>    *  - (RTE_ETH_TX_DESC_FULL) Descriptor is being processed by the hw, i.e.

The patch lacks explanation why it was wrong before and why it is
correct after the patch.

I think there is a space here for description improvements since it is
still confusing. I'd suggest to remove 'tail' term from the description or
write down full description to explain what/where is head and tail.

Rx case:

  UNAVAIL     DONE        AVAIL        UNUSED

i.e. V points to the next packet to be received by the driver, i.e. the 
first *
(the descriptor is done by HW and packet is ready to be processed).
DONE(*) are descriptors filled in by HW, but not processed by the driver 
AVAIL(-) are available for HW to fill in with received packets.
UNUSED(0) (right now it is UNAVAIL as well) are descriptors which can be
done AVAIL on Rx queue refill
UNAVAIL(=) are reserved Rx ring space which cannot be used

The key question for Rx is the length of DONE. Is CPU fast enough to
handle incoming traffic?

Tx case (where is tail V and why):

  UNAVAIL     DONE          FULL       UNUSED

DONE(*) are descriptors processed by HW and should be processed by the 
driver to
free associated mbuf (rte_eth_tx_done_cleanup())
FULL(-) are available for HW to send these packets out, but not 
processed yet.
UNUSED(0) is available space in Tx ring to make it FULL
UNAVAIL(=) is reserved Tx ring space which cannot be used

I'd say that it should be similar to Rx here, but it looks different in 
accordance with
current description. Above patch fixes it from the first '-' (or the 
first '0'?) to be
the last '-'.

What is the main question for Tx status descriptor user?

More information about the dev mailing list