aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/drop_monitor.h
diff options
context:
space:
mode:
authorIdo Schimmel <idosch@mellanox.com>2019-08-17 16:28:12 +0300
committerDavid S. Miller <davem@davemloft.net>2019-08-17 12:40:08 -0700
commitedd3d0074c256848bbf5805350b39d40b1e2bf2b (patch)
tree5606e7b74ef722693ac100484b88d7b1cf6e14bc /include/net/drop_monitor.h
parentdrop_monitor: Initialize hardware per-CPU data (diff)
downloadlinux-dev-edd3d0074c256848bbf5805350b39d40b1e2bf2b.tar.xz
linux-dev-edd3d0074c256848bbf5805350b39d40b1e2bf2b.zip
drop_monitor: Add basic infrastructure for hardware drops
Export a function that can be invoked in order to report packets that were dropped by the underlying hardware along with metadata. Subsequent patches will add support for the different alert modes. Signed-off-by: Ido Schimmel <idosch@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/drop_monitor.h')
-rw-r--r--include/net/drop_monitor.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/include/net/drop_monitor.h b/include/net/drop_monitor.h
new file mode 100644
index 000000000000..2ab668461463
--- /dev/null
+++ b/include/net/drop_monitor.h
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef _NET_DROP_MONITOR_H_
+#define _NET_DROP_MONITOR_H_
+
+#include <linux/ktime.h>
+#include <linux/netdevice.h>
+#include <linux/skbuff.h>
+
+/**
+ * struct net_dm_hw_metadata - Hardware-supplied packet metadata.
+ * @trap_group_name: Hardware trap group name.
+ * @trap_name: Hardware trap name.
+ * @input_dev: Input netdevice.
+ */
+struct net_dm_hw_metadata {
+ const char *trap_group_name;
+ const char *trap_name;
+ struct net_device *input_dev;
+};
+
+#if IS_ENABLED(CONFIG_NET_DROP_MONITOR)
+void net_dm_hw_report(struct sk_buff *skb,
+ const struct net_dm_hw_metadata *hw_metadata);
+#else
+static inline void
+net_dm_hw_report(struct sk_buff *skb,
+ const struct net_dm_hw_metadata *hw_metadata)
+{
+}
+#endif
+
+#endif /* _NET_DROP_MONITOR_H_ */