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 24CBEA034C; Wed, 21 Dec 2022 09:43:43 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 17D1442D19; Wed, 21 Dec 2022 09:43:39 +0100 (CET) Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2080.outbound.protection.outlook.com [40.107.102.80]) by mails.dpdk.org (Postfix) with ESMTP id 6E8A241141 for ; Wed, 21 Dec 2022 09:43:37 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n8VhvsKkIIwpapG9PBRa5rXpjmoWvBKpMTtwCg6XO7ufEBWnPyjwrRO54FEGS3v9/QAssTXijpveQW+faJRa6BDV5MCaPBtBIi8Nx8zQ1o6youmTF2K/QJD4bdq+GIaD7y9em58o8esKxMLZkx7iVz8uzC67EF9rkbtvpSTdntNdhznIT7K9tMZdIWeFvQ9x0QjQxTtAXnWGA0IEmkeAf+fOz5/CXbSKejkjymAr8ax2I1hH9q60bOWFWlcmOoXDpQXLQ+45xFpQHPfslTBZ1RekFe+GLVWbCxNnCw2Zo8BEjFbh/JhCc/au/F99EG3ovJvPxa+bTsTpyWWBta4aWQ== 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=D+mmw1o5yJUaPxvs/QX0ss7i4rQWqj3mtgObeGp7VN8=; b=jR464mu5qIq6c+XInZu2QTdGUwsnTSnhOQwzzqyvp8vCM9pY7racPiT9V6FSh8PqEVE1qGoYcV6G+IB9hgHMNJvSMyGDMOK/ikGpN4SQLMoRHRF0StEKhS8biSeMI8zOmeYs0N+oTxs+zDRGEYGWa/ljxtYIqs0NjITZGYhO6DkNQfVZ5FoiRIGoRXZqC4mLtVQN7YPaJWCI4KkbFQ/Q9m0PlsNSj/2QYoT780MTK1rw0FHAJ1M7mPEnN6PO0xnc8AKq8A7KeAQGq250ukgrYUf34g9jdWtG2ksb+uN8RXae5Q8fMrncq4kktSoFKr4Csl/bo3sZDysbvvu8ITOHlQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=monjalon.net 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=D+mmw1o5yJUaPxvs/QX0ss7i4rQWqj3mtgObeGp7VN8=; b=WKUy1Jjf7/k9KssQGvbs89L0NkMg2E+YU/eaJFm6hk3TWdECX4hZMQyGL74khojOwEHA0Co2Z+RgJ5M97MJ+EF3Y+lYm6F/JIYNxbpFdegnlfMwS97CQ7cN1tMu0MUjJYAcac6mgv+VYfgsBBls6jpr73x4jjuCRAf3bpG86SCIgfy0K53mbAQTfYDfn+wgk/ZXGx56MEcMfBAycQofVZDWKjtqArvEb8ycaDrK04MPwTUTcEJ0Jz+sBonbz8KFW+qTfeU3WeFIWhQL3hwTY1yHmkt8IMp1BIAYYjVrXlw9hIvGcY323OOHOJ+vQrAZb/yMBEHBDP2vPT1SPy02yyA== Received: from BN9P222CA0022.NAMP222.PROD.OUTLOOK.COM (2603:10b6:408:10c::27) by SA0PR12MB4589.namprd12.prod.outlook.com (2603:10b6:806:92::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Wed, 21 Dec 2022 08:43:35 +0000 Received: from BL02EPF00010207.namprd05.prod.outlook.com (2603:10b6:408:10c:cafe::a1) by BN9P222CA0022.outlook.office365.com (2603:10b6:408:10c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.21 via Frontend Transport; Wed, 21 Dec 2022 08:43:35 +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 BL02EPF00010207.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.8 via Frontend Transport; Wed, 21 Dec 2022 08:43:35 +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; Wed, 21 Dec 2022 00:43:22 -0800 Received: from nvidia.com (10.126.231.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, 21 Dec 2022 00:43:19 -0800 From: Rongwei Liu To: , , , , Ferruh Yigit , Andrew Rybchenko , Olivier Matz CC: , Subject: [RFC 1/9] ethdev: add IPv6 routing extension header definition Date: Wed, 21 Dec 2022 10:42:56 +0200 Message-ID: <20221221084304.3680690-2-rongweil@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20221221084304.3680690-1-rongweil@nvidia.com> References: <20221221084304.3680690-1-rongweil@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.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: BL02EPF00010207:EE_|SA0PR12MB4589:EE_ X-MS-Office365-Filtering-Correlation-Id: 703bb563-4fe5-4788-d649-08dae32f72dc 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: 0SqXkuCREfEwMXyFTUyQauxJ1TMXI/aNaSw7yhc3M74L56w1fHJpG2RchxJmTlxClaKSPGCXkmuZyBYAvW1igJ+gQ2rw/j5D/dOrRphl6w7CJsqLkPu54hlWgHb76zANoGMGN9h12Y4PjDihZVnSVIatvGb4TbJ2uLgnc04yomel+BkasKxA8eG4NTnEhSYgiioW+27I5MYUQ0xn0qVqnPF6IiH4hz+s0M8J1sO/uYOwTRdu0+Wq/A7D0OxjIIAGZ2saUAyQgxTxOUSlnG4tybAIYNS1E/xxgpsONfZ3DcaSZLuNYyGjdffF3Iz0wfX0HXtBHnRI9c45JpeGo3C5vU5Km1CaDUtsGiflT4yKTeppkfSiJ5MpqNl0z9ukX8V68FVTuvy5UiDbvgCfponTm7UEO5QxCZ5xL2oc77zKRI+xK0LGPr2EKvBTvbOYHxE4q+txo/KUMuBV6WIVzZ/9JTxmy4T5CpdeUTBTWetrp3eJFCtXcA6Ihv7kVLbbI/gfBhW9XfFp3OCOp4Bzk6CkS3WvKO3/krrYOMdf768KXZm7Ng48P4yoO+zZn8/S29zmDIrSo++17iCLSIMDQN0kAUh7o5kGzPfUQwBptwy1MRY1LKsV9DTrdVsU9s/sRpezbW5Ycx8Sp0rb+dC85520mrU4pOERumXVH2t6+eEb77yPwRi61XwtZNTP2wY2LtMtj7Auq1vebObHhiqGjbRB5g== 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:(13230022)(4636009)(396003)(346002)(39860400002)(376002)(136003)(451199015)(36840700001)(40470700004)(46966006)(6666004)(107886003)(478600001)(7696005)(70206006)(26005)(2616005)(186003)(6286002)(16526019)(40480700001)(54906003)(55016003)(86362001)(70586007)(316002)(110136005)(1076003)(82740400003)(356005)(8676002)(4326008)(41300700001)(2906002)(8936002)(83380400001)(336012)(426003)(36756003)(40460700003)(82310400005)(5660300002)(47076005)(7636003)(36860700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2022 08:43:35.4357 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 703bb563-4fe5-4788-d649-08dae32f72dc 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: BL02EPF00010207.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4589 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/segment_left field. Signed-off-by: Rongwei Liu --- doc/guides/prog_guide/rte_flow.rst | 9 ++++++ doc/guides/rel_notes/release_22_03.rst | 5 ++++ lib/ethdev/rte_flow.c | 15 ++++++++++ lib/ethdev/rte_flow.h | 39 ++++++++++++++++++++++++++ lib/net/rte_ip.h | 21 ++++++++++++++ 5 files changed, 89 insertions(+) diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 3e6242803d..1ebc159893 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. + +- ``nexthdr``: 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_22_03.rst b/doc/guides/rel_notes/release_22_03.rst index 0923707cb8..cc050ff3e7 100644 --- a/doc/guides/rel_notes/release_22_03.rst +++ b/doc/guides/rel_notes/release_22_03.rst @@ -207,6 +207,11 @@ API Changes * ethdev: Old public macros and enumeration constants without ``RTE_ETH_`` prefix, which are kept for backward compatibility, are marked as deprecated. +* ethdev: added a new structure: + + - IPv6 routing extension header ``rte_flow_item_ipv6_routing_ext`` and + ``rte_ipv6_routing_ext`` + * cryptodev: The asymmetric session handling was modified to use a single mempool object. An API ``rte_cryptodev_asym_session_pool_create`` was added to create a mempool with element size big enough to hold the generic asymmetric diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c index 7d0c24366c..e08b690300 100644 --- a/lib/ethdev/rte_flow.c +++ b/lib/ethdev/rte_flow.c @@ -76,6 +76,19 @@ rte_flow_item_flex_conv(void *buf, const void *data) return src->length; } +static size_t +rte_flow_item_ipv6_routing_ext_conv(void *buf, const void *data) +{ + struct rte_flow_item_ipv6_routing_ext *dst = buf; + const struct rte_flow_item_ipv6_routing_ext *src = data; + + if (buf) + rte_memcpy((void *)((uintptr_t)(dst->hdr.segments)), + src->hdr.segments, + src->hdr.segments_left << 4); + return src->hdr.segments_left << 4; +} + /** Generate flow_item[] entry. */ #define MK_FLOW_ITEM(t, s) \ [RTE_FLOW_ITEM_TYPE_ ## t] = { \ @@ -157,6 +170,8 @@ 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_FN(IPV6_ROUTING_EXT, sizeof(struct rte_flow_item_ipv6_routing_ext), + rte_flow_item_ipv6_routing_ext_conv), }; /** Generate flow_action[] entry. */ diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index b60987db4b..f8f1d6f9dd 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -624,6 +624,33 @@ 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, + + /** + * Matches IPv6 routing extension header next header. + * + * See struct rte_flow_item_ipv6_routing_ext. + */ + RTE_FLOW_ITEM_TYPE_IPV6_ROUTING_EXT_NEXT_HDR, + + /** + * Matches IPv6 routing extension header type. + * + * See struct rte_flow_item_ipv6_routing_ext. + */ + RTE_FLOW_ITEM_TYPE_IPV6_ROUTING_EXT_TYPE, + + /** + * Matches IPv6 routing extension header segment left. + * + * See struct rte_flow_item_ipv6_routing_ext. + */ + RTE_FLOW_ITEM_TYPE_IPV6_ROUTING_EXT_SEG_LEFT, }; /** @@ -873,6 +900,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..2b9a65dfcb 100644 --- a/lib/net/rte_ip.h +++ b/lib/net/rte_ip.h @@ -539,6 +539,27 @@ 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 nexthdr; /**< Protocol, next header. */ + uint8_t hdrlen; /**< Header length. */ + uint8_t type; /**< Extension header type. */ + uint8_t segments_left; /**< Valid segments number. */ + __extension__ + union { + uint32_t flags; + struct { + uint8_t last_entry; /**< The last_entry field of SRH */ + uint8_t flag; /**< Packet flag. */ + uint16_t tag; /**< Packet tag. */ + }; + }; + __extension__ + uint32_t segments[0]; /**< Each hop IPv6 address. */ +} __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