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 E70E3A0526; Fri, 24 Jul 2020 16:25:31 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 801201C0BC; Fri, 24 Jul 2020 16:24:43 +0200 (CEST) Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10084.outbound.protection.outlook.com [40.107.1.84]) by dpdk.org (Postfix) with ESMTP id AD2FE1C0B3 for ; Fri, 24 Jul 2020 16:24:37 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CMKx8bI5U8x1mVVktTLmBRDmqJX65KURDC/siwxIXbC4LUTbLq7vYz2s/7zAtiM3lit1PqgFukdpLoevohpBtMxOZUCiphEk56jjvo6KrmNXUsK1yihhrU34+JhIiDE9oiO+jkYXyvv8LQnuitdKdytCyPcQraiZxESWLoIJWldM2dbDjhATPwHthEPkoqeAdkoigyJsT+bCzF1sqcntoiHmzEbNOTKSggj1DgSLduM7DFFawhp0eTASfRjHxpbK017oLhljzFd5jHZu2FiI4qrrQ7150O3DL9ZkQB8sM2zD+6X6IUHM4u26xvFaI76YbZSEZPc6w3FJFQZRBGNC8A== 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=k3OTMIc8i5Pe4sYjnEaOynTtZZXvOEKXHgQ9TC5xLKtlrjF8YnluuDvdlMAgFuNzEdaodvtu77Oq9fHg+EszJrTZ3K5fVsthn+rRmK5xr6fOR1KuPpJ+tF864irLlH3FHmf1Afm+HhC06dOihNAeruSK3d/Wyt9HWUbV89A1bELQQvOvnfjGbjKdwIjtT3h67q15qf3SJppex8WegKbZQDgNPLUlhQL4ZmZYUXKls3Lxf2E/bPtqFECDhX46PrK8mUBQe4Bv1t230hUvv0dQ+Ah5YTW//1SfxBuF84xTMBZMBvl9q//+6vx1Xc8duWcVv9RAeJFGzzRnjaAMfbRRxA== 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=PVMSNXsWkgkCGztHuTlDae6uZwWrjoJUmLL6bN1wNy+wyshVqCUI2CiUZKQB6MlSF6OBHVnU60IHUphGn/1ThURtUsGqITSOEfMbnh3kOeHBQ9Z7q2ze5+0F9bdZFt9R7GY/rGX3npNWv2ssW2Pgd4t24e0+FmeqSVw97m0k6zs= 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 AM4PR05MB3203.eurprd05.prod.outlook.com (2603:10a6:205:6::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.20; Fri, 24 Jul 2020 14:24:35 +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:24:35 +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:23:59 +0300 Message-Id: <20200724142403.6132-7-parav@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200724142403.6132-1-parav@mellanox.com> References: <20200610171728.89-2-parav@mellanox.com> <20200724142403.6132-1-parav@mellanox.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: DM6PR02CA0136.namprd02.prod.outlook.com (2603:10b6:5:1b4::38) 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 DM6PR02CA0136.namprd02.prod.outlook.com (2603:10b6:5:1b4::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.21 via Frontend Transport; Fri, 24 Jul 2020 14:24: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: a8ec0ad0-72ff-470f-e6db-08d82fdd4a7c X-MS-TrafficTypeDiagnostic: AM4PR05MB3203: 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: FRX9UZ/Odio2bZE+9p8YLQka0+9RntrN8Ri72AeeOzAdIFhcDnqQa8GIeeKV3jDOMY7tujBZZopvNmqotmbELXWn8BhIGxFllHwhsLTMN95LGr1YSc0YUih/XEHns/CFRtTqiZic4q3HApIqQdMThjX8ruwFyREs+X+fHdJKaCZ+K1QZBVG0n70vLu9THpB+68F7UoIEr/CiO6CAeUppf2M7DFt1O/CtrZv8ZZhsMlJUQ8BPoAphvDgpzl91FPCEeYxNjswivapj+jqyRANZ85EWbOnAuxA7utJQ/C0cxz/wOCT/Je/eQCM/Xe6sygf+ 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)(376002)(346002)(136003)(366004)(396003)(39860400002)(5660300002)(86362001)(2616005)(956004)(6512007)(2906002)(66946007)(66476007)(66556008)(316002)(6506007)(4326008)(16526019)(186003)(26005)(8936002)(54906003)(478600001)(8676002)(6666004)(52116002)(6486002)(83380400001)(1076003)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Q4GTgOfMh0KoHrDdiciAEFKjT9Yh7zf69VF7ech+nc2UH7n3liKPnZW+zzLmA8ikESdmvJykga2ga/cobu/r+S3u/4tcGn2exMGTEdp3lLYgnHOc3OV0gpip7vrcdUQ+FrKoY/YJUJtIzpntcEz4MQqZRgOljdxJQ0I+NbVzP4Epns86dDZYyuoXZ8qBoIm6sUM60RLL1rO6NQIxiBhrpCGxE05531xurK9o+6NUUeAdBPd3Mre5N5CVdVNtM5UPlLISCcZJ2VNsY1I0oQ++hSNh3n4LK6b39hywIDOfXf2chowFPidr/e12eQ8yuiw2oOjne7YBbZGoJ3otM07Asm3B5rjbuGS5NzxmE1nWuPpMC9TaG4jUPcwYmXDWMJzOCFUt/X+I0FCGpoEtIAzZQY3AjeA7PqaMPHojfeY0nXBN9c8R1ZUAeUbrs39jk81vHQI7RNxpzuJ+nSs3FapMnum/A6cVJa1vtqXhO5cOggaZxjCMaDGkwnEg0XXxYLLJ X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: a8ec0ad0-72ff-470f-e6db-08d82fdd4a7c 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:24:35.8281 (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: 31yV5s6xDG7OdVApTp+8idVXxtNCjGswlTcd4mKzdkLvw1pbz98vfic3gXqzlTtLsrEnUpi0LJBemxYBQy6Rwg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3203 Subject: [dpdk-dev] [PATCH v9 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