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 9BCB343863; Mon, 8 Jan 2024 11:54:52 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4344B40263; Mon, 8 Jan 2024 11:54:52 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 7A80940261 for ; Mon, 8 Jan 2024 11:54:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1704711290; x=1736247290; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=Vjpj8523VS7m4Gk2socXCh3I1cLSgckDoW/TM6KOcBM=; b=SPD2W9oCB/bWCGDRNLlp0ZftHBncxMCL2mHW8z3nPTzBGbg25a+o/BW/ jyHxIPgbQ6e9gkoDeQtIndAGtSPNMAgFtXCT+uG7F+OfIghiYDGaXA/zT q7l5MVaSTvQclhb4ILHsv7pCvmktkRlINJFToOuUWt2P7CtayGNwwKpty 7UhzfR6QtXsjNPo6nDpE39YpMcyBdxcAmiEkTKS0WwC22l56tqqOzYAN/ DdJVXKEH1nsi6rR2lgqYThdCpVD563d/LCZQDNwObq9cvkJ44Xmjs/sue az/s7IWV54VPfVVJ2z1J2hcZD2TIXRRmEoQdtndJsqkRZun9ZSHBmJUMW Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10946"; a="396731342" X-IronPort-AV: E=Sophos;i="6.04,340,1695711600"; d="scan'208";a="396731342" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2024 02:54:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,340,1695711600"; d="scan'208";a="15883263" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmviesa002.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 08 Jan 2024 02:54:45 -0800 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 8 Jan 2024 02:54:44 -0800 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Mon, 8 Jan 2024 02:54:44 -0800 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.168) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 8 Jan 2024 02:54:44 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f0T6dRRZByOQQSnqz4tSZzhTsTWKJDQOVrrGCrObodOWP2w/M3QyAHxKo2OaynoARGaSnuYPjKkVvChuXb3Xxm0q2JfKvF8VBW7YbbOxDQaB4V1x3A6zb1vmPQk8Lun8tcpTHUCmZLVx0C4Vfo9N1hxqSvJn9fA3qT3ufft+mCWwsZ4o0vaV3umpSburR8NbOcLRrMQJJVYzCIc0rfeqWwXJ/XHW5muRCb6TBx3GI9r1HMRC5wpQ3ncSoszVAsUahmtzgPQvzyQXLUIIXCArrpjwJ9kDfRCuTR314mMBU0YVIHjjYIiBSqFZkup1/9jHlWhu9w6OdHjRpFcg82aP+Q== 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=0KycGexXe0EoiQFaxY/6cf2MLZG4DjXe4XXyL5Xi48E=; b=U0/USQjYYv/B95wN7Roq3Pg/joAsApCunjs2hEweWWljtWX4xyyaC16mZV0Sh1oO5rs45T5SHI3u+65Qhcp44OOrMZEzKP38t5LB5C0zGb11qm4tGlnA7eXvq2SfhWYaZlWunOhIam47MTtclNXpaMWmd5ATZMu8aaT6Y0fCMLJeDaevDQ+DpDRFOQvGGAJGJOg3ToK+Z5C7fe8dTq1a69i0XaS4hPpEX/QE/u2wEekWFHnWhyoLJ4MV/j07xf0idoVSHoOv540yKaOfasi5PoXAaWQDt/k16vL3SQ6nXvWWTSUMEWl9vmwTVs8a5gM5EDutOwZ1rSqzyIRwfSOIUw== 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 Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) by SJ1PR11MB6156.namprd11.prod.outlook.com (2603:10b6:a03:45d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.21; Mon, 8 Jan 2024 10:54:36 +0000 Received: from DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::4782:d54a:209d:cb49]) by DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::4782:d54a:209d:cb49%7]) with mapi id 15.20.7159.020; Mon, 8 Jan 2024 10:54:36 +0000 Date: Mon, 8 Jan 2024 10:54:20 +0000 From: Bruce Richardson To: CC: , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: Re: [dpdk-dev] [RFC] ethdev: support Tx queue free descriptor query Message-ID: References: <20231219172948.3909749-1-jerinj@marvell.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20231219172948.3909749-1-jerinj@marvell.com> X-ClientProxiedBy: DU6P191CA0056.EURP191.PROD.OUTLOOK.COM (2603:10a6:10:53e::17) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|SJ1PR11MB6156:EE_ X-MS-Office365-Filtering-Correlation-Id: 8edbc7ec-ec75-46ae-5c1c-08dc103833f7 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: kLup4jS66a3lB7imbQnSyhK1cMbpjfX/NSwG/KeJ83yq4gLpyQxpaz+43AWahxrlu9bq6l3c8GKzmpnvH4DexrbrC9brkN+96gRATX/4ZtIw2WUCs8wZ1Przy/2MJAtYONA7CamqIAupiAST1IZdMcyp/swPsDP5RCQfNDaTSSUAStbciOBDVTAs+GL+HbWUYZNnXpTwPpi9JA+suZckysGY7Wm3x50hsthGDdBZq6YzpNJBnbAZEJdragNAAzm/K7w85maWmDP2JOJtoDWGDLA1lxm9UnQk6bQXqo7aP7vZIh2o+1nnaxQlnmJ6Cx/4MR1Szs2xp6iYWnDCdQfInDgwy4zy/C3Hz3G1jjwWnIFpz6qqD+VEPkvi2/RmmjxK+tjixkGraaDTi48EhOndSLGNHqvzJkJoinN/kxdxm9SDDZPV8NTqJzHRsBi+U+We9pcCQKnX6LAsg/EAnWuSCPkXt980yR1SOtCaY+Whp6GvAKh3QRK94WlDU1SxML7DPIDJoq996Edt4nQccPuSgZI4ZwY228qBjlRK70MUJJXjchpZgYzGsOIbK4ZW5bFd X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS0PR11MB7309.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(346002)(366004)(396003)(39850400004)(376002)(136003)(230922051799003)(64100799003)(451199024)(186009)(1800799012)(26005)(6666004)(6512007)(6506007)(6486002)(478600001)(38100700002)(86362001)(82960400001)(7406005)(2906002)(7366002)(7416002)(41300700001)(5660300002)(107886003)(66946007)(6916009)(8676002)(66556008)(66476007)(316002)(54906003)(4326008)(44832011)(8936002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?DthXOeuHdslgasuybO4nncY1SuCgVs+zVSYpcDMQ1+HacIMDxX1rH3Gd23oP?= =?us-ascii?Q?SHPN5TQEP9ul+v8turtn+t1Cg5ekNjtd+SSvnU9mQSYPfEtSTGiLXXCLOxl3?= =?us-ascii?Q?wrDvo+bZcpkbM7fFT9XgpOxbO7wznBwmDBSE2BJOKiPyUA1W4S+aFStT6RqU?= =?us-ascii?Q?sUxhJk2Ydo+v/CYpO0D8CbODpphkb6PMwRwyAXlM1HPxCFJDQKSf8ZF0yKCk?= =?us-ascii?Q?qL40f/48V4gk6o8ix3+HMjieT/HqkJ7vS37ioX293zQU2KoNu2EMF9UmcKBg?= =?us-ascii?Q?P+pAXfADi++oFFV2u69A1uj+XcwJDx5poDiZinIBGXKsMNsU/d9KSg7p1Sbn?= =?us-ascii?Q?A9mmeGgw47G3jjjzfcpZFILs30Da8sECdXPdIb4QwUbuiJIlEosB9aVkib82?= =?us-ascii?Q?3aeQ5kHCWMLwnSXfn8dlPeHQLTujZn6XE4G6lEmsK6Yd57sGoo6ulF58uV1k?= =?us-ascii?Q?PWD1gNtk8tUCPSs62Ar4e0rPGB8OhHAIdRNfL/+Lw115j3e2+L+6+xDKjKBz?= =?us-ascii?Q?GvhEqJqn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TT?= =?us-ascii?Q?NR0kcVZSGc3el4DG3OYl1Qbee0H8XhD/peQws+xEq9Ez9WzP1A8Du1z6SKZN?= =?us-ascii?Q?tzPGya7+HAvHuDKjzN0YLENgzP0RenalYryRI8CnCCkjcIVZvLBytsNZdCSq?= =?us-ascii?Q?l8ldKHWjq1LJbZq3zvgdEayFcv5tVPnizR8KhlqvchgyYkO8JX9bbHjg/jua?= =?us-ascii?Q?0Q=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 8edbc7ec-ec75-46ae-5c1c-08dc103833f7 X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jan 2024 10:54:35.9842 (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: o+HRV4hS/0kiSxnK2TK5Clj9KM6nlwztjpaS+X3OOyY2CEsQOACEze9H/GeoFA+iBs12/SHjNAUqisVnBrOMVJbX7Co+Ye73+151aGpvzYU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR11MB6156 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 On Tue, Dec 19, 2023 at 10:59:48PM +0530, jerinj@marvell.com wrote: > From: Jerin Jacob > > 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 > --- Hi Jerin, while I don't strongly object to this patch, I wonder if it encourages sub-optimal code implementations. To determine the number of free descriptors in a ring, the driver in many cases will need to do a scan of the descriptor ring to see how many are free/used. However, I suspect that in most cases we will see something like the following being done: count = rte_eth_rx_free_count(); if (count > X) { /* Do something */ } For instances like this, scanning the entire ring is wasteful of resources. Instead it would be better to just check the descriptor at position X explicitly. Going to the trouble of checking the exact descriptor count is unnecessary in this case. Out of interest, are you aware of a case where an app would need to know exactly the number of free descriptors, and where the result would not be just compared to one or more threshold values? Do we see cases where it would be used in a computation, perhaps? /Bruce