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 2197743F50 for ; Tue, 30 Apr 2024 07:56:05 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 15943402A8; Tue, 30 Apr 2024 07:56:05 +0200 (CEST) Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2045.outbound.protection.outlook.com [40.107.102.45]) by mails.dpdk.org (Postfix) with ESMTP id DEBFE40262 for ; Tue, 30 Apr 2024 07:56:03 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B+eRisvzm8vsKIGon20E6a4JWjlZMfcS5WluanWpX38nBEUjwaUYA9KuMH/hqTk84m1nwp6MyxssZz179jUL0g6C+vjrFfEhNCPnXDNadeAGkgiVIhjMDOabOl7JW2omcxDggfzxN3MPtj/flEbmdhat8iQen16V/dekED6DgSC/ezA0OmrIgkx2SexPXS++Ycs0QBFBvuCHRil5jzLTyk1jgmug1vHKM8gAsamIu/JtaRAIONedptoW6fq4FEWbDAk+3EMgNdkOuo4UhbRiNdqpUfzPhStr6usjOMkh9rixzH/eu7Mtafm+uLA91hnOzvOnjo0NvL+QjxfmvKhIWw== 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=cs33p4GQK2Kc4dDKz8eRGjZ265jbcDH3dVnHAElS5eg=; b=n00ZKIWx2dpySLVOl6B7kwVlBR3GwhepDwPKF3MoThOgAX230M6N7YaaQHtunHAwksaOPF5F+B24bp3b2kN9adB6nO8xUjJ5/N96OBfvHY7xlfwD6RjPgM+yX/wTK44YOyx2LI3kBg5WJ3yAEAMFyOyTUMqUS6OYp5BJvS5GZLV7WGsEcQBzXlExUOpKg5o0hKeBUKGIkg89RtdKc0Co9pMOAQNNAT6VdzXOdsf0rpW0ehM/jzDiW1rbyvd3WJQCSNrqLieWZZqhc4eLKLqnj2L0Gk+JKoxDWO7hh9TYEHgR4VNM5QoP2YqEad1TwTIT28YJuGHk/0w3MUxMGM5Nyw== 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=cs33p4GQK2Kc4dDKz8eRGjZ265jbcDH3dVnHAElS5eg=; b=HeFx4HfH8JbVnf9vdVBHr9X+FqrOAnmCzq7zqaxkdBs+8AxF6IJzT9RyJhhDRwx4vgeyUJ1z0Us2N2/4UgBGPEVEcYIEC5vhYZl8kTQSdUpr+7wQO0mbIWIvTUuA/RzOjvtA20qYwPteDA2zIvwTFvjHXBMpom1VPkefIWsMTpAzJy1GVpKIo1neCdr/byk/Iy5rn/sDc5PGghXhFfz8R/ofuhw7BU3ibcnDRlhLEayPJ1uPNM/HmbRpZBzACKwk5VWn6EJO9iyZowTYP0/R4v+uvqt7iYql6UdHrmPwi+YHK8a33EKP3RIkWySTDr+V3qEVFf4ai8EUUCJjs6rpAA== Received: from DS7PR03CA0341.namprd03.prod.outlook.com (2603:10b6:8:55::23) by SJ2PR12MB8831.namprd12.prod.outlook.com (2603:10b6:a03:4d0::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.35; Tue, 30 Apr 2024 05:56:00 +0000 Received: from CH3PEPF00000014.namprd21.prod.outlook.com (2603:10b6:8:55:cafe::98) by DS7PR03CA0341.outlook.office365.com (2603:10b6:8:55::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.32 via Frontend Transport; Tue, 30 Apr 2024 05:56:00 +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 CH3PEPF00000014.mail.protection.outlook.com (10.167.244.119) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.0 via Frontend Transport; Tue, 30 Apr 2024 05:56: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.1544.4; Mon, 29 Apr 2024 22:55:47 -0700 Received: from nvidia.com (10.126.230.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; Mon, 29 Apr 2024 22:55:46 -0700 From: Alex Vesker To: , , Subject: [PATCH 23.11] net/mlx5/hws: fix tunnel protocol checks Date: Tue, 30 Apr 2024 08:55:36 +0300 Message-ID: <20240430055536.1627-1-valex@nvidia.com> X-Mailer: git-send-email 2.18.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.126.230.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: CH3PEPF00000014:EE_|SJ2PR12MB8831:EE_ X-MS-Office365-Filtering-Correlation-Id: 22a88e56-029b-440c-a953-08dc68da3662 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|376005|82310400014|1800799015|36860700004; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?sn+T2fvS8pgmCvyFe9nF6Q1x9XaiHhbrWLwhdCurJJ8qtXoKZZy5KbASzldp?= =?us-ascii?Q?pAHKaZ4OFhCuNR47p7mKSsdy6kXXg+Pln0Vre0TZxdHlRR09nbMneVQy5x/S?= =?us-ascii?Q?+j3pSkgYgRiDNtys7h0gzKLKPWNAsnElVAFZXr/UgyMWIFOCMsqxFbevlGDc?= =?us-ascii?Q?5shqcsZaNFmTdclijV32LJKQFM+73Hm/xAjfgIk0jXm3hhLuGpk3NqAs2XKw?= =?us-ascii?Q?PLtc58z0wnprA6MpMf2oYoyXVRSnv3V1wEpJPRNgu5n1uwEr26CQGDfi43Fi?= =?us-ascii?Q?C2cYdJIXYOsaHcdo5Q9UWefaLlHOYgwq0zT0RsDhLhFNSog80kTX89pnTvz6?= =?us-ascii?Q?kdLuHbwFrj/4cd2ejLbLw7Y1m+Elb+3HB6Z/mnzEUQD4dCACmJ+0La0qjIra?= =?us-ascii?Q?xm/CIQ6vP+E/iM5DYK/8pLajDQPb8jGOCDa3932QBWy05gQhQLLf//eMwuj7?= =?us-ascii?Q?2QUqvWI1fs1tPhDf/E+7I+aNmHk7ky76/wlyX3Rfx7FGdawOJ1na3u3LmzbP?= =?us-ascii?Q?Jo0UPyHrqy2kJtwg+ftEFOgEyI6S1aD2vxvGypySWQV8yHOs8DqBcX3UKK1A?= =?us-ascii?Q?fquvKDZn9XwCGDGNlsFvLDabq9QQEqH4CqbbNeqZ8Df77/wB3MUSCMbY+8ie?= =?us-ascii?Q?p43yGJSHqJDbsLxW6x6vA+xTtiJx+urkRh9FdUwvvacVKm5C+hdk2ukZruSw?= =?us-ascii?Q?FMfdiNhSRR44urqtspudPHydzIbeFts6L0qxrCuBSqGcr0AgI/SxruatriA5?= =?us-ascii?Q?Srg0iO0J7NHKu1D33nJW0KZaZvlbPMt+4Z78hu/mWjPHiT+9H8iqeCm9dF/n?= =?us-ascii?Q?mNEUzuQ5LbRnfaNXHoDb6a+EAGT5g3ky/PW8NzEIl6uFK3bAhefTBvtT9ZfP?= =?us-ascii?Q?se1MAO1xjoPBX1fbwfOym6c7ZD7Cto1LLzIg9gFlSy9F4+kbdiqg/u+kkhy7?= =?us-ascii?Q?EW770hhN6SZLTSIoT77OV9OJWIkRe6cotz3GZ6ZyWTS+okcaHBoKGB2wnbu7?= =?us-ascii?Q?C2pJ8JEnU7MSE+RjXYz1s08lkoWwT7agZYPZLV7rp1rjDmcN2YYhchFzJaJh?= =?us-ascii?Q?IFq314KT10AXNRZvVFGLuYCOLzeN1elNCEdknt41siiQClvbtgMVptOjrz6a?= =?us-ascii?Q?NGK1bmQFKDEW6MDXml6GOBoiQKA4gL1sD/2U0NGyCR4V4KOogr1KOXf2hRTk?= =?us-ascii?Q?Fke7CWdMwYL+29Njc9l6R/E4WyiEhdcSqCDHHJgsOI/oYCp3xpEEemFnTsJr?= =?us-ascii?Q?XrRgRFOq0JZfl6J4JKltVj8z4hWdNaG8zvedkJavcRs0ebwDAOH3uJiFacbV?= =?us-ascii?Q?18zSWQOFgeX1cmkfe3qqf70b7Fd1TYDolT3+sF/dl6ZCyKPeWgn8szWNS3SC?= =?us-ascii?Q?+qkKKFCGhKK97XZq5jEK1AIIBZwr?= 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:(13230031)(376005)(82310400014)(1800799015)(36860700004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2024 05:56:00.2643 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 22a88e56-029b-440c-a953-08dc68da3662 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: CH3PEPF00000014.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8831 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org [ upstream commit 28e69588f4170f29b73a04fc3bffba2596305782 ] Align GRE, GTPU and VXLAN tunnel protocols to fail in case the packet is already tunneled. Also use local defines for protocol UDP ports for better layering of mlx5dr API. Signed-off-by: Alex Vesker Acked-by: Suanming Mou --- drivers/net/mlx5/hws/mlx5dr_definer.c | 39 +++++++++++++-------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/drivers/net/mlx5/hws/mlx5dr_definer.c b/drivers/net/mlx5/hws/mlx5dr_definer.c index c6918ef4f3..3391b3d32a 100644 --- a/drivers/net/mlx5/hws/mlx5dr_definer.c +++ b/drivers/net/mlx5/hws/mlx5dr_definer.c @@ -8,8 +8,9 @@ #define BAD_PORT 0xBAD #define ETH_TYPE_IPV4_VXLAN 0x0800 #define ETH_TYPE_IPV6_VXLAN 0x86DD -#define ETH_VXLAN_DEFAULT_PORT 4789 -#define IP_UDP_PORT_MPLS 6635 +#define UDP_GTPU_PORT 2152 +#define UDP_VXLAN_PORT 4789 +#define UDP_PORT_MPLS 6635 #define UDP_ROCEV2_PORT 4791 #define DR_FLOW_LAYER_TUNNEL_NO_MPLS (MLX5_FLOW_LAYER_TUNNEL & ~MLX5_FLOW_LAYER_MPLS) @@ -162,7 +163,7 @@ struct mlx5dr_definer_conv_data { X(SET, tcp_protocol, STE_TCP, rte_flow_item_tcp) \ X(SET_BE16, tcp_src_port, v->hdr.src_port, rte_flow_item_tcp) \ X(SET_BE16, tcp_dst_port, v->hdr.dst_port, rte_flow_item_tcp) \ - X(SET, gtp_udp_port, RTE_GTPU_UDP_PORT, rte_flow_item_gtp) \ + X(SET, gtp_udp_port, UDP_GTPU_PORT, rte_flow_item_gtp) \ X(SET_BE32, gtp_teid, v->hdr.teid, rte_flow_item_gtp) \ X(SET, gtp_msg_type, v->hdr.msg_type, rte_flow_item_gtp) \ X(SET, gtp_ext_flag, !!v->hdr.gtp_hdr_info, rte_flow_item_gtp) \ @@ -170,8 +171,8 @@ struct mlx5dr_definer_conv_data { X(SET, gtp_ext_hdr_pdu, v->hdr.type, rte_flow_item_gtp_psc) \ X(SET, gtp_ext_hdr_qfi, v->hdr.qfi, rte_flow_item_gtp_psc) \ X(SET, vxlan_flags, v->flags, rte_flow_item_vxlan) \ - X(SET, vxlan_udp_port, ETH_VXLAN_DEFAULT_PORT, rte_flow_item_vxlan) \ - X(SET, mpls_udp_port, IP_UDP_PORT_MPLS, rte_flow_item_mpls) \ + X(SET, vxlan_udp_port, UDP_VXLAN_PORT, rte_flow_item_vxlan) \ + X(SET, mpls_udp_port, UDP_PORT_MPLS, rte_flow_item_mpls) \ X(SET, source_qp, v->queue, mlx5_rte_flow_item_sq) \ X(SET, tag, v->data, rte_flow_item_tag) \ X(SET, metadata, v->data, rte_flow_item_meta) \ @@ -1184,6 +1185,12 @@ mlx5dr_definer_conv_item_gtp(struct mlx5dr_definer_conv_data *cd, const struct rte_flow_item_gtp *m = item->mask; struct mlx5dr_definer_fc *fc; + if (cd->tunnel) { + DR_LOG(ERR, "Inner GTPU item not supported"); + rte_errno = ENOTSUP; + return rte_errno; + } + /* Overwrite GTPU dest port if not present */ fc = &cd->fc[DR_CALC_FNAME(L4_DPORT, false)]; if (!fc->tag_set && !cd->relaxed) { @@ -1358,9 +1365,13 @@ mlx5dr_definer_conv_item_vxlan(struct mlx5dr_definer_conv_data *cd, struct mlx5dr_definer_fc *fc; bool inner = cd->tunnel; - /* In order to match on VXLAN we must match on ether_type, ip_protocol - * and l4_dport. - */ + if (inner) { + DR_LOG(ERR, "Inner VXLAN item not supported"); + rte_errno = ENOTSUP; + return rte_errno; + } + + /* In order to match on VXLAN we must match on ip_protocol and l4_dport */ if (m && (m->rsvd0[0] != 0 || m->rsvd0[1] != 0 || m->rsvd0[2] != 0 || m->rsvd1 != 0)) { DR_LOG(ERR, "reserved fields are not supported"); @@ -1390,12 +1401,6 @@ mlx5dr_definer_conv_item_vxlan(struct mlx5dr_definer_conv_data *cd, return 0; if (m->flags) { - if (inner) { - DR_LOG(ERR, "Inner VXLAN flags item not supported"); - rte_errno = ENOTSUP; - return rte_errno; - } - fc = &cd->fc[MLX5DR_DEFINER_FNAME_VXLAN_FLAGS]; fc->item_idx = item_idx; fc->tag_set = &mlx5dr_definer_vxlan_flags_set; @@ -1405,12 +1410,6 @@ mlx5dr_definer_conv_item_vxlan(struct mlx5dr_definer_conv_data *cd, } if (!is_mem_zero(m->vni, 3)) { - if (inner) { - DR_LOG(ERR, "Inner VXLAN vni item not supported"); - rte_errno = ENOTSUP; - return rte_errno; - } - fc = &cd->fc[MLX5DR_DEFINER_FNAME_VXLAN_VNI]; fc->item_idx = item_idx; fc->tag_set = &mlx5dr_definer_vxlan_vni_set; -- 2.18.1