[dpdk-dev] [RFC] ethdev: support Tx queue free descriptor query

Konstantin Ananyev konstantin.ananyev at huawei.com
Fri Jan 5 12:12:46 CET 2024



> -----Original Message-----
> From: Thomas Monjalon <thomas at monjalon.net>
> Sent: Friday, January 5, 2024 10:04 AM
> To: Jerin Jacob <jerinjacobk at gmail.com>
> Cc: Dumitrescu, Cristian <cristian.dumitrescu at intel.com>; Konstantin Ananyev <konstantin.ananyev at huawei.com>;
> jerinj at marvell.com; dev at dpdk.org; Ferruh Yigit <ferruh.yigit at amd.com>; Andrew Rybchenko <andrew.rybchenko at oktetlabs.ru>;
> ferruh.yigit at xilinx.com; ajit.khaparde at broadcom.com; aboyer at pensando.io; Xing, Beilei <beilei.xing at intel.com>; Richardson, Bruce
> <bruce.richardson at intel.com>; chas3 at att.com; chenbo.xia at intel.com; Loftus, Ciara <ciara.loftus at intel.com>;
> dsinghrawat at marvell.com; Czeck, Ed <ed.czeck at atomicrules.com>; evgenys at amazon.com; grive at u256.net; g.singh at nxp.com;
> zhouguoyang at huawei.com; Wang, Haiyue <haiyue.wang at intel.com>; hkalra at marvell.com; heinrich.kuhn at corigine.com;
> hemant.agrawal at nxp.com; hyonkim at cisco.com; igorch at amazon.com; irusskikh at marvell.com; jgrajcia at cisco.com; Singh, Jasvinder
> <jasvinder.singh at intel.com>; jianwang at trustnetic.com; jiawenwu at trustnetic.com; Wu, Jingjing <jingjing.wu at intel.com>;
> johndale at cisco.com; john.miller at atomicrules.com; linville at tuxdriver.com; Wiles, Keith <keith.wiles at intel.com>;
> kirankumark at marvell.com; oulijun at huawei.com; lironh at marvell.com; longli at microsoft.com; mw at semihalf.com;
> spinler at cesnet.cz; matan at nvidia.com; Peters, Matt <matt.peters at windriver.com>; maxime.coquelin at redhat.com;
> mk at semihalf.com; humin (Q) <humin29 at huawei.com>; pnalla at marvell.com; ndabilpuram at marvell.com; Yang, Qiming
> <qiming.yang at intel.com>; Zhang, Qi Z <qi.z.zhang at intel.com>; radhac at marvell.com; rahul.lakkireddy at chelsio.com;
> rmody at marvell.com; Xu, Rosen <rosen.xu at intel.com>; sachin.saxena at oss.nxp.com; skoteshwar at marvell.com;
> shshaikh at marvell.com; shaibran at amazon.com; Siegel, Shepard <shepard.siegel at atomicrules.com>; asomalap at amd.com;
> somnath.kotur at broadcom.com; sthemmin at microsoft.com; Webster, Steven <steven.webster at windriver.com>;
> skori at marvell.com; mtetsuyah at gmail.com; vburru at marvell.com; viacheslavo at nvidia.com; Wang, Xiao W
> <xiao.w.wang at intel.com>; Wangxiaoyun (Cloud) <cloud.wangxiaoyun at huawei.com>; Zhuangyuzeng (Yisen)
> <yisen.zhuang at huawei.com>; Wang, Yong <yongwang at vmware.com>; Xuanziyang (William) <william.xuanziyang at huawei.com>
> Subject: Re: [dpdk-dev] [RFC] ethdev: support Tx queue free descriptor query
> 
> 05/01/2024 10:57, Jerin Jacob:
> > On Thu, Jan 4, 2024 at 11:59 PM Thomas Monjalon <thomas at monjalon.net> wrote:
> > >
> > > 04/01/2024 15:21, Konstantin Ananyev:
> > > >
> > > > > > > Introduce a new API to retrieve the number of available free 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.
> > > > > > >
> > > > > > > Signed-off-by: Jerin Jacob <jerinj at marvell.com>
> > > > > >
> > > > > > I think having an API to get the number of free descriptors per queue is a good idea. Why have it only for TX queues and not
> for RX
> > > > > queues as well?
> > > > >
> > > > > I see no harm in adding for Rx as well. I think, it is better to have
> > > > > separate API for each instead of adding argument as it is fast path
> > > > > API.
> > > > > If so, we could add a new API when there is any PMD implementation or
> > > > > need for this.
> > > >
> > > > I think for RX we already have similar one:
> > > > /** @internal Get number of used descriptors on a receive queue. */
> > > > typedef uint32_t (*eth_rx_queue_count_t)(void *rxq);
> > >
> > > rte_eth_rx_queue_count() gives the number of Rx used descriptors
> > > rte_eth_rx_descriptor_status() gives the status of one Rx descriptor
> > > rte_eth_tx_descriptor_status() gives the status of one Tx descriptor
> > >
> > > This patch is adding a function to get Tx available descriptors,
> > > rte_eth_tx_queue_free_desc_get().
> > > I can see a symmetry with rte_eth_rx_queue_count().
> > > For consistency I would rename it to rte_eth_tx_queue_free_count().
> > >
> > > Should we add rte_eth_tx_queue_count() and rte_eth_rx_queue_free_count()?
> >
> > IMO, rte_eth_rx_queue_free_count() is enough as
> > used count =  total desc number(configured via nb_tx_desc with
> > rte_eth_tx_queue_setup())  - free count
> 
> I'm fine with that.
> 

Yep, agree.
If we ever need  rte_eth_rx_queue_free_count() and rte_eth_tx_queue_used_count(),
it could be done via slow-path as Jerin outlined above, no need to waste entries in fp_ops
for that.



More information about the dev mailing list