net: core: devlink: add dropped stats traps field

Whenever query statistics is issued for trap, devlink subsystem
would also fill-in statistics 'dropped' field. This field indicates
the number of packets HW dropped and failed to report to the device driver,
and thus - to the devlink subsystem itself.
In case if device driver didn't register callback for hard drop
statistics querying, 'dropped' field will be omitted and not filled.

Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Oleksandr Mazur
2021-06-14 16:01:12 +03:00
committed by David S. Miller
parent ea99750e40
commit ddee9dbc3d
2 changed files with 59 additions and 4 deletions

View File

@@ -1347,6 +1347,16 @@ struct devlink_ops {
const struct devlink_trap_group *group,
enum devlink_trap_action action,
struct netlink_ext_ack *extack);
/**
* @trap_drop_counter_get: Trap drop counter get function.
*
* Should be used by device drivers to report number of packets
* that have been dropped, and cannot be passed to the devlink
* subsystem by the underlying device.
*/
int (*trap_drop_counter_get)(struct devlink *devlink,
const struct devlink_trap *trap,
u64 *p_drops);
/**
* @trap_policer_init: Trap policer initialization function.
*