summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Machata <petrm@mellanox.com>2018-06-25 10:48:14 +0300
committerDavid S. Miller <davem@davemloft.net>2018-06-26 18:05:21 +0900
commite6f1960ae6c736b7bb65a012809eb7c3654b42d7 (patch)
tree243380b69cb48f1d7b968566c889cdb60e53eb28
parent5f15e257e1e2bd17830fdf32ac715ca4a29a504f (diff)
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>
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
index 05c52e486330..c7243d3f91df 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
@@ -6870,7 +6870,20 @@ static struct mlxsw_sp_fid *
mlxsw_sp_rif_vlan_fid_get(struct mlxsw_sp_rif *rif,
struct netlink_ext_ack *extack)
{
- u16 vid = is_vlan_dev(rif->dev) ? vlan_dev_vlan_id(rif->dev) : 1;
+ u16 vid;
+ int err;
+
+ if (is_vlan_dev(rif->dev)) {
+ vid = vlan_dev_vlan_id(rif->dev);
+ } else {
+ err = br_vlan_get_pvid(rif->dev, &vid);
+ if (!vid)
+ err = -EINVAL;
+ if (err) {
+ NL_SET_ERR_MSG_MOD(extack, "Couldn't determine bridge PVID");
+ return ERR_PTR(err);
+ }
+ }
return mlxsw_sp_fid_8021q_get(rif->mlxsw_sp, vid);
}