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 C3A6942825; Thu, 23 Mar 2023 13:35:08 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D39E342C4D; Thu, 23 Mar 2023 13:35:00 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2087.outbound.protection.outlook.com [40.107.223.87]) by mails.dpdk.org (Postfix) with ESMTP id C30EF4282D; Thu, 23 Mar 2023 13:34:59 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SOzvyqVzAfAtuPJPZxUNFQFeyUedvHbbINMe0fNyaqN1aJPYksCBDN086sk9UXed5rKtoE1XrF0A6eNLLzGxwQA/dvXKiRMTA1desMNQr+0SKcYvFsLGxQIls7aZDNW7oNWBBv2wTIk+51O2F2Y6Nbaih6ViKC+lLJRyYigOd+S6wMfuG2YL6OsKS5pfr+x1onUzTf/NrToTnVeub/hafYLsAhY0bW7n2dwmJgCYuI1SoQvMgr267a9pj8RW1kcNHagbbgjK8BhhgA/mDahx4GiuE20+A+DNYwPqf1aOIxOIHmAGuxxks6Qqy4fJLI7/58bMo77iAU5qUYGBmyaoMw== 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=loiZynQc2ZRad+/Zc5PgknP/YCqfjpysCTrWDm9XPkE=; b=YUa9fMVWggcilInaChx47Hj+PDs+cgGgArdqQenuWa44o1PqgpuT9RfqmenOlvWGh7N7CVsEwF7Ah962Yy+r+glKgMLCtbM0Byeuj3gPFEyktaXaj6lmG3pooJMRlCfOU3ZzhvFrL38TE/duFafqbF/jIeXc4Kxu+5rTu1dkp6KtYOuZlz0paFfv5EKw8XevFUMjuz+ccnWiRsB2sjjykpA63bMMbSGrLYOq+RCI73uctO2BSuG6Xg93UlZWpKo+NntsheZoXIl54w/bKODCFwcnbSTmDpZz0QtfCVAjXTvbZBtJAjjFzHJiBnvQvG2GIrnbAxNtmfpfix9Th1KHuA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) 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=loiZynQc2ZRad+/Zc5PgknP/YCqfjpysCTrWDm9XPkE=; b=UXrS0UElBP6BDzOIZJTfDmUV65P2lg4lwGnilsm8NHasMVvHmgncyeevLME4wgBfDrs1Luw+0PA88WQr7pUBNWHgqAWJhj8gEtNi6Amgh5jjTLUXyze/k8hcG+Rt3rOAbWXw2RX2htk3/a4LADDYLTV/YE1cnMdNJmq2GFFT6JFlnXZg8rXFGcixfdV7tX527GDIQq69xIV07HvUSbk5a6oeCus0vItaewG0r0mSnh5zfEUFYRJgvXWpgzinNG/MBjPBpBzvEPkZT6HgEsStRB/oIm9O84v0vAGF8mzGkTSbOx3IHUMtwTlDlMGQ4hKf4gGHNB/vZ89Qshz9cfizfQ== Received: from DM6PR02CA0091.namprd02.prod.outlook.com (2603:10b6:5:1f4::32) by SA0PR12MB7002.namprd12.prod.outlook.com (2603:10b6:806:2c0::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.28; Thu, 23 Mar 2023 12:34:57 +0000 Received: from DM6NAM11FT028.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1f4:cafe::c7) by DM6PR02CA0091.outlook.office365.com (2603:10b6:5:1f4::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.38 via Frontend Transport; Thu, 23 Mar 2023 12:34:57 +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 DM6NAM11FT028.mail.protection.outlook.com (10.13.173.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.22 via Frontend Transport; Thu, 23 Mar 2023 12:34:57 +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.986.5; Thu, 23 Mar 2023 05:34:48 -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; Thu, 23 Mar 2023 05:34:45 -0700 From: Alex Vesker To: , , , , Matan Azrad CC: , , Hamdan Igbaria , Subject: [PATCH] net/mlx5/hws: fix IPv4 frag matching Date: Thu, 23 Mar 2023 14:34:16 +0200 Message-ID: <20230323123416.26636-3-valex@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20230323123416.26636-1-valex@nvidia.com> References: <20230323123416.26636-1-valex@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.126.230.37] 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: DM6NAM11FT028:EE_|SA0PR12MB7002:EE_ X-MS-Office365-Filtering-Correlation-Id: dc0c89fe-0f0b-446c-ea89-08db2b9b02e6 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: x6ZzaoHZryUw5ZCP96dJYu+4A1KUp8yOKoXujuLI5z3zvgcCRPt0INeZSz4lHLJG2q2ZJrQseKeU1uow70tEXNCP+x7K/0V8yWbsSZUuuTmYey2oJ/F6IDTG/CG18Y+aLnAoBDjlCIGQ5X5XtZEdt4On2c1mE9xtNmVLvT8xwrP2AN+VwriK4yF5m8+532USCrBWb/eBfKeentNm+tJ0p93BCHY0+2W4IBRWmoo8Cm06QWf+W/zTh+DxHu2tk/PCsjqgrUajcuQsJS4DXpioR7QqLFuRnMSelBNGHZOGSSiJc+qZ5yXv5eNt+UqRm+2lr3ODJ5esHzNXN5xFP1Lf3IIeIKOzrD7eEXY+eU2eBszkBblSILbcl13Szk3jZqtwhwXVeP2edsr/bZYiDKaFh6IDZ9V2ujsj+zXWPJUEHDDKnM84Cia5iN0X5itdeaH78WjXcnBkm3IeM3ghcavV9xwrakdpwiNFHbWqjPX+QErwZF/+8/BpRcETXs2pBcgD73HW+0pNN5iBxFqA2wNMRuuLxn2bHacW8DCHRthltel30dM3FPshGA3616he5atfPFBwnO9I+BxlYoos7YiUK7erPMJTsxD97+JDAIAXM9ZyA/oOxJiYir/nBNxpMW6aqEfPROmHWIXQndJY8TDTqySDmpj6IaUcWfR8yOXaif24f/LH1OhxzOkRoX4eL3oaHVbbySbHoNiOkWj/pvomnhvSYByfnrgOW8An55DLTJlP0Mm6IrihgWJ5+3Rz+x9nFfVAlpJjbVXg/Os4prZeMA== 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:(13230025)(4636009)(396003)(376002)(39860400002)(136003)(346002)(451199018)(36840700001)(46966006)(40470700004)(54906003)(36756003)(316002)(8676002)(83380400001)(47076005)(336012)(6636002)(70206006)(40480700001)(40460700003)(70586007)(26005)(1076003)(16526019)(2616005)(6666004)(6286002)(82740400003)(356005)(41300700001)(82310400005)(5660300002)(7696005)(86362001)(186003)(4326008)(2906002)(36860700001)(110136005)(8936002)(7636003)(478600001)(55016003)(426003)(309714004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Mar 2023 12:34:57.0264 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dc0c89fe-0f0b-446c-ea89-08db2b9b02e6 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: DM6NAM11FT028.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB7002 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 From: Hamdan Igbaria 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") Cc: stable@dpdk.org Signed-off-by: Hamdan Igbaria Reviewed-by: Alex Vesker Acked-by: Matan Azrad matan@nvidia.com --- 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 379f4065e7..f92d3e8e1f 100644 --- a/drivers/net/mlx5/hws/mlx5dr_definer.c +++ b/drivers/net/mlx5/hws/mlx5dr_definer.c @@ -127,6 +127,7 @@ struct mlx5dr_definer_conv_data { X(SET, ipv4_version, STE_IPV4, rte_ipv4_hdr) \ X(SET_BE16, ipv4_frag, v->fragment_offset, rte_ipv4_hdr) \ X(SET_BE16, ipv4_len, v->total_length, 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_routing_hdr, IPPROTO_ROUTING, rte_flow_item_ipv6) \ @@ -735,8 +736,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 0cd83db756..90ec4ce845 100644 --- a/drivers/net/mlx5/hws/mlx5dr_definer.h +++ b/drivers/net/mlx5/hws/mlx5dr_definer.h @@ -226,8 +226,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.18.1