A previous patch added a pointer to loopback CRIF to the router data structure. That makes the loopback RIF index redundant, as everything necessary can be derived from the CRIF. Drop the field and adjust the code accordingly.
Unified · Split
| @@ -3563,7 +3563,7 @@ static int __mlxsw_sp_nexthop_eth_update(struct mlxsw_sp *mlxsw_sp, · 3562 unmodified lines | |||
| 3563 | u16 rif_index; | 3563 | u16 rif_index; |
| 3564 | 3564 | ||
| 3565 | rif_index = nh->rif ? nh->rif->rif_index : | 3565 | rif_index = nh->rif ? nh->rif->rif_index : |
| 3566 | mlxsw_sp->router->lb_rif_index; | 3566 | mlxsw_sp->router->lb_crif->rif->rif_index; |
| 3567 | op = force ? MLXSW_REG_RATR_OP_WRITE_WRITE_ENTRY : | 3567 | op = force ? MLXSW_REG_RATR_OP_WRITE_WRITE_ENTRY : |
| 3568 | MLXSW_REG_RATR_OP_WRITE_WRITE_ENTRY_ON_ACTIVITY; | 3568 | MLXSW_REG_RATR_OP_WRITE_WRITE_ENTRY_ON_ACTIVITY; |
| 3569 | mlxsw_reg_ratr_pack(ratr_pl, op, true, MLXSW_REG_RATR_TYPE_ETHERNET, | 3569 | mlxsw_reg_ratr_pack(ratr_pl, op, true, MLXSW_REG_RATR_TYPE_ETHERNET, |
| @@ -4530,7 +4530,7 @@ static int mlxsw_sp_adj_trap_entry_init(struct mlxsw_sp *mlxsw_sp) · 960 unmodified lines | |||
| 4530 | mlxsw_reg_ratr_pack(ratr_pl, MLXSW_REG_RATR_OP_WRITE_WRITE_ENTRY, true, | 4530 | mlxsw_reg_ratr_pack(ratr_pl, MLXSW_REG_RATR_OP_WRITE_WRITE_ENTRY, true, |
| 4531 | MLXSW_REG_RATR_TYPE_ETHERNET, | 4531 | MLXSW_REG_RATR_TYPE_ETHERNET, |
| 4532 | mlxsw_sp->router->adj_trap_index, | 4532 | mlxsw_sp->router->adj_trap_index, |
| 4533 | mlxsw_sp->router->lb_rif_index); | 4533 | mlxsw_sp->router->lb_crif->rif->rif_index); |
| 4534 | mlxsw_reg_ratr_trap_action_set(ratr_pl, trap_action); | 4534 | mlxsw_reg_ratr_trap_action_set(ratr_pl, trap_action); |
| 4535 | mlxsw_reg_ratr_trap_id_set(ratr_pl, MLXSW_TRAP_ID_RTR_EGRESS0); | 4535 | mlxsw_reg_ratr_trap_id_set(ratr_pl, MLXSW_TRAP_ID_RTR_EGRESS0); |
| 4536 | err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ratr), ratr_pl); | 4536 | err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ratr), ratr_pl); |
| @@ -4846,15 +4846,13 @@ static bool mlxsw_sp_nexthop_obj_is_gateway(struct mlxsw_sp *mlxsw_sp, · 309 unmodified lines | |||
| 4846 | static void mlxsw_sp_nexthop_obj_blackhole_init(struct mlxsw_sp *mlxsw_sp, | 4846 | static void mlxsw_sp_nexthop_obj_blackhole_init(struct mlxsw_sp *mlxsw_sp, |
| 4847 | struct mlxsw_sp_nexthop *nh) | 4847 | struct mlxsw_sp_nexthop *nh) |
| 4848 | { | 4848 | { |
| 4849 | u16 lb_rif_index = mlxsw_sp->router->lb_rif_index; | ||
| 4850 | |||
| 4851 | nh->action = MLXSW_SP_NEXTHOP_ACTION_DISCARD; | 4849 | nh->action = MLXSW_SP_NEXTHOP_ACTION_DISCARD; |
| 4852 | nh->should_offload = 1; | 4850 | nh->should_offload = 1; |
| 4853 | /* While nexthops that discard packets do not forward packets | 4851 | /* While nexthops that discard packets do not forward packets |
| 4854 | * via an egress RIF, they still need to be programmed using a | 4852 | * via an egress RIF, they still need to be programmed using a |
| 4855 | * valid RIF, so use the loopback RIF created during init. | 4853 | * valid RIF, so use the loopback RIF created during init. |
| 4856 | */ | 4854 | */ |
| 4857 | nh->rif = mlxsw_sp->router->rifs[lb_rif_index]; | 4855 | nh->rif = mlxsw_sp->router->lb_crif->rif; |
| 4858 | } | 4856 | } |
| 4859 | 4857 | ||
| 4860 | static void mlxsw_sp_nexthop_obj_blackhole_fini(struct mlxsw_sp *mlxsw_sp, | 4858 | static void mlxsw_sp_nexthop_obj_blackhole_fini(struct mlxsw_sp *mlxsw_sp, |
| @@ -10784,8 +10782,6 @@ static int mlxsw_sp_lb_rif_init(struct mlxsw_sp *mlxsw_sp, · 5923 unmodified lines | |||
| 10784 | goto err_ul_rif_get; | 10782 | goto err_ul_rif_get; |
| 10785 | } | 10783 | } |
| 10786 | 10784 | ||
| 10787 | mlxsw_sp->router->lb_rif_index = lb_rif->rif_index; | ||
| 10788 | |||
| 10789 | return 0; | 10785 | return 0; |
| 10790 | 10786 | ||
| 10791 | err_ul_rif_get: | 10787 | err_ul_rif_get: |
| @@ -10795,7 +10791,7 @@ err_ul_rif_get: · 3 unmodified lines | |||
| 10795 | 10791 | ||
| 10796 | static void mlxsw_sp_lb_rif_fini(struct mlxsw_sp *mlxsw_sp) | 10792 | static void mlxsw_sp_lb_rif_fini(struct mlxsw_sp *mlxsw_sp) |
| 10797 | { | 10793 | { |
| 10798 | mlxsw_sp_router_ul_rif_put(mlxsw_sp, mlxsw_sp->router->lb_rif_index); | 10794 | mlxsw_sp_ul_rif_put(mlxsw_sp->router->lb_crif->rif); |
| 10799 | mlxsw_sp_crif_free(mlxsw_sp->router->lb_crif); | 10795 | mlxsw_sp_crif_free(mlxsw_sp->router->lb_crif); |
| 10800 | } | 10796 | } |
| 10801 | 10797 | ||
| @@ -60,7 +60,6 @@ struct mlxsw_sp_router { · 59 unmodified lines | |||
| 60 | struct mlxsw_sp_router_nve_decap nve_decap_config; | 60 | struct mlxsw_sp_router_nve_decap nve_decap_config; |
| 61 | struct mutex lock; /* Protects shared router resources */ | 61 | struct mutex lock; /* Protects shared router resources */ |
| 62 | struct mlxsw_sp_fib_entry_op_ctx *ll_op_ctx; | 62 | struct mlxsw_sp_fib_entry_op_ctx *ll_op_ctx; |
| 63 | u16 lb_rif_index; | ||
| 64 | struct mlxsw_sp_crif *lb_crif; | 63 | struct mlxsw_sp_crif *lb_crif; |
| 65 | const struct mlxsw_sp_adj_grp_size_range *adj_grp_size_ranges; | 64 | const struct mlxsw_sp_adj_grp_size_range *adj_grp_size_ranges; |
| 66 | size_t adj_grp_size_ranges_count; | 65 | size_t adj_grp_size_ranges_count; |