From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 74BB2A0527; Fri, 24 Jul 2020 16:40:35 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0D13D1C0C5; Fri, 24 Jul 2020 16:39:43 +0200 (CEST) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60058.outbound.protection.outlook.com [40.107.6.58]) by dpdk.org (Postfix) with ESMTP id 890D11C06D for ; Fri, 24 Jul 2020 16:39:37 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PeS5nnOHC+3QOlKrii1tMAzLcao4WLIM9k6S5jbPHzDxzO3cz9lw8cq6CQeMM9jdxUWcsCn0mxuvqkbJd+fqo1yMUZP6pl3H8BTrUx6kmiFkUXlxmJXhelph9Uy2uhaSTfsS/sztJqcODD1ZCZtJI8yVRITcxVV17SNBrQK+xnsgNWsNwQ+rJSayQBwaGM5g27b2CHmbZ1sFeMBUFVGG3eC/s+4f46+TY504Lz+9J5eD2nWmMT05rNbUxd3SqVj6wCXwHWJJ6xN9h9HX7aKhf0VxMzLUtjDqfsmhIMO6soTqFevDoFG6PP9csQ/chTGPFgQZhvfv7BEneWjyJGx3Fw== 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-SenderADCheck; bh=uE1aG3m3rW+suXJngbZxLa6tmSK5I5Xc8kW4y3TDwWw=; b=JuKtaEKw06HqJPfvD8p/gugFyCVpKZyHe2AqW1wIRIT0w9W0S334YiqbVMY6Br0+kDHpmvUmDDZ1Dw/+5SpKN4qefS9KR9sZja6ChjWS7Ap9MaebflmRkOHYbd3mXks1IraDAHenW1fRbl3s5OV38UA4vOkb1dfrDNuCkw80PYUR+pUaJtyXL+B7Q4rPCAuwocpkKqsHiCPaiXEx2QFaSZXLBI3GqAUHiC//OuiHZA7Ie0FP6Xkm3XojfyzsmztoKUqql7r0vSld668rHWB8v7+sUe90GFq3KPGFpJM2zDsdkTUnaxfFqFVmVjDfuNJd60d+SzHD8whMrap9EzEb1w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uE1aG3m3rW+suXJngbZxLa6tmSK5I5Xc8kW4y3TDwWw=; b=o5ATF9GhBovHlsIY6qTXiR4r9r7BOkj4NE5uikN2An+8/Sm0ywB+nAWZmpkjC51YEwDhudHOmjVtPRKN6SSYtlgODY0/itR/VeedqagmZh0XkbHkpv5SxLR/U3XJ7vbnLQUQFqxM9YjerirR5+ZxoTNIYsOjt9HBhJfS34ncPrs= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=mellanox.com; Received: from AM0PR05MB4866.eurprd05.prod.outlook.com (2603:10a6:208:c0::32) by AM4PR05MB3204.eurprd05.prod.outlook.com (2603:10a6:205:3::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.23; Fri, 24 Jul 2020 14:39:36 +0000 Received: from AM0PR05MB4866.eurprd05.prod.outlook.com ([fe80::eccf:72b3:bacb:f09d]) by AM0PR05MB4866.eurprd05.prod.outlook.com ([fe80::eccf:72b3:bacb:f09d%5]) with mapi id 15.20.3216.024; Fri, 24 Jul 2020 14:39:36 +0000 From: Parav Pandit To: dev@dpdk.org, grive@u256.net, ferruh.yigit@intel.com, thomas@monjalon.net Cc: rasland@mellanox.com, orika@mellanox.com, matan@mellanox.com, joyce.kong@arm.com, Parav Pandit , David Marchand Date: Fri, 24 Jul 2020 17:39:02 +0300 Message-Id: <20200724143906.7453-7-parav@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200724143906.7453-1-parav@mellanox.com> References: <20200610171728.89-2-parav@mellanox.com> <20200724143906.7453-1-parav@mellanox.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SA9PR10CA0025.namprd10.prod.outlook.com (2603:10b6:806:a7::30) To AM0PR05MB4866.eurprd05.prod.outlook.com (2603:10a6:208:c0::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sw-mtx-036.mtx.labs.mlnx (208.176.44.194) by SA9PR10CA0025.namprd10.prod.outlook.com (2603:10b6:806:a7::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.23 via Frontend Transport; Fri, 24 Jul 2020 14:39:34 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [208.176.44.194] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 520d87dd-b373-42d3-ce80-08d82fdf6342 X-MS-TrafficTypeDiagnostic: AM4PR05MB3204: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtFwd,ExtAddr X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:216; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: irwvy/igdFrtt2Ik5F9tcdntm48Q7GCEv8XMCMs+qrwW2DAj6pHPZPJT/vQXyXOtkNhlBwQvtIjkw0f6FuCFD09kGz/hy20XQmRHevQ/ZyP2aI1bMoLXpBgHG1dJnS368w1TQKdFv359wK31Oz5Pr2B/SifLQC/WcyOwmZ12tQOA4H/JakDOw9qaLzs2RhkPSv10cyQvml6Hj5yNUOFtt7e4dASkOZBrwByYKXcMmJkfugq9ZPWK6pBqZYTRnwGIFqIrXUqcQu84iOCmCjEBx+SqFzSn81gH8TIiaaOgxd9vENbnQ3QanJsRmraWxR7F X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR05MB4866.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(396003)(136003)(346002)(366004)(376002)(39860400002)(26005)(8936002)(36756003)(54906003)(6506007)(316002)(956004)(52116002)(2616005)(6512007)(6666004)(8676002)(66946007)(4326008)(16526019)(2906002)(186003)(6486002)(5660300002)(478600001)(86362001)(83380400001)(1076003)(66556008)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: MXpblmPPevlyAb/LyQb7xFTqYaX1tVIuNDgO9Ivd+FnmMbbl3nMDgboaabMDRVFn8p2qKAOerM4QNXhAWqzO3hqOt07yD82zUY/TUe3sbRIawQfYz8Golopjrj3MUQ1RVLKIr2uxmX0T+rA4HDhCF3hSLshGBqHhz5StEDgts2031T5oRG+8q1C/PJu860NiZmKWu6iS8zyyr3Wi3+vf1E50yjDPsqxRUirVRZ713F4Vz3/Flxy6yUM38XhW2FC9pyJ8+rNEEYimMVsxm4zLALykXcjqUyC+7EiCOn/f4/TsH0Xg5y2U8jIMer5TV8Z9PhBUW/xA3rmMJhL2z9Uwho1LmDWLIb1WpnD+9a31hsG4+Me5KeovRcl30+mXIhlMSU5EKbFjH7j9l+fajAKTATBWQY1y8jDCfOKwmy2w2B6BRFecoC2kh5RF0C0r/gTMKYJ3Ln9ZP8vxV1pyqHoC2he4vWkl7gNSxSO7uhKC7MBin2j2JZGFo9Auz/rrMzRi X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 520d87dd-b373-42d3-ce80-08d82fdf6342 X-MS-Exchange-CrossTenant-AuthSource: AM0PR05MB4866.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2020 14:39:36.3719 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7unIEK5R+NhPuew7B4Hnz8MX+OctpIqSiWrUbRJbxEE/ECYLd9aXca1jJLl+Id45JC+pzcewZGab2xhOsKsRfg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3204 Subject: [dpdk-dev] [PATCH v10 06/10] common/mlx5: avoid using class constructor priority X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" mlx5_common is shared library between mlx5 net, VDPA and regex PMD. It is better to use common initialization helper instead of using RTE_PRIORITY_CLASS priority. Reviewed-by: David Marchand Suggested-by: David Marchand Signed-off-by: Parav Pandit --- Changelog: v7->v8: - new patch --- drivers/common/mlx5/mlx5_common.c | 13 +++++++++++-- drivers/common/mlx5/mlx5_common.h | 3 +++ drivers/common/mlx5/rte_common_mlx5_version.map | 1 + drivers/net/mlx5/mlx5.c | 1 + drivers/regex/mlx5/mlx5_regex.c | 1 + drivers/vdpa/mlx5/mlx5_vdpa.c | 1 + 6 files changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/common/mlx5/mlx5_common.c b/drivers/common/mlx5/mlx5_common.c index 1a67a1b16..2b336bb2d 100644 --- a/drivers/common/mlx5/mlx5_common.c +++ b/drivers/common/mlx5/mlx5_common.c @@ -86,12 +86,21 @@ RTE_INIT_PRIO(mlx5_log_init, LOG) rte_log_set_level(mlx5_common_logtype, RTE_LOG_NOTICE); } +static bool mlx5_common_initialized; + /** - * Initialization routine for run-time dependency on glue library. + * One time innitialization routine for run-time dependency on glue library + * for multiple PMDs. Each mlx5 PMD that depends on mlx5_common module, + * must invoke in its constructor. */ -RTE_INIT_PRIO(mlx5_glue_init, CLASS) +void +mlx5_common_init(void) { + if (mlx5_common_initialized) + return; + mlx5_glue_constructor(); + mlx5_common_initialized = true; } /** diff --git a/drivers/common/mlx5/mlx5_common.h b/drivers/common/mlx5/mlx5_common.h index a811eb6c9..ebe4e9ced 100644 --- a/drivers/common/mlx5/mlx5_common.h +++ b/drivers/common/mlx5/mlx5_common.h @@ -260,4 +260,7 @@ int32_t mlx5_release_dbr(struct mlx5_dbr_page_list *head, uint32_t umem_id, uint64_t offset); extern uint8_t haswell_broadwell_cpu; +__rte_internal +void mlx5_common_init(void); + #endif /* RTE_PMD_MLX5_COMMON_H_ */ diff --git a/drivers/common/mlx5/rte_common_mlx5_version.map b/drivers/common/mlx5/rte_common_mlx5_version.map index 132a0695f..65f25252a 100644 --- a/drivers/common/mlx5/rte_common_mlx5_version.map +++ b/drivers/common/mlx5/rte_common_mlx5_version.map @@ -3,6 +3,7 @@ INTERNAL { mlx5_class_get; + mlx5_common_init; mlx5_common_verbs_reg_mr; mlx5_common_verbs_dereg_mr; diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 647ada339..037703d2e 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -2111,6 +2111,7 @@ RTE_LOG_REGISTER(mlx5_logtype, pmd.net.mlx5, NOTICE) */ RTE_INIT(rte_mlx5_pmd_init) { + mlx5_common_init(); /* Build the static tables for Verbs conversion. */ mlx5_set_ptype_table(); mlx5_set_cksum_table(); diff --git a/drivers/regex/mlx5/mlx5_regex.c b/drivers/regex/mlx5/mlx5_regex.c index 36ae9f809..4e0367052 100644 --- a/drivers/regex/mlx5/mlx5_regex.c +++ b/drivers/regex/mlx5/mlx5_regex.c @@ -258,6 +258,7 @@ static struct rte_pci_driver mlx5_regex_driver = { RTE_INIT(rte_mlx5_regex_init) { + mlx5_common_init(); if (mlx5_glue) rte_pci_register(&mlx5_regex_driver); } diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.c b/drivers/vdpa/mlx5/mlx5_vdpa.c index 67e77b11a..85dbcf956 100644 --- a/drivers/vdpa/mlx5/mlx5_vdpa.c +++ b/drivers/vdpa/mlx5/mlx5_vdpa.c @@ -846,6 +846,7 @@ RTE_LOG_REGISTER(mlx5_vdpa_logtype, pmd.vdpa.mlx5, NOTICE) */ RTE_INIT(rte_mlx5_vdpa_init) { + mlx5_common_init(); if (mlx5_glue) rte_pci_register(&mlx5_vdpa_driver); } -- 2.26.2