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 4034241B9E; Wed, 1 Feb 2023 12:35:44 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 25CD742D33; Wed, 1 Feb 2023 12:35:44 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2049.outbound.protection.outlook.com [40.107.243.49]) by mails.dpdk.org (Postfix) with ESMTP id 556E3406A2 for ; Wed, 1 Feb 2023 12:35:42 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J5DP7TxoUXerEoIE/CtjwqyoDoV7vfsHaPrS9uj6/oIs7wsRLaaErbqFcqWrzv08g/abpMvML2MS26rZIwSe491jrGfbzRs+rAA1ZqDcL2I/jefSdOvhfq12vmPZmgTinpm5Tj3VfuB7mjgsRA+shTM0hGllNpN/JPhpgnza8Pl1NSDLWgiYwMQ3E13kfp2II1wSVmRhXzg4UAI+caH/UlckbhWI9fJ3zzM7ErIf2R6z6g33DPwLs9dcD+JdMiDs1VcgOffNHTDAU4FG8aN1SA6Dn29mjKEXPXmIqCgxjPJkF/nYjZ57GB2eaQlIo7/EDjWl6WDC98xV9kVyfxCVKQ== 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=PSKekoF1nBcGnPQStU7Zw+hHtL3mwYxHfClYo+GzkkE=; b=bMAP7tl1NrQpQw2Hk5JlXsJrJbHaA8zJTkBlF7TZo5sMjhUhsytgXPmwHgTwUpKIc3MFSuxufKo8DUaw8rKBFCKjV8/27iWW0OlqvkJGkTk0OYnZSVd9ibodPmiEhF/GluJ4EI35aVyfLZvnUQmqsY/UORNWqv7JFVOXmrsk9qqS6f24iRV0KFf9xlFI0RXImfFOjZx6imJmpqh72cuNvRh2EIJCRfIBGCWvgl/vIn0wYDbmLYJZkJzz3vnwMFZThg+E9giNPi1uimdSgwgH0v72lt9Zwqf9zxX0og24qfgrUxs7Pq6MhpfR7WKzv0Xloe3H/KitfYuADWc++dBJ5w== 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=PSKekoF1nBcGnPQStU7Zw+hHtL3mwYxHfClYo+GzkkE=; b=W5GxJeC2uH6vi/Mni3gA/61FWkaOXU74XwuzpEAfimrLY/tNOFe6jRvbX2B3xKD/gjD5K86zjZcM2kKEWTZCvYQjmx0a2q0vOenF9SqCAEhXJu2W2x89Zs5sPKNJdx6kQAK5LvdNUHLOS/3eTf4aCrkPrXcFpErDSQ/qy5YL+GhYwEs97Gna19/3EgcgF6SCTSSQVm9wmnqTR+6Ux7dtwHu9cq33EVBcFDZCP66O6QT68SVU2yu2CkBJZi+eaPFlL2jiXmhVG/Q1iVQcALif0PnoGnkKngpkpjsOboNn+gZw60p+Rpy1gq3z5j6l/bf6AG9jxa3/QYUf0aPWEsxYXg== Received: from DS7PR03CA0256.namprd03.prod.outlook.com (2603:10b6:5:3b3::21) by DS7PR12MB5789.namprd12.prod.outlook.com (2603:10b6:8:74::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.38; Wed, 1 Feb 2023 11:35:40 +0000 Received: from DS1PEPF0000E642.namprd02.prod.outlook.com (2603:10b6:5:3b3:cafe::a1) by DS7PR03CA0256.outlook.office365.com (2603:10b6:5:3b3::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.25 via Frontend Transport; Wed, 1 Feb 2023 11:35:40 +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 DS1PEPF0000E642.mail.protection.outlook.com (10.167.17.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.17 via Frontend Transport; Wed, 1 Feb 2023 11:35:40 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) 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.36; Wed, 1 Feb 2023 03:35:30 -0800 Received: from nvidia.com (10.126.230.37) by rnnvmail201.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.36; Wed, 1 Feb 2023 03:35:27 -0800 From: Rongwei Liu To: , , , , CC: , Aman Singh , Yuying Zhang , Ferruh Yigit , "Andrew Rybchenko" , Olivier Matz Subject: [PATCH v5 1/3] ethdev: add IPv6 routing extension header definition Date: Wed, 1 Feb 2023 13:35:09 +0200 Message-ID: <20230201113511.2362188-2-rongweil@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20230201113511.2362188-1-rongweil@nvidia.com> References: <0c02f3bb-f733-b534-86e5-0cd047d927ee@oktetlabs.ru> <20230201113511.2362188-1-rongweil@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.37] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E642:EE_|DS7PR12MB5789:EE_ X-MS-Office365-Filtering-Correlation-Id: 34005f86-93d7-481f-a9ba-08db04487272 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: NPiyys3v+/DHJo9C3vkGcmj8/pQry1BQaMBfzRyIGIHehXvEz6kzXy8qIrwXUGCI75SQDjCu4AVWES0toRwcrFPuMabynlYxJULHBwmb3kMDoIB+b2KiH+opm+ltNNW/gPu4x4ugVTkCUJlOpxh5CU4A/QRqTtILh0RyaodKmsqcNOXxT7nmZzFTVE1A2sklnDk7CG8cW4Ss0sn8JrNBNgmrufD8LLRbDUSe54YSOvZKeFCs+hrmmWK/NIYOXVyEVyGOjL+h5cz65reAJFBTuCL/stee+jRpC6AcdnBcxYiXNugoRo7bRS/jQyVqWysh5hUdEKbri2AbI/ZwypAsb/Ae5qVP5z+ObSoqzVqIF8HuyskpYLFzQ2+95+vECGBn3CpjYx27tQYDcMhNgEp75Urd0vxieyci5ycfpER72S/eQlFm8+fKApcaAxU5BA+v4zWrS3CjLAXrHVO2xUE185ep6knCageDNcIoAPUIPgHEBr5V+TO1c7H8nwBPqpsGP9jdsutclghyvHgmBjOPqBZyUURqAgi7WTbcg9ku7mU3LWB4RMdLqtQPvvg3vwEyXhIEMJ6tOXAJjgFcEjOQQGyIMLg4iu3wZJsjEy1ElfvDO6ekHQRkZ3i+wHscubRSHGiCD7h/0taHHkFi5lYe9eY2Qehm4ndvhXx2xK54/ljfICT8yvAJ6vQ3Fy5eXd1eh8TIl/2aKDe0iEEu569VfQ== 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:(13230025)(4636009)(39860400002)(136003)(346002)(396003)(376002)(451199018)(36840700001)(46966006)(40470700004)(2616005)(336012)(82310400005)(47076005)(6666004)(316002)(83380400001)(54906003)(426003)(2906002)(36756003)(7636003)(82740400003)(110136005)(70206006)(186003)(70586007)(16526019)(7696005)(478600001)(40460700003)(1076003)(26005)(6286002)(356005)(8676002)(86362001)(36860700001)(41300700001)(4326008)(5660300002)(40480700001)(55016003)(8936002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2023 11:35:40.5768 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 34005f86-93d7-481f-a9ba-08db04487272 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: DS1PEPF0000E642.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5789 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 IPv6 routing extension header definition and no TLV support for now. At rte_flow layer, there are new items defined for matching type/nexthdr/segments_left field. Add command line support for IPv6 routing extension header matching: type/nexthdr/segment_list. Signed-off-by: Rongwei Liu Acked-by: Ori Kam --- app/test-pmd/cmdline_flow.c | 46 ++++++++++++++++++++++++++ doc/guides/prog_guide/rte_flow.rst | 9 +++++ doc/guides/rel_notes/release_23_03.rst | 9 +++++ lib/ethdev/rte_flow.c | 1 + lib/ethdev/rte_flow.h | 19 +++++++++++ lib/net/rte_ip.h | 20 +++++++++++ 6 files changed, 104 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 88108498e0..7a8516829c 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -298,6 +298,10 @@ enum index { ITEM_IPV6_SRC, ITEM_IPV6_DST, ITEM_IPV6_HAS_FRAG_EXT, + ITEM_IPV6_ROUTING_EXT, + ITEM_IPV6_ROUTING_EXT_TYPE, + ITEM_IPV6_ROUTING_EXT_NEXT_HDR, + ITEM_IPV6_ROUTING_EXT_SEG_LEFT, ITEM_ICMP, ITEM_ICMP_TYPE, ITEM_ICMP_CODE, @@ -1326,6 +1330,7 @@ static const enum index next_item[] = { ITEM_ARP_ETH_IPV4, ITEM_IPV6_EXT, ITEM_IPV6_FRAG_EXT, + ITEM_IPV6_ROUTING_EXT, ITEM_ICMP6, ITEM_ICMP6_ND_NS, ITEM_ICMP6_ND_NA, @@ -1435,6 +1440,15 @@ static const enum index item_ipv6[] = { ITEM_IPV6_SRC, ITEM_IPV6_DST, ITEM_IPV6_HAS_FRAG_EXT, + ITEM_IPV6_ROUTING_EXT, + ITEM_NEXT, + ZERO, +}; + +static const enum index item_ipv6_routing_ext[] = { + ITEM_IPV6_ROUTING_EXT_TYPE, + ITEM_IPV6_ROUTING_EXT_NEXT_HDR, + ITEM_IPV6_ROUTING_EXT_SEG_LEFT, ITEM_NEXT, ZERO, }; @@ -3844,6 +3858,38 @@ static const struct token token_list[] = { .args = ARGS(ARGS_ENTRY_BF(struct rte_flow_item_ipv6, has_frag_ext, 1)), }, + [ITEM_IPV6_ROUTING_EXT] = { + .name = "ipv6_routing_ext", + .help = "match IPv6 routing extension header", + .priv = PRIV_ITEM(IPV6_ROUTING_EXT, + sizeof(struct rte_flow_item_ipv6_routing_ext)), + .next = NEXT(item_ipv6_routing_ext), + .call = parse_vc, + }, + [ITEM_IPV6_ROUTING_EXT_TYPE] = { + .name = "ext_type", + .help = "match IPv6 routing extension header type", + .next = NEXT(item_ipv6_routing_ext, NEXT_ENTRY(COMMON_UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv6_routing_ext, + hdr.type)), + }, + [ITEM_IPV6_ROUTING_EXT_NEXT_HDR] = { + .name = "ext_next_hdr", + .help = "match IPv6 routing extension header next header type", + .next = NEXT(item_ipv6_routing_ext, NEXT_ENTRY(COMMON_UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv6_routing_ext, + hdr.next_hdr)), + }, + [ITEM_IPV6_ROUTING_EXT_SEG_LEFT] = { + .name = "ext_seg_left", + .help = "match IPv6 routing extension header segment left", + .next = NEXT(item_ipv6_routing_ext, NEXT_ENTRY(COMMON_UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv6_routing_ext, + hdr.segments_left)), + }, [ITEM_ICMP] = { .name = "icmp", .help = "match ICMP header", diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 3e6242803d..602fab29d3 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -1544,6 +1544,15 @@ Matches Color Marker set by a Meter. - ``color``: Metering color marker. +Item: ``IPV6_ROUTING_EXT`` +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Matches IPv6 routing extension header. + +- ``next_hdr``: Next layer header type. +- ``type``: IPv6 routing extension header type. +- ``segments_left``: How many IPv6 destination addresses carries on. + Actions ~~~~~~~ diff --git a/doc/guides/rel_notes/release_23_03.rst b/doc/guides/rel_notes/release_23_03.rst index c15f6fbb9f..1337da73b8 100644 --- a/doc/guides/rel_notes/release_23_03.rst +++ b/doc/guides/rel_notes/release_23_03.rst @@ -69,6 +69,11 @@ New Features ``rte_event_dev_config::nb_single_link_event_port_queues`` parameter required for eth_rx, eth_tx, crypto and timer eventdev adapters. +* **Added rte_flow support for matching IPv6 routing extension header fields.** + + Added ``ipv6_routing_ext`` items in rte_flow to match IPv6 routing extension + header. + Removed Items ------------- @@ -98,6 +103,10 @@ API Changes Also, make sure to start the actual text at the margin. ======================================================= +* net: added a new structure: + + - IPv6 routing extension header ``rte_ipv6_routing_ext``. + ABI Changes ----------- diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c index 7d0c24366c..4da581146e 100644 --- a/lib/ethdev/rte_flow.c +++ b/lib/ethdev/rte_flow.c @@ -157,6 +157,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = { MK_FLOW_ITEM(L2TPV2, sizeof(struct rte_flow_item_l2tpv2)), MK_FLOW_ITEM(PPP, sizeof(struct rte_flow_item_ppp)), MK_FLOW_ITEM(METER_COLOR, sizeof(struct rte_flow_item_meter_color)), + MK_FLOW_ITEM(IPV6_ROUTING_EXT, sizeof(struct rte_flow_item_ipv6_routing_ext)), }; /** Generate flow_action[] entry. */ diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index b60987db4b..9b9018cba2 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -624,6 +624,13 @@ enum rte_flow_item_type { * See struct rte_flow_item_meter_color. */ RTE_FLOW_ITEM_TYPE_METER_COLOR, + + /** + * Matches the presence of IPv6 routing extension header. + * + * @see struct rte_flow_item_ipv6_routing_ext. + */ + RTE_FLOW_ITEM_TYPE_IPV6_ROUTING_EXT, }; /** @@ -873,6 +880,18 @@ struct rte_flow_item_ipv6 { uint32_t reserved:23; }; +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice + * + * RTE_FLOW_ITEM_TYPE_IPV6_ROUTING_EXT. + * + * Matches an IPv6 routing extension header. + */ +struct rte_flow_item_ipv6_routing_ext { + struct rte_ipv6_routing_ext hdr; +}; + /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6. */ #ifndef __cplusplus static const struct rte_flow_item_ipv6 rte_flow_item_ipv6_mask = { diff --git a/lib/net/rte_ip.h b/lib/net/rte_ip.h index 9c8e8206f0..1f23e24af5 100644 --- a/lib/net/rte_ip.h +++ b/lib/net/rte_ip.h @@ -539,6 +539,26 @@ struct rte_ipv6_hdr { uint8_t dst_addr[16]; /**< IP address of destination host(s). */ } __rte_packed; +/** + * IPv6 Routing Extension Header + */ +struct rte_ipv6_routing_ext { + uint8_t next_hdr; /**< Protocol, next header. */ + uint8_t hdr_len; /**< Header length. */ + uint8_t type; /**< Extension header type. */ + uint8_t segments_left; /**< Valid segments number. */ + __extension__ + union { + rte_be32_t flags; /**< Packet control data per type. */ + struct { + uint8_t last_entry; /**< The last_entry field of SRH */ + uint8_t flag; /**< Packet flag. */ + rte_be16_t tag; /**< Packet tag. */ + }; + }; + /** Following variable number of segments. */ +} __rte_packed; + /* IPv6 vtc_flow: IPv / TC / flow_label */ #define RTE_IPV6_HDR_FL_SHIFT 0 #define RTE_IPV6_HDR_TC_SHIFT 20 -- 2.27.0