summaryrefslogtreecommitdiff
path: root/drivers/net/mlx4/mlx4.h
diff options
context:
space:
mode:
authorYongseok Koh <yskoh@mellanox.com>2019-04-01 14:15:51 -0700
committerFerruh Yigit <ferruh.yigit@intel.com>2019-04-05 17:45:22 +0200
commit099c2c5376131b3d352d70f8904e586c0e84651e (patch)
treeb2caff9034df247d5f7710ca2ebfb1ba988374da /drivers/net/mlx4/mlx4.h
parent2aac5b5d119f425964868a7e530e95d18af9e31c (diff)
downloaddpdk-099c2c5376131b3d352d70f8904e586c0e84651e.zip
dpdk-099c2c5376131b3d352d70f8904e586c0e84651e.tar.gz
dpdk-099c2c5376131b3d352d70f8904e586c0e84651e.tar.xz
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>
Diffstat (limited to 'drivers/net/mlx4/mlx4.h')
-rw-r--r--drivers/net/mlx4/mlx4.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h
index 7ac49ca..51566ca 100644
--- a/drivers/net/mlx4/mlx4.h
+++ b/drivers/net/mlx4/mlx4.h
@@ -79,7 +79,7 @@ LIST_HEAD(mlx4_mr_list, mlx4_mr);
struct mlx4_priv {
LIST_ENTRY(mlx4_priv) mem_event_cb;
/**< Called by memory event callback. */
- struct rte_eth_dev *dev; /**< Ethernet device. */
+ struct rte_eth_dev_data *dev_data; /* Pointer to device data. */
struct ibv_context *ctx; /**< Verbs context. */
struct ibv_device_attr device_attr; /**< Device properties. */
struct ibv_pd *pd; /**< Protection Domain. */
@@ -113,6 +113,9 @@ struct mlx4_priv {
/**< Configured MAC addresses. Unused entries are zeroed. */
};
+#define PORT_ID(priv) ((priv)->dev_data->port_id)
+#define ETH_DEV(priv) (&rte_eth_devices[PORT_ID(priv)])
+
/* mlx4_ethdev.c */
int mlx4_get_ifname(const struct mlx4_priv *priv, char (*ifname)[IF_NAMESIZE]);