Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mlxsw: spectrum_router: Allocate FID according to PVID

For bridge netdevices, instead of assuming that the router traffic is on
VLAN 1, look at the bridge PVID.

This patch assumes that the PVID doesn't change after the router
interface is created (i.e. after the IP address is assigned).

Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Petr Machata and committed by
David S. Miller
e6f1960a 5f15e257

+14 -1
+14 -1
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
··· 6870 6870 mlxsw_sp_rif_vlan_fid_get(struct mlxsw_sp_rif *rif, 6871 6871 struct netlink_ext_ack *extack) 6872 6872 { 6873 - u16 vid = is_vlan_dev(rif->dev) ? vlan_dev_vlan_id(rif->dev) : 1; 6873 + u16 vid; 6874 + int err; 6875 + 6876 + if (is_vlan_dev(rif->dev)) { 6877 + vid = vlan_dev_vlan_id(rif->dev); 6878 + } else { 6879 + err = br_vlan_get_pvid(rif->dev, &vid); 6880 + if (!vid) 6881 + err = -EINVAL; 6882 + if (err) { 6883 + NL_SET_ERR_MSG_MOD(extack, "Couldn't determine bridge PVID"); 6884 + return ERR_PTR(err); 6885 + } 6886 + } 6874 6887 6875 6888 return mlxsw_sp_fid_8021q_get(rif->mlxsw_sp, vid); 6876 6889 }