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 4C3D545BA5; Tue, 22 Oct 2024 20:07:32 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B2DBD4060B; Tue, 22 Oct 2024 20:07:31 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2086.outbound.protection.outlook.com [40.107.243.86]) by mails.dpdk.org (Postfix) with ESMTP id 5B717402D5 for ; Tue, 22 Oct 2024 20:07:30 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ogoDdo6JkwlMAPSlEorGjZtcpdcv+SPudWEjrsBtMrq/Y+QiktWH3uwQqjADA0Ngwg8x8zgdgE2d1S2pdFeK7cGKUxxvh8JYh5jQqGc5gDTpiCj/9WsSlAIRa+uRpJ+oBdMIOW/mQRCwvYRSsGHnbQGGpjCttSmlu1i1JFUcP2TAIVOxCBkGjZn7MnwzWCjBgLId9DUO9g0sN6eCgvIIq208wih4kBzK8BM59yc+34HftSvRAEYvLdopVh8b+NY0xvSuR9FjBKlmkU7ASUurouu0FBWYMZWxz1F3BBu22z2+gUlXI1GAHp+UuLbzQyyrOs2gdWXnWrlOFEMLBr1LRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=g/3JZOih26RQXL2AMZn3/DdCujKDI347zcTnHEkUdPw=; b=fa4U94M7Oh06calDVQ+F6f/0KOUORLA8pSxRfmb7AjYF2tKqNyPYiRgZymnQPaxh2kp3qqmxONAxw5kjvxJMTt5OSPGVII9RBzeqtLEWKUQaqg2rWEmgtP3TsGaUE1MpbmoHbGJkNdF6/gfTaa1KJRMzIxUFJ4xvoWBnAi3sDLVmzJWeLfFPyrZVMzzLvbqw2Ri35T8mIBki29NHSONqucACZeOEZydMEJmeCqjbc6iEIhb4Gb0eAyaN4O8yNHmTvtpHRI9+eAQS/CtKYS2hHM6YHjFxyu76H4YncJ6DtnQ0mFYfco60/kDulClLlLc+NqhEFQlv66Kmz2k1wS1V6Q== 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 (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=g/3JZOih26RQXL2AMZn3/DdCujKDI347zcTnHEkUdPw=; b=rN/z9t3ndD/tkCBiPftzOohdV/PTSc6Xk2mwF1x4H2/jKp2LY5VOidLoWLqTS0frL6HsvVBqXiujLZ8KjRGrgkYLJkI4gSJAcsA7wQR/UNDBFxhn6OfOCh4G0Ft4aGA85xFjmhn0xKrpC05VkFj8EscS0G5I9+TdyM9GV9B1WMe0BpAV1zCoWkFZu98sXAW6bWP8hJgF7CIQWiKUsXc9zVpb/heoUxHD3nVWIpp1xqZBcSy2gSOfOd2PK1j0IbEhKhfYPgvSVeCooYHxJi7rXXEzSEhIdCW7fuyFBBT2TBkLVut0KdbVsV+DLSnkHfOu+eVOtbhn+DXQYH9KmlsVTQ== Received: from SJ0PR05CA0127.namprd05.prod.outlook.com (2603:10b6:a03:33d::12) by PH8PR12MB7136.namprd12.prod.outlook.com (2603:10b6:510:22b::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Tue, 22 Oct 2024 18:07:24 +0000 Received: from CO1PEPF000042AD.namprd03.prod.outlook.com (2603:10b6:a03:33d:cafe::19) by SJ0PR05CA0127.outlook.office365.com (2603:10b6:a03:33d::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.10 via Frontend Transport; Tue, 22 Oct 2024 18:07:21 +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 CO1PEPF000042AD.mail.protection.outlook.com (10.167.243.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.14 via Frontend Transport; Tue, 22 Oct 2024 18:07:20 +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.1544.4; Tue, 22 Oct 2024 11:06:58 -0700 Received: from pegasus01.mtr.labs.mlnx (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.1544.4; Tue, 22 Oct 2024 11:06:55 -0700 From: Alexander Kozyrev To: CC: , , , , , , , , , , Subject: [PATCH] net/mlx5: add support for transport mode ESP ptype Date: Tue, 22 Oct 2024 21:06:40 +0300 Message-ID: <20241022180640.1426495-1-akozyrev@nvidia.com> X-Mailer: git-send-email 2.18.2 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000042AD:EE_|PH8PR12MB7136:EE_ X-MS-Office365-Filtering-Correlation-Id: 06a8703b-2c3c-4409-64d8-08dcf2c45f65 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|82310400026|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?5Pymg3Go9pLRnz9hkdtXhuIThbmJHbQyiPbm753UTs0ldkWOrBpNpbvYu1ZL?= =?us-ascii?Q?i5php88bEGgD/Sdg+xfN7TDcUN8fXNyduZ6kQ6RdFsrTkSq2yQ9y643ytmZn?= =?us-ascii?Q?Jc3pDTy6a1dWIxxggunnf/PQz7TFf5UgDm9lkaVKybm9ieZkrUP7jIdLmZsz?= =?us-ascii?Q?zInf9ZaVSwMUsuYMIqltP5n1Q69p3YLDyohRM+I+1AEuJSOflNavR/MUtk8A?= =?us-ascii?Q?0o+oZ8c06OkxOlia1Gnu0BW2DuWaXFyG4XW5ZabwBBgCmzLbcSitgmXOiuUu?= =?us-ascii?Q?OgElq0yCogVHinM3n2aotOkwqkEEDy4a6kCm0/dI3YsyvkwSzXJ82IO/wGoU?= =?us-ascii?Q?JZgPPm78mG5TmchH3wCCztlZ77FJQIzzisAWLGwUlJaIA051WvtZh150AEhV?= =?us-ascii?Q?//3O5yEl/HoIjstP4VoCHT8kABy/GzVnzfwhIQUFbp/koQqXbAGOPLtEaJVo?= =?us-ascii?Q?RJTP6SQhsmUyR++j1S9TzklP0E8ZyW9tt6nWlZqLm3GRdScUR1JMUNJ6sETi?= =?us-ascii?Q?fyx6XyvIBQ7xaAVv2qE2+iyLtJGSyIjeyJelstQ0wms91IUA09tTvCiagDYz?= =?us-ascii?Q?S/w886e8oWiI5bClWpvePbhxir4zpRKdYpNisXT+1A/dM+FM4Or4wh10wPO1?= =?us-ascii?Q?e9hvNxgoD6MJuI/nFZ7jfS8HU3BVJ25s7aNz9y3Pb1USAcKqXplNmCe1ZPse?= =?us-ascii?Q?6Tl3koYzROFwPAWxJVy8JbR5mnGXK+UqtB5g7jBIS6wuzg4iG1THKh6y2ay1?= =?us-ascii?Q?F9j1tVRI2lxMkPIXfRnbflYa4+G8ouzSGb+PsqP6lmzpSO+k3UkMxuNsammZ?= =?us-ascii?Q?1J9bdvq2VfSH+telb8ldVsB4mSIhHNka9FbGv9uQLsXtBbPW1HRNt9dc/vRa?= =?us-ascii?Q?2Dn/YwzD9CPS4wq4pDBv7E1oZfz5uFRnVmqqafVYWFjY+TL3GGve7RLedcLJ?= =?us-ascii?Q?CvTzN10xETognac6D43T3iHwSR7dLnKyzTABvSD+MhtAQD47t0Q5jusAbY0X?= =?us-ascii?Q?pD9+z1enQuxxcJvyd6rHG/UG6KaoaTXdCW6Gnep8m+rp1zr0rzOz8O9IQJ3D?= =?us-ascii?Q?tsG6NVgFnOBBY6nD1X9qIt9HIIgGbECyyWr+nWfNzG/0A4WNOCEoNCy9kM+G?= =?us-ascii?Q?49DlUSzUCvbQfaJQkmTHB7RhNZYQ6Yb1TBo2NzO+fv3gWxdgduG9ZwJFwNQy?= =?us-ascii?Q?9SmzVoix3Z8uUnknnMvESvcRYEPafkptqwCEKUc0z7HVpmw4HrUUPY+bRWpW?= =?us-ascii?Q?bzrICHXE9SAdlVU7zJNWxOFKSmzdRviuPq04OxHxlSiegvE4tY+eBxnkOVjx?= =?us-ascii?Q?j006GpAV+L+ZRME1Cs4djaqkDGkSYqKOWLJo0LASlF9eYkxtNDpqnIoQstnH?= =?us-ascii?Q?ub37Iea1x/XeTtWVwsQNolASnjjW2Sqwi2i0DGCi/Bb/jIof3Q=3D=3D?= 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:(13230040)(376014)(82310400026)(1800799024)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 18:07:20.6353 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 06a8703b-2c3c-4409-64d8-08dcf2c45f65 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: CO1PEPF000042AD.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7136 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 Implement matching on RTE_PTYPE_L4_ESP and RTE_PTYPE_INNER_L4_ESP for IP Encapsulating Security Payload (ESP) in transport mode. Signed-off-by: Alexander Kozyrev --- drivers/net/mlx5/hws/mlx5dr_definer.c | 33 +++++++++++++++++++++++++++ drivers/net/mlx5/hws/mlx5dr_definer.h | 2 ++ 2 files changed, 35 insertions(+) diff --git a/drivers/net/mlx5/hws/mlx5dr_definer.c b/drivers/net/mlx5/hws/mlx5dr_definer.c index 79d98bbf78..bf86627f49 100644 --- a/drivers/net/mlx5/hws/mlx5dr_definer.c +++ b/drivers/net/mlx5/hws/mlx5dr_definer.c @@ -345,6 +345,27 @@ mlx5dr_definer_ptype_l4_set(struct mlx5dr_definer_fc *fc, (inner ? RTE_PTYPE_INNER_L4_MASK : RTE_PTYPE_L4_MASK); uint8_t l4_type = STE_NO_L4; + if (packet_type == (inner ? RTE_PTYPE_INNER_L4_TCP : RTE_PTYPE_L4_TCP)) + l4_type = STE_TCP; + else if (packet_type == (inner ? RTE_PTYPE_INNER_L4_UDP : RTE_PTYPE_L4_UDP)) + l4_type = STE_UDP; + else if (packet_type == (inner ? RTE_PTYPE_INNER_L4_ESP : RTE_PTYPE_L4_ESP)) + l4_type = STE_ESP; + + DR_SET(tag, l4_type, fc->byte_off, fc->bit_off, fc->bit_mask); +} + +static void +mlx5dr_definer_ptype_l4_ext_set(struct mlx5dr_definer_fc *fc, + const void *item_spec, + uint8_t *tag) +{ + bool inner = (fc->fname == MLX5DR_DEFINER_FNAME_PTYPE_L4_EXT_I); + const struct rte_flow_item_ptype *v = item_spec; + uint32_t packet_type = v->packet_type & + (inner ? RTE_PTYPE_INNER_L4_MASK : RTE_PTYPE_L4_MASK); + uint8_t l4_type = STE_NO_L4; + if (packet_type == (inner ? RTE_PTYPE_INNER_L4_TCP : RTE_PTYPE_L4_TCP)) l4_type = STE_TCP; else if (packet_type == (inner ? RTE_PTYPE_INNER_L4_UDP : RTE_PTYPE_L4_UDP)) @@ -1937,6 +1958,12 @@ mlx5dr_definer_conv_item_ptype(struct mlx5dr_definer_conv_data *cd, fc->item_idx = item_idx; fc->tag_set = &mlx5dr_definer_ptype_l4_set; fc->tag_mask_set = &mlx5dr_definer_ones_set; + DR_CALC_SET(fc, eth_l2, l4_type_bwc, false); + + fc = &cd->fc[DR_CALC_FNAME(PTYPE_L4_EXT, false)]; + fc->item_idx = item_idx; + fc->tag_set = &mlx5dr_definer_ptype_l4_ext_set; + fc->tag_mask_set = &mlx5dr_definer_ones_set; DR_CALC_SET(fc, eth_l2, l4_type, false); } } @@ -1953,6 +1980,12 @@ mlx5dr_definer_conv_item_ptype(struct mlx5dr_definer_conv_data *cd, fc->item_idx = item_idx; fc->tag_set = &mlx5dr_definer_ptype_l4_set; fc->tag_mask_set = &mlx5dr_definer_ones_set; + DR_CALC_SET(fc, eth_l2, l4_type_bwc, true); + + fc = &cd->fc[DR_CALC_FNAME(PTYPE_L4_EXT, true)]; + fc->item_idx = item_idx; + fc->tag_set = &mlx5dr_definer_ptype_l4_ext_set; + fc->tag_mask_set = &mlx5dr_definer_ones_set; DR_CALC_SET(fc, eth_l2, l4_type, true); } } diff --git a/drivers/net/mlx5/hws/mlx5dr_definer.h b/drivers/net/mlx5/hws/mlx5dr_definer.h index ced9d9da13..5c809866b7 100644 --- a/drivers/net/mlx5/hws/mlx5dr_definer.h +++ b/drivers/net/mlx5/hws/mlx5dr_definer.h @@ -171,6 +171,8 @@ enum mlx5dr_definer_fname { MLX5DR_DEFINER_FNAME_PTYPE_L3_I, MLX5DR_DEFINER_FNAME_PTYPE_L4_O, MLX5DR_DEFINER_FNAME_PTYPE_L4_I, + MLX5DR_DEFINER_FNAME_PTYPE_L4_EXT_O, + MLX5DR_DEFINER_FNAME_PTYPE_L4_EXT_I, MLX5DR_DEFINER_FNAME_PTYPE_TUNNEL, MLX5DR_DEFINER_FNAME_PTYPE_FRAG_O, MLX5DR_DEFINER_FNAME_PTYPE_FRAG_I, -- 2.18.2