In mlx5 PMD the associated device index is retrieved via Netlink request to underlying Infiniband device driver. This network device index is permanent throughout the lifetime of device. We do not spawn the rte_eth_dev ports without associated network device, and if network device is being unbound we get the remove notification event message and rte_eth_dev port is also detached. So, we may store the ifindex in mlx5_device_spawn() routine at rte_eth_dev port creation and initialization time and use the cached value further instead of doing actual Netlink request.
This approach allows the query API routines like mlx5_link_update to be thread-safe due to Netlink request elimination. mlx5_link_update() may be called in asynchronous event handler concurrently and it may cause application hang. This patch extends and updates the [1]. [1] http://patches.dpdk.org/patch/56417/ Reported-by: Stephen Hemminger <step...@networkplumber.org> Signed-off-by: Viacheslav Ovsiienko <viachesl...@mellanox.com> --- v2: -- comments addressed v1: -- http://patches.dpdk.org/cover/56749/ Viacheslav Ovsiienko (2): net/mlx5: cache the associated network device ifindex Revert "net/mlx5: fix master device Netlink socket sharing" drivers/net/mlx5/mlx5.c | 7 +++ drivers/net/mlx5/mlx5.h | 7 +-- drivers/net/mlx5/mlx5_ethdev.c | 128 ++++------------------------------------- 3 files changed, 18 insertions(+), 124 deletions(-) -- 1.8.3.1