]> git.baikalelectronics.ru Git - kernel.git/commit
netdevsim: Ensure policer drop counter always increases
authorIdo Schimmel <idosch@mellanox.com>
Thu, 21 May 2020 11:46:16 +0000 (14:46 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 22 May 2020 23:05:42 +0000 (16:05 -0700)
commitf5d3e7f78759572d2305b097137763c36b8e4d0f
tree84a142dc5f23911f90d51d26d30717d46391aeae
parent1f275d516060f7abbe72f9e91ed6e9bbc34eb3a6
netdevsim: Ensure policer drop counter always increases

In case the policer drop counter is retrieved when the jiffies value is
a multiple of 64, the counter will not be incremented.

This randomly breaks a selftest [1] the reads the counter twice and
checks that it was incremented:

```
TEST: Trap policer                                                  [FAIL]
Policer drop counter was not incremented
```

Fix by always incrementing the counter by 1.

[1] tools/testing/selftests/drivers/net/netdevsim/devlink_trap.sh

Fixes: 3c3837483df6 ("netdevsim: Add devlink-trap policer support")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/netdevsim/dev.c