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 CFB36A09EC; Wed, 19 Oct 2022 20:41:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EB5AC42C1E; Wed, 19 Oct 2022 20:41:27 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2048.outbound.protection.outlook.com [40.107.243.48]) by mails.dpdk.org (Postfix) with ESMTP id ED42E42BF9 for ; Wed, 19 Oct 2022 20:41:25 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qg//YhJEbVHbhbrgjO1lRyX7CkiRmsk4eV3tsXSO6JTPksnnlEuR4YhVbSKvDSXdp9P82xcO52eiG4BvMs0SHp7TkGPK5yS9zdXf08sXsE3jcMSbX/oH4qfbB0qhGeOzpx95WfmaUoAI7YVgjUQt5ymvRcQqtg8cZCBIoisB9n0fbFsQunvTaMB/17qo6VTnOUZPqmH6HJz0cz2rcGT7ts8ffr56vlw2+aR7FaXLLWFe80iDbQFbcptR1Nlmdgvq+kGiA0cKNzYl/HC0KLFpni4eQ63w3QJe+s+XEasYaSZhXPjOi3DuRFaTj6OjsNaPKFshhgLF+kjToTwCUfsfoQ== 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=rWQ2tMb8Y3UVzxUakFrgIQmF0CqHUe/vttSDEis0UDM=; b=nLLD2ylMbZFAvvmgdCrH73qWpOBKSrmMiyZGp/zXtD6HaYfNMu9hbNaYdFB+Md4R1eNsIGGIUqUiR9yamWBPqLhYSzCfJFJWyzSwZ3jpc5WPXHx6N80VcPQz+6HuQrXU3egf1tz2Qt8bchARN6DYH3AIVw5I13V4qnj3fAkT8ShZUS5XGdOLt/R/afQOF2ervw3OF1N+HUO6QqSXEdz74qYG5hlc4WSWClS4JE3AT0P0Rq7infv9ouc1RPlxuYAj4QhDflHkba7PVUj7M+sP/8AitW/y6iWktZc91rZ9F39nWrpYCFYWufZ8wQuFdVZJkBNZwaBwopzfD+POsOVwgA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 216.228.117.161) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=fail (p=reject sp=reject pct=100) action=oreject 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=rWQ2tMb8Y3UVzxUakFrgIQmF0CqHUe/vttSDEis0UDM=; b=IzloorFzV2vckq0BzkSu5yjeD6bozsXQzW2GqcpfeoZkWDKYWY+FVEtcCiFvirl4Y/AXzFwQC8BMwEeei2N0OWLXOyBm6BDIUki9D7cxpiGAS1hFd5UQs8iwmuUEJo+la8YgLc37MRTi2OJI/CFuDjcXVdPDZiUy8c99t1RvF3RqvffA5QBtItssL8PEVWGNRc5mLYxmiypfcrKqgu4aFqNIPjT/qEq4LPYSP6H63pQsYKUOqq4W2AT3XALSj7GbDnIIku4hAtdF0IYGsE44Y+25gGJIqUNPGHU4urriH21aTAwtOJQSeeVThbcLwQlJcQJDxBI4spAYtrAnROdmmg== Received: from MW3PR05CA0003.namprd05.prod.outlook.com (2603:10b6:303:2b::8) by DM4PR12MB6011.namprd12.prod.outlook.com (2603:10b6:8:6b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.29; Wed, 19 Oct 2022 18:41:24 +0000 Received: from CO1NAM11FT088.eop-nam11.prod.protection.outlook.com (2603:10b6:303:2b:cafe::be) by MW3PR05CA0003.outlook.office365.com (2603:10b6:303:2b::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.6 via Frontend Transport; Wed, 19 Oct 2022 18:41:23 +0000 X-MS-Exchange-Authentication-Results: spf=none (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=fail action=oreject header.from=nvidia.com; Received-SPF: None (protection.outlook.com: nvidia.com does not designate permitted sender hosts) Received: from mail.nvidia.com (216.228.117.161) by CO1NAM11FT088.mail.protection.outlook.com (10.13.175.131) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.16 via Frontend Transport; Wed, 19 Oct 2022 18:41:23 +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.26; Wed, 19 Oct 2022 11:41:10 -0700 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.29; Wed, 19 Oct 2022 11:41:08 -0700 From: Michael Savisko To: CC: , , , , Matan Azrad Subject: [PATCH v2 1/4] common/mlx5: new glue callback for send to kernel action Date: Wed, 19 Oct 2022 21:40:04 +0300 Message-ID: <20221019184007.1032874-2-michaelsav@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20221019184007.1032874-1-michaelsav@nvidia.com> References: <20221019184007.1032874-1-michaelsav@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT088:EE_|DM4PR12MB6011:EE_ X-MS-Office365-Filtering-Correlation-Id: a20bec11-2c32-45ad-906f-08dab20185ef X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RECN+hMkUAbOBjJunNnD28uoX8NAI5jK1fShKglFR/WvH7WvWarf3TImJLWyA90A6xF0iJg51jJPvRs3yoiYoj/EBlWBHJQGZr3FbnWrOoeu82UEDRBMuykIDNaNW4VKdyN0/35yeM4ROYu8nFUloLeXWJeZdYZcV/hLJrti347CIYTUHYCm4NKV3VD/O7C/+CblZ0NXX/nmUaFdMMHxx2l7b2hQWH8nCjN7NBemMX1Khz2C5nIVFA2p1V7BXSyoQ2WpvLjOkRESO9XzWKBlSx199yBNHOfzyOF/0tOqJCu8iDKBgwIrydvXMGzzYU/JLFqlI8J52O2jBxcDXM75BgrSq6Vpn7r9g2VlUIyQ+qbMZILbjMW/tK0OdXGGhYb+54DcXwE9FkgBQSPrqRke9dT05sep2fcvbc6wXKEZJ10z2Zpw7caozQItucGa6X8ir8qZ27VxmYPM5Vm+IZ+dG6SMN0QQ4g2WgZdE8pDnq5pnaF1ZSr4UcP2sPar7+oMQ1SOrvvR99eM3rEyFKbGhMniQV7qzhcXwZKUsdTZGW6G1LGAX8wKifpMNvaeNfQiTs5z4KPpdEWyCCltId/6g2YBLDSn+Ajbej+c2cN9j9ivpZnXkHiewOpawwbFK3eKBdHScD+xLbkoPU3YiF1o4cZgsRDi17JQvKKDjAVdvyylW8UJxLcHwJSneLg56AgmeHo8H0dLNySDjLA0p6Pg6nCPrEQj8gm76TUmBOb+je74Bi5LP+RaQKRBbRzUctnzZoN3+XHQqG0brkc4mrY+xWw== 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:(13230022)(4636009)(39860400002)(136003)(376002)(346002)(396003)(451199015)(36840700001)(40470700004)(46966006)(2616005)(6286002)(36860700001)(40480700001)(107886003)(26005)(6666004)(7696005)(478600001)(83380400001)(336012)(1076003)(16526019)(186003)(5660300002)(40460700003)(55016003)(82310400005)(6916009)(54906003)(4326008)(316002)(70206006)(41300700001)(8936002)(8676002)(70586007)(47076005)(426003)(86362001)(36756003)(7636003)(356005)(82740400003)(2906002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2022 18:41:23.6252 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a20bec11-2c32-45ad-906f-08dab20185ef 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: CO1NAM11FT088.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6011 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 Add new glue callback dr_create_flow_action_send_to_kernel. Default callback invokes mlx5dv_dr_action_create_dest_root_table(). Add static inline mlx5_flow_os_create_flow_action_send_to_kernel(), which calls dr_create_flow_action_send_to_kernel glue callback. Define HAVE_MLX5DV_DR_ACTION_CREATE_DEST_ROOT_TABLE macro if function mlx5dv_dr_action_create_dest_root_table exists in infiniband/mlx5dv.h Signed-off-by: Michael Savisko Acked-by: Matan Azrad --- drivers/common/mlx5/linux/meson.build | 2 ++ drivers/common/mlx5/linux/mlx5_glue.c | 17 +++++++++++++++++ drivers/common/mlx5/linux/mlx5_glue.h | 2 ++ drivers/net/mlx5/linux/mlx5_flow_os.h | 22 ++++++++++++++++++++++ drivers/net/mlx5/windows/mlx5_flow_os.h | 24 ++++++++++++++++++++++++ 5 files changed, 67 insertions(+) diff --git a/drivers/common/mlx5/linux/meson.build b/drivers/common/mlx5/linux/meson.build index e77b46d157..b044f95700 100644 --- a/drivers/common/mlx5/linux/meson.build +++ b/drivers/common/mlx5/linux/meson.build @@ -213,6 +213,8 @@ has_sym_args = [ 'ibv_reg_mr_iova' ], [ 'HAVE_MLX5_IBV_IMPORT_CTX_PD_AND_MR', 'infiniband/verbs.h', 'ibv_import_device' ], + [ 'HAVE_MLX5DV_DR_ACTION_CREATE_DEST_ROOT_TABLE', 'infiniband/mlx5dv.h', + 'mlx5dv_dr_action_create_dest_root_table' ], ] if libmtcr_ul_found has_sym_args += [ diff --git a/drivers/common/mlx5/linux/mlx5_glue.c b/drivers/common/mlx5/linux/mlx5_glue.c index 450dd6a06a..b954df0784 100644 --- a/drivers/common/mlx5/linux/mlx5_glue.c +++ b/drivers/common/mlx5/linux/mlx5_glue.c @@ -1434,6 +1434,21 @@ mlx5_glue_dv_free_pp(struct mlx5dv_pp *pp) #endif } +static void * +mlx5_glue_dr_create_flow_action_send_to_kernel(void *tbl, uint16_t priority) +{ +#ifdef HAVE_MLX5DV_DR_ACTION_CREATE_DEST_ROOT_TABLE + struct mlx5dv_dr_table *table = (struct mlx5dv_dr_table *)tbl; + + return mlx5dv_dr_action_create_dest_root_table(table, priority); +#else + RTE_SET_USED(tbl); + RTE_SET_USED(priority); + errno = ENOTSUP; + return NULL; +#endif +} + __rte_cache_aligned const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue) { .version = MLX5_GLUE_VERSION, @@ -1561,4 +1576,6 @@ const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue) { .dv_free_var = mlx5_glue_dv_free_var, .dv_alloc_pp = mlx5_glue_dv_alloc_pp, .dv_free_pp = mlx5_glue_dv_free_pp, + .dr_create_flow_action_send_to_kernel = + mlx5_glue_dr_create_flow_action_send_to_kernel, }; diff --git a/drivers/common/mlx5/linux/mlx5_glue.h b/drivers/common/mlx5/linux/mlx5_glue.h index c4903a6dce..9616dfdd06 100644 --- a/drivers/common/mlx5/linux/mlx5_glue.h +++ b/drivers/common/mlx5/linux/mlx5_glue.h @@ -373,6 +373,8 @@ struct mlx5_glue { void *(*dv_create_flow_action_aso) (struct mlx5dv_dr_domain *domain, void *aso_obj, uint32_t offset, uint32_t flags, uint8_t return_reg_c); + void *(*dr_create_flow_action_send_to_kernel)(void *tbl, + uint16_t priority); }; extern const struct mlx5_glue *mlx5_glue; diff --git a/drivers/net/mlx5/linux/mlx5_flow_os.h b/drivers/net/mlx5/linux/mlx5_flow_os.h index bcb48b3e56..ed71289322 100644 --- a/drivers/net/mlx5/linux/mlx5_flow_os.h +++ b/drivers/net/mlx5/linux/mlx5_flow_os.h @@ -368,6 +368,28 @@ mlx5_flow_os_create_flow_action_default_miss(void **action) return (*action) ? 0 : -1; } +/** + * Create flow action: send_to_kernel. + * + * @param[in] tbl + * Pointer to destination root table. + * @param[in] priority + * Priority to which traffic will arrive. + * @param[out] action + * Pointer to a valid action on success, NULL otherwise. + * + * @return + * 0 on success, or -1 on failure and errno is set. + */ +static inline int +mlx5_flow_os_create_flow_action_send_to_kernel(void *tbl, uint16_t priority, + void **action) +{ + *action = mlx5_glue->dr_create_flow_action_send_to_kernel(tbl, + priority); + return (*action) ? 0 : -1; +} + /** * Create flow action: dest_devx_tir * diff --git a/drivers/net/mlx5/windows/mlx5_flow_os.h b/drivers/net/mlx5/windows/mlx5_flow_os.h index 347ec64580..1c1c17fc41 100644 --- a/drivers/net/mlx5/windows/mlx5_flow_os.h +++ b/drivers/net/mlx5/windows/mlx5_flow_os.h @@ -326,6 +326,30 @@ mlx5_flow_os_create_flow_action_default_miss(void **action) return 0; } +/** + * Create flow action: send_to_kernel. + * + * @param[in] tbl + * Pointer to destination root table. + * @param[in] priority + * Priority to which traffic will arrive. + * @param[out] action + * Pointer to a valid action on success, NULL otherwise. + * + * @return + * 0 on success, or -1 on failure and errno is set. + */ +static inline int +mlx5_flow_os_create_flow_action_send_to_kernel(void *tbl, uint16_t priority, + void **action) +{ + RTE_SET_USED(tbl); + RTE_SET_USED(priority); + *action = NULL; + rte_errno = ENOTSUP; + return -rte_errno; +} + /** * Create flow action: sampler * -- 2.27.0