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 1917F42900 for ; Mon, 10 Apr 2023 14:56:18 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E960D40DDC; Mon, 10 Apr 2023 14:56:17 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2056.outbound.protection.outlook.com [40.107.244.56]) by mails.dpdk.org (Postfix) with ESMTP id 36C8240A81 for ; Mon, 10 Apr 2023 14:56:16 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K3j9TrWXEalvtqqTSSdslEDuazz/RmgJNBeJnr+XmPgI926E87Og/spu72oQeH5jnDfASd8uhux2Hz1nMKtWtUuFbkuOBsTwli0Li7jeBeRk7T/fLNgAfYQ7lLY6qT+42l6NJ1O7PNetOPpSxWqr48ZQZu5xz3hzoSB1mjrcxYqB2E4DaOEbHbVMgzFvrOBWe5YNn+xhNn7cItVnnrow/0ipqDQwttxIKZYK0uVjU2F1bHL7HtN9c83B3r7Ta6eW86cTXzHKe5pkp25h7RLg/glNUQwzQMOpTY+fK9pI0OAHYv8PPDp5H3C4Lj12ivTgpp7vKBzMBG+/I7BaN7KVpw== 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=EhtzuiHWr/524Tst/R3m4Z1phwGu84zAz0d5YOZnF6g=; b=BXFWzb7fnnFdYXsl7FyChUBwFdCAYFeNmIc0uEyQhlnHxsLSbWzHQivbuaO0LxEn0IysDAn1rGdeEd6xEeRjwWYOSmbyYZIJbOeYhu2Tph8fTb1bP9By0IAZvLkxOzx8fhL9CgyDh3IaqzQWTClxZgdnanxTYY2jwtGKfIAo0dygYM6knpnlpq9t5iQ60UQ1Qy5mMCoENFtxmXh+U0IFeAXufzLDUvJdo8xk5dQoxXQxHnAoidYyY2iyBjf/pTmLpYCWHu1V1Gu4a73PBaNFikK497BGeZsXgGqilsrXvD3+GnuJo7EPXsfAGhVJAYx63/UKFrH2wn02W+FjYjtoog== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=monjalon.net 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=EhtzuiHWr/524Tst/R3m4Z1phwGu84zAz0d5YOZnF6g=; b=HzbSE/vNnfzQCAK+JQAeZstH8XIk8uj5FJIAW9rJ9Ag7hJwguXhd5DiOz5409VvvAShWzmbWfC6svCHqVnQ1INVViJsBxkVFUHmfnHrEAdQCVy8DYi3emrgK3rVIoa5iCpQfg8StrEYEWml1VQiWa0URq5PfZNT3dN4LldAopvjNjdXvkWGJECC/oeVrbAOcZy5c46K1rz45L56R8AfLXCqc476FQbwghs1DaKy9lt0zoMZXdyB5TXCdEf4yixhhQ9xw5hybBsl7Vn+3rIcL1cS9+Sbf2CERhHCTx8TqeI4cjv2y5WCi6EZbt5GJIYO3UBqJPXbtC5je9mg28j+2GQ== Received: from MW4PR03CA0053.namprd03.prod.outlook.com (2603:10b6:303:8e::28) by SJ2PR12MB8847.namprd12.prod.outlook.com (2603:10b6:a03:546::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.38; Mon, 10 Apr 2023 12:56:13 +0000 Received: from CO1NAM11FT071.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8e:cafe::9a) by MW4PR03CA0053.outlook.office365.com (2603:10b6:303:8e::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.35 via Frontend Transport; Mon, 10 Apr 2023 12:56:12 +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 CO1NAM11FT071.mail.protection.outlook.com (10.13.175.56) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.25 via Frontend Transport; Mon, 10 Apr 2023 12:56:12 +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, 10 Apr 2023 05:56:03 -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; Mon, 10 Apr 2023 05:56:01 -0700 From: Hamdan Igbaria To: , , , CC: , Subject: [PATCH 22.11] net/mlx5/hws: fix IPv4 fragment matching Date: Mon, 10 Apr 2023 15:55:42 +0300 Message-ID: <20230410125542.3108908-1-hamdani@nvidia.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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: CO1NAM11FT071:EE_|SJ2PR12MB8847:EE_ X-MS-Office365-Filtering-Correlation-Id: 1c00a4de-5cd5-49df-8a71-08db39c2f699 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: weVhQ8K8q8vAQ1BRMxWXReqZXrhQCn6MWwyi5ffdun3XlNJz40pgRQ1MGCe6t+S52Vk9HM2mQmMMb9SkqXe3+9roCAWVzyTaNbtRENLebNJJgb86LzEuTpZ0y/fnfxo8NHNnMKRM6InvVX4Y7zvhZV6hU/14qZdlLwoqrmoyJUIJXqmew0TwVw1/hCEqjTRCAgC97XNoZ0fNPvHWLc5Sww3ssZJ8EFCcH7fUNonkvBafYC7TEqGtQpgdE2fUz4w2+pXkPaf/Mrrz1LkfWo466lx/MMod/yWgoW4vM5Sx2ML+HUAoAgx59EvfQ1XaFRQ9Sv1yRLT3Xxgk2XGerylRth++aDcAns8e2AyVwM4CnIWzwkdXq2NGXcm3zVfSmz8IzVIjuoCvWl7ILU7t0zq6Ned2mSr3n133Fxe7P8aqEJzdtDiMVbJIOah/izw4sjv7xF18HAiXSWgxznFbPuHYQ4UjXqky1xDkXVypmCKFl2oBMsR6DZz7hUFyJGN47BpLrkYmXHnLVwmVF+23rOeKXclDO61BFBSQ5TTBBU+QTK66TzBI9xFj8AOjY1vOL0IcTuZH9aAKz6BPfERr0OF4xZXFmn1N8BfY6hj/Pm9HzWof9HZJFmBP8Wz3Wbk40WLLsrUDajJDIoJkk6yOL6WO+MbYsQXGLeAld/xnDP79GErc4qTX7MTl+zU+UyavevB8SH2xKxvprusp3o/FW0AsRTCYPnTBbQvC2L375P3XmUasqzA/5kya5rzA9sGGMeKkYZBqQjEG/O0h6i6P378BCp+eIKDKHfeM7GawNaXhvYy3zFP8iQRXEEE523BoCAULalQ7vI+xMu2YWF3mVI5wyQ== 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)(136003)(376002)(396003)(346002)(39860400002)(451199021)(46966006)(36840700001)(40470700004)(478600001)(7696005)(316002)(54906003)(6636002)(110136005)(1076003)(26005)(16526019)(186003)(6286002)(6666004)(2906002)(5660300002)(4326008)(70586007)(70206006)(41300700001)(8936002)(8676002)(82310400005)(107886003)(7636003)(356005)(82740400003)(86362001)(55016003)(40480700001)(40460700003)(36756003)(83380400001)(47076005)(2616005)(36860700001)(426003)(336012)(309714004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2023 12:56:12.5972 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1c00a4de-5cd5-49df-8a71-08db39c2f699 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: CO1NAM11FT071.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8847 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 f3291366c95096fbe99ab8dd2248d033b191522d ] Fix IPv4 frag matching in case fragment_offset field is set to non zero value in the mask. fragment_offset value is converted using the following logic: -In case fragment_offset value was set to 0x3fff, then we will match only on ip_fragmented bit. -Otherwise we will match fragment_offset based on spec and last same as any other field. Fixes: c55c2bf35333 ("net/mlx5/hws: add definer layer") Signed-off-by: Hamdan Igbaria --- drivers/net/mlx5/hws/mlx5dr_definer.c | 11 +++++++++-- drivers/net/mlx5/hws/mlx5dr_definer.h | 9 +++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/net/mlx5/hws/mlx5dr_definer.c b/drivers/net/mlx5/hws/mlx5dr_definer.c index 6b98eb8c96..768bed580d 100644 --- a/drivers/net/mlx5/hws/mlx5dr_definer.c +++ b/drivers/net/mlx5/hws/mlx5dr_definer.c @@ -123,6 +123,7 @@ struct mlx5dr_definer_conv_data { X(SET, ipv4_next_proto, v->next_proto_id, rte_ipv4_hdr) \ X(SET, ipv4_version, STE_IPV4, rte_ipv4_hdr) \ X(SET_BE16, ipv4_frag, v->fragment_offset, rte_ipv4_hdr) \ + X(SET, ip_fragmented, !!v->fragment_offset, rte_ipv4_hdr) \ X(SET_BE16, ipv6_payload_len, v->hdr.payload_len, rte_flow_item_ipv6) \ X(SET, ipv6_proto, v->hdr.proto, rte_flow_item_ipv6) \ X(SET, ipv6_hop_limits, v->hdr.hop_limits, rte_flow_item_ipv6) \ @@ -542,8 +543,14 @@ mlx5dr_definer_conv_item_ipv4(struct mlx5dr_definer_conv_data *cd, if (m->fragment_offset) { fc = &cd->fc[DR_CALC_FNAME(IP_FRAG, inner)]; fc->item_idx = item_idx; - fc->tag_set = &mlx5dr_definer_ipv4_frag_set; - DR_CALC_SET(fc, eth_l3, fragment_offset, inner); + if (rte_be_to_cpu_16(m->fragment_offset) == 0x3fff) { + fc->tag_set = &mlx5dr_definer_ip_fragmented_set; + DR_CALC_SET(fc, eth_l2, ip_fragmented, inner); + } else { + fc->is_range = l && l->fragment_offset; + fc->tag_set = &mlx5dr_definer_ipv4_frag_set; + DR_CALC_SET(fc, eth_l3, ipv4_frag, inner); + } } if (m->next_proto_id) { diff --git a/drivers/net/mlx5/hws/mlx5dr_definer.h b/drivers/net/mlx5/hws/mlx5dr_definer.h index d52c6b0627..5b38a54e6b 100644 --- a/drivers/net/mlx5/hws/mlx5dr_definer.h +++ b/drivers/net/mlx5/hws/mlx5dr_definer.h @@ -196,8 +196,13 @@ struct mlx5_ifc_definer_hl_eth_l3_bits { u8 time_to_live_hop_limit[0x8]; u8 protocol_next_header[0x8]; u8 identification[0x10]; - u8 flags[0x3]; - u8 fragment_offset[0xd]; + union { + u8 ipv4_frag[0x10]; + struct { + u8 flags[0x3]; + u8 fragment_offset[0xd]; + }; + }; u8 ipv4_total_length[0x10]; u8 checksum[0x10]; u8 reserved_at_60[0xc]; -- 2.31.1