netdevsim: Add devlink-trap policer support
authorIdo Schimmel <idosch@mellanox.com>
Mon, 30 Mar 2020 19:38:20 +0000 (22:38 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 31 Mar 2020 00:54:58 +0000 (17:54 -0700)
commitad188458d0123d4e116f14f7eab73d644aed149f
tree8f18f217a1b333c68cfaaa8da3ce523b681b1767
parentef7d5c7d4340d5087afb97100e69427785152ccd
netdevsim: Add devlink-trap policer support

Register three dummy packet trap policers with devlink and implement
callbacks to change their parameters and read their counters.

This will be used later on in the series to test the devlink-trap
policer infrastructure.

v2:
* Remove check about burst size being a power of 2 and instead add a
  debugfs knob to fail the operation
* Provide max/min rate/burst size when registering policers and remove
  the validity checks from nsim_dev_devlink_trap_policer_set()

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/netdevsim/dev.c
drivers/net/netdevsim/netdevsim.h