Skip to content

Commit 7a40a2d

Browse files
committed
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: David S. Miller <[email protected]>
2 parents 4629ed2 + 4d59e59 commit 7a40a2d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

drivers/net/netdevsim/dev.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -858,8 +858,7 @@ nsim_dev_devlink_trap_policer_counter_get(struct devlink *devlink,
858858
return -EINVAL;
859859

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

864863
return 0;
865864
}

tools/testing/selftests/drivers/net/netdevsim/devlink_trap.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,8 @@ trap_policer_test()
264264
local packets_t0
265265
local packets_t1
266266

267+
RET=0
268+
267269
if [ $(devlink_trap_policers_num_get) -eq 0 ]; then
268270
check_err 1 "Failed to dump policers"
269271
fi
@@ -328,6 +330,8 @@ trap_group_check_policer()
328330

329331
trap_policer_bind_test()
330332
{
333+
RET=0
334+
331335
devlink trap group set $DEVLINK_DEV group l2_drops policer 1
332336
check_err $? "Failed to bind a valid policer"
333337
if [ $(devlink_trap_group_policer_get "l2_drops") -ne 1 ]; then

0 commit comments

Comments
 (0)