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 A1F7D43412; Thu, 30 Nov 2023 17:32:52 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7291542EEF; Thu, 30 Nov 2023 17:32:48 +0100 (CET) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2085.outbound.protection.outlook.com [40.107.237.85]) by mails.dpdk.org (Postfix) with ESMTP id 6F64C42DA1 for ; Thu, 30 Nov 2023 17:32:46 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=acij5QCoOooKzctiB3lF60UvtmSKkBMOp5ItxmSMW3ZZSTFP0BeuQGQUkaBcx8O5E8i9v/QpwonfgQQLYwAJAkdgm+X+7Ty97UCb+B6tRBt/EXd7Xd3CvCDTn6pYa55RhPqQptQZCCYLVwTlAU5Ay2k5O1+/MnbSs2z3RSDlbpVqq2zEDWtGV7gzD2/afWeuTm7T4UeO5CC+YzvB95PaxYU1skk7qtg6CeYpysLu9lvPBEFEUlo0ugmB/u41XxtyRHOXlUrzZAqjYQ1WMnby9dcryZVjPaTL0Aicjkh9CfzT7DBf8rxcdXKZuMKnTqYWfLuO2eo9RmsL7yXswUmE8A== 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=ViDFTBi6rZPsG9NY/hE2mO0MinW3AnOn42yRtXxPmZc=; b=JRULbJ23ToeA9iDI9aZFUatjv3RJEYWH6jwSyVEsA5vOm6TSl89n+433img/dsl3ZTM1fTFkSI1XXmjpXy6RQJn+EgYlbPg0JkOUCHocHuRJKlNnQsKl/NZ4X3RxAuIe0VV4WAQB49dK3Mb4XfDYmQ5HJY7atKq45T9a8uMyw0WZvMmvkEgVp//Nw2quu1FYJCbBrGhBKcmCQeHhDwbZb5dOuXOHTf98/BbU1FizX9Ai8bm9Vd1kO8ME9XuCSUZ/JVFqrCShl71+usthk/ENnzuZv++rWqzpvvIeWCA3aWkuASeSK4OInjztQ5Wjv0yJtJ9K6Ic7WPxaH3evBmyw+w== 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 (0) 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=ViDFTBi6rZPsG9NY/hE2mO0MinW3AnOn42yRtXxPmZc=; b=PVXqOZguMCZN/F96NVprDvceN713eqeVjEIYyfknutDWIkl5NJD1fahNO/T+jd/37DkL/mmvChcJPJ6BQjksLqBY0AKHGYLK2rKhsEG//MPBpDWUcKxk18JNjgTpK5TwoxGnqFB21zJJFEqMeip3bra6IARNKZuUCzGdBMcNc/jq3yS2K7tXU5H3hkw8up7N+hxpXaRL17tvT88pvEqOVxpunVR/C0xUH9a2wE9xq6pDAkkfHn78AdVPyUJK5dyI0RxkhvzAEXUzDkp4h+ATnI24xJcwtjbHBmNBAnv3IwOz3DZ6ZumOIgyU9sylQbcMjxqBlElZpZ2IkLTCuI0DYA== Received: from BL1PR13CA0211.namprd13.prod.outlook.com (2603:10b6:208:2bf::6) by PH7PR12MB6393.namprd12.prod.outlook.com (2603:10b6:510:1ff::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.22; Thu, 30 Nov 2023 16:32:43 +0000 Received: from BL6PEPF0001AB75.namprd02.prod.outlook.com (2603:10b6:208:2bf:cafe::ea) by BL1PR13CA0211.outlook.office365.com (2603:10b6:208:2bf::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.22 via Frontend Transport; Thu, 30 Nov 2023 16:32:43 +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 BL6PEPF0001AB75.mail.protection.outlook.com (10.167.242.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.17 via Frontend Transport; Thu, 30 Nov 2023 16:32:42 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) 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.41; Thu, 30 Nov 2023 08:32:24 -0800 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail204.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.41; Thu, 30 Nov 2023 08:32:24 -0800 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.41 via Frontend Transport; Thu, 30 Nov 2023 08:32:22 -0800 From: Michael Baum To: CC: Ori Kam , Aman Singh , "Yuying Zhang" , Ferruh Yigit , "Thomas Monjalon" Subject: [PATCH v3 1/2] ethdev: add random item support Date: Thu, 30 Nov 2023 18:32:14 +0200 Message-ID: <20231130163215.666239-2-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231130163215.666239-1-michaelba@nvidia.com> References: <20230911074149.697944-1-michaelba@nvidia.com> <20231130163215.666239-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: BL6PEPF0001AB75:EE_|PH7PR12MB6393:EE_ X-MS-Office365-Filtering-Correlation-Id: c0d670f6-93c9-4c2d-89ff-08dbf1c1fa16 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: nW+SxBhq4QQdmCoF0vaDD0u8nzxeX23Lv3F1FMTAdtr/UKQ2DkdsjATTgidK09I+6lXl8LAZI4GdNfSPT1Xf1KYZDOtAV6H8QYNrFA5bLyg515hIlM508tuyS2V7TqkytyNeom+/qT9YF+BLahbwotKytx5R9IOO1zSbnZpnrKcezaTZ6iLCDl/X13w6Ni3zb7XmwP1RilsjMU4ZKaQvSGmKrlt+Nc6OEg5lQEhwLfwASdq/2aAJ2XHh43uTOcU8gC8cS0qqX+gl3054yRuNVK2gtEbViDi3wm/FKFmcukUp5AAOhfE21WyFGCY2E/zfVCLn4JDrk6qBN7VfYTtc9A1DetoqYgL4w7Q9/oP4FMaMs/qHHecBk9ZOpt63l+Es4ObkvjcF/f4Ju+rUfjLgq26P9dqiiMwoT5t3qzG5XedH8YZhdbBGouQ4VmPthQVKpJoAQ5NRv28iHrP/ZKPoLsL6afZKn/Z8WaF+rgiTlQI8OwAHajG2fJmUhdB90DtENaA3iv3Fb7113eDpz9TsXJeEVo8jli5K/qMMMgtjWcs9FkaMn1BZJpBJumI33kS7eMnyuGa1kRh9Or/9rTPEKhUipOepIfuOJrh0eVz/G4EvpWmqkjknN2hQ+Tdu71om7bhGeuzrwXz+IQW+/4c6pTSfKWJ4i6CyfT/KB2PhYn5eQ/T8bZZhQZPbAwk7s6NREXouwDsJGD1HzAkYmAFVAPy+vzOLPUORYH/oB0ZE6rD8/BG+iuPb2tKVIUmabnjmHB9hhJvnrZXu6g6YmKRWuA== 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)(39860400002)(346002)(136003)(376002)(396003)(230922051799003)(230273577357003)(230173577357003)(186009)(64100799003)(82310400011)(1800799012)(451199024)(46966006)(36840700001)(40470700004)(478600001)(6666004)(40460700003)(2616005)(26005)(356005)(6286002)(426003)(82740400003)(1076003)(336012)(36860700001)(5660300002)(2906002)(70206006)(8676002)(8936002)(70586007)(54906003)(6916009)(4326008)(316002)(83380400001)(7636003)(41300700001)(36756003)(7696005)(47076005)(86362001)(55016003)(40480700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2023 16:32:42.7945 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c0d670f6-93c9-4c2d-89ff-08dbf1c1fa16 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: BL6PEPF0001AB75.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6393 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 | 13 ++++++++++ doc/guides/rel_notes/release_24_03.rst | 4 +++ lib/ethdev/rte_flow.c | 1 + lib/ethdev/rte_flow.h | 35 +++++++++++++++++++++++++- 5 files changed, 53 insertions(+), 1 deletion(-) diff --git a/doc/guides/nics/features/default.ini b/doc/guides/nics/features/default.ini index 806cb033ff..6d50236292 100644 --- a/doc/guides/nics/features/default.ini +++ b/doc/guides/nics/features/default.ini @@ -140,6 +140,7 @@ pppoe_proto_id = ptype = 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 627b845bfb..fd7fddb6cd 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -1573,6 +1573,19 @@ Matches the packet type as defined in rte_mbuf_ptype. - ``packet_type``: L2/L3/L4 and tunnel information. +Item: ``RANDOM`` +^^^^^^^^^^^^^^^^ + +Matches a random value. + +The rundom number is generated by PMD, +application can match on either exact value or range of values. +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``: Specific value to match. + Actions ~~~~~~~ diff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_notes/release_24_03.rst index e9c9717706..ab91ce2b21 100644 --- a/doc/guides/rel_notes/release_24_03.rst +++ b/doc/guides/rel_notes/release_24_03.rst @@ -55,6 +55,10 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= +* **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 549e329558..090b936ca9 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 affdc8121b..887401bb86 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -704,6 +704,19 @@ enum rte_flow_item_type { * */ RTE_FLOW_ITEM_TYPE_PTYPE, + + /** + * [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, }; /** @@ -2047,6 +2060,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. * @@ -3903,7 +3935,8 @@ enum rte_flow_field_id { RTE_FLOW_FIELD_TCP_DATA_OFFSET, /**< TCP data offset. */ RTE_FLOW_FIELD_IPV4_IHL, /**< IPv4 IHL. */ RTE_FLOW_FIELD_IPV4_TOTAL_LEN, /**< IPv4 total length. */ - RTE_FLOW_FIELD_IPV6_PAYLOAD_LEN /**< IPv6 payload length. */ + RTE_FLOW_FIELD_IPV6_PAYLOAD_LEN,/**< IPv6 payload length. */ + RTE_FLOW_FIELD_RANDOM /**< Random value. */ }; /** -- 2.25.1