Skip to content

Commit 11351bf

Browse files
committed
Merge branch 'mlx4-fixes'
Or Gerlitz says: ==================== Mellanox 10/40G mlx4 driver fixes for 4.5-rc6 This series contains two fixes for the SRIOV HW LAG that was introduced in 4.5-rc1 and one fix that allows to revoke the administrative MAC that was assigned to VF through the PF. The VF mac fix needs to go for stable too. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents ebc363f + 6e52242 commit 11351bf

File tree

3 files changed

+22
-14
lines changed

3 files changed

+22
-14
lines changed

drivers/net/ethernet/mellanox/mlx4/en_netdev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2245,7 +2245,7 @@ static int mlx4_en_set_vf_mac(struct net_device *dev, int queue, u8 *mac)
22452245
struct mlx4_en_dev *mdev = en_priv->mdev;
22462246
u64 mac_u64 = mlx4_mac_to_u64(mac);
22472247

2248-
if (!is_valid_ether_addr(mac))
2248+
if (is_multicast_ether_addr(mac))
22492249
return -EINVAL;
22502250

22512251
return mlx4_set_vf_mac(mdev->dev, en_priv->port, queue, mac_u64);

drivers/net/ethernet/mellanox/mlx4/main.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,6 +1256,7 @@ static ssize_t set_port_ib_mtu(struct device *dev,
12561256
static int mlx4_mf_bond(struct mlx4_dev *dev)
12571257
{
12581258
int err = 0;
1259+
int nvfs;
12591260
struct mlx4_slaves_pport slaves_port1;
12601261
struct mlx4_slaves_pport slaves_port2;
12611262
DECLARE_BITMAP(slaves_port_1_2, MLX4_MFUNC_MAX);
@@ -1272,11 +1273,18 @@ static int mlx4_mf_bond(struct mlx4_dev *dev)
12721273
return -EINVAL;
12731274
}
12741275

1276+
/* number of virtual functions is number of total functions minus one
1277+
* physical function for each port.
1278+
*/
1279+
nvfs = bitmap_weight(slaves_port1.slaves, dev->persist->num_vfs + 1) +
1280+
bitmap_weight(slaves_port2.slaves, dev->persist->num_vfs + 1) - 2;
1281+
12751282
/* limit on maximum allowed VFs */
1276-
if ((bitmap_weight(slaves_port1.slaves, dev->persist->num_vfs + 1) +
1277-
bitmap_weight(slaves_port2.slaves, dev->persist->num_vfs + 1)) >
1278-
MAX_MF_BOND_ALLOWED_SLAVES)
1283+
if (nvfs > MAX_MF_BOND_ALLOWED_SLAVES) {
1284+
mlx4_warn(dev, "HA mode is not supported for %d VFs (max %d are allowed)\n",
1285+
nvfs, MAX_MF_BOND_ALLOWED_SLAVES);
12791286
return -EINVAL;
1287+
}
12801288

12811289
if (dev->caps.steering_mode != MLX4_STEERING_MODE_DEVICE_MANAGED) {
12821290
mlx4_warn(dev, "HA mode unsupported for NON DMFS steering\n");

drivers/net/ethernet/mellanox/mlx4/port.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,10 @@ int __mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac)
193193
if (need_mf_bond) {
194194
if (port == 1) {
195195
mutex_lock(&table->mutex);
196-
mutex_lock(&dup_table->mutex);
196+
mutex_lock_nested(&dup_table->mutex, SINGLE_DEPTH_NESTING);
197197
} else {
198198
mutex_lock(&dup_table->mutex);
199-
mutex_lock(&table->mutex);
199+
mutex_lock_nested(&table->mutex, SINGLE_DEPTH_NESTING);
200200
}
201201
} else {
202202
mutex_lock(&table->mutex);
@@ -389,10 +389,10 @@ void __mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, u64 mac)
389389
if (dup) {
390390
if (port == 1) {
391391
mutex_lock(&table->mutex);
392-
mutex_lock(&dup_table->mutex);
392+
mutex_lock_nested(&dup_table->mutex, SINGLE_DEPTH_NESTING);
393393
} else {
394394
mutex_lock(&dup_table->mutex);
395-
mutex_lock(&table->mutex);
395+
mutex_lock_nested(&table->mutex, SINGLE_DEPTH_NESTING);
396396
}
397397
} else {
398398
mutex_lock(&table->mutex);
@@ -479,10 +479,10 @@ int __mlx4_replace_mac(struct mlx4_dev *dev, u8 port, int qpn, u64 new_mac)
479479
if (dup) {
480480
if (port == 1) {
481481
mutex_lock(&table->mutex);
482-
mutex_lock(&dup_table->mutex);
482+
mutex_lock_nested(&dup_table->mutex, SINGLE_DEPTH_NESTING);
483483
} else {
484484
mutex_lock(&dup_table->mutex);
485-
mutex_lock(&table->mutex);
485+
mutex_lock_nested(&table->mutex, SINGLE_DEPTH_NESTING);
486486
}
487487
} else {
488488
mutex_lock(&table->mutex);
@@ -588,10 +588,10 @@ int __mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan,
588588
if (need_mf_bond) {
589589
if (port == 1) {
590590
mutex_lock(&table->mutex);
591-
mutex_lock(&dup_table->mutex);
591+
mutex_lock_nested(&dup_table->mutex, SINGLE_DEPTH_NESTING);
592592
} else {
593593
mutex_lock(&dup_table->mutex);
594-
mutex_lock(&table->mutex);
594+
mutex_lock_nested(&table->mutex, SINGLE_DEPTH_NESTING);
595595
}
596596
} else {
597597
mutex_lock(&table->mutex);
@@ -764,10 +764,10 @@ void __mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, u16 vlan)
764764
if (dup) {
765765
if (port == 1) {
766766
mutex_lock(&table->mutex);
767-
mutex_lock(&dup_table->mutex);
767+
mutex_lock_nested(&dup_table->mutex, SINGLE_DEPTH_NESTING);
768768
} else {
769769
mutex_lock(&dup_table->mutex);
770-
mutex_lock(&table->mutex);
770+
mutex_lock_nested(&table->mutex, SINGLE_DEPTH_NESTING);
771771
}
772772
} else {
773773
mutex_lock(&table->mutex);

0 commit comments

Comments
 (0)