DPDK patches and discussions
 help / color / mirror / Atom feed
From: Olivier Matz <olivier.matz@6wind.com>
To: "Richardson, Bruce" <bruce.richardson@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"thomas.monjalon@6wind.com" <thomas.monjalon@6wind.com>,
	"Ananyev, Konstantin" <konstantin.ananyev@intel.com>,
	"Lu, Wenzhuo" <wenzhuo.lu@intel.com>,
	"Zhang, Helin" <helin.zhang@intel.com>
Subject: Re: [dpdk-dev] [RFC 0/9] get Rx and Tx used descriptors
Date: Tue, 17 Jan 2017 09:24:10 +0100	[thread overview]
Message-ID: <20170117092410.5f5950d7@platinum> (raw)
In-Reply-To: <59AF69C657FD0841A61C55336867B5B035B88D5D@IRSMSX103.ger.corp.intel.com>

Hi,

Thanks Bruce for the comments.

On Fri, 13 Jan 2017 17:32:38 +0000, "Richardson, Bruce"
<bruce.richardson@intel.com> wrote:
> > -----Original Message-----
> > From: Olivier Matz [mailto:olivier.matz@6wind.com]
> > Sent: Friday, January 13, 2017 4:44 PM
> > To: dev@dpdk.org
> > Cc: thomas.monjalon@6wind.com; Ananyev, Konstantin
> > <konstantin.ananyev@intel.com>; Lu, Wenzhuo <wenzhuo.lu@intel.com>;
> > Zhang, Helin <helin.zhang@intel.com>; Richardson, Bruce
> > <bruce.richardson@intel.com>
> > Subject: Re: [dpdk-dev] [RFC 0/9] get Rx and Tx used descriptors
> > 
> > Hi,
> > 
> > On Thu, 24 Nov 2016 10:54:12 +0100, Olivier Matz
> > <olivier.matz@6wind.com> wrote:  
> > > This RFC patchset introduces a new ethdev API function
> > > rte_eth_tx_queue_count() which is the tx counterpart of
> > > rte_eth_rx_queue_count(). It implements this API on some Intel
> > > drivers for reference, and it also optimizes the implementation of
> > > rte_eth_rx_queue_count().
> > >  
> > 
> > I'm planning to send a new version of this patchset, fixing the
> > issues seen by Ferruh, plus a bug fix in the e1000 implementation.
> > 
> > Does anyone have any comment about the new API or about questions
> > raised in the cover letter? Especially about the real meaning of
> > "used descriptor": should it include the descriptors hold by the
> > driver?  
> For TX, I think we just need used/unused, since for TX any driver
> will reuse a slot that has been completed by the NIC, and doesn't
> hold the mbufs back for buffering at all.

Agree

> For RX, strictly speaking, we should have three categories, rather
> than trying to work it into 2. I don't see why we can't report a slot
> as used/unused/unavailable.

With the rte_eth_rx_queue_count() API, we don't have this opportunity
since it just returns an int.

Something I found a bit strange when doing this patchset is that the
user does not have the full control of the number of hold buffers. With
default parameters, the effective size of a ring of 128 is 64.

So it is, we could introduce an API to retrieve the status:
used/unused/unavailable.

> > Any comment about the method (binary search to find the used
> > descriptors)?  
> 
> I think binary search should work ok, though linear search may work
> better for smaller ranges as we can prefetch ahead since we know what
> we will check next. Linear can also go backward only if we want
> accuracy (going forward risks having race conditions between read and
> NIC write). Overall, though I think binary search should work well
> enough.
> 
> > 
> > I'm also wondering about adding rte_eth_tx_descriptor_done() in the
> > API at the same time.
> >   
> 
> Let me switch the question around - do we need the queue_count APIs at
> all, and is it not more efficient to just supply the
> descriptor_done() APIs? If an app wants to know the use of the ring,
> and take some action based on it, that app is going to have one or
> more thresholds for taking the action, right? In that case, rather
> than scanning descriptors to find the absolute number of free/used
> descriptors, it would be more efficient for the app to just check the
> descriptor on the threshold - and take action based just on that
> value. 

Yes, I reached the same conclusion (...after posting the RFC patchset
unfortunatly).

> Any app that really does need the absolute value of the ring
> capacity can presumably do its own binary search or linear search to
> determine the value itself. However, I think just doing a done
> function should encourage people to use the more efficient solution
> of just checking the minimum number of descriptors needed.


The question is: now that the work is done, is there any application
that would require this absolute values? For instance, monitoring.

If not, I have no problem to the patchset, I just need to validate my
application with a descriptor_done() API. In this case we can also
deprecate rx_queue_count() and tx_queue_count().

The rte_eth_rx_descriptor_done() function could be updated into:

/**
 * Check the status of a RX descriptor in the queue.
 *
 * @param port_id
 *  The port identifier of the Ethernet device.
 * @param queue_id
 *  The queue id on the specific port.
 * @param offset
 *  The offset of the descriptor ID from tail (0 is the next packet to
 *  be received by the driver).
 *  - (2) Descriptor is unavailable (hold by driver, not yet returned to hw)
 *  - (1) Descriptor is done (filled by hw, but not processed by the driver,
 *        i.e. in the receive queue)
 *  - (0) Descriptor is available for the hardware to receive a packet.
 *  - (-ENODEV) if *port_id* invalid.
 *  - (-ENOTSUP) if the device does not support this function
 */
 static inline int rte_eth_rx_descriptor_done(uint8_t port_id,
 	uint16_t queue_id, uint16_t offset)


A similar rte_eth_tx_descriptor_done() would be introduced:

/**
 * Check the status of a TX descriptor in the queue.
 *
 * @param port_id
 *  The port identifier of the Ethernet device.
 * @param queue_id
 *  The queue id on the specific port.
 * @param offset
 *  The offset of the descriptor ID from tail (0 is the place where the next
 *  packet will be send).
 *  - (1) Descriptor is beeing processed by the hw, i.e. in the transmit queue
 *  - (0) Descriptor is available for the driver to send a packet.
 *  - (-ENODEV) if *port_id* invalid.
 *  - (-ENOTSUP) if the device does not support this function
 */
 static inline int rte_eth_tx_descriptor_done(uint8_t port_id,
 	uint16_t queue_id, uint16_t offset)



An alternative would be to rename these functions in descriptor_status()
instead of descriptor_done().


Regards,
Olivier

  reply	other threads:[~2017-01-17  8:24 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-24  9:54 Olivier Matz
2016-11-24  9:54 ` [dpdk-dev] [RFC 1/9] ethdev: clarify api comments of rx queue count Olivier Matz
2016-11-24 10:52   ` Ferruh Yigit
2016-11-24 11:13     ` Olivier Matz
2016-11-24  9:54 ` [dpdk-dev] [RFC 2/9] ethdev: move queue id check in generic layer Olivier Matz
2016-11-24 10:59   ` Ferruh Yigit
2016-11-24 13:05     ` Olivier Matz
2016-11-24  9:54 ` [dpdk-dev] [RFC 3/9] ethdev: add handler for Tx queue descriptor count Olivier Matz
2016-11-24  9:54 ` [dpdk-dev] [RFC 4/9] net/ixgbe: optimize Rx " Olivier Matz
2016-11-24  9:54 ` [dpdk-dev] [RFC 5/9] net/ixgbe: add handler for Tx " Olivier Matz
2016-11-24  9:54 ` [dpdk-dev] [RFC 6/9] net/igb: optimize rx " Olivier Matz
2016-11-24  9:54 ` [dpdk-dev] [RFC 7/9] net/igb: add handler for tx " Olivier Matz
2016-11-24  9:54 ` [dpdk-dev] [RFC 8/9] net/e1000: optimize rx " Olivier Matz
2016-11-24  9:54 ` [dpdk-dev] [RFC 9/9] net/e1000: add handler for tx " Olivier Matz
2017-01-13 16:44 ` [dpdk-dev] [RFC 0/9] get Rx and Tx used descriptors Olivier Matz
2017-01-13 17:32   ` Richardson, Bruce
2017-01-17  8:24     ` Olivier Matz [this message]
2017-01-17 13:56       ` Bruce Richardson
2017-03-01 17:19 ` [dpdk-dev] [PATCH 0/6] get status of Rx and Tx descriptors Olivier Matz
2017-03-01 17:19   ` [dpdk-dev] [PATCH 1/6] ethdev: add descriptor status API Olivier Matz
2017-03-01 18:22     ` Andrew Rybchenko
2017-03-02 13:57       ` Olivier Matz
2017-03-02 14:19         ` Andrew Rybchenko
2017-03-02 14:54           ` Olivier Matz
2017-03-02 15:05             ` Andrew Rybchenko
2017-03-02 15:14               ` Olivier Matz
2017-03-01 17:19   ` [dpdk-dev] [PATCH 2/6] net/ixgbe: implement " Olivier Matz
2017-03-01 17:19   ` [dpdk-dev] [PATCH 3/6] net/e1000: implement descriptor status API (igb) Olivier Matz
2017-03-02  1:28     ` Lu, Wenzhuo
2017-03-02 13:58       ` Olivier Matz
2017-03-01 17:19   ` [dpdk-dev] [PATCH 4/6] net/e1000: implement descriptor status API (em) Olivier Matz
2017-03-02  1:22     ` Lu, Wenzhuo
2017-03-02 14:46       ` Olivier Matz
2017-03-03  1:15         ` Lu, Wenzhuo
2017-03-01 17:19   ` [dpdk-dev] [PATCH 5/6] net/mlx5: implement descriptor status API Olivier Matz
2017-03-02  7:56     ` Nélio Laranjeiro
2017-03-01 17:19   ` [dpdk-dev] [PATCH 6/6] net/i40e: " Olivier Matz
2017-03-01 18:02   ` [dpdk-dev] [PATCH 0/6] get status of Rx and Tx descriptors Andrew Rybchenko
2017-03-02 13:40     ` Olivier Matz
2017-03-06 10:41       ` Thomas Monjalon
2017-03-01 18:07   ` Stephen Hemminger
2017-03-02 13:43     ` Olivier Matz
2017-03-06 10:41       ` Thomas Monjalon
2017-03-02 15:32   ` Bruce Richardson
2017-03-02 16:14     ` Olivier Matz
2017-03-03 16:18       ` Venkatesan, Venky
2017-03-03 16:45         ` Olivier Matz
2017-03-03 18:46           ` Venkatesan, Venky
2017-03-04 20:45             ` Olivier Matz
2017-03-06 11:02               ` Thomas Monjalon
2017-03-07 15:59   ` [dpdk-dev] [PATCH v2 " Olivier Matz
2017-03-07 15:59     ` [dpdk-dev] [PATCH v2 1/6] ethdev: add descriptor status API Olivier Matz
2017-03-09 11:49       ` Andrew Rybchenko
2017-03-21  8:32       ` Yang, Qiming
2017-03-24 12:49         ` Olivier Matz
2017-03-27  1:28           ` Yang, Qiming
2017-03-07 15:59     ` [dpdk-dev] [PATCH v2 2/6] net/ixgbe: implement " Olivier Matz
2017-03-07 15:59     ` [dpdk-dev] [PATCH v2 3/6] net/e1000: implement descriptor status API (igb) Olivier Matz
2017-03-08  1:17       ` Lu, Wenzhuo
2017-03-07 15:59     ` [dpdk-dev] [PATCH v2 4/6] net/e1000: implement descriptor status API (em) Olivier Matz
2017-03-07 15:59     ` [dpdk-dev] [PATCH v2 5/6] net/mlx5: implement descriptor status API Olivier Matz
2017-03-07 15:59     ` [dpdk-dev] [PATCH v2 6/6] net/i40e: " Olivier Matz
2017-03-08  1:17       ` Lu, Wenzhuo
2017-03-29  8:36     ` [dpdk-dev] [PATCH v3 0/6] get status of Rx and Tx descriptors Olivier Matz
2017-03-29  8:36       ` [dpdk-dev] [PATCH v3 1/6] ethdev: add descriptor status API Olivier Matz
2017-03-29  8:36       ` [dpdk-dev] [PATCH v3 2/6] net/ixgbe: implement " Olivier Matz
2017-03-29  8:36       ` [dpdk-dev] [PATCH v3 3/6] net/e1000: implement descriptor status API (igb) Olivier Matz
2017-03-29  8:36       ` [dpdk-dev] [PATCH v3 4/6] net/e1000: implement descriptor status API (em) Olivier Matz
2017-03-29  8:36       ` [dpdk-dev] [PATCH v3 5/6] net/mlx5: implement descriptor status API Olivier Matz
2017-03-29  8:36       ` [dpdk-dev] [PATCH v3 6/6] net/i40e: " Olivier Matz
2017-03-30 13:30       ` [dpdk-dev] [PATCH v3 0/6] get status of Rx and Tx descriptors Thomas Monjalon
2017-04-19 15:50         ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170117092410.5f5950d7@platinum \
    --to=olivier.matz@6wind.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=helin.zhang@intel.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=thomas.monjalon@6wind.com \
    --cc=wenzhuo.lu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).