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 1391443C2C; Wed, 28 Feb 2024 16:11:43 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0CA7C43409; Wed, 28 Feb 2024 16:11:28 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2071.outbound.protection.outlook.com [40.107.94.71]) by mails.dpdk.org (Postfix) with ESMTP id 306D643401 for ; Wed, 28 Feb 2024 16:11:20 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=muJTnyvBJTYvvA3hwf+UCDgofAxw9oorc8eJ1TSBfF1erqB3G+lcOIoZM8CkWG8GYoZtpbhDzvUOG7Unz94G04xloCE9Z2h7mLD6p7ugQT4T1PZHOCKfbDsogHh2j5aPB2HDRXVn0c0UA5gRc0b4Jk3zcVayMxjQOYYea7xIIBQg7kU9s4kYqT9MCaQhaXEsvMARNTJXQ53ZK6HYDCwA9ocDmVIVstYnpTOJP6tVvMSK4rXp4XZRfAFqhmB/9EeQZVdYgiS2M/8uBUDpgOsGI74koCRPxfKfzPYvC0zZgyve5tmgCxIaJnw8SbQ5mtj0ALGCWpwmlsEKlnDS1BneAA== 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=V4Rz9qzfqJpMrDqQBpFnRVnY3a1v2T1g0vpDlpXawrY=; b=JeMiKEsqcJTnz7XRk5V6hQ2o0/3YxJQvKue54OQtH7MIwaknXg7WO6y2co21NRlDHEVodNRplQ+uKlE8yWyQsk7D/EwF5NCmR3wN26YIGHtTiCRcnzv6jMBqsykvoTKX65mqCL8gMLxprpKC3GkYL+kAKbneipT5tVz0I91lC5XhFk3jq4jc+oRpn1ZdMwa8Rt6d5O5iNLRRyIv7sQR8f9KW1Dp0bXfFhEy3Wquii3VpqOs4N2Qc3HRbST+ympV6lqRz8bMflICewKfEM8yz2dCcCIIdYjyilzxFnbkjNDFCQ0zY9eUWopjkvjcmk/ky5QVWi6etx0LUm4GH6ySSMw== 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=V4Rz9qzfqJpMrDqQBpFnRVnY3a1v2T1g0vpDlpXawrY=; b=Aoespp5AYLC7GhvuTYsAILQGxllGXjyNXpQ/wqrhpvMlW1DGbHEEyj1iOvF1CjW2ekHeZZGks6atKLWHLqhoQhzj8hyzNC/7qODmmjPxZLdmUe1K6/LcXkqBulzHMuwCvb7/wt4rC4To1y98UALR/LiGdFs1O4VslKs+wM77BgWDANZeKuWr3QmFgNkwuJUdOXS1lQFRQ4yN+sQWv5PJHNKRaZB5lWYrN5VDWXNqZPrXoS72e5pVF5IInn2ejtd4mK0PZJ74VS6CFFwGxf/jGkvTFoaSxDh89YAURUI0H24viDeC38UkmXNu+qkuPVG9xYMMwUjs45DIp1soOvPeMw== Received: from MW4PR04CA0263.namprd04.prod.outlook.com (2603:10b6:303:88::28) by MW4PR12MB6707.namprd12.prod.outlook.com (2603:10b6:303:1ee::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.34; Wed, 28 Feb 2024 15:11:15 +0000 Received: from MWH0EPF000971E6.namprd02.prod.outlook.com (2603:10b6:303:88:cafe::e6) by MW4PR04CA0263.outlook.office365.com (2603:10b6:303:88::28) 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:15 +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 MWH0EPF000971E6.mail.protection.outlook.com (10.167.243.74) 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:15 +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; Wed, 28 Feb 2024 07:10:56 -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:52 -0800 From: Bing Zhao To: , , , , , , , , , CC: , Subject: [PATCH v4 4/5] net/mlx5: add NAT64 action support in rule creation Date: Wed, 28 Feb 2024 17:09:12 +0200 Message-ID: <20240228150913.32603-5-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: MWH0EPF000971E6:EE_|MW4PR12MB6707:EE_ X-MS-Office365-Filtering-Correlation-Id: 40eb468a-902e-47ef-7a6c-08dc386f81e1 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: uc5GMNSjVF00NKMnFmueipWxghRGQnU/Ln43bLAyOYNoAm0WniKv73Dy57nD0QsrDosd3rKE5XQtpuEIR6OYLMJr1Clu6Prg+PMydHPB45ts9KkFlUMDST93HQtymX441aiPHzPZeJcYqgZWoRoGr01TWbMLcEMHaP9XiibGofDqYguvmDjfA2jti0GrbG4eUx+L4zYVebgbH4anYSLCIK7FrfMAhFzdQKpMtg4sd8kphdwdmkceLlBdh6MY38Izla6E3A+dCFw6KO2UV6mQVRLkJH5C2IAXsyCfuGDEo00HE4e8EGYPIj6jrGz5X0JARys2//cp1J59U0oWsbdZdLKwQzvI7+pYH7IKd21O39zAI2DZHoDmqk8xwr5PXUBf6c4QRseH5VnYIe/4I5ioLlfzrCArsTgt7P1gwHql53ccPwOt+dImYhmDJWhZ3CuImnGwxDvrXusC4SLLFluYEie47EuUxGdxaAocS2IJXNpp/CdFjpgU46POa530qNSStRzffSVXf+/Peq/VjCCmXXkWwjARHo685gAdxG/4ijK47og/vDSTrJ4lG6Ldak0Rn3qcER7K12MYg2Dwwf0tKMs+MMk0dKf4cBiXkqB9j0nbP0bY3dneBThyJ48G5ud4bA1dMBbMPHMk+vhG99445VCGR0xIzwn3hLBWVMiVravaj0Y/J5k+qgdSS3HBggjuXVwIcM8SFD3Ows/C2nZPqg9fEM5KvQaBhtOJXfPWdgBtHq0tq9+kTGI4DcvubBqQEfMOV0T0++e4H1rgFroPyg== 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)(82310400014)(36860700004)(921011); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Feb 2024 15:11:15.0549 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 40eb468a-902e-47ef-7a6c-08dc386f81e1 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: MWH0EPF000971E6.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6707 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 77f0aff91e..f32bdff98f 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -2499,6 +2499,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; @@ -2941,6 +2954,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 = { @@ -3208,6 +3222,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; } @@ -6099,6 +6118,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.39.3