mlxsw: spectrum_router: Compare only trees which are in use during tree get

Only trees which are in use should be compared to requested prefix usage.

Fixes: 53342023ee ("mlxsw: spectrum_router: Implement LPM trees management")
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Jiri Pirko 2016-10-25 11:25:57 +02:00 коммит произвёл David S. Miller
Родитель 2083d36790
Коммит 8b99becdc8
1 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -345,7 +345,8 @@ mlxsw_sp_lpm_tree_get(struct mlxsw_sp *mlxsw_sp,
for (i = 0; i < MLXSW_SP_LPM_TREE_COUNT; i++) { for (i = 0; i < MLXSW_SP_LPM_TREE_COUNT; i++) {
lpm_tree = &mlxsw_sp->router.lpm_trees[i]; lpm_tree = &mlxsw_sp->router.lpm_trees[i];
if (lpm_tree->proto == proto && if (lpm_tree->ref_count != 0 &&
lpm_tree->proto == proto &&
mlxsw_sp_prefix_usage_eq(&lpm_tree->prefix_usage, mlxsw_sp_prefix_usage_eq(&lpm_tree->prefix_usage,
prefix_usage)) prefix_usage))
goto inc_ref_count; goto inc_ref_count;