From ef65067c46cbb0903cdbd07fa196fb1586a9681a Mon Sep 17 00:00:00 2001 From: Tal Shnaiderman Date: Mon, 28 Dec 2020 14:32:59 +0200 Subject: [PATCH] net/mlx5: initialize context list mutex dynamically The mutex mlx5_dev_ctx_list_mutex was initialized with PTHREAD_MUTEX_INITIALIZER global macro however this macro is not supported on Windows OS shim implementation of pthreads in DPDK. Moved the init of this mutex to RTE_INIT to support this mutex on both OSs. Signed-off-by: Tal Shnaiderman Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index a91c240bcc..023ef50a77 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -184,8 +184,7 @@ int mlx5_logtype; static LIST_HEAD(, mlx5_dev_ctx_shared) mlx5_dev_ctx_list = LIST_HEAD_INITIALIZER(); -static pthread_mutex_t mlx5_dev_ctx_list_mutex = PTHREAD_MUTEX_INITIALIZER; - +static pthread_mutex_t mlx5_dev_ctx_list_mutex; static const struct mlx5_indexed_pool_config mlx5_ipool_cfg[] = { #if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H) [MLX5_IPOOL_DECAP_ENCAP] = { @@ -2235,6 +2234,7 @@ RTE_LOG_REGISTER(mlx5_logtype, pmd.net.mlx5, NOTICE) */ RTE_INIT(rte_mlx5_pmd_init) { + pthread_mutex_init(&mlx5_dev_ctx_list_mutex, NULL); mlx5_common_init(); /* Build the static tables for Verbs conversion. */ mlx5_set_ptype_table(); -- 2.39.5