From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 60B9743817; Thu, 4 Jan 2024 14:16:10 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 505754064A; Thu, 4 Jan 2024 14:16:10 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by mails.dpdk.org (Postfix) with ESMTP id 26139402C7 for ; Thu, 4 Jan 2024 14:16:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1704374169; x=1735910169; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=bGUGbKlaI3PKzoqLGFlHco+BegZrnhel5Zf4pnerVnk=; b=Le2G8HabLEYkpf8XdkITqDDOjeQ4/SSIf7YKNqfWU2M/ooZi0ikSueP+ bvtVci11WQytMLbnCSpcSaiLdtT7YkLCxkgQFOwUvT3D6RRfTBnppR2A9 gYWTgsVQCAyTiK6tNcpH33oKbVMP9ylVdLPFoyGrmy5GT1kwS2AyP3ZHd p1hTuqN0U+Yy0idDdowhYdcX0nc1wFvqgiDMmajTyJ+U4eYO7FRPK5jX5 5aKAAjCNx5Pr9iKmHcNjN1C7qJYkpp8G2WxVIUf8fu6gerTd1tp7djime FSE+xCPhoPvy04LhKmPOJRqKywLbF5f1mJKR7y/l28TrBp1RzZYU+VA5b w==; X-IronPort-AV: E=McAfee;i="6600,9927,10942"; a="10624066" X-IronPort-AV: E=Sophos;i="6.04,330,1695711600"; d="scan'208";a="10624066" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jan 2024 05:16:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10942"; a="809223023" X-IronPort-AV: E=Sophos;i="6.04,330,1695711600"; d="scan'208";a="809223023" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by orsmga008.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 04 Jan 2024 05:16:06 -0800 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 4 Jan 2024 05:16:06 -0800 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 4 Jan 2024 05:16:05 -0800 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Thu, 4 Jan 2024 05:16:05 -0800 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.169) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Thu, 4 Jan 2024 05:16:05 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ROPGSk28KGFNCghKiEUuyuyDYFYs1PvK8ojkoSe3kBbOLvTK3Sgo4T/lFV2pMKaAF5nvw2bZdP5qnfCvVSkSTyRrQw3Pewd3Ts1D51y5DqyAt4i7/naSCGOup0xNSjbdFurgdZ0OVoRsiE82iTsA8wn+yn8eVgimoAAlxt5a+In5essRDbuZkg0qOzHfHs9+VZMH2fBxBwr9HXYkwm4xl6ILl1jXlGAqC4KT2XkIjaYKxxq/NHcttnL3Sv5H4jd0vAsBKOcxj8HnRyFMBo+YkJQ0zBYvGc46y5+Ko9IHpW8xWh3dZtK/xJN2AyMIL7PagLHKGLUKbGNCGECTG69FlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=KHUmJ0om0tXbhE4cu8vObWwRnk7FdGWfQee0XFjKtLQ=; b=f2H5qnu+RvRU6A86RuYe0gFjUDm5ClgbfkQ7VGnw8gggrwTYH3lWh+jgYNCJc3pROzPgEQug2QimN2i/0xR1/221nwlG9Ya75CoDvMDN3zEIqBnwp9XzulzBXl3ckRp+eVbgtn98XqNv7hebpTR+WHh8ecxdDLoo4NvmgE8/qkzuYDTtSfCaqAT35sTqJQ0dPQYsKUcRHzm8caujnBC6A30WAlaiMzEXMPu1A7YDC9xYV0YDJNr5tbQUuOBTW2TNi8HKXOwY4VTGQaiUYnz/pYpuJtHygkrFKfiK1ZPH370JqQAHFIbkFjQfW/PJYYrZF0u2qGWObGORsePOZfas5Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from DS0PR11MB7442.namprd11.prod.outlook.com (2603:10b6:8:14d::22) by PH7PR11MB8501.namprd11.prod.outlook.com (2603:10b6:510:308::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.15; Thu, 4 Jan 2024 13:16:01 +0000 Received: from DS0PR11MB7442.namprd11.prod.outlook.com ([fe80::4421:19db:68bf:7d3d]) by DS0PR11MB7442.namprd11.prod.outlook.com ([fe80::4421:19db:68bf:7d3d%3]) with mapi id 15.20.7159.013; Thu, 4 Jan 2024 13:16:01 +0000 From: "Dumitrescu, Cristian" To: "jerinj@marvell.com" , "dev@dpdk.org" , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko CC: "ferruh.yigit@xilinx.com" , "ajit.khaparde@broadcom.com" , "aboyer@pensando.io" , "Xing, Beilei" , "Richardson, Bruce" , "chas3@att.com" , "chenbo.xia@intel.com" , "Loftus, Ciara" , "dsinghrawat@marvell.com" , "Czeck, Ed" , "evgenys@amazon.com" , "grive@u256.net" , "g.singh@nxp.com" , "zhouguoyang@huawei.com" , "Wang, Haiyue" , "hkalra@marvell.com" , "heinrich.kuhn@corigine.com" , "hemant.agrawal@nxp.com" , "hyonkim@cisco.com" , "igorch@amazon.com" , "irusskikh@marvell.com" , "jgrajcia@cisco.com" , "Singh, Jasvinder" , "jianwang@trustnetic.com" , "jiawenwu@trustnetic.com" , "Wu, Jingjing" , "johndale@cisco.com" , "john.miller@atomicrules.com" , "linville@tuxdriver.com" , "Wiles, Keith" , "kirankumark@marvell.com" , "oulijun@huawei.com" , "lironh@marvell.com" , "longli@microsoft.com" , "mw@semihalf.com" , "spinler@cesnet.cz" , "matan@nvidia.com" , "Peters, Matt" , "maxime.coquelin@redhat.com" , "mk@semihalf.com" , "humin29@huawei.com" , "pnalla@marvell.com" , "ndabilpuram@marvell.com" , "Yang, Qiming" , "Zhang, Qi Z" , "radhac@marvell.com" , "rahul.lakkireddy@chelsio.com" , "rmody@marvell.com" , "Xu, Rosen" , "sachin.saxena@oss.nxp.com" , "skoteshwar@marvell.com" , "shshaikh@marvell.com" , "shaibran@amazon.com" , "Siegel, Shepard" , "asomalap@amd.com" , "somnath.kotur@broadcom.com" , "sthemmin@microsoft.com" , "Webster, Steven" , "skori@marvell.com" , "mtetsuyah@gmail.com" , "vburru@marvell.com" , "viacheslavo@nvidia.com" , "Wang, Xiao W" , "cloud.wangxiaoyun@huawei.com" , "yisen.zhuang@huawei.com" , "Wang, Yong" , "xuanziyang2@huawei.com" Subject: RE: [dpdk-dev] [RFC] ethdev: support Tx queue free descriptor query Thread-Topic: [dpdk-dev] [RFC] ethdev: support Tx queue free descriptor query Thread-Index: AQHaMqEzC3RT4sE4RkCcaXpvTr1sG7DJum2A Date: Thu, 4 Jan 2024 13:16:00 +0000 Message-ID: References: <20231219172948.3909749-1-jerinj@marvell.com> In-Reply-To: <20231219172948.3909749-1-jerinj@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DS0PR11MB7442:EE_|PH7PR11MB8501:EE_ x-ms-office365-filtering-correlation-id: ffc08a48-3874-48e0-8e4d-08dc0d274bee x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: pWkZ4xAW4+81fAYClIbhstQXKySGs0UlJDaRijAnTSpTLCAoPDlQRm/UGgJncCSDqna6Tsa0n57g3nF67IyxVWlKnkeUqO7nFp5ehTpsA+7YEASfIK+94ANCmXcn91Osz7jR5n5s8C122+KKgImZ1Dc0JLiPj1EK/YeSetAxH3VbE7AE1vx3NI1mPmd88cP97KpPb7P+UtovK5OvSpM0SuW3LfNY7eBKR/E1djLd90XTT5IeUgH8fEtxafIiNWRY1cHtcEic9VjD6tWihcknxng5xXYFJQG6TzwUmvPjhHFEJCA1Kf2GRVqAPS/HC61RJ139hYmqLxEzktWj3lJNYR7oJIhtePOyrFYn25zu3ernBybvbNJYIwaVLg6gpm47ahXc4gJTegl8uE+mrvQ9ksS4krw6XxfBsoQmP9cr6nqss4uQlat11+RHDxhmdh3WALXFmd8/sYbz18AuCwb4XQ/D3D1VSohRhqksbfxECicnx72MQK0GA5/OiXM4JCslIwKWRdqEtUqrZA+RLnmrV44hNmtDKA/dklrZyrcTawcwCSVt6oMTo5Pz6nhwW77E6fya8SJ8++6Y+BLt3jLn/rmtJ/pZY4zCUrtL1sDZOs1vfhZ06xfpuNHESAmD8o3Ty6iRw038E8aUO8ff7horut2S2kA59WyhdFygvbp6aRo= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS0PR11MB7442.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(346002)(366004)(39860400002)(136003)(376002)(230173577357003)(230273577357003)(230922051799003)(64100799003)(186009)(451199024)(1800799012)(55016003)(71200400001)(53546011)(26005)(9686003)(7696005)(6506007)(478600001)(122000001)(38100700002)(33656002)(86362001)(82960400001)(2906002)(76116006)(7366002)(7406005)(41300700001)(7416002)(45080400002)(5660300002)(83380400001)(110136005)(66476007)(66446008)(64756008)(54906003)(316002)(66946007)(66556008)(52536014)(4326008)(8936002)(38070700009)(8676002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?6+UiO6wlHXHv1udo253TmaC0FOfqpOH6fBOLhPXkBAL4/0cXRsgZAxnMSjy9?= =?us-ascii?Q?knTfqKCxBru0QfxUS/o5wyIxJaP3ijKx1yVF8AFSAp7Rm0zyf+S5xl2oZqy7?= =?us-ascii?Q?5Qmd+zQV2s8kZxQEjn6k5t8EGiWS/uTIrbyk57g5lXDNtPgaVdhAiQFYhx34?= =?us-ascii?Q?DvfzMBWVMFhF5Mhc2yVNfWw71NJWmZjZzBNVe30t2jU03i03muKA+qys2ZMp?= =?us-ascii?Q?jG1NCG0dmJ/SXJatr2vNK5H35uQWbWSuMMbGLpdcATO150YhiMmbz3v44icB?= =?us-ascii?Q?cywv+CgSwG5OFgFVkF4wCmhvgMKEVoLgKDPcM+qELziQmN88UzfXfn285w9t?= =?us-ascii?Q?v5r4Loxp6KJEz92AQhrCkZ331sTvLRgSBVQyxo1zvyt54CdwR5jo2rp5pZ5M?= =?us-ascii?Q?EXHLtFa2aaaEATCQslgsh9mh0uoCYCeaFsZRcN30CCirqG/3eTaqYeZaVofK?= =?us-ascii?Q?XI5Bw1L4qbvmiHqvqr2BJ2fh+U0SSS2TltZnTfuAEESzMZpfqWD5d+IUas+o?= =?us-ascii?Q?ApkH8waV5umMMq3kdNZmA76UBYUD2HiB31gfDJsLJBPLyj/iPazijSacsKcd?= =?us-ascii?Q?CZvJtV9faMl6TEqJg2KD4RccltfOheUj92md/CA8rvT17G3y4WWWeV4RQGYU?= =?us-ascii?Q?7SsyAEcI1THS/zaeUavsvHtwvHqhAIUMAaQEG4rZLzlDdE6kg7vCcoVmzMGZ?= =?us-ascii?Q?GRR5gkIkQeps7ecT1h6WqZAL/1cOvtmrAf0PkVScnyYeAGdh1Ro+1OTwquSu?= =?us-ascii?Q?1jl3dcVhhIKosk3XhFoola8IJqkDIza2Oya5Hv9c2xjYh6ybDriM7fbFzCHr?= =?us-ascii?Q?MT/KUSze4qh13eEsCAwsd5/B2Hi1BPDnW0mEhZSkZfHLQ/cNRwvngzjYJAda?= =?us-ascii?Q?7AXY8JB72XzfygbcN3gtFgNq3hjKXhDQmASeHC/AgGvV9yhwEWxHsl8Fo/vd?= =?us-ascii?Q?OTcyty4swE/XLp3SHH9x+NUEI9lWWu7oyFJiexkuT9FN3PnpqRtl0M7M4+06?= =?us-ascii?Q?b8FhOLwrMY0eG0jzdV7eZ5FWIuY+7zYJj9gcpae21NI/UCHgFbj6ETp8axxn?= =?us-ascii?Q?gubNXgx4jdso99fm4mzQN38izxPMhr0mqd4AUyJKKml994cNtW49iWyarQvR?= =?us-ascii?Q?2quA6AdjpcJjf7fdw1GQuUUNbh53gK8kU3F1vqwQnr4q4n/On3z3h7PMUlNv?= =?us-ascii?Q?4D4hXbaQqx8WDzANkD8xlX6LbF3rjFyVk/JJlE3lXrJY9tvAFu88NSZCxEnW?= =?us-ascii?Q?26NxvmjYzC2RpJ3G12Qc0QBccu/N5VyqqF1sZ+AnNtRhvOPzD9U1Shx+DtlG?= =?us-ascii?Q?GtjoLFjcZS+2EPgz7mxlzXpisGFxuaKIvgY5Ct1KQKio1AzK79P4VAZUeqcy?= =?us-ascii?Q?VxGt46lhCs4nSVjeQJuyc0tR40cOLrtVVodI6BdwYQRy9md3600Bf+Hrs81o?= =?us-ascii?Q?Wex3UZ4hDkZjeq95DtcIk9ZsRxFXsyxMIbkAY5e4oLoRxz6F+AwdERIZusbL?= =?us-ascii?Q?gS72nUZaxzQPMGP/hcfQC8aG5NfUm9kq2QOEBtkRE9283DmOIdqshtby1+N7?= =?us-ascii?Q?BIMyM/cCgJjzWmdEQZTAFvQX2w8jsU4hKNqOvDPjU4Jbofs6Ezthv5xtl+bq?= =?us-ascii?Q?0g=3D=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7442.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ffc08a48-3874-48e0-8e4d-08dc0d274bee X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Jan 2024 13:16:00.7941 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 7vaAkzIb42IXwYUXLMx+aFHE3mJY3Fx/thrukyRnMuiyul2NIadDulEqQZ5mOr38rrB7o823n7lNEFvMqRVGIiOJ3J0NeS6kc5ggmBdwV10= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB8501 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org > -----Original Message----- > From: jerinj@marvell.com > Sent: Tuesday, December 19, 2023 5:30 PM > To: dev@dpdk.org; Thomas Monjalon ; Ferruh Yigit > ; Andrew Rybchenko > Cc: ferruh.yigit@xilinx.com; ajit.khaparde@broadcom.com; > aboyer@pensando.io; Xing, Beilei ; Richardson, Bru= ce > ; chas3@att.com; chenbo.xia@intel.com; Loftus= , > Ciara ; dsinghrawat@marvell.com; Czeck, Ed > ; evgenys@amazon.com; grive@u256.net; > g.singh@nxp.com; zhouguoyang@huawei.com; Wang, Haiyue > ; hkalra@marvell.com; heinrich.kuhn@corigine.com; > hemant.agrawal@nxp.com; hyonkim@cisco.com; igorch@amazon.com; > irusskikh@marvell.com; jgrajcia@cisco.com; Singh, Jasvinder > ; jianwang@trustnetic.com; > jiawenwu@trustnetic.com; Wu, Jingjing ; > johndale@cisco.com; john.miller@atomicrules.com; linville@tuxdriver.com; > Wiles, Keith ; kirankumark@marvell.com; > oulijun@huawei.com; lironh@marvell.com; longli@microsoft.com; > mw@semihalf.com; spinler@cesnet.cz; matan@nvidia.com; Peters, Matt > ; maxime.coquelin@redhat.com; > mk@semihalf.com; humin29@huawei.com; pnalla@marvell.com; > ndabilpuram@marvell.com; Yang, Qiming ; Zhang, Qi = Z > ; radhac@marvell.com; rahul.lakkireddy@chelsio.com; > rmody@marvell.com; Xu, Rosen ; > sachin.saxena@oss.nxp.com; skoteshwar@marvell.com; shshaikh@marvell.com; > shaibran@amazon.com; Siegel, Shepard ; > asomalap@amd.com; somnath.kotur@broadcom.com; > sthemmin@microsoft.com; Webster, Steven ; > skori@marvell.com; mtetsuyah@gmail.com; vburru@marvell.com; > viacheslavo@nvidia.com; Wang, Xiao W ; > cloud.wangxiaoyun@huawei.com; yisen.zhuang@huawei.com; Wang, Yong > ; xuanziyang2@huawei.com; Dumitrescu, Cristian > ; Jerin Jacob > Subject: [dpdk-dev] [RFC] ethdev: support Tx queue free descriptor query >=20 > From: Jerin Jacob >=20 > 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. >=20 > A notable use case could be implementing Random Early Discard (RED) > in software based on Tx queue occupancy. >=20 > Signed-off-by: Jerin Jacob > --- > doc/guides/nics/features.rst | 10 ++++ > doc/guides/nics/features/default.ini | 1 + > lib/ethdev/ethdev_trace_points.c | 3 ++ > lib/ethdev/rte_ethdev.h | 78 ++++++++++++++++++++++++++++ > lib/ethdev/rte_ethdev_core.h | 7 ++- > lib/ethdev/rte_ethdev_trace_fp.h | 8 +++ > 6 files changed, 106 insertions(+), 1 deletion(-) >=20 > diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst > index f7d9980849..9d6655473a 100644 > --- a/doc/guides/nics/features.rst > +++ b/doc/guides/nics/features.rst > @@ -962,6 +962,16 @@ management (see :doc:`../prog_guide/power_man` for > more details). >=20 > * **[implements] eth_dev_ops**: ``get_monitor_addr`` >=20 > +.. _nic_features_tx_queue_free_desc_query: > + > +Tx queue free descriptor query > +------------------------------ > + > +Supports to get the number of free descriptors in a Tx queue. > + > +* **[implements] eth_dev_ops**: ``tx_queue_free_desc_get``. > +* **[related] API**: ``rte_eth_tx_queue_free_desc_get()``. > + > .. _nic_features_other: >=20 > Other dev ops not represented by a Feature > diff --git a/doc/guides/nics/features/default.ini > b/doc/guides/nics/features/default.ini > index 806cb033ff..b30002b1c1 100644 > --- a/doc/guides/nics/features/default.ini > +++ b/doc/guides/nics/features/default.ini > @@ -59,6 +59,7 @@ Packet type parsing =3D > Timesync =3D > Rx descriptor status =3D > Tx descriptor status =3D > +Tx free descriptor query =3D > Basic stats =3D > Extended stats =3D > Stats per queue =3D > diff --git a/lib/ethdev/ethdev_trace_points.c b/lib/ethdev/ethdev_trace_p= oints.c > index 91f71d868b..346f37f2e4 100644 > --- a/lib/ethdev/ethdev_trace_points.c > +++ b/lib/ethdev/ethdev_trace_points.c > @@ -481,6 +481,9 @@ > RTE_TRACE_POINT_REGISTER(rte_eth_trace_count_aggr_ports, > RTE_TRACE_POINT_REGISTER(rte_eth_trace_map_aggr_tx_affinity, > lib.ethdev.map_aggr_tx_affinity) >=20 > +RTE_TRACE_POINT_REGISTER(rte_eth_trace_tx_queue_free_desc_get, > + lib.ethdev.tx_queue_free_desc_get) > + > RTE_TRACE_POINT_REGISTER(rte_flow_trace_copy, > lib.ethdev.flow.copy) >=20 > diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h > index 77331ce652..033fcb8c9b 100644 > --- a/lib/ethdev/rte_ethdev.h > +++ b/lib/ethdev/rte_ethdev.h > @@ -6802,6 +6802,84 @@ rte_eth_recycle_mbufs(uint16_t rx_port_id, uint16_= t > rx_queue_id, > __rte_experimental > int rte_eth_buffer_split_get_supported_hdr_ptypes(uint16_t port_id, uint= 32_t > *ptypes, int num); >=20 > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change, or be removed, without prior no= tice > + * > + * Get the number of free descriptors in a Tx queue. > + * > + * This function retrieves the number of available free descriptors in a > + * transmit queue. Applications can use this API in the fast path to ins= pect > + * Tx queue occupancy and take appropriate actions based on the availabl= e > + * free descriptors. An example action could be implementing the > + * Random Early Discard (RED). > + * > + * If there are no packets in the Tx queue, the function returns the val= ue > + * of `nb_tx_desc` provided during the initialization of the Tx queue us= ing > + * rte_eth_tx_queue_setup(), signifying that all descriptors are free. > + * > + * @param port_id > + * The port identifier of the device. > + * @param tx_queue_id > + * The index of the transmit queue. > + * The value must be in the range [0, nb_tx_queue - 1] previously supp= lied > + * to rte_eth_dev_configure(). > + * @return > + * - (<=3D UINT16_MAX) Number of free descriptors in a Tx queue > + * - (> UINT16_MAX) if error. Enabled only when RTE_ETHDEV_DEBUG_TX is > enabled > + * > + * @note This function is designed for fast-path use. > + * > + */ > +__rte_experimental > +static inline uint32_t > +rte_eth_tx_queue_free_desc_get(uint16_t port_id, uint16_t tx_queue_id) > +{ > + struct rte_eth_fp_ops *fops; > + uint32_t rc; > + void *qd; > + > +#ifdef RTE_ETHDEV_DEBUG_TX > + rc =3D UINT32_MAX; > + if (port_id >=3D RTE_MAX_ETHPORTS || tx_queue_id >=3D > RTE_MAX_QUEUES_PER_PORT) { > + RTE_ETHDEV_LOG(ERR, "Invalid port_id=3D%u or > tx_queue_id=3D%u\n", > + port_id, tx_queue_id); > + > + rte_eth_trace_tx_queue_free_desc_get(port_id, tx_queue_id, > rc); > + return rc; > + } > +#endif > + > + /* Fetch pointer to Tx queue data */ > + fops =3D &rte_eth_fp_ops[port_id]; > + qd =3D fops->txq.data[tx_queue_id]; > + > +#ifdef RTE_ETHDEV_DEBUG_TX > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0); > + > + if (qd =3D=3D NULL) { > + RTE_ETHDEV_LOG(ERR, "Invalid Tx queue_id=3D%u for > port_id=3D%u\n", > + tx_queue_id, port_id); > + > + rte_eth_trace_tx_queue_free_desc_get(port_id, tx_queue_id, > rc); > + return rc; > + } > + > + if (fops->tx_queue_free_desc_get =3D=3D NULL) { > + RTE_ETHDEV_LOG(ERR, "tx_queue_free_desc_get callback not > implementedd Tx queue_id=3D%u for port_id=3D%u\n", > + tx_queue_id, port_id); > + > + rte_eth_trace_tx_queue_free_desc_get(port_id, tx_queue_id, > rc); > + return rc; > + } > +#endif > + rc =3D fops->tx_queue_free_desc_get(qd); > + > + rte_eth_trace_tx_queue_free_desc_get(port_id, tx_queue_id, rc); > + > + return rc; > +} > + > #ifdef __cplusplus > } > #endif > diff --git a/lib/ethdev/rte_ethdev_core.h b/lib/ethdev/rte_ethdev_core.h > index 4bfaf79c6c..5b7ee66ee7 100644 > --- a/lib/ethdev/rte_ethdev_core.h > +++ b/lib/ethdev/rte_ethdev_core.h > @@ -60,6 +60,9 @@ typedef uint16_t (*eth_recycle_tx_mbufs_reuse_t)(void > *txq, > /** @internal Refill Rx descriptors with the recycling mbufs */ > typedef void (*eth_recycle_rx_descriptors_refill_t)(void *rxq, uint16_t = nb); >=20 > +/** @internal Get the number of free descriptors count of a Tx queue */ > +typedef uint16_t (*eth_tx_queue_free_desc_get_t)(void *txq); > + > /** > * @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 free descriptors count of a Tx queue. */ > + eth_tx_queue_free_desc_get_t tx_queue_free_desc_get; > + uintptr_t reserved2[1]; > /**@}*/ >=20 > } __rte_cache_aligned; > diff --git a/lib/ethdev/rte_ethdev_trace_fp.h b/lib/ethdev/rte_ethdev_tra= ce_fp.h > index 186271c9ff..2c57b39bd2 100644 > --- a/lib/ethdev/rte_ethdev_trace_fp.h > +++ b/lib/ethdev/rte_ethdev_trace_fp.h > @@ -73,6 +73,14 @@ RTE_TRACE_POINT_FP( > rte_trace_point_emit_u64(count); > ) >=20 > +RTE_TRACE_POINT_FP( > + rte_eth_trace_tx_queue_free_desc_get, > + RTE_TRACE_POINT_ARGS(uint16_t port_id, uint16_t tx_queue_id, > uint32_t nb_free_desc), > + rte_trace_point_emit_u16(port_id); > + rte_trace_point_emit_u16(tx_queue_id); > + rte_trace_point_emit_u32(nb_free_desc); > +) > + > #ifdef __cplusplus > } > #endif > -- > 2.43.0 Hi Jerin, 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? Regards, Cristian