diff options
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx4/port.c')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/port.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/port.c b/drivers/net/ethernet/mellanox/mlx4/port.c index 30eb1ead0fe6..9f268f05290a 100644 --- a/drivers/net/ethernet/mellanox/mlx4/port.c +++ b/drivers/net/ethernet/mellanox/mlx4/port.c | |||
@@ -553,9 +553,9 @@ int mlx4_get_slave_num_gids(struct mlx4_dev *dev, int slave, int port) | |||
553 | slaves_pport_actv = mlx4_phys_to_slaves_pport_actv( | 553 | slaves_pport_actv = mlx4_phys_to_slaves_pport_actv( |
554 | dev, &exclusive_ports); | 554 | dev, &exclusive_ports); |
555 | slave_gid -= bitmap_weight(slaves_pport_actv.slaves, | 555 | slave_gid -= bitmap_weight(slaves_pport_actv.slaves, |
556 | dev->num_vfs + 1); | 556 | dev->persist->num_vfs + 1); |
557 | } | 557 | } |
558 | vfs = bitmap_weight(slaves_pport.slaves, dev->num_vfs + 1) - 1; | 558 | vfs = bitmap_weight(slaves_pport.slaves, dev->persist->num_vfs + 1) - 1; |
559 | if (slave_gid <= ((MLX4_ROCE_MAX_GIDS - MLX4_ROCE_PF_GIDS) % vfs)) | 559 | if (slave_gid <= ((MLX4_ROCE_MAX_GIDS - MLX4_ROCE_PF_GIDS) % vfs)) |
560 | return ((MLX4_ROCE_MAX_GIDS - MLX4_ROCE_PF_GIDS) / vfs) + 1; | 560 | return ((MLX4_ROCE_MAX_GIDS - MLX4_ROCE_PF_GIDS) / vfs) + 1; |
561 | return (MLX4_ROCE_MAX_GIDS - MLX4_ROCE_PF_GIDS) / vfs; | 561 | return (MLX4_ROCE_MAX_GIDS - MLX4_ROCE_PF_GIDS) / vfs; |
@@ -590,10 +590,10 @@ int mlx4_get_base_gid_ix(struct mlx4_dev *dev, int slave, int port) | |||
590 | slaves_pport_actv = mlx4_phys_to_slaves_pport_actv( | 590 | slaves_pport_actv = mlx4_phys_to_slaves_pport_actv( |
591 | dev, &exclusive_ports); | 591 | dev, &exclusive_ports); |
592 | slave_gid -= bitmap_weight(slaves_pport_actv.slaves, | 592 | slave_gid -= bitmap_weight(slaves_pport_actv.slaves, |
593 | dev->num_vfs + 1); | 593 | dev->persist->num_vfs + 1); |
594 | } | 594 | } |
595 | gids = MLX4_ROCE_MAX_GIDS - MLX4_ROCE_PF_GIDS; | 595 | gids = MLX4_ROCE_MAX_GIDS - MLX4_ROCE_PF_GIDS; |
596 | vfs = bitmap_weight(slaves_pport.slaves, dev->num_vfs + 1) - 1; | 596 | vfs = bitmap_weight(slaves_pport.slaves, dev->persist->num_vfs + 1) - 1; |
597 | if (slave_gid <= gids % vfs) | 597 | if (slave_gid <= gids % vfs) |
598 | return MLX4_ROCE_PF_GIDS + ((gids / vfs) + 1) * (slave_gid - 1); | 598 | return MLX4_ROCE_PF_GIDS + ((gids / vfs) + 1) * (slave_gid - 1); |
599 | 599 | ||
@@ -644,7 +644,7 @@ void mlx4_reset_roce_gids(struct mlx4_dev *dev, int slave) | |||
644 | int num_eth_ports, err; | 644 | int num_eth_ports, err; |
645 | int i; | 645 | int i; |
646 | 646 | ||
647 | if (slave < 0 || slave > dev->num_vfs) | 647 | if (slave < 0 || slave > dev->persist->num_vfs) |
648 | return; | 648 | return; |
649 | 649 | ||
650 | actv_ports = mlx4_get_active_ports(dev, slave); | 650 | actv_ports = mlx4_get_active_ports(dev, slave); |
@@ -1214,7 +1214,8 @@ int mlx4_get_slave_from_roce_gid(struct mlx4_dev *dev, int port, u8 *gid, | |||
1214 | return -EINVAL; | 1214 | return -EINVAL; |
1215 | 1215 | ||
1216 | slaves_pport = mlx4_phys_to_slaves_pport(dev, port); | 1216 | slaves_pport = mlx4_phys_to_slaves_pport(dev, port); |
1217 | num_vfs = bitmap_weight(slaves_pport.slaves, dev->num_vfs + 1) - 1; | 1217 | num_vfs = bitmap_weight(slaves_pport.slaves, |
1218 | dev->persist->num_vfs + 1) - 1; | ||
1218 | 1219 | ||
1219 | for (i = 0; i < MLX4_ROCE_MAX_GIDS; i++) { | 1220 | for (i = 0; i < MLX4_ROCE_MAX_GIDS; i++) { |
1220 | if (!memcmp(priv->port[port].gid_table.roce_gids[i].raw, gid, | 1221 | if (!memcmp(priv->port[port].gid_table.roce_gids[i].raw, gid, |
@@ -1258,7 +1259,7 @@ int mlx4_get_slave_from_roce_gid(struct mlx4_dev *dev, int port, u8 *gid, | |||
1258 | dev, &exclusive_ports); | 1259 | dev, &exclusive_ports); |
1259 | num_vfs_before += bitmap_weight( | 1260 | num_vfs_before += bitmap_weight( |
1260 | slaves_pport_actv.slaves, | 1261 | slaves_pport_actv.slaves, |
1261 | dev->num_vfs + 1); | 1262 | dev->persist->num_vfs + 1); |
1262 | } | 1263 | } |
1263 | 1264 | ||
1264 | /* candidate_slave_gid isn't necessarily the correct slave, but | 1265 | /* candidate_slave_gid isn't necessarily the correct slave, but |
@@ -1288,7 +1289,7 @@ int mlx4_get_slave_from_roce_gid(struct mlx4_dev *dev, int port, u8 *gid, | |||
1288 | dev, &exclusive_ports); | 1289 | dev, &exclusive_ports); |
1289 | slave_gid += bitmap_weight( | 1290 | slave_gid += bitmap_weight( |
1290 | slaves_pport_actv.slaves, | 1291 | slaves_pport_actv.slaves, |
1291 | dev->num_vfs + 1); | 1292 | dev->persist->num_vfs + 1); |
1292 | } | 1293 | } |
1293 | } | 1294 | } |
1294 | *slave_id = slave_gid; | 1295 | *slave_id = slave_gid; |