mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-17 10:46:33 +00:00
mlxsw: spectrum_router: Encapsulate nexthop update in a function
Encapsulate this functionality in a separate function, so that it could be invoked by follow-up patches, when replacing a nexthop bucket that is part of a resilient nexthop group. Signed-off-by: Ido Schimmel <idosch@nvidia.com> Reviewed-by: Petr Machata <petrm@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
424603ccdd
commit
29017c6434
@ -3491,6 +3491,20 @@ static int mlxsw_sp_nexthop_ipip_update(struct mlxsw_sp *mlxsw_sp,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int mlxsw_sp_nexthop_update(struct mlxsw_sp *mlxsw_sp, u32 adj_index,
|
||||||
|
struct mlxsw_sp_nexthop *nh)
|
||||||
|
{
|
||||||
|
/* When action is discard or trap, the nexthop must be
|
||||||
|
* programmed as an Ethernet nexthop.
|
||||||
|
*/
|
||||||
|
if (nh->type == MLXSW_SP_NEXTHOP_TYPE_ETH ||
|
||||||
|
nh->action == MLXSW_SP_NEXTHOP_ACTION_DISCARD ||
|
||||||
|
nh->action == MLXSW_SP_NEXTHOP_ACTION_TRAP)
|
||||||
|
return mlxsw_sp_nexthop_eth_update(mlxsw_sp, adj_index, nh);
|
||||||
|
else
|
||||||
|
return mlxsw_sp_nexthop_ipip_update(mlxsw_sp, adj_index, nh);
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
mlxsw_sp_nexthop_group_update(struct mlxsw_sp *mlxsw_sp,
|
mlxsw_sp_nexthop_group_update(struct mlxsw_sp *mlxsw_sp,
|
||||||
struct mlxsw_sp_nexthop_group_info *nhgi,
|
struct mlxsw_sp_nexthop_group_info *nhgi,
|
||||||
@ -3511,19 +3525,7 @@ mlxsw_sp_nexthop_group_update(struct mlxsw_sp *mlxsw_sp,
|
|||||||
if (nh->update || reallocate) {
|
if (nh->update || reallocate) {
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
/* When action is discard or trap, the nexthop must be
|
err = mlxsw_sp_nexthop_update(mlxsw_sp, adj_index, nh);
|
||||||
* programmed as an Ethernet nexthop.
|
|
||||||
*/
|
|
||||||
if (nh->type == MLXSW_SP_NEXTHOP_TYPE_ETH ||
|
|
||||||
nh->action == MLXSW_SP_NEXTHOP_ACTION_DISCARD ||
|
|
||||||
nh->action == MLXSW_SP_NEXTHOP_ACTION_TRAP)
|
|
||||||
err = mlxsw_sp_nexthop_eth_update(mlxsw_sp,
|
|
||||||
adj_index,
|
|
||||||
nh);
|
|
||||||
else
|
|
||||||
err = mlxsw_sp_nexthop_ipip_update(mlxsw_sp,
|
|
||||||
adj_index,
|
|
||||||
nh);
|
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
nh->update = 0;
|
nh->update = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user