Skip to content

Commit 93e1559

Browse files
idoschdavem330
authored andcommitted
drop_monitor: Filter control packets in drop monitor
Previously, devlink called into drop monitor in order to report hardware originated drops / exceptions. devlink intentionally filtered control packets and did not pass them to drop monitor as they were not dropped by the underlying hardware. Now drop monitor registers its probe on a generic 'devlink_trap_report' tracepoint and should therefore perform this filtering itself instead of having devlink do that. Add the trap type as metadata and have drop monitor ignore control packets. Signed-off-by: Ido Schimmel <[email protected]> Reviewed-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a848c05 commit 93e1559

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

include/net/devlink.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,12 +630,14 @@ struct devlink_health_reporter_ops {
630630
* @trap_group_name: Trap group name.
631631
* @input_dev: Input netdevice.
632632
* @fa_cookie: Flow action user cookie.
633+
* @trap_type: Trap type.
633634
*/
634635
struct devlink_trap_metadata {
635636
const char *trap_name;
636637
const char *trap_group_name;
637638
struct net_device *input_dev;
638639
const struct flow_action_cookie *fa_cookie;
640+
enum devlink_trap_type trap_type;
639641
};
640642

641643
/**

net/core/devlink.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9269,6 +9269,7 @@ devlink_trap_report_metadata_set(struct devlink_trap_metadata *metadata,
92699269
metadata->trap_name = trap_item->trap->name;
92709270
metadata->trap_group_name = trap_item->group_item->group->name;
92719271
metadata->fa_cookie = fa_cookie;
9272+
metadata->trap_type = trap_item->trap->type;
92729273

92739274
spin_lock(&in_devlink_port->type_lock);
92749275
if (in_devlink_port->type == DEVLINK_PORT_TYPE_ETH)
@@ -9294,13 +9295,6 @@ void devlink_trap_report(struct devlink *devlink, struct sk_buff *skb,
92949295
devlink_trap_stats_update(trap_item->stats, skb->len);
92959296
devlink_trap_stats_update(trap_item->group_item->stats, skb->len);
92969297

9297-
/* Control packets were not dropped by the device or encountered an
9298-
* exception during forwarding and therefore should not be reported to
9299-
* the kernel's drop monitor.
9300-
*/
9301-
if (trap_item->trap->type == DEVLINK_TRAP_TYPE_CONTROL)
9302-
return;
9303-
93049298
if (trace_devlink_trap_report_enabled()) {
93059299
struct devlink_trap_metadata metadata = {};
93069300

net/core/drop_monitor.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,9 @@ net_dm_hw_trap_summary_probe(void *ignore, const struct devlink *devlink,
444444
unsigned long flags;
445445
int i;
446446

447+
if (metadata->trap_type == DEVLINK_TRAP_TYPE_CONTROL)
448+
return;
449+
447450
hw_data = this_cpu_ptr(&dm_hw_cpu_data);
448451
spin_lock_irqsave(&hw_data->lock, flags);
449452
hw_entries = hw_data->hw_entries;
@@ -937,6 +940,9 @@ net_dm_hw_trap_packet_probe(void *ignore, const struct devlink *devlink,
937940
struct sk_buff *nskb;
938941
unsigned long flags;
939942

943+
if (metadata->trap_type == DEVLINK_TRAP_TYPE_CONTROL)
944+
return;
945+
940946
if (!skb_mac_header_was_set(skb))
941947
return;
942948

0 commit comments

Comments
 (0)