From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7CE5C43C2C; Wed, 28 Feb 2024 16:11:20 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0AA14433FD; Wed, 28 Feb 2024 16:11:17 +0100 (CET) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2043.outbound.protection.outlook.com [40.107.237.43]) by mails.dpdk.org (Postfix) with ESMTP id D6323433F5 for ; Wed, 28 Feb 2024 16:11:15 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GMRP5Mw3LnF1KfsB8jcxN9yg77p8kseHjHqswsn0J88Mg5pHyLjEwB1YD68/cTb4e6ZUVOnLwLnWVN4TlenSwu5s7Po3S7G8vWSOSxWDfFalbYnzJb+BA9/q1iCpIQ/3t49G78q+/VcAuylMynrP4hu61uQd6BCcyz7QHXHjFsBTlIgpbdcNjWyGdjOPDP1E5Ab89fYcRdJNZfJhxGLkRDYqHnNsPGoBE0jPWxi32laY0j2fIyo7LU+LrE8xLwhby1NP0xzr5iV7IwAegCqxi7JrbG6zFJE+mJ4sd8D5Pw8IeN+usfkxfCEjKuQbUv7DZLqvZMvAEaTUe7b9TRsTdA== 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=aE/jITWYsW5bGskODIUeTEHbBmt5NWzVpqdsFHBascQ=; b=ZN6T3mWDUgzYomjwaCVsR8QFDGZb9fZWqXxvZid7wsWrZuHJP718ByKRKYIOT0RpcTdCjK5UIv/NxRCE80vf3aPjzMSIzFR4t1sDkFVRu86Y1I1I1Z7igWSoUqvxefY7ySDpIZK5J/UbRlKASszDnMn5M41zZjVCSWzbwEWRizdbYcm1u3dlgJeFQpAbk2nHGB2/JbwqyTBTyLFBGBzTXuYTBOt5oAJEkAm94SdgcU+SE+tihE1JuS4H50OMH1WyeqcVvcQDRwuO4Ev18DbnrSyxjqT6Kxjqu/7zm5eau1SOM2N4rVmwOzafcDSmbFztkr5EvX/eYZZIZYWNc98tKQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=intel.com 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=aE/jITWYsW5bGskODIUeTEHbBmt5NWzVpqdsFHBascQ=; b=ZxGKpxsk9DEGCfYmeb49DfHzQykCJoHkfi/1qYuLOn+IQv4BhSHSQeFuR1Y7JNUIZ/b7y4rVBte3wVJIeSS5YJ0D6WQPkNWHMqWQ/LVN3Af8i/hRZp2ZsaEn/+dSH2XoUxS+mmH7EV/1i9K9ysEnj23BH7rHDj3Wg1d9i6//6wJtVmaXZP/5u1XeeqamIZmDp/Q6oqml8QeDeeqlsfuQGRV3aeYoyfR0VQCi2mS+eZ3BwGnouM/av9W2dWDct6wCI/bQgPCyhUd8t+OplOWrA65Y727oWBTJfXZXLlt+Q/W6OV7HUhYXE23nWnhvxwqyN/fNEIKC5zhcZXQpLi7Cog== Received: from DS7PR03CA0137.namprd03.prod.outlook.com (2603:10b6:5:3b4::22) by DM4PR12MB5198.namprd12.prod.outlook.com (2603:10b6:5:395::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.39; Wed, 28 Feb 2024 15:11:11 +0000 Received: from DS1PEPF00017096.namprd05.prod.outlook.com (2603:10b6:5:3b4:cafe::cf) by DS7PR03CA0137.outlook.office365.com (2603:10b6:5:3b4::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.49 via Frontend Transport; Wed, 28 Feb 2024 15:11:11 +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 DS1PEPF00017096.mail.protection.outlook.com (10.167.18.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.25 via Frontend Transport; Wed, 28 Feb 2024 15:11:10 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Wed, 28 Feb 2024 07:10:47 -0800 Received: from nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Wed, 28 Feb 2024 07:10:43 -0800 From: Bing Zhao To: , , , , , , , , , CC: , Subject: [PATCH v4 2/5] net/mlx5: fetch the available registers for NAT64 Date: Wed, 28 Feb 2024 17:09:10 +0200 Message-ID: <20240228150913.32603-3-bingz@nvidia.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240228150913.32603-1-bingz@nvidia.com> References: <20231227090731.2569427-1-bingz@nvidia.com> <20240228150913.32603-1-bingz@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF00017096:EE_|DM4PR12MB5198:EE_ X-MS-Office365-Filtering-Correlation-Id: 8ab94374-d26b-4d2e-05ae-08dc386f7f75 X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IPER8UJ+hK2rXQ6alPRLYMImzBK9jrtBezkVh+gbROHMbCeLgz/86v3kYdjt3vxcScWHhwHHiZ8uumZIR0cY7t26oapqQfixMEr4quWZaP620oTGxN+GXdbR89cuXkNeHcoOCYWoY0TTHLcnZZDNT9ll/YXkiA7GBjtsN7njGpdi3n4rn4wte4kyUOFRNZyfZte32nPIrPV5PfSNVvkb/amcp/9tY9K1V9/mAPKsMxCidBbDBs/IHzErKoBBqSZEhKodKyQLrkB7OX4DfLHCu3/m2NfFUeKRZFln2bqN+iXWh7Ou3ixaB5yg0z6J7FDcMr+VOZAaSkpDjUSE7DHqwh8awJ9FT8G1C+31dj5QHns4OfhIW+N/s85Tp6AoYdXbpgryfvXN5LG91oA8/IC/R3nt9AkJMqZwMlA/0UoVVz/BfCN2v1fUWRapZ93wOckN4rMwoxIzPZm1gBM/k7vzacf1mkPbTHEDuFMJR5UHZjIG1QwEF890RmkgEqqWFdD4/rylShzrLTGRe+bUFkIjlWn5llpvsvOFz/cr+YlHwjFOyl8QTpIQzazm5XmaEcpDUTcc2TxMzVF7F/azT71r1G0DWAQqkMsOkrWUmOhINw3IDfYzvSNjVnQZEMv4nZT1kz9OZfWMbnhxn58Glgxt3WUc4d0gBvse1IR25yff7Qp2TWrzpXe814DXK7+Mr0lQkKTxxQz/4nlYnEac9mlRNXGOPCIa7gwACVGiqD6qtNEJMvDjGQKqQ0nqILR0gmoEXkuG6q7KxuBccqnUu4WPBg== 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:(13230031)(82310400014)(36860700004)(921011); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Feb 2024 15:11:10.6293 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8ab94374-d26b-4d2e-05ae-08dc386f7f75 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: DS1PEPF00017096.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5198 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 REG_C_6 is used as the 1st one and since it is reserved internally by default, there is no impact. The remaining 2 registers will be fetched from the available TAGs array from right to left. They will not be masked in the array due to the fact that not all the rules will use NAT64 action. Signed-off-by: Bing Zhao --- drivers/net/mlx5/mlx5.c | 9 +++++++++ drivers/net/mlx5/mlx5.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index f2ca0ae4c2..cc7cd6adf5 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1644,6 +1644,15 @@ mlx5_init_hws_flow_tags_registers(struct mlx5_dev_ctx_shared *sh) if (!!((1 << i) & masks)) reg->hw_avl_tags[j++] = mlx5_regc_value(i); } + /* + * Set the registers for NAT64 usage internally. REG_C_6 is always used. + * The other 2 registers will be fetched from right to left, at least 2 + * tag registers should be available. + */ + MLX5_ASSERT(j >= (MLX5_FLOW_NAT64_REGS_MAX - 1)); + reg->nat64_regs[0] = REG_C_6; + reg->nat64_regs[1] = reg->hw_avl_tags[j - 2]; + reg->nat64_regs[2] = reg->hw_avl_tags[j - 1]; } static void diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 99850a58af..ee17a30454 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -1407,10 +1407,12 @@ struct mlx5_hws_cnt_svc_mng { }; #define MLX5_FLOW_HW_TAGS_MAX 12 +#define MLX5_FLOW_NAT64_REGS_MAX 3 struct mlx5_dev_registers { enum modify_reg aso_reg; enum modify_reg hw_avl_tags[MLX5_FLOW_HW_TAGS_MAX]; + enum modify_reg nat64_regs[MLX5_FLOW_NAT64_REGS_MAX]; }; #if defined(HAVE_MLX5DV_DR) && \ -- 2.39.3