Commit 48fde466 authored by Ido Schimmel's avatar Ido Schimmel Committed by David S. Miller

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: default avatarIdo Schimmel <idosch@mellanox.com>
Reviewed-by: default avatarPetr Machata <petrm@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b03fa9e7
...@@ -5172,7 +5172,7 @@ static int mlxsw_sp_netdevice_vxlan_event(struct mlxsw_sp *mlxsw_sp, ...@@ -5172,7 +5172,7 @@ static int mlxsw_sp_netdevice_vxlan_event(struct mlxsw_sp *mlxsw_sp,
if (!netif_running(dev)) if (!netif_running(dev))
return 0; return 0;
return mlxsw_sp_bridge_vxlan_join(mlxsw_sp, upper_dev, return mlxsw_sp_bridge_vxlan_join(mlxsw_sp, upper_dev,
dev, extack); dev, 0, extack);
} else { } else {
mlxsw_sp_bridge_vxlan_leave(mlxsw_sp, dev); mlxsw_sp_bridge_vxlan_leave(mlxsw_sp, dev);
} }
...@@ -5185,7 +5185,7 @@ static int mlxsw_sp_netdevice_vxlan_event(struct mlxsw_sp *mlxsw_sp, ...@@ -5185,7 +5185,7 @@ static int mlxsw_sp_netdevice_vxlan_event(struct mlxsw_sp *mlxsw_sp,
return 0; return 0;
if (!mlxsw_sp_lower_get(upper_dev)) if (!mlxsw_sp_lower_get(upper_dev))
return 0; return 0;
return mlxsw_sp_bridge_vxlan_join(mlxsw_sp, upper_dev, dev, return mlxsw_sp_bridge_vxlan_join(mlxsw_sp, upper_dev, dev, 0,
extack); extack);
case NETDEV_DOWN: case NETDEV_DOWN:
upper_dev = netdev_master_upper_dev_get(dev); upper_dev = netdev_master_upper_dev_get(dev);
......
...@@ -358,7 +358,7 @@ bool mlxsw_sp_bridge_device_is_offloaded(const struct mlxsw_sp *mlxsw_sp, ...@@ -358,7 +358,7 @@ bool mlxsw_sp_bridge_device_is_offloaded(const struct mlxsw_sp *mlxsw_sp,
const struct net_device *br_dev); const struct net_device *br_dev);
int mlxsw_sp_bridge_vxlan_join(struct mlxsw_sp *mlxsw_sp, int mlxsw_sp_bridge_vxlan_join(struct mlxsw_sp *mlxsw_sp,
const struct net_device *br_dev, const struct net_device *br_dev,
const struct net_device *vxlan_dev, const struct net_device *vxlan_dev, u16 vid,
struct netlink_ext_ack *extack); struct netlink_ext_ack *extack);
void mlxsw_sp_bridge_vxlan_leave(struct mlxsw_sp *mlxsw_sp, void mlxsw_sp_bridge_vxlan_leave(struct mlxsw_sp *mlxsw_sp,
const struct net_device *vxlan_dev); const struct net_device *vxlan_dev);
......
...@@ -85,7 +85,7 @@ struct mlxsw_sp_bridge_ops { ...@@ -85,7 +85,7 @@ struct mlxsw_sp_bridge_ops {
struct mlxsw_sp_bridge_port *bridge_port, struct mlxsw_sp_bridge_port *bridge_port,
struct mlxsw_sp_port *mlxsw_sp_port); struct mlxsw_sp_port *mlxsw_sp_port);
int (*vxlan_join)(struct mlxsw_sp_bridge_device *bridge_device, int (*vxlan_join)(struct mlxsw_sp_bridge_device *bridge_device,
const struct net_device *vxlan_dev, const struct net_device *vxlan_dev, u16 vid,
struct netlink_ext_ack *extack); struct netlink_ext_ack *extack);
struct mlxsw_sp_fid * struct mlxsw_sp_fid *
(*fid_get)(struct mlxsw_sp_bridge_device *bridge_device, (*fid_get)(struct mlxsw_sp_bridge_device *bridge_device,
...@@ -2003,7 +2003,7 @@ mlxsw_sp_bridge_8021q_port_leave(struct mlxsw_sp_bridge_device *bridge_device, ...@@ -2003,7 +2003,7 @@ mlxsw_sp_bridge_8021q_port_leave(struct mlxsw_sp_bridge_device *bridge_device,
static int static int
mlxsw_sp_bridge_8021q_vxlan_join(struct mlxsw_sp_bridge_device *bridge_device, mlxsw_sp_bridge_8021q_vxlan_join(struct mlxsw_sp_bridge_device *bridge_device,
const struct net_device *vxlan_dev, const struct net_device *vxlan_dev, u16 vid,
struct netlink_ext_ack *extack) struct netlink_ext_ack *extack)
{ {
WARN_ON(1); WARN_ON(1);
...@@ -2107,7 +2107,7 @@ mlxsw_sp_bridge_8021d_port_leave(struct mlxsw_sp_bridge_device *bridge_device, ...@@ -2107,7 +2107,7 @@ mlxsw_sp_bridge_8021d_port_leave(struct mlxsw_sp_bridge_device *bridge_device,
static int static int
mlxsw_sp_bridge_8021d_vxlan_join(struct mlxsw_sp_bridge_device *bridge_device, mlxsw_sp_bridge_8021d_vxlan_join(struct mlxsw_sp_bridge_device *bridge_device,
const struct net_device *vxlan_dev, const struct net_device *vxlan_dev, u16 vid,
struct netlink_ext_ack *extack) struct netlink_ext_ack *extack)
{ {
struct mlxsw_sp *mlxsw_sp = mlxsw_sp_lower_get(bridge_device->dev); struct mlxsw_sp *mlxsw_sp = mlxsw_sp_lower_get(bridge_device->dev);
...@@ -2166,7 +2166,8 @@ mlxsw_sp_bridge_8021d_fid_get(struct mlxsw_sp_bridge_device *bridge_device, ...@@ -2166,7 +2166,8 @@ mlxsw_sp_bridge_8021d_fid_get(struct mlxsw_sp_bridge_device *bridge_device,
if (!netif_running(vxlan_dev)) if (!netif_running(vxlan_dev))
return fid; return fid;
err = mlxsw_sp_bridge_8021d_vxlan_join(bridge_device, vxlan_dev, NULL); err = mlxsw_sp_bridge_8021d_vxlan_join(bridge_device, vxlan_dev, 0,
NULL);
if (err) if (err)
goto err_vxlan_join; goto err_vxlan_join;
...@@ -2255,7 +2256,7 @@ void mlxsw_sp_port_bridge_leave(struct mlxsw_sp_port *mlxsw_sp_port, ...@@ -2255,7 +2256,7 @@ void mlxsw_sp_port_bridge_leave(struct mlxsw_sp_port *mlxsw_sp_port,
int mlxsw_sp_bridge_vxlan_join(struct mlxsw_sp *mlxsw_sp, int mlxsw_sp_bridge_vxlan_join(struct mlxsw_sp *mlxsw_sp,
const struct net_device *br_dev, const struct net_device *br_dev,
const struct net_device *vxlan_dev, const struct net_device *vxlan_dev, u16 vid,
struct netlink_ext_ack *extack) struct netlink_ext_ack *extack)
{ {
struct mlxsw_sp_bridge_device *bridge_device; struct mlxsw_sp_bridge_device *bridge_device;
...@@ -2264,7 +2265,8 @@ int mlxsw_sp_bridge_vxlan_join(struct mlxsw_sp *mlxsw_sp, ...@@ -2264,7 +2265,8 @@ int mlxsw_sp_bridge_vxlan_join(struct mlxsw_sp *mlxsw_sp,
if (WARN_ON(!bridge_device)) if (WARN_ON(!bridge_device))
return -EINVAL; return -EINVAL;
return bridge_device->ops->vxlan_join(bridge_device, vxlan_dev, extack); return bridge_device->ops->vxlan_join(bridge_device, vxlan_dev, vid,
extack);
} }
void mlxsw_sp_bridge_vxlan_leave(struct mlxsw_sp *mlxsw_sp, void mlxsw_sp_bridge_vxlan_leave(struct mlxsw_sp *mlxsw_sp,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment