From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id C9CA843819;
	Thu,  4 Jan 2024 19:29:37 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 9479D402CB;
	Thu,  4 Jan 2024 19:29:37 +0100 (CET)
Received: from wnew4-smtp.messagingengine.com (wnew4-smtp.messagingengine.com
 [64.147.123.18]) by mails.dpdk.org (Postfix) with ESMTP id 592634029A
 for <dev@dpdk.org>; Thu,  4 Jan 2024 19:29:36 +0100 (CET)
Received: from compute5.internal (compute5.nyi.internal [10.202.2.45])
 by mailnew.west.internal (Postfix) with ESMTP id 955202B0037B;
 Thu,  4 Jan 2024 13:29:28 -0500 (EST)
Received: from mailfrontend1 ([10.202.2.162])
 by compute5.internal (MEProxy); Thu, 04 Jan 2024 13:29:35 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=
 cc:cc:content-transfer-encoding:content-type:content-type:date
 :date:from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:subject:subject:to:to; s=fm2; t=1704392968;
 x=1704400168; bh=QQTOXDxmzL9m/oEUsumG/TiJ1rkf3acMtXUaKrixgh8=; b=
 pcLZmK5sWF8PKc3L2NiC+0j8ziFqdO/7FEo6AQkVEWwOhJpTsHSwvPZ3B5NrFaPy
 7pTNxgQAyulPNzpg8621A6taDY+pQXEnp5VVcIKYktUfCng7/mxp6pa6zEB15o89
 wLCPrV3/YjZ1x/ZtIY25doNmXbx10v4EdoBIId/p5eQhEb8fJG/4QpSE6VTYK6s+
 FUvHytacWGPpZxC3PfCYgKJ3W8pcwhmGPHFepMDpghHtFnac2c4jlb2ndxDFEyoA
 QCX2xsaM9JEYgagWwx4izxQlTKIFWkeu50Vy+R1SsYdDOj/Wn3vXftEzmPKAiXo5
 ytMORhbSKbKgvyto2Qrs8g==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy
 :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1704392968; x=
 1704400168; bh=QQTOXDxmzL9m/oEUsumG/TiJ1rkf3acMtXUaKrixgh8=; b=0
 f5gVezA3Y9VlhyPvLKidhUp0UtFOBiYpWjUxopUZCWVAqzaHoVIBUw7snhETt0XE
 L0vCKfRmtCKA4/WjT6SzwyeR8HgNKBu5WFZHWci8qprp7reZo13Umt/6/eZ4dgnO
 6U322zJh093qJ/9jR41tQR4ug+z3azk+d5wVsQmqgqni346EurpS2FJRQOFwzPgF
 /VGSeZlHqvn6oNjklyf6zkJWiNCaxW7doyQR9JbhLOHDQgFDFO3+RJydiaA6EM99
 avtQcHtdcA/3UkzQehvhfxliYduDY4rPAPjEHiGa0KvCIAb+KOM2JDhlKCGrKDm6
 jpSD6n5hXfY8WNxcGwrag==
X-ME-Sender: <xms:BvmWZe5-YCiowxhh7iF45oMnoxNZSnDwl3ksBNir0z6za-GHW0IU4A>
 <xme:BvmWZX77fZIoUwAQiDKbt4gweJuD4mKtzf_qQYXR3IUiU1rVj8Y5juF-egQtgmjpb
 ufQSSUMjvZguc2KVg>
X-ME-Received: <xmr:BvmWZdegH6NkcJMlNn9RemsSnVJDUQgREDHDI4z9z1YvYf55-Izt1vkFGb1zj3Oa-Bli6uiFr5C50gu0l4z5N4AC1A>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdegjedguddufecutefuodetggdotefrod
 ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh
 necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd
 enucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhho
 mhgrshcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqne
 cuggftrfgrthhtvghrnheptdejieeifeehtdffgfdvleetueeffeehueejgfeuteeftddt
 ieekgfekudehtdfgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh
 hfrhhomhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth
X-ME-Proxy: <xmx:BvmWZbIRENwJ6abTe7gCGLuSpYPbLyJqNK4KUFU9PMSET3s6hJgJOQ>
 <xmx:BvmWZSI5GQstMTvpLB2NVJeGyh4VPpKZ5kEpzIt0umD8AXyzvmV7IQ>
 <xmx:BvmWZcx7UAvS2OoExwLd_ie3enui7QEz1pqejet_krkLdNqt06Figg>
 <xmx:CPmWZVXURA7jIsHzRPf2YU5E6xvYx8OhFZG750uH04eCqcYI65TpLG8rPxM>
Feedback-ID: i47234305:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu,
 4 Jan 2024 13:29:18 -0500 (EST)
From: Thomas Monjalon <thomas@monjalon.net>
To: Jerin Jacob <jerinjacobk@gmail.com>,
 "Dumitrescu, Cristian" <cristian.dumitrescu@intel.com>,
 Konstantin Ananyev <konstantin.ananyev@huawei.com>
Cc: "jerinj@marvell.com" <jerinj@marvell.com>, "dev@dpdk.org" <dev@dpdk.org>, 
 Ferruh Yigit <ferruh.yigit@amd.com>,
 Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
 "ferruh.yigit@xilinx.com" <ferruh.yigit@xilinx.com>,
 "ajit.khaparde@broadcom.com" <ajit.khaparde@broadcom.com>,
 "aboyer@pensando.io" <aboyer@pensando.io>, "Xing,
 Beilei" <beilei.xing@intel.com>, "Richardson,
 Bruce" <bruce.richardson@intel.com>, "chas3@att.com" <chas3@att.com>,
 "chenbo.xia@intel.com" <chenbo.xia@intel.com>, "Loftus,
 Ciara" <ciara.loftus@intel.com>,
 "dsinghrawat@marvell.com" <dsinghrawat@marvell.com>, "Czeck,
 Ed" <ed.czeck@atomicrules.com>, "evgenys@amazon.com" <evgenys@amazon.com>,
 "grive@u256.net" <grive@u256.net>, "g.singh@nxp.com" <g.singh@nxp.com>,
 "zhouguoyang@huawei.com" <zhouguoyang@huawei.com>, "Wang,
 Haiyue" <haiyue.wang@intel.com>, "hkalra@marvell.com" <hkalra@marvell.com>,
 "heinrich.kuhn@corigine.com" <heinrich.kuhn@corigine.com>,
 "hemant.agrawal@nxp.com" <hemant.agrawal@nxp.com>,
 "hyonkim@cisco.com" <hyonkim@cisco.com>,
 "igorch@amazon.com" <igorch@amazon.com>,
 "irusskikh@marvell.com" <irusskikh@marvell.com>,
 "jgrajcia@cisco.com" <jgrajcia@cisco.com>, "Singh,
 Jasvinder" <jasvinder.singh@intel.com>,
 "jianwang@trustnetic.com" <jianwang@trustnetic.com>,
 "jiawenwu@trustnetic.com" <jiawenwu@trustnetic.com>, "Wu,
 Jingjing" <jingjing.wu@intel.com>,
 "johndale@cisco.com" <johndale@cisco.com>,
 "john.miller@atomicrules.com" <john.miller@atomicrules.com>,
 "linville@tuxdriver.com" <linville@tuxdriver.com>, "Wiles,
 Keith" <keith.wiles@intel.com>,
 "kirankumark@marvell.com" <kirankumark@marvell.com>,
 "oulijun@huawei.com" <oulijun@huawei.com>,
 "lironh@marvell.com" <lironh@marvell.com>,
 "longli@microsoft.com" <longli@microsoft.com>,
 "mw@semihalf.com" <mw@semihalf.com>,
 "spinler@cesnet.cz" <spinler@cesnet.cz>,
 "matan@nvidia.com" <matan@nvidia.com>, "Peters,
 Matt" <matt.peters@windriver.com>,
 "maxime.coquelin@redhat.com" <maxime.coquelin@redhat.com>,
 "mk@semihalf.com" <mk@semihalf.com>, "humin (Q)" <humin29@huawei.com>,
 "pnalla@marvell.com" <pnalla@marvell.com>,
 "ndabilpuram@marvell.com" <ndabilpuram@marvell.com>, "Yang,
 Qiming" <qiming.yang@intel.com>, "Zhang, Qi Z" <qi.z.zhang@intel.com>,
 "radhac@marvell.com" <radhac@marvell.com>,
 "rahul.lakkireddy@chelsio.com" <rahul.lakkireddy@chelsio.com>,
 "rmody@marvell.com" <rmody@marvell.com>, "Xu, Rosen" <rosen.xu@intel.com>,
 "sachin.saxena@oss.nxp.com" <sachin.saxena@oss.nxp.com>,
 "skoteshwar@marvell.com" <skoteshwar@marvell.com>,
 "shshaikh@marvell.com" <shshaikh@marvell.com>,
 "shaibran@amazon.com" <shaibran@amazon.com>, "Siegel,
 Shepard" <shepard.siegel@atomicrules.com>,
 "asomalap@amd.com" <asomalap@amd.com>,
 "somnath.kotur@broadcom.com" <somnath.kotur@broadcom.com>,
 "sthemmin@microsoft.com" <sthemmin@microsoft.com>, "Webster,
 Steven" <steven.webster@windriver.com>,
 "skori@marvell.com" <skori@marvell.com>,
 "mtetsuyah@gmail.com" <mtetsuyah@gmail.com>,
 "vburru@marvell.com" <vburru@marvell.com>,
 "viacheslavo@nvidia.com" <viacheslavo@nvidia.com>, "Wang,
 Xiao W" <xiao.w.wang@intel.com>,
 "Wangxiaoyun (Cloud)" <cloud.wangxiaoyun@huawei.com>,
 "Zhuangyuzeng (Yisen)" <yisen.zhuang@huawei.com>, "Wang,
 Yong" <yongwang@vmware.com>,
 "Xuanziyang (William)" <william.xuanziyang@huawei.com>
Subject: Re: [dpdk-dev] [RFC] ethdev: support Tx queue free descriptor query
Date: Thu, 04 Jan 2024 19:29:16 +0100
Message-ID: <852198449.0ifERbkFSE@thomas>
In-Reply-To: <72c8a6a8001e48159f4bbeac44847f26@huawei.com>
References: <20231219172948.3909749-1-jerinj@marvell.com>
 <CALBAE1OnY5n4UPT8Jnj4D16soXUktSjXqs8gxpJNf0LACFXSQg@mail.gmail.com>
 <72c8a6a8001e48159f4bbeac44847f26@huawei.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

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@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()?