summaryrefslogtreecommitdiff
path: root/drivers/net/mlx5/mlx5_ethdev.c
diff options
context:
space:
mode:
authorViacheslav Ovsiienko <viacheslavo@mellanox.com>2019-09-25 07:53:34 +0000
committerFerruh Yigit <ferruh.yigit@intel.com>2019-10-08 12:14:29 +0200
commitbee57a0a3565181c0467f3d2cbde8bf6af664301 (patch)
tree35c9b8ee5310fb0d4b75ce086f7b95220ee5a3a0 /drivers/net/mlx5/mlx5_ethdev.c
parentf7e95215ac7c7bcd41cd263f9da2383f92f9bcd7 (diff)
downloaddpdk-next-eventdev-bee57a0a3565181c0467f3d2cbde8bf6af664301.zip
dpdk-next-eventdev-bee57a0a3565181c0467f3d2cbde8bf6af664301.tar.gz
dpdk-next-eventdev-bee57a0a3565181c0467f3d2cbde8bf6af664301.tar.xz
net/mlx5: update switch port id in bonding configuration
With bonding configuration multiple PFs may represent the single switching device with multiple ports as representors. To distinguish representors belonging to different PFs we should generated unique port ID. It is proposed to use the PF index in bonding configuration to generate this unique port IDs. 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.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 751247d..aa645d0 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -582,6 +582,25 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info)
if (priv->representor) {
uint16_t port_id;
+ if (priv->pf_bond >= 0) {
+ /*
+ * Switch port ID is opaque value with driver defined
+ * format. Push the PF index in bonding configurations
+ * in upper four bits of port ID. If we get too many
+ * representors (more than 4K) or PFs (more than 15)
+ * this approach must be reconsidered.
+ */
+ if ((info->switch_info.port_id >>
+ MLX5_PORT_ID_BONDING_PF_SHIFT) ||
+ priv->pf_bond > MLX5_PORT_ID_BONDING_PF_MASK) {
+ DRV_LOG(ERR, "can't update switch port ID"
+ " for bonding device");
+ assert(false);
+ return -ENODEV;
+ }
+ info->switch_info.port_id |=
+ priv->pf_bond << MLX5_PORT_ID_BONDING_PF_SHIFT;
+ }
MLX5_ETH_FOREACH_DEV(port_id) {
struct mlx5_priv *opriv =
rte_eth_devices[port_id].data->dev_private;