mlxsw: spectrum_switchdev: Create common function for joining VxLAN to VLAN-aware...
authorAmit Cohen <amcohen@nvidia.com>
Tue, 8 Dec 2020 09:22:44 +0000 (11:22 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 8 Dec 2020 23:45:56 +0000 (15:45 -0800)
The code in mlxsw_sp_bridge_8021q_vxlan_join() can be used also for
802.1ad bridge.

Move the code to function called mlxsw_sp_bridge_vlan_aware_vxlan_join()
and call it from mlxsw_sp_bridge_8021q_vxlan_join() to enable code
reuse.

Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c

index 9c4e176..c53e0ab 100644 (file)
@@ -2053,9 +2053,9 @@ mlxsw_sp_bridge_8021q_port_leave(struct mlxsw_sp_bridge_device *bridge_device,
 }
 
 static int
-mlxsw_sp_bridge_8021q_vxlan_join(struct mlxsw_sp_bridge_device *bridge_device,
-                                const struct net_device *vxlan_dev, u16 vid,
-                                struct netlink_ext_ack *extack)
+mlxsw_sp_bridge_vlan_aware_vxlan_join(struct mlxsw_sp_bridge_device *bridge_device,
+                                     const struct net_device *vxlan_dev,
+                                     u16 vid, struct netlink_ext_ack *extack)
 {
        struct mlxsw_sp *mlxsw_sp = mlxsw_sp_lower_get(bridge_device->dev);
        struct vxlan_dev *vxlan = netdev_priv(vxlan_dev);
@@ -2101,6 +2101,15 @@ err_vni_exists:
        return err;
 }
 
+static int
+mlxsw_sp_bridge_8021q_vxlan_join(struct mlxsw_sp_bridge_device *bridge_device,
+                                const struct net_device *vxlan_dev, u16 vid,
+                                struct netlink_ext_ack *extack)
+{
+       return mlxsw_sp_bridge_vlan_aware_vxlan_join(bridge_device, vxlan_dev,
+                                                    vid, extack);
+}
+
 static struct net_device *
 mlxsw_sp_bridge_8021q_vxlan_dev_find(struct net_device *br_dev, u16 vid)
 {