Skip to content

Commit 62bef63

Browse files
pmachatakuba-moo
authored andcommitted
mlxsw: spectrum_router: Register netdevice notifier before nexthop
If there are IPIP nexthops at the time when the driver is loaded (or the devlink instance reloaded), the driver looks up the corresponding IPIP entry. But IPIP entries are only created as a result of netdevice notifications. Since the netdevice notifier is registered after the nexthop notifier, mlxsw_sp_nexthop_type_init() never finds the IPIP entry, registers the nexthop MLXSW_SP_NEXTHOP_TYPE_ETH, and fails to assign a CRIF to the nexthop. Later on when the CRIF is necessary, the WARN_ON in mlxsw_sp_nexthop_rif() triggers, causing the splat [1]. In order to fix the issue, reorder the netdevice notifier to be registered before the nexthop one. [1] (edited for clarity): WARNING: CPU: 1 PID: 1364 at drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c:3245 mlxsw_sp_nexthop_rif (drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c:3246 (discriminator 1)) mlxsw_spectrum Hardware name: Mellanox Technologies Ltd. MSN4410/VMOD0010, BIOS 5.11 01/06/2019 Call Trace: ? mlxsw_sp_nexthop_rif (drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c:3246 (discriminator 1)) mlxsw_spectrum __mlxsw_sp_nexthop_eth_update (drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c:3637) mlxsw_spectrum mlxsw_sp_nexthop_update (drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c:3679 drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c:3727) mlxsw_spectrum mlxsw_sp_nexthop_group_update (drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c:3757) mlxsw_spectrum mlxsw_sp_nexthop_group_refresh (drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c:4112) mlxsw_spectrum mlxsw_sp_nexthop_obj_event (drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c:5118 drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c:5191 drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c:5315 drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c:5500) mlxsw_spectrum nexthops_dump (net/ipv4/nexthop.c:217 net/ipv4/nexthop.c:440 net/ipv4/nexthop.c:3609) register_nexthop_notifier (net/ipv4/nexthop.c:3624) mlxsw_sp_router_init (drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c:11486) mlxsw_spectrum mlxsw_sp_init (drivers/net/ethernet/mellanox/mlxsw/spectrum.c:3267) mlxsw_spectrum __mlxsw_core_bus_device_register (drivers/net/ethernet/mellanox/mlxsw/core.c:2202) mlxsw_core mlxsw_devlink_core_bus_device_reload_up (drivers/net/ethernet/mellanox/mlxsw/core.c:2265 drivers/net/ethernet/mellanox/mlxsw/core.c:1603) mlxsw_core devlink_reload (net/devlink/dev.c:314 net/devlink/dev.c:475) [...] Fixes: 9464a3d ("mlxsw: spectrum_router: Track next hops at CRIFs") Reported-by: Maksym Yaremchuk <[email protected]> Signed-off-by: Petr Machata <[email protected]> Reviewed-by: Ido Schimmel <[email protected]> Acked-by: Paolo Abeni <[email protected]> Link: https://lore.kernel.org/r/74edb8d45d004e8d8f5318eede6ccc3d786d8ba9.1705502064.git.petrm@nvidia.com Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 483ae90 commit 62bef63

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11472,6 +11472,13 @@ int mlxsw_sp_router_init(struct mlxsw_sp *mlxsw_sp,
1147211472
if (err)
1147311473
goto err_register_netevent_notifier;
1147411474

11475+
mlxsw_sp->router->netdevice_nb.notifier_call =
11476+
mlxsw_sp_router_netdevice_event;
11477+
err = register_netdevice_notifier_net(mlxsw_sp_net(mlxsw_sp),
11478+
&mlxsw_sp->router->netdevice_nb);
11479+
if (err)
11480+
goto err_register_netdev_notifier;
11481+
1147511482
mlxsw_sp->router->nexthop_nb.notifier_call =
1147611483
mlxsw_sp_nexthop_obj_event;
1147711484
err = register_nexthop_notifier(mlxsw_sp_net(mlxsw_sp),
@@ -11487,22 +11494,15 @@ int mlxsw_sp_router_init(struct mlxsw_sp *mlxsw_sp,
1148711494
if (err)
1148811495
goto err_register_fib_notifier;
1148911496

11490-
mlxsw_sp->router->netdevice_nb.notifier_call =
11491-
mlxsw_sp_router_netdevice_event;
11492-
err = register_netdevice_notifier_net(mlxsw_sp_net(mlxsw_sp),
11493-
&mlxsw_sp->router->netdevice_nb);
11494-
if (err)
11495-
goto err_register_netdev_notifier;
11496-
1149711497
return 0;
1149811498

11499-
err_register_netdev_notifier:
11500-
unregister_fib_notifier(mlxsw_sp_net(mlxsw_sp),
11501-
&mlxsw_sp->router->fib_nb);
1150211499
err_register_fib_notifier:
1150311500
unregister_nexthop_notifier(mlxsw_sp_net(mlxsw_sp),
1150411501
&mlxsw_sp->router->nexthop_nb);
1150511502
err_register_nexthop_notifier:
11503+
unregister_netdevice_notifier_net(mlxsw_sp_net(mlxsw_sp),
11504+
&router->netdevice_nb);
11505+
err_register_netdev_notifier:
1150611506
unregister_netevent_notifier(&mlxsw_sp->router->netevent_nb);
1150711507
err_register_netevent_notifier:
1150811508
unregister_inet6addr_validator_notifier(&router->inet6addr_valid_nb);
@@ -11550,11 +11550,11 @@ void mlxsw_sp_router_fini(struct mlxsw_sp *mlxsw_sp)
1155011550
{
1155111551
struct mlxsw_sp_router *router = mlxsw_sp->router;
1155211552

11553-
unregister_netdevice_notifier_net(mlxsw_sp_net(mlxsw_sp),
11554-
&router->netdevice_nb);
1155511553
unregister_fib_notifier(mlxsw_sp_net(mlxsw_sp), &router->fib_nb);
1155611554
unregister_nexthop_notifier(mlxsw_sp_net(mlxsw_sp),
1155711555
&router->nexthop_nb);
11556+
unregister_netdevice_notifier_net(mlxsw_sp_net(mlxsw_sp),
11557+
&router->netdevice_nb);
1155811558
unregister_netevent_notifier(&router->netevent_nb);
1155911559
unregister_inet6addr_validator_notifier(&router->inet6addr_valid_nb);
1156011560
unregister_inetaddr_validator_notifier(&router->inetaddr_valid_nb);

0 commit comments

Comments
 (0)