]> git.droids-corp.org - dpdk.git/commitdiff
net/mlx4: support a device removal check operation
authorMatan Azrad <matan@mellanox.com>
Sat, 20 Jan 2018 21:12:20 +0000 (21:12 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Sun, 21 Jan 2018 20:09:41 +0000 (21:09 +0100)
Add support to get removal status of mlx4 device.

Signed-off-by: Matan Azrad <matan@mellanox.com>
drivers/net/mlx4/mlx4.c
drivers/net/mlx4/mlx4.h
drivers/net/mlx4/mlx4_ethdev.c

index 61c5bf4d30aedcddcffd68a9d66c9fc0d6d4f4d4..703513e79b7c27f49ea27adf42354cd6e75003e2 100644 (file)
@@ -256,6 +256,7 @@ static const struct eth_dev_ops mlx4_dev_ops = {
        .filter_ctrl = mlx4_filter_ctrl,
        .rx_queue_intr_enable = mlx4_rx_intr_enable,
        .rx_queue_intr_disable = mlx4_rx_intr_disable,
+       .is_removed = mlx4_is_removed,
 };
 
 /**
index 99dc3357a9adfa2d071b3376ac8e83209a263f44..2ab298894cd0e55bb69f17b3316d5f342ab74ae8 100644 (file)
@@ -171,6 +171,7 @@ int mlx4_flow_ctrl_get(struct rte_eth_dev *dev,
 int mlx4_flow_ctrl_set(struct rte_eth_dev *dev,
                       struct rte_eth_fc_conf *fc_conf);
 const uint32_t *mlx4_dev_supported_ptypes_get(struct rte_eth_dev *dev);
+int mlx4_is_removed(struct rte_eth_dev *dev);
 
 /* mlx4_intr.c */
 
index c80eab5a896d32a52584a2f8e73a5a5102c87ee0..5318b56378e57b3cbff031caeec505a1a44f86fd 100644 (file)
@@ -1052,3 +1052,23 @@ mlx4_dev_supported_ptypes_get(struct rte_eth_dev *dev)
        }
        return NULL;
 }
+
+/**
+ * Check if mlx4 device was removed.
+ *
+ * @param dev
+ *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   1 when device is removed, otherwise 0.
+ */
+int
+mlx4_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;
+}