Skip to content

Commit 955154f

Browse files
matanb10davem330
authored andcommitted
net/mlx4_en: Don't reassign port mac address on firmware that supports it
Mac reassignments should only be done when not supported by the firmware. To accomplish that, checking firmware capability bit to know whether we should reassign macs in the driver. Signed-off-by: Matan Barak <matanb@mellanox.com> Signed-off-by: Amir Vadai <amirv@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 23537b7 commit 955154f

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1285,7 +1285,8 @@ void mlx4_en_stop_port(struct net_device *dev)
12851285

12861286
/* Unregister Mac address for the port */
12871287
mlx4_put_eth_qp(mdev->dev, priv->port, priv->mac, priv->base_qpn);
1288-
mdev->mac_removed[priv->port] = 1;
1288+
if (!(mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAGS2_REASSIGN_MAC_EN))
1289+
mdev->mac_removed[priv->port] = 1;
12891290

12901291
/* Remove flow steering rules for the port*/
12911292
if (mdev->dev->caps.steering_mode ==

‎drivers/net/ethernet/mellanox/mlx4/fw.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ static void dump_dev_cap_flags2(struct mlx4_dev *dev, u64 flags)
127127
[0] = "RSS support",
128128
[1] = "RSS Toeplitz Hash Function support",
129129
[2] = "RSS XOR Hash Function support",
130-
[3] = "Device manage flow steering support"
130+
[3] = "Device manage flow steering support",
131+
[4] = "Automatic mac reassignment support"
131132
};
132133
int i;
133134

@@ -478,6 +479,7 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
478479
#define QUERY_DEV_CAP_BMME_FLAGS_OFFSET 0x94
479480
#define QUERY_DEV_CAP_RSVD_LKEY_OFFSET 0x98
480481
#define QUERY_DEV_CAP_MAX_ICM_SZ_OFFSET 0xa0
482+
#define QUERY_DEV_CAP_FW_REASSIGN_MAC 0x9d
481483

482484
dev_cap->flags2 = 0;
483485
mailbox = mlx4_alloc_cmd_mailbox(dev);
@@ -637,6 +639,9 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
637639
QUERY_DEV_CAP_BMME_FLAGS_OFFSET);
638640
MLX4_GET(dev_cap->reserved_lkey, outbox,
639641
QUERY_DEV_CAP_RSVD_LKEY_OFFSET);
642+
MLX4_GET(field, outbox, QUERY_DEV_CAP_FW_REASSIGN_MAC);
643+
if (field & 1<<6)
644+
dev_cap->flags2 |= MLX4_DEV_CAP_FLAGS2_REASSIGN_MAC_EN;
640645
MLX4_GET(dev_cap->max_icm_sz, outbox,
641646
QUERY_DEV_CAP_MAX_ICM_SZ_OFFSET);
642647
if (dev_cap->flags & MLX4_DEV_CAP_FLAG_COUNTERS)

‎include/linux/mlx4/device.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ enum {
150150
MLX4_DEV_CAP_FLAG2_RSS = 1LL << 0,
151151
MLX4_DEV_CAP_FLAG2_RSS_TOP = 1LL << 1,
152152
MLX4_DEV_CAP_FLAG2_RSS_XOR = 1LL << 2,
153-
MLX4_DEV_CAP_FLAG2_FS_EN = 1LL << 3
153+
MLX4_DEV_CAP_FLAG2_FS_EN = 1LL << 3,
154+
MLX4_DEV_CAP_FLAGS2_REASSIGN_MAC_EN = 1LL << 4
154155
};
155156

156157
enum {

0 commit comments

Comments
 (0)