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