mlxsw: spectrum_router: Move IPIP init up
authorPetr Machata <petrm@nvidia.com>
Mon, 12 Jun 2023 15:31:09 +0000 (17:31 +0200)
committerPaolo Abeni <pabeni@redhat.com>
Wed, 14 Jun 2023 11:12:21 +0000 (13:12 +0200)
mlxsw will need to keep track of certain devices that are not related to
any of its front panel ports. This includes IPIP netdevices. To be able to
query the list of supported IPIP types, router->ipip_ops_arr needs to be
initialized.

To that end, move the IPIP initialization up (and finalization
correspondingly down).

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Amit Cohen <amcohen@nvidia.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c

index fdb8121..43e8f19 100644 (file)
@@ -10643,14 +10643,14 @@ int mlxsw_sp_router_init(struct mlxsw_sp *mlxsw_sp,
        if (err)
                goto err_router_init;
 
-       err = mlxsw_sp_rifs_init(mlxsw_sp);
-       if (err)
-               goto err_rifs_init;
-
        err = mlxsw_sp->router_ops->ipips_init(mlxsw_sp);
        if (err)
                goto err_ipips_init;
 
+       err = mlxsw_sp_rifs_init(mlxsw_sp);
+       if (err)
+               goto err_rifs_init;
+
        err = rhashtable_init(&mlxsw_sp->router->nexthop_ht,
                              &mlxsw_sp_nexthop_ht_params);
        if (err)
@@ -10776,10 +10776,10 @@ err_lpm_init:
 err_nexthop_group_ht_init:
        rhashtable_destroy(&mlxsw_sp->router->nexthop_ht);
 err_nexthop_ht_init:
-       mlxsw_sp_ipips_fini(mlxsw_sp);
-err_ipips_init:
        mlxsw_sp_rifs_fini(mlxsw_sp);
 err_rifs_init:
+       mlxsw_sp_ipips_fini(mlxsw_sp);
+err_ipips_init:
        __mlxsw_sp_router_fini(mlxsw_sp);
 err_router_init:
        cancel_delayed_work_sync(&mlxsw_sp->router->nh_grp_activity_dw);
@@ -10812,8 +10812,8 @@ void mlxsw_sp_router_fini(struct mlxsw_sp *mlxsw_sp)
        mlxsw_sp_lpm_fini(mlxsw_sp);
        rhashtable_destroy(&router->nexthop_group_ht);
        rhashtable_destroy(&router->nexthop_ht);
-       mlxsw_sp_ipips_fini(mlxsw_sp);
        mlxsw_sp_rifs_fini(mlxsw_sp);
+       mlxsw_sp_ipips_fini(mlxsw_sp);
        __mlxsw_sp_router_fini(mlxsw_sp);
        cancel_delayed_work_sync(&router->nh_grp_activity_dw);
        mutex_destroy(&router->lock);