Skip to content

Commit 6ce966f

Browse files
ogerlitzSaeed Mahameed
authored andcommitted
net/mlx5e: Unblock setting vid 0 for VFs through the uplink rep
It turns out that libvirt uses 0-vid as a default if no vlan was set for the guest (which is the case for switchdev mode) and errs if we disallow that: error: Failed to start domain vm75 error: Cannot set interface MAC/vlanid to 6a:66:2d:48:92:c2/0 \ for ifname enp59s0f0 vf 0: Operation not supported So allow this in order not to break existing systems. Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Reported-by: Maor Dickman <maord@mellanox.com> Reviewed-by: Gavi Teitz <gavi@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
1 parent c12ecc2 commit 6ce966f

File tree

1 file changed

+13
-0
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core

1 file changed

+13
-0
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_rep.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,6 +1293,18 @@ static int mlx5e_uplink_rep_set_mac(struct net_device *netdev, void *addr)
12931293
return 0;
12941294
}
12951295

1296+
static int mlx5e_uplink_rep_set_vf_vlan(struct net_device *dev, int vf, u16 vlan, u8 qos,
1297+
__be16 vlan_proto)
1298+
{
1299+
netdev_warn_once(dev, "legacy vf vlan setting isn't supported in switchdev mode\n");
1300+
1301+
if (vlan != 0)
1302+
return -EOPNOTSUPP;
1303+
1304+
/* allow setting 0-vid for compatibility with libvirt */
1305+
return 0;
1306+
}
1307+
12961308
static const struct switchdev_ops mlx5e_rep_switchdev_ops = {
12971309
.switchdev_port_attr_get = mlx5e_attr_get,
12981310
};
@@ -1327,6 +1339,7 @@ static const struct net_device_ops mlx5e_netdev_ops_uplink_rep = {
13271339
.ndo_set_vf_rate = mlx5e_set_vf_rate,
13281340
.ndo_get_vf_config = mlx5e_get_vf_config,
13291341
.ndo_get_vf_stats = mlx5e_get_vf_stats,
1342+
.ndo_set_vf_vlan = mlx5e_uplink_rep_set_vf_vlan,
13301343
};
13311344

13321345
bool mlx5e_eswitch_rep(struct net_device *netdev)

0 commit comments

Comments
 (0)