Skip to content

Commit

Permalink
Merge branch 'netdevsim-Two-small-fixes'
Browse files Browse the repository at this point in the history
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: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed May 22, 2020
2 parents 4629ed2 + 4d59e59 commit 7a40a2d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/net/netdevsim/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -858,8 +858,7 @@ nsim_dev_devlink_trap_policer_counter_get(struct devlink *devlink,
return -EINVAL;

cnt = &nsim_dev->trap_data->trap_policers_cnt_arr[policer->id - 1];
*p_drops = *cnt;
*cnt += jiffies % 64;
*p_drops = (*cnt)++;

return 0;
}
Expand Down
4 changes: 4 additions & 0 deletions tools/testing/selftests/drivers/net/netdevsim/devlink_trap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@ trap_policer_test()
local packets_t0
local packets_t1

RET=0

if [ $(devlink_trap_policers_num_get) -eq 0 ]; then
check_err 1 "Failed to dump policers"
fi
Expand Down Expand Up @@ -328,6 +330,8 @@ trap_group_check_policer()

trap_policer_bind_test()
{
RET=0

devlink trap group set $DEVLINK_DEV group l2_drops policer 1
check_err $? "Failed to bind a valid policer"
if [ $(devlink_trap_group_policer_get "l2_drops") -ne 1 ]; then
Expand Down

0 comments on commit 7a40a2d

Please sign in to comment.