* Get the interface index from device name. * * @param[in] dev * Pointer to Ethernet device. * * @return * Nonzero interface index on success, zero otherwise and rte_errno is set. */
| 39 | * Nonzero interface index on success, zero otherwise and rte_errno is set. |
| 40 | */ |
| 41 | unsigned int |
| 42 | mlx5_ifindex(const struct rte_eth_dev *dev) |
| 43 | { |
| 44 | struct mlx5_priv *priv = dev->data->dev_private; |
| 45 | unsigned int ifindex; |
| 46 | |
| 47 | MLX5_ASSERT(priv); |
| 48 | MLX5_ASSERT(priv->if_index); |
| 49 | if (priv->master && priv->sh->bond.ifindex > 0) |
| 50 | ifindex = priv->sh->bond.ifindex; |
| 51 | else |
| 52 | ifindex = priv->if_index; |
| 53 | if (!ifindex) |
| 54 | rte_errno = ENXIO; |
| 55 | return ifindex; |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * DPDK callback for Ethernet device configuration. |
no outgoing calls
no test coverage detected