summaryrefslogtreecommitdiff
path: root/net/openvswitch/drop.h
diff options
context:
space:
mode:
authorAdrian Moreno <amorenoz@redhat.com>2023-08-11 16:12:48 +0200
committerDavid S. Miller <davem@davemloft.net>2023-08-14 08:01:06 +0100
commit9d802da40b7c820deb9c60fc394457ea565cafc8 (patch)
treeff60cda621b7504ac5ce43fde491c630584173c0 /net/openvswitch/drop.h
parentafb0c19242a0c9a19fc2013dd1389b553acc0ede (diff)
net: openvswitch: add last-action drop reason
Create a new drop reason subsystem for openvswitch and add the first drop reason to represent last-action drops. Last-action drops happen when a flow has an empty action list or there is no action that consumes the packet (output, userspace, recirc, etc). It is the most common way in which OVS drops packets. Implementation-wise, most of these skb-consuming actions already call "consume_skb" internally and return directly from within the do_execute_actions() loop so with minimal changes we can assume that any skb that exits the loop normally is a packet drop. Signed-off-by: Adrian Moreno <amorenoz@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/openvswitch/drop.h')
-rw-r--r--net/openvswitch/drop.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/net/openvswitch/drop.h b/net/openvswitch/drop.h
new file mode 100644
index 000000000000..a5b2b901249b
--- /dev/null
+++ b/net/openvswitch/drop.h
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * OpenvSwitch drop reason list.
+ */
+
+#ifndef OPENVSWITCH_DROP_H
+#define OPENVSWITCH_DROP_H
+#include <linux/skbuff.h>
+#include <net/dropreason.h>
+
+#define OVS_DROP_REASONS(R) \
+ R(OVS_DROP_LAST_ACTION) \
+ /* deliberate comment for trailing \ */
+
+enum ovs_drop_reason {
+ __OVS_DROP_REASON = SKB_DROP_REASON_SUBSYS_OPENVSWITCH <<
+ SKB_DROP_REASON_SUBSYS_SHIFT,
+#define ENUM(x) x,
+ OVS_DROP_REASONS(ENUM)
+#undef ENUM
+
+ OVS_DROP_MAX,
+};
+
+static inline void
+ovs_kfree_skb_reason(struct sk_buff *skb, enum ovs_drop_reason reason)
+{
+ kfree_skb_reason(skb, (u32)reason);
+}
+
+#endif /* OPENVSWITCH_DROP_H */