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 <idosch@mellanox.com> Reviewed-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
a848c05f4b
commit
93e155967c
@@ -630,12 +630,14 @@ struct devlink_health_reporter_ops {
|
|||||||
* @trap_group_name: Trap group name.
|
* @trap_group_name: Trap group name.
|
||||||
* @input_dev: Input netdevice.
|
* @input_dev: Input netdevice.
|
||||||
* @fa_cookie: Flow action user cookie.
|
* @fa_cookie: Flow action user cookie.
|
||||||
|
* @trap_type: Trap type.
|
||||||
*/
|
*/
|
||||||
struct devlink_trap_metadata {
|
struct devlink_trap_metadata {
|
||||||
const char *trap_name;
|
const char *trap_name;
|
||||||
const char *trap_group_name;
|
const char *trap_group_name;
|
||||||
struct net_device *input_dev;
|
struct net_device *input_dev;
|
||||||
const struct flow_action_cookie *fa_cookie;
|
const struct flow_action_cookie *fa_cookie;
|
||||||
|
enum devlink_trap_type trap_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -9269,6 +9269,7 @@ devlink_trap_report_metadata_set(struct devlink_trap_metadata *metadata,
|
|||||||
metadata->trap_name = trap_item->trap->name;
|
metadata->trap_name = trap_item->trap->name;
|
||||||
metadata->trap_group_name = trap_item->group_item->group->name;
|
metadata->trap_group_name = trap_item->group_item->group->name;
|
||||||
metadata->fa_cookie = fa_cookie;
|
metadata->fa_cookie = fa_cookie;
|
||||||
|
metadata->trap_type = trap_item->trap->type;
|
||||||
|
|
||||||
spin_lock(&in_devlink_port->type_lock);
|
spin_lock(&in_devlink_port->type_lock);
|
||||||
if (in_devlink_port->type == DEVLINK_PORT_TYPE_ETH)
|
if (in_devlink_port->type == DEVLINK_PORT_TYPE_ETH)
|
||||||
@@ -9294,13 +9295,6 @@ void devlink_trap_report(struct devlink *devlink, struct sk_buff *skb,
|
|||||||
devlink_trap_stats_update(trap_item->stats, skb->len);
|
devlink_trap_stats_update(trap_item->stats, skb->len);
|
||||||
devlink_trap_stats_update(trap_item->group_item->stats, skb->len);
|
devlink_trap_stats_update(trap_item->group_item->stats, skb->len);
|
||||||
|
|
||||||
/* Control packets were not dropped by the device or encountered an
|
|
||||||
* exception during forwarding and therefore should not be reported to
|
|
||||||
* the kernel's drop monitor.
|
|
||||||
*/
|
|
||||||
if (trap_item->trap->type == DEVLINK_TRAP_TYPE_CONTROL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (trace_devlink_trap_report_enabled()) {
|
if (trace_devlink_trap_report_enabled()) {
|
||||||
struct devlink_trap_metadata metadata = {};
|
struct devlink_trap_metadata metadata = {};
|
||||||
|
|
||||||
|
@@ -444,6 +444,9 @@ net_dm_hw_trap_summary_probe(void *ignore, const struct devlink *devlink,
|
|||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (metadata->trap_type == DEVLINK_TRAP_TYPE_CONTROL)
|
||||||
|
return;
|
||||||
|
|
||||||
hw_data = this_cpu_ptr(&dm_hw_cpu_data);
|
hw_data = this_cpu_ptr(&dm_hw_cpu_data);
|
||||||
spin_lock_irqsave(&hw_data->lock, flags);
|
spin_lock_irqsave(&hw_data->lock, flags);
|
||||||
hw_entries = hw_data->hw_entries;
|
hw_entries = hw_data->hw_entries;
|
||||||
@@ -937,6 +940,9 @@ net_dm_hw_trap_packet_probe(void *ignore, const struct devlink *devlink,
|
|||||||
struct sk_buff *nskb;
|
struct sk_buff *nskb;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
|
if (metadata->trap_type == DEVLINK_TRAP_TYPE_CONTROL)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!skb_mac_header_was_set(skb))
|
if (!skb_mac_header_was_set(skb))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user