From patchwork Tue Aug 22 09:05:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Baum X-Patchwork-Id: 130630 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: 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 5FB07430CE; Tue, 22 Aug 2023 11:05:38 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 25D1E42FB2; Tue, 22 Aug 2023 11:05:35 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2075.outbound.protection.outlook.com [40.107.237.75]) by mails.dpdk.org (Postfix) with ESMTP id D610A4021D for ; Tue, 22 Aug 2023 11:05:32 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h0GZgndaZeSirZQ3DmWEPYQm9hnamz3VLLIwlKumv6JcQX0uf0XFSJpdNVjb/v6gdz2BF/uJ1ArGdOof3dUWCgsGgJYDXPzJ3fhjaNYYZspYC3jnhv+oQB+F7rqpDuHKif0OXg7FtcVQ1U+QfQvHSVbi2oBe9e2Joo7e6qRTgcjmAazPEpoMf3KLkwIyxWgkajYRo+F/UQN6Md9MV1kWd2YIGN0n6sLEKCjyFKYuAOWy98xeSjcWHhwLa2oNXly6teGshNIg9zS/McRekk4RRA9/iMNjMumA5HC2p1bBHJK/ykAOhxgTd8Zwntr0jp2PQFXEeOr+qlIZ+i3DiU4cVg== 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=nHQEl5a1BULvRtAU71IHLUcvEOrCgu/n3LUDSlvnU8s=; b=RKuGPEF98L2zsTiA/xFxN/kAZMacf6EA76NAUGLjl0epXMPDZmyzaJWA7BsMDbQ9Iahy4R3zVVy9qXBtRAUGhmULqXG537iuvqzZqmvTIRlXM5RESFZU38TDiv2QBidqxHmOL5qSgGReasayE8j6H5WgnEJ0cYC4KALGjOpstr2saAaRjiSS4H7epcw55JU3W+OGMMoh6+/nHo+OXXtuaQM4J8Q6Q4NOkBKV50DovByUbI7sMDo2wKlO7tj6qIHX8ygo+J4LabDvFSMXr/o4mfaM55A42ZzEWWqNEWBZam/pv688yEju69yj1KyDTOgUNzXzylrYZawl6kS7WQb+hA== 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=nHQEl5a1BULvRtAU71IHLUcvEOrCgu/n3LUDSlvnU8s=; b=cOLH5pmah98YCu7uPSo40QQojZG8ArTIsJyEkYHoo4Wj4iaaQddgD5JL2c3bsJPA47lQIwzs3I0qev1VUV/p2IF/05VBW7qg0+5DY2ofvd3Rt6gOt1AkUtNxVxKaavzaWfwtZU53kxxTKtOJ4YSB8xvJ8/Kz+PbtnjosipleP9gADdysOsaiLcC+ZKPdUKRZha3esDdWGTj90VwlO8NW7yYbx0dhk5zZqQe/E4XQLSFVl+6oLGllQPW57EpgahkOx6tBu2v+qYIxhHLsRZcNHRSnYHl+y93qkobsi3NZzG18OlZFfkRNuUKi/DAy59O0q156MIeTP6J4yPl//+2XIw== Received: from CY5PR15CA0242.namprd15.prod.outlook.com (2603:10b6:930:66::18) by SA3PR12MB7974.namprd12.prod.outlook.com (2603:10b6:806:307::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.24; Tue, 22 Aug 2023 09:05:31 +0000 Received: from CY4PEPF0000E9CF.namprd03.prod.outlook.com (2603:10b6:930:66:cafe::83) by CY5PR15CA0242.outlook.office365.com (2603:10b6:930:66::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.20 via Frontend Transport; Tue, 22 Aug 2023 09:05:31 +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 CY4PEPF0000E9CF.mail.protection.outlook.com (10.167.241.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.15 via Frontend Transport; Tue, 22 Aug 2023 09:05:30 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) 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; Tue, 22 Aug 2023 02:05:18 -0700 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Tue, 22 Aug 2023 02:05:18 -0700 Received: from nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37 via Frontend Transport; Tue, 22 Aug 2023 02:05:16 -0700 From: Michael Baum To: CC: Ori Kam , Aman Singh , "Yuying Zhang" , Ferruh Yigit , "Thomas Monjalon" Subject: [PATCH v1 1/2] ethdev: add random item support Date: Tue, 22 Aug 2023 12:05:04 +0300 Message-ID: <20230822090505.3242455-2-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 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9CF:EE_|SA3PR12MB7974:EE_ X-MS-Office365-Filtering-Correlation-Id: c3fd1959-8747-4ca9-1ed1-08dba2eeef95 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: knzdymEQHVQ04+O9M7+l5T2x77Aik+5GRb/AailVIoUftY0jZf5sRABulIpqXcdALlaz3X9ApiC4MoXSzzqWGzxnwX7xXnmb2WYd4mRnWiSlTbR8cW7mx00b7cqXLUXwZssF9hjC78c85BWF0ehxapVQNRgrYaFlre0gvelpI9u+jgGXq07Ch4ukBsGgokAsOpDFdHuwf2/F9gxu4fVy6TikEdQTsZlaGUskIaCHIVpmYkagM9/K52Rulk9e4rXp+CGd2B+AZeNLSmOWQkSQx6MyeBxZEU1YseUOSxox1H3JxQCrbOnGoQXSQv+yUUlfPQKxxfAqAg69UayZvyLbGTUL6vuzDM9z2QYI4fqc/cMarMwz2gOhB7wFwaZLXWX032Xh6n5US8wFRPKxYPU47K/mR0KKJ3sZIl4CmA69Hi5rp6t4D3TZ+Yjy7Ap/bU7R1Kksm7Dy5aTZxOfj2PpnHX65GnoKRmYDCzd6TzbhCg3O9usJVm17ilgL2BtEElRBFgiE0xCkO83Ro4WhJrsNBwP55G9BR4phFXc046KO7EUZ3a+2x6TiGf0v2ZK6j6QV+1umal0qtUtypE8QyVNr9pqnfGuUgK+1D1C1PdJXBHtcwDZljgNhosYHwHhyooSNUv3uCVWQM2gIgipsv6x0mxwOxnU/KG5nEyovTL3zhO7zrczSEBDO8eOEhqRKnhLqRZYo6Rp5yWbXk+D5IRbeoWBMFwt4t13Ol4NfjgnmTz+clM4oeK1v6ftQtW3qy9fU 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)(396003)(136003)(39860400002)(376002)(346002)(1800799009)(186009)(451199024)(82310400011)(36840700001)(40470700004)(46966006)(54906003)(6916009)(70586007)(70206006)(316002)(8936002)(8676002)(2616005)(4326008)(7636003)(1076003)(40460700003)(41300700001)(36756003)(82740400003)(356005)(478600001)(55016003)(6666004)(40480700001)(2906002)(83380400001)(36860700001)(86362001)(47076005)(7696005)(426003)(336012)(5660300002)(26005)(6286002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2023 09:05:30.7406 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c3fd1959-8747-4ca9-1ed1-08dba2eeef95 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: CY4PEPF0000E9CF.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB7974 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 Add support for a new item type "RTE_FLOW_ITEM_TYPE_RANDOM". This item enables to match on some random value as a part of flow rule. Signed-off-by: Michael Baum --- doc/guides/nics/features/default.ini | 1 + doc/guides/prog_guide/rte_flow.rst | 11 +++++++++ doc/guides/rel_notes/release_23_11.rst | 4 ++++ lib/ethdev/rte_flow.c | 1 + lib/ethdev/rte_flow.h | 33 ++++++++++++++++++++++++++ 5 files changed, 50 insertions(+) diff --git a/doc/guides/nics/features/default.ini b/doc/guides/nics/features/default.ini index 2011e97127..0a790dafe8 100644 --- a/doc/guides/nics/features/default.ini +++ b/doc/guides/nics/features/default.ini @@ -139,6 +139,7 @@ pppoes = pppoe_proto_id = quota = raw = +random = represented_port = sctp = tag = diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 5bc998a433..5ad699dff7 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -1566,6 +1566,17 @@ Matches an InfiniBand base transport header in RoCE packet. - ``hdr``: InfiniBand base transport header definition (``rte_ib.h``). +Item: ``RANDOM`` +^^^^^^^^^^^^^^^^ + +Matches a random value. + +This 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. + +- ``value``: Random value. + Actions ~~~~~~~ diff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst index 4411bb32c1..1e90bf83e7 100644 --- a/doc/guides/rel_notes/release_23_11.rst +++ b/doc/guides/rel_notes/release_23_11.rst @@ -72,6 +72,10 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= +* **Added flow matching of Infiniband BTH.** + + Added ``RTE_FLOW_ITEM_RANDOM`` to match random value. + Removed Items ------------- diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c index 271d854f78..51db3e5aec 100644 --- a/lib/ethdev/rte_flow.c +++ b/lib/ethdev/rte_flow.c @@ -136,6 +136,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = { sizeof(struct rte_flow_item_icmp6_nd_opt_tla_eth)), MK_FLOW_ITEM(MARK, sizeof(struct rte_flow_item_mark)), MK_FLOW_ITEM(META, sizeof(struct rte_flow_item_meta)), + MK_FLOW_ITEM(RANDOM, sizeof(struct rte_flow_item_random)), MK_FLOW_ITEM(TAG, sizeof(struct rte_flow_item_tag)), MK_FLOW_ITEM(GRE_KEY, sizeof(rte_be32_t)), MK_FLOW_ITEM(GRE_OPTION, sizeof(struct rte_flow_item_gre_opt)), diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index 2ebb76dbc0..b5228b293c 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -688,6 +688,19 @@ enum rte_flow_item_type { * @see struct rte_flow_item_ib_bth. */ RTE_FLOW_ITEM_TYPE_IB_BTH, + + /** + * [META] + * + * Matches a random value. + * + * This 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. + * + * @see struct rte_flow_item_random. + */ + RTE_FLOW_ITEM_TYPE_RANDOM, }; /** @@ -2031,6 +2044,25 @@ static const struct rte_flow_item_ib_bth rte_flow_item_ib_bth_mask = { }; #endif +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice + * + * RTE_FLOW_ITEM_TYPE_RANDOM + * + * Matches a random value. + */ +struct rte_flow_item_random { + uint32_t value; +}; + +/** Default mask for RTE_FLOW_ITEM_TYPE_RANDOM. */ +#ifndef __cplusplus +static const struct rte_flow_item_random rte_flow_item_random_mask = { + .value = UINT32_MAX, +}; +#endif + /** * Matching pattern item definition. * @@ -3875,6 +3907,7 @@ enum rte_flow_field_id { RTE_FLOW_FIELD_GENEVE_OPT_CLASS,/**< GENEVE option class. */ RTE_FLOW_FIELD_GENEVE_OPT_DATA, /**< GENEVE option data. */ RTE_FLOW_FIELD_MPLS, /**< MPLS header. */ + RTE_FLOW_FIELD_RANDOM /**< Random value. */ }; /** From patchwork Tue Aug 22 09:05:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Baum X-Patchwork-Id: 130631 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: 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 7DC35430CE; Tue, 22 Aug 2023 11:05:45 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5D8AB42D13; Tue, 22 Aug 2023 11:05:40 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2088.outbound.protection.outlook.com [40.107.94.88]) by mails.dpdk.org (Postfix) with ESMTP id 0F5D84021D for ; Tue, 22 Aug 2023 11:05:39 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kb7m4aZML0xfd/bmp5jzNVeaaAyGhTJ78zDgcAZTthpMoqU2gSsqvnAOzKzVJ5o91z/KMjfVSgJOuYo8TDOsQ4I1xhPVuyp1Bxy9FdN4eU6xtHXM0IGsYnTtiPZ6yuRe9nrIENqbr1wo+DtauZlC9WbQ3fOD6cYIuM2MwUAlyfQdRZ8SA1xQu7bZ8K+X18Bi1OnH8o6DVKTFpsT/2T0gu+zB0nAn/0uEMipbleq4CQXQWhZaNurrpxU+j/jh101W34E0Z6voPxK/c+7zyWFfJ5Ope/L+bzDETsS5d+WBGSRXAY0xSfRTYeljY5FP3iab5b9m3wvLG1Rw+eOD3Wb5TQ== 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=4Qh7CrLu6Uh/HjelxuIhI7/jne8K3mP6M2BrTG2z21Q=; b=AVXGwSregZFXQLsRSlQQENqzjrqZEVEh5GmGvtDIhmDw8+nwc6b16WZ1W8j4I/ptc+dSsFaM/sr1fArIf4/7ShY6rVLLJIqdQfrLnwlzmYS+IQlTfrPpDJ7UNawnLOdRKGi7kRv8Vs7x9j38ajyktD5YhDu2LechDVRaKlbg0+TLba/YchNpMtVgYfZF8mUO1Ch8YomVyoYbXcuxkFcKAQBUrjNPZUaWDnhmAWRKS49W8Bbc8MPwxc5gMLyW+MLlaFimPgouG9ONTLwlWaFdvKLODOufu2I4BhtGzmA3FvROB6NMYAN1447IVtFcG94ZFmc6V596thH7LLBPyv9ivA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) 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=4Qh7CrLu6Uh/HjelxuIhI7/jne8K3mP6M2BrTG2z21Q=; b=c94iQUI4xi2IrsnGOfIn9/ZGUvjUUQd2ci8itr2w6GXXor06f+bnW1Bve8bmssAQdjEb31Rk7aG4apTaAFxmdFoHlGC+z/3E9uS+PaPOW9eI8oLpDMK9zi0V5OupGI4YKZLYd2Qw5PETQr5TnIzMlkoJrx7jodWT0HgeFTDpeE5kaRvR5T+oEDw3fOfGO6ThmFyuvwWPkN0HWOcQOuo15i0SSG0wnfjd3wFHXuyCXGRHV75Z2v7df8pYNszVDqznPoEaumN3+EjRdYb5kj+x3ddE8ldtLwayLvTUg7aIeoAzlwGCQvTf/zmx9e6ZK0JyIRK3zZt41ACPoD077x3CuQ== Received: from SN7PR04CA0038.namprd04.prod.outlook.com (2603:10b6:806:120::13) by CH0PR12MB5268.namprd12.prod.outlook.com (2603:10b6:610:d3::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.24; Tue, 22 Aug 2023 09:05:36 +0000 Received: from SA2PEPF00001506.namprd04.prod.outlook.com (2603:10b6:806:120:cafe::c8) by SN7PR04CA0038.outlook.office365.com (2603:10b6:806:120::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.24 via Frontend Transport; Tue, 22 Aug 2023 09:05:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by SA2PEPF00001506.mail.protection.outlook.com (10.167.242.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.14 via Frontend Transport; Tue, 22 Aug 2023 09:05:36 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Tue, 22 Aug 2023 02:05:21 -0700 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Tue, 22 Aug 2023 02:05:20 -0700 Received: from nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37 via Frontend Transport; Tue, 22 Aug 2023 02:05:18 -0700 From: Michael Baum To: CC: Ori Kam , Aman Singh , "Yuying Zhang" , Ferruh Yigit , "Thomas Monjalon" Subject: [PATCH v1 2/2] app/testpmd: add random item support Date: Tue, 22 Aug 2023 12:05:05 +0300 Message-ID: <20230822090505.3242455-3-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 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00001506:EE_|CH0PR12MB5268:EE_ X-MS-Office365-Filtering-Correlation-Id: d523b736-3e34-4272-3bd7-08dba2eef2fe 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: zk4AWKi1KQB4cPwtSltIZDM7sv9vNqmt9PnkhpirZ6zMZFl4ZTWWyGpIC2CgGv/YKwFbRTyf7b4RQGu0UeUhQxOtvcegH9yi5A/rnX4MZMVPU/CeomnOWC7kQE1/2YcNegQZ0Ldr0g4UK+L+3b4mHZkcrYcb2H/2bPypaIPn5UtusHnFkMOCQrGKRnNfI10lsd7L4xJ1Xc9/aPGSrsLk12SFWFXTft8b3nYCyocO9JBGXkDvYM6mjhLjbF5J8SZHRm2luKWLkPkq4QimeRwAmCf8vdLaCoQRmO/7pqEniP4U/M3oOxxaz4mK5Wwv+s0RKEtE9bmwfVrUrrvIJ2JKRN22XD/fqgrrD5iikoTTs39pcj1J7WpVDXkXS9xh49hQaQDBkl7NHnGWU1W8yF9Q0+9yF5EWkMqbZQ1fy/HkhxOnpJPXD8rgm9syOrQ9Lvy/2/KI1gSKPDIajmjSmhdTN29VDPJuAGzBo/5a/zV+XrQNFOrEB929dFVrQEzibdl8VqiSnThsWjxqd3HWOKTqnhgol2iTikVpTDT1M7iaXI+8axmrD+zKAbh72r9oQARFuYdRmGi1UTv4+27oNA0f4Z64LtkjaFSUvPT1JOMVFq99Y6IFYyUh9RGZ491edU+vL7Pv6NXF8n3jDjqZPrs2fguC86020vOlLV4v1o2cyW7FkL5cn5n1od9TSUiF3GR734QzRi1E9dZt6Gvkz0Xn7MWCoG3Bl8Olgq3MNbBuaxowRcoPXPLlHrmXJW2Q+Mu1 X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230031)(4636009)(396003)(136003)(39860400002)(346002)(376002)(1800799009)(186009)(451199024)(82310400011)(46966006)(36840700001)(40470700004)(54906003)(6916009)(70206006)(70586007)(316002)(8676002)(8936002)(2616005)(4326008)(7636003)(40460700003)(36756003)(41300700001)(1076003)(82740400003)(356005)(478600001)(6666004)(55016003)(40480700001)(83380400001)(2906002)(86362001)(7696005)(47076005)(36860700001)(336012)(426003)(5660300002)(26005)(6286002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2023 09:05:36.4158 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d523b736-3e34-4272-3bd7-08dba2eef2fe 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.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00001506.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5268 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 Add support for random item, usage example: pattern random spec value 0x1 mask value 0x3 / eth / end Flow rule with above pattern matching 25% of the traffic, it hits only when random value suffix is "01" and miss the others ("00", "10", "11"). Signed-off-by: Michael Baum --- app/test-pmd/cmdline_flow.c | 30 ++++++++++++++++++++- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 4 +++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 94827bcc4a..55fb07ec91 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -417,6 +417,8 @@ enum index { ITEM_ICMP6_ND_OPT_TLA_ETH_TLA, ITEM_META, ITEM_META_DATA, + ITEM_RANDOM, + ITEM_RANDOM_VALUE, ITEM_GRE_KEY, ITEM_GRE_KEY_VALUE, ITEM_GRE_OPTION, @@ -936,7 +938,8 @@ static const char *const modify_field_ids[] = { "ipv6_proto", "flex_item", "hash_result", - "geneve_opt_type", "geneve_opt_class", "geneve_opt_data", "mpls", + "geneve_opt_type", "geneve_opt_class", "geneve_opt_data", + "mpls", "random", NULL }; @@ -1535,6 +1538,7 @@ static const enum index next_item[] = { ITEM_ICMP6_ND_OPT_SLA_ETH, ITEM_ICMP6_ND_OPT_TLA_ETH, ITEM_META, + ITEM_RANDOM, ITEM_GRE_KEY, ITEM_GRE_OPTION, ITEM_GTP_PSC, @@ -1842,6 +1846,12 @@ static const enum index item_meta[] = { ZERO, }; +static const enum index item_random[] = { + ITEM_RANDOM_VALUE, + ITEM_NEXT, + ZERO, +}; + static const enum index item_gtp_psc[] = { ITEM_GTP_PSC_QFI, ITEM_GTP_PSC_PDU_T, @@ -5063,6 +5073,21 @@ static const struct token token_list[] = { .args = ARGS(ARGS_ENTRY_MASK(struct rte_flow_item_meta, data, "\xff\xff\xff\xff")), }, + [ITEM_RANDOM] = { + .name = "random", + .help = "match random value", + .priv = PRIV_ITEM(RANDOM, sizeof(struct rte_flow_item_random)), + .next = NEXT(item_random), + .call = parse_vc, + }, + [ITEM_RANDOM_VALUE] = { + .name = "value", + .help = "random value", + .next = NEXT(item_random, NEXT_ENTRY(COMMON_UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_MASK(struct rte_flow_item_random, + value, "\xff\xff")), + }, [ITEM_GRE_KEY] = { .name = "gre_key", .help = "match GRE key", @@ -12634,6 +12659,9 @@ flow_item_default_mask(const struct rte_flow_item *item) case RTE_FLOW_ITEM_TYPE_META: mask = &rte_flow_item_meta_mask; break; + case RTE_FLOW_ITEM_TYPE_RANDOM: + mask = &rte_flow_item_random_mask; + break; case RTE_FLOW_ITEM_TYPE_FUZZY: mask = &rte_flow_item_fuzzy_mask; break; diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index a182479ab2..0b27a6fd97 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3724,6 +3724,10 @@ This section lists supported pattern items and their attributes, if any. - ``data {unsigned}``: metadata value. +- ``random``: match application specific random value. + + - ``value {unsigned}``: random value. + - ``gtp_psc``: match GTP PDU extension header with type 0x85. - ``pdu_type {unsigned}``: PDU type.