From patchwork Tue Jul 9 12:30:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Itamar Gozlan X-Patchwork-Id: 142264 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 662DB455E3; Tue, 9 Jul 2024 14:31:51 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 28965402E8; Tue, 9 Jul 2024 14:31:51 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2048.outbound.protection.outlook.com [40.107.237.48]) by mails.dpdk.org (Postfix) with ESMTP id 3793D402E4 for ; Tue, 9 Jul 2024 14:31:49 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nUerrOaVrGrMrOda+HUJQ4EnmtYFZEf/+4+xL6dJH4znEJoofVjTp8jjY0usX5DZuFvHs3qaf75KHFZrXgJ58lA/po96rMIA9saoP3lr4PHg12xW7C9ZjGtjnBqZFZHwdIjJOLDSevUnAkLxSiUnnlqyttXSyI2gVC0H19rU4Ar95FwmEPXnjo67J8fsMfhGdilCkwi8cdW9j1eC6srnWUOgzJTOO2k2gfb8bR1KJTkvuwoY0orcEdpwTXQvDoBGM5Rjmi1/FwM3OfMlaDYdHXlsLNGpzzru+Q60JQRsDimygHWpvZQzTZcgHibpvUyhHXhmPkV2TW4MH9qkgb99Xg== 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=/lpLtmxvvL8kAbHpcg9z48/oN3VQyKW6PUHIIwQBpUY=; b=ijJevtN+ymr/u59M8EG+Uj4wkkBxyGUVJ/rSmfPNAywQnyTQEyTn0wLgowcBwxTVRYEM/wdKO8JIUfS81bdu4ba7aUzzoGfzxZF3iWLoYuDNkEgvvDJ0M+O14lKTCLF8StgmKnVe0WxUjaVZ5Fl4b/OfAHYurDNu7oNlTx3LaCb/2xnfLy4bkGbioANemUQnyDMhfAxglMKRqeuZMBjUfekS3oL9ht31T16XStu8JXDyV4/JflGR8EU0Hgm53ymIFXa2ubOFl0fcG+XHDRHVHCbO3V/wTOjuLYvBlZ7d14z9Hilcg31EKgBVYqDdw72atYlmQRL0rHlFfH26RPlo4w== 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 (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=/lpLtmxvvL8kAbHpcg9z48/oN3VQyKW6PUHIIwQBpUY=; b=egIneNNgzZV0uGJzy85toZvICCOxSA2XbPqCllbtWM0ZoJFVzN5/a0voLjxOvkgdOVh4/xp86teK+B1kyUaD3930lhHBju0EJ6xe8q0ez7QWPXSUvtl8CyvaM+lxylaqlPbzu5MeZzRJwuAG8R2Tva5xFwrxOKe2H6C4rJTNsZGDG9T4IFgYPgc7XaRJYayHrgvIP/LCgAxRK9UmLLvjQmeXayVgS78Lb7wYT76jGZYlmmbLaFGE8j/MUdtElk4sym+lpjFmPQfFMujq+z91O1T53oYfsRmOEj3We2OfNQq9Y2c6QLvjscSsTeRMgJPqfdJuWxjJY17g0dy2rqxZwQ== Received: from BLAPR05CA0006.namprd05.prod.outlook.com (2603:10b6:208:36e::9) by DM4PR12MB7623.namprd12.prod.outlook.com (2603:10b6:8:108::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Tue, 9 Jul 2024 12:31:44 +0000 Received: from BN2PEPF000055DC.namprd21.prod.outlook.com (2603:10b6:208:36e:cafe::d4) by BLAPR05CA0006.outlook.office365.com (2603:10b6:208:36e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.20 via Frontend Transport; Tue, 9 Jul 2024 12:31:44 +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 BN2PEPF000055DC.mail.protection.outlook.com (10.167.245.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.1 via Frontend Transport; Tue, 9 Jul 2024 12:31:44 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) 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, 9 Jul 2024 05:31:16 -0700 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 9 Jul 2024 05:31:15 -0700 Received: from nvidia.com (10.127.8.12) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4 via Frontend Transport; Tue, 9 Jul 2024 05:31:11 -0700 From: Itamar Gozlan To: , , , , , , , , Dariusz Sosnowski , Bing Zhao , Ori Kam , Matan Azrad CC: Subject: [PATCH 1/8] net/mlx5/hws: set eswitch owner vhc ID valid accordingly Date: Tue, 9 Jul 2024 15:30:56 +0300 Message-ID: <20240709123103.2101902-2-igozlan@nvidia.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240709123103.2101902-1-igozlan@nvidia.com> References: <20240707102532.2045942-10-igozlan@nvidia.com> <20240709123103.2101902-1-igozlan@nvidia.com> MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF000055DC:EE_|DM4PR12MB7623:EE_ X-MS-Office365-Filtering-Correlation-Id: e2481077-14f6-4100-fdfc-08dca01317d1 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; ARA:13230040|82310400026|36860700013|1800799024|376014|921020; X-Microsoft-Antispam-Message-Info: 6UmzGdpxZvKbudthM0iCxuWUS6o9bU8N73l3rB24oA4vZU/eoGiOdhbg+4yioJXrtyKWJCqPFGOW+BJGUIs8fPtR/qF2xdA5hLd1urm99BBN66XJREJkDGt7o9Of/bgO0oJKQul3MTe/vgVmQO3GenkbX8lftPH15waCfesKH/I1kuLmjN3/mrGcdJ4ON5NK7G19M01/6QeCIjDHD9t/fwHZD2TzmoU/nsoh6uDKSGEiFZifKpbm4HK+aub9nL61f0s8BYST/x0zInvY/VUJHQ/jOc3V9f25cP0dc9nZ3LJbE5Clx+p47PCDHkRS5Qlo/aCudPP+Ec5p1JAYMT1ZBnNwLqOG6EXoWtA5rX6IjfFZZU4MWDixEiXP+yJ4e0jChyQ+8WjS1+sHDDLTzZoFLHhevTEnyCdKmhpFqXT9oK91aNMsHeLMvt2fkC66zXgkIacAbBrGPAtM8WgiQ//ehGCjrw5JykWsXGZDuT/P2Az//cBeUbG3pH1VHmoYlAosUoIBrR/aVlazVryDx6XIy/zSD5jH1zW283OvfEve1DUrp5o3GPY49nXE5/pbGO9XwowxtnJBmhaHB0zlTnI9Q+C/lHOTj/Zu2zaiPzw/uoWrfZwF55OCNWVGRrKuuCzxoMJyNjcKmfGW7EYkgx2VKNrslQ2etO90+mgCUCgmZ0pTVj29MZavHs50zKOjPnZ0nmLb14YopRBFsPV6zYBhDMOvOH+hFJhd6G3wVOb81RvGXRfhx9sJkPXUPK2LhPOToVLxO7/gdA+NCxkHZ41fo1UR8pPQJE0wilVquRL5w4RxdBSLG5eRuJxQ74cOM2gQQTxWaKzxvEtMGQyfILrjXyIbOzi4cZeir9qn5BUo+XTIkwP9LW6FJC/7NttL7jnv4ATjn7+7h9ta/OtdMtuop+r3h+WfkwqgN+uqnkFP9fz/xUt4u2CVng+OnzsgYmcF+4nEyftGwIyAOr5Fl7UW4v8vrSnUR2Nqqy9nWEFxkiSSupY+QILDmbY2TosEWuYNfXo+v08AZ1iNtHdVALWP2CcLYPislzqRMMWMX258Fq50UCmWFQJwcwwpL2UOdOhBOQkehJGw/qsyfdC6nazB6V+K1mDY3HyPbhlc4irTXy02pOizT4AgczDSdIT1h+mWsGfpmS5gHb4+6dO7WuwAw66WyHXLcp9ucgmOyohuijS9V+SLqVcaThFDWtpeCU90JDve9sHx2RwexU3ZaiEWefHn1DyYm1V+ViQSSlKKNIpuL55fQ9aLamSEsWIJBCdmV8wl5BBZp3jDEyEUvuZWRopBS0GF4H5PN16V6dTeeURHxEvZHwwLo0DfMi38vjdiCKi+HLL5C007Ik4sRji2f5Qdy/hFgR9qiDgg1m/2sa9m4rWfqskGny3WNBLb4n4SJZVzrejBYwPDy3dtccqz8kS7HVBb8eJBnj0w4Mcq8GByTzsNcFR9uoO4VxC/4hUvA8hs4+rpH2E9Dgo30vawjA== 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)(82310400026)(36860700013)(1800799024)(376014)(921020); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jul 2024 12:31:44.2197 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e2481077-14f6-4100-fdfc-08dca01317d1 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: BN2PEPF000055DC.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB7623 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: Erez Shitrit eswitch_owner_vhca_id_valid value should be set to 1 only on merged-eswitch device. Signed-off-by: Erez Shitrit Acked-by: Matan Azrad --- drivers/net/mlx5/hws/mlx5dr_action.c | 12 ++++++++++++ drivers/net/mlx5/hws/mlx5dr_cmd.c | 3 ++- drivers/net/mlx5/hws/mlx5dr_cmd.h | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c index 90f2f17bd0..03c3683f71 100644 --- a/drivers/net/mlx5/hws/mlx5dr_action.c +++ b/drivers/net/mlx5/hws/mlx5dr_action.c @@ -680,6 +680,8 @@ mlx5dr_action_fixup_stc_attr(struct mlx5dr_context *ctx, fixup_stc_attr->stc_offset = stc_attr->stc_offset; fixup_stc_attr->vport.esw_owner_vhca_id = ctx->caps->vhca_id; fixup_stc_attr->vport.vport_num = ctx->caps->eswitch_manager_vport_number; + fixup_stc_attr->vport.eswitch_owner_vhca_id_valid = + ctx->caps->merged_eswitch; use_fixup = true; } break; @@ -700,6 +702,8 @@ mlx5dr_action_fixup_stc_attr(struct mlx5dr_context *ctx, fixup_stc_attr->stc_offset = stc_attr->stc_offset; fixup_stc_attr->vport.vport_num = 0; fixup_stc_attr->vport.esw_owner_vhca_id = stc_attr->vport.esw_owner_vhca_id; + fixup_stc_attr->vport.eswitch_owner_vhca_id_valid = + ctx->caps->merged_eswitch; } use_fixup = true; break; @@ -1429,6 +1433,14 @@ static int mlx5dr_action_create_dest_vport_hws(struct mlx5dr_context *ctx, action->vport.vport_num = vport_caps.vport_num; action->vport.esw_owner_vhca_id = vport_caps.esw_owner_vhca_id; + if (!ctx->caps->merged_eswitch && + action->vport.esw_owner_vhca_id != ctx->caps->vhca_id) { + DR_LOG(ERR, "Not merged-eswitch (%d), not allowed to send to other vhca_id (%d)", + ctx->caps->vhca_id, action->vport.esw_owner_vhca_id); + rte_errno = ENOTSUP; + return rte_errno; + } + ret = mlx5dr_action_create_stcs(action, NULL); if (ret) { DR_LOG(ERR, "Failed creating stc for port %d", ib_port_num); diff --git a/drivers/net/mlx5/hws/mlx5dr_cmd.c b/drivers/net/mlx5/hws/mlx5dr_cmd.c index 666d678b42..72fc9e3d91 100644 --- a/drivers/net/mlx5/hws/mlx5dr_cmd.c +++ b/drivers/net/mlx5/hws/mlx5dr_cmd.c @@ -515,7 +515,8 @@ mlx5dr_cmd_stc_modify_set_stc_param(struct mlx5dr_cmd_stc_modify_attr *stc_attr, stc_attr->vport.vport_num); MLX5_SET(stc_ste_param_vport, stc_param, eswitch_owner_vhca_id, stc_attr->vport.esw_owner_vhca_id); - MLX5_SET(stc_ste_param_vport, stc_param, eswitch_owner_vhca_id_valid, 1); + MLX5_SET(stc_ste_param_vport, stc_param, eswitch_owner_vhca_id_valid, + stc_attr->vport.eswitch_owner_vhca_id_valid); break; case MLX5_IFC_STC_ACTION_TYPE_DROP: case MLX5_IFC_STC_ACTION_TYPE_NOP: diff --git a/drivers/net/mlx5/hws/mlx5dr_cmd.h b/drivers/net/mlx5/hws/mlx5dr_cmd.h index ea5d346d8e..54840ec445 100644 --- a/drivers/net/mlx5/hws/mlx5dr_cmd.h +++ b/drivers/net/mlx5/hws/mlx5dr_cmd.h @@ -133,6 +133,7 @@ struct mlx5dr_cmd_stc_modify_attr { struct { uint16_t vport_num; uint16_t esw_owner_vhca_id; + uint8_t eswitch_owner_vhca_id_valid; } vport; struct { struct mlx5dr_pool_chunk ste; From patchwork Tue Jul 9 12:30:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Itamar Gozlan X-Patchwork-Id: 142265 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4298E455E3; Tue, 9 Jul 2024 14:32:07 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9D4954270A; Tue, 9 Jul 2024 14:32:01 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2081.outbound.protection.outlook.com [40.107.93.81]) by mails.dpdk.org (Postfix) with ESMTP id 9E79F40ED3; Tue, 9 Jul 2024 14:31:59 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ivvKHGTuACjf8yVjvxEWZZA5jxzcBGMXNKbfttSLfka+ykaTcR+vncBohU8v7fCqe8hhPhVVgOxY9WFmZLfua9Mb2wr7/t6El2Mh0PEC3bVMNWuLuWysC7OczH/8QxfVpocwROXEUQKbf3Y1C0Jffl9ICXtV8XCXjNJojHGckXcaKBT2uJH/dbeUvbVSeTQDo+R8sefXLX71sn+SizJxyB2XLDHibkbP/C6mpCUyjjSTV6WrwHur1mKbbh6sWLIczIokn3bptIuLS8HSlFEQiQNafsKhg67PnRLQbxE7R2OvIzmJgW2b4bTm9O9j799tW88Me1n8PiJadn+9eu7lbw== 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=mQPMxZetFHL4jAQX41f2xDbeaeuHp7OBURe3PIcZ1Vo=; b=grA8wBfC5qWhfgQujHzTi3rrStUWWTE3vBzSmbq38oLFshQWwON2jQTuz4fPuqid1UnSJscMTgVnu80LlPGbXll+y2qBDdKH2w2HATUL2e/puDMY13ZS7pRG+DkV+lnVf86vZzvZLXXMkPYLmURSWJ5qy4db2ALxoLZ84cpzzZKC8PLx9JOYLke/BlxOjhjC8dFEm2ztsgAJLMEOIDwJmIKup8xlJ2qz41xDRo2ADM6g7Uma5aDclEshAL91L3asPCf12OpgGYAvQvX0j2BRS2pLvqu3GTMCxvduAXU4o8pe/Bgs5KoFnT0mvjHgYZW8aOCNpNj2kxBGn7KiHieZhQ== 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 (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=mQPMxZetFHL4jAQX41f2xDbeaeuHp7OBURe3PIcZ1Vo=; b=AJ7Bae67fA9sTX2U6EdpnbZ2sHJBrAr12Lp8KWtMPn09KquYJweryPn2w9Hvf/nCfnB3sK7Efbow3C0fOvvdVs3OiRRt3VgU5E9ISDaOzcj4nLfA3bgWypI1qnzrO+7qxLH3CyCKX7N6rhiMB/RFr+UX52VrGizPQJK3UseJ2TeSet6jZR/zvUfvWAcvryTSmOvj9cQDNc3RoXZzsBrYxuZmXtE8pPfcOwHpHk7SzjeYsHQ5GMAuCs3Hkjm4Mfjha//OVvxLsQp8xnjulrt/ZPnlxITMFlD8/r0idmVmO0KbQR99TL3m+Rbccwlm2x2MGMHfNS06rPHpmRyvLGZTOg== Received: from BL1P221CA0018.NAMP221.PROD.OUTLOOK.COM (2603:10b6:208:2c5::30) by IA1PR12MB6068.namprd12.prod.outlook.com (2603:10b6:208:3ec::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Tue, 9 Jul 2024 12:31:56 +0000 Received: from BL6PEPF0001AB52.namprd02.prod.outlook.com (2603:10b6:208:2c5:cafe::38) by BL1P221CA0018.outlook.office365.com (2603:10b6:208:2c5::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.36 via Frontend Transport; Tue, 9 Jul 2024 12:31:56 +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 BL6PEPF0001AB52.mail.protection.outlook.com (10.167.241.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.17 via Frontend Transport; Tue, 9 Jul 2024 12:31:56 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) 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.1544.4; Tue, 9 Jul 2024 05:31:20 -0700 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 9 Jul 2024 05:31:20 -0700 Received: from nvidia.com (10.127.8.12) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4 via Frontend Transport; Tue, 9 Jul 2024 05:31:16 -0700 From: Itamar Gozlan To: , , , , , , , , Dariusz Sosnowski , Bing Zhao , Ori Kam , Matan Azrad CC: , Subject: [PATCH 2/8] net/mlx5/hws: fix memory leak in modify header free Date: Tue, 9 Jul 2024 15:30:57 +0300 Message-ID: <20240709123103.2101902-3-igozlan@nvidia.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240709123103.2101902-1-igozlan@nvidia.com> References: <20240707102532.2045942-10-igozlan@nvidia.com> <20240709123103.2101902-1-igozlan@nvidia.com> MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB52:EE_|IA1PR12MB6068:EE_ X-MS-Office365-Filtering-Correlation-Id: 8f89e6f6-cd62-4907-04e7-08dca0131eea 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; ARA:13230040|376014|1800799024|36860700013|82310400026|921020; X-Microsoft-Antispam-Message-Info: IA5gtfgKddPaFJQUu/s+YPEBZXzGr60xp2OsjoTlRgMcdcMLy6i5KCA+wtkubMzD77wjTobgD4kSR5VCoaNMevUFdUwO3BsrXzPtI08I6Jhn19I3WDb0nLM1nUKlZLNh7LuW3JdHs75auAEX7zGjc5/vkKbhMrsYmE6Lyw2Cp1/PClmPmbJYX5VNxnxbotTEWJEZg11d/dggjeugUAY6e/PpoypdzSC0Aqr0YuFjp7a9+ILlVGCKWApJnWLz9ZHO6H8RoUfG23BV1kLk8JdwxJI/1uiFhCYkam8APJmxyLLTm3vZ/Mz/yWGEBYpSjRiAsoik43lzBvwnARzK6Gr4zOjcuOq7R+cJS+Aw3c7IEMMmrZqHOiIACBmu59kNzGK7r5VF/rFRjyvj3A6f6/Li46bhxwHXK1mvst3aZV7o6iNzWIP537AXxCX7aUM4MTyrBi3eRa3VwLRdYdpDJbH0OwEtBe2i9UuihbeXdaCmqoxud05JKu1Ur6JUVa5IEsO1LByH0eJgFOER9OypXGg7ZmI/FQSHpmxWHeujpVHHByAw4G71K2lMMpYQVdIyAPiMULUwy32ITxK6s+pVYfbf3qrro6RwvR4NBynKjaavb/CtLBczjSrDBh/By8yjCrR8bf2yNKkRGpxWbdPBaarobzyJHP/1NPCwwu5l8+weN8tH2AaRD3i+7FbScyT49Kt6a1u1v/jFLIHyHwRSNHU4G7ENXz4sTzEnc/Ff2sxp9xGRKIZjV6gHhGJlvwdo4vNOGMVW2BB68c09YE79zfXXNtIlW/cuncKYesM5TFOwnjJcevcEczwP7hIqC04z85qeF1AzqGU7Gu1LSYY81Ay2NkYiUdFhSv5mY3xW8SaKzeuwDWz9lj3HLpVKykNg0CXtpX+E2abZfBtwxSUNan1ltQzOzAgybrlozR45e7dfC5UIWkR9vqctfeGvqKCv3+Lfas3gqF2xhYFFfWEMMKvPIMtzM2+m1uRBf2oGhyAYSVEPr8Ji6okaAjr1h7n7yHJSlM/LwBF5+cLEPsJ7FTByP0xHdUbopZz5yu8Vi1wzP5cYJG1NtCi71JIBXfrQSqpMeTnVfWFMbtDDjInpdNFmVfZ3bNkQ2CdRsVfJijwga82JMdfhLeD5ct0r3GyU1w22H/UaFTSBAI8tNQU2X//KEF3KQxp8vP+e5KqC+xa7jdBDoC7qgKYSFgaf0e63KmfzTVdbLZ5h8wLkCY1aTIR+pCNIiEnACBm9cq3UeLQ0lQxEWpF/OTC21e3GB0OGIUliuNjQLkG5+1Nrc0kOzkhZhC6KUOgP27VKIqKb0wBbv3aXf7iZ/yk9oYCo7Kqu8HrGWNdsE114jeCgxbMfKxppXlFBomT5SQhb7ngrNMkEzK1Akf5q3EJPMS0IANBcxP7MOXoGBRXJ750aLGNlQbsYi2bdEkoJE/GTvN5FtOkhHFwye0Haam4XdC1uTV8XRbi4Tu2By8MxbFTPaAGOaRDErA== 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:(13230040)(376014)(1800799024)(36860700013)(82310400026)(921020); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jul 2024 12:31:56.1212 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8f89e6f6-cd62-4907-04e7-08dca0131eea 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: BL6PEPF0001AB52.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6068 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: Erez Shitrit When creating action from type MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2 we use modify-header object, we support few of that type at the same time over this action depends on the number of headers. Now when destroying the modify-header object we run over the number_of_patterns, this variable was not set in the creation of that action. Fixes: 3a6c50215c07 ("net/mlx5/hws: support multi-pattern") Cc: valex@nvidia.com Cc: stable@dpdk.org Signed-off-by: Erez Shitrit Acked-by: Matan Azrad --- drivers/net/mlx5/hws/mlx5dr_action.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c index 03c3683f71..b90f18df8a 100644 --- a/drivers/net/mlx5/hws/mlx5dr_action.c +++ b/drivers/net/mlx5/hws/mlx5dr_action.c @@ -1820,6 +1820,7 @@ mlx5dr_action_handle_tunnel_l3_to_l2(struct mlx5dr_action *action, action[i].modify_header.max_num_of_actions = num_of_actions; action[i].modify_header.num_of_actions = num_of_actions; + action[i].modify_header.num_of_patterns = num_of_hdrs; action[i].modify_header.arg_obj = arg_obj; action[i].modify_header.pat_obj = pat_obj; action[i].modify_header.require_reparse = From patchwork Tue Jul 9 12:30:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Itamar Gozlan X-Patchwork-Id: 142266 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 91AB0455E3; Tue, 9 Jul 2024 14:32:17 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 309F942D45; Tue, 9 Jul 2024 14:32:03 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2086.outbound.protection.outlook.com [40.107.220.86]) by mails.dpdk.org (Postfix) with ESMTP id 11472427C7; Tue, 9 Jul 2024 14:32:02 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a2vUe6GW3f5u4iTDGBbFL7tR+h1FbrXTK5pAlCPBSf9arcjFwiHhZPUI+rE+ZpXvPRNT3Hv8F4dFjUr5XDNo0fGX6IpHZxccuzbCM+SJi2ZXtn7zoqpkHmtMyGDmQ2DBs91Kk/YJqCHi9IhFuqlyfex+Xra8x3jMYJsNiq8fYcno/AIsBGYxc5zFPT2PV0PRCOUrQgNKDyHK6LrnAd5jwFXfWwOuw8A408/2ZWbr6RhOd3SE7xIHJcAh+zG7+DHhi6LjEBG+ekmOUPuIklZYyjhDqIXryoUBENVycz0H90wL/L3KIwMkv04lpjfaV3/7cfnJLrrnw9OlRnwaHtM/8g== 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=DTI1rpiSfVQeT9hxOukXF+R4Sdvk3wayOd4+BDnriZI=; b=decVefTRxVsDVwAk93vUuoZkLhB2mJvdcrBkuXt4+ds7ytVmdCBr0XRJmTEuyFe6BV6PsLHpWXczXxLu5DG9edEOpgEDs1RqN7kcJiB3MgmaSvpGnTD3XQLnucnORwp1M/b6WtIYhNQY+UiqQ7S1YQgENS62n2qDcCi3p0YiJqfyEKGI63gi9I0XeOPZLFDNQ0HvdLNFiqUeWIYLErNX/XPhW/yN7DtiBwrOH1vr5msCm0Z/3aBjvRrUQE+w+8DvE+hyO2StUYagpgFkhzRlLAW+IW65p3qLjuwDkjfKYtIvOTUGoIodgxHpX4NMrtDlQWO8MqJu4Xiof/ZbsQkMdg== 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 (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=DTI1rpiSfVQeT9hxOukXF+R4Sdvk3wayOd4+BDnriZI=; b=Zr3uRkwBzcoxY0jSIUjHpVkJyXzS1V35NxTaATmoKJ8NXYAtR3kcwgOOx0byfYrHdwsP3RY1ll/CQbqY7WBCz2mCqxShnvHrFOrmcIzR9hF3UQKmqXMojNQqbzthOmN9yekqnJ5fHymIl/eXd5qx3hCjkxofw+7crkpv5WZyOxX3EKBKwrgVkQsg9b0wn0KvGXxcdW81f/Dx2NJSCd9g0/lKhqI3Vvsncd5fL41pCgZTOu/QFE8P8an3Ok53KUZTM0hi9DbagrponC4dn8dXzMKogfiXuiPDgng4GKieg88RXnRHZ0/62zVn0rxXEr8XTQ0g4cchbz6ZUDVSKLI4cQ== Received: from BL1P221CA0007.NAMP221.PROD.OUTLOOK.COM (2603:10b6:208:2c5::33) by DS0PR12MB8788.namprd12.prod.outlook.com (2603:10b6:8:14f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Tue, 9 Jul 2024 12:31:58 +0000 Received: from BN2PEPF000055DE.namprd21.prod.outlook.com (2603:10b6:208:2c5:cafe::2e) by BL1P221CA0007.outlook.office365.com (2603:10b6:208:2c5::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.36 via Frontend Transport; Tue, 9 Jul 2024 12:31:58 +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 BN2PEPF000055DE.mail.protection.outlook.com (10.167.245.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.1 via Frontend Transport; Tue, 9 Jul 2024 12:31:58 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) 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, 9 Jul 2024 05:31:25 -0700 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 9 Jul 2024 05:31:25 -0700 Received: from nvidia.com (10.127.8.12) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4 via Frontend Transport; Tue, 9 Jul 2024 05:31:21 -0700 From: Itamar Gozlan To: , , , , , , , , Dariusz Sosnowski , Bing Zhao , Ori Kam , Matan Azrad CC: , Subject: [PATCH 3/8] net/mlx5/hws: strictly range templates check fix Date: Tue, 9 Jul 2024 15:30:58 +0300 Message-ID: <20240709123103.2101902-4-igozlan@nvidia.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240709123103.2101902-1-igozlan@nvidia.com> References: <20240707102532.2045942-10-igozlan@nvidia.com> <20240709123103.2101902-1-igozlan@nvidia.com> MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF000055DE:EE_|DS0PR12MB8788:EE_ X-MS-Office365-Filtering-Correlation-Id: 9fd7de52-f55e-42ad-1b04-08dca013200d 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; ARA:13230040|376014|1800799024|36860700013|82310400026|921020; X-Microsoft-Antispam-Message-Info: /0r3frb11J3g8es69jJiZXc8wS8NXaqd3dQ7VK4mQ71NSlXCn0Ee4eY+cEa6Lj4qVnA8RsvzWbIIC9Rjt2lc0LoF0pIC7RRlIr+hCLBJU2r6wTdmRBUM9OEgfPBKWqrYBrloGgd9y97BZUjmVDgxxmRXb9fPluJPYNL2YFrdk1zlKHoLNtsFIhO9vcfZ+yUzY1sxYkWD92vrgrnSlHC0ZpR1BxU6n6YNszD29oL1bJBdPS9V/W17a2W0EhRa1IDQ6XRhfOLMlbvoG0spkzCCePq3bmpT3rzkozVQzfirnP1mU54h1+EpPJgzghAF4IeoilLFSAe0KUsKfvvVvaG+14qLSmjJcpztXQmYi9RKC0RvW1K70Z8DOnlw1kh+d/sg2g/by1NdVFpVjnKUpCc8pcAXWKM92b/tmvhO6BohIK7n7pE+8KzsialyNO56SjbcgyVhx44BF0GPVVTQRn3ddi78xZ1u5XDcygp8mWy4Wy+2v3hpH3DnNgdbdLBH7hJhZ9xrtx96OYs6akf5DotEHJ+GCRpW6QsT3MONoJR3mOl075lOkHNPGgMwawoCA3d0eHasR0vxDTxYTwE7csJO2bmqTohZz/OUpgtD3oHUUXRiabtEE+cLgIHQicBjnKkj1lX4qchB8ERzGUOaSdsoq/U+5orKLkngof13w4ReML/lvZabSww0pg07HZkkE4qSVB6XbbFo2OyzV1+eA/+hIixPAs7QBA8S67gSNZi1Sj/IvQnclDAm+PT1BU3cYhBE++z54omuaPvwPA1wNllQW29APCLMPzeX6fAnE2ZyGlIdn872I7d9c4i6i9biPQQ1qVnEkoNpSAptp7Jg2Tx0xByJV4DUY0pFXccAPC1yWIJdLk8A040cvUCrxOcQMyZ0q43NaV8AI8Cr4EQb+YhUy9dgCM4ft1AbguoqNNMRUOHgeu6659/zpcd3WT2zqpJvONGKgN+07B//RC8p6LyoDoU3VcS+DH3W/XMtDgN7ajPr2nn/0z1gCRoyX/xcIXdZdbliWfqId08qEUPHLy2Sqh9PSB/HDpFSm4AJm15FOK4kYj0JiRIndHvjkOb/tRKbn1NI3zlkQBC+C3YcxKwEa/J9jFrVQT/7EEXdgJ/AyTECbOepMrko66Zlimw/jT5s7m+n021ZOhdjefWlr1SzXANY7HvaNAuyjU4lGoj4bBymj507s+2JAapJNteH2xyHGKnPbCD7gPON4ZtW1yGVj1MLLNlieBT63jxygY3sIkD5nb13SIhUutnabRSibhzQY+oBBHYF0Qzcl3TJ1mkx0tyj1PFJT63kUZFS+Ie7+3y0czyGOYOm1dkzvyOzCYrrMr1qbglR7Gz9qKPNX7MOehNLeXx9WwfKyISd15T9K5mbSoPNAxwrJ/WHLjK97jBAm877euZvbHtopGAiv0W6WrR0FtouudCWdMSmdYPbaFs7NdE8JzhIYh9BJ0G3tp95L2WqZyBr06VtpcqjIP05Zg== 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)(1800799024)(36860700013)(82310400026)(921020); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jul 2024 12:31:58.0289 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9fd7de52-f55e-42ad-1b04-08dca013200d 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: BN2PEPF000055DE.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8788 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 Using range and non range templates is not allowed, and in HWS there is a check that enforce that limitation with constantly check that, in a loop, if the current template defined as range, the last one should also be defined as range. But, in the case where there are two templates in the following order: (1) template with range, and (2) template without range. The existing checks will not cover this case. This commit fixes that hole by maintain the invariant that if a template without a range exist, all the previous match template are also. Fixes: 9732ffe13bd6 ("net/mlx5/hws: add range definer creation") Cc: valex@nvidia.com Cc: stable@dpdk.org Signed-off-by: Itamar Gozlan Acked-by: Matan Azrad --- drivers/net/mlx5/hws/mlx5dr_definer.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/mlx5/hws/mlx5dr_definer.c b/drivers/net/mlx5/hws/mlx5dr_definer.c index 9ebda9267d..51a3f7be4b 100644 --- a/drivers/net/mlx5/hws/mlx5dr_definer.c +++ b/drivers/net/mlx5/hws/mlx5dr_definer.c @@ -4041,15 +4041,18 @@ mlx5dr_definer_matcher_range_init(struct mlx5dr_context *ctx, /* Create optional range definers */ for (i = 0; i < matcher->num_of_mt; i++) { - if (!mt[i].fcr_sz) - continue; - /* All must use range if requested */ - if (i && !mt[i - 1].range_definer) { + bool is_range = !!mt[i].fcr_sz; + bool has_range = matcher->flags & MLX5DR_MATCHER_FLAGS_RANGE_DEFINER; + + if (i && ((is_range && !has_range) || (!is_range && has_range))) { DR_LOG(ERR, "Using range and non range templates is not allowed"); goto free_definers; } + if (!mt[i].fcr_sz) + continue; + matcher->flags |= MLX5DR_MATCHER_FLAGS_RANGE_DEFINER; /* Create definer without fcr binding, already binded */ mt[i].range_definer = mlx5dr_definer_alloc(ctx, From patchwork Tue Jul 9 12:30:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Itamar Gozlan X-Patchwork-Id: 142267 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C5100455E3; Tue, 9 Jul 2024 14:32:27 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6080042D9F; Tue, 9 Jul 2024 14:32:08 +0200 (CEST) Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2077.outbound.protection.outlook.com [40.107.95.77]) by mails.dpdk.org (Postfix) with ESMTP id 96764427D9; Tue, 9 Jul 2024 14:32:06 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PN0frAswZoaKteZnNfso1fxakYGCWO0rwiR9XtpLlE01CyVkBGtWBM08OlyZI0oBwgE8aqp6pAQuCEn2R1JAqIB2oJqw0kv8etfcWNWi3I/VhuLtomLwWEfh84OoNQaqUBIhxDKgr+M+TDgG62g66z5vub9zwlgFJYNkQk/vBxND3m66OEFIfFK80FCBVXhq7DkcjFaoMokW6x6aFHJNl4g1fJmlnKiiIuchkstuC8K7uuew+OHFdODjSjZXyZk4TETBhClmrvhwPIIFD4vvxIQ/200voraEfmhA43zkqiooEaBH4iEvIXlxuqYp2kZeBQLJa0UCy3MTsuzWmFlMHQ== 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=dwxrYioBUkCKgYAbwE+NRB1M1s97xu84WR6YAID/Bvw=; b=dhY4bNx8uHonJylPDFHT12nQV+E9Sr4NPFWjY2CMwvxAjqcrqa11Rkiu3bCs4LbXIh+CH0OF8xPZiTTC4+wC/tsjv+Ph+tdQxfskMeWFj6m2zNDNdqLGAvAVQUIgT2w8r7WXsqxVDztBIHu6Cd0pui+FKzkBAIW3dhdOE60xnh29JTfc5UNiqlWLWFg36KZfMEl3SJobcLXGUAni3EkzJU1f330SIH3DANzRMhn4q3duMhkuK0AHIZgo5XaQXRDUwSz3eOiGoDzzrxuznTwV7XjKoLD1xDR+qSiC+eauvQhmmfPhNwe+ZqLgKjrgyvr+S0QESqEiR66eoxJUPSYA1w== 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 (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=dwxrYioBUkCKgYAbwE+NRB1M1s97xu84WR6YAID/Bvw=; b=Nld5gOKksqE/tjqihZN9bwoMmCU70zUrg4q8yzYQPgXsItUeRHLBAfwb1msSVVyXI6Qcq0sINdF7x7GCD5fZpqs21lZigwP4+H4Zdz1Jur0Y3Agu76abuFH9+u+gzjyuu5WibICgJkDfAudxY9nDvuf6XdzV695dJwn4vBrzc5pi64mGRoNNeoxzTwFTykSrna6kyDvWfo0wSC9qFwsfl0YItGssWKspQ3/90raNWssG+mYJkdUOc+i9MpnQpP3+jCs1s4IjOd4PN40Qdk1yHafJ/c4t0eg0wxEWCJAeECuKNTdgkt4xDTQ56Orc3Y4Cb7gC+TTd6oO1bV33dnkMFA== Received: from BL1P221CA0013.NAMP221.PROD.OUTLOOK.COM (2603:10b6:208:2c5::11) by IA1PR12MB6090.namprd12.prod.outlook.com (2603:10b6:208:3ee::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.36; Tue, 9 Jul 2024 12:32:03 +0000 Received: from BN2PEPF000055DE.namprd21.prod.outlook.com (2603:10b6:208:2c5:cafe::17) by BL1P221CA0013.outlook.office365.com (2603:10b6:208:2c5::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.36 via Frontend Transport; Tue, 9 Jul 2024 12:32:02 +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 BN2PEPF000055DE.mail.protection.outlook.com (10.167.245.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.1 via Frontend Transport; Tue, 9 Jul 2024 12:32:02 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) 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, 9 Jul 2024 05:31:30 -0700 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 9 Jul 2024 05:31:29 -0700 Received: from nvidia.com (10.127.8.12) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4 via Frontend Transport; Tue, 9 Jul 2024 05:31:25 -0700 From: Itamar Gozlan To: , , , , , , , , Dariusz Sosnowski , Bing Zhao , Ori Kam , Matan Azrad CC: , Subject: [PATCH 4/8] net/mlx5/hws: fix deletion of action vport Date: Tue, 9 Jul 2024 15:30:59 +0300 Message-ID: <20240709123103.2101902-5-igozlan@nvidia.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240709123103.2101902-1-igozlan@nvidia.com> References: <20240707102532.2045942-10-igozlan@nvidia.com> <20240709123103.2101902-1-igozlan@nvidia.com> MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF000055DE:EE_|IA1PR12MB6090:EE_ X-MS-Office365-Filtering-Correlation-Id: 55b1dc88-423e-47c1-d637-08dca01322ce 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; ARA:13230040|376014|1800799024|82310400026|36860700013|921020; X-Microsoft-Antispam-Message-Info: yoZO3iBZ4bJmZc1Qx3Rfqq3LAAEYK1zF+xuNhHJbPllyVQEzB53aftRM3dgYMDlzeBQvg07v2XT24cuE3GLeAY2SWJ3xfRRNThp+DVJXlEaviD4iW1t+GoqOutotul+wXsQ4va7rTUGwhS9tNC6YeeV2+0OPqtVFvpLUR802ycyFis1KApEUTYB/9EwKvC0Y//ENTtkx/zFEon9ZnTpmCoukPuXbpGTZyvATqMIN802d92ILI5WzNWPbnAcmT+w5O+idVTgUFSWy58wzykBrJ44Ib0m5hK1Eq1MXwBmgVx2wiut+9j7VHqZlHs2rp6SN1ve/jsV0o1whm7WIIEbKFt5cadVZjVM8s0xiJGgLMaGZOIqIxBo/CGOrMaRiSDcFJHCaVI/H5o4GwbNtbCfK4WJB+bzcnsT1EjLtfdt6VEVmlVZZHqXJC6TaxuX/9x2luLDoMuRp5dm61F0cUt7jdhOJdU7Ljyvfw3iu4LyqCUsZ8OGpwvwyWBMjoztu7qYEv6Po7AEEKELisBQHnVmcx1ui3e5QLV83FzdihJ/vyrmV2qRomZO/xyq9aQNxEwTE8SEJOc4K3MmxBVAyD4dMpzKLJ7UfNY0Cusbi0+QPfv/s7rXaS+bjLR8keuyi/1D3BBEzCWIGoChW023aq0E3WsOvsXjxv25UkSJO2CRqBMrIqkEcqC4MTwQxXsfADqolCIe3LqT9Jn85kCpoJe3o373QZv0bc3zsRNf3yBp63dOyvLE/YpjeEMDePPerxFnlo4z1ZC2b4uHERFrIG5GWdNRXCUMF3sYVjPqd6hwftNSesRkiAGexw/dMBgzEE71CjWyLmfJRrZvmtUTyvpGfoqrKV6g6Tv00yHlGSxrYObSCJIn7oOBiKRdmgzqQtP/G+nfJzxtBLLVjZ/nlsvhq1vR5ykVl0E0zdr1VYuOaaGDtZfG0OmHuv/iyd3cJRxUHfPReDqjNlMCyawI7BnEo92kGRyvIXOi3Vm9Qm/UFTXJEpSqtXuS6fuQe2NX4ihn0mFWL5ZjJdSKuY+bItIl2fuvtP07PMZvPkjOkYrMsbUVlz49RJwwC3ovVliTHr11O47eiX2CtAJQJhTp/uFB25aBIFImF2khg4kX5CoX70IkVLhyODYH0oTflDMypKmqrrIo/AIOTRBmMxWJ1HwAhDtghyJIJ3zVFZuD/K/igPTTJHtoSX0Y7TNwqyjBhehZ/NqpEBKhRN6MyqlBzkLfPzhXhp2+DHSW8wqVfRpa3QAntEELtpYLrAl7Y1suLMMTCaU8iQ8DqvrTTQjCM8DkMvxiGLJIslcS884uHKEELpF9LB2Kn5BOYB/APcPgPN58Si26+88cjeeob2ZhkL3TjriiiQlkQnJU025ZiRkUcB+ovtV7YzDvevvFhDXOHYXkWGaFGnbcXOuKn0/jGENqDO2txt8o3lj82fVu5Z0QBpA6TAppE9n/S4erz5K0/24Gn3knW5zBOSlkuh4tFC0TJbQ== 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)(1800799024)(82310400026)(36860700013)(921020); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jul 2024 12:32:02.6539 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 55b1dc88-423e-47c1-d637-08dca01322ce 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: BN2PEPF000055DE.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6090 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: Erez Shitrit No more ignoring this action while destroying it. Fixes: f8c8a6d8440d ("net/mlx5/hws: add action object") Cc: erezsh@nvidia.com Cc: stable@dpdk.org Signed-off-by: Erez Shitrit Acked-by: Matan Azrad --- drivers/net/mlx5/hws/mlx5dr_action.c | 4 ++++ drivers/net/mlx5/hws/mlx5dr_cmd.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c index b90f18df8a..0d90280a7d 100644 --- a/drivers/net/mlx5/hws/mlx5dr_action.c +++ b/drivers/net/mlx5/hws/mlx5dr_action.c @@ -2968,6 +2968,7 @@ static void mlx5dr_action_destroy_hws(struct mlx5dr_action *action) case MLX5DR_ACTION_TYP_ASO_CT: case MLX5DR_ACTION_TYP_PUSH_VLAN: case MLX5DR_ACTION_TYP_REMOVE_HEADER: + case MLX5DR_ACTION_TYP_VPORT: mlx5dr_action_destroy_stcs(action); break; case MLX5DR_ACTION_TYP_DEST_ROOT: @@ -3027,6 +3028,9 @@ static void mlx5dr_action_destroy_hws(struct mlx5dr_action *action) break; case MLX5DR_ACTION_TYP_LAST: break; + default: + DR_LOG(ERR, "Not supported action type: %d", action->type); + assert(false); } } diff --git a/drivers/net/mlx5/hws/mlx5dr_cmd.c b/drivers/net/mlx5/hws/mlx5dr_cmd.c index 72fc9e3d91..a4f778a8a4 100644 --- a/drivers/net/mlx5/hws/mlx5dr_cmd.c +++ b/drivers/net/mlx5/hws/mlx5dr_cmd.c @@ -1033,7 +1033,8 @@ int mlx5dr_cmd_generate_wqe(struct ibv_context *ctx, ret = mlx5_glue->devx_general_cmd(ctx, in, sizeof(in), out, sizeof(out)); if (ret) { - DR_LOG(ERR, "Failed to write GTA WQE using FW"); + DR_LOG(ERR, "Failed to write GTA WQE using FW (syndrome: %#x)", + mlx5dr_cmd_get_syndrome(out)); rte_errno = errno; return rte_errno; } From patchwork Tue Jul 9 12:31:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Itamar Gozlan X-Patchwork-Id: 142268 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BF07B455E3; Tue, 9 Jul 2024 14:32:40 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C6C5F410FD; Tue, 9 Jul 2024 14:32:18 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2058.outbound.protection.outlook.com [40.107.223.58]) by mails.dpdk.org (Postfix) with ESMTP id 4ABD842D7B; Tue, 9 Jul 2024 14:32:17 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MuFlrJZ2NIjo+UTSGZTuZaByOwQLgu3F6deMiA2n9vW+43dllboqfZVOYTBSV9dLaggiZA+QG5Dh6adEyZFc2cCfZhoniOu5rEWa+oorgZgCEFrCIO5kwtlSp4nLq7M56WKRTq5tEPH7Em/rt1SEsGPnsn8/5Pv/6OWw2aQkPXzEPDnPU/JRJzfxIkfpK0arNrjDa/J7oXfTN/IoYiLFsCE8EOdvOfecT1Ev0qd9BS/cPV24lEBNOF5VJWaGti8FY7bdRufnm4EwrA8mbXZHPVU5MwMKsqrKyfXIcmXJpgdU/RCJzGdpzD1Wm51AP6NEUTOlUh4Ql2xq4FCAbMv9HA== 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=lh0JzjEswFsxkTTE/KqualtgXsT9NXs9lNmZKbgrwxs=; b=J7AzkxoAd2eGx0ET4QjHzErN9M8LoPJlwBxu/t11FcyECls4wHj4d3Y7eZbfWPdE2FtFiczXwA/fO9dapB2tkW0rqCU6KDPKGemw9QoqmkRN9gZWemZmaLiFWWPwD2feDu4zXCYd3y3Bley4R7V8EmeOyJ+SeEVFMyaFKgb0dW0dUBE/xsgeM5aUPrCd/nA0npO0l6DCLc1k7QgEPYX8pgsT5eK8sj/RwtV1YGESGLlthXok2AaUqsHITn69tU1lQhcqgBLNGBrSn4JMyfeu3Qpoc9HzeaPd6kYVxALQdfmRYYngRNWKOKdksvkCdzpJXvRDw04WE2HXYHlCJi6iOw== 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 (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=lh0JzjEswFsxkTTE/KqualtgXsT9NXs9lNmZKbgrwxs=; b=RsSouAZMPN7LmHrrhxV7DR9hlIXtpTZ/tW/8oOecTjezn8qMc9284hbC1nVHX7YvEMLhFpy0qNVraoAuWj43bFvIKcOuG28FdMS0roxUj9Tfp83TAA0DjagprNHr+mgJjuJIoH8PuBVrBCwMimz2nEuZTDz/c4qucjGHiLVCVv9zlsMZ547OHwSxJHanvnuzPVZ0y1Hml2ozECNBSA3MYJS95lOHUtXa0d8J5EOCcaacY/gBFcc4MhPvvHk3W6GRV2cox/rExUfyDuzx1ulKeY2rIzodElSH03Yj12a6tQ+7+uXDHl1Ed9+ihlYOuBDZuFb1UXPNEMyo7hJhzLSGrQ== Received: from BL0PR01CA0005.prod.exchangelabs.com (2603:10b6:208:71::18) by DS7PR12MB5839.namprd12.prod.outlook.com (2603:10b6:8:7a::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Tue, 9 Jul 2024 12:32:09 +0000 Received: from BL6PEPF0001AB59.namprd02.prod.outlook.com (2603:10b6:208:71:cafe::12) by BL0PR01CA0005.outlook.office365.com (2603:10b6:208:71::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.36 via Frontend Transport; Tue, 9 Jul 2024 12:32:09 +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 BL6PEPF0001AB59.mail.protection.outlook.com (10.167.241.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.17 via Frontend Transport; Tue, 9 Jul 2024 12:32:09 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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.1544.4; Tue, 9 Jul 2024 05:31:35 -0700 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 9 Jul 2024 05:31:34 -0700 Received: from nvidia.com (10.127.8.12) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4 via Frontend Transport; Tue, 9 Jul 2024 05:31:30 -0700 From: Itamar Gozlan To: , , , , , , , , Dariusz Sosnowski , Bing Zhao , Ori Kam , Matan Azrad CC: , Subject: [PATCH 5/8] net/mlx5/hws: fix incorrect port ID on root item convert Date: Tue, 9 Jul 2024 15:31:00 +0300 Message-ID: <20240709123103.2101902-6-igozlan@nvidia.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240709123103.2101902-1-igozlan@nvidia.com> References: <20240707102532.2045942-10-igozlan@nvidia.com> <20240709123103.2101902-1-igozlan@nvidia.com> MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB59:EE_|DS7PR12MB5839:EE_ X-MS-Office365-Filtering-Correlation-Id: 6aae3939-0e51-42d2-19ff-08dca01326a6 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; ARA:13230040|376014|1800799024|36860700013|82310400026|921020; X-Microsoft-Antispam-Message-Info: 6k8fgjFt248OVNr15qbXNrEOQFk+ukroJnM6pbn5sTho/JFlnTCVtfuiY+iQkQ5vKrr0BMDYUFPOdjKujH8GApxEC4+WktxJ4XdhooGzrsz8K/7jW95uT2V8Cy4jB5jQ3Sauh2fXc2ccGwE8MuB6C5g57W/go8tq4vjcnYnxBrfDcHQoWbkT3A9cRcoW/8NMhGNl+tFKpRDE8rIls3m038p7HNEW8T53pdRSI1slOKVfxwkrb2bYBTlZFQxl8c2gGd6wpVIfrR23/46LPnlpJ4TiCciZtQGGrJI220OvPR8pU/kdqlraasKokS5VY0NiZJPKYuhTziFaxUuUhjcXKLV1Y76OKG7gx3hVXDL1/oWvdB1gHuOntx4ak/5vHvS+052cJF/Z/ghhoxt8n11nrS7Y2TCVRgb+87zvkGtu32UW2cV67/l3ZYBbcMzQuMF1gUt4wBONEWOPZPfVw+6F6aJmJKJdUlh2FpH2b22SwSfcIcvxPJvZLurB1x2XjX8YBm8Az1IaTBGOceF4U+WAO0oSL18MQfGU9YcDU1UtLfGlABzy9ZaNg0edgen8JnqemU2zhEdrZn54W49MSoTYi6jVLGWAJChPOv7hMXNZlRL9Ey2yOMqXJJHrwgaiqA9fooBKkFFT8V9/cLfKznVRICS5kkyKcB3vGBieFCJht7jA1Okw2DGMQOtOX6fuRU0PzFtsF1roLjAKfOVPHLnrs21yCTp0JKNQuU8lJh2N1g3CQ10/ioh7n4y3QArGNYv/gji5o/3wwCY032+7aEudhnl575cY/nHbcRl6JJGvJmIrbqYpZ56C1eGMry+gBRlYyOdCuBUM8kUo3Z+6mwcD4dhSo001mHQUNqbOjx6yrZ+Jy8FU99xCQheBxIypam3rqLugTKoX5Ol+sU+dnAMJuWxn4y/H/5tub0+yrxIxuovAWvm+NiJo/DaH7gzt9NMeN7z62fcWrZtG/gTHe73KCHR0kdgzqwSoWbQg+0K+4dP4oF1YL932SnoOpXf6f0OPyfAoXSfTJ1tgCNCcnlFYyTpP3TnvgtFa3LmfgHqsiX5rdBr37d0Sy4sJx9491dIdOc/D3GM+J3JkZRyr/jgUmJOqkkrlBaBw0JrsRIEwjl5YeHZ8zzdwDMWEKfH72k94O8PugsnSRkuMFSr6E+bo3kSX6xO5DO8RsXgDqPvQXTV3uLhOTtVfbiHcc2QWdLVkpXceVTl3XGHsdwV22lcHE/UIvZNe2ab5SAhJFaKMprvLOWG8byN0L8Voo96XMBTwdybNmOc6gYcOCnIvc2IpcQFwWtyB1o4p697j1+b/SSloWo+YEUwE1H/rPglVE8hLWgUg15XomJjaaC37GcNA4/NURjA+LbzWcp5lTIfJza3NzTMaYJVYklTn4+cpQtc87knAS25PzaBDzA06J0X41HEzbmL31fPJxfQiOrZqKkmxtba5BveRjDbC5CafGqVN 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:(13230040)(376014)(1800799024)(36860700013)(82310400026)(921020); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jul 2024 12:32:09.0979 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6aae3939-0e51-42d2-19ff-08dca01326a6 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: BL6PEPF0001AB59.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5839 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: Alex Vesker When calling item convert function we need to pass the port_id in the attributes. This value should be passed not only for cases that match on PORT related items, to resolve we will always pass it. Fixes: 572fe9ef2f46 ("net/mlx5/hws: fix port ID for root table") Cc: erezsh@nvidia.com Cc: stable@dpdk.org Signed-off-by: Alex Vesker Acked-by: Matan Azrad --- drivers/net/mlx5/hws/mlx5dr_matcher.c | 20 +++++--------------- drivers/net/mlx5/hws/mlx5dr_rule.c | 22 ++++++---------------- 2 files changed, 11 insertions(+), 31 deletions(-) diff --git a/drivers/net/mlx5/hws/mlx5dr_matcher.c b/drivers/net/mlx5/hws/mlx5dr_matcher.c index 6a939eb031..dfa2cd435c 100644 --- a/drivers/net/mlx5/hws/mlx5dr_matcher.c +++ b/drivers/net/mlx5/hws/mlx5dr_matcher.c @@ -1231,7 +1231,6 @@ static int mlx5dr_matcher_init_root(struct mlx5dr_matcher *matcher) struct mlx5dv_flow_match_parameters *mask; struct mlx5_flow_attr flow_attr = {0}; struct rte_flow_error rte_error; - struct rte_flow_item *item; uint8_t match_criteria; int ret; @@ -1260,20 +1259,11 @@ static int mlx5dr_matcher_init_root(struct mlx5dr_matcher *matcher) return rte_errno; } - /* We need the port id in case of matching representor */ - item = matcher->mt[0].items; - while (item->type != RTE_FLOW_ITEM_TYPE_END) { - if (item->type == RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR || - item->type == RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT) { - ret = flow_hw_get_port_id_from_ctx(ctx, &flow_attr.port_id); - if (ret) { - DR_LOG(ERR, "Failed to get port id for dev %s", - ctx->ibv_ctx->device->name); - rte_errno = EINVAL; - return rte_errno; - } - } - ++item; + ret = flow_hw_get_port_id_from_ctx(ctx, &flow_attr.port_id); + if (ret) { + DR_LOG(ERR, "Failed to get port id for dev %s", ctx->ibv_ctx->device->name); + rte_errno = EINVAL; + return rte_errno; } mask = simple_calloc(1, MLX5_ST_SZ_BYTES(fte_match_param) + diff --git a/drivers/net/mlx5/hws/mlx5dr_rule.c b/drivers/net/mlx5/hws/mlx5dr_rule.c index 06d8e66f63..1edb7eac74 100644 --- a/drivers/net/mlx5/hws/mlx5dr_rule.c +++ b/drivers/net/mlx5/hws/mlx5dr_rule.c @@ -694,29 +694,19 @@ int mlx5dr_rule_create_root_no_comp(struct mlx5dr_rule *rule, struct mlx5dr_rule_action rule_actions[]) { struct mlx5dv_flow_matcher *dv_matcher = rule->matcher->dv_matcher; + struct mlx5dr_context *ctx = rule->matcher->tbl->ctx; struct mlx5dv_flow_match_parameters *value; struct mlx5_flow_attr flow_attr = {0}; struct mlx5dv_flow_action_attr *attr; - const struct rte_flow_item *cur_item; struct rte_flow_error error; uint8_t match_criteria; int ret; - /* We need the port id in case of matching representor */ - cur_item = items; - while (cur_item->type != RTE_FLOW_ITEM_TYPE_END) { - if (cur_item->type == RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR || - cur_item->type == RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT) { - ret = flow_hw_get_port_id_from_ctx(rule->matcher->tbl->ctx, - &flow_attr.port_id); - if (ret) { - DR_LOG(ERR, "Failed to get port id for dev %s", - rule->matcher->tbl->ctx->ibv_ctx->device->name); - rte_errno = EINVAL; - return rte_errno; - } - } - ++cur_item; + ret = flow_hw_get_port_id_from_ctx(ctx, &flow_attr.port_id); + if (ret) { + DR_LOG(ERR, "Failed to get port id for dev %s", ctx->ibv_ctx->device->name); + rte_errno = EINVAL; + return rte_errno; } attr = simple_calloc(num_actions, sizeof(*attr)); From patchwork Tue Jul 9 12:31:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Itamar Gozlan X-Patchwork-Id: 142269 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 70AC0455E3; Tue, 9 Jul 2024 14:32:50 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D739E42E37; Tue, 9 Jul 2024 14:32:19 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2057.outbound.protection.outlook.com [40.107.237.57]) by mails.dpdk.org (Postfix) with ESMTP id 909D142DCB; Tue, 9 Jul 2024 14:32:17 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qt+zfcT5xWOMxhag8gbnYeYJYIyAurqTYmMvpdio4aT3PZf8QC0JU+HCWdF50aSOXyHhoznNar4Gq85lLQ+t/A730/5SDWMmBEiyHN0Jp66Y+Gcp1WRg+sRiUpb88EgOMDl1/CUuEYZ2215v9gHxvMy1Vgb2w2oJH17/pVxY+PTnfBy+Q9xYcgYzRTYOpdyA6Kj49T8snSSq4aKiinsL8+VGoDxEuNPPnfNd9ag9TWto7Af1DBBdVi2a6UgIW7CBgc6b6vKJ9/u7lNUxAQh05uO6x4W6LheAXksH7/255pJF96YS0O0p6/gA+Rp3mAxHT8IXCrb5uFKdBXBbz+TjGQ== 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=mzS2s4/T3FfeyHX29Jb9jrVBcxIDicpIUMQk/63qR/o=; b=N0RYtvAsYhWZ+3t6XRWClr6h7UfVGGaZMh0uJqWyvEhW5CXGjF7NIj28/N4DJUqrN4pqbKlZs93azg/NXOa3obGB3i4//bf3w6N+kg8RAXMv10FHNYX1yBWm+oKFF/j5NEbDGBluOFtNwEsgQj3l/vFMGtpIDco2YvEfFAU4Gs+JoLev4VsK+koZy+gYIs8X06WLDMYYmhjJzRC5Pn2OBEHfSfBd5gP4XwEbQgG3jOrdr6zP+58XfdE3vgGJu1ra7POhDM4dI2fin8/NrlK4XQFrx2apHrycAHVPbOFVeJ2z14Rog14sbMWGP4YmrsOzzDU7/EE/Xd4S+hQjsC2SUw== 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 (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=mzS2s4/T3FfeyHX29Jb9jrVBcxIDicpIUMQk/63qR/o=; b=UKSk1ohJ3n+EJk5HkQWtYANPG7Yw+r/7X5oF/UMI2ItNY05jaV50cO7rewuHAq0oiZ+Ihtq5dNjP6BmfbGhXht+a+EQxYoc9yI8oC6TchgQiOLrFVfw+ejMu843HtrRdcTKR/NItTAL/Ntczn1ElecCrDKcV+gBpivTSBoWvK7uYM1EhL1ErfvkSh6qlRyIvx6VigvuotfC2DteYjqjq8gaDOqAxxfxcEmb2dsN2c9rSWpfjUXXwcRZzSSSNvkexRyH7jF1QIaSntkCAUDibcPdo/SrA3buiRu1Unq3VMgAbQD4Q23YZjLjWhmdpoNrMGOp/rvpvnAQKxKRgB+9WmA== Received: from MN2PR16CA0048.namprd16.prod.outlook.com (2603:10b6:208:234::17) by MW4PR12MB7264.namprd12.prod.outlook.com (2603:10b6:303:22e::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Tue, 9 Jul 2024 12:32:14 +0000 Received: from BL6PEPF0001AB58.namprd02.prod.outlook.com (2603:10b6:208:234:cafe::d1) by MN2PR16CA0048.outlook.office365.com (2603:10b6:208:234::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.19 via Frontend Transport; Tue, 9 Jul 2024 12:32:14 +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 BL6PEPF0001AB58.mail.protection.outlook.com (10.167.241.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.17 via Frontend Transport; Tue, 9 Jul 2024 12:32:13 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) 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.1544.4; Tue, 9 Jul 2024 05:31:39 -0700 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 9 Jul 2024 05:31:39 -0700 Received: from nvidia.com (10.127.8.12) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4 via Frontend Transport; Tue, 9 Jul 2024 05:31:35 -0700 From: Itamar Gozlan To: , , , , , , , , Dariusz Sosnowski , Bing Zhao , Ori Kam , Matan Azrad CC: , Subject: [PATCH 6/8] net/mlx5/hws: take out not needed variable Date: Tue, 9 Jul 2024 15:31:01 +0300 Message-ID: <20240709123103.2101902-7-igozlan@nvidia.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240709123103.2101902-1-igozlan@nvidia.com> References: <20240707102532.2045942-10-igozlan@nvidia.com> <20240709123103.2101902-1-igozlan@nvidia.com> MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB58:EE_|MW4PR12MB7264:EE_ X-MS-Office365-Filtering-Correlation-Id: c7e38f72-4619-476f-c68c-08dca0132979 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; ARA:13230040|1800799024|376014|36860700013|82310400026|921020; X-Microsoft-Antispam-Message-Info: 2anS3CMeNdkThgM1G79lMWcJC2fSt4nwvFCMXHcIvBrHpB7xQXTCea7V6Puqu3m3s5Wk2x744z5q/6uH1tKznlIYvmfwyi94hWBHlXsjHrDtPNRmRUch4+0CqLT1JxF14qYGF286ccHJ1VnImdef3WLLl9I0WK6vGpYVcDDDeff7Ym933cOgXeUIbnRub6WXE0jdH8k3hC1nP65/22bl3aSoopwXI9lcBAxDvyvO+faRCVZFT9sZgmUu6TD6q8IUursxQy/StUmRoydpAnS82PCL2Ib2sbOJ9J7yTmuXc0FO6uWs+gOmsrnYV3P0PF9coNhXbW+6X03zBT3GAH1EyyPfw89kC8n+PEk3l8AvRw5RR0kD48/lM4ClUdr5WxfaEh/zRNm7HVKVsD4abB7SyiY340uhjmsDr32IejwSdrQiPnme6WFDuLdH3AATcOiDzSp9NJqpAfIloGQ2M048pF/n3Eex8xT5sr0sbkmQJXRban68UjoPCmt7HPFXg9etaPquJXScnlVvb7gz5TNQ1tVz1gvPOYcf5WdOQC0NfnLC7gdrmn7O5CGXN0zOXhd7UQjaMl0e3qR6zJ81eDoOYfKbW7cxvCJVd9cWc5CqE9IV9ssjqFftc9w60e6fneFlQ6J0rOg90GGDxvDdTgjnRMbdjSuDlRMOeQTKEd1rE3IRO7ofyedhz5VCy2fk+QLy+/FGiFMMcoPzFRXHOoashIs4c6K9FbWnQMEtrg0VJv/qKj1QR+QojuVN4RFehwoi3WRrAk/kaCI4bHaXepodWVjSzgyefAlAgk48bCvTA8z0fkuUK3KBYt6W6LJCUcqXQukYcqi9d5n0sEyPjutCzF+EV66n1G+OYlcHdoyqF/lxz6R36wRj9lBos+zaZqYLnRBzZ6Ult3QQYlxj8eDkvL0sXs9zYYhaIHQ8UMEDwmIkyL8paBhNKpnw61SZG9OoF0wbcY4a3qIhmEVqvCoe2G1LU/AsmJBZT4T7J5vnhKM8eFJjhNWQAvl5gwhLX8MWJtgxoIv27NMX5Xvb39s4av69tiaQYEHeqzkKYz9+1nzazf7Kz95s5QuJx1ZnX0YwzUiVhTP2KsbNKgDdf05oveAE5DFGDACq042Q3xrVYo+n6hwe9Tf6cORiHy2urffgiwpotJ/xzphMDoMDPgr+IAwrYJCiPLEk2m6hwe+jYblOy5VohMWpjqrCf42FESHpXq/1hXOZnslxE9QvtZu6TUdv7x9Kn9xQ8W0onQrEC/t/2TnCFXFObd9Oh0LkJuV+NivD6AhPavNpYDPJEPW/ZuGlwmAEpITdfKFYuamo9sfPFxQv2TiuB490syd2hZ6pyOcuIu//ccSl/A0kmFSpz8iu1M0z97KsYzPM3sTVBfxAvhcUmuyNtJmvVfGOCLDC3dwwJsxnuR9pk8SiuwOsIA/jxQAvL1QZQPQttsW1jQvNkPkz9v8cmP0KgZSHd4OKALcejNOwfKQq8haTkRyVQA== 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:(13230040)(1800799024)(376014)(36860700013)(82310400026)(921020); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jul 2024 12:32:13.2468 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c7e38f72-4619-476f-c68c-08dca0132979 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: BL6PEPF0001AB58.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7264 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: Erez Shitrit Removing a redundant variable. Was there from day 1, not in use. Fixes: f8c8a6d8440d ("net/mlx5/hws: add action object") Cc: erezsh@nvidia.com Cc: stable@dpdk.org Signed-off-by: Erez Shitrit Acked-by: Matan Azrad --- drivers/net/mlx5/hws/mlx5dr_pat_arg.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/mlx5/hws/mlx5dr_pat_arg.h b/drivers/net/mlx5/hws/mlx5dr_pat_arg.h index bbe313102f..c4e0cbc843 100644 --- a/drivers/net/mlx5/hws/mlx5dr_pat_arg.h +++ b/drivers/net/mlx5/hws/mlx5dr_pat_arg.h @@ -30,7 +30,6 @@ struct mlx5dr_pattern_cache { struct mlx5dr_pattern_cache_item { struct { struct mlx5dr_devx_obj *pattern_obj; - struct dr_icm_chunk *chunk; uint8_t *data; uint16_t num_of_actions; } mh_data; From patchwork Tue Jul 9 12:31:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Itamar Gozlan X-Patchwork-Id: 142270 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E9481455E3; Tue, 9 Jul 2024 14:32:58 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3E7F442E4C; Tue, 9 Jul 2024 14:32:24 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2050.outbound.protection.outlook.com [40.107.220.50]) by mails.dpdk.org (Postfix) with ESMTP id A750E40ED3; Tue, 9 Jul 2024 14:32:22 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SycofJE9hsb8tO8R5v0huc5ZUG/aBkqcBVj2wI3Tbrbgf840px7a5LU162EENdRInSLx4t75VGWt4v7zNRoQxvEV/KjowXdnRk1q8XC3N06thS61VD9P6THvvPOUJeUjWyoYgBAU4NE8tBVMhjrY0Q3UiHnly3KZGUbwyzFxFPliRYYfS6kRbDhGTu7krzQksugAh1/UZPP6BHZ19ACNqWwxZafpBmHzr7Fwgj1soxlxDPYzWMIoM2WN7XShy/tP9zAcML9Wa9jP7vnHGv9vBtBlfIiym1JmLBwFrLwmPPrhO2iZu/MsUom1XuTeg8S4vncvQafh5/Pvgpv4iW/Lhw== 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=Lpfcgf40tfD+BqRj0urH3tSGTzbo+PqEYNrCZLn2+b0=; b=EfsXRZJgc+nlxgVCksJ3+K7TULUMWvJCVbi5qDtbcBowzgPcK89MAtLnZ0jg/4ETU5haTalDzcOrW07MZlkQMPU7vDS6ChbHj/xR1lZVjIOAx8A0x5j9LU7djsILviuJRvXm8XlIK4+B/YXA2dRPeq/eaXhqrHt8Jz/R6jc63aokXDCUioW05KLYq5gphOZHpuYRjXas2RB8yke/74bTuBPwVsFr0lmniZzIhvz7hO5aPrIz4mvPxxKj9wzrxIiVIoJ/7AupI2CjDHFRKpcCuwmziNvmfoeTCGqD2WZZZ0Kp0rJ/faSCXoaWNDiB+Wpuurekwh090m5gd+sjr7VAtw== 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 (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=Lpfcgf40tfD+BqRj0urH3tSGTzbo+PqEYNrCZLn2+b0=; b=GdBjmV74QRvzAUVTWc5c5yYtzVLy3HaoegYHLJ7+5gQl7hWpEic1GPuAifbexq3oFAdwGGVb5gaBvCPWIeQR+a5MU9IxbbhWEz3i+TTxLgkY89aXwQxRXU2Zufw19L3cgS4xxD3QYA2+3FqCGGV9vN9U7Ol8TYdDYmEhPRz6Ix0gi8xdDOx4R0X+CaNW6gURCWZ8fYOPEpD7SlqVHfB7xYoZ/8Dka9wTHhhu1ppYOqnZBqhlX5VUqb1BqiyHOASNA0ksEWKFAzepgmLsQlC2A48FHVEYVX7ubSKWtN1N6SIz77S7v9rAr8fb+GBvhVFtX/9eWn/esl1dLr6XGIdZ9A== Received: from BN9PR03CA0297.namprd03.prod.outlook.com (2603:10b6:408:f5::32) by PH7PR12MB6665.namprd12.prod.outlook.com (2603:10b6:510:1a7::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.30; Tue, 9 Jul 2024 12:32:18 +0000 Received: from BN2PEPF000055DF.namprd21.prod.outlook.com (2603:10b6:408:f5:cafe::5f) by BN9PR03CA0297.outlook.office365.com (2603:10b6:408:f5::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.36 via Frontend Transport; Tue, 9 Jul 2024 12:32:17 +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 BN2PEPF000055DF.mail.protection.outlook.com (10.167.245.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.1 via Frontend Transport; Tue, 9 Jul 2024 12:32:16 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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, 9 Jul 2024 05:31:44 -0700 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 9 Jul 2024 05:31:44 -0700 Received: from nvidia.com (10.127.8.12) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4 via Frontend Transport; Tue, 9 Jul 2024 05:31:40 -0700 From: Itamar Gozlan To: , , , , , , , , Dariusz Sosnowski , Bing Zhao , Ori Kam , Matan Azrad CC: , Subject: [PATCH 7/8] net/mlx5/hws: fix NAT64 csum issue Date: Tue, 9 Jul 2024 15:31:02 +0300 Message-ID: <20240709123103.2101902-8-igozlan@nvidia.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240709123103.2101902-1-igozlan@nvidia.com> References: <20240707102532.2045942-10-igozlan@nvidia.com> <20240709123103.2101902-1-igozlan@nvidia.com> MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF000055DF:EE_|PH7PR12MB6665:EE_ X-MS-Office365-Filtering-Correlation-Id: f512c133-fff2-402c-ae93-08dca0132bbf 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; ARA:13230040|1800799024|36860700013|82310400026|376014|921020; X-Microsoft-Antispam-Message-Info: GVIGTYO/4ZZu97sfHipqRp5/B06pjn9SdEFnhL82QGG0la+FEqEYUoburSP3ZpboHiDE+0puRkJudN0z52q31nFewuQCYfkUqaxTCZxkx/gnhXlZLeSc5T0o5Kst9I8T3jsWaEOXkOnHwaMOAwkNGfro8C2ZB63YSQ8Ep6jE2FMLKGWZOxWzXjNeaOrFR/4nrlIdbZrms2Ke4hDXWvb5ZqJiQjQWXbHShB2pub52GI5YIPY6ePxhh+zoLTZUubabKsR66BE7WtL5c7a69fa94HOd+ffKERxdph8+3TzmIJxQSHqoc4l0AoXkRc/D6QrsvtD+ilQ9Q0Vuo488JnBvquhGSYCUnyHE4jCEW4GKxEa82OncKV9P0WOvKq/FKm4a3q5jpourg0w3eAaQRMatxefI90mJ2pSIx2wlNi0emy+yuCfE2UMR0HM475TN48SyjtCa9jYrNafywfrT0IVjurb3gpBOMaYZLSnNWVUT/ZJaoj2TmqpRqUKfa13xdo8komIUInl0j+ZuKbJnB2zoFebJUp+aJ2mCm6O++GxR3YsUMRBi/zi6ArHYcvs8wXh3DgVWLC0/b/vVq/D+zhmhEEQnn4jUI36m+ac0YWsVKeZ4mWew9LpF/AgQlPnmcqjrUX4OusGVIBPQPSLkCjQZh2OYQur0mMqxbQ341WKnDEFeS/Id3AqcNTmbxJBonBavdVCvtmrvvg5j5J1Ay1nnc6fvVGVTMd8O2vEefLleOLdpbSFbQATwazju5s7gUvn7J1EFxOo8kr3wDm8UnGxYOpkXNbKVjTr+vPRWTqHblpoUV6pvVR5AAl3e00AC9DFDEu+hXx4JW9hJQ55ai3eLaaLhVrVSh/B8/f9W+83WDydAy5unFQEeCEA4qD5jliciIZFuNfy/kf+dyvxNOQyjEa3m6xnjH1YLMPVV4CCuWrrLPkoP0gy3FDivTRuSd3KzuiWtSZXXz4wKEE/oqruoWnAG7p0uyW6gSZgdNslbaVVhEG6H2zwf//dKrlPkddZYk0/4yFn9o34vLnXYXhqqqkyFeBL/7zZXgju90ZuLrOdhpaCv8JQHZKDMsdIRk8XVJOaecKJWwiIS3KH5czwyqREGtpooQU860ZjH8lTGDqKsmYMmf9+5r9b8bR1X5iolfdq2kxZTBXbMcadErMiKX8cl67yl4DFShtvAWXD/niJqbiZG5xjLguCSgrJ0kZOpoO6MZHbtvgb+fr/SNKxCD8QzojG/pEIkJyL8lOteqomWUR8yGELV8ruHqhwBTG3mY5OdKLAdS/zx1TZyWAfRsEVG/MiuzpqqUo9NYw17KnFgNCDzZCun8w4uJl+IXswxeB+QEToif2iuYZwCiq0MNXJ5KVmmk1gWIy0dLMNmXWMWCa5sIfK4/hnv7q2pN40yoUixp48EhuazwBxQqlKMYLEyRBOI2x1BVLtXSzYQZBd2dOLUjg3imZNf3B2hs5sZvfhss0MY4jLxtlxIwlc2Ww== 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)(1800799024)(36860700013)(82310400026)(376014)(921020); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jul 2024 12:32:16.9823 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f512c133-fff2-402c-ae93-08dca0132bbf 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: BN2PEPF000055DF.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6665 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: Erez Shitrit Due to HW limitation we got two csum's that were not correct, udp and ip, both of them were not calculated correctly by the HW. By adding the next W/A we allow the HW to collect it well: Separate the protocol field and zero all the addresses before fixed the UDP csum. We saw that the IP csum by the HW didn't take the ipv4 version as part of the csum because the way it was inserted into the packet, in order to solve that we added a prefix that takes into account the real csum for the ip version and from that point the HW calculating the csum correctly. Fixes: 06d969a8c5b8 ("net/mlx5/hws: support NAT64 flow action") Cc: erezsh@nvidia.com Cc: stable@dpdk.org Signed-off-by: Erez Shitrit Acked-by: Matan Azrad --- drivers/net/mlx5/hws/mlx5dr_action.c | 136 ++++++++++++++++++++++----- drivers/net/mlx5/hws/mlx5dr_action.h | 15 ++- 2 files changed, 123 insertions(+), 28 deletions(-) diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c index 0d90280a7d..8d3d0033e5 100644 --- a/drivers/net/mlx5/hws/mlx5dr_action.c +++ b/drivers/net/mlx5/hws/mlx5dr_action.c @@ -249,6 +249,62 @@ static void mlx5dr_action_put_shared_stc(struct mlx5dr_action *action, mlx5dr_action_put_shared_stc_nic(ctx, stc_type, MLX5DR_TABLE_TYPE_FDB); } +static void +mlx5dr_action_create_nat64_zero_all_addr(uint8_t **action_ptr, bool is_v4_to_v6) +{ + if (is_v4_to_v6) { + MLX5_SET(set_action_in, *action_ptr, action_type, MLX5_MODIFICATION_TYPE_SET); + MLX5_SET(set_action_in, *action_ptr, field, MLX5_MODI_OUT_SIPV4); + MLX5_SET(set_action_in, *action_ptr, data, 0); + *action_ptr += MLX5DR_ACTION_DOUBLE_SIZE; + + MLX5_SET(set_action_in, *action_ptr, action_type, MLX5_MODIFICATION_TYPE_SET); + MLX5_SET(set_action_in, *action_ptr, field, MLX5_MODI_OUT_DIPV4); + MLX5_SET(set_action_in, *action_ptr, data, 0); + *action_ptr += MLX5DR_ACTION_DOUBLE_SIZE; + } else { + MLX5_SET(set_action_in, *action_ptr, action_type, MLX5_MODIFICATION_TYPE_SET); + MLX5_SET(set_action_in, *action_ptr, field, MLX5_MODI_OUT_SIPV6_127_96); + MLX5_SET(set_action_in, *action_ptr, data, 0); + *action_ptr += MLX5DR_ACTION_DOUBLE_SIZE; + + MLX5_SET(set_action_in, *action_ptr, action_type, MLX5_MODIFICATION_TYPE_SET); + MLX5_SET(set_action_in, *action_ptr, field, MLX5_MODI_OUT_SIPV6_95_64); + MLX5_SET(set_action_in, *action_ptr, data, 0); + *action_ptr += MLX5DR_ACTION_DOUBLE_SIZE; + + MLX5_SET(set_action_in, *action_ptr, action_type, MLX5_MODIFICATION_TYPE_SET); + MLX5_SET(set_action_in, *action_ptr, field, MLX5_MODI_OUT_SIPV6_63_32); + MLX5_SET(set_action_in, *action_ptr, data, 0); + *action_ptr += MLX5DR_ACTION_DOUBLE_SIZE; + + MLX5_SET(set_action_in, *action_ptr, action_type, MLX5_MODIFICATION_TYPE_SET); + MLX5_SET(set_action_in, *action_ptr, field, MLX5_MODI_OUT_SIPV6_31_0); + MLX5_SET(set_action_in, *action_ptr, data, 0); + *action_ptr += MLX5DR_ACTION_DOUBLE_SIZE; + + MLX5_SET(set_action_in, *action_ptr, action_type, MLX5_MODIFICATION_TYPE_SET); + MLX5_SET(set_action_in, *action_ptr, field, MLX5_MODI_OUT_DIPV6_127_96); + MLX5_SET(set_action_in, *action_ptr, data, 0); + *action_ptr += MLX5DR_ACTION_DOUBLE_SIZE; + + MLX5_SET(set_action_in, *action_ptr, action_type, MLX5_MODIFICATION_TYPE_SET); + MLX5_SET(set_action_in, *action_ptr, field, MLX5_MODI_OUT_DIPV6_95_64); + MLX5_SET(set_action_in, *action_ptr, data, 0); + *action_ptr += MLX5DR_ACTION_DOUBLE_SIZE; + + MLX5_SET(set_action_in, *action_ptr, action_type, MLX5_MODIFICATION_TYPE_SET); + MLX5_SET(set_action_in, *action_ptr, field, MLX5_MODI_OUT_DIPV6_63_32); + MLX5_SET(set_action_in, *action_ptr, data, 0); + *action_ptr += MLX5DR_ACTION_DOUBLE_SIZE; + + MLX5_SET(set_action_in, *action_ptr, action_type, MLX5_MODIFICATION_TYPE_SET); + MLX5_SET(set_action_in, *action_ptr, field, MLX5_MODI_OUT_DIPV6_31_0); + MLX5_SET(set_action_in, *action_ptr, data, 0); + *action_ptr += MLX5DR_ACTION_DOUBLE_SIZE; + } +} + static struct mlx5dr_action * mlx5dr_action_create_nat64_copy_state(struct mlx5dr_context *ctx, struct mlx5dr_action_nat64_attr *attr, @@ -329,17 +385,7 @@ mlx5dr_action_create_nat64_copy_state(struct mlx5dr_context *ctx, action_ptr += MLX5DR_ACTION_DOUBLE_SIZE; /* set sip and dip to 0, in order to have new csum */ - if (is_v4_to_v6) { - MLX5_SET(set_action_in, action_ptr, action_type, MLX5_MODIFICATION_TYPE_SET); - MLX5_SET(set_action_in, action_ptr, field, MLX5_MODI_OUT_SIPV4); - MLX5_SET(set_action_in, action_ptr, data, 0); - action_ptr += MLX5DR_ACTION_DOUBLE_SIZE; - - MLX5_SET(set_action_in, action_ptr, action_type, MLX5_MODIFICATION_TYPE_SET); - MLX5_SET(set_action_in, action_ptr, field, MLX5_MODI_OUT_DIPV4); - MLX5_SET(set_action_in, action_ptr, data, 0); - action_ptr += MLX5DR_ACTION_DOUBLE_SIZE; - } + mlx5dr_action_create_nat64_zero_all_addr(&action_ptr, is_v4_to_v6); pat[0].data = modify_action_data; pat[0].sz = (action_ptr - (uint8_t *)modify_action_data); @@ -383,9 +429,14 @@ mlx5dr_action_create_nat64_repalce_state(struct mlx5dr_context *ctx, memcpy(address_prefix, nat64_well_known_pref, MLX5DR_ACTION_NAT64_HEADER_MINUS_ONE * sizeof(uint32_t)); } else { + /* In order to fix HW csum issue, make the prefix ready */ + uint32_t ipv4_pref[] = {0x0, 0xffba0000, 0x0, 0x0, 0x0}; + header_size_in_dw = MLX5DR_ACTION_NAT64_IPV4_HEADER; ip_ver = MLX5DR_ACTION_NAT64_IPV4_VER; eth_type = RTE_ETHER_TYPE_IPV4; + memcpy(address_prefix, ipv4_pref, + MLX5DR_ACTION_NAT64_IPV4_HEADER * sizeof(uint32_t)); } memset(modify_action_data, 0, sizeof(modify_action_data)); @@ -441,6 +492,46 @@ mlx5dr_action_create_nat64_repalce_state(struct mlx5dr_context *ctx, return action; } +static struct mlx5dr_action * +mlx5dr_action_create_nat64_copy_proto_state(struct mlx5dr_context *ctx, + struct mlx5dr_action_nat64_attr *attr, + uint32_t flags) +{ + __be64 modify_action_data[MLX5DR_ACTION_NAT64_MAX_MODIFY_ACTIONS]; + struct mlx5dr_action_mh_pattern pat[2]; + struct mlx5dr_action *action; + uint8_t *action_ptr; + + memset(modify_action_data, 0, sizeof(modify_action_data)); + action_ptr = (uint8_t *)modify_action_data; + + MLX5_SET(copy_action_in, action_ptr, action_type, MLX5_MODIFICATION_TYPE_COPY); + MLX5_SET(copy_action_in, action_ptr, src_field, + attr->registers[MLX5DR_ACTION_NAT64_REG_CONTROL]); + MLX5_SET(copy_action_in, action_ptr, dst_field, + MLX5_MODI_OUT_IP_PROTOCOL); + MLX5_SET(copy_action_in, action_ptr, src_offset, 16); + MLX5_SET(copy_action_in, action_ptr, dst_offset, 0); + MLX5_SET(copy_action_in, action_ptr, length, 8); + action_ptr += MLX5DR_ACTION_DOUBLE_SIZE; + + MLX5_SET(copy_action_in, action_ptr, action_type, MLX5_MODIFICATION_TYPE_NOP); + action_ptr += MLX5DR_ACTION_DOUBLE_SIZE; + + pat[0].data = modify_action_data; + pat[0].sz = action_ptr - (uint8_t *)modify_action_data; + + action = mlx5dr_action_create_modify_header_reparse(ctx, 1, pat, 0, flags, + MLX5DR_ACTION_STC_REPARSE_ON); + if (!action) { + DR_LOG(ERR, "Failed to create action: action_sz: %zu, flags: 0x%x\n", + pat[0].sz, flags); + return NULL; + } + + return action; +} + static struct mlx5dr_action * mlx5dr_action_create_nat64_copy_back_state(struct mlx5dr_context *ctx, struct mlx5dr_action_nat64_attr *attr, @@ -490,16 +581,6 @@ mlx5dr_action_create_nat64_copy_back_state(struct mlx5dr_context *ctx, MLX5_SET(copy_action_in, action_ptr, action_type, MLX5_MODIFICATION_TYPE_NOP); action_ptr += MLX5DR_ACTION_DOUBLE_SIZE; - MLX5_SET(copy_action_in, action_ptr, action_type, MLX5_MODIFICATION_TYPE_COPY); - MLX5_SET(copy_action_in, action_ptr, src_field, - attr->registers[MLX5DR_ACTION_NAT64_REG_CONTROL]); - MLX5_SET(copy_action_in, action_ptr, dst_field, - MLX5_MODI_OUT_IP_PROTOCOL); - MLX5_SET(copy_action_in, action_ptr, src_offset, 16); - MLX5_SET(copy_action_in, action_ptr, dst_offset, 0); - MLX5_SET(copy_action_in, action_ptr, length, 8); - action_ptr += MLX5DR_ACTION_DOUBLE_SIZE; - MLX5_SET(copy_action_in, action_ptr, action_type, MLX5_MODIFICATION_TYPE_NOP); action_ptr += MLX5DR_ACTION_DOUBLE_SIZE; @@ -2051,7 +2132,7 @@ mlx5dr_action_create_modify_header_hws(struct mlx5dr_action *action, return rte_errno; } -static struct mlx5dr_action * +struct mlx5dr_action * mlx5dr_action_create_modify_header_reparse(struct mlx5dr_context *ctx, uint8_t num_of_patterns, struct mlx5dr_action_mh_pattern *patterns, @@ -2927,17 +3008,24 @@ mlx5dr_action_create_nat64(struct mlx5dr_context *ctx, DR_LOG(ERR, "Nat64 failed creating replace state"); goto free_copy; } + action->nat64.stages[MLX5DR_ACTION_NAT64_STAGE_COPY_PROTOCOL] = + mlx5dr_action_create_nat64_copy_proto_state(ctx, attr, flags); + if (!action->nat64.stages[MLX5DR_ACTION_NAT64_STAGE_COPY_PROTOCOL]) { + DR_LOG(ERR, "Nat64 failed creating copy protocol state"); + goto free_replace; + } action->nat64.stages[MLX5DR_ACTION_NAT64_STAGE_COPYBACK] = mlx5dr_action_create_nat64_copy_back_state(ctx, attr, flags); if (!action->nat64.stages[MLX5DR_ACTION_NAT64_STAGE_COPYBACK]) { DR_LOG(ERR, "Nat64 failed creating copyback state"); - goto free_replace; + goto free_copy_proto; } return action; - +free_copy_proto: + mlx5dr_action_destroy(action->nat64.stages[MLX5DR_ACTION_NAT64_STAGE_COPY_PROTOCOL]); free_replace: mlx5dr_action_destroy(action->nat64.stages[MLX5DR_ACTION_NAT64_STAGE_REPLACE]); free_copy: diff --git a/drivers/net/mlx5/hws/mlx5dr_action.h b/drivers/net/mlx5/hws/mlx5dr_action.h index 57e059a572..faea6bb1f4 100644 --- a/drivers/net/mlx5/hws/mlx5dr_action.h +++ b/drivers/net/mlx5/hws/mlx5dr_action.h @@ -11,9 +11,6 @@ /* Max number of internal subactions of ipv6_ext */ #define MLX5DR_ACTION_IPV6_EXT_MAX_SA 4 -/* Number of MH in NAT64 */ -#define MLX5DR_ACTION_NAT64_STAGES 3 - enum mlx5dr_action_stc_idx { MLX5DR_ACTION_STC_IDX_CTRL = 0, MLX5DR_ACTION_STC_IDX_HIT = 1, @@ -88,7 +85,10 @@ enum { enum mlx5dr_action_nat64_stages { MLX5DR_ACTION_NAT64_STAGE_COPY = 0, MLX5DR_ACTION_NAT64_STAGE_REPLACE = 1, - MLX5DR_ACTION_NAT64_STAGE_COPYBACK = 2, + MLX5DR_ACTION_NAT64_STAGE_COPY_PROTOCOL = 2, + MLX5DR_ACTION_NAT64_STAGE_COPYBACK = 3, + /* Number of MH in NAT64 */ + MLX5DR_ACTION_NAT64_STAGES = 4, }; /* Registers for keeping data from stage to stage */ @@ -256,6 +256,13 @@ int mlx5dr_action_alloc_single_stc(struct mlx5dr_context *ctx, void mlx5dr_action_free_single_stc(struct mlx5dr_context *ctx, uint32_t table_type, struct mlx5dr_pool_chunk *stc); +struct mlx5dr_action * +mlx5dr_action_create_modify_header_reparse(struct mlx5dr_context *ctx, + uint8_t num_of_patterns, + struct mlx5dr_action_mh_pattern *patterns, + uint32_t log_bulk_size, + uint32_t flags, uint32_t reparse); + static inline void mlx5dr_action_setter_default_single(struct mlx5dr_actions_apply_data *apply, From patchwork Tue Jul 9 12:31:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Itamar Gozlan X-Patchwork-Id: 142271 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C7E3A455E3; Tue, 9 Jul 2024 14:33:08 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0577642E6A; Tue, 9 Jul 2024 14:32:28 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2056.outbound.protection.outlook.com [40.107.94.56]) by mails.dpdk.org (Postfix) with ESMTP id F16A942E66; Tue, 9 Jul 2024 14:32:25 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RUUkhJQoztDS1ibseMcuY6GZGyLlAB4dQkwkK22QFeYApmgggYnv6n0nDVbZrCoHSExYgAXuDZIzzEdqg1iAFK/3Zq6zils4W+xVOGBbd8RlZNQSpAr/va422oLUWgek2IIJXIgskHLl/vll26STbSIbfG9DHwCujZTV45LdcUO+k9D6HGnQMO6UgBcK7S0R/PY7VoD6GOdKZar7bcNcYcViFbCdxH+We/xS2q0eYJeDu3TzXYAPM/AlXfObY9MEEVwQexcxqXBwa5hh3/kgG19fyPjKNNE3PoFaWzTMl0FYTyHxlmbTjYGQndu/jpSZVZV7aXBgkjUp8ITs25J4iA== 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=/JcZuVh+ROhGrYOwKcnnZuXzkxZiLTx8biBj+A0s2E8=; b=dBvx85oFSvQOsRlpZPODzAkhqzo3t2GmwV/usxdttL4ILrBSvwDxwXaSlRTFS47QlTV/tv9HzMXZEfOCP8A5GsIfyurtZp8kMNJ436sX+qDnn8Mr55a41fNgUh4zfgChtlY3cwC3tXwvFjvdUNMh2OfltojPDukMuLWREv9ZUKKpdNSaULTMsDz5KyP6BJVjgwv01r18f1YTsTnjTfvODx9SuePRwVQYepO4O3hmf1PtuCTE+Gz7L8O9BwQAx1OsAaQIGOaywH7D1BsbpGiEZNWDE3D198UzxYuLDlp64rkCrZVXuVtiSnlPv26riMyPU8yycHNWOiwM9AGY5vQQng== 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 (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=/JcZuVh+ROhGrYOwKcnnZuXzkxZiLTx8biBj+A0s2E8=; b=DQvwAYY5o/NjV6yjc5QREy3RYFuW4ubK2PScR10tqHeNRrB5YY7YoPBGul3251jU9ettiKbnZ52zZbV4SJ6S/Jrnjiz7MbQ5EQ7YXo46+W1mjXqB1Or8JOaVZI5FwC0PPtasUTubdc8Y8p36H5QLk81RYEyZ0uWhEL7eGcPUNQgtmGA+ZLHGw/uNlxtsP755qm8x38h9gjE/Tr8w3h19KnV5bgty46d1mQKu3B60pvI6Mc4O7PdJGTqz1OTG1EeCas9xyz540czzPkLzRnFg2nQDCC0nNL6H5wcP9iT28D5dmDY8cf3NlirbMAj42f5zbGBzYkLzP6UNO2DNXqTWzw== Received: from MN2PR06CA0017.namprd06.prod.outlook.com (2603:10b6:208:23d::22) by MN2PR12MB4285.namprd12.prod.outlook.com (2603:10b6:208:1d7::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.20; Tue, 9 Jul 2024 12:32:22 +0000 Received: from BL6PEPF0001AB54.namprd02.prod.outlook.com (2603:10b6:208:23d:cafe::4) by MN2PR06CA0017.outlook.office365.com (2603:10b6:208:23d::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.36 via Frontend Transport; Tue, 9 Jul 2024 12:32:20 +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 BL6PEPF0001AB54.mail.protection.outlook.com (10.167.241.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.17 via Frontend Transport; Tue, 9 Jul 2024 12:32:20 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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.1544.4; Tue, 9 Jul 2024 05:31:49 -0700 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 9 Jul 2024 05:31:49 -0700 Received: from nvidia.com (10.127.8.12) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4 via Frontend Transport; Tue, 9 Jul 2024 05:31:45 -0700 From: Itamar Gozlan To: , , , , , , , , Dariusz Sosnowski , Bing Zhao , Ori Kam , Matan Azrad CC: , Subject: [PATCH 8/8] net/mlx5/hws: fix NA64 copy TOS field instead of TTL Date: Tue, 9 Jul 2024 15:31:03 +0300 Message-ID: <20240709123103.2101902-9-igozlan@nvidia.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240709123103.2101902-1-igozlan@nvidia.com> References: <20240707102532.2045942-10-igozlan@nvidia.com> <20240709123103.2101902-1-igozlan@nvidia.com> MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB54:EE_|MN2PR12MB4285:EE_ X-MS-Office365-Filtering-Correlation-Id: 0869725f-6b27-45b6-c53b-08dca0132d59 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; ARA:13230040|376014|36860700013|1800799024|82310400026|921020; X-Microsoft-Antispam-Message-Info: wirMBVZ9ZGrz7Zvfz2k96O/q2MNiDjRha+f3eXb2toikBVMLpcwic2Z34fI6p6mzLRq3LOsxA6SRISRACmkYu1O9x1WQ96or3dbUyb9ePZm9Wpaa2zxMz5IWYa2L8/AuKm/TqjrhikNnAglLpsmldBZgFu+PPsjsNlDvsmoIyjbI+WbNSEsZ3nkumC+4FzuLF6ETsHiDIL2aprHPx7ayNlWIg5jH23NgNinzwEhOJtkxpfa7VBA5ZSmf6+dVzy0mzs8Vq9/HaXYmvDjNB8VuUTkSVYJ2D75d3UQGthZCfeFaZu7NxjaFXjwgb7HzPl4LeexQRh0Dmzdb4RDhGYEYJlGAGoEurR5Wc4jQH5+WoBn+I54C8A7lGlxOgzZFvxgtB7uox7lHD5ko6nZwCB2Q5FsOmBkTETpsh8tenw/BFDT4jWqDdglNo5wnBOQ5CZ7G1oyFhKdaDXaNP2YrAKB2dfq4A6rLASEX3CjZ5+ewP84oJCPcBc7ciZaRoqoxCB/t0poif6Y92IaZEQ1fxN1G/psBGiVoEjsylmwF8z/C5qqdtRV5XQOhErOrAJE4Kb15KDoAmYjCAL/KivM0sRlA0E7sMPYs89T95KOsdWOrbA9r62r7B8WBNJVt7I1ZNqPhItzTTPbYChhhnl4knkBF+HQvYnNqSnhX0g1RznuuUsGGShSyTfVtzKn+LlF0cc3qNjsnW3Cc9psRa4NR52UUk9jT2Hh42vrGzYNjVweXEvUeHu/WhDlW4RahXXub83lLESd2o03fl0trFsQbDikzDwGdKrZqRYoNSTjnqjTqk89Pvk/xLPjflEyvGr/FIHtAYAhU2K2rjH0VkudrnVw+29LvEm4SNXmJpC7VdtegteQ0N82+4fE0HV98Lktgu37GmpH7+snbuAA/4TsLg/nyqWRnT1biJrdP9Jn94Qr6M7dLJIP0dBPJx3OeP+hbNroeeO7I8RjkDXTuatNXBOMHeVk7gvg/B+NAs33Y27ou2bfNlR1+06wlXhCtlw/LxI6EpKrCQRiAqlfv5EUtKGMK5hi6r9W/XKV8NwsYDJfbCrd+OyQe3i8xxLHo7dndbndaDiqreFaKfL292tZw4dIFOtT14AutyQBvpRAKo9/KX5QYML8mwqhPqiG1Jlq6MTe8EwrOdpfUn4wusKju+yHhJcn6ZYM0VWWnQg8WJclu8S4JLCNu2hGnvw6RwV0+KmGX/hNi39LQLGMizfSE+Me8rTRrAVyYXV6Gfgv7lkebqa3KTVSLdGDIA36dDe51oD+eGTSgpBtGzNZLHiQuMIuwrzNjNSc0CPyzVj9H70dJOJA+TCXhh+GGrVTGYcsJZaEcOLCs0HSF+c5nqnbFfrxKuFdS8bZJM0PZCursQSnNsiuIl9/5em+kkC+YGJZ9xNHg06ro2IgWZ0U8/B/qCxjJylYe0OyevgKkRDHjQj7hX7cyAT4X4NAl7Cv4MwNe5BifZYBQTvDo9TgVIkeiA9RuSw== 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:(13230040)(376014)(36860700013)(1800799024)(82310400026)(921020); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jul 2024 12:32:20.3260 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0869725f-6b27-45b6-c53b-08dca0132d59 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: BL6PEPF0001AB54.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4285 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: Erez Shitrit We don't have enough registers to copy TTL and TOS, so we will set TTL to be the default value (64) and will copy TOS. Fixes: 06d969a8c5b8 ("net/mlx5/hws: support NAT64 flow action") Cc: erezsh@nvidia.com Cc: stable@dpdk.org Signed-off-by: Erez Shitrit Acked-by: Matan Azrad --- drivers/net/mlx5/hws/mlx5dr_action.c | 66 +++++++++++++++++++++++----- drivers/net/mlx5/hws/mlx5dr_action.h | 2 + 2 files changed, 56 insertions(+), 12 deletions(-) diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c index 8d3d0033e5..8f6be37818 100644 --- a/drivers/net/mlx5/hws/mlx5dr_action.c +++ b/drivers/net/mlx5/hws/mlx5dr_action.c @@ -315,21 +315,27 @@ mlx5dr_action_create_nat64_copy_state(struct mlx5dr_context *ctx, struct mlx5dr_action *action; uint32_t packet_len_field; uint8_t *action_ptr; - uint32_t ttl_field; + uint32_t tos_field; + uint32_t tos_size; uint32_t src_addr; uint32_t dst_addr; bool is_v4_to_v6; + uint32_t ecn; is_v4_to_v6 = attr->flags & MLX5DR_ACTION_NAT64_V4_TO_V6; if (is_v4_to_v6) { packet_len_field = MLX5_MODI_OUT_IPV4_TOTAL_LEN; - ttl_field = MLX5_MODI_OUT_IPV4_TTL; + tos_field = MLX5_MODI_OUT_IP_DSCP; + tos_size = 6; + ecn = MLX5_MODI_OUT_IP_ECN; src_addr = MLX5_MODI_OUT_SIPV4; dst_addr = MLX5_MODI_OUT_DIPV4; } else { packet_len_field = MLX5_MODI_OUT_IPV6_PAYLOAD_LEN; - ttl_field = MLX5_MODI_OUT_IPV6_HOPLIMIT; + tos_field = MLX5_MODI_OUT_IPV6_TRAFFIC_CLASS; + tos_size = 8; + ecn = 0; src_addr = MLX5_MODI_OUT_SIPV6_31_0; dst_addr = MLX5_MODI_OUT_DIPV6_31_0; } @@ -352,7 +358,7 @@ mlx5dr_action_create_nat64_copy_state(struct mlx5dr_context *ctx, } /* | 8 bit - 8 bit - 16 bit | - * | ttl - protocol - packet-len | + * | TOS - protocol - packet-len | */ MLX5_SET(copy_action_in, action_ptr, action_type, MLX5_MODIFICATION_TYPE_COPY); MLX5_SET(copy_action_in, action_ptr, src_field, packet_len_field); @@ -377,12 +383,25 @@ mlx5dr_action_create_nat64_copy_state(struct mlx5dr_context *ctx, action_ptr += MLX5DR_ACTION_DOUBLE_SIZE; MLX5_SET(copy_action_in, action_ptr, action_type, MLX5_MODIFICATION_TYPE_COPY); - MLX5_SET(copy_action_in, action_ptr, src_field, ttl_field); + MLX5_SET(copy_action_in, action_ptr, src_field, tos_field); MLX5_SET(copy_action_in, action_ptr, dst_field, attr->registers[MLX5DR_ACTION_NAT64_REG_CONTROL]); MLX5_SET(copy_action_in, action_ptr, dst_offset, 24); - MLX5_SET(copy_action_in, action_ptr, length, 8); + MLX5_SET(copy_action_in, action_ptr, length, tos_size); action_ptr += MLX5DR_ACTION_DOUBLE_SIZE; + /* in ipv4 TOS = {dscp (6bits) - ecn (2bits) }*/ + if (ecn) { + MLX5_SET(copy_action_in, action_ptr, action_type, MLX5_MODIFICATION_TYPE_NOP); + action_ptr += MLX5DR_ACTION_DOUBLE_SIZE; + + MLX5_SET(copy_action_in, action_ptr, action_type, MLX5_MODIFICATION_TYPE_COPY); + MLX5_SET(copy_action_in, action_ptr, src_field, ecn); + MLX5_SET(copy_action_in, action_ptr, dst_field, + attr->registers[MLX5DR_ACTION_NAT64_REG_CONTROL]); + MLX5_SET(copy_action_in, action_ptr, dst_offset, 24 + tos_size); + MLX5_SET(copy_action_in, action_ptr, length, MLX5DR_ACTION_NAT64_ECN_SIZE); + action_ptr += MLX5DR_ACTION_DOUBLE_SIZE; + } /* set sip and dip to 0, in order to have new csum */ mlx5dr_action_create_nat64_zero_all_addr(&action_ptr, is_v4_to_v6); @@ -543,10 +562,13 @@ mlx5dr_action_create_nat64_copy_back_state(struct mlx5dr_context *ctx, uint32_t packet_len_field; uint32_t packet_len_add; uint8_t *action_ptr; + uint32_t tos_field; uint32_t ttl_field; + uint32_t tos_size; uint32_t src_addr; uint32_t dst_addr; bool is_v4_to_v6; + uint32_t ecn; is_v4_to_v6 = attr->flags & MLX5DR_ACTION_NAT64_V4_TO_V6; @@ -557,6 +579,9 @@ mlx5dr_action_create_nat64_copy_back_state(struct mlx5dr_context *ctx, ttl_field = MLX5_MODI_OUT_IPV6_HOPLIMIT; src_addr = MLX5_MODI_OUT_SIPV6_31_0; dst_addr = MLX5_MODI_OUT_DIPV6_31_0; + tos_field = MLX5_MODI_OUT_IPV6_TRAFFIC_CLASS; + tos_size = 8; + ecn = 0; } else { packet_len_field = MLX5_MODI_OUT_IPV4_TOTAL_LEN; /* ipv4 len is including 20 bytes of the header, so add 20 over ipv6 len */ @@ -564,6 +589,9 @@ mlx5dr_action_create_nat64_copy_back_state(struct mlx5dr_context *ctx, ttl_field = MLX5_MODI_OUT_IPV4_TTL; src_addr = MLX5_MODI_OUT_SIPV4; dst_addr = MLX5_MODI_OUT_DIPV4; + tos_field = MLX5_MODI_OUT_IP_DSCP; + tos_size = 6; + ecn = MLX5_MODI_OUT_IP_ECN; } memset(modify_action_data, 0, sizeof(modify_action_data)); @@ -578,20 +606,34 @@ mlx5dr_action_create_nat64_copy_back_state(struct mlx5dr_context *ctx, MLX5_SET(copy_action_in, action_ptr, length, 16); action_ptr += MLX5DR_ACTION_DOUBLE_SIZE; - MLX5_SET(copy_action_in, action_ptr, action_type, MLX5_MODIFICATION_TYPE_NOP); - action_ptr += MLX5DR_ACTION_DOUBLE_SIZE; - - MLX5_SET(copy_action_in, action_ptr, action_type, MLX5_MODIFICATION_TYPE_NOP); + MLX5_SET(set_action_in, action_ptr, action_type, MLX5_MODIFICATION_TYPE_SET); + MLX5_SET(set_action_in, action_ptr, field, ttl_field); + MLX5_SET(set_action_in, action_ptr, length, 8); + MLX5_SET(set_action_in, action_ptr, data, MLX5DR_ACTION_NAT64_TTL_DEFAULT_VAL); action_ptr += MLX5DR_ACTION_DOUBLE_SIZE; + /* copy TOS */ MLX5_SET(copy_action_in, action_ptr, action_type, MLX5_MODIFICATION_TYPE_COPY); MLX5_SET(copy_action_in, action_ptr, src_field, attr->registers[MLX5DR_ACTION_NAT64_REG_CONTROL]); - MLX5_SET(copy_action_in, action_ptr, dst_field, ttl_field); + MLX5_SET(copy_action_in, action_ptr, dst_field, tos_field); MLX5_SET(copy_action_in, action_ptr, src_offset, 24); - MLX5_SET(copy_action_in, action_ptr, length, 8); + MLX5_SET(copy_action_in, action_ptr, length, tos_size); action_ptr += MLX5DR_ACTION_DOUBLE_SIZE; + if (ecn) { + MLX5_SET(copy_action_in, action_ptr, action_type, MLX5_MODIFICATION_TYPE_NOP); + action_ptr += MLX5DR_ACTION_DOUBLE_SIZE; + + MLX5_SET(copy_action_in, action_ptr, action_type, MLX5_MODIFICATION_TYPE_COPY); + MLX5_SET(copy_action_in, action_ptr, src_field, + attr->registers[MLX5DR_ACTION_NAT64_REG_CONTROL]); + MLX5_SET(copy_action_in, action_ptr, dst_field, ecn); + MLX5_SET(copy_action_in, action_ptr, src_offset, 24 + tos_size); + MLX5_SET(copy_action_in, action_ptr, length, MLX5DR_ACTION_NAT64_ECN_SIZE); + action_ptr += MLX5DR_ACTION_DOUBLE_SIZE; + } + MLX5_SET(copy_action_in, action_ptr, action_type, MLX5_MODIFICATION_TYPE_NOP); action_ptr += MLX5DR_ACTION_DOUBLE_SIZE; diff --git a/drivers/net/mlx5/hws/mlx5dr_action.h b/drivers/net/mlx5/hws/mlx5dr_action.h index faea6bb1f4..ba4ce55228 100644 --- a/drivers/net/mlx5/hws/mlx5dr_action.h +++ b/drivers/net/mlx5/hws/mlx5dr_action.h @@ -79,6 +79,8 @@ enum { MLX5DR_ACTION_NAT64_IPV4_HEADER = 5, MLX5DR_ACTION_NAT64_IPV6_VER = 0x60000000, MLX5DR_ACTION_NAT64_IPV4_VER = 0x45000000, + MLX5DR_ACTION_NAT64_TTL_DEFAULT_VAL = 64, + MLX5DR_ACTION_NAT64_ECN_SIZE = 2, }; /* 3 stages for the nat64 action */