summaryrefslogtreecommitdiff
path: root/drivers/net/mlx5/mlx5_ethdev.c
diff options
context:
space:
mode:
authorMatan Azrad <matan@mellanox.com>2018-01-20 21:12:21 +0000
committerFerruh Yigit <ferruh.yigit@intel.com>2018-01-21 21:09:41 +0100
commitd3e0f392076497b2c01309ed6724e9f5337f4ad5 (patch)
tree85a7049dd46af7fe70d95ed1f67023461257463f /drivers/net/mlx5/mlx5_ethdev.c
parentcdf4ec6eaaf2cdb1b7068fc6b7dacfbf732527da (diff)
downloaddpdk-d3e0f392076497b2c01309ed6724e9f5337f4ad5.zip
dpdk-d3e0f392076497b2c01309ed6724e9f5337f4ad5.tar.gz
dpdk-d3e0f392076497b2c01309ed6724e9f5337f4ad5.tar.xz
net/mlx5: support a device removal check operation
Add support to get removal status of mlx5 device. It is not supported in secondary process. Signed-off-by: Matan Azrad <matan@mellanox.com>
Diffstat (limited to 'drivers/net/mlx5/mlx5_ethdev.c')
-rw-r--r--drivers/net/mlx5/mlx5_ethdev.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 9a2ebd8..9226f1a 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -1515,3 +1515,23 @@ priv_select_rx_function(struct priv *priv, __rte_unused struct rte_eth_dev *dev)
}
return rx_pkt_burst;
}
+
+/**
+ * Check if mlx5 device was removed.
+ *
+ * @param dev
+ * Pointer to Ethernet device structure.
+ *
+ * @return
+ * 1 when device is removed, otherwise 0.
+ */
+int
+mlx5_is_removed(struct rte_eth_dev *dev)
+{
+ struct ibv_device_attr device_attr;
+ struct priv *priv = dev->data->dev_private;
+
+ if (ibv_query_device(priv->ctx, &device_attr) == EIO)
+ return 1;
+ return 0;
+}