net/mlx5: fix initial link status detection

Link status change takes time that depends on the HW and the kernel.
It was checked immediately after the change was issued at probing.
If the port had been down before probing, a "down" state may be read,
while the port would be "up" imminently.
After that, DPDK reported the port as "down" mistakenly
and "ifconfig $DEV up" did not trigger an LSC event,
because from the system's perspective the port was "up" already.

Install Netlink event handler at port probe before requesting the port
to come up in order to receive LSC event even if it comes up
between probe and start.

Fixes: a85a606ca5 ("net/mlx5: fix link status initialization")
Cc: stable@dpdk.org

Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
Reviewed-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
This commit is contained in:
Dmitry Kozlyuk 2022-03-01 14:15:14 +02:00 committed by Raslan Darawsheh
parent 17f95513ad
commit 655c3c26c1

View File

@ -1483,13 +1483,12 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
/* Bring Ethernet device up. */
DRV_LOG(DEBUG, "port %u forcing Ethernet interface up",
eth_dev->data->port_id);
mlx5_set_link_up(eth_dev);
/*
* Even though the interrupt handler is not installed yet,
* interrupts will still trigger on the async_fd from
* Verbs context returned by ibv_open_device().
*/
/* Read link status in case it is up and there will be no event. */
mlx5_link_update(eth_dev, 0);
/* Watch LSC interrupts between port probe and port start. */
priv->sh->port[priv->dev_port - 1].nl_ih_port_id =
eth_dev->data->port_id;
mlx5_set_link_up(eth_dev);
for (i = 0; i < MLX5_FLOW_TYPE_MAXI; i++) {
icfg[i].release_mem_en = !!sh->config.reclaim_mode;
if (sh->config.reclaim_mode)