These are counterparts to userspace's xlate_error values. Signed-off-by: Eric Garver <e...@garver.life> --- include/net/dropreason.h | 6 ++++++ net/openvswitch/datapath.c | 17 +++++++++++++++++ net/openvswitch/drop.h | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 net/openvswitch/drop.h
diff --git a/include/net/dropreason.h b/include/net/dropreason.h index 685fb37df8e8..653675bba758 100644 --- a/include/net/dropreason.h +++ b/include/net/dropreason.h @@ -23,6 +23,12 @@ enum skb_drop_reason_subsys { */ SKB_DROP_REASON_SUBSYS_MAC80211_MONITOR, + /** + * @SKB_DROP_REASON_SUBSYS_OPENVSWITCH: openvswitch drop reasons + * see net/openvswitch/drop.h + */ + SKB_DROP_REASON_SUBSYS_OPENVSWITCH, + /** @SKB_DROP_REASON_SUBSYS_NUM: number of subsystems defined */ SKB_DROP_REASON_SUBSYS_NUM }; diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index a6d2a0b1aa21..4ebdc52856ab 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -48,6 +48,7 @@ #include "openvswitch_trace.h" #include "vport-internal_dev.h" #include "vport-netdev.h" +#include "drop.h" unsigned int ovs_net_id __read_mostly; @@ -2702,6 +2703,18 @@ static struct pernet_operations ovs_net_ops = { .size = sizeof(struct ovs_net), }; +static const char * const ovs_drop_reasons[] = { + [0] = "OVS_XLATE_OK", +#define S(x) #x, + OVS_DROP_REASONS(S) +#undef S +}; + +static struct drop_reason_list drop_reason_list_ovs = { + .reasons = ovs_drop_reasons, + .n_reasons = ARRAY_SIZE(ovs_drop_reasons), +}; + static int __init dp_init(void) { int err; @@ -2743,6 +2756,9 @@ static int __init dp_init(void) if (err < 0) goto error_unreg_netdev; + drop_reasons_register_subsys(SKB_DROP_REASON_SUBSYS_OPENVSWITCH, + &drop_reason_list_ovs); + return 0; error_unreg_netdev: @@ -2769,6 +2785,7 @@ static void dp_cleanup(void) ovs_netdev_exit(); unregister_netdevice_notifier(&ovs_dp_device_notifier); unregister_pernet_device(&ovs_net_ops); + drop_reasons_unregister_subsys(SKB_DROP_REASON_SUBSYS_OPENVSWITCH); rcu_barrier(); ovs_vport_exit(); ovs_flow_exit(); diff --git a/net/openvswitch/drop.h b/net/openvswitch/drop.h new file mode 100644 index 000000000000..787eda0083c1 --- /dev/null +++ b/net/openvswitch/drop.h @@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * openvswitch drop reason list + */ + +#ifndef OPENVSWITCH_DROP_H +#define OPENVSWITCH_DROP_H +#include <net/dropreason.h> + +/* these are counterparts to userspace xlate_error */ +#define OVS_DROP_REASONS(R) \ + R(OVS_XLATE_BRIDGE_NOT_FOUND) \ + R(OVS_XLATE_RECURSION_TOO_DEEP) \ + R(OVS_XLATE_TOO_MANY_RESUBMITS) \ + R(OVS_XLATE_STACK_TOO_DEEP) \ + R(OVS_XLATE_NO_RECIRCULATION_CONTEXT) \ + R(OVS_XLATE_RECIRCULATION_CONFLICT) \ + R(OVS_XLATE_TOO_MANY_MPLS_LABELS) \ + R(OVS_XLATE_INVALID_TUNNEL_METADATA) \ + R(OVS_XLATE_UNSUPPORTED_PACKET_TYPE) \ + R(OVS_XLATE_CONGESTION_DROP) \ + R(OVS_XLATE_FORWARDING_DISABLED) \ + /* deliberate comment for trailing \ */ + +enum ovs_drop_reason { + OVS_XLATE_OK = SKB_DROP_REASON_SUBSYS_OPENVSWITCH << + SKB_DROP_REASON_SUBSYS_SHIFT, +#define ENUM(x) x, + OVS_DROP_REASONS(ENUM) +#undef ENUM + OVS_XLATE_MAX, +}; + +#endif /* OPENVSWITCH_DROP_H */ -- 2.39.0 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev