summaryrefslogtreecommitdiff
path: root/drivers/net/mlx5/mlx5_ethdev.c
diff options
context:
space:
mode:
authorViacheslav Ovsiienko <viacheslavo@mellanox.com>2019-09-25 07:53:33 +0000
committerFerruh Yigit <ferruh.yigit@intel.com>2019-10-08 12:14:29 +0200
commitf7e95215ac7c7bcd41cd263f9da2383f92f9bcd7 (patch)
treea6379f37bf63070b449b4d29516622bdc927e4e0 /drivers/net/mlx5/mlx5_ethdev.c
parentf07341e7aed3545031061530117d355b753ae776 (diff)
downloaddpdk-next-eventdev-f7e95215ac7c7bcd41cd263f9da2383f92f9bcd7.zip
dpdk-next-eventdev-f7e95215ac7c7bcd41cd263f9da2383f92f9bcd7.tar.gz
dpdk-next-eventdev-f7e95215ac7c7bcd41cd263f9da2383f92f9bcd7.tar.xz
net/mlx5: extend switch domain searching range
With bonding configurations the switch domain may be shared between multiple PCI devices, we should search the switch sibling devices within the entire set of present ethernet devices backed by the mlx5 PMD. Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com> Acked-by: Matan Azrad <matan@mellanox.com>
Diffstat (limited to 'drivers/net/mlx5/mlx5_ethdev.c')
-rw-r--r--drivers/net/mlx5/mlx5_ethdev.c52
1 files changed, 11 insertions, 41 deletions
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 27372f1..751247d 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -580,16 +580,15 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info)
info->switch_info.domain_id = priv->domain_id;
info->switch_info.port_id = priv->representor_id;
if (priv->representor) {
- unsigned int i = mlx5_dev_to_port_id(dev->device, NULL, 0);
- uint16_t port_id[i];
+ uint16_t port_id;
- i = RTE_MIN(mlx5_dev_to_port_id(dev->device, port_id, i), i);
- while (i--) {
+ MLX5_ETH_FOREACH_DEV(port_id) {
struct mlx5_priv *opriv =
- rte_eth_devices[port_id[i]].data->dev_private;
+ rte_eth_devices[port_id].data->dev_private;
if (!opriv ||
opriv->representor ||
+ opriv->sh != priv->sh ||
opriv->domain_id != priv->domain_id)
continue;
/*
@@ -600,7 +599,6 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info)
break;
}
}
-
return 0;
}
@@ -717,11 +715,13 @@ mlx5_find_master_dev(struct rte_eth_dev *dev)
priv = dev->data->dev_private;
domain_id = priv->domain_id;
assert(priv->representor);
- RTE_ETH_FOREACH_DEV_OF(port_id, dev->device) {
- priv = rte_eth_devices[port_id].data->dev_private;
- if (priv &&
- priv->master &&
- priv->domain_id == domain_id)
+ MLX5_ETH_FOREACH_DEV(port_id) {
+ struct mlx5_priv *opriv =
+ rte_eth_devices[port_id].data->dev_private;
+ if (opriv &&
+ opriv->master &&
+ opriv->domain_id == domain_id &&
+ opriv->sh == priv->sh)
return &rte_eth_devices[port_id];
}
return NULL;
@@ -1630,36 +1630,6 @@ mlx5_is_removed(struct rte_eth_dev *dev)
}
/**
- * Get port ID list of mlx5 instances sharing a common device.
- *
- * @param[in] dev
- * Device to look for.
- * @param[out] port_list
- * Result buffer for collected port IDs.
- * @param port_list_n
- * Maximum number of entries in result buffer. If 0, @p port_list can be
- * NULL.
- *
- * @return
- * Number of matching instances regardless of the @p port_list_n
- * parameter, 0 if none were found.
- */
-unsigned int
-mlx5_dev_to_port_id(const struct rte_device *dev, uint16_t *port_list,
- unsigned int port_list_n)
-{
- uint16_t id;
- unsigned int n = 0;
-
- RTE_ETH_FOREACH_DEV_OF(id, dev) {
- if (n < port_list_n)
- port_list[n] = id;
- n++;
- }
- return n;
-}
-
-/**
* Get the E-Switch parameters by port id.
*
* @param[in] port