mlxsw: spectrum: Move handling of router events to router code
The events NETDEV_PRE_CHANGEADDR, NETDEV_CHANGEADDR and NETDEV_CHANGEMTU have implications for in-ASIC router interface objects, and as such are handled in the router module. 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>
This commit is contained in:
parent
f40e600b36
commit
ba81954cd5
@ -5004,18 +5004,6 @@ static int mlxsw_sp_netdevice_vxlan_event(struct mlxsw_sp *mlxsw_sp,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool mlxsw_sp_netdevice_event_is_router(unsigned long event)
|
||||
{
|
||||
switch (event) {
|
||||
case NETDEV_PRE_CHANGEADDR:
|
||||
case NETDEV_CHANGEADDR:
|
||||
case NETDEV_CHANGEMTU:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static int mlxsw_sp_netdevice_event(struct notifier_block *nb,
|
||||
unsigned long event, void *ptr)
|
||||
{
|
||||
@ -5040,8 +5028,6 @@ static int mlxsw_sp_netdevice_event(struct notifier_block *nb,
|
||||
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_netdevice_event_is_router(event))
|
||||
err = mlxsw_sp_netdevice_router_port_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))
|
||||
|
@ -718,8 +718,6 @@ union mlxsw_sp_l3addr {
|
||||
int mlxsw_sp_router_init(struct mlxsw_sp *mlxsw_sp,
|
||||
struct netlink_ext_ack *extack);
|
||||
void mlxsw_sp_router_fini(struct mlxsw_sp *mlxsw_sp);
|
||||
int mlxsw_sp_netdevice_router_port_event(struct net_device *dev,
|
||||
unsigned long event, void *ptr);
|
||||
void mlxsw_sp_rif_macvlan_del(struct mlxsw_sp *mlxsw_sp,
|
||||
const struct net_device *macvlan_dev);
|
||||
int mlxsw_sp_inetaddr_valid_event(struct notifier_block *unused,
|
||||
|
@ -9438,8 +9438,20 @@ mlxsw_sp_netdevice_offload_xstats_cmd(struct mlxsw_sp *mlxsw_sp,
|
||||
return err;
|
||||
}
|
||||
|
||||
int mlxsw_sp_netdevice_router_port_event(struct net_device *dev,
|
||||
unsigned long event, void *ptr)
|
||||
static bool mlxsw_sp_is_router_event(unsigned long event)
|
||||
{
|
||||
switch (event) {
|
||||
case NETDEV_PRE_CHANGEADDR:
|
||||
case NETDEV_CHANGEADDR:
|
||||
case NETDEV_CHANGEMTU:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static int mlxsw_sp_netdevice_router_port_event(struct net_device *dev,
|
||||
unsigned long event, void *ptr)
|
||||
{
|
||||
struct netlink_ext_ack *extack = netdev_notifier_info_to_extack(ptr);
|
||||
struct mlxsw_sp *mlxsw_sp;
|
||||
@ -9557,6 +9569,8 @@ 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_is_router_event(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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user