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 3B9E4437AA; Wed, 27 Dec 2023 10:09:08 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C673240A73; Wed, 27 Dec 2023 10:08:38 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2063.outbound.protection.outlook.com [40.107.223.63]) by mails.dpdk.org (Postfix) with ESMTP id 6D00B40A73 for ; Wed, 27 Dec 2023 10:08:37 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AtYTTtUhjSzwGwvVBqtxmJfDqoO7duguRkSg7DPFI134Sq1ymUY/wUQeRIJR8gPRwtn7dTBmRSXgs8BEHrEfyfGj+x8mAqgAP8ekepM+5sePxtbcPCxUl1QoMnCQwbKf+2kLc/vikxqctxERA5i9SttBt7SEUeYzrAM3s9qBsyxs1+qWBlRsJgQFBYKlg/HnZOurToqMZGxVqv/Po5Wecz5MjAt03YFZk+xZb98nZ9D/ZwKwAPq8r1ELAFbDhJL/5kVoj/WD4bUJPgrCy0K39LouLf5dSyhMZhH9LsNo/NsrAM3ZDrkYWpAI1nekAH50BDObj4K8MpS3im94tlpbEg== 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=VC+iUozdYrY6IaDwOexwY1kOCAMuYppq1tBow85pmG4=; b=Z6JC7HlJDI7+q9cdelDZad7TyERk9L2NuhdAigMu8M2k983mBR5q6GhP2H32nPsd/VoO3dK5b9sRcJ1QaOXY3Rfs2sijperk6l7ggh7acah/e9MukaUe0Qt7i6wimJGwbs0wVBhom6QyGLDgvC5W2MlRZVipONs9iSUvUvgREx4IQ0VCuAfnv4kpsjyCawzsFs0NnYiN215Ihn2bCo7DYqBvnxjQiYhcx9R7kcsigkI5958gddnIFNfaeW5fNKzTXU9BeVa3V7vjT1+AnQgNjPfe8aHdgVAA/NV7Tt+3sKEVZ7kGV2IiA9AnxAFKidkSOhZvZcWfcygGO8isFx9tlg== 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=VC+iUozdYrY6IaDwOexwY1kOCAMuYppq1tBow85pmG4=; b=pTPDCwR1mgLSIpE0ZXpP2H9qeAf3rz2IknuQ1VNmaKQPpUobnbycIPy6/J+FUgnoGgdxhI8vhKMEFwsR4Us9wf/XvM1dgWUKtclZamW64it9qlcu+2WMBSJ3zGy0Gh8D82TG0ntWKzx973xLRLot8KbTgyNguOFBPC+Br8fVtoZ7hu8nI12Do6pNz6Fq9OqI7dwDD2SxdVjGd8vL/TNrpG5HH0ogquzcl+PAbVDJLrFerwC537y0P0S31RY1Rt9lp47a6BhPnRpNB50iELgV5CsTYlqWeYkL5IyK8y6jumGabeK4ZE1Zg+pb0l0rPFQd6qqk+PgTLgVrYNEnDTsW4g== Received: from BLAPR05CA0032.namprd05.prod.outlook.com (2603:10b6:208:335::13) by IA1PR12MB9063.namprd12.prod.outlook.com (2603:10b6:208:3a9::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.29; Wed, 27 Dec 2023 09:08:34 +0000 Received: from MN1PEPF0000ECD6.namprd02.prod.outlook.com (2603:10b6:208:335:cafe::20) by BLAPR05CA0032.outlook.office365.com (2603:10b6:208:335::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.18 via Frontend Transport; Wed, 27 Dec 2023 09:08:34 +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 MN1PEPF0000ECD6.mail.protection.outlook.com (10.167.242.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.14 via Frontend Transport; Wed, 27 Dec 2023 09:08:34 +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, 27 Dec 2023 01:08:17 -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.986.41; Wed, 27 Dec 2023 01:08:14 -0800 From: Bing Zhao To: , , , , , , , , , , , Subject: [PATCH 7/8] net/mlx5: add NAT64 action support in rule creation Date: Wed, 27 Dec 2023 11:07:30 +0200 Message-ID: <20231227090731.2569427-8-bingz@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231227090731.2569427-1-bingz@nvidia.com> References: <20231227090731.2569427-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: 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: MN1PEPF0000ECD6:EE_|IA1PR12MB9063:EE_ X-MS-Office365-Filtering-Correlation-Id: 30e86a07-8cf4-4e4e-73ac-08dc06bb67a9 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: BnBw7y5iwbzitxzfRSzDlcLkDgchc7qKyvH+m51JoDkyYPLsJDFGIqjqTM4y1tO8na6jXVRMsrkBcNrsodkHKdskchazImJJiQmI1K2HhBhTwTeV3l3yc/lzsDeN/jeyx+2+FOantpuqFEguCxi2vBFA4Cw+SYSSNp6kNBP+S1E+70SbWpfizYT8qrqw9UiahsbGIE92OGhVAQmDa+vEgtblp+1np/FpXvMaBbkz5eVLWWJkfYY5X3HnqZ3k8pW9Ct/Emea2dpLiimFQFK73WoNu1q8B717z/CBhG+a2rXVTPNvqyRiFIEVLpTxt/AXCQEOER8mPe9ybl7uS1lDYKYW0V9JBe3YLU7wFTMVjkKNS32iQOZfBnNSie4KR/T3TcZisB+joGE3Zp5G++eAXB6lF165dhvieDtxj9hxIKQcWdGnO9rysrMQoJo/aKJrvT30TDnG1mY18mYd4hFoTBJTKh+V5Xi71arq1Fc3XLi59pzcg9jD9PbSCDT3VNvOC9uGMIY3q7yx3eQrhMUf15hEvRLu4plgm+5nmGWZLW1h6igMwf1j0PKR1NfgDeIa6q/Gv2G4VdH7bDI2eU9W5oufNRASFh04rVOxtRge8c42SdAC5sXsd98veAYhzdUntxVeTrZSAeAeL5/s96prPamnunRDtrChVcM4WmoASAts7s73ZVHp9JtmkHkOF1gBmUw1U3zDd8E6VcM9ExUQhvE/dJGWK0Kl0ulWAuD6KUTdAN7c//Fwqlibb4rKv56VHSF3nnOAzNaJmn+/kyWketA== 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)(4636009)(346002)(136003)(396003)(39860400002)(376002)(230922051799003)(451199024)(82310400011)(186009)(64100799003)(1800799012)(36840700001)(40470700004)(46966006)(110136005)(6636002)(70206006)(70586007)(6666004)(7696005)(478600001)(16526019)(336012)(426003)(6286002)(36756003)(2616005)(1076003)(26005)(86362001)(55016003)(921011)(2906002)(82740400003)(5660300002)(356005)(7636003)(41300700001)(47076005)(8936002)(8676002)(40460700003)(316002)(36860700001)(40480700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2023 09:08:34.5545 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 30e86a07-8cf4-4e4e-73ac-08dc06bb67a9 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: MN1PEPF0000ECD6.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB9063 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 | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index 9b9ad8de2d..9b60233549 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -2479,6 +2479,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; @@ -2912,6 +2925,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 = { @@ -3179,6 +3193,13 @@ 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; + if (!priv->action_nat64[table->type][nat64_c->type]) + return -1; + rule_acts[act_data->action_dst].action = + priv->action_nat64[table->type][nat64_c->type]; + break; default: break; } @@ -5872,6 +5893,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.25.1