xref: /openbmc/linux/include/net/dropreason-core.h (revision 4025d3e7)
15b8285ccSJohannes Berg /* SPDX-License-Identifier: GPL-2.0-or-later */
25b8285ccSJohannes Berg 
35b8285ccSJohannes Berg #ifndef _LINUX_DROPREASON_CORE_H
45b8285ccSJohannes Berg #define _LINUX_DROPREASON_CORE_H
55b8285ccSJohannes Berg 
65b8285ccSJohannes Berg #define DEFINE_DROP_REASON(FN, FNe)	\
75b8285ccSJohannes Berg 	FN(NOT_SPECIFIED)		\
85b8285ccSJohannes Berg 	FN(NO_SOCKET)			\
95b8285ccSJohannes Berg 	FN(PKT_TOO_SMALL)		\
105b8285ccSJohannes Berg 	FN(TCP_CSUM)			\
115b8285ccSJohannes Berg 	FN(SOCKET_FILTER)		\
125b8285ccSJohannes Berg 	FN(UDP_CSUM)			\
135b8285ccSJohannes Berg 	FN(NETFILTER_DROP)		\
145b8285ccSJohannes Berg 	FN(OTHERHOST)			\
155b8285ccSJohannes Berg 	FN(IP_CSUM)			\
165b8285ccSJohannes Berg 	FN(IP_INHDR)			\
175b8285ccSJohannes Berg 	FN(IP_RPFILTER)			\
185b8285ccSJohannes Berg 	FN(UNICAST_IN_L2_MULTICAST)	\
195b8285ccSJohannes Berg 	FN(XFRM_POLICY)			\
205b8285ccSJohannes Berg 	FN(IP_NOPROTO)			\
215b8285ccSJohannes Berg 	FN(SOCKET_RCVBUFF)		\
225b8285ccSJohannes Berg 	FN(PROTO_MEM)			\
235b8285ccSJohannes Berg 	FN(TCP_MD5NOTFOUND)		\
245b8285ccSJohannes Berg 	FN(TCP_MD5UNEXPECTED)		\
255b8285ccSJohannes Berg 	FN(TCP_MD5FAILURE)		\
265b8285ccSJohannes Berg 	FN(SOCKET_BACKLOG)		\
275b8285ccSJohannes Berg 	FN(TCP_FLAGS)			\
285b8285ccSJohannes Berg 	FN(TCP_ZEROWINDOW)		\
295b8285ccSJohannes Berg 	FN(TCP_OLD_DATA)		\
305b8285ccSJohannes Berg 	FN(TCP_OVERWINDOW)		\
315b8285ccSJohannes Berg 	FN(TCP_OFOMERGE)		\
325b8285ccSJohannes Berg 	FN(TCP_RFC7323_PAWS)		\
33b4469349SEric Dumazet 	FN(TCP_OLD_SEQUENCE)		\
345b8285ccSJohannes Berg 	FN(TCP_INVALID_SEQUENCE)	\
355b8285ccSJohannes Berg 	FN(TCP_RESET)			\
365b8285ccSJohannes Berg 	FN(TCP_INVALID_SYN)		\
375b8285ccSJohannes Berg 	FN(TCP_CLOSE)			\
385b8285ccSJohannes Berg 	FN(TCP_FASTOPEN)		\
395b8285ccSJohannes Berg 	FN(TCP_OLD_ACK)			\
405b8285ccSJohannes Berg 	FN(TCP_TOO_OLD_ACK)		\
415b8285ccSJohannes Berg 	FN(TCP_ACK_UNSENT_DATA)		\
425b8285ccSJohannes Berg 	FN(TCP_OFO_QUEUE_PRUNE)		\
435b8285ccSJohannes Berg 	FN(TCP_OFO_DROP)		\
445b8285ccSJohannes Berg 	FN(IP_OUTNOROUTES)		\
455b8285ccSJohannes Berg 	FN(BPF_CGROUP_EGRESS)		\
465b8285ccSJohannes Berg 	FN(IPV6DISABLED)		\
475b8285ccSJohannes Berg 	FN(NEIGH_CREATEFAIL)		\
485b8285ccSJohannes Berg 	FN(NEIGH_FAILED)		\
495b8285ccSJohannes Berg 	FN(NEIGH_QUEUEFULL)		\
505b8285ccSJohannes Berg 	FN(NEIGH_DEAD)			\
515b8285ccSJohannes Berg 	FN(TC_EGRESS)			\
525b8285ccSJohannes Berg 	FN(QDISC_DROP)			\
535b8285ccSJohannes Berg 	FN(CPU_BACKLOG)			\
545b8285ccSJohannes Berg 	FN(XDP)				\
555b8285ccSJohannes Berg 	FN(TC_INGRESS)			\
565b8285ccSJohannes Berg 	FN(UNHANDLED_PROTO)		\
575b8285ccSJohannes Berg 	FN(SKB_CSUM)			\
585b8285ccSJohannes Berg 	FN(SKB_GSO_SEG)			\
595b8285ccSJohannes Berg 	FN(SKB_UCOPY_FAULT)		\
605b8285ccSJohannes Berg 	FN(DEV_HDR)			\
615b8285ccSJohannes Berg 	FN(DEV_READY)			\
625b8285ccSJohannes Berg 	FN(FULL_RING)			\
635b8285ccSJohannes Berg 	FN(NOMEM)			\
645b8285ccSJohannes Berg 	FN(HDR_TRUNC)			\
655b8285ccSJohannes Berg 	FN(TAP_FILTER)			\
665b8285ccSJohannes Berg 	FN(TAP_TXFILTER)		\
675b8285ccSJohannes Berg 	FN(ICMP_CSUM)			\
685b8285ccSJohannes Berg 	FN(INVALID_PROTO)		\
695b8285ccSJohannes Berg 	FN(IP_INADDRERRORS)		\
705b8285ccSJohannes Berg 	FN(IP_INNOROUTES)		\
715b8285ccSJohannes Berg 	FN(PKT_TOO_BIG)			\
725b8285ccSJohannes Berg 	FN(DUP_FRAG)			\
735b8285ccSJohannes Berg 	FN(FRAG_REASM_TIMEOUT)		\
745b8285ccSJohannes Berg 	FN(FRAG_TOO_FAR)		\
755b8285ccSJohannes Berg 	FN(TCP_MINTTL)			\
765b8285ccSJohannes Berg 	FN(IPV6_BAD_EXTHDR)		\
775b8285ccSJohannes Berg 	FN(IPV6_NDISC_FRAG)		\
785b8285ccSJohannes Berg 	FN(IPV6_NDISC_HOP_LIMIT)	\
795b8285ccSJohannes Berg 	FN(IPV6_NDISC_BAD_CODE)		\
805b8285ccSJohannes Berg 	FN(IPV6_NDISC_BAD_OPTIONS)	\
815b8285ccSJohannes Berg 	FN(IPV6_NDISC_NS_OTHERHOST)	\
82*4025d3e7SEric Dumazet 	FN(QUEUE_PURGE)			\
835b8285ccSJohannes Berg 	FNe(MAX)
845b8285ccSJohannes Berg 
855b8285ccSJohannes Berg /**
865b8285ccSJohannes Berg  * enum skb_drop_reason - the reasons of skb drops
875b8285ccSJohannes Berg  *
885b8285ccSJohannes Berg  * The reason of skb drop, which is used in kfree_skb_reason().
895b8285ccSJohannes Berg  */
905b8285ccSJohannes Berg enum skb_drop_reason {
915b8285ccSJohannes Berg 	/**
925b8285ccSJohannes Berg 	 * @SKB_NOT_DROPPED_YET: skb is not dropped yet (used for no-drop case)
935b8285ccSJohannes Berg 	 */
945b8285ccSJohannes Berg 	SKB_NOT_DROPPED_YET = 0,
955b8285ccSJohannes Berg 	/** @SKB_CONSUMED: packet has been consumed */
965b8285ccSJohannes Berg 	SKB_CONSUMED,
975b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_NOT_SPECIFIED: drop reason is not specified */
985b8285ccSJohannes Berg 	SKB_DROP_REASON_NOT_SPECIFIED,
995b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_NO_SOCKET: socket not found */
1005b8285ccSJohannes Berg 	SKB_DROP_REASON_NO_SOCKET,
1015b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_PKT_TOO_SMALL: packet size is too small */
1025b8285ccSJohannes Berg 	SKB_DROP_REASON_PKT_TOO_SMALL,
1035b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_TCP_CSUM: TCP checksum error */
1045b8285ccSJohannes Berg 	SKB_DROP_REASON_TCP_CSUM,
1055b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_SOCKET_FILTER: dropped by socket filter */
1065b8285ccSJohannes Berg 	SKB_DROP_REASON_SOCKET_FILTER,
1075b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_UDP_CSUM: UDP checksum error */
1085b8285ccSJohannes Berg 	SKB_DROP_REASON_UDP_CSUM,
1095b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_NETFILTER_DROP: dropped by netfilter */
1105b8285ccSJohannes Berg 	SKB_DROP_REASON_NETFILTER_DROP,
1115b8285ccSJohannes Berg 	/**
1125b8285ccSJohannes Berg 	 * @SKB_DROP_REASON_OTHERHOST: packet don't belong to current host
1135b8285ccSJohannes Berg 	 * (interface is in promisc mode)
1145b8285ccSJohannes Berg 	 */
1155b8285ccSJohannes Berg 	SKB_DROP_REASON_OTHERHOST,
1165b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_IP_CSUM: IP checksum error */
1175b8285ccSJohannes Berg 	SKB_DROP_REASON_IP_CSUM,
1185b8285ccSJohannes Berg 	/**
1195b8285ccSJohannes Berg 	 * @SKB_DROP_REASON_IP_INHDR: there is something wrong with IP header (see
1205b8285ccSJohannes Berg 	 * IPSTATS_MIB_INHDRERRORS)
1215b8285ccSJohannes Berg 	 */
1225b8285ccSJohannes Berg 	SKB_DROP_REASON_IP_INHDR,
1235b8285ccSJohannes Berg 	/**
1245b8285ccSJohannes Berg 	 * @SKB_DROP_REASON_IP_RPFILTER: IP rpfilter validate failed. see the
1255b8285ccSJohannes Berg 	 * document for rp_filter in ip-sysctl.rst for more information
1265b8285ccSJohannes Berg 	 */
1275b8285ccSJohannes Berg 	SKB_DROP_REASON_IP_RPFILTER,
1285b8285ccSJohannes Berg 	/**
1295b8285ccSJohannes Berg 	 * @SKB_DROP_REASON_UNICAST_IN_L2_MULTICAST: destination address of L2 is
1305b8285ccSJohannes Berg 	 * multicast, but L3 is unicast.
1315b8285ccSJohannes Berg 	 */
1325b8285ccSJohannes Berg 	SKB_DROP_REASON_UNICAST_IN_L2_MULTICAST,
1335b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_XFRM_POLICY: xfrm policy check failed */
1345b8285ccSJohannes Berg 	SKB_DROP_REASON_XFRM_POLICY,
1355b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_IP_NOPROTO: no support for IP protocol */
1365b8285ccSJohannes Berg 	SKB_DROP_REASON_IP_NOPROTO,
1375b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_SOCKET_RCVBUFF: socket receive buff is full */
1385b8285ccSJohannes Berg 	SKB_DROP_REASON_SOCKET_RCVBUFF,
1395b8285ccSJohannes Berg 	/**
1405b8285ccSJohannes Berg 	 * @SKB_DROP_REASON_PROTO_MEM: proto memory limition, such as udp packet
1415b8285ccSJohannes Berg 	 * drop out of udp_memory_allocated.
1425b8285ccSJohannes Berg 	 */
1435b8285ccSJohannes Berg 	SKB_DROP_REASON_PROTO_MEM,
1445b8285ccSJohannes Berg 	/**
1455b8285ccSJohannes Berg 	 * @SKB_DROP_REASON_TCP_MD5NOTFOUND: no MD5 hash and one expected,
1465b8285ccSJohannes Berg 	 * corresponding to LINUX_MIB_TCPMD5NOTFOUND
1475b8285ccSJohannes Berg 	 */
1485b8285ccSJohannes Berg 	SKB_DROP_REASON_TCP_MD5NOTFOUND,
1495b8285ccSJohannes Berg 	/**
1505b8285ccSJohannes Berg 	 * @SKB_DROP_REASON_TCP_MD5UNEXPECTED: MD5 hash and we're not expecting
1515b8285ccSJohannes Berg 	 * one, corresponding to LINUX_MIB_TCPMD5UNEXPECTED
1525b8285ccSJohannes Berg 	 */
1535b8285ccSJohannes Berg 	SKB_DROP_REASON_TCP_MD5UNEXPECTED,
1545b8285ccSJohannes Berg 	/**
1555b8285ccSJohannes Berg 	 * @SKB_DROP_REASON_TCP_MD5FAILURE: MD5 hash and its wrong, corresponding
1565b8285ccSJohannes Berg 	 * to LINUX_MIB_TCPMD5FAILURE
1575b8285ccSJohannes Berg 	 */
1585b8285ccSJohannes Berg 	SKB_DROP_REASON_TCP_MD5FAILURE,
1595b8285ccSJohannes Berg 	/**
1605b8285ccSJohannes Berg 	 * @SKB_DROP_REASON_SOCKET_BACKLOG: failed to add skb to socket backlog (
1615b8285ccSJohannes Berg 	 * see LINUX_MIB_TCPBACKLOGDROP)
1625b8285ccSJohannes Berg 	 */
1635b8285ccSJohannes Berg 	SKB_DROP_REASON_SOCKET_BACKLOG,
1645b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_TCP_FLAGS: TCP flags invalid */
1655b8285ccSJohannes Berg 	SKB_DROP_REASON_TCP_FLAGS,
1665b8285ccSJohannes Berg 	/**
1675b8285ccSJohannes Berg 	 * @SKB_DROP_REASON_TCP_ZEROWINDOW: TCP receive window size is zero,
1685b8285ccSJohannes Berg 	 * see LINUX_MIB_TCPZEROWINDOWDROP
1695b8285ccSJohannes Berg 	 */
1705b8285ccSJohannes Berg 	SKB_DROP_REASON_TCP_ZEROWINDOW,
1715b8285ccSJohannes Berg 	/**
1725b8285ccSJohannes Berg 	 * @SKB_DROP_REASON_TCP_OLD_DATA: the TCP data reveived is already
1735b8285ccSJohannes Berg 	 * received before (spurious retrans may happened), see
1745b8285ccSJohannes Berg 	 * LINUX_MIB_DELAYEDACKLOST
1755b8285ccSJohannes Berg 	 */
1765b8285ccSJohannes Berg 	SKB_DROP_REASON_TCP_OLD_DATA,
1775b8285ccSJohannes Berg 	/**
1785b8285ccSJohannes Berg 	 * @SKB_DROP_REASON_TCP_OVERWINDOW: the TCP data is out of window,
1795b8285ccSJohannes Berg 	 * the seq of the first byte exceed the right edges of receive
1805b8285ccSJohannes Berg 	 * window
1815b8285ccSJohannes Berg 	 */
1825b8285ccSJohannes Berg 	SKB_DROP_REASON_TCP_OVERWINDOW,
1835b8285ccSJohannes Berg 	/**
1845b8285ccSJohannes Berg 	 * @SKB_DROP_REASON_TCP_OFOMERGE: the data of skb is already in the ofo
1855b8285ccSJohannes Berg 	 * queue, corresponding to LINUX_MIB_TCPOFOMERGE
1865b8285ccSJohannes Berg 	 */
1875b8285ccSJohannes Berg 	SKB_DROP_REASON_TCP_OFOMERGE,
1885b8285ccSJohannes Berg 	/**
1895b8285ccSJohannes Berg 	 * @SKB_DROP_REASON_TCP_RFC7323_PAWS: PAWS check, corresponding to
1905b8285ccSJohannes Berg 	 * LINUX_MIB_PAWSESTABREJECTED
1915b8285ccSJohannes Berg 	 */
1925b8285ccSJohannes Berg 	SKB_DROP_REASON_TCP_RFC7323_PAWS,
193b4469349SEric Dumazet 	/** @SKB_DROP_REASON_TCP_OLD_SEQUENCE: Old SEQ field (duplicate packet) */
194b4469349SEric Dumazet 	SKB_DROP_REASON_TCP_OLD_SEQUENCE,
1955b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_TCP_INVALID_SEQUENCE: Not acceptable SEQ field */
1965b8285ccSJohannes Berg 	SKB_DROP_REASON_TCP_INVALID_SEQUENCE,
1975b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_TCP_RESET: Invalid RST packet */
1985b8285ccSJohannes Berg 	SKB_DROP_REASON_TCP_RESET,
1995b8285ccSJohannes Berg 	/**
2005b8285ccSJohannes Berg 	 * @SKB_DROP_REASON_TCP_INVALID_SYN: Incoming packet has unexpected
2015b8285ccSJohannes Berg 	 * SYN flag
2025b8285ccSJohannes Berg 	 */
2035b8285ccSJohannes Berg 	SKB_DROP_REASON_TCP_INVALID_SYN,
2045b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_TCP_CLOSE: TCP socket in CLOSE state */
2055b8285ccSJohannes Berg 	SKB_DROP_REASON_TCP_CLOSE,
2065b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_TCP_FASTOPEN: dropped by FASTOPEN request socket */
2075b8285ccSJohannes Berg 	SKB_DROP_REASON_TCP_FASTOPEN,
2085b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_TCP_OLD_ACK: TCP ACK is old, but in window */
2095b8285ccSJohannes Berg 	SKB_DROP_REASON_TCP_OLD_ACK,
2105b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_TCP_TOO_OLD_ACK: TCP ACK is too old */
2115b8285ccSJohannes Berg 	SKB_DROP_REASON_TCP_TOO_OLD_ACK,
2125b8285ccSJohannes Berg 	/**
2135b8285ccSJohannes Berg 	 * @SKB_DROP_REASON_TCP_ACK_UNSENT_DATA: TCP ACK for data we haven't
2145b8285ccSJohannes Berg 	 * sent yet
2155b8285ccSJohannes Berg 	 */
2165b8285ccSJohannes Berg 	SKB_DROP_REASON_TCP_ACK_UNSENT_DATA,
2175b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_TCP_OFO_QUEUE_PRUNE: pruned from TCP OFO queue */
2185b8285ccSJohannes Berg 	SKB_DROP_REASON_TCP_OFO_QUEUE_PRUNE,
2195b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_TCP_OFO_DROP: data already in receive queue */
2205b8285ccSJohannes Berg 	SKB_DROP_REASON_TCP_OFO_DROP,
2215b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_IP_OUTNOROUTES: route lookup failed */
2225b8285ccSJohannes Berg 	SKB_DROP_REASON_IP_OUTNOROUTES,
2235b8285ccSJohannes Berg 	/**
2245b8285ccSJohannes Berg 	 * @SKB_DROP_REASON_BPF_CGROUP_EGRESS: dropped by BPF_PROG_TYPE_CGROUP_SKB
2255b8285ccSJohannes Berg 	 * eBPF program
2265b8285ccSJohannes Berg 	 */
2275b8285ccSJohannes Berg 	SKB_DROP_REASON_BPF_CGROUP_EGRESS,
2285b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_IPV6DISABLED: IPv6 is disabled on the device */
2295b8285ccSJohannes Berg 	SKB_DROP_REASON_IPV6DISABLED,
2305b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_NEIGH_CREATEFAIL: failed to create neigh entry */
2315b8285ccSJohannes Berg 	SKB_DROP_REASON_NEIGH_CREATEFAIL,
2325b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_NEIGH_FAILED: neigh entry in failed state */
2335b8285ccSJohannes Berg 	SKB_DROP_REASON_NEIGH_FAILED,
2345b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_NEIGH_QUEUEFULL: arp_queue for neigh entry is full */
2355b8285ccSJohannes Berg 	SKB_DROP_REASON_NEIGH_QUEUEFULL,
2365b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_NEIGH_DEAD: neigh entry is dead */
2375b8285ccSJohannes Berg 	SKB_DROP_REASON_NEIGH_DEAD,
2385b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_TC_EGRESS: dropped in TC egress HOOK */
2395b8285ccSJohannes Berg 	SKB_DROP_REASON_TC_EGRESS,
2405b8285ccSJohannes Berg 	/**
2415b8285ccSJohannes Berg 	 * @SKB_DROP_REASON_QDISC_DROP: dropped by qdisc when packet outputting (
2425b8285ccSJohannes Berg 	 * failed to enqueue to current qdisc)
2435b8285ccSJohannes Berg 	 */
2445b8285ccSJohannes Berg 	SKB_DROP_REASON_QDISC_DROP,
2455b8285ccSJohannes Berg 	/**
2465b8285ccSJohannes Berg 	 * @SKB_DROP_REASON_CPU_BACKLOG: failed to enqueue the skb to the per CPU
2475b8285ccSJohannes Berg 	 * backlog queue. This can be caused by backlog queue full (see
2485b8285ccSJohannes Berg 	 * netdev_max_backlog in net.rst) or RPS flow limit
2495b8285ccSJohannes Berg 	 */
2505b8285ccSJohannes Berg 	SKB_DROP_REASON_CPU_BACKLOG,
2515b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_XDP: dropped by XDP in input path */
2525b8285ccSJohannes Berg 	SKB_DROP_REASON_XDP,
2535b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_TC_INGRESS: dropped in TC ingress HOOK */
2545b8285ccSJohannes Berg 	SKB_DROP_REASON_TC_INGRESS,
2555b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_UNHANDLED_PROTO: protocol not implemented or not supported */
2565b8285ccSJohannes Berg 	SKB_DROP_REASON_UNHANDLED_PROTO,
2575b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_SKB_CSUM: sk_buff checksum computation error */
2585b8285ccSJohannes Berg 	SKB_DROP_REASON_SKB_CSUM,
2595b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_SKB_GSO_SEG: gso segmentation error */
2605b8285ccSJohannes Berg 	SKB_DROP_REASON_SKB_GSO_SEG,
2615b8285ccSJohannes Berg 	/**
2625b8285ccSJohannes Berg 	 * @SKB_DROP_REASON_SKB_UCOPY_FAULT: failed to copy data from user space,
2635b8285ccSJohannes Berg 	 * e.g., via zerocopy_sg_from_iter() or skb_orphan_frags_rx()
2645b8285ccSJohannes Berg 	 */
2655b8285ccSJohannes Berg 	SKB_DROP_REASON_SKB_UCOPY_FAULT,
2665b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_DEV_HDR: device driver specific header/metadata is invalid */
2675b8285ccSJohannes Berg 	SKB_DROP_REASON_DEV_HDR,
2685b8285ccSJohannes Berg 	/**
2695b8285ccSJohannes Berg 	 * @SKB_DROP_REASON_DEV_READY: the device is not ready to xmit/recv due to
2705b8285ccSJohannes Berg 	 * any of its data structure that is not up/ready/initialized,
2715b8285ccSJohannes Berg 	 * e.g., the IFF_UP is not set, or driver specific tun->tfiles[txq]
2725b8285ccSJohannes Berg 	 * is not initialized
2735b8285ccSJohannes Berg 	 */
2745b8285ccSJohannes Berg 	SKB_DROP_REASON_DEV_READY,
2755b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_FULL_RING: ring buffer is full */
2765b8285ccSJohannes Berg 	SKB_DROP_REASON_FULL_RING,
2775b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_NOMEM: error due to OOM */
2785b8285ccSJohannes Berg 	SKB_DROP_REASON_NOMEM,
2795b8285ccSJohannes Berg 	/**
2805b8285ccSJohannes Berg 	 * @SKB_DROP_REASON_HDR_TRUNC: failed to trunc/extract the header from
2815b8285ccSJohannes Berg 	 * networking data, e.g., failed to pull the protocol header from
2825b8285ccSJohannes Berg 	 * frags via pskb_may_pull()
2835b8285ccSJohannes Berg 	 */
2845b8285ccSJohannes Berg 	SKB_DROP_REASON_HDR_TRUNC,
2855b8285ccSJohannes Berg 	/**
2865b8285ccSJohannes Berg 	 * @SKB_DROP_REASON_TAP_FILTER: dropped by (ebpf) filter directly attached
2875b8285ccSJohannes Berg 	 * to tun/tap, e.g., via TUNSETFILTEREBPF
2885b8285ccSJohannes Berg 	 */
2895b8285ccSJohannes Berg 	SKB_DROP_REASON_TAP_FILTER,
2905b8285ccSJohannes Berg 	/**
2915b8285ccSJohannes Berg 	 * @SKB_DROP_REASON_TAP_TXFILTER: dropped by tx filter implemented at
2925b8285ccSJohannes Berg 	 * tun/tap, e.g., check_filter()
2935b8285ccSJohannes Berg 	 */
2945b8285ccSJohannes Berg 	SKB_DROP_REASON_TAP_TXFILTER,
2955b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_ICMP_CSUM: ICMP checksum error */
2965b8285ccSJohannes Berg 	SKB_DROP_REASON_ICMP_CSUM,
2975b8285ccSJohannes Berg 	/**
2985b8285ccSJohannes Berg 	 * @SKB_DROP_REASON_INVALID_PROTO: the packet doesn't follow RFC 2211,
2995b8285ccSJohannes Berg 	 * such as a broadcasts ICMP_TIMESTAMP
3005b8285ccSJohannes Berg 	 */
3015b8285ccSJohannes Berg 	SKB_DROP_REASON_INVALID_PROTO,
3025b8285ccSJohannes Berg 	/**
3035b8285ccSJohannes Berg 	 * @SKB_DROP_REASON_IP_INADDRERRORS: host unreachable, corresponding to
3045b8285ccSJohannes Berg 	 * IPSTATS_MIB_INADDRERRORS
3055b8285ccSJohannes Berg 	 */
3065b8285ccSJohannes Berg 	SKB_DROP_REASON_IP_INADDRERRORS,
3075b8285ccSJohannes Berg 	/**
3085b8285ccSJohannes Berg 	 * @SKB_DROP_REASON_IP_INNOROUTES: network unreachable, corresponding to
3095b8285ccSJohannes Berg 	 * IPSTATS_MIB_INADDRERRORS
3105b8285ccSJohannes Berg 	 */
3115b8285ccSJohannes Berg 	SKB_DROP_REASON_IP_INNOROUTES,
3125b8285ccSJohannes Berg 	/**
3135b8285ccSJohannes Berg 	 * @SKB_DROP_REASON_PKT_TOO_BIG: packet size is too big (maybe exceed the
3145b8285ccSJohannes Berg 	 * MTU)
3155b8285ccSJohannes Berg 	 */
3165b8285ccSJohannes Berg 	SKB_DROP_REASON_PKT_TOO_BIG,
3175b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_DUP_FRAG: duplicate fragment */
3185b8285ccSJohannes Berg 	SKB_DROP_REASON_DUP_FRAG,
3195b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_FRAG_REASM_TIMEOUT: fragment reassembly timeout */
3205b8285ccSJohannes Berg 	SKB_DROP_REASON_FRAG_REASM_TIMEOUT,
3215b8285ccSJohannes Berg 	/**
3225b8285ccSJohannes Berg 	 * @SKB_DROP_REASON_FRAG_TOO_FAR: ipv4 fragment too far.
3235b8285ccSJohannes Berg 	 * (/proc/sys/net/ipv4/ipfrag_max_dist)
3245b8285ccSJohannes Berg 	 */
3255b8285ccSJohannes Berg 	SKB_DROP_REASON_FRAG_TOO_FAR,
3265b8285ccSJohannes Berg 	/**
3275b8285ccSJohannes Berg 	 * @SKB_DROP_REASON_TCP_MINTTL: ipv4 ttl or ipv6 hoplimit below
3285b8285ccSJohannes Berg 	 * the threshold (IP_MINTTL or IPV6_MINHOPCOUNT).
3295b8285ccSJohannes Berg 	 */
3305b8285ccSJohannes Berg 	SKB_DROP_REASON_TCP_MINTTL,
3315b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_IPV6_BAD_EXTHDR: Bad IPv6 extension header. */
3325b8285ccSJohannes Berg 	SKB_DROP_REASON_IPV6_BAD_EXTHDR,
3335b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_IPV6_NDISC_FRAG: invalid frag (suppress_frag_ndisc). */
3345b8285ccSJohannes Berg 	SKB_DROP_REASON_IPV6_NDISC_FRAG,
3355b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_IPV6_NDISC_HOP_LIMIT: invalid hop limit. */
3365b8285ccSJohannes Berg 	SKB_DROP_REASON_IPV6_NDISC_HOP_LIMIT,
3375b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_IPV6_NDISC_BAD_CODE: invalid NDISC icmp6 code. */
3385b8285ccSJohannes Berg 	SKB_DROP_REASON_IPV6_NDISC_BAD_CODE,
3395b8285ccSJohannes Berg 	/** @SKB_DROP_REASON_IPV6_NDISC_BAD_OPTIONS: invalid NDISC options. */
3405b8285ccSJohannes Berg 	SKB_DROP_REASON_IPV6_NDISC_BAD_OPTIONS,
3415b8285ccSJohannes Berg 	/**
3425b8285ccSJohannes Berg 	 * @SKB_DROP_REASON_IPV6_NDISC_NS_OTHERHOST: NEIGHBOUR SOLICITATION
3435b8285ccSJohannes Berg 	 * for another host.
3445b8285ccSJohannes Berg 	 */
3455b8285ccSJohannes Berg 	SKB_DROP_REASON_IPV6_NDISC_NS_OTHERHOST,
346*4025d3e7SEric Dumazet 	/** @SKB_DROP_REASON_QUEUE_PURGE: bulk free. */
347*4025d3e7SEric Dumazet 	SKB_DROP_REASON_QUEUE_PURGE,
3485b8285ccSJohannes Berg 	/**
349071c0fc6SJohannes Berg 	 * @SKB_DROP_REASON_MAX: the maximum of core drop reasons, which
350071c0fc6SJohannes Berg 	 * shouldn't be used as a real 'reason' - only for tracing code gen
3515b8285ccSJohannes Berg 	 */
3525b8285ccSJohannes Berg 	SKB_DROP_REASON_MAX,
353071c0fc6SJohannes Berg 
354071c0fc6SJohannes Berg 	/**
355071c0fc6SJohannes Berg 	 * @SKB_DROP_REASON_SUBSYS_MASK: subsystem mask in drop reasons,
356071c0fc6SJohannes Berg 	 * see &enum skb_drop_reason_subsys
357071c0fc6SJohannes Berg 	 */
358071c0fc6SJohannes Berg 	SKB_DROP_REASON_SUBSYS_MASK = 0xffff0000,
3595b8285ccSJohannes Berg };
3605b8285ccSJohannes Berg 
361071c0fc6SJohannes Berg #define SKB_DROP_REASON_SUBSYS_SHIFT	16
362071c0fc6SJohannes Berg 
3635b8285ccSJohannes Berg #define SKB_DR_INIT(name, reason)				\
3645b8285ccSJohannes Berg 	enum skb_drop_reason name = SKB_DROP_REASON_##reason
3655b8285ccSJohannes Berg #define SKB_DR(name)						\
3665b8285ccSJohannes Berg 	SKB_DR_INIT(name, NOT_SPECIFIED)
3675b8285ccSJohannes Berg #define SKB_DR_SET(name, reason)				\
3685b8285ccSJohannes Berg 	(name = SKB_DROP_REASON_##reason)
3695b8285ccSJohannes Berg #define SKB_DR_OR(name, reason)					\
3705b8285ccSJohannes Berg 	do {							\
3715b8285ccSJohannes Berg 		if (name == SKB_DROP_REASON_NOT_SPECIFIED ||	\
3725b8285ccSJohannes Berg 		    name == SKB_NOT_DROPPED_YET)		\
3735b8285ccSJohannes Berg 			SKB_DR_SET(name, reason);		\
3745b8285ccSJohannes Berg 	} while (0)
3755b8285ccSJohannes Berg 
3765b8285ccSJohannes Berg #endif
377