Commit 7a40a2d2 authored by David S. Miller's avatar David S. Miller

Merge branch 'netdevsim-Two-small-fixes'

Ido Schimmel says:

====================
netdevsim: Two small fixes

Fix two bugs observed while analyzing regression failures.

Patch #1 fixes a bug where sometimes the drop counter of a packet trap
policer would not increase.

Patch #2 adds a missing initialization of a variable in a related
selftest.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 4629ed2e 4d59e59c
...@@ -858,8 +858,7 @@ nsim_dev_devlink_trap_policer_counter_get(struct devlink *devlink, ...@@ -858,8 +858,7 @@ nsim_dev_devlink_trap_policer_counter_get(struct devlink *devlink,
return -EINVAL; return -EINVAL;
cnt = &nsim_dev->trap_data->trap_policers_cnt_arr[policer->id - 1]; cnt = &nsim_dev->trap_data->trap_policers_cnt_arr[policer->id - 1];
*p_drops = *cnt; *p_drops = (*cnt)++;
*cnt += jiffies % 64;
return 0; return 0;
} }
......
...@@ -264,6 +264,8 @@ trap_policer_test() ...@@ -264,6 +264,8 @@ trap_policer_test()
local packets_t0 local packets_t0
local packets_t1 local packets_t1
RET=0
if [ $(devlink_trap_policers_num_get) -eq 0 ]; then if [ $(devlink_trap_policers_num_get) -eq 0 ]; then
check_err 1 "Failed to dump policers" check_err 1 "Failed to dump policers"
fi fi
...@@ -328,6 +330,8 @@ trap_group_check_policer() ...@@ -328,6 +330,8 @@ trap_group_check_policer()
trap_policer_bind_test() trap_policer_bind_test()
{ {
RET=0
devlink trap group set $DEVLINK_DEV group l2_drops policer 1 devlink trap group set $DEVLINK_DEV group l2_drops policer 1
check_err $? "Failed to bind a valid policer" check_err $? "Failed to bind a valid policer"
if [ $(devlink_trap_group_policer_get "l2_drops") -ne 1 ]; then if [ $(devlink_trap_group_policer_get "l2_drops") -ne 1 ]; then
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment