net/mlx4: change device reference for secondary process
authorYongseok Koh <yskoh@mellanox.com>
Mon, 1 Apr 2019 21:15:51 +0000 (14:15 -0700)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 5 Apr 2019 15:45:22 +0000 (17:45 +0200)
commit099c2c5376131b3d352d70f8904e586c0e84651e
treeb2caff9034df247d5f7710ca2ebfb1ba988374da
parent2aac5b5d119f425964868a7e530e95d18af9e31c
net/mlx4: change device reference for secondary process

rte_eth_devices[] is not shared between primary and secondary process,
but a static array to each process. The reverse pointer of device
(priv->dev) becomes invalid if mlx4 supports secondary process.
Instead, priv has the pointer to shared data of the device,
  struct rte_eth_dev_data *dev_data;

Two macros are added,
  #define PORT_ID(priv) ((priv)->dev_data->port_id)
  #define ETH_DEV(priv) (&rte_eth_devices[PORT_ID(priv)])

Cc: stable@dpdk.org
Suggested-by: Raslan Darawsheh <rasland@mellanox.com>
Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
drivers/net/mlx4/mlx4.c
drivers/net/mlx4/mlx4.h
drivers/net/mlx4/mlx4_flow.c
drivers/net/mlx4/mlx4_intr.c
drivers/net/mlx4/mlx4_mr.c
drivers/net/mlx4/mlx4_rxq.c
drivers/net/mlx4/mlx4_txq.c