From patchwork Mon Apr 17 02:26:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rongwei Liu X-Patchwork-Id: 126147 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6499C42966; Mon, 17 Apr 2023 04:27:08 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C13BD4021D; Mon, 17 Apr 2023 04:27:05 +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 0D63D42BC9 for ; Mon, 17 Apr 2023 04:27:04 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PKaaE5B6I3qhXyIfJuZZjl5nrZ9joKoH7LzQT6b1QzDaqGbIat143SSJ9eZYZI8+GpvLSYs9xxphMQ1sN78GtbgqpfkxRFtpw5I1X9Sx+XOMW2Wmx7R6eSS+IPAjwPupN+YPZfKZUPOP6hxTecZ2DGr+FDdBTjxHPA0VZtMJ3msuytDXh+wTFI9HvJ6cIapsww9eHMLhwQTiNVQXK1h1v6geUXF6PTQmBxVlz0ju2WOwwWSKafFRddNYE+ivBRXQksf+hficByH55ofUVwySnyIMix5wARoBTlJcWDKV4JpY4Lhs3P243j/5ijHWtWKTU14aTZQzjiKJRvR0s8d5Og== 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=TKcaUrWBbVHDCLGrnBbdqoEqCr0CxOEGQrEizWHTYrQ=; b=VOKNbVYl+U5ld/kE7NMR9FE2H5TVE6rlwl9miicDZGg+Cp1y40qkR1oFzb2eR3kq/PXIu4AJJDnL/IhdMrmoavcmFplZX6g2SlnzBb3fp9T565xm87ryZqxebZF5B2aTtRifovbmn/jAGCVFZgSUGlTCRLOjWHy+hDmk81udhFDvZoVQc/WhsP9rwPDm3czB+4+jg1cUq/ho5fE5MYrN7WGcXXdEJsLiOZOYzMhE4wH/6IpyqKF9982SmBvGr8l6xhxfNhuKUpfcfvcYksyRur7YrF/3EG7rpF4RlTUZx22G3ymFybDKR/p5OfZMyxdBGpu6AQ7Bu2AKyk38tE8Hzg== 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=TKcaUrWBbVHDCLGrnBbdqoEqCr0CxOEGQrEizWHTYrQ=; b=lIaPLZKpMUJqEU6xkbS7OQwNjf9csVcmiP7j8yJh4RvJNnwrN3z4r4O4FByFOWLqfyopFL7K6V4UsrWboo8Fd1zF5ykcrKo5rsmblzO1GXKz+3WvN2FbZCTJpDxRXpKdso9qIp39hKySuL3oh8yNgxqSfUcqXfZ2Nnwh7N7N5gfpL4XepHOh3onSObYsZedWkW0t35O/d2lEVRFZBNXVso8/RVRvrojfRZNpoifEoaNioC9lkMDRdJBGnVkNPzJ2mfC7X6YguhfLuAEwx9ClNJtePOcYaLBXDcAUEXjuMC1Xm08IGiKGgUT9YXdykzocP0Scu+DXZONm78i6IX7llw== Received: from BN6PR17CA0058.namprd17.prod.outlook.com (2603:10b6:405:75::47) by CY5PR12MB6381.namprd12.prod.outlook.com (2603:10b6:930:3f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.30; Mon, 17 Apr 2023 02:27:01 +0000 Received: from BN8NAM11FT097.eop-nam11.prod.protection.outlook.com (2603:10b6:405:75:cafe::7b) by BN6PR17CA0058.outlook.office365.com (2603:10b6:405:75::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.46 via Frontend Transport; Mon, 17 Apr 2023 02:27:01 +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 BN8NAM11FT097.mail.protection.outlook.com (10.13.176.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.19 via Frontend Transport; Mon, 17 Apr 2023 02:27:00 +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.5; Sun, 16 Apr 2023 19:26:51 -0700 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.37; Sun, 16 Apr 2023 19:26:48 -0700 From: Rongwei Liu To: , , , , CC: Ferruh Yigit , Andrew Rybchenko Subject: [RFC v1 1/2] ethdev: add IPv6 extension push remove action Date: Mon, 17 Apr 2023 05:26:29 +0300 Message-ID: <20230417022630.2377505-2-rongweil@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20230417022630.2377505-1-rongweil@nvidia.com> References: <20230417022630.2377505-1-rongweil@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.230.37] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT097:EE_|CY5PR12MB6381:EE_ X-MS-Office365-Filtering-Correlation-Id: e043736c-35f0-4a4a-e374-08db3eeb39c8 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: TocY6RS+wtMrowkYXjW+roVpa05+vHtdcK+ftXxRZ3NxFJPP/ZkwhiInwwvnUsuwOKCMoipKZm14EUe9LOY8MNpNm7LVt1s1js44eM4f8T3vvuCmmTNtuPNk4NGTc6nqJ2z5E44XwpzRxjufJdRhkJW5CMCPuEj8z3THfUKGXZNM7VQZZPOSUYICBL6ADR9wkuDxsqN643jK3hkvT+/tygf3HJ84wDAn/uQ0hyF6NO2yOjb2VVCvni2ggYSpAmoLrfHOjJ3Pl61uf0p58spbhmPUsXXmCkHD7d/qj1fVvxXaeUSNPeZGkjBdhuKogXd4MGm0NubCtyGJxWudWj6sfV2n82F8nZ4D9jHiYlO0L5o4qvXcpCrlzmwQeE8BMpfPg/3eaofaIieumcQyBwgSx/l6kyGABStUYMCypYWs9F2l84cyDSx+XZArS9dg/9SSNH9Qes36HTa5/IY0OVdsASLS/BL9sdb6cz8pKe+tnXNYivvlyN7hK7DgOpkPfCAcnC1SaR0DwJ5/vFRWZ+D6r92DHy6dFflfYfxualNG+YACdBK95CdzcSPsvh1BOztmx/N99xTFDHI0NTyI66Ly+lw9Vog5QUDADlZB/s1OfqoyYuB1t3GBGTmIp+FhtzbEpuOcBZVBbkbFen7PigFfU56k6qYXSZ6srqxwfJiAvxD3JcEVBCNGog5ACg4XuZEJvWGHkXgsL2xHjRSFpj0xstXbT/5Si2nm5x1z3B6g+ng1BOlbTE6/Ix1V9Iv0LR33N518Z3JV8KvPfOC/P1Efbg== 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:(13230028)(4636009)(376002)(39860400002)(396003)(136003)(346002)(451199021)(36840700001)(46966006)(40470700004)(36860700001)(83380400001)(82740400003)(41300700001)(5660300002)(2906002)(2616005)(47076005)(336012)(426003)(8936002)(8676002)(186003)(1076003)(40460700003)(16526019)(6286002)(26005)(36756003)(110136005)(7696005)(4326008)(6666004)(70206006)(54906003)(7636003)(86362001)(70586007)(55016003)(40480700001)(356005)(478600001)(316002)(82310400005)(34020700004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Apr 2023 02:27:00.8729 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e043736c-35f0-4a4a-e374-08db3eeb39c8 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: BN8NAM11FT097.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6381 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 new rte_actions to push and remove the specific type of IPv6 extension to and from original packets. A new extension to be pushed should be the last extension due to the next header awareness. Remove can support the IPv6 extension in any position. Signed-off-by: Rongwei Liu --- doc/guides/prog_guide/rte_flow.rst | 21 ++++++++++++ lib/ethdev/rte_flow.c | 2 ++ lib/ethdev/rte_flow.h | 52 ++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+) diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 43e38839ae..6a7401c98a 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -3308,6 +3308,27 @@ and rte_mtr_policy_get() API respectively. | ``policy`` | Meter policy object | +------------------+----------------------+ +Action: ``IPV6_EXT_PUSH`` +^^^^^^^^^^^^^^^^^^^^^^^^^ + +Add an IPv6 extension into IPv6 header and its template is provided in +its data buffer with the specific type as defined in the +``rte_flow_action_ipv6_ext_push`` definition. + +This action modifies the payload of matched flows. The data supplied must +be a valid extension in the specified type, it should be added the last one +if preceding extension existed. When applied to the original packet the +resulting packet must be a valid packet. + +Action: ``IPV6_EXT_REMOVE`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Remove an IPv6 extension whose type is provided in its type as defined in +the ``rte_flow_action_ipv6_ext_remove``. + +This action modifies the payload of matched flow and the packet should be +valid after removing. + Negative types ~~~~~~~~~~~~~~ diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c index 26531ecb8e..4504bb3ae9 100644 --- a/lib/ethdev/rte_flow.c +++ b/lib/ethdev/rte_flow.c @@ -272,6 +272,8 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = { MK_FLOW_ACTION(SEND_TO_KERNEL, 0), MK_FLOW_ACTION(QUOTA, sizeof(struct rte_flow_action_quota)), MK_FLOW_ACTION(INDIRECT_LIST, 0), + MK_FLOW_ACTION(IPV6_EXT_PUSH, sizeof(struct rte_flow_action_ipv6_ext_push)), + MK_FLOW_ACTION(IPV6_EXT_REMOVE, sizeof(struct rte_flow_action_ipv6_ext_remove)), }; int diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index dfad6d1af4..f5e0c22389 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -3029,6 +3029,25 @@ enum rte_flow_action_type { * RTE_FLOW_ACTION_TYPE_INDIRECT_LIST */ RTE_FLOW_ACTION_TYPE_INDIRECT_LIST, + + /** + * RTE_FLOW_ACTION_TYPE_IPV6_EXT_PUSH + * + * Push IPv6 extension into IPv6 packet. + * + * @see struct rte_flow_action_ipv6_ext_push. + */ + RTE_FLOW_ACTION_TYPE_IPV6_EXT_PUSH, + + /** + * RTE_FLOW_ACTION_TYPE_IPV6_EXT_REMOVE + * + * Remove IPv6 extension from IPv6 packet whose type + * is provided in its configuration buffer. + * + * @see struct rte_flow_action_ipv6_ext_remove. + */ + RTE_FLOW_ACTION_TYPE_IPV6_EXT_REMOVE, }; /** @@ -3469,6 +3488,39 @@ struct rte_flow_action_vxlan_encap { struct rte_flow_item *definition; }; +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice + * + * RTE_FLOW_ACTION_TYPE_IPV6_EXT_PUSH + * + * Valid flow definition for RTE_FLOW_ACTION_TYPE_IPV6_EXT_PUSH include: + * + * - IPV6_EXT TYPE / IPV6_EXT_HEADER_IN_TYPE / END + * + * size holds the number of bytes in @p data. + * The data must be added as the last IPv6 extension. + */ +struct rte_flow_action_ipv6_ext_push { + uint8_t *data; /**< IPv6 extension header data. */ + size_t size; /**< Size of @p data. */ + uint8_t type; /**< Type of IPv6 extension. */ +}; + +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice + * + * RTE_FLOW_ACTION_TYPE_IPV6_EXT_REMOVE + * + * Valid flow definition for RTE_FLOW_ACTION_TYPE_IPV6_EXT_REMOVE include: + * + * - IPV6_EXT TYPE / END + */ +struct rte_flow_action_ipv6_ext_remove { + uint8_t type; /**< Type of IPv6 extension. */ +}; + /** * @warning * @b EXPERIMENTAL: this structure may change without prior notice