Skip to content

Commit 440273e

Browse files
pmachataPaolo Abeni
authored andcommitted
mlxsw: spectrum_router: Extract a helper for RIF migration
RIF configuration contains a number of parameters that cannot be changed after the RIF is created. For the IPIP loopbacks, this is currently worked around by creating a new RIF with the desired configuration changes applied, and updating next hops to the new RIF, and then destroying the old RIF. This operation will be useful as a reusable atom, so extract a helper to that effect. Signed-off-by: Petr Machata <[email protected]> Reviewed-by: Amit Cohen <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
1 parent 33d11c4 commit 440273e

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

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

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,6 +1651,17 @@ static void mlxsw_sp_netdevice_ipip_ol_down_event(struct mlxsw_sp *mlxsw_sp,
16511651
static void mlxsw_sp_nexthop_rif_migrate(struct mlxsw_sp *mlxsw_sp,
16521652
struct mlxsw_sp_rif *old_rif,
16531653
struct mlxsw_sp_rif *new_rif);
1654+
static void mlxsw_sp_rif_migrate_destroy(struct mlxsw_sp *mlxsw_sp,
1655+
struct mlxsw_sp_rif *old_rif,
1656+
struct mlxsw_sp_rif *new_rif,
1657+
bool migrate_nhs)
1658+
{
1659+
if (migrate_nhs)
1660+
mlxsw_sp_nexthop_rif_migrate(mlxsw_sp, old_rif, new_rif);
1661+
1662+
mlxsw_sp_rif_destroy(old_rif);
1663+
}
1664+
16541665
static int
16551666
mlxsw_sp_ipip_entry_ol_lb_update(struct mlxsw_sp *mlxsw_sp,
16561667
struct mlxsw_sp_ipip_entry *ipip_entry,
@@ -1668,12 +1679,8 @@ mlxsw_sp_ipip_entry_ol_lb_update(struct mlxsw_sp *mlxsw_sp,
16681679
return PTR_ERR(new_lb_rif);
16691680
ipip_entry->ol_lb = new_lb_rif;
16701681

1671-
if (keep_encap)
1672-
mlxsw_sp_nexthop_rif_migrate(mlxsw_sp, &old_lb_rif->common,
1673-
&new_lb_rif->common);
1674-
1675-
mlxsw_sp_rif_destroy(&old_lb_rif->common);
1676-
1682+
mlxsw_sp_rif_migrate_destroy(mlxsw_sp, &old_lb_rif->common,
1683+
&new_lb_rif->common, keep_encap);
16771684
return 0;
16781685
}
16791686

0 commit comments

Comments
 (0)