[dpdk-dev] [PATCH] net/mlx5: fix device reference in secondary process

Yongseok Koh yskoh at mellanox.com
Wed May 2 08:13:20 CEST 2018


rte_eth_devices[] is not shared between primary and secondary process, but
a static array to each process. The backward pointer of device (priv->dev)
must be reset when a secondary process attaches to a device.

Fixes: f8b9a3bad467 ("net/mlx5: install a socket to exchange a file descriptor")
Cc: stable at dpdk.org

Signed-off-by: Yongseok Koh <yskoh at mellanox.com>
---
 drivers/net/mlx5/mlx5.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 8f983061a..f606e3dd4 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -799,6 +799,12 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 			}
 			eth_dev->device = &pci_dev->device;
 			eth_dev->dev_ops = &mlx5_dev_sec_ops;
+			/*
+			 * rte_eth_devices[] is not shared but static to each
+			 * process. The backward pointer should be reset.
+			 */
+			priv = eth_dev->data->dev_private;
+			priv->dev = eth_dev;
 			err = mlx5_uar_init_secondary(eth_dev);
 			if (err)
 				goto error;
-- 
2.11.0



More information about the dev mailing list