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 28AB94256B; Mon, 11 Sep 2023 09:42:19 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2E2A8402E1; Mon, 11 Sep 2023 09:42:13 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by mails.dpdk.org (Postfix) with ESMTP id 359BC402DA for ; Mon, 11 Sep 2023 09:42:11 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c38ctoJfnYwFiSqqdDZQHGRIS9fvMsBhQZlfG7GL5IpgI361ap5M6ZBfzyHg8x9RyUEhOFBAg9bpJk0l/aJYTRl9KAd4WcLsvQYgX1tp6+vHZKzpqo4Xv474pUbrygAAOqZu44mNdU2a/GlG6/OvB2/FGdPx0XoBIijVCmBls21k8fWDJy2/xNxzmshSbW9MHvcOTcdimGtEhrqkkmS++2cLfq38+GJdEnhot3vkIFV1cx5+C1yksVhF4gzf6mLvTC2OiMgbcQRNtGjJcUPI2EX+VH2JUisY9GdAnsvP/VQkKvrqjGN6jInNfl3Q0DGC3VRbs0yVxME1mlon3gIADQ== 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=vDh4mlYRyt7qUUv11iPl8ibd767Xz3Plv2t1+MY5HL4=; b=PXtsF06yWOqWnlu3zpBPd4GFXD0XQQ2R8rQvbgmMj7qNPlTGliutIDgZ4h5RtWZQAkFrZvTr1hu5yojOjWW7CdiPlTrUsX5T+YZK02GCm6R16b7ZPe4/t9nWsVWNcTwSJIWY8POIDfF0ZJ9bP0ux7zFjenuebvzTVtW4qwyYisQQPBnkOCOhJokTygREKP7Yq3UCuhKPONKFhhub0IIgix/xfR7b/Yj80W1qOSDplawnpdz8QH6cHN9kiNvALpccjUM17HFO5uLUYdb5wKeAo0iivHLjwk6LJU7eprYmCakS+YF5hY5uiNxGV8NYiP9g1JME5dQSTpHmui59f6ksZg== 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=vDh4mlYRyt7qUUv11iPl8ibd767Xz3Plv2t1+MY5HL4=; b=INDsnz3rGNPX9/PpXph8NL/fgUE180GnwuR4lBvVHaK339PLtlVuvVJOYTEJnfPrZtaID5KwabA7/WhklB90TINdmXaqsuRhfNmNkeT+vnHJQOf/7rtC8THvPCChZe4f5lBduPMSDZNzBb/Uu+XzmXpJCPqezkMCHwBhmc+w9gwRqMS1i5qWKRSaegsWqQfw+c4ihPDKv/aejl8AkM28DSX2L8elic0gC7DvH31VqCizYgQDVWhoesJZxFMMIZCMcmjsBnQ5oFKg8DeWzCC4Tm5KjbfmBohgTflK7AX6YaW2WICysSiLsy8UZusrgHZINaoHYI4/S50vSASLVQ5Blw== Received: from SA9PR13CA0049.namprd13.prod.outlook.com (2603:10b6:806:22::24) by LV3PR12MB9165.namprd12.prod.outlook.com (2603:10b6:408:19f::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.31; Mon, 11 Sep 2023 07:42:09 +0000 Received: from SN1PEPF000252A3.namprd05.prod.outlook.com (2603:10b6:806:22:cafe::9f) by SA9PR13CA0049.outlook.office365.com (2603:10b6:806:22::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.14 via Frontend Transport; Mon, 11 Sep 2023 07:42:09 +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 SN1PEPF000252A3.mail.protection.outlook.com (10.167.242.10) 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 Received: from rnnvmail202.nvidia.com (10.129.68.7) 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:58 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail202.nvidia.com (10.129.68.7) 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:58 -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:56 -0700 From: Michael Baum To: CC: Ori Kam , Aman Singh , "Yuying Zhang" , Ferruh Yigit , "Thomas Monjalon" Subject: [PATCH v2 1/2] ethdev: add random item support Date: Mon, 11 Sep 2023 10:41:48 +0300 Message-ID: <20230911074149.697944-2-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230911074149.697944-1-michaelba@nvidia.com> References: <20230822090505.3242455-1-michaelba@nvidia.com> <20230911074149.697944-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: SN1PEPF000252A3:EE_|LV3PR12MB9165:EE_ X-MS-Office365-Filtering-Correlation-Id: faacfccf-f8fb-41a6-09d7-08dbb29a9a74 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: 4dXE8HmQK5Lc97r1sKdOqsm0RjA4ZdxDFwYLXt3bCgckmV08OO/EGjQn4pehxr5S6ixW/zBIrHtekj/E1rg7c8do1hn50YOyQBIYzGQ6d2YyxTIQbrXXw6n70TMVkAnRu1+h/WfZcGdGlcmRybb4ruoC9lXvvgKpeCSWXE6BdE+5uJUqD+EAaypcuWVlqrvuhm/T8z7SwhTWMbFWLWMhzZZ+sMRQ4VBRBPd00zGkSJFJwvs9qBWXWdDJG7fzY0Q0UNCBc6iBm+JsaPLbRq0IQm5NMxl6IOf8RhjJYmt66n7yUYghiiaB5ptpRX7whVmOFE7hl/I/7dVU37pJ6hQ423vuBdnO7rOO++1mhDkalXkGrc+vdcZbyPWhbtnQj6XyFL0wgEfGqyxc9yG0BfQt6gnH7EWi7qeFpi29WYeH/1HQoEJYpuyQoOBfeNeMfb34evCVZxySQYA4XksPMNQuF+2+ZCnfDeKeO2VLl69MHieVMYU8TyMCa4Och29wKOAid0jOOCtp3rz3B5p+iZbuzLtaBndimO3eHzl5ieHQgTwHwy2MzfHX3QIrKFcjVaWHjMtpVFbHGz3Fau4Z2jfWYj3G5qXr+wosQrlMBmRGz5xNTRSTQjNCR+DCqP0XHjvOib8b9E+2bihTCoprYjZrZiamlQC5MpmLmfGZ+Ui/HNKiHhvp5MNhcDJScC6jx62/8TWAfTFNz9PMB6/SJMSbvVTMwfvzCQrMT2/BoTo+7BPp5jJtAKcqUPyZ5b4VKmam 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)(376002)(346002)(396003)(39860400002)(136003)(451199024)(82310400011)(186009)(1800799009)(46966006)(40470700004)(36840700001)(41300700001)(7636003)(6666004)(7696005)(40460700003)(36756003)(40480700001)(86362001)(82740400003)(55016003)(356005)(47076005)(36860700001)(1076003)(2616005)(6286002)(336012)(2906002)(426003)(83380400001)(478600001)(70586007)(316002)(70206006)(8676002)(8936002)(4326008)(5660300002)(26005)(6916009)(54906003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2023 07:42:08.7810 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: faacfccf-f8fb-41a6-09d7-08dbb29a9a74 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: SN1PEPF000252A3.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR12MB9165 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 333e1d95a2..bcd71138cb 100644 --- a/doc/guides/rel_notes/release_23_11.rst +++ b/doc/guides/rel_notes/release_23_11.rst @@ -78,6 +78,10 @@ New Features * build: Optional libraries can now be selected with the new ``enable_libs`` build option similarly to the existing ``enable_drivers`` build option. +* **Added flow matching of random value.** + + 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. */ }; /** -- 2.25.1