xref: /linux/include/net/dropreason-core.h (revision 3fd6c59042dbba50391e30862beac979491145fe)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #ifndef _LINUX_DROPREASON_CORE_H
4 #define _LINUX_DROPREASON_CORE_H
5 
6 #define DEFINE_DROP_REASON(FN, FNe)	\
7 	FN(NOT_SPECIFIED)		\
8 	FN(NO_SOCKET)			\
9 	FN(PKT_TOO_SMALL)		\
10 	FN(TCP_CSUM)			\
11 	FN(SOCKET_FILTER)		\
12 	FN(UDP_CSUM)			\
13 	FN(NETFILTER_DROP)		\
14 	FN(OTHERHOST)			\
15 	FN(IP_CSUM)			\
16 	FN(IP_INHDR)			\
17 	FN(IP_RPFILTER)			\
18 	FN(UNICAST_IN_L2_MULTICAST)	\
19 	FN(XFRM_POLICY)			\
20 	FN(IP_NOPROTO)			\
21 	FN(SOCKET_RCVBUFF)		\
22 	FN(PROTO_MEM)			\
23 	FN(TCP_AUTH_HDR)		\
24 	FN(TCP_MD5NOTFOUND)		\
25 	FN(TCP_MD5UNEXPECTED)		\
26 	FN(TCP_MD5FAILURE)		\
27 	FN(TCP_AONOTFOUND)		\
28 	FN(TCP_AOUNEXPECTED)		\
29 	FN(TCP_AOKEYNOTFOUND)		\
30 	FN(TCP_AOFAILURE)		\
31 	FN(SOCKET_BACKLOG)		\
32 	FN(TCP_FLAGS)			\
33 	FN(TCP_ABORT_ON_DATA)		\
34 	FN(TCP_ZEROWINDOW)		\
35 	FN(TCP_OLD_DATA)		\
36 	FN(TCP_OVERWINDOW)		\
37 	FN(TCP_OFOMERGE)		\
38 	FN(TCP_RFC7323_PAWS)		\
39 	FN(TCP_OLD_SEQUENCE)		\
40 	FN(TCP_INVALID_SEQUENCE)	\
41 	FN(TCP_INVALID_ACK_SEQUENCE)	\
42 	FN(TCP_RESET)			\
43 	FN(TCP_INVALID_SYN)		\
44 	FN(TCP_CLOSE)			\
45 	FN(TCP_FASTOPEN)		\
46 	FN(TCP_OLD_ACK)			\
47 	FN(TCP_TOO_OLD_ACK)		\
48 	FN(TCP_ACK_UNSENT_DATA)		\
49 	FN(TCP_OFO_QUEUE_PRUNE)		\
50 	FN(TCP_OFO_DROP)		\
51 	FN(IP_OUTNOROUTES)		\
52 	FN(BPF_CGROUP_EGRESS)		\
53 	FN(IPV6DISABLED)		\
54 	FN(NEIGH_CREATEFAIL)		\
55 	FN(NEIGH_FAILED)		\
56 	FN(NEIGH_QUEUEFULL)		\
57 	FN(NEIGH_DEAD)			\
58 	FN(TC_EGRESS)			\
59 	FN(SECURITY_HOOK)		\
60 	FN(QDISC_DROP)			\
61 	FN(CPU_BACKLOG)			\
62 	FN(XDP)				\
63 	FN(TC_INGRESS)			\
64 	FN(UNHANDLED_PROTO)		\
65 	FN(SKB_CSUM)			\
66 	FN(SKB_GSO_SEG)			\
67 	FN(SKB_UCOPY_FAULT)		\
68 	FN(DEV_HDR)			\
69 	FN(DEV_READY)			\
70 	FN(FULL_RING)			\
71 	FN(NOMEM)			\
72 	FN(HDR_TRUNC)			\
73 	FN(TAP_FILTER)			\
74 	FN(TAP_TXFILTER)		\
75 	FN(ICMP_CSUM)			\
76 	FN(INVALID_PROTO)		\
77 	FN(IP_INADDRERRORS)		\
78 	FN(IP_INNOROUTES)		\
79 	FN(IP_LOCAL_SOURCE)		\
80 	FN(IP_INVALID_SOURCE)		\
81 	FN(IP_LOCALNET)			\
82 	FN(IP_INVALID_DEST)		\
83 	FN(PKT_TOO_BIG)			\
84 	FN(DUP_FRAG)			\
85 	FN(FRAG_REASM_TIMEOUT)		\
86 	FN(FRAG_TOO_FAR)		\
87 	FN(TCP_MINTTL)			\
88 	FN(IPV6_BAD_EXTHDR)		\
89 	FN(IPV6_NDISC_FRAG)		\
90 	FN(IPV6_NDISC_HOP_LIMIT)	\
91 	FN(IPV6_NDISC_BAD_CODE)		\
92 	FN(IPV6_NDISC_BAD_OPTIONS)	\
93 	FN(IPV6_NDISC_NS_OTHERHOST)	\
94 	FN(QUEUE_PURGE)			\
95 	FN(TC_COOKIE_ERROR)		\
96 	FN(PACKET_SOCK_ERROR)		\
97 	FN(TC_CHAIN_NOTFOUND)		\
98 	FN(TC_RECLASSIFY_LOOP)		\
99 	FN(VXLAN_INVALID_HDR)		\
100 	FN(VXLAN_VNI_NOT_FOUND)		\
101 	FN(MAC_INVALID_SOURCE)		\
102 	FN(VXLAN_ENTRY_EXISTS)		\
103 	FN(VXLAN_NO_REMOTE)		\
104 	FN(IP_TUNNEL_ECN)		\
105 	FN(TUNNEL_TXINFO)		\
106 	FN(LOCAL_MAC)			\
107 	FN(ARP_PVLAN_DISABLE)		\
108 	FNe(MAX)
109 
110 /**
111  * enum skb_drop_reason - the reasons of skb drops
112  *
113  * The reason of skb drop, which is used in kfree_skb_reason().
114  */
115 enum skb_drop_reason {
116 	/**
117 	 * @SKB_NOT_DROPPED_YET: skb is not dropped yet (used for no-drop case)
118 	 */
119 	SKB_NOT_DROPPED_YET = 0,
120 	/** @SKB_CONSUMED: packet has been consumed */
121 	SKB_CONSUMED,
122 	/** @SKB_DROP_REASON_NOT_SPECIFIED: drop reason is not specified */
123 	SKB_DROP_REASON_NOT_SPECIFIED,
124 	/**
125 	 * @SKB_DROP_REASON_NO_SOCKET: no valid socket that can be used.
126 	 * Reason could be one of three cases:
127 	 * 1) no established/listening socket found during lookup process
128 	 * 2) no valid request socket during 3WHS process
129 	 * 3) no valid child socket during 3WHS process
130 	 */
131 	SKB_DROP_REASON_NO_SOCKET,
132 	/** @SKB_DROP_REASON_PKT_TOO_SMALL: packet size is too small */
133 	SKB_DROP_REASON_PKT_TOO_SMALL,
134 	/** @SKB_DROP_REASON_TCP_CSUM: TCP checksum error */
135 	SKB_DROP_REASON_TCP_CSUM,
136 	/** @SKB_DROP_REASON_SOCKET_FILTER: dropped by socket filter */
137 	SKB_DROP_REASON_SOCKET_FILTER,
138 	/** @SKB_DROP_REASON_UDP_CSUM: UDP checksum error */
139 	SKB_DROP_REASON_UDP_CSUM,
140 	/** @SKB_DROP_REASON_NETFILTER_DROP: dropped by netfilter */
141 	SKB_DROP_REASON_NETFILTER_DROP,
142 	/**
143 	 * @SKB_DROP_REASON_OTHERHOST: packet don't belong to current host
144 	 * (interface is in promisc mode)
145 	 */
146 	SKB_DROP_REASON_OTHERHOST,
147 	/** @SKB_DROP_REASON_IP_CSUM: IP checksum error */
148 	SKB_DROP_REASON_IP_CSUM,
149 	/**
150 	 * @SKB_DROP_REASON_IP_INHDR: there is something wrong with IP header (see
151 	 * IPSTATS_MIB_INHDRERRORS)
152 	 */
153 	SKB_DROP_REASON_IP_INHDR,
154 	/**
155 	 * @SKB_DROP_REASON_IP_RPFILTER: IP rpfilter validate failed. see the
156 	 * document for rp_filter in ip-sysctl.rst for more information
157 	 */
158 	SKB_DROP_REASON_IP_RPFILTER,
159 	/**
160 	 * @SKB_DROP_REASON_UNICAST_IN_L2_MULTICAST: destination address of L2 is
161 	 * multicast, but L3 is unicast.
162 	 */
163 	SKB_DROP_REASON_UNICAST_IN_L2_MULTICAST,
164 	/** @SKB_DROP_REASON_XFRM_POLICY: xfrm policy check failed */
165 	SKB_DROP_REASON_XFRM_POLICY,
166 	/** @SKB_DROP_REASON_IP_NOPROTO: no support for IP protocol */
167 	SKB_DROP_REASON_IP_NOPROTO,
168 	/** @SKB_DROP_REASON_SOCKET_RCVBUFF: socket receive buff is full */
169 	SKB_DROP_REASON_SOCKET_RCVBUFF,
170 	/**
171 	 * @SKB_DROP_REASON_PROTO_MEM: proto memory limitation, such as
172 	 * udp packet drop out of udp_memory_allocated.
173 	 */
174 	SKB_DROP_REASON_PROTO_MEM,
175 	/**
176 	 * @SKB_DROP_REASON_TCP_AUTH_HDR: TCP-MD5 or TCP-AO hashes are met
177 	 * twice or set incorrectly.
178 	 */
179 	SKB_DROP_REASON_TCP_AUTH_HDR,
180 	/**
181 	 * @SKB_DROP_REASON_TCP_MD5NOTFOUND: no MD5 hash and one expected,
182 	 * corresponding to LINUX_MIB_TCPMD5NOTFOUND
183 	 */
184 	SKB_DROP_REASON_TCP_MD5NOTFOUND,
185 	/**
186 	 * @SKB_DROP_REASON_TCP_MD5UNEXPECTED: MD5 hash and we're not expecting
187 	 * one, corresponding to LINUX_MIB_TCPMD5UNEXPECTED
188 	 */
189 	SKB_DROP_REASON_TCP_MD5UNEXPECTED,
190 	/**
191 	 * @SKB_DROP_REASON_TCP_MD5FAILURE: MD5 hash and its wrong, corresponding
192 	 * to LINUX_MIB_TCPMD5FAILURE
193 	 */
194 	SKB_DROP_REASON_TCP_MD5FAILURE,
195 	/**
196 	 * @SKB_DROP_REASON_TCP_AONOTFOUND: no TCP-AO hash and one was expected,
197 	 * corresponding to LINUX_MIB_TCPAOREQUIRED
198 	 */
199 	SKB_DROP_REASON_TCP_AONOTFOUND,
200 	/**
201 	 * @SKB_DROP_REASON_TCP_AOUNEXPECTED: TCP-AO hash is present and it
202 	 * was not expected, corresponding to LINUX_MIB_TCPAOKEYNOTFOUND
203 	 */
204 	SKB_DROP_REASON_TCP_AOUNEXPECTED,
205 	/**
206 	 * @SKB_DROP_REASON_TCP_AOKEYNOTFOUND: TCP-AO key is unknown,
207 	 * corresponding to LINUX_MIB_TCPAOKEYNOTFOUND
208 	 */
209 	SKB_DROP_REASON_TCP_AOKEYNOTFOUND,
210 	/**
211 	 * @SKB_DROP_REASON_TCP_AOFAILURE: TCP-AO hash is wrong,
212 	 * corresponding to LINUX_MIB_TCPAOBAD
213 	 */
214 	SKB_DROP_REASON_TCP_AOFAILURE,
215 	/**
216 	 * @SKB_DROP_REASON_SOCKET_BACKLOG: failed to add skb to socket backlog (
217 	 * see LINUX_MIB_TCPBACKLOGDROP)
218 	 */
219 	SKB_DROP_REASON_SOCKET_BACKLOG,
220 	/** @SKB_DROP_REASON_TCP_FLAGS: TCP flags invalid */
221 	SKB_DROP_REASON_TCP_FLAGS,
222 	/**
223 	 * @SKB_DROP_REASON_TCP_ABORT_ON_DATA: abort on data, corresponding to
224 	 * LINUX_MIB_TCPABORTONDATA
225 	 */
226 	SKB_DROP_REASON_TCP_ABORT_ON_DATA,
227 	/**
228 	 * @SKB_DROP_REASON_TCP_ZEROWINDOW: TCP receive window size is zero,
229 	 * see LINUX_MIB_TCPZEROWINDOWDROP
230 	 */
231 	SKB_DROP_REASON_TCP_ZEROWINDOW,
232 	/**
233 	 * @SKB_DROP_REASON_TCP_OLD_DATA: the TCP data received is already
234 	 * received before (spurious retrans may happened), see
235 	 * LINUX_MIB_DELAYEDACKLOST
236 	 */
237 	SKB_DROP_REASON_TCP_OLD_DATA,
238 	/**
239 	 * @SKB_DROP_REASON_TCP_OVERWINDOW: the TCP data is out of window,
240 	 * the seq of the first byte exceed the right edges of receive
241 	 * window
242 	 */
243 	SKB_DROP_REASON_TCP_OVERWINDOW,
244 	/**
245 	 * @SKB_DROP_REASON_TCP_OFOMERGE: the data of skb is already in the ofo
246 	 * queue, corresponding to LINUX_MIB_TCPOFOMERGE
247 	 */
248 	SKB_DROP_REASON_TCP_OFOMERGE,
249 	/**
250 	 * @SKB_DROP_REASON_TCP_RFC7323_PAWS: PAWS check, corresponding to
251 	 * LINUX_MIB_PAWSESTABREJECTED, LINUX_MIB_PAWSACTIVEREJECTED
252 	 */
253 	SKB_DROP_REASON_TCP_RFC7323_PAWS,
254 	/** @SKB_DROP_REASON_TCP_OLD_SEQUENCE: Old SEQ field (duplicate packet) */
255 	SKB_DROP_REASON_TCP_OLD_SEQUENCE,
256 	/** @SKB_DROP_REASON_TCP_INVALID_SEQUENCE: Not acceptable SEQ field */
257 	SKB_DROP_REASON_TCP_INVALID_SEQUENCE,
258 	/**
259 	 * @SKB_DROP_REASON_TCP_INVALID_ACK_SEQUENCE: Not acceptable ACK SEQ
260 	 * field because ack sequence is not in the window between snd_una
261 	 * and snd_nxt
262 	 */
263 	SKB_DROP_REASON_TCP_INVALID_ACK_SEQUENCE,
264 	/** @SKB_DROP_REASON_TCP_RESET: Invalid RST packet */
265 	SKB_DROP_REASON_TCP_RESET,
266 	/**
267 	 * @SKB_DROP_REASON_TCP_INVALID_SYN: Incoming packet has unexpected
268 	 * SYN flag
269 	 */
270 	SKB_DROP_REASON_TCP_INVALID_SYN,
271 	/** @SKB_DROP_REASON_TCP_CLOSE: TCP socket in CLOSE state */
272 	SKB_DROP_REASON_TCP_CLOSE,
273 	/** @SKB_DROP_REASON_TCP_FASTOPEN: dropped by FASTOPEN request socket */
274 	SKB_DROP_REASON_TCP_FASTOPEN,
275 	/** @SKB_DROP_REASON_TCP_OLD_ACK: TCP ACK is old, but in window */
276 	SKB_DROP_REASON_TCP_OLD_ACK,
277 	/** @SKB_DROP_REASON_TCP_TOO_OLD_ACK: TCP ACK is too old */
278 	SKB_DROP_REASON_TCP_TOO_OLD_ACK,
279 	/**
280 	 * @SKB_DROP_REASON_TCP_ACK_UNSENT_DATA: TCP ACK for data we haven't
281 	 * sent yet
282 	 */
283 	SKB_DROP_REASON_TCP_ACK_UNSENT_DATA,
284 	/** @SKB_DROP_REASON_TCP_OFO_QUEUE_PRUNE: pruned from TCP OFO queue */
285 	SKB_DROP_REASON_TCP_OFO_QUEUE_PRUNE,
286 	/** @SKB_DROP_REASON_TCP_OFO_DROP: data already in receive queue */
287 	SKB_DROP_REASON_TCP_OFO_DROP,
288 	/** @SKB_DROP_REASON_IP_OUTNOROUTES: route lookup failed */
289 	SKB_DROP_REASON_IP_OUTNOROUTES,
290 	/**
291 	 * @SKB_DROP_REASON_BPF_CGROUP_EGRESS: dropped by BPF_PROG_TYPE_CGROUP_SKB
292 	 * eBPF program
293 	 */
294 	SKB_DROP_REASON_BPF_CGROUP_EGRESS,
295 	/** @SKB_DROP_REASON_IPV6DISABLED: IPv6 is disabled on the device */
296 	SKB_DROP_REASON_IPV6DISABLED,
297 	/** @SKB_DROP_REASON_NEIGH_CREATEFAIL: failed to create neigh entry */
298 	SKB_DROP_REASON_NEIGH_CREATEFAIL,
299 	/** @SKB_DROP_REASON_NEIGH_FAILED: neigh entry in failed state */
300 	SKB_DROP_REASON_NEIGH_FAILED,
301 	/** @SKB_DROP_REASON_NEIGH_QUEUEFULL: arp_queue for neigh entry is full */
302 	SKB_DROP_REASON_NEIGH_QUEUEFULL,
303 	/** @SKB_DROP_REASON_NEIGH_DEAD: neigh entry is dead */
304 	SKB_DROP_REASON_NEIGH_DEAD,
305 	/** @SKB_DROP_REASON_TC_EGRESS: dropped in TC egress HOOK */
306 	SKB_DROP_REASON_TC_EGRESS,
307 	/** @SKB_DROP_REASON_SECURITY_HOOK: dropped due to security HOOK */
308 	SKB_DROP_REASON_SECURITY_HOOK,
309 	/**
310 	 * @SKB_DROP_REASON_QDISC_DROP: dropped by qdisc when packet outputting (
311 	 * failed to enqueue to current qdisc)
312 	 */
313 	SKB_DROP_REASON_QDISC_DROP,
314 	/**
315 	 * @SKB_DROP_REASON_CPU_BACKLOG: failed to enqueue the skb to the per CPU
316 	 * backlog queue. This can be caused by backlog queue full (see
317 	 * netdev_max_backlog in net.rst) or RPS flow limit
318 	 */
319 	SKB_DROP_REASON_CPU_BACKLOG,
320 	/** @SKB_DROP_REASON_XDP: dropped by XDP in input path */
321 	SKB_DROP_REASON_XDP,
322 	/** @SKB_DROP_REASON_TC_INGRESS: dropped in TC ingress HOOK */
323 	SKB_DROP_REASON_TC_INGRESS,
324 	/** @SKB_DROP_REASON_UNHANDLED_PROTO: protocol not implemented or not supported */
325 	SKB_DROP_REASON_UNHANDLED_PROTO,
326 	/** @SKB_DROP_REASON_SKB_CSUM: sk_buff checksum computation error */
327 	SKB_DROP_REASON_SKB_CSUM,
328 	/** @SKB_DROP_REASON_SKB_GSO_SEG: gso segmentation error */
329 	SKB_DROP_REASON_SKB_GSO_SEG,
330 	/**
331 	 * @SKB_DROP_REASON_SKB_UCOPY_FAULT: failed to copy data from user space,
332 	 * e.g., via zerocopy_sg_from_iter() or skb_orphan_frags_rx()
333 	 */
334 	SKB_DROP_REASON_SKB_UCOPY_FAULT,
335 	/** @SKB_DROP_REASON_DEV_HDR: device driver specific header/metadata is invalid */
336 	SKB_DROP_REASON_DEV_HDR,
337 	/**
338 	 * @SKB_DROP_REASON_DEV_READY: the device is not ready to xmit/recv due to
339 	 * any of its data structure that is not up/ready/initialized,
340 	 * e.g., the IFF_UP is not set, or driver specific tun->tfiles[txq]
341 	 * is not initialized
342 	 */
343 	SKB_DROP_REASON_DEV_READY,
344 	/** @SKB_DROP_REASON_FULL_RING: ring buffer is full */
345 	SKB_DROP_REASON_FULL_RING,
346 	/** @SKB_DROP_REASON_NOMEM: error due to OOM */
347 	SKB_DROP_REASON_NOMEM,
348 	/**
349 	 * @SKB_DROP_REASON_HDR_TRUNC: failed to trunc/extract the header from
350 	 * networking data, e.g., failed to pull the protocol header from
351 	 * frags via pskb_may_pull()
352 	 */
353 	SKB_DROP_REASON_HDR_TRUNC,
354 	/**
355 	 * @SKB_DROP_REASON_TAP_FILTER: dropped by (ebpf) filter directly attached
356 	 * to tun/tap, e.g., via TUNSETFILTEREBPF
357 	 */
358 	SKB_DROP_REASON_TAP_FILTER,
359 	/**
360 	 * @SKB_DROP_REASON_TAP_TXFILTER: dropped by tx filter implemented at
361 	 * tun/tap, e.g., check_filter()
362 	 */
363 	SKB_DROP_REASON_TAP_TXFILTER,
364 	/** @SKB_DROP_REASON_ICMP_CSUM: ICMP checksum error */
365 	SKB_DROP_REASON_ICMP_CSUM,
366 	/**
367 	 * @SKB_DROP_REASON_INVALID_PROTO: the packet doesn't follow RFC 2211,
368 	 * such as a broadcasts ICMP_TIMESTAMP
369 	 */
370 	SKB_DROP_REASON_INVALID_PROTO,
371 	/**
372 	 * @SKB_DROP_REASON_IP_INADDRERRORS: host unreachable, corresponding to
373 	 * IPSTATS_MIB_INADDRERRORS
374 	 */
375 	SKB_DROP_REASON_IP_INADDRERRORS,
376 	/**
377 	 * @SKB_DROP_REASON_IP_INNOROUTES: network unreachable, corresponding to
378 	 * IPSTATS_MIB_INADDRERRORS
379 	 */
380 	SKB_DROP_REASON_IP_INNOROUTES,
381 	/** @SKB_DROP_REASON_IP_LOCAL_SOURCE: the source ip is local */
382 	SKB_DROP_REASON_IP_LOCAL_SOURCE,
383 	/**
384 	 * @SKB_DROP_REASON_IP_INVALID_SOURCE: the source ip is invalid:
385 	 * 1) source ip is multicast or limited broadcast
386 	 * 2) source ip is zero and not IGMP
387 	 */
388 	SKB_DROP_REASON_IP_INVALID_SOURCE,
389 	/** @SKB_DROP_REASON_IP_LOCALNET: source or dest ip is local net */
390 	SKB_DROP_REASON_IP_LOCALNET,
391 	/**
392 	 * @SKB_DROP_REASON_IP_INVALID_DEST: the dest ip is invalid:
393 	 * 1) dest ip is 0
394 	 */
395 	SKB_DROP_REASON_IP_INVALID_DEST,
396 	/**
397 	 * @SKB_DROP_REASON_PKT_TOO_BIG: packet size is too big (maybe exceed the
398 	 * MTU)
399 	 */
400 	SKB_DROP_REASON_PKT_TOO_BIG,
401 	/** @SKB_DROP_REASON_DUP_FRAG: duplicate fragment */
402 	SKB_DROP_REASON_DUP_FRAG,
403 	/** @SKB_DROP_REASON_FRAG_REASM_TIMEOUT: fragment reassembly timeout */
404 	SKB_DROP_REASON_FRAG_REASM_TIMEOUT,
405 	/**
406 	 * @SKB_DROP_REASON_FRAG_TOO_FAR: ipv4 fragment too far.
407 	 * (/proc/sys/net/ipv4/ipfrag_max_dist)
408 	 */
409 	SKB_DROP_REASON_FRAG_TOO_FAR,
410 	/**
411 	 * @SKB_DROP_REASON_TCP_MINTTL: ipv4 ttl or ipv6 hoplimit below
412 	 * the threshold (IP_MINTTL or IPV6_MINHOPCOUNT).
413 	 */
414 	SKB_DROP_REASON_TCP_MINTTL,
415 	/** @SKB_DROP_REASON_IPV6_BAD_EXTHDR: Bad IPv6 extension header. */
416 	SKB_DROP_REASON_IPV6_BAD_EXTHDR,
417 	/** @SKB_DROP_REASON_IPV6_NDISC_FRAG: invalid frag (suppress_frag_ndisc). */
418 	SKB_DROP_REASON_IPV6_NDISC_FRAG,
419 	/** @SKB_DROP_REASON_IPV6_NDISC_HOP_LIMIT: invalid hop limit. */
420 	SKB_DROP_REASON_IPV6_NDISC_HOP_LIMIT,
421 	/** @SKB_DROP_REASON_IPV6_NDISC_BAD_CODE: invalid NDISC icmp6 code. */
422 	SKB_DROP_REASON_IPV6_NDISC_BAD_CODE,
423 	/** @SKB_DROP_REASON_IPV6_NDISC_BAD_OPTIONS: invalid NDISC options. */
424 	SKB_DROP_REASON_IPV6_NDISC_BAD_OPTIONS,
425 	/**
426 	 * @SKB_DROP_REASON_IPV6_NDISC_NS_OTHERHOST: NEIGHBOUR SOLICITATION
427 	 * for another host.
428 	 */
429 	SKB_DROP_REASON_IPV6_NDISC_NS_OTHERHOST,
430 	/** @SKB_DROP_REASON_QUEUE_PURGE: bulk free. */
431 	SKB_DROP_REASON_QUEUE_PURGE,
432 	/**
433 	 * @SKB_DROP_REASON_TC_COOKIE_ERROR: An error occurred whilst
434 	 * processing a tc ext cookie.
435 	 */
436 	SKB_DROP_REASON_TC_COOKIE_ERROR,
437 	/**
438 	 * @SKB_DROP_REASON_PACKET_SOCK_ERROR: generic packet socket errors
439 	 * after its filter matches an incoming packet.
440 	 */
441 	SKB_DROP_REASON_PACKET_SOCK_ERROR,
442 	/** @SKB_DROP_REASON_TC_CHAIN_NOTFOUND: tc chain lookup failed. */
443 	SKB_DROP_REASON_TC_CHAIN_NOTFOUND,
444 	/**
445 	 * @SKB_DROP_REASON_TC_RECLASSIFY_LOOP: tc exceeded max reclassify loop
446 	 * iterations.
447 	 */
448 	SKB_DROP_REASON_TC_RECLASSIFY_LOOP,
449 	/**
450 	 * @SKB_DROP_REASON_VXLAN_INVALID_HDR: VXLAN header is invalid. E.g.:
451 	 * 1) reserved fields are not zero
452 	 * 2) "I" flag is not set
453 	 */
454 	SKB_DROP_REASON_VXLAN_INVALID_HDR,
455 	/** @SKB_DROP_REASON_VXLAN_VNI_NOT_FOUND: no VXLAN device found for VNI */
456 	SKB_DROP_REASON_VXLAN_VNI_NOT_FOUND,
457 	/** @SKB_DROP_REASON_MAC_INVALID_SOURCE: source mac is invalid */
458 	SKB_DROP_REASON_MAC_INVALID_SOURCE,
459 	/**
460 	 * @SKB_DROP_REASON_VXLAN_ENTRY_EXISTS: trying to migrate a static
461 	 * entry or an entry pointing to a nexthop.
462 	 */
463 	SKB_DROP_REASON_VXLAN_ENTRY_EXISTS,
464 	/** @SKB_DROP_REASON_VXLAN_NO_REMOTE: no remote found for xmit */
465 	SKB_DROP_REASON_VXLAN_NO_REMOTE,
466 	/**
467 	 * @SKB_DROP_REASON_IP_TUNNEL_ECN: skb is dropped according to
468 	 * RFC 6040 4.2, see __INET_ECN_decapsulate() for detail.
469 	 */
470 	SKB_DROP_REASON_IP_TUNNEL_ECN,
471 	/**
472 	 * @SKB_DROP_REASON_TUNNEL_TXINFO: packet without necessary metadata
473 	 * reached a device which is in "external" mode.
474 	 */
475 	SKB_DROP_REASON_TUNNEL_TXINFO,
476 	/**
477 	 * @SKB_DROP_REASON_LOCAL_MAC: the source MAC address is equal to
478 	 * the MAC address of the local netdev.
479 	 */
480 	SKB_DROP_REASON_LOCAL_MAC,
481 	/**
482 	 * @SKB_DROP_REASON_ARP_PVLAN_DISABLE: packet which is not IP is
483 	 * forwarded to the in_dev, and the proxy_arp_pvlan is not
484 	 * enabled.
485 	 */
486 	SKB_DROP_REASON_ARP_PVLAN_DISABLE,
487 	/**
488 	 * @SKB_DROP_REASON_MAX: the maximum of core drop reasons, which
489 	 * shouldn't be used as a real 'reason' - only for tracing code gen
490 	 */
491 	SKB_DROP_REASON_MAX,
492 
493 	/**
494 	 * @SKB_DROP_REASON_SUBSYS_MASK: subsystem mask in drop reasons,
495 	 * see &enum skb_drop_reason_subsys
496 	 */
497 	SKB_DROP_REASON_SUBSYS_MASK = 0xffff0000,
498 };
499 
500 #define SKB_DROP_REASON_SUBSYS_SHIFT	16
501 
502 #define SKB_DR_INIT(name, reason)				\
503 	enum skb_drop_reason name = SKB_DROP_REASON_##reason
504 #define SKB_DR(name)						\
505 	SKB_DR_INIT(name, NOT_SPECIFIED)
506 #define SKB_DR_SET(name, reason)				\
507 	(name = SKB_DROP_REASON_##reason)
508 #define SKB_DR_OR(name, reason)					\
509 	do {							\
510 		if (name == SKB_DROP_REASON_NOT_SPECIFIED ||	\
511 		    name == SKB_NOT_DROPPED_YET)		\
512 			SKB_DR_SET(name, reason);		\
513 	} while (0)
514 
515 #endif
516