From: David Marchand Date: Wed, 30 May 2018 14:42:53 +0000 (+0200) Subject: net/mlx5: register memory callback only when probing X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=44b1d513d58db0ac54e67715470f9a50643a593b;p=dpdk.git net/mlx5: register memory callback only when probing The callback should be invoked only for memory that has been registered in a device, hence, no need to track cleanup events if no device is present. Bugzilla ID: 56 Fixes: 974f1e7ef146 ("net/mlx5: add new memory region support") Signed-off-by: David Marchand Acked-by: Yongseok Koh Tested-by: Ferruh Yigit --- diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 3ef02e2d20..c933e274fe 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -137,6 +137,8 @@ mlx5_prepare_shared_data(void) LIST_INIT(&mlx5_shared_data->mem_event_cb_list); rte_rwlock_init(&mlx5_shared_data->mem_event_rwlock); } + rte_mem_event_callback_register("MLX5_MEM_EVENT_CB", + mlx5_mr_mem_event_cb, NULL); } rte_spinlock_unlock(&mlx5_shared_data_lock); } @@ -1473,8 +1475,6 @@ rte_mlx5_pmd_init(void) } mlx5_glue->fork_init(); rte_pci_register(&mlx5_driver); - rte_mem_event_callback_register("MLX5_MEM_EVENT_CB", - mlx5_mr_mem_event_cb, NULL); } RTE_PMD_EXPORT_NAME(net_mlx5, __COUNTER__);