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

mlxsw: spectrum_switchdev: Prepare function for VLAN-aware bridges

The vxlan_join() function resolves the FID on which the VNI should be
set and then sets the VNI. Currently, the FID is simply resolved
according to the ifindex of the bridge device to which the VxLAN device
is enslaved. This works because only VLAN-unaware bridges are supported.

With VLAN-aware bridges the FID would need to be resolved based on the
VLAN to which the VNI is mapped to.

Add the VLAN ID to the argument list of the function.

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

authored by

Ido Schimmel and committed by
David S. Miller
48fde466 b03fa9e7

+11 -9
+2 -2
drivers/net/ethernet/mellanox/mlxsw/spectrum.c
··· 5172 5172 if (!netif_running(dev)) 5173 5173 return 0; 5174 5174 return mlxsw_sp_bridge_vxlan_join(mlxsw_sp, upper_dev, 5175 - dev, extack); 5175 + dev, 0, extack); 5176 5176 } else { 5177 5177 mlxsw_sp_bridge_vxlan_leave(mlxsw_sp, dev); 5178 5178 } ··· 5185 5185 return 0; 5186 5186 if (!mlxsw_sp_lower_get(upper_dev)) 5187 5187 return 0; 5188 - return mlxsw_sp_bridge_vxlan_join(mlxsw_sp, upper_dev, dev, 5188 + return mlxsw_sp_bridge_vxlan_join(mlxsw_sp, upper_dev, dev, 0, 5189 5189 extack); 5190 5190 case NETDEV_DOWN: 5191 5191 upper_dev = netdev_master_upper_dev_get(dev);
+1 -1
drivers/net/ethernet/mellanox/mlxsw/spectrum.h
··· 358 358 const struct net_device *br_dev); 359 359 int mlxsw_sp_bridge_vxlan_join(struct mlxsw_sp *mlxsw_sp, 360 360 const struct net_device *br_dev, 361 - const struct net_device *vxlan_dev, 361 + const struct net_device *vxlan_dev, u16 vid, 362 362 struct netlink_ext_ack *extack); 363 363 void mlxsw_sp_bridge_vxlan_leave(struct mlxsw_sp *mlxsw_sp, 364 364 const struct net_device *vxlan_dev);
+8 -6
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
··· 85 85 struct mlxsw_sp_bridge_port *bridge_port, 86 86 struct mlxsw_sp_port *mlxsw_sp_port); 87 87 int (*vxlan_join)(struct mlxsw_sp_bridge_device *bridge_device, 88 - const struct net_device *vxlan_dev, 88 + const struct net_device *vxlan_dev, u16 vid, 89 89 struct netlink_ext_ack *extack); 90 90 struct mlxsw_sp_fid * 91 91 (*fid_get)(struct mlxsw_sp_bridge_device *bridge_device, ··· 2003 2003 2004 2004 static int 2005 2005 mlxsw_sp_bridge_8021q_vxlan_join(struct mlxsw_sp_bridge_device *bridge_device, 2006 - const struct net_device *vxlan_dev, 2006 + const struct net_device *vxlan_dev, u16 vid, 2007 2007 struct netlink_ext_ack *extack) 2008 2008 { 2009 2009 WARN_ON(1); ··· 2107 2107 2108 2108 static int 2109 2109 mlxsw_sp_bridge_8021d_vxlan_join(struct mlxsw_sp_bridge_device *bridge_device, 2110 - const struct net_device *vxlan_dev, 2110 + const struct net_device *vxlan_dev, u16 vid, 2111 2111 struct netlink_ext_ack *extack) 2112 2112 { 2113 2113 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_lower_get(bridge_device->dev); ··· 2166 2166 if (!netif_running(vxlan_dev)) 2167 2167 return fid; 2168 2168 2169 - err = mlxsw_sp_bridge_8021d_vxlan_join(bridge_device, vxlan_dev, NULL); 2169 + err = mlxsw_sp_bridge_8021d_vxlan_join(bridge_device, vxlan_dev, 0, 2170 + NULL); 2170 2171 if (err) 2171 2172 goto err_vxlan_join; 2172 2173 ··· 2256 2255 2257 2256 int mlxsw_sp_bridge_vxlan_join(struct mlxsw_sp *mlxsw_sp, 2258 2257 const struct net_device *br_dev, 2259 - const struct net_device *vxlan_dev, 2258 + const struct net_device *vxlan_dev, u16 vid, 2260 2259 struct netlink_ext_ack *extack) 2261 2260 { 2262 2261 struct mlxsw_sp_bridge_device *bridge_device; ··· 2265 2264 if (WARN_ON(!bridge_device)) 2266 2265 return -EINVAL; 2267 2266 2268 - return bridge_device->ops->vxlan_join(bridge_device, vxlan_dev, extack); 2267 + return bridge_device->ops->vxlan_join(bridge_device, vxlan_dev, vid, 2268 + extack); 2269 2269 } 2270 2270 2271 2271 void mlxsw_sp_bridge_vxlan_leave(struct mlxsw_sp *mlxsw_sp,