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 4C2E543B54; Tue, 20 Feb 2024 15:38:49 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C2D0840A7A; Tue, 20 Feb 2024 15:38:32 +0100 (CET) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2043.outbound.protection.outlook.com [40.107.100.43]) by mails.dpdk.org (Postfix) with ESMTP id 4F52040289 for ; Tue, 20 Feb 2024 15:38:30 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OWasg0awVSV+kqDWbCsocKeL1bA9+d179Dg5EieiJFv0t6WOpWqWtw6Rk8FHr3E/O8SFaC/wzzdI7jv+qnZ56IAhIbeWH86P0NpCZz3ZkCW7QzC3dy5+2tGrQDJw0A45i4P5GCXk1tU3TrIWC/u5I83E8xx3ACLcWNUXnV/mO4NmaAYPiX4D+fYD44ncaV82ckOfM/IH/dHNucbYXrAuNCuHtIuBeFVMWgn0kM8KDHigsyq86QyHnVOm+Q0oI0tpRWlEhTPBrSMa5AsmjMbNYZhfBD5C01ctlf0xAUoHZWDcuEB3IlF6N4LqH1xkTjox8Wj1tJ8cqa2V9NvUa6t2wA== 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=LXC2v1SqOWdKAll7LLME0u7OrsP8hxDoBFqYDi92bWY=; b=oYnYNuG+STCiGjZ/RXigUHcK8147l5hTI7ZQTBg4Utr0W0AkC/CJo8nPYXIW8PpD47LklsUB0CXYjzbFrL/SdKkMVT80iMRzywjIoqB6LKP0LH9/OKpozzwsxubw37yJwFP5uo/q6nhXO6sDYEVNGAJVxb9FA7ebNFkI1cizVB0/x8I5h2yDyduIXMj77lN0VLStbq5y6YHfsXkrpj3VDBMpXD1akY6UWI2YWZk+0voY40+pKPdqSZn8nXsDQmK0e1vC1KSVRK7nMurIeuV/HrRUrwV3kTpHtYT/Fr5nWy1br2tQKgO1hMqZk7Hrgdejl+Vr0vzXCr9nbqUSz7QWow== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) 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=LXC2v1SqOWdKAll7LLME0u7OrsP8hxDoBFqYDi92bWY=; b=RI/hS6/i2bpVZjzcRUOncU/RK5M+cHoGaNbACpOk+J8ENT5JDvn9BJfgwn/h5PvCn6NS/BhIOe8lwLa7SAPG8kaarU8Kyd6NVZt8Px6oo1m6lkiKxA/eavPIwvPcpDnY35/KLecrrJ4VDPO0U0W11XAZG1VxfLbtiWEPUzdZE0rxWTrf0JLmlnHiVPU3uAP+9Bhb/9vQ/+Gs5alc3c/a8fBaLvJqUAy4gPT+xkxWBB+xZTB3OWTA/co24QQ6gfCVonIogj+QvYvlDGWW1G704NN1orECnlK0bg8mybRhWibUlKJkGuNRuRUDzdcE2q/OVsXXd4ik3kvmFp0gZTHt3Q== Received: from BN9PR03CA0141.namprd03.prod.outlook.com (2603:10b6:408:fe::26) by BN9PR12MB5177.namprd12.prod.outlook.com (2603:10b6:408:11a::19) 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:26 +0000 Received: from BN2PEPF0000449F.namprd02.prod.outlook.com (2603:10b6:408:fe:cafe::e0) by BN9PR03CA0141.outlook.office365.com (2603:10b6:408:fe::26) 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:26 +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 BN2PEPF0000449F.mail.protection.outlook.com (10.167.243.150) 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:26 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 20 Feb 2024 06:38:07 -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:38:03 -0800 From: Bing Zhao To: , , , , , , , , , , Subject: [PATCH v3 4/5] net/mlx5: add NAT64 action support in rule creation Date: Tue, 20 Feb 2024 16:37:30 +0200 Message-ID: <20240220143731.295140-5-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: BN2PEPF0000449F:EE_|BN9PR12MB5177:EE_ X-MS-Office365-Filtering-Correlation-Id: ab8cd656-35dc-4010-d636-08dc32219956 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: fTEfn/Bab+540rR2QNOuh3KhgL2jrp167rTqMP400Tfi58r+oNv56oyW50qazk8nEAfxPLcQYneYZCJxqmZqa0cyP1TeKYC72Qf6hUmEqeG0gQAd1HvfJi057AdN7I5WhcgWd6VF1BKk9UpSmnCF/9BFyAcFqVYF9tf8r2mwWLg32b2kdZ3HkOohwRMvHno9dHfVb0kOi70LE4qhX4JtBPOhrAjdrG0rd+DA+Xhk4DJtNHeb1eo6pL3oNy4sQPsqCF7S2EvHmyNJ9JGna4RCQTXJSl1Epygw6bBNmcTowO0OdBLeGcmSRYM+oxxf7SDLBwhThRuoQEuOLii52JX8gbafmCiDVwYndJD0jZdgCQuznzqMW41wj8LEnKEz446ohCv5ajz/IZkQOS/dV3VQl2Tdw9PvQptAmrKuI7eZFJ6jHXjPjYD6Xfo7BH4Wnv+9iWSYcY6+8Wg0trzXg0HoFCwPrmhXojFrLQklOFhhxMKRBcE3U1E0wa6FJx/cI2AUAJ8Yk8Cmjttif62Pxj4W/afMTRXo5ndXTUI/Bgj7s1wJYQF7i1D10/hkzHjY7cFl8DraE9WU+uRa9kV3kqG869Wxw31cl4I2CSWBDpPCXgsohaxzD3xclA3qNa/dS24U1Ut5eNossRfUtdOI21dHfPzEj4yxIdAOAdBD9/cR3CE= 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:(13230031)(36860700004)(46966006)(40470700004)(921011); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2024 14:38:26.4713 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ab8cd656-35dc-4010-d636-08dc32219956 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: BN2PEPF0000449F.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5177 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 The action will handle the IPv4 and IPv6 headers translation. It will add / remove IPv6 address prefix by default. To use the user specific address, another rule to modify the addresses of the IP header is needed. Signed-off-by: Bing Zhao --- drivers/net/mlx5/mlx5_flow_hw.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index 386f6d1ae1..a2e2c6769a 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -2492,6 +2492,19 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev, } acts->rule_acts[dr_pos].action = priv->hw_def_miss; break; + case RTE_FLOW_ACTION_TYPE_NAT64: + if (masks->conf && + ((const struct rte_flow_action_nat64 *)masks->conf)->type) { + const struct rte_flow_action_nat64 *nat64_c = + (const struct rte_flow_action_nat64 *)actions->conf; + + acts->rule_acts[dr_pos].action = + priv->action_nat64[type][nat64_c->type]; + } else if (__flow_hw_act_data_general_append(priv, acts, + actions->type, + src_pos, dr_pos)) + goto err; + break; case RTE_FLOW_ACTION_TYPE_END: actions_end = true; break; @@ -2934,6 +2947,7 @@ flow_hw_actions_construct(struct rte_eth_dev *dev, const struct rte_flow_action_ethdev *port_action = NULL; const struct rte_flow_action_meter *meter = NULL; const struct rte_flow_action_age *age = NULL; + const struct rte_flow_action_nat64 *nat64_c = NULL; uint8_t *buf = job->encap_data; uint8_t *push_buf = job->push_data; struct rte_flow_attr attr = { @@ -3201,6 +3215,11 @@ flow_hw_actions_construct(struct rte_eth_dev *dev, if (ret != 0) return ret; break; + case RTE_FLOW_ACTION_TYPE_NAT64: + nat64_c = action->conf; + rule_acts[act_data->action_dst].action = + priv->action_nat64[table->type][nat64_c->type]; + break; default: break; } @@ -5959,6 +5978,7 @@ static enum mlx5dr_action_type mlx5_hw_dr_action_types[] = { [RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL] = MLX5DR_ACTION_TYP_DEST_ROOT, [RTE_FLOW_ACTION_TYPE_IPV6_EXT_PUSH] = MLX5DR_ACTION_TYP_PUSH_IPV6_ROUTE_EXT, [RTE_FLOW_ACTION_TYPE_IPV6_EXT_REMOVE] = MLX5DR_ACTION_TYP_POP_IPV6_ROUTE_EXT, + [RTE_FLOW_ACTION_TYPE_NAT64] = MLX5DR_ACTION_TYP_NAT64, }; static inline void -- 2.34.1