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 D5EB342C9E; Tue, 13 Jun 2023 07:29:13 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C3E2F4161A; Tue, 13 Jun 2023 07:29:13 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2075.outbound.protection.outlook.com [40.107.244.75]) by mails.dpdk.org (Postfix) with ESMTP id 0EF4941149 for ; Tue, 13 Jun 2023 07:29:12 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cxFat+pNIo26nM7SI1IpBc31uqj0z/KYDzAcIFQQTR1a3NjrHT79MzldtQZe/H733DTefXLvg9+YVxseP4l7w5PFRJzyu8lehbacTtTYVQLYtBl7Q3tliqUi0ogdQVUwk2kYFOxX2z279D3HOYnY8udm9gGLHycw+kmSglvx2ooWjRJThq7N1CN/112ntvN9JiqcTIBQtxArjbuIL0upSiQ3m48Jmc7BqYf894KBa5hhaM/qxCP7+WrvKFVbCIqMX4nthIQ/jHXWhi0i9YDiVciJx4UwqACRdZx6M5cNtZcIRZElOar28sh99BIQSImPTuO8dapztR2cEQ9Hjstuiw== 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=MDB1MaIgJnG/Sb1HLig5uXupeEjQpQ1CFhPj43f+5wE=; b=KfR/kTO3DW4CwzF3ZcKNrfKWD2v9vgAwb5/jxkE3mssVZ722QtWC7hHi/MC5riU7a7Lp7+HKmMIN0apf6Pzt2gYKxH0KYcF3/CdEJHu6/T3EjjPWS8GGG/28t3GB3qH3HUxFeNxN3GztRcJOBdHL5EMGtXNOg/y33Qw8GCC1Phz+vmD74H7g1tCvfQFmDphRasVG1Nc53fIgHitmcxa6umx+8IiJYC3y5hrTdn2OwNLAdHa2ktIQ2clKuHes+h/jVooZOhKV8NlByx6x4T+gf8kB2gDDxNT9ly8ZP37vQ6rP+Sh5LtgUuger4vKSKSJf2OV7okQ/+BdNx42BgBYcWg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=dpdk.org 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 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=MDB1MaIgJnG/Sb1HLig5uXupeEjQpQ1CFhPj43f+5wE=; b=aCqoe+MQjWYVCPaekLrxMJEqygaJjUQYu6NISM8BSttQ01tFyw5dB+oJiqpvIgdjgGiZy3OXmfKdarsJ/GFHv8DFnwdkasSFNN+hV99cg1xJP9PIAHkQCVkILChk3Twb+86n2F42za0iiKGHKQc8r6LtKhhLSXhmwAuhNp0Q9WpM2QQDfydGBzCCyqSodcu1uk8kM1ht2QBg10nMu5bWpsQtOx3xya8yADcoZQl45gPD2t4GS/EQhwktXlSsQbNeg2xj2PbWmcM1mQvxY5H8XPcDZl2yYa342KMblE+is8xqUZSZyW8nTDc3zvOmL11O21WO6z/BCR1qs2rVEY5QPw== Received: from DM6PR17CA0013.namprd17.prod.outlook.com (2603:10b6:5:1b3::26) by SA1PR12MB7295.namprd12.prod.outlook.com (2603:10b6:806:2b6::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Tue, 13 Jun 2023 05:29:10 +0000 Received: from DM6NAM11FT010.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1b3:cafe::66) by DM6PR17CA0013.outlook.office365.com (2603:10b6:5:1b3::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.34 via Frontend Transport; Tue, 13 Jun 2023 05:29:10 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) 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.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by DM6NAM11FT010.mail.protection.outlook.com (10.13.172.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.22 via Frontend Transport; Tue, 13 Jun 2023 05:29:09 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 12 Jun 2023 22:29:01 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail202.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 12 Jun 2023 22:29:01 -0700 Received: from nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37 via Frontend Transport; Mon, 12 Jun 2023 22:28:59 -0700 From: Bar Neuman To: CC: , , , , Subject: [PATCH 2/2] net/mlx5: add support for send to kernel over HWS Date: Tue, 13 Jun 2023 05:28:10 +0000 Message-ID: <20230613052810.4052102-2-bneuman@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230613052810.4052102-1-bneuman@nvidia.com> References: <20230613052810.4052102-1-bneuman@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT010:EE_|SA1PR12MB7295:EE_ X-MS-Office365-Filtering-Correlation-Id: 4216b10b-2252-4626-ace9-08db6bcf1d20 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SbVn8R0Z7yK8ywHZN5oeKeCDiOAEk9b600m08M0f6n+cleIyOT3dhU+GQaykWHAZJNZj5H6QeqiSA3DqIkt2boObW0jt/5gxM1TUcEz/+H9g+CYuSTqvklisn6rOGJtn7Bh52MQmx5haye5vxzNGuRZV3rleee/bEXSiLquGHXep4/nUW3nOGy0VbW82mVD9Pl+AG56LS/pI+9DkonCy65Dz8GVuve2tg2Ph5uUh9TmXdRqN4qliD1VVmkLqai63ayA+md4IxRDVkfCyolG+fhZUvPKjoCrBMNeKLWPk/6k7dSJRpvw4NyKGepwVip9Gk7M7B7DozTJ794AedihcbsJ4zYxIxL5544mejF9QqzIuAsjl+7B42VTnn0DjkxaboK698V5At/H3ki5G98huA12gVIn1ufxh7oB5+e8IrD9WGFv9pM8XTNJeimKnL3I9nW47fOnT8qkRxvINxShyq3YPn5tSXCb1jUbmGWSaGyD6kTNNiRe9APxVLvBj8Nbnc9aNBrS1k6xY9CR0g0RDvaWKg+z2jKTvP+QRkgYBWrFhDe4L4DlHQ9+7rTpIwB5e8PAlf9jwqTO+8c7WeRnovkP5uaTQVxhP5MSiDkV7MMRcm0hLBxQN9GcHqSnbYtb95o3QxWnnyvP2bNpOqoq8/mQg3W+UhxKMK0bi+SkbTMp9BKmJAx1V4XlxcxHrzrCHGp+5jnsGbE9XHEROL7JrSeiEQ5jvx0noMT6qKQZlwSr1dsl3TmqhG7PQ+HTDYyBZpWKggIFIPC64z5DeQtQyKmRHzsM8r21OdX8g07PGWAQ= X-Forefront-Antispam-Report: CIP:216.228.118.233; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc7edge2.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(396003)(39860400002)(136003)(346002)(376002)(451199021)(36840700001)(40470700004)(46966006)(186003)(40460700003)(82740400003)(6666004)(7696005)(40480700001)(26005)(107886003)(55016003)(36860700001)(83380400001)(426003)(47076005)(36756003)(336012)(1076003)(6286002)(2616005)(54906003)(316002)(86362001)(82310400005)(6916009)(70206006)(5660300002)(4326008)(8676002)(8936002)(70586007)(2906002)(356005)(41300700001)(7636003)(478600001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2023 05:29:09.2890 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4216b10b-2252-4626-ace9-08db6bcf1d20 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.118.233]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT010.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7295 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 Added hws send to kernel action and root tbl in mlx5_priv. Initialized in hws configure and used in hws actions translate. Signed-off-by: Bar Neuman --- drivers/net/mlx5/mlx5.h | 2 ++ drivers/net/mlx5/mlx5_flow_hw.c | 59 +++++++++++++++++++++++++++++++-- 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 021049ad2b..c3f1a49f86 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -1852,6 +1852,8 @@ struct mlx5_priv { struct mlx5dr_action *hw_drop[2]; /* HW steering global tag action. */ struct mlx5dr_action *hw_tag[2]; + /* HW steering global send to kernel action. */ + struct mlx5dr_action *hw_send_to_kernel; /* HW steering create ongoing rte flow table list header. */ LIST_HEAD(flow_hw_tbl_ongo, rte_flow_template_table) flow_hw_tbl_ongo; struct mlx5_indexed_pool *acts_ipool; /* Action data indexed pool. */ diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index f17a2a0522..74985009df 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -1620,8 +1620,18 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev, refmt_type = MLX5DR_ACTION_REFORMAT_TYPE_TNL_L2_TO_L2; break; case RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL: - DRV_LOG(ERR, "send to kernel action is not supported in HW steering."); - goto err; + flow_hw_translate_group(dev, cfg, attr->group, + &target_grp, error); + if (target_grp == 0) { + __flow_hw_action_template_destroy(dev, acts); + return rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ACTION, + NULL, + "Send to kernel action on root table is not supported in HW steering mode"); + } + action_pos = at->actions_off[actions - at->actions]; + acts->rule_acts[action_pos].action = priv->hw_send_to_kernel; + break; case RTE_FLOW_ACTION_TYPE_MODIFY_FIELD: err = flow_hw_modify_field_compile(dev, attr, action_start, actions, masks, acts, &mhdr, @@ -4031,6 +4041,7 @@ flow_hw_template_expand_modify_field(struct rte_flow_action actions[], case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP: case RTE_FLOW_ACTION_TYPE_RAW_ENCAP: case RTE_FLOW_ACTION_TYPE_DROP: + case RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL: case RTE_FLOW_ACTION_TYPE_JUMP: case RTE_FLOW_ACTION_TYPE_QUEUE: case RTE_FLOW_ACTION_TYPE_RSS: @@ -4179,6 +4190,21 @@ mlx5_flow_hw_actions_validate(struct rte_eth_dev *dev, /* TODO: Validation logic */ action_flags |= MLX5_FLOW_ACTION_JUMP; break; +#ifdef HAVE_MLX5DV_DR_ACTION_CREATE_DEST_ROOT_TABLE + case RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL: + if (priv->shared_host) + return rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ACTION, + action, + "action not supported in guest port"); + if (!priv->hw_send_to_kernel) + return rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ACTION, + action, + "action is not available"); + action_flags |= MLX5_FLOW_ACTION_SEND_TO_KERNEL; + break; +#endif case RTE_FLOW_ACTION_TYPE_QUEUE: /* TODO: Validation logic */ action_flags |= MLX5_FLOW_ACTION_QUEUE; @@ -4320,6 +4346,7 @@ static enum mlx5dr_action_type mlx5_hw_dr_action_types[] = { [RTE_FLOW_ACTION_TYPE_CONNTRACK] = MLX5DR_ACTION_TYP_ASO_CT, [RTE_FLOW_ACTION_TYPE_OF_POP_VLAN] = MLX5DR_ACTION_TYP_POP_VLAN, [RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN] = MLX5DR_ACTION_TYP_PUSH_VLAN, + [RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL] = MLX5DR_ACTION_TYP_DEST_ROOT, }; static int @@ -5721,6 +5748,30 @@ flow_hw_free_vport_actions(struct mlx5_priv *priv) priv->hw_vport = NULL; } +static void +flow_hw_create_send_to_kernel_actions(struct mlx5_priv *priv __rte_unused) +{ +#ifdef HAVE_MLX5DV_DR_ACTION_CREATE_DEST_ROOT_TABLE + priv->hw_send_to_kernel = + mlx5dr_action_create_dest_root(priv->dr_ctx, + MLX5_HW_LOWEST_PRIO_ROOT, + MLX5DR_ACTION_FLAG_HWS_RX); + if (!priv->hw_send_to_kernel) { + DRV_LOG(WARNING, "Unable to create HWS send to kernel action"); + return; + } +#endif +} + +static void +flow_hw_destroy_send_to_kernel_action(struct mlx5_priv *priv) +{ + if (priv->hw_send_to_kernel) { + mlx5dr_action_destroy(priv->hw_send_to_kernel); + priv->hw_send_to_kernel = NULL; + } +} + /** * Create an egress pattern template matching on source SQ. * @@ -7584,6 +7635,8 @@ flow_hw_configure(struct rte_eth_dev *dev, goto err; } } + if (!priv->shared_host) + flow_hw_create_send_to_kernel_actions(priv); if (port_attr->nb_conn_tracks || (host_priv && host_priv->hws_ctpool)) { mem_size = sizeof(struct mlx5_aso_sq) * nb_q_updated + sizeof(*priv->ct_mng); @@ -7646,6 +7699,7 @@ flow_hw_configure(struct rte_eth_dev *dev, priv->hws_cpool = NULL; } mlx5_flow_quota_destroy(dev); + flow_hw_destroy_send_to_kernel_action(priv); flow_hw_free_vport_actions(priv); for (i = 0; i < MLX5_HW_ACTION_FLAG_MAX; i++) { if (priv->hw_drop[i]) @@ -7726,6 +7780,7 @@ flow_hw_resource_release(struct rte_eth_dev *dev) mlx5dr_action_destroy(priv->hw_tag[i]); } flow_hw_destroy_vlan(dev); + flow_hw_destroy_send_to_kernel_action(priv); flow_hw_free_vport_actions(priv); if (priv->acts_ipool) { mlx5_ipool_destroy(priv->acts_ipool); -- 2.25.1