Skip to content

Commit 78126cf

Browse files
pmachatakuba-moo
authored andcommitted
mlxsw: spectrum_router: Maintain CRIF for fallback loopback RIF
CRIFs are generally not maintained for loopback RIFs. However, the RIF for the default VRF is used for offloading of blackhole nexthops. Nexthops expect to have a valid CRIF. Therefore in this patch, add code to maintain CRIF for the loopback RIF as well. Signed-off-by: Petr Machata <[email protected]> Reviewed-by: Danielle Ratson <[email protected]> Link: https://lore.kernel.org/r/7f2b2fcc98770167ed1254a904c3f7f585ba43f0.1687438411.git.petrm@nvidia.com Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 4796c28 commit 78126cf

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10731,27 +10731,37 @@ static void __mlxsw_sp_router_fini(struct mlxsw_sp *mlxsw_sp)
1073110731
static int mlxsw_sp_lb_rif_init(struct mlxsw_sp *mlxsw_sp,
1073210732
struct netlink_ext_ack *extack)
1073310733
{
10734+
struct mlxsw_sp_router *router = mlxsw_sp->router;
1073410735
struct mlxsw_sp_rif *lb_rif;
1073510736
int err;
1073610737

10738+
router->lb_crif = mlxsw_sp_crif_alloc(NULL);
10739+
if (IS_ERR(router->lb_crif))
10740+
return PTR_ERR(router->lb_crif);
10741+
1073710742
/* Create a generic loopback RIF associated with the main table
1073810743
* (default VRF). Any table can be used, but the main table exists
1073910744
* anyway, so we do not waste resources.
1074010745
*/
1074110746
lb_rif = mlxsw_sp_ul_rif_get(mlxsw_sp, RT_TABLE_MAIN, extack);
1074210747
if (IS_ERR(lb_rif)) {
1074310748
err = PTR_ERR(lb_rif);
10744-
return err;
10749+
goto err_ul_rif_get;
1074510750
}
1074610751

1074710752
mlxsw_sp->router->lb_rif_index = lb_rif->rif_index;
1074810753

1074910754
return 0;
10755+
10756+
err_ul_rif_get:
10757+
mlxsw_sp_crif_free(router->lb_crif);
10758+
return err;
1075010759
}
1075110760

1075210761
static void mlxsw_sp_lb_rif_fini(struct mlxsw_sp *mlxsw_sp)
1075310762
{
1075410763
mlxsw_sp_router_ul_rif_put(mlxsw_sp, mlxsw_sp->router->lb_rif_index);
10764+
mlxsw_sp_crif_free(mlxsw_sp->router->lb_crif);
1075510765
}
1075610766

1075710767
static int mlxsw_sp1_router_init(struct mlxsw_sp *mlxsw_sp)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ struct mlxsw_sp_router {
6161
struct mutex lock; /* Protects shared router resources */
6262
struct mlxsw_sp_fib_entry_op_ctx *ll_op_ctx;
6363
u16 lb_rif_index;
64+
struct mlxsw_sp_crif *lb_crif;
6465
const struct mlxsw_sp_adj_grp_size_range *adj_grp_size_ranges;
6566
size_t adj_grp_size_ranges_count;
6667
struct delayed_work nh_grp_activity_dw;

0 commit comments

Comments
 (0)