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 18BBE4296B; Mon, 17 Apr 2023 11:26:16 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E674E41138; Mon, 17 Apr 2023 11:26:14 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2059.outbound.protection.outlook.com [40.107.93.59]) by mails.dpdk.org (Postfix) with ESMTP id 2022A410EA for ; Mon, 17 Apr 2023 11:26:14 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KSmrvcSJ8RSbYGi9cjFMCR1iF0WXsbZxaS5gKpf2CQqZksEFJLhmp8ovM5bRNKDnYBlj9DsSi5LLrXXk30OcpzcSiYBHeTv2t/1elgMz9wQeGBS9Bo0YqM/diVgMD/ftune8MzN+ebkUPQEDizvpG+U2M9NIM2krri0uDy0TqCqFCNDW1z8wPPov0w+YuQDmz2htvTBVG+p3bW21WmafQHhGQrCT5PWVfFT3I7TUcQNe3lS/ENtHbBSvWC0CPz/l6CuXlnFG4+uF7cFZClYAwGAfw/p6kMAGkVi5FVe9zXFGFUb3cC0nzfHeNDxRVCu0t3hWDtS8HfVtlI5nZvpcEg== 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=YB3tFkSi9npJhV0uZdtkHKWWJRuCe94L1SnQMzT/myE=; b=RfLygGsmJCY223qsSrHd5cSsieDl9heHSxqPsQgRrZBXR+JIukX2dnpzr/DLeCZAoKGbJW5np20tmHwqdN0QiNhyyBjXj4/0vEO+zD516/VIdOKQ9Br9AFSwgbySAupyXHLUimQTNsZdg2gMXzNnp5U/c6wRxghJLFg5evpVKYbBqJMqHRWEJikpLNl8j67DSb0tgxsHjpbiiUSr8h5rTnj/jXseiPspo00UI9K1sZZd+96tX2b+wPoYSnkaNbrHccN4Se9j/PIrxvFVsjncpsrM0bBF7aMEqmCEsSFE7EYBrmF20JCu+7fuOcrWECq5/oNB7PTkdjaiEiBIFRAvMg== 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=YB3tFkSi9npJhV0uZdtkHKWWJRuCe94L1SnQMzT/myE=; b=KpALP2T5o2r+VRpv8BH3D0t6usCXZ34xjvU8OSBDzkWnzMMGTcYtcz7++BeXzNGap3C04+AHcjlKYsgCNegM4e3h1FRnNq9glLn9C2N59lJY2lhr5N4oFvAKjvtvAoEsj/Ca0CEpkjb7qYjD9F7J3VzM68/pIKMH3LjrDXySPREKzIY8VSaZD3uKRnS77vEPeicOK2czk6+Eb7OQWpu/tENy680Gl6U2EttEZ9ntAuwyZHsMBes8sSS/c/TfNAtgkXaWOUTvnySJ2PtENH5/o2C6Fd13Ue7ouLUwXCizzDG3g1z8jPl3yJEsvUJOIh/2Gg7ljOIEL5ytctd2woysQg== Received: from BN0PR03CA0036.namprd03.prod.outlook.com (2603:10b6:408:e7::11) by MW3PR12MB4474.namprd12.prod.outlook.com (2603:10b6:303:2e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.45; Mon, 17 Apr 2023 09:26:10 +0000 Received: from BN8NAM11FT105.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e7:cafe::15) by BN0PR03CA0036.outlook.office365.com (2603:10b6:408:e7::11) 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 09:26:10 +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 BN8NAM11FT105.mail.protection.outlook.com (10.13.176.183) 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 09:26:10 +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.5; Mon, 17 Apr 2023 02:25:57 -0700 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.37; Mon, 17 Apr 2023 02:25:54 -0700 From: Rongwei Liu To: , , , , CC: Ferruh Yigit , Andrew Rybchenko Subject: [PATCH v1 1/8] ethdev: add IPv6 extension push remove action Date: Mon, 17 Apr 2023 12:25:33 +0300 Message-ID: <20230417092540.2617450-2-rongweil@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20230417092540.2617450-1-rongweil@nvidia.com> References: <20230417092540.2617450-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: BN8NAM11FT105:EE_|MW3PR12MB4474:EE_ X-MS-Office365-Filtering-Correlation-Id: fd80d0e6-5698-42bb-f432-08db3f25c80b 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: IbP0ahwXi7ZXy566EeDJ4vJO8PTy9S7e8Uo4DcPSv41/cuBo864vKZafginTAV60ifS/3R93cBLl3XvEFjOIp+Sh+AMwUlJ3bfMrEDt+Z6qz37nJ3mWWtav+dzKXQIwG3LQcp62aoNfONn5psA5u28MbvK4mQfAV+TBCalvxt8xIj30w96pQ/rtgS7rZUqSVDYzh0hvKlkoD6viRFYQYlUpoAjcUlpo5G63kbXOUxfk6oTnr1vS/P75np98KuWiAQqWFU8NhDGuZdH61+psmuq+d88n80tUU4fjJSmIl+PkZHa4qp09aBSim/MqDYxHKNMnxojCiH1SQvuHNFrackLdfIuYnDg1bhKtbK7ykrP4xs9xkxLceau+Y1jW3BJ5i6caDsukqZ2NBkuGCLna+42dk1oLGeaXroneGk897aZUOetjUZjnsooJU2ln26CjsF3WVMzebS7bwl8ydyv2Uj+9Ue58E43D8yAIdr4O8KX0EhLvvvBS6BdHYGoKkjEbxRKTD+4GvvRkVidF9lWwkcSOmAvO+U8GbgV+Vax6sQkd6JyEc6J8i3aQNuwVZVCaJusoFJDD80C+oZLFyrWF9QFVwejLrclDom8zBv/WSOJEYYWJi94MjnDYR/3rE+ywVUczp5DHb3ycAOqQD2oHEXKXP6oO78Tfw4NHv2hiGL/25RUA7JZdYFmhfNt8thVaSbi3rfct4Y4YpWNrHPoMHGSv2urltZQXrPkmsF0NpS0J0tZTqCx5Iuzbexa2F7066MxRDW/+Ro4UJIaQTyI2vmLMP2xnODRm7TvLc8TePJGE= 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:(13230028)(4636009)(376002)(396003)(136003)(39860400002)(346002)(451199021)(36840700001)(40470700004)(46966006)(336012)(7696005)(6666004)(86362001)(478600001)(110136005)(34020700004)(55016003)(36860700001)(2616005)(47076005)(426003)(36756003)(83380400001)(26005)(40480700001)(6286002)(186003)(1076003)(16526019)(40460700003)(82740400003)(82310400005)(7636003)(356005)(70206006)(70586007)(316002)(2906002)(4326008)(8936002)(8676002)(5660300002)(41300700001)(54906003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Apr 2023 09:26:10.3280 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fd80d0e6-5698-42bb-f432-08db3f25c80b 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: BN8NAM11FT105.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4474 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 32fc45516a..2fe42e1cea 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -3300,6 +3300,27 @@ The ``quota`` value is reduced according to ``mode`` setting. | ``RTE_FLOW_QUOTA_MODE_L3`` | Count packet bytes starting from L3 | +------------------+----------------------------------------------------+ +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 69e6e749f7..af4b3f6da4 100644 --- a/lib/ethdev/rte_flow.c +++ b/lib/ethdev/rte_flow.c @@ -259,6 +259,8 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = { MK_FLOW_ACTION(METER_MARK, sizeof(struct rte_flow_action_meter_mark)), MK_FLOW_ACTION(SEND_TO_KERNEL, 0), MK_FLOW_ACTION(QUOTA, sizeof(struct rte_flow_action_quota)), + 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 713ba8b65c..369ecbc6ba 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -2912,6 +2912,25 @@ enum rte_flow_action_type { * applied to the given ethdev Rx queue. */ RTE_FLOW_ACTION_TYPE_SKIP_CMAN, + + /** + * 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, }; /** @@ -3352,6 +3371,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 -- 2.27.0