From: Matan Azrad Date: Sat, 20 Jan 2018 21:12:20 +0000 (+0000) Subject: net/mlx4: support a device removal check operation X-Git-Tag: spdx-start~28 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=cdf4ec6eaaf2cdb1b7068fc6b7dacfbf732527da;p=dpdk.git net/mlx4: support a device removal check operation Add support to get removal status of mlx4 device. Signed-off-by: Matan Azrad --- diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index 61c5bf4d30..703513e79b 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -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, }; /** diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h index 99dc3357a9..2ab298894c 100644 --- a/drivers/net/mlx4/mlx4.h +++ b/drivers/net/mlx4/mlx4.h @@ -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 */ diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c index c80eab5a89..5318b56378 100644 --- a/drivers/net/mlx4/mlx4_ethdev.c +++ b/drivers/net/mlx4/mlx4_ethdev.c @@ -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; +}