Messages in this thread Patch in this message | | | From | Oleksandr Mazur <> | Subject | [PATCH iproute2-next] devlink: add support for HARD_DROP trap action | Date | Thu, 21 Jan 2021 13:29:54 +0200 |
| |
Add support for new HARD_DROP action, which is used for trap hard drop statistics retrival. It's used whenever device is unable to report trapped packet to the devlink subsystem, and thus device could only state how many packets have been dropped, without passing a packet to the devlink subsystem to get track of traffic statistics.
Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu> --- devlink/devlink.c | 4 ++++ include/uapi/linux/devlink.h | 4 ++++ 2 files changed, 8 insertions(+)
diff --git a/devlink/devlink.c b/devlink/devlink.c index a2e06644..77185f7c 100644 --- a/devlink/devlink.c +++ b/devlink/devlink.c @@ -1335,6 +1335,8 @@ static int trap_action_get(const char *actionstr, { if (strcmp(actionstr, "drop") == 0) { *p_action = DEVLINK_TRAP_ACTION_DROP; + } else if (strcmp(actionstr, "hard_drop") == 0) { + *p_action = DEVLINK_TRAP_ACTION_HARD_DROP; } else if (strcmp(actionstr, "trap") == 0) { *p_action = DEVLINK_TRAP_ACTION_TRAP; } else if (strcmp(actionstr, "mirror") == 0) { @@ -7726,6 +7728,8 @@ static const char *trap_action_name(uint8_t action) switch (action) { case DEVLINK_TRAP_ACTION_DROP: return "drop"; + case DEVLINK_TRAP_ACTION_HARD_DROP: + return "hard_drop"; case DEVLINK_TRAP_ACTION_TRAP: return "trap"; case DEVLINK_TRAP_ACTION_MIRROR: diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h index 1414acee..ecee2541 100644 --- a/include/uapi/linux/devlink.h +++ b/include/uapi/linux/devlink.h @@ -261,12 +261,16 @@ enum { * enum devlink_trap_action - Packet trap action. * @DEVLINK_TRAP_ACTION_DROP: Packet is dropped by the device and a copy is not * sent to the CPU. + * @DEVLINK_TRAP_ACTION_HARD_DROP: Packet was dropped by the underlying device, + * and device cannot report packet to devlink + * (or inject it into the kernel RX path). * @DEVLINK_TRAP_ACTION_TRAP: The sole copy of the packet is sent to the CPU. * @DEVLINK_TRAP_ACTION_MIRROR: Packet is forwarded by the device and a copy is * sent to the CPU. */ enum devlink_trap_action { DEVLINK_TRAP_ACTION_DROP, + DEVLINK_TRAP_ACTION_HARD_DROP, DEVLINK_TRAP_ACTION_TRAP, DEVLINK_TRAP_ACTION_MIRROR, }; -- 2.17.1
| |