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 D5BCB41BAB; Thu, 2 Feb 2023 11:01:22 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 91BDE42D81; Thu, 2 Feb 2023 11:01:19 +0100 (CET) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2086.outbound.protection.outlook.com [40.107.92.86]) by mails.dpdk.org (Postfix) with ESMTP id 6DB3942D6D for ; Thu, 2 Feb 2023 11:01:18 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=beDo8ytOV83bthL0Dm1d4b5k/MkDWQsoLt29HHQi/sm3TQjKDeAUuSx3XogEe2p1a7p4xS4DlSZxk5vckgIC1SxwwBjuhXxOG/EZwV8kLVwkcIQnlq4eEatqq82HXDNhTO9YyVAUhJAumiCran5l0uWL+1jYfnO4RKLzDddJuYpIIQAPTpFo7p8dNHQIlHvT2D+rPIvpsmmtkVZNikI9RFztjmOGc87/RMhQjpb13obQbSMK8Z81HnlVhDYariVTO96Zo5EHLTGHdRSxaR85XzFyLIAJcRtI/wj18v3jqk07EtsB8j8FOZnGAE8o0hUSNVUlqVbxGQbVYiiezeBe6g== 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=3J4SHx0CczHnY16y+CfhToLTlyBOMCmd3IE5w/flQR0=; b=eEKIIX+gYYgdQn91bzPRSpoeX8gUC3BMjaBVFW+5ZzLTiXlLPYn8S8Gtcx3WlyXxz6tHjLCzfDs6zAs5HghxdPIyNKlRs6eNu7LbYjYzXAVTiwhiu7HWuY4kQh/EDn/GCUQEAsYsTpSRHBhPFk+/XPpZJPJnAdzyzN/Kt8C1FfGvg4rbvksQdpi2AfpdKUkTBgfXo9s710t6SAnip6T3tC3fdmBnNrAJbPmyHAfPAXFbLEDm6x6xHu4eIxXPgI+CGxozoi4FnEAvedHOooIc+7kRYYF6n4ZG8Wb006KvSzxvutTSeO7V8lbXH+vs86ZU8PeNXpGWBFmG+FlAU8du2g== 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=3J4SHx0CczHnY16y+CfhToLTlyBOMCmd3IE5w/flQR0=; b=fry+EsGSKM1E+s7Mv9pKbzhtpIxVhQfxLglaWDzcM7wE+nco7jNmUZIgBXROUmgM9WS0itO0WUwRYwi79jdjCrlVyXmUWJzHD5vilpzGQpIQnDqbgEH1EFzu4ZeMEI3ji/jFK0HzEO0qTiHxGXMbDXkigNKv6p5OijFb8GWW/SUk1AKiBd9wCN1zmfccm7kkYuisTeDlI8SnSK/fItzljdXoXeHbpy/hYnB5r3MNk4t7m2N5o4Uh1NONmaAQzpDbhFJkYkPQg5zpnMF+rruasKbh1hVYX7PvB+pHvdwBpx6WPV453qx8iP8jUCvPsFloNH8v06IfqBvOkZxyikym4Q== Received: from BN7PR06CA0040.namprd06.prod.outlook.com (2603:10b6:408:34::17) by CH2PR12MB4939.namprd12.prod.outlook.com (2603:10b6:610:61::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.24; Thu, 2 Feb 2023 10:01:16 +0000 Received: from BN8NAM11FT060.eop-nam11.prod.protection.outlook.com (2603:10b6:408:34:cafe::c1) by BN7PR06CA0040.outlook.office365.com (2603:10b6:408:34::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.27 via Frontend Transport; Thu, 2 Feb 2023 10:01:16 +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 BN8NAM11FT060.mail.protection.outlook.com (10.13.177.211) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.27 via Frontend Transport; Thu, 2 Feb 2023 10:01:16 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) 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.36; Thu, 2 Feb 2023 02:01:02 -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; Thu, 2 Feb 2023 02:00:59 -0800 From: Rongwei Liu To: , , , , CC: , Andrew Rybchenko , Aman Singh , Yuying Zhang , Ferruh Yigit , Olivier Matz Subject: [PATCH v6 1/3] ethdev: add IPv6 routing extension header definition Date: Thu, 2 Feb 2023 12:00:19 +0200 Message-ID: <20230202100021.2445976-2-rongweil@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20230202100021.2445976-1-rongweil@nvidia.com> References: <2111452.3Lj2Plt8kZ@thomas> <20230202100021.2445976-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: BN8NAM11FT060:EE_|CH2PR12MB4939:EE_ X-MS-Office365-Filtering-Correlation-Id: 8bcd63ba-0475-4a33-340c-08db05046cc8 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: G9dQG37XKG17o10B+MEtzFyMgcMqGLN+rqXb9Oj+aF1KztXmadHrJfd4SH/1YuiXa7vVbvcMWTC0rDwxkvMyp7LAMFYrK9OrdwTuhT20VxPUQ/CA8El7J4oOvocjx/pZFy4m3GdHo71YBBmmP3B5rD7xh/tBAg7mz2WPv7X0+SrGrht9eUhImbKYbQqNACh9nyDYIa3xv388FGB/6ExYyaxOIm6lySWzU+LytcAAy3VjL6bvQjyb0nevd2I5DEprni3gSJ9J3YS4AGip7Qw7K4rOF6zlV5JSgvWAmM+RqPw1ROpTAb+QtnLLb4i+Gx+iTQMEkY0oVY2W8/jdQsLxT5rAtprOol1AWyio2XlLx/RbBcdkayx9ysTAE97/04vFBaM6niipDqieudFTJYiAw9qUN6hdKDvyBvSFB9Kylo07hcSg7oWbhVilxlvODKhPCCXtrAR8xLZrkGaweR1dohH9iLQgYo+h6eng3dkdvDi/Slv92ZILAG5hx4D7YUmUAXCCTGSaoZ9C6grVyHYJbvniAggM3P+Fa1BWfH4MpVIb7g7oYs+xYE6ANEEEazVbE5viFoLTHSm50l2zrCIuieKi6RNEG7N1Ib6bXh5zqFWKUwRiE42eGK4F3Sjhv/tzzkbkC/VSqcEVKsJ5w0zKyfe+RpG3AusYgX6wnbH61nxOOlk8fAPELfqTlxwJh4nJip7k6jPwaMpZGLyMwytQKw== 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:(13230025)(4636009)(376002)(346002)(39860400002)(136003)(396003)(451199018)(40470700004)(46966006)(36840700001)(356005)(186003)(16526019)(26005)(70586007)(4326008)(70206006)(6286002)(1076003)(82310400005)(2616005)(41300700001)(8936002)(6666004)(8676002)(5660300002)(478600001)(86362001)(47076005)(316002)(83380400001)(336012)(36756003)(426003)(40460700003)(110136005)(82740400003)(2906002)(54906003)(7636003)(7696005)(40480700001)(55016003)(36860700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Feb 2023 10:01:16.4093 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8bcd63ba-0475-4a33-340c-08db05046cc8 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: BN8NAM11FT060.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4939 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 Acked-by: Andrew Rybchenko --- 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..a310e9d498 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. */ + }; + }; + /* Next are 128-bit IPv6 address fields to describe 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