mlxsw: spectrum: Move handling of tunnel events to router code
authorPetr Machata <petrm@nvidia.com>
Sun, 8 May 2022 08:08:19 +0000 (11:08 +0300)
committerDavid S. Miller <davem@davemloft.net>
Sun, 8 May 2022 10:46:20 +0000 (11:46 +0100)
The events related to IPIP tunnels are handled by the router code. Move the
handling from the central dispatcher in spectrum.c to the new notifier
handler in the router module.

Signed-off-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.c
drivers/net/ethernet/mellanox/mlxsw/spectrum.h
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c

index afc03ba9382695bffed478a750c2bb4b4ba7a85d..5ced3df92aabdc7396efcb86d78930cbeb9f3cda 100644 (file)
@@ -5022,12 +5022,6 @@ static int mlxsw_sp_netdevice_event(struct notifier_block *nb,
 
        if (netif_is_vxlan(dev))
                err = mlxsw_sp_netdevice_vxlan_event(mlxsw_sp, dev, event, ptr);
-       if (mlxsw_sp_netdev_is_ipip_ol(mlxsw_sp, dev))
-               err = mlxsw_sp_netdevice_ipip_ol_event(mlxsw_sp, dev,
-                                                      event, ptr);
-       else if (mlxsw_sp_netdev_is_ipip_ul(mlxsw_sp, dev))
-               err = mlxsw_sp_netdevice_ipip_ul_event(mlxsw_sp, dev,
-                                                      event, ptr);
        else if (mlxsw_sp_port_dev_check(dev))
                err = mlxsw_sp_netdevice_port_event(dev, dev, event, ptr);
        else if (netif_is_lag_master(dev))
index 983195ee881e50bbe4f91a4257c8cb1df3b853e2..a60d2bbd3aa6e258e8787a98c1e194d32089e9ed 100644 (file)
@@ -724,19 +724,6 @@ int mlxsw_sp_inetaddr_valid_event(struct notifier_block *unused,
                                  unsigned long event, void *ptr);
 int mlxsw_sp_inet6addr_valid_event(struct notifier_block *unused,
                                   unsigned long event, void *ptr);
-bool mlxsw_sp_netdev_is_ipip_ol(const struct mlxsw_sp *mlxsw_sp,
-                               const struct net_device *dev);
-bool mlxsw_sp_netdev_is_ipip_ul(struct mlxsw_sp *mlxsw_sp,
-                               const struct net_device *dev);
-int mlxsw_sp_netdevice_ipip_ol_event(struct mlxsw_sp *mlxsw_sp,
-                                    struct net_device *l3_dev,
-                                    unsigned long event,
-                                    struct netdev_notifier_info *info);
-int
-mlxsw_sp_netdevice_ipip_ul_event(struct mlxsw_sp *mlxsw_sp,
-                                struct net_device *l3_dev,
-                                unsigned long event,
-                                struct netdev_notifier_info *info);
 int
 mlxsw_sp_port_vlan_router_join(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan,
                               struct net_device *l3_dev,
index d5a8307aecb3c1b091c75391999911bc36438877..54e19e988c01c53a2397a763133e7054f98c1062 100644 (file)
@@ -1530,8 +1530,8 @@ static bool mlxsw_sp_netdev_ipip_type(const struct mlxsw_sp *mlxsw_sp,
        return false;
 }
 
-bool mlxsw_sp_netdev_is_ipip_ol(const struct mlxsw_sp *mlxsw_sp,
-                               const struct net_device *dev)
+static bool mlxsw_sp_netdev_is_ipip_ol(const struct mlxsw_sp *mlxsw_sp,
+                                      const struct net_device *dev)
 {
        return mlxsw_sp_netdev_ipip_type(mlxsw_sp, dev, NULL);
 }
@@ -1575,8 +1575,8 @@ mlxsw_sp_ipip_entry_find_by_ul_dev(const struct mlxsw_sp *mlxsw_sp,
        return NULL;
 }
 
-bool mlxsw_sp_netdev_is_ipip_ul(struct mlxsw_sp *mlxsw_sp,
-                               const struct net_device *dev)
+static bool mlxsw_sp_netdev_is_ipip_ul(struct mlxsw_sp *mlxsw_sp,
+                                      const struct net_device *dev)
 {
        bool is_ipip_ul;
 
@@ -1960,10 +1960,10 @@ static void mlxsw_sp_ipip_demote_tunnel_by_ul_netdev(struct mlxsw_sp *mlxsw_sp,
        }
 }
 
-int mlxsw_sp_netdevice_ipip_ol_event(struct mlxsw_sp *mlxsw_sp,
-                                    struct net_device *ol_dev,
-                                    unsigned long event,
-                                    struct netdev_notifier_info *info)
+static int mlxsw_sp_netdevice_ipip_ol_event(struct mlxsw_sp *mlxsw_sp,
+                                           struct net_device *ol_dev,
+                                           unsigned long event,
+                                           struct netdev_notifier_info *info)
 {
        struct netdev_notifier_changeupper_info *chup;
        struct netlink_ext_ack *extack;
@@ -2038,7 +2038,7 @@ __mlxsw_sp_netdevice_ipip_ul_event(struct mlxsw_sp *mlxsw_sp,
        return 0;
 }
 
-int
+static int
 mlxsw_sp_netdevice_ipip_ul_event(struct mlxsw_sp *mlxsw_sp,
                                 struct net_device *ul_dev,
                                 unsigned long event,
@@ -9569,6 +9569,12 @@ static int mlxsw_sp_router_netdevice_event(struct notifier_block *nb,
        if (mlxsw_sp_is_offload_xstats_event(event))
                err = mlxsw_sp_netdevice_offload_xstats_cmd(mlxsw_sp, dev,
                                                            event, ptr);
+       else if (mlxsw_sp_netdev_is_ipip_ol(mlxsw_sp, dev))
+               err = mlxsw_sp_netdevice_ipip_ol_event(mlxsw_sp, dev,
+                                                      event, ptr);
+       else if (mlxsw_sp_netdev_is_ipip_ul(mlxsw_sp, dev))
+               err = mlxsw_sp_netdevice_ipip_ul_event(mlxsw_sp, dev,
+                                                      event, ptr);
        else if (mlxsw_sp_is_router_event(event))
                err = mlxsw_sp_netdevice_router_port_event(dev, event, ptr);
        else if (mlxsw_sp_is_vrf_event(event, ptr))