Skip to content

Commit f3c85ee

Browse files
pmachatakuba-moo
authored andcommitted
mlxsw: spectrum_router: Use mlxsw_sp_ul_rif_get() to get main VRF LB RIF
The current function, mlxsw_sp_router_ul_rif_get(), is a wrapper around the function mentioned in the subject. As such it forms an external interface of the router code. In future patches we will want to maintain connection between RIFs and the CRIFs (introduced in the next patch) that back them. That will not hold for the VRF-based loopback netdevices, so the whole CRIF business can be kept hidden from the rest of mlxsw. But for the main VRF loopback RIF we do want to keep the RIF-CRIF connection, because that RIF is used for blackhole next hops, and the next hop code can be kept simpler for assuming rif->crif is valid. Hence, instead, call mlxsw_sp_ul_rif_get() to create the main VRF loopback RIF. This being an internal function will take the CRIF argument anyway. Furthermore, the function does not lock, which is not necessary at this point in code yet. Signed-off-by: Petr Machata <[email protected]> Reviewed-by: Danielle Ratson <[email protected]> Link: https://lore.kernel.org/r/7a39a011a02a84164cd7f5da7985ec5b2ae01ba5.1687438411.git.petrm@nvidia.com Signed-off-by: Jakub Kicinski <[email protected]>
1 parent ebbd17c commit f3c85ee

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10564,19 +10564,20 @@ static void __mlxsw_sp_router_fini(struct mlxsw_sp *mlxsw_sp)
1056410564
static int mlxsw_sp_lb_rif_init(struct mlxsw_sp *mlxsw_sp,
1056510565
struct netlink_ext_ack *extack)
1056610566
{
10567-
u16 lb_rif_index;
10567+
struct mlxsw_sp_rif *lb_rif;
1056810568
int err;
1056910569

1057010570
/* Create a generic loopback RIF associated with the main table
1057110571
* (default VRF). Any table can be used, but the main table exists
1057210572
* anyway, so we do not waste resources.
1057310573
*/
10574-
err = mlxsw_sp_router_ul_rif_get(mlxsw_sp, RT_TABLE_MAIN,
10575-
&lb_rif_index);
10576-
if (err)
10574+
lb_rif = mlxsw_sp_ul_rif_get(mlxsw_sp, RT_TABLE_MAIN, extack);
10575+
if (IS_ERR(lb_rif)) {
10576+
err = PTR_ERR(lb_rif);
1057710577
return err;
10578+
}
1057810579

10579-
mlxsw_sp->router->lb_rif_index = lb_rif_index;
10580+
mlxsw_sp->router->lb_rif_index = lb_rif->rif_index;
1058010581

1058110582
return 0;
1058210583
}

0 commit comments

Comments
 (0)