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 9C71C43B54; Tue, 20 Feb 2024 15:38:28 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E28C14067C; Tue, 20 Feb 2024 15:38:21 +0100 (CET) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2041.outbound.protection.outlook.com [40.107.100.41]) by mails.dpdk.org (Postfix) with ESMTP id 712CD406A2 for ; Tue, 20 Feb 2024 15:38:20 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BVpoB9bnvsZVtkEN+psVV28yLInfgM4DzFp2EAJH7hMEg0SnXHE7zhomBk+lw6TMk+Dz2TTbv5CU7kuKQ4lGQq/J2XRlWSWzBXD3mKoZhEYI39Zjr+YyXG1zSomoV3qNPyG3uosqLHl6ICXm4Mbxg0RHRPhTIwbxINZqLV31As3XQFuLLM5yfqys0+BjWuS15KOJ/ol+KwC6aEC+ZqKlhhUo13wEbxtOmdwGSkkbm1fzS3/LZHQ0lFk1HfR2EoJOOZkfyvi02q9slUleYqSNoqYy66YvPi4/DKzLhqMUiUzudEQuf6KiaVpaPX5rcuBhVTVD9ujVejYK+EKn99RRww== 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=ISsGRpNSM0iS647UnSP/Z+xh3YBqvlc3068K/SCE+Qs=; b=l3nG/8ZlIj2qEAvMqnkDgNs8Qc2SZsILENMEqXHR0w6gGF9bQiUbstkne6nLDCg5gWp4KalMWWafogTBzASOQYWGbxV4XnDBRmziYv4mamIhtQhUnWIJKVUBdSt8FPeSp4lpkDm8n6qpc8gf9smodDFST+8Gcxxa4h1gJK0Z8+Q8v8aMMZ/DySWzJlvGDW20ymo8Txs4up8FBX9JZ13ut+LLeMQ9Kstl+gzzKTxYX50bL0+EaSaW3/ptNZn15kl7N5CBoqC6E1o/9TLzciiyi5YqtUIRdWxnyeDM2p4rOcjvYgKw0eIYXZU7k1jsDcy5KlfD4K3wri0mURcUJPL2Hg== 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=ISsGRpNSM0iS647UnSP/Z+xh3YBqvlc3068K/SCE+Qs=; b=dea9CM6TAgLNIh+Ss1W+U2uenbcJPZNC+JdoCd4zAEkRss0Y5bRqkDPGK2KBIMa1jn9ZH9yU1RzH9xPNR4E5FePH5w8sMq2uKj0uIA4txDDpQOL9xuSs+7uF8VI+asDifjohcLDPsVXUprSLAM0r0K5dPD1v6be+ePpvhBUG/8A+dFWsbu32PRrYeRN5rYtC9L551rQt3Zc8yoVT4zhy/B74Ry8uSTSgJhsItk6nyTzKmAhf36yDpKJxB6TeCqaGZJZbSt121fNOKFpUB4miF32q5clvQEVlaXxKflHoFJY+bS5LKc4aGjx4X0kfXsR8fhl4juYLTtAHYOWxFWEvHA== Received: from CH0PR08CA0020.namprd08.prod.outlook.com (2603:10b6:610:33::25) by MN0PR12MB5835.namprd12.prod.outlook.com (2603:10b6:208:37a::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.21; Tue, 20 Feb 2024 14:38:15 +0000 Received: from DS2PEPF0000343D.namprd02.prod.outlook.com (2603:10b6:610:33:cafe::7f) by CH0PR08CA0020.outlook.office365.com (2603:10b6:610:33::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.40 via Frontend Transport; Tue, 20 Feb 2024 14:38: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 DS2PEPF0000343D.mail.protection.outlook.com (10.167.18.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.25 via Frontend Transport; Tue, 20 Feb 2024 14:38:14 +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; Tue, 20 Feb 2024 06:38:01 -0800 Received: from nvidia.com (10.126.231.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; Tue, 20 Feb 2024 06:37:57 -0800 From: Bing Zhao To: , , , , , , , , , , Subject: [PATCH v3 2/5] net/mlx5: fetch the available registers for NAT64 Date: Tue, 20 Feb 2024 16:37:28 +0200 Message-ID: <20240220143731.295140-3-bingz@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240220143731.295140-1-bingz@nvidia.com> References: <20231227090731.2569427-1-bingz@nvidia.com> <20240220143731.295140-1-bingz@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS2PEPF0000343D:EE_|MN0PR12MB5835:EE_ X-MS-Office365-Filtering-Correlation-Id: 0ebf765c-4175-465c-a899-08dc32219220 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: fcrmXypM3ALaqGR3zIU3qe1nfn/zcCjGZue5HNUetHED8OYalCKZF74JWAKVLgarpwmCsDnfLabwb+o4YlOZJ5PJ4hlpbLcVkj6VcdJw29wbyptoZyV3QAvHDueZWtHGRQ+RdGXrs6GTsSnQ4ejfBdq84z3+Jkom/Aw13WNn4DUIyf1LgUf12jlzbSNtWIRPXxZ+Sw9Ha33gKLzvq2g0UcwgAIA2Yp0WT9CkO0Pcxj6GtZdkPHESDfm59D67fBraiCin/Yyh1lzBUQ+IKlYSB1W9mhZLrspnWyqmpN+JX9RVNavfx2VRV9HbTwil0Avp7OpCJwbXxR/aODBFysEI5ABQJmy8N73hdolypbZs0ErG+d0qVmAM7A8otPeHP2iXzeCj67sb/S7hbfF31iKYWUyO9S7xfMQR3Xavr1H10MoWYZZSIqbL4xh+PIymUJwrRJpcmpeRhrTU5GTbjOTpeolUeVU4davsVo7/g/WAZaFUnHQDVTm6SE+2cj070LXGDyNtY+cQx9W0H7tdI3u3LCjauRygYEPIeW/RTrzSVo4IgfLNOLJ1f6a1Z9VWxJBRLi3ze79A4MiLr+RsXifWoPUeP71nOARd4GxkHyGm52E0RFtKogQyz4kLX+IG4eWNyPib6UccT6jg1+Vfn3yohQyj+hHhnE3ilS47wIwBsJ0= 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)(36860700004)(40470700004)(46966006)(921011); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2024 14:38:14.5128 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0ebf765c-4175-465c-a899-08dc32219220 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: DS2PEPF0000343D.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5835 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 881c42a97a..9c3b9946e3 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 5265d1aa1f..544cf35069 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.34.1