X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fmlx5%2Fmlx5_ethdev.c;h=83657f5092a619025a2e9cd8f5f617bfe498d627;hb=3669a1af893088064778f14fba0c2ca88819e095;hp=9a2ebd80cee7668d7a8083b13ba948047cc3cc62;hpb=c7bf62255edf718f49f3c5279463e23b6a2199ac;p=dpdk.git diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c index 9a2ebd80ce..83657f5092 100644 --- a/drivers/net/mlx5/mlx5_ethdev.c +++ b/drivers/net/mlx5/mlx5_ethdev.c @@ -55,7 +55,7 @@ #include #include -#include +#include #include #include #include @@ -692,6 +692,7 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) priv->reta_idx_n : config->ind_table_max_size; info->hash_key_size = priv->rss_conf.rss_key_len; info->speed_capa = priv->link_speed_capa; + info->flow_type_rss_offloads = ~MLX5_RSS_HF_MASK; priv_unlock(priv); } @@ -965,6 +966,33 @@ priv_link_update(struct priv *priv, int wait_to_complete) return ret; } +/** + * Querying the link status till it changes to the desired state. + * Number of query attempts is bounded by MLX5_MAX_LINK_QUERY_ATTEMPTS. + * + * @param priv + * Pointer to private structure. + * @param status + * Link desired status. + * + * @return + * 0 on success, negative errno value on failure. + */ +int +priv_force_link_status_change(struct priv *priv, int status) +{ + int try = 0; + + while (try < MLX5_MAX_LINK_QUERY_ATTEMPTS) { + priv_link_update(priv, 0); + if (priv->dev->data->dev_link.link_status == status) + return 0; + try++; + sleep(1); + } + return -EAGAIN; +} + /** * DPDK callback to retrieve physical link information. * @@ -1515,3 +1543,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; +}