mlxsw: spectrum_router: Do not force specific configuration order
authorIdo Schimmel <idosch@mellanox.com>
Thu, 20 Dec 2018 19:42:23 +0000 (19:42 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 20 Dec 2018 23:48:54 +0000 (15:48 -0800)
In symmetric routing, the only two members in the VLAN corresponding to
the L3 VNI are the router port and the VXLAN tunnel.

In case the VXLAN device is already enslaved to the bridge and only
later the VLAN interface is configured, the tunnel will not be
offloaded.

The reason for this is that when the router interface (RIF)
corresponding to the VLAN interface is configured, it calls the core
fid_get() API which does not check if NVE should be enabled on the FID.

Instead, call into the bridge code which will check if NVE should be
enabled on the FID.

This effectively means that the same code path is used to retrieve a FID
when either a local port or a router port joins the FID.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum.h
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c

index f022e9e2408582bffa64c692b060e0978e60791f..a7f8a4611baa07b39be37a1b7342034ff6ce41d4 100644 (file)
@@ -387,6 +387,10 @@ int mlxsw_sp_bridge_vxlan_join(struct mlxsw_sp *mlxsw_sp,
                               struct netlink_ext_ack *extack);
 void mlxsw_sp_bridge_vxlan_leave(struct mlxsw_sp *mlxsw_sp,
                                 const struct net_device *vxlan_dev);
+struct mlxsw_sp_fid *mlxsw_sp_bridge_fid_get(struct mlxsw_sp *mlxsw_sp,
+                                            const struct net_device *br_dev,
+                                            u16 vid,
+                                            struct netlink_ext_ack *extack);
 extern struct notifier_block mlxsw_sp_switchdev_notifier;
 
 /* spectrum.c */
index 673950933daceede107ec0e04022be6f5a14d5eb..96e2904daf574e2c6e1efbd69a6aa7e2377d78aa 100644 (file)
@@ -7260,11 +7260,15 @@ static struct mlxsw_sp_fid *
 mlxsw_sp_rif_vlan_fid_get(struct mlxsw_sp_rif *rif,
                          struct netlink_ext_ack *extack)
 {
+       struct net_device *br_dev = rif->dev;
        u16 vid;
        int err;
 
        if (is_vlan_dev(rif->dev)) {
                vid = vlan_dev_vlan_id(rif->dev);
+               br_dev = vlan_dev_real_dev(rif->dev);
+               if (WARN_ON(!netif_is_bridge_master(br_dev)))
+                       return ERR_PTR(-EINVAL);
        } else {
                err = br_vlan_get_pvid(rif->dev, &vid);
                if (err < 0 || !vid) {
@@ -7273,7 +7277,7 @@ mlxsw_sp_rif_vlan_fid_get(struct mlxsw_sp_rif *rif,
                }
        }
 
-       return mlxsw_sp_fid_8021q_get(rif->mlxsw_sp, vid);
+       return mlxsw_sp_bridge_fid_get(rif->mlxsw_sp, br_dev, vid, extack);
 }
 
 static void mlxsw_sp_rif_vlan_fdb_del(struct mlxsw_sp_rif *rif, const char *mac)
@@ -7363,7 +7367,7 @@ static struct mlxsw_sp_fid *
 mlxsw_sp_rif_fid_fid_get(struct mlxsw_sp_rif *rif,
                         struct netlink_ext_ack *extack)
 {
-       return mlxsw_sp_fid_8021d_get(rif->mlxsw_sp, rif->dev->ifindex);
+       return mlxsw_sp_bridge_fid_get(rif->mlxsw_sp, rif->dev, 0, extack);
 }
 
 static void mlxsw_sp_rif_fid_fdb_del(struct mlxsw_sp_rif *rif, const char *mac)
index 4b7ef83c19c4e2adf977aad1595ff6fee219bc31..7d89c8dedb4aeb460a49853d881a489dc9e9fb62 100644 (file)
@@ -2386,6 +2386,20 @@ void mlxsw_sp_bridge_vxlan_leave(struct mlxsw_sp *mlxsw_sp,
        mlxsw_sp_fid_put(fid);
 }
 
+struct mlxsw_sp_fid *mlxsw_sp_bridge_fid_get(struct mlxsw_sp *mlxsw_sp,
+                                            const struct net_device *br_dev,
+                                            u16 vid,
+                                            struct netlink_ext_ack *extack)
+{
+       struct mlxsw_sp_bridge_device *bridge_device;
+
+       bridge_device = mlxsw_sp_bridge_device_find(mlxsw_sp->bridge, br_dev);
+       if (WARN_ON(!bridge_device))
+               return ERR_PTR(-EINVAL);
+
+       return bridge_device->ops->fid_get(bridge_device, vid, extack);
+}
+
 static void
 mlxsw_sp_switchdev_vxlan_addr_convert(const union vxlan_addr *vxlan_addr,
                                      enum mlxsw_sp_l3proto *proto,