xref: /linux/include/net/dropreason.h (revision 071c0fc6)
1*071c0fc6SJohannes Berg /* SPDX-License-Identifier: GPL-2.0-or-later */
2*071c0fc6SJohannes Berg 
3*071c0fc6SJohannes Berg #ifndef _LINUX_DROPREASON_H
4*071c0fc6SJohannes Berg #define _LINUX_DROPREASON_H
5*071c0fc6SJohannes Berg #include <net/dropreason-core.h>
6*071c0fc6SJohannes Berg 
7*071c0fc6SJohannes Berg /**
8*071c0fc6SJohannes Berg  * enum skb_drop_reason_subsys - subsystem tag for (extended) drop reasons
9*071c0fc6SJohannes Berg  */
10*071c0fc6SJohannes Berg enum skb_drop_reason_subsys {
11*071c0fc6SJohannes Berg 	/** @SKB_DROP_REASON_SUBSYS_CORE: core drop reasons defined above */
12*071c0fc6SJohannes Berg 	SKB_DROP_REASON_SUBSYS_CORE,
13*071c0fc6SJohannes Berg 
14*071c0fc6SJohannes Berg 	/** @SKB_DROP_REASON_SUBSYS_NUM: number of subsystems defined */
15*071c0fc6SJohannes Berg 	SKB_DROP_REASON_SUBSYS_NUM
16*071c0fc6SJohannes Berg };
17*071c0fc6SJohannes Berg 
18*071c0fc6SJohannes Berg struct drop_reason_list {
19*071c0fc6SJohannes Berg 	const char * const *reasons;
20*071c0fc6SJohannes Berg 	size_t n_reasons;
21*071c0fc6SJohannes Berg };
22*071c0fc6SJohannes Berg 
23*071c0fc6SJohannes Berg /* Note: due to dynamic registrations, access must be under RCU */
24*071c0fc6SJohannes Berg extern const struct drop_reason_list __rcu *
25*071c0fc6SJohannes Berg drop_reasons_by_subsys[SKB_DROP_REASON_SUBSYS_NUM];
26*071c0fc6SJohannes Berg 
27*071c0fc6SJohannes Berg void drop_reasons_register_subsys(enum skb_drop_reason_subsys subsys,
28*071c0fc6SJohannes Berg 				  const struct drop_reason_list *list);
29*071c0fc6SJohannes Berg void drop_reasons_unregister_subsys(enum skb_drop_reason_subsys subsys);
30*071c0fc6SJohannes Berg 
31*071c0fc6SJohannes Berg #endif
32