summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorPetr Machata <petrm@nvidia.com>2023-06-22 16:33:03 +0300
committerJakub Kicinski <kuba@kernel.org>2023-06-24 05:01:56 +0300
commitf3c85eed1ac364ae2cb2729959c6150813cc9c20 (patch)
tree3a45c79ca03c9a5ece9cf45ba7b00fcbda089b19 /drivers
parentebbd17ce297a3f367ca20058272063eaeeced63a (diff)
downloadlinux-f3c85eed1ac364ae2cb2729959c6150813cc9c20.tar.xz
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 <petrm@nvidia.com> Reviewed-by: Danielle Ratson <danieller@nvidia.com> Link: https://lore.kernel.org/r/7a39a011a02a84164cd7f5da7985ec5b2ae01ba5.1687438411.git.petrm@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
index 0b1c17819388..15ce0d557f39 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
@@ -10564,19 +10564,20 @@ static void __mlxsw_sp_router_fini(struct mlxsw_sp *mlxsw_sp)
static int mlxsw_sp_lb_rif_init(struct mlxsw_sp *mlxsw_sp,
struct netlink_ext_ack *extack)
{
- u16 lb_rif_index;
+ struct mlxsw_sp_rif *lb_rif;
int err;
/* Create a generic loopback RIF associated with the main table
* (default VRF). Any table can be used, but the main table exists
* anyway, so we do not waste resources.
*/
- err = mlxsw_sp_router_ul_rif_get(mlxsw_sp, RT_TABLE_MAIN,
- &lb_rif_index);
- if (err)
+ lb_rif = mlxsw_sp_ul_rif_get(mlxsw_sp, RT_TABLE_MAIN, extack);
+ if (IS_ERR(lb_rif)) {
+ err = PTR_ERR(lb_rif);
return err;
+ }
- mlxsw_sp->router->lb_rif_index = lb_rif_index;
+ mlxsw_sp->router->lb_rif_index = lb_rif->rif_index;
return 0;
}