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 B00E04386F; Tue, 9 Jan 2024 09:47:24 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2FE2C40261; Tue, 9 Jan 2024 09:47:24 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 725664021F for ; Tue, 9 Jan 2024 09:47:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1704790041; x=1736326041; h=date:from:to:cc:subject:message-id:references: content-transfer-encoding:in-reply-to:mime-version; bh=IaH3ENdBlezioMOLraYF6cEZO67hN4hE6+EUkIGB34c=; b=DNcnECpsG+w7NtUJQgydN/oLR3I8fyupE1pxWbWeiXJh7SC94kdNiJ5U +JpaBbAcUvPTe923W4Qq7amMazFMtvn1OOc1350yI7ipQjqohPwVVXaKv 5L/FWr8/R/pBeKd0Tc5IabQXQvTOnOqQW+74UwueKPhPfttbxwMQQ+NVV Gvr6OQ4EuXiJ6cKNEKZbPnC1UW6Fuz7q7SbdS7PPyjf+0Ohy+DJrnrh78 /k6/MjPxNmOT4VDFhUc0J5bwFNvrw1MuX9U3XlUQu8zx0urZnDx4jqv4d U9oVhq5PICmFfh3XQcfH8sxGPGPj1ri4olxsr7ljHDx5gFahJL91NyOrt g==; X-IronPort-AV: E=McAfee;i="6600,9927,10947"; a="484307428" X-IronPort-AV: E=Sophos;i="6.04,182,1695711600"; d="scan'208";a="484307428" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jan 2024 00:47:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10947"; a="774774352" X-IronPort-AV: E=Sophos;i="6.04,182,1695711600"; d="scan'208";a="774774352" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by orsmga007.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 09 Jan 2024 00:47:17 -0800 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) 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; Tue, 9 Jan 2024 00:47:17 -0800 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) 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; Tue, 9 Jan 2024 00:47:16 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) 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; Tue, 9 Jan 2024 00:47:16 -0800 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.100) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Tue, 9 Jan 2024 00:47:16 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Uh2i51dcmfViSv17SSxC+JUcgVOz7lT+d399kOMp0UwTMHsHzEqLKf8sJCRyC9V2ir+efvpPLCti5RScO3ibv/bTAJcICmqI/eOg9Y89EfDILJjYVE+5G+un1MVwH5Qp8yH2N022O4iWhpxgHhyu2+ztQZnhmxNOyoBJZKJJCPQFX0S9/n2R8nMWB0oy+6UdJTIkpIrXnMqU1JVMPewq0miJHnwspDhnYA6DURl4hBiMp2bseE9LYDR8jlrE30BYLr3Blbs9GeEMJkeD4EkxCz6/3hNV7pPGd+wXWO7Kk5ea+UR83WPhevqaHKfvgDnmOcxOs7j5cRoJ1ecppT+dMg== 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=LqAzR+JuF8wnEBWSQNYB+scvbwGYbDrxxdv/E9OiF4E=; b=YxoZRvABiuzawo3+TC9b+6wB3VC1APhK9URePay+qh+Lj6WZAuR0LsgfQ1ZkkuotMFQJsWPO/lhzlijAhKaXj65eIMNtF0TqqJFsutigzi/lX7IURXIVbubNip/adG9J1+wr2wEjmFIFFClT8Zu9rWNmI7K8i9WYE1DvL/Zjyk3iQdAE848GcsSnvWXIXnQxJfZhFm1wRFr5Dtjobicey707JnWnVd345dEsdZvmX6a2bZOiwjetgat3Iwm02V1Vf5lugy233/Yz9HVW7ZWIStIJcazaYg8kfyN1e63SeU+ie5mRVACAq0wSd5nL/ha+OsMcNHDCxiVY5li+Jq5BQg== 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 MN2PR11MB4693.namprd11.prod.outlook.com (2603:10b6:208:261::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.23; Tue, 9 Jan 2024 08:47:14 +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; Tue, 9 Jan 2024 08:47:14 +0000 Date: Tue, 9 Jan 2024 08:47:01 +0000 From: Bruce Richardson To: Morten =?iso-8859-1?Q?Br=F8rup?= 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> <98CBD80474FA8B44BF855DF32C47DC35E9F11E@smartserver.smartshare.dk> Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35E9F11E@smartserver.smartshare.dk> X-ClientProxiedBy: DB8PR06CA0052.eurprd06.prod.outlook.com (2603:10a6:10:120::26) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|MN2PR11MB4693:EE_ X-MS-Office365-Filtering-Correlation-Id: 75dd559f-7f31-4ae2-b534-08dc10ef9329 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: 8EBAar4Kn2Zza+dpKt2EKPoVfCe2ntVS77VeJCBtwYiTEfRIjPtiORrgpFtJ6fq3rDRa6TDWyAr4gyHX3ZHmVvFLbz/kKT3GZyXOmRuxLxUVEZBWNIHJPTcGf4IamSlF9qjMRw3AHP09r/s+B2EVZ2DEqgcJY8hjI9DTxzisipkMcQnJO9JQiUi0wtwvlJMAPXl6xw88/SKRQvxdheHAd2uhJe/lQvTdFzTLNmh9WON1mlMyTipVe7qdefgHuo9BQgjAEPhpnUNSyICNBvAntT+zDpFXiXLb6um7IU+0EcxfrJ+OwPF0WBtbbcEoAzrCDbDJJsRqA/sJ0yLjFZ3VVh9uo3ZXg2sba/VMJEm7i1Ikq3u81WByfRD9po6iRKFFQMKl8UvjLH2Cb3LOmxeci6kB6ncZzPQkVFgk9578G1HYqHEPHt+049TF6SngOTQP4HsAv5iOQ68jjY71QVMabh1XNX7dEQIAjTGvf64UKIQJUa8fliTiXBzwlb1pcl2Woxpm7eDyldbiFh08KOooLNirDYCqji2Cjdtd1cTujNNiOZWlRAxTaeJQ8aczeW+W 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)(366004)(346002)(396003)(136003)(39860400002)(376002)(230922051799003)(64100799003)(451199024)(1800799012)(186009)(2906002)(38100700002)(7406005)(7416002)(7366002)(5660300002)(82960400001)(86362001)(41300700001)(54906003)(66574015)(316002)(8676002)(8936002)(6512007)(6486002)(66946007)(107886003)(66556008)(6916009)(66476007)(26005)(478600001)(83380400001)(6506007)(6666004)(44832011)(4326008); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?iso-8859-1?Q?Z+6eBWxAwhzYGUJl3qvEAlaNm+oGCOyiuOZk+LNDWZ+//WSohQnI2fyHv3?= =?iso-8859-1?Q?gluCmaKUCidy1VeI2XH9t6kFz75iAru3d2gYs+ARsyiOsVnPBOS1Zz4xEK?= =?iso-8859-1?Q?P+G/B3FBjKD1cFOVh/NXOX+Yz6z4ShAZzc5vYC+8QZpTy7nRSsNVzpqg1y?= =?iso-8859-1?Q?CF69YEkCU+RxjN3Oxf/XY0Sw7132I8N2pbgiyKrR1/uTn09MEPz/lr126C?= =?iso-8859-1?Q?dId8VIxZNheOFoagJSee/BYJPmc+TJPfj0UrqKnm+8AL4nHm8EJ9Bamb3m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mB0Z+4MNL2onZDiqxoDzuaVcCC/L+r?= =?iso-8859-1?Q?DVoH7k1wsxH9R8BKj4YJbpQ7CEtft4dPbQ9pm4s2XL6iSNw9IC9HoUxBH0?= =?iso-8859-1?Q?DxeZ6vd/vD4c5pBh719M1rLjC6GHALcOJoff7uIkap/0/vgWtWLTy1OyFT?= =?iso-8859-1?Q?mZG0uz5TDPmBDki++5agP4OT3D7quN6iwbp//F1315nwlLeGc56H1uQ1e3?= =?iso-8859-1?Q?+zmsK94ZMVECPmHZTnIni0a1DSlCaFLQS3ckzH2TjTwyvunNcA7/kN0oNy?= =?iso-8859-1?Q?sPBV7dEwfsoYJn/8yH8CaVbkhcW7GEt6rVFDLUCAb6VvM/sY1vM8zPJGou?= =?iso-8859-1?Q?8pw+2APaAbg4CcHYqWKZxp6gOPxncAJkI5IjUCjqi4iroRxwDJNxx0ERz2?= =?iso-8859-1?Q?OwBpEC85CPcHOon2uGOQe7JvU1uB6/ITBXdZ//YCblXIwRApOIxGco3m83?= =?iso-8859-1?Q?0uJTA8J8Zs568i3YCk+nvpdXRdzJWwngEQttPwcqOaXlrdanIBcRuh1A?= =?iso-8859-1?Q?=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 75dd559f-7f31-4ae2-b534-08dc10ef9329 X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2024 08:47:13.6963 (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: Ke9cy94Zo/A1Uq9AFUMUaOWL7rtERehvSW7HX2YyFccVLEMn23r8aRpjFIq9nnMSeDWUcVjtd7InXhVCmJeGBmfo+3MMH/5XYJDysXyqMPA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4693 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 Mon, Jan 08, 2024 at 10:15:40PM +0100, Morten Brørup wrote: > > From: Bruce Richardson [mailto:bruce.richardson@intel.com] > > Sent: Monday, 8 January 2024 11.54 > > > > 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(); > > Typo: rte_eth_rx_free_count() -> rte_eth_tx_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. > > Yes, it introduces such a risk. > All DPDK examples simply call tx_burst() without checking free space first, so I think the probability (of the simple case) is low. > And the probability for the case comparing to X could be mitigated by referring to rte_eth_tx_descriptor_status() in the function description. > > > > > 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? > > Yes: RED. When exceeding the minimum threshold, the probability of marking/dropping a packet increases linearly with the queue's fill level. > E.g.: > 0-900 packets in queue: don't drop, > 901-1000 packets in queue: probability of dropping the packet is 1-100 % (e.g. 980 packets in queue = 80 % drop probability). > Ok, thanks for the info. All good with me so. /Bruce