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 54FB043A46; Wed, 7 Feb 2024 13:30:15 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ACE8842E0D; Wed, 7 Feb 2024 13:29:57 +0100 (CET) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2056.outbound.protection.outlook.com [40.107.237.56]) by mails.dpdk.org (Postfix) with ESMTP id 5DB2742DFB for ; Wed, 7 Feb 2024 13:29:55 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ppseo/IFHoTPQGTuqXhqY9AOS6Z5vJk3dBhzKqhRjJZdMC9pMRGkN+54JtKMEv6vK9x6XRAEiL+1iszjC745u68hEDpu+pWCeIU7r8Gqy7dDnt1pKDBZ/+Bj/kPfz3+BXHQWvYgqX6g/McbySrIuT8m8/4hsEXJ9blkHRSmB223xIIBupPW5hZtTPscF24Oh3YPyfaBrFdGrZOgJotLd5HcUVdZeeFcQManDsJPsNiPkxHacSRlYAVa/MItDF8YhIKLccn6el+WDJJkZuBc7Ql0iQjnznM7f35Aw/OQ35SBRS0UxPXwU/LCiKAGt8lpHOfcQ5uYCDVzP8VlbJuIWLQ== 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=dnNNzS1PbYVoM8d2NOo33Agao471Js9OpCBKEu4YQQw=; b=KtwkQt16PibhiHXtEcMyBkj0UBImvJu2tuMrILi1T3IfA9dNerfOPmIHdedkVeuGfaJ9GgpC8qiT/xsTGnFt2pLYGULj7GqP+VCVigB5rSc3riSir3XOben4rUMnBpiZsHOtm/TeP3PgwHBOCEz2tK00BnFx2tOh2PeYFje6y9a6pR+4Ak17ODvYnv1RMV1YpKpnRepTJTxzbNKn6YO8FL56Io/V29y05YW+7Y7yn99bhpTG9KE+9aB9GgHfxFGrK7KimjZUemlt5BKd+mpktZpdZrikXNu1bMZJZ99U0julLy3Vh7GLP/zf8lidTF9sUEnwwBUc0BwrlRtdZXOeiA== 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 (0) 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=dnNNzS1PbYVoM8d2NOo33Agao471Js9OpCBKEu4YQQw=; b=rdivehm1msKwvrjchF5GP13LIFxyuNRun9T0QY0X/AldHmpDTUgtphVkUehzxzpg5MxYYZ7qvIOYnifviluNBN842V3qgjWKxSRBVAkG036rYobgLwzKpO5MMaulFuhcA3dSmrKZVyss3PZ4DUtUrImZ2RBDu5u7vN8+8S+7fMWLpXj/D9hwBPnRSUd+xtc3Y33KgTvPw4QxBMT3SRXhjWFKreAndcPEb08ULERvXwTG9wneDvMwG4sLxpI07v9a91VqZo9c5fuApCDvV8JZp2z2fJD7CMEKV6duIT91KbMh9/V9xU7BZnNnO0vqvtZ3foExbTlyLqQYFh+N+MTRSg== Received: from CY5PR19CA0040.namprd19.prod.outlook.com (2603:10b6:930:1a::31) by SA1PR12MB7125.namprd12.prod.outlook.com (2603:10b6:806:29f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.24; Wed, 7 Feb 2024 12:29:53 +0000 Received: from CY4PEPF0000EDD6.namprd03.prod.outlook.com (2603:10b6:930:1a:cafe::ea) by CY5PR19CA0040.outlook.office365.com (2603:10b6:930:1a::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.38 via Frontend Transport; Wed, 7 Feb 2024 12:29:52 +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 CY4PEPF0000EDD6.mail.protection.outlook.com (10.167.241.210) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.19 via Frontend Transport; Wed, 7 Feb 2024 12:29:52 +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.41; Wed, 7 Feb 2024 04:29:39 -0800 Received: from nvidia.com (10.126.231.35) 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.1258.12; Wed, 7 Feb 2024 04:29:37 -0800 From: Viacheslav Ovsiienko To: CC: , , , Subject: [PATCH v3 6/6] net/mlx5: add modify field action IPsec support Date: Wed, 7 Feb 2024 14:29:08 +0200 Message-ID: <20240207122908.20646-6-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20240207122908.20646-1-viacheslavo@nvidia.com> References: <20240207122908.20646-1-viacheslavo@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.126.231.35] 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: CY4PEPF0000EDD6:EE_|SA1PR12MB7125:EE_ X-MS-Office365-Filtering-Correlation-Id: e91a465f-f8ec-4e4f-a601-08dc27d87c2e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CDvxZaBzZc7TdX6cRn8wV6WvFsPFQhruF/JZnwWfh72iq+m9Ed0k6XleyCWwEbeD922n4XYC0SQL+cFDeooeRQHUCZhgZOQnOQNGBc+9YIsPj+sAVPmu8DjgmulgpV+CoJvYTqpzukJVGgz+oK6YOf60G+u1MVnbq1EqhN6QOkexgUMxGzsAJ5gDNYaWss6MXNVBKOhaV8IqOfC7q2oIYbO3hyih9eZOzCQIFay/V1FFsrwkQ9Ac2pz3gQCuBZEVUKdhwluD6kyQeAv3WJ11rXnjqD+qcyQkML1lGW5nSVWfclJWSLRmhxPHqz9Tqo0nlBgNpIWvmKE5qBXkvehFQUtgOFE2PRmaQcSHZ5j0/9ZqttY4LrBTgGpF1OIRBcEFJE8y+SUmK/EQC3oyUbHHymZij5hD3lwzL5kFSaTv82PvJkzjDTjtr/Qd5glvKCI/F4l2iQw6fhrFYzN9ztYZOJtDmNPsyPged/YmXluSHlPuXJKP6U8T2r1TMQSMBR22aERTO+h8F373d+PuLMt3A1xaX4eGdSFubCl5GE4WzJqyaKxMQzfpz5RU/lvd92Kg8WVdeuO9+D84Su0+UARWteCChPGpQhRZLqcLyNqfNRoFQHiX+OQhtq+MtvLqRyS8JKIlQEUlK0dFgCw5zRTh9mw8KBxZwC7a8Zt8E1njnmUzDGXEEI4V3Es2c0iL9LumU9hs3746dfLQN3hGr/FPPE58Y0beHm9timCkZvg9TO8s8YQZZOwWnm8zSVQtdUBl 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:(13230031)(4636009)(396003)(136003)(376002)(346002)(39860400002)(230922051799003)(186009)(82310400011)(1800799012)(64100799003)(451199024)(46966006)(36840700001)(40470700004)(55016003)(36756003)(40460700003)(40480700001)(41300700001)(426003)(86362001)(356005)(107886003)(1076003)(7636003)(47076005)(5660300002)(6286002)(36860700001)(2616005)(8676002)(7696005)(8936002)(6666004)(26005)(16526019)(70586007)(2906002)(336012)(82740400003)(478600001)(70206006)(316002)(4326008)(6916009)(54906003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Feb 2024 12:29:52.8212 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e91a465f-f8ec-4e4f-a601-08dc27d87c2e 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: CY4PEPF0000EDD6.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7125 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 mlx5 PMD support for the IPsec fields: - RTE_FLOW_FIELD_ESP_SPI - SPI value in IPsec header - RTE_FLOW_FIELD_ESP_SEQ_NUM - sequence number in header - RTE_FLOW_FIELD_ESP_PROTO - next protocol value in trailer Signed-off-by: Viacheslav Ovsiienko Acked-by: Dariusz Sosnowski --- doc/guides/rel_notes/release_24_03.rst | 3 +++ drivers/common/mlx5/mlx5_prm.h | 3 +++ drivers/net/mlx5/mlx5_flow_dv.c | 31 ++++++++++++++++++++++++++ 3 files changed, 37 insertions(+) diff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_notes/release_24_03.rst index d0c3389287..0f8d2fd81c 100644 --- a/doc/guides/rel_notes/release_24_03.rst +++ b/doc/guides/rel_notes/release_24_03.rst @@ -112,6 +112,9 @@ New Features * Added HW steering support for modify field ``RTE_FLOW_FIELD_GENEVE_OPT_CLASS`` flow action. * Added HW steering support for modify field ``RTE_FLOW_FIELD_GENEVE_OPT_DATA`` flow action. * Added HW steering support for modify field ``RTE_FLOW_FIELD_IPV4_PROTO`` flow action. + * Added HW steering support for modify field ``RTE_FLOW_FIELD_ESP_SPI`` flow action. + * Added HW steering support for modify field ``RTE_FLOW_FIELD_ESP_SEQ_NUM`` flow action. + * Added HW steering support for modify field ``RTE_FLOW_FIELD_ESP_PROTO`` flow action. Removed Items diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h index 3168ce76a5..0035a1e616 100644 --- a/drivers/common/mlx5/mlx5_prm.h +++ b/drivers/common/mlx5/mlx5_prm.h @@ -854,6 +854,9 @@ enum mlx5_modification_field { MLX5_MODI_OUT_IPV6_PAYLOAD_LEN = 0x11E, MLX5_MODI_OUT_IPV4_IHL = 0x11F, MLX5_MODI_OUT_TCP_DATA_OFFSET = 0x120, + MLX5_MODI_OUT_ESP_SPI = 0x5E, + MLX5_MODI_OUT_ESP_SEQ_NUM = 0x82, + MLX5_MODI_OUT_IPSEC_NEXT_HDR = 0x126, MLX5_MODI_INVALID = INT_MAX, }; diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index eb7cbf808c..6fded15d91 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -1414,7 +1414,11 @@ mlx5_flow_item_field_width(struct rte_eth_dev *dev, case RTE_FLOW_FIELD_GTP_TEID: case RTE_FLOW_FIELD_MPLS: case RTE_FLOW_FIELD_TAG: + case RTE_FLOW_FIELD_ESP_SPI: + case RTE_FLOW_FIELD_ESP_SEQ_NUM: return 32; + case RTE_FLOW_FIELD_ESP_PROTO: + return 8; case RTE_FLOW_FIELD_MARK: return rte_popcount32(priv->sh->dv_mark_mask); case RTE_FLOW_FIELD_META: @@ -2205,6 +2209,33 @@ mlx5_flow_field_id_to_modify_info else info[idx].offset = off_be; break; + case RTE_FLOW_FIELD_ESP_PROTO: + MLX5_ASSERT(data->offset + width <= 8); + off_be = 8 - (data->offset + width); + info[idx] = (struct field_modify_info){1, 0, MLX5_MODI_OUT_IPSEC_NEXT_HDR}; + if (mask) + mask[idx] = flow_modify_info_mask_8(width, off_be); + else + info[idx].offset = off_be; + break; + case RTE_FLOW_FIELD_ESP_SPI: + MLX5_ASSERT(data->offset + width <= 32); + off_be = 32 - (data->offset + width); + info[idx] = (struct field_modify_info){4, 0, MLX5_MODI_OUT_ESP_SPI}; + if (mask) + mask[idx] = flow_modify_info_mask_32(width, off_be); + else + info[idx].offset = off_be; + break; + case RTE_FLOW_FIELD_ESP_SEQ_NUM: + MLX5_ASSERT(data->offset + width <= 32); + off_be = 32 - (data->offset + width); + info[idx] = (struct field_modify_info){4, 0, MLX5_MODI_OUT_ESP_SEQ_NUM}; + if (mask) + mask[idx] = flow_modify_info_mask_32(width, off_be); + else + info[idx].offset = off_be; + break; case RTE_FLOW_FIELD_FLEX_ITEM: MLX5_ASSERT(data->flex_handle != NULL && !(data->offset & 0x7)); mlx5_modify_flex_item(dev, (const struct mlx5_flex_item *)data->flex_handle, -- 2.18.1