Message ID | 20230911074149.697944-1-michaelba@nvidia.com (mailing list archive) |
---|---|
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 792574256B; Mon, 11 Sep 2023 09:42:12 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 13E12402DD; Mon, 11 Sep 2023 09:42:12 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2082.outbound.protection.outlook.com [40.107.244.82]) by mails.dpdk.org (Postfix) with ESMTP id 6ED0D402DA for <dev@dpdk.org>; Mon, 11 Sep 2023 09:42:10 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UE+oi+TneauCWhpWbUCtoHBWVw8Y7OVrA4paDTK6uB/L813EzjcoPAbSKGCt/gKDfla3xTQA00gxrlXl1KY03W0L0UQmQgf82b1QJRrfFl7ZnU2pRh+U+Hodw4VkwPm+HCMcN+pM1ZiZR3dmWkl95vy1HPZgmGTbBFA+TXw1zZpPg2zhEtG+eSd4xti4VBmMnncHSwTtrQ5Dd10cT6aAfweKtammBrgctQ/LsQj6jkMJxve8s5dp8inPegqieaafyPFLMaiIDeDA4pVOyi9NEB/GmDWKgGJwLsMYd5Ssq1lUoFkGjv8XgE/PamSYC6RHF2x9LYZnhFr+u2xjoz5azQ== 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=GTxHGrfa2LrX6NlfVpdak41cBzYvwdrB2HI9IzI8HyM=; b=H9qGuRRxcpGuoFVK2zeuzf1t1ShhoZtwL2uO3Us/qyYuyfVKPY87jhZ3sAm5PWBlmtGYdFiXhUWDCtSUWUYeugG0CWB7MN3QYQbF5vKRLofD6/0yzLay/O1nb0iYq/9fNrBTC0K31VYOwhLADkeTrODBAg+AG6DsC1+4rgcyhZEkXRpHSdEK+ek0nnUsmREEh9U8yyyhLpUsHF1xzCHddWfYoTqF80zB790OHDs7FT7JFMvxgID3Wu6ig4s4DDJaniC0wCWi3Zm7mYJwMvgRz3C865x8n30PNDE4r4M7gS3qFYKZ3Uj4BRnUt4qXxLh8ATPqrkzRjoIAOcBhDgIpFg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GTxHGrfa2LrX6NlfVpdak41cBzYvwdrB2HI9IzI8HyM=; b=a8HfGjgovtN1YyP9QJkgPcSBJmHBUsG4qoFR6LP0iHCaSXuzQMeMGRS6DORHfa4R+n4wtkG/db9Yr7rSL+++r9UtKhfMX0TeuE6Kyaand220eqYBF2XBPlqpgZWOi+orEr8sJt+1J34hTq88LPF5sR36qKN3c/fzZ+NoiL/Z+ictjQknSgOYqJ7BbwPzOVUDiqLN/ZkbI1/Qhend6UJl81Ncz94ZuiEmU3VBy2irmGxDTuq3UHU7q68GaE8mGSS34YJDFQPTeKtQq08pq4VJq0fsLz4bYsCSKo+zMqH8VE4Or4S+s9LS0QAdtmmb5C6fhT9v5mNjtHMlJ5BDd5Q/vQ== Received: from SA9PR13CA0107.namprd13.prod.outlook.com (2603:10b6:806:24::22) by CYYPR12MB8939.namprd12.prod.outlook.com (2603:10b6:930:b8::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.30; Mon, 11 Sep 2023 07:42:08 +0000 Received: from SN1PEPF000252A2.namprd05.prod.outlook.com (2603:10b6:806:24:cafe::38) by SA9PR13CA0107.outlook.office365.com (2603:10b6:806:24::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.16 via Frontend Transport; Mon, 11 Sep 2023 07:42:08 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by SN1PEPF000252A2.mail.protection.outlook.com (10.167.242.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.11 via Frontend Transport; Mon, 11 Sep 2023 07:42:08 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 11 Sep 2023 00:41:56 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 11 Sep 2023 00:41:55 -0700 Received: from nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37 via Frontend Transport; Mon, 11 Sep 2023 00:41:53 -0700 From: Michael Baum <michaelba@nvidia.com> To: <dev@dpdk.org> CC: Ori Kam <orika@nvidia.com>, Aman Singh <aman.deep.singh@intel.com>, "Yuying Zhang" <yuying.zhang@intel.com>, Ferruh Yigit <ferruh.yigit@amd.com>, "Thomas Monjalon" <thomas@monjalon.net> Subject: [PATCH v2 0/2] ethdev: add random item support Date: Mon, 11 Sep 2023 10:41:47 +0300 Message-ID: <20230911074149.697944-1-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230822090505.3242455-1-michaelba@nvidia.com> References: <20230822090505.3242455-1-michaelba@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF000252A2:EE_|CYYPR12MB8939:EE_ X-MS-Office365-Filtering-Correlation-Id: 7def3804-2188-46a0-944e-08dbb29a9a1a X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vLtXHEB61SOHGBmvnRqYnSytoYj1lQZylbGUMcpEm/NnzCOkmSi+R00kaScI3AiZUZQtCs9rhShzPI3mcGJCHTcvDaWDsNXdkn+AW8XOJwjFX5Uqu61fb5htHeajpJbO32GzDft5Bi0ufLtwRX1zw0ADkczwD177ITMQKspX1XQSQleZGycUUqBc6Wf3FXAWqdciIKe17Beb1E0syfp8l23+SH32DGSCzZX/StTOfXvOqAAsQ0Ww2dGkNxfnOGvcnCmjrgupYTav8Vwrrq594RDDX+J9HaaNYyVlbpMoAIEYu4uMEpET2IXBXFvdymigRWY50uWiwIeXPDqdZ3JxDC0IYFQtAwacvV5bBZz28id17yWPSC9jSx7vvSzyi1BsjNq7hKIE4xBMBmvBuA5/ZDi6JcVW0ZP6BvkfKNGAgk7t1JBDjmDkTXBsM7qFa3xyYD5B+OUMdFYkvCkgXp0s/vC1vEORsK4MXYRXE56y84si9KxE+O6PlG1Zlc1Jqp3SGcEth485N1ScDLeU5AUI1OAMz04kJyuvdmkY2BWRcYN5fJ/bfcX2qAUaxFaAxSpy50x2g+3AiTxQyDrTskZ44oQ5pxAEIPhUpq0tcTZFs8/XZYVkFUCeQTIuQOEisChM+l3fOBwLebF29TsMeeOiBi7gtkrtk7p1cySQf4IS74J0MDLF5UmQNWCMqCSMHQfIsJr541frZcB3+GsMkKUJ1xakwkdsPmxcojxV0GG/B6ebzCIFcMAcpEVDa1NGAq2q X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230031)(4636009)(39860400002)(346002)(376002)(396003)(136003)(82310400011)(1800799009)(186009)(451199024)(46966006)(40470700004)(36840700001)(6666004)(7696005)(83380400001)(478600001)(426003)(336012)(2616005)(26005)(6286002)(4744005)(1076003)(2906002)(6916009)(54906003)(316002)(41300700001)(8676002)(8936002)(5660300002)(70206006)(40460700003)(4326008)(70586007)(36756003)(82740400003)(40480700001)(47076005)(36860700001)(86362001)(55016003)(356005)(7636003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2023 07:42:08.1791 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7def3804-2188-46a0-944e-08dbb29a9a1a X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF000252A2.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR12MB8939 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 |
Series |
ethdev: add random item support
|
|
Message
Michael Baum
Sept. 11, 2023, 7:41 a.m. UTC
Add support for matching random value using new "rte_flow_item_random" structure. This random value is not based on the packet data/headers. Application shouldn't assume that this value is kept during the life time of the packet. v2: - Rabase. - Fix copy-paste mistake in release notes. Michael Baum (2): ethdev: add random item support app/testpmd: add random item support app/test-pmd/cmdline_flow.c | 30 ++++++++++++++++++- doc/guides/nics/features/default.ini | 1 + doc/guides/prog_guide/rte_flow.rst | 11 +++++++ doc/guides/rel_notes/release_23_11.rst | 4 +++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 4 +++ lib/ethdev/rte_flow.c | 1 + lib/ethdev/rte_flow.h | 33 +++++++++++++++++++++ 7 files changed, 83 insertions(+), 1 deletion(-)
Comments
> From: Michael Baum [mailto:michaelba@nvidia.com] > Sent: Monday, 11 September 2023 08.42 > > Add support for matching random value using new "rte_flow_item_random" > structure. I get it. It can be used for things like stochastic sampling. However, it doesn't provide support for e.g. 1/100 or 1/500. So here's a suggestion: Instead of "value" (which is irrelevant) & "mask" (which is what really controls the probability), wouldn't it be better if "value" was an inverse probability (and "mask" was irrelevant)? E.g. value=500 means that there is a 1 of 500 probability of a match. Would this kind of random item better serve the purpose? Or is the random item, in its current form, also required for other purposes?
On Mon, 11 Sep 2023 18:55:45 +0200 Morten Brørup <mb@smartsharesystems.com> wrote: > > From: Michael Baum [mailto:michaelba@nvidia.com] > > Sent: Monday, 11 September 2023 08.42 > > > > Add support for matching random value using new > > "rte_flow_item_random" structure. > > I get it. It can be used for things like stochastic sampling. > > However, it doesn't provide support for e.g. 1/100 or 1/500. > > So here's a suggestion: > > Instead of "value" (which is irrelevant) & "mask" (which is what > really controls the probability), wouldn't it be better if "value" > was an inverse probability (and "mask" was irrelevant)? E.g. > value=500 means that there is a 1 of 500 probability of a match. > > Would this kind of random item better serve the purpose? > > Or is the random item, in its current form, also required for other > purposes? > For netem (Linux kernel) needed to support expressing a percent in fixed point number. The solution was to express it as: Percent = X / UINT32_MAX
On Mon, 11 Sep 2023 18:55:45 +0200 Morten Brørup <mb@smartsharesystems.com> wrote: > > > From: Michael Baum [mailto:michaelba@nvidia.com] > > Sent: Monday, 11 September 2023 08.42 > > > > Add support for matching random value using new "rte_flow_item_random" > > structure. > > I get it. It can be used for things like stochastic sampling. > > However, it doesn't provide support for e.g. 1/100 or 1/500. It supports those values using "last" field in addition to "spec" and "mask". It matches a range of random values for any requested percentage. > > So here's a suggestion: > > Instead of "value" (which is irrelevant) & "mask" (which is what really controls the > probability), wouldn't it be better if "value" was an inverse probability (and > "mask" was irrelevant)? E.g. value=500 means that there is a 1 of 500 probability > of a match. > > Would this kind of random item better serve the purpose? > > Or is the random item, in its current form, also required for other purposes? The random item is more generic than stochastic sampling, it can implement distribution. When application wants to distribute the traffic between ports/queues, it can match all random value range with send to port/queue actions.
On Monday, 11 September 2023 20:53 Stephen Hemminger wrote: > > On Mon, 11 Sep 2023 18:55:45 +0200 > Morten Brørup <mb@smartsharesystems.com> wrote: > > > > From: Michael Baum [mailto:michaelba@nvidia.com] > > > Sent: Monday, 11 September 2023 08.42 > > > > > > Add support for matching random value using new > > > "rte_flow_item_random" structure. > > > > I get it. It can be used for things like stochastic sampling. > > > > However, it doesn't provide support for e.g. 1/100 or 1/500. > > > > So here's a suggestion: > > > > Instead of "value" (which is irrelevant) & "mask" (which is what > > really controls the probability), wouldn't it be better if "value" > > was an inverse probability (and "mask" was irrelevant)? E.g. > > value=500 means that there is a 1 of 500 probability of a match. > > > > Would this kind of random item better serve the purpose? > > > > Or is the random item, in its current form, also required for other > > purposes? > > > > For netem (Linux kernel) needed to support expressing a percent in fixed point > number. The solution was to express it as: > Percent = X / UINT32_MAX I concur with the notion that numbers can be utilized for probability calculations. However, it's important to acknowledge that when employing numbers, we are essentially working with a superset of possibilities due to their inherent versatility. To illustrate this, consider the scenario where we transmit a numerical value to an application and use that same value across different stages of the pipeline. Take, for instance, the following use case: In the initial stage, there is a 20% probability of selecting a packet for sampling before proceeding with the pipeline. Towards the end of the pipeline, if the packet was initially sampled, we sample it once more. The challenge arises when attempting to replicate this process solely using a numerical value, as there is no guarantee that the same packet will be chosen both in the initial and final stages. Conversely, by duplicating the random number and using it as a reference for matching, we can effectively implement the aforementioned usage scenario. I hope this clarifies the distinction and benefits of utilizing random numbers in our probability calculations.