mlxsw: spectrum: Move handling of VRF events to router code
Events involving VRF, as L3 concern, are handled in the router code, by the helper mlxsw_sp_netdevice_vrf_event(). The handler is currently invoked from the centralized dispatcher in spectrum.c. Instead, move the call to the newly-introduced router-specific notifier handler. 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>
This commit is contained in:
parent
0a27cb1692
commit
4f8afb680f
|
@ -4936,15 +4936,6 @@ static int mlxsw_sp_netdevice_macvlan_event(struct net_device *macvlan_dev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static bool mlxsw_sp_is_vrf_event(unsigned long event, void *ptr)
|
||||
{
|
||||
struct netdev_notifier_changeupper_info *info = ptr;
|
||||
|
||||
if (event != NETDEV_PRECHANGEUPPER && event != NETDEV_CHANGEUPPER)
|
||||
return false;
|
||||
return netif_is_l3_master(info->upper_dev);
|
||||
}
|
||||
|
||||
static int mlxsw_sp_netdevice_vxlan_event(struct mlxsw_sp *mlxsw_sp,
|
||||
struct net_device *dev,
|
||||
unsigned long event, void *ptr)
|
||||
|
@ -5055,8 +5046,6 @@ static int mlxsw_sp_netdevice_event(struct notifier_block *nb,
|
|||
event, ptr);
|
||||
else if (mlxsw_sp_netdevice_event_is_router(event))
|
||||
err = mlxsw_sp_netdevice_router_port_event(dev, event, ptr);
|
||||
else if (mlxsw_sp_is_vrf_event(event, ptr))
|
||||
err = mlxsw_sp_netdevice_vrf_event(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))
|
||||
|
|
|
@ -726,8 +726,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);
|
||||
int mlxsw_sp_netdevice_vrf_event(struct net_device *l3_dev, unsigned long event,
|
||||
struct netdev_notifier_changeupper_info *info);
|
||||
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,
|
||||
|
|
|
@ -9476,8 +9476,18 @@ static void mlxsw_sp_port_vrf_leave(struct mlxsw_sp *mlxsw_sp,
|
|||
__mlxsw_sp_inetaddr_event(mlxsw_sp, l3_dev, NETDEV_DOWN, NULL);
|
||||
}
|
||||
|
||||
int mlxsw_sp_netdevice_vrf_event(struct net_device *l3_dev, unsigned long event,
|
||||
struct netdev_notifier_changeupper_info *info)
|
||||
static bool mlxsw_sp_is_vrf_event(unsigned long event, void *ptr)
|
||||
{
|
||||
struct netdev_notifier_changeupper_info *info = ptr;
|
||||
|
||||
if (event != NETDEV_PRECHANGEUPPER && event != NETDEV_CHANGEUPPER)
|
||||
return false;
|
||||
return netif_is_l3_master(info->upper_dev);
|
||||
}
|
||||
|
||||
static int
|
||||
mlxsw_sp_netdevice_vrf_event(struct net_device *l3_dev, unsigned long event,
|
||||
struct netdev_notifier_changeupper_info *info)
|
||||
{
|
||||
struct mlxsw_sp *mlxsw_sp = mlxsw_sp_lower_get(l3_dev);
|
||||
int err = 0;
|
||||
|
@ -9511,8 +9521,12 @@ int mlxsw_sp_netdevice_vrf_event(struct net_device *l3_dev, unsigned long event,
|
|||
static int mlxsw_sp_router_netdevice_event(struct notifier_block *nb,
|
||||
unsigned long event, void *ptr)
|
||||
{
|
||||
struct net_device *dev = netdev_notifier_info_to_dev(ptr);
|
||||
int err = 0;
|
||||
|
||||
if (mlxsw_sp_is_vrf_event(event, ptr))
|
||||
err = mlxsw_sp_netdevice_vrf_event(dev, event, ptr);
|
||||
|
||||
return notifier_from_errno(err);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue