From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id 9868637A2 for ; Wed, 30 May 2018 16:43:08 +0200 (CEST) Received: from alcyon.dev.6wind.com. (unknown [10.16.0.235]) by proxy.6wind.com (Postfix) with ESMTP id CCE5A182E5C; Wed, 30 May 2018 16:39:19 +0200 (CEST) From: David Marchand To: dev@dpdk.org Cc: adrien.mazarguil@6wind.com, nelio.laranjeiro@6wind.com, yskoh@mellanox.com Date: Wed, 30 May 2018 16:42:53 +0200 Message-Id: <20180530144253.8935-1-david.marchand@6wind.com> X-Mailer: git-send-email 2.11.0 Subject: [dpdk-dev] [PATCH] net/mlx5: only register memory callback when probing a device 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: , X-List-Received-Date: Wed, 30 May 2018 14:43:08 -0000 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 --- 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 d77a20db4..601d03f71 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -138,6 +138,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); } @@ -1460,8 +1462,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__); -- 2.11.0