Nexthop finalization consists of two steps: the part where the offload is removed, because the backing RIF is now gone; and the part where the association to the RIF is severed. Extract from mlxsw_sp_nexthop_type_fini() a helper that covers the unoffloading part, mlxsw_sp_nexthop_type_rif_gone(), so that it can later be called independently. Note that this swaps around the ordering of mlxsw_sp_nexthop_ipip_fini() vs. mlxsw_sp_nexthop_rif_fini(). The current ordering is more of a historical happenstance than a conscious decision. The two cleanups do not depend on each other, and this change should have no observable effects.
Unified · Split
| @@ -4369,21 +4369,26 @@ err_neigh_init: · 4368 unmodified lines | |||
| 4369 | return err; | 4369 | return err; |
| 4370 | } | 4370 | } |
| 4371 | 4371 | ||
| 4372 | static void mlxsw_sp_nexthop_type_fini(struct mlxsw_sp *mlxsw_sp, | 4372 | static void mlxsw_sp_nexthop_type_rif_gone(struct mlxsw_sp *mlxsw_sp, |
| 4373 | struct mlxsw_sp_nexthop *nh) | 4373 | struct mlxsw_sp_nexthop *nh) |
| 4374 | { | 4374 | { |
| 4375 | switch (nh->type) { | 4375 | switch (nh->type) { |
| 4376 | case MLXSW_SP_NEXTHOP_TYPE_ETH: | 4376 | case MLXSW_SP_NEXTHOP_TYPE_ETH: |
| 4377 | mlxsw_sp_nexthop_neigh_fini(mlxsw_sp, nh); | 4377 | mlxsw_sp_nexthop_neigh_fini(mlxsw_sp, nh); |
| 4378 | mlxsw_sp_nexthop_rif_fini(nh); | ||
| 4379 | break; | 4378 | break; |
| 4380 | case MLXSW_SP_NEXTHOP_TYPE_IPIP: | 4379 | case MLXSW_SP_NEXTHOP_TYPE_IPIP: |
| 4381 | mlxsw_sp_nexthop_rif_fini(nh); | ||
| 4382 | mlxsw_sp_nexthop_ipip_fini(mlxsw_sp, nh); | 4380 | mlxsw_sp_nexthop_ipip_fini(mlxsw_sp, nh); |
| 4383 | break; | 4381 | break; |
| 4384 | } | 4382 | } |
| 4385 | } | 4383 | } |
| 4386 | 4384 | ||
| 4385 | static void mlxsw_sp_nexthop_type_fini(struct mlxsw_sp *mlxsw_sp, | ||
| 4386 | struct mlxsw_sp_nexthop *nh) | ||
| 4387 | { | ||
| 4388 | mlxsw_sp_nexthop_type_rif_gone(mlxsw_sp, nh); | ||
| 4389 | mlxsw_sp_nexthop_rif_fini(nh); | ||
| 4390 | } | ||
| 4391 | |||
| 4387 | static int mlxsw_sp_nexthop4_init(struct mlxsw_sp *mlxsw_sp, | 4392 | static int mlxsw_sp_nexthop4_init(struct mlxsw_sp *mlxsw_sp, |
| 4388 | struct mlxsw_sp_nexthop_group *nh_grp, | 4393 | struct mlxsw_sp_nexthop_group *nh_grp, |
| 4389 | struct mlxsw_sp_nexthop *nh, | 4394 | struct mlxsw_sp_nexthop *nh, |