mirror of
https://github.com/torvalds/linux.git
synced 2024-12-30 14:52:05 +00:00
mlxsw: spectrum_router: Update adjacency index more efficiently
The device supports an operation that allows the driver to issue one request to update the adjacency index for all the routes in a given virtual router (VR) from old index and size to new ones. This is useful in case the configuration of a certain nexthop group is updated and its adjacency index changes. Currently, the driver does not use this operation in an efficient manner. It iterates over all the routes using the nexthop group and issues an update request for the VR if it is not the same as the previous VR. Instead, use the VR tracking added in the previous patch to update the adjacency index once for each VR currently using the nexthop group. Example: 8k IPv6 routes were added in an alternating manner to two VRFs. All the routes are using the same nexthop object ('nhid 1'). Before: # perf stat -e devlink:devlink_hwmsg --filter='incoming==0' -- ip nexthop replace id 1 via 2001:db8:1::2 dev swp3 Performance counter stats for 'ip nexthop replace id 1 via 2001:db8:1::2 dev swp3': 16,385 devlink:devlink_hwmsg 4.255933213 seconds time elapsed 0.000000000 seconds user 0.666923000 seconds sys Number of EMAD transactions corresponds to number of routes using the nexthop group. After: # perf stat -e devlink:devlink_hwmsg --filter='incoming==0' -- ip nexthop replace id 1 via 2001:db8:1::2 dev swp3 Performance counter stats for 'ip nexthop replace id 1 via 2001:db8:1::2 dev swp3': 3 devlink:devlink_hwmsg 0.077655094 seconds time elapsed 0.000000000 seconds user 0.076698000 seconds sys Number of EMAD transactions corresponds to number of VRFs / VRs. Signed-off-by: Ido Schimmel <idosch@nvidia.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
d2141a42b9
commit
ff47fa13c9
@ -3366,18 +3366,14 @@ static int mlxsw_sp_adj_index_mass_update(struct mlxsw_sp *mlxsw_sp,
|
|||||||
struct mlxsw_sp_nexthop_group *nh_grp,
|
struct mlxsw_sp_nexthop_group *nh_grp,
|
||||||
u32 old_adj_index, u16 old_ecmp_size)
|
u32 old_adj_index, u16 old_ecmp_size)
|
||||||
{
|
{
|
||||||
struct mlxsw_sp_fib_entry *fib_entry;
|
struct mlxsw_sp_nexthop_group_info *nhgi = nh_grp->nhgi;
|
||||||
struct mlxsw_sp_fib *fib = NULL;
|
struct mlxsw_sp_nexthop_group_vr_entry *vr_entry;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
list_for_each_entry(fib_entry, &nh_grp->fib_list, nexthop_group_node) {
|
list_for_each_entry(vr_entry, &nh_grp->vr_list, list) {
|
||||||
struct mlxsw_sp_nexthop_group_info *nhgi = nh_grp->nhgi;
|
err = mlxsw_sp_adj_index_mass_update_vr(mlxsw_sp,
|
||||||
|
vr_entry->key.proto,
|
||||||
if (fib == fib_entry->fib_node->fib)
|
vr_entry->key.vr_id,
|
||||||
continue;
|
|
||||||
fib = fib_entry->fib_node->fib;
|
|
||||||
err = mlxsw_sp_adj_index_mass_update_vr(mlxsw_sp, fib->proto,
|
|
||||||
fib->vr->id,
|
|
||||||
old_adj_index,
|
old_adj_index,
|
||||||
old_ecmp_size,
|
old_ecmp_size,
|
||||||
nhgi->adj_index,
|
nhgi->adj_index,
|
||||||
@ -3388,16 +3384,12 @@ static int mlxsw_sp_adj_index_mass_update(struct mlxsw_sp *mlxsw_sp,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_mass_update_vr:
|
err_mass_update_vr:
|
||||||
list_for_each_entry_continue_reverse(fib_entry, &nh_grp->fib_list,
|
list_for_each_entry_continue_reverse(vr_entry, &nh_grp->vr_list, list)
|
||||||
nexthop_group_node) {
|
mlxsw_sp_adj_index_mass_update_vr(mlxsw_sp, vr_entry->key.proto,
|
||||||
struct mlxsw_sp_nexthop_group_info *nhgi = nh_grp->nhgi;
|
vr_entry->key.vr_id,
|
||||||
|
nhgi->adj_index,
|
||||||
fib = fib_entry->fib_node->fib;
|
|
||||||
mlxsw_sp_adj_index_mass_update_vr(mlxsw_sp, fib->proto,
|
|
||||||
fib->vr->id, nhgi->adj_index,
|
|
||||||
nhgi->ecmp_size,
|
nhgi->ecmp_size,
|
||||||
old_adj_index, old_ecmp_size);
|
old_adj_index, old_ecmp_size);
|
||||||
}
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user