Skip to content

Commit 377a48b

Browse files
pmachataBrian Maly
authored andcommitted
mlxsw: spectrum_router: Use router.lb_crif instead of .lb_rif_index
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. Signed-off-by: Petr Machata <[email protected]> Reviewed-by: Danielle Ratson <[email protected]> Link: https://lore.kernel.org/r/8637bf959bc5b6c9d5184b9bd8a0cd53c5132835.1687438411.git.petrm@nvidia.com Signed-off-by: Jakub Kicinski <[email protected]> Orabug: 35622106 (cherry picked from commit bdc0b78) cherry-pick-repo=kernel/git/torvalds/linux.git unmodified-from-upstream: bdc0b78 Signed-off-by: Mikhael Goikhman <[email protected]> Signed-off-by: Qing Huang <[email protected]> Reviewed-by: Devesh Sharma <[email protected]> Signed-off-by: Brian Maly <[email protected]>
1 parent e5fe12d commit 377a48b

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3563,7 +3563,7 @@ static int __mlxsw_sp_nexthop_eth_update(struct mlxsw_sp *mlxsw_sp,
35633563
u16 rif_index;
35643564

35653565
rif_index = nh->rif ? nh->rif->rif_index :
3566-
mlxsw_sp->router->lb_rif_index;
3566+
mlxsw_sp->router->lb_crif->rif->rif_index;
35673567
op = force ? MLXSW_REG_RATR_OP_WRITE_WRITE_ENTRY :
35683568
MLXSW_REG_RATR_OP_WRITE_WRITE_ENTRY_ON_ACTIVITY;
35693569
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)
45304530
mlxsw_reg_ratr_pack(ratr_pl, MLXSW_REG_RATR_OP_WRITE_WRITE_ENTRY, true,
45314531
MLXSW_REG_RATR_TYPE_ETHERNET,
45324532
mlxsw_sp->router->adj_trap_index,
4533-
mlxsw_sp->router->lb_rif_index);
4533+
mlxsw_sp->router->lb_crif->rif->rif_index);
45344534
mlxsw_reg_ratr_trap_action_set(ratr_pl, trap_action);
45354535
mlxsw_reg_ratr_trap_id_set(ratr_pl, MLXSW_TRAP_ID_RTR_EGRESS0);
45364536
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,
48464846
static void mlxsw_sp_nexthop_obj_blackhole_init(struct mlxsw_sp *mlxsw_sp,
48474847
struct mlxsw_sp_nexthop *nh)
48484848
{
4849-
u16 lb_rif_index = mlxsw_sp->router->lb_rif_index;
4850-
48514849
nh->action = MLXSW_SP_NEXTHOP_ACTION_DISCARD;
48524850
nh->should_offload = 1;
48534851
/* While nexthops that discard packets do not forward packets
48544852
* via an egress RIF, they still need to be programmed using a
48554853
* valid RIF, so use the loopback RIF created during init.
48564854
*/
4857-
nh->rif = mlxsw_sp->router->rifs[lb_rif_index];
4855+
nh->rif = mlxsw_sp->router->lb_crif->rif;
48584856
}
48594857

48604858
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,
1078410782
goto err_ul_rif_get;
1078510783
}
1078610784

10787-
mlxsw_sp->router->lb_rif_index = lb_rif->rif_index;
10788-
1078910785
return 0;
1079010786

1079110787
err_ul_rif_get:
@@ -10795,7 +10791,7 @@ static int mlxsw_sp_lb_rif_init(struct mlxsw_sp *mlxsw_sp,
1079510791

1079610792
static void mlxsw_sp_lb_rif_fini(struct mlxsw_sp *mlxsw_sp)
1079710793
{
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);
1079910795
mlxsw_sp_crif_free(mlxsw_sp->router->lb_crif);
1080010796
}
1080110797

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ struct mlxsw_sp_router {
6060
struct mlxsw_sp_router_nve_decap nve_decap_config;
6161
struct mutex lock; /* Protects shared router resources */
6262
struct mlxsw_sp_fib_entry_op_ctx *ll_op_ctx;
63-
u16 lb_rif_index;
6463
struct mlxsw_sp_crif *lb_crif;
6564
const struct mlxsw_sp_adj_grp_size_range *adj_grp_size_ranges;
6665
size_t adj_grp_size_ranges_count;

0 commit comments

Comments
 (0)