Merge tag '6.4-rc-ksmbd-server-fixes' of git://git.samba.org/ksmbd
[platform/kernel/linux-starfive.git] / net / mac80211 / drop.h
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * mac80211 drop reason list
4  *
5  * Copyright (C) 2023 Intel Corporation
6  */
7
8 #ifndef MAC80211_DROP_H
9 #define MAC80211_DROP_H
10 #include <net/dropreason.h>
11
12 typedef unsigned int __bitwise ieee80211_rx_result;
13
14 #define MAC80211_DROP_REASONS_MONITOR(R)        \
15         R(RX_DROP_M_UNEXPECTED_4ADDR_FRAME)     \
16         R(RX_DROP_M_BAD_BCN_KEYIDX)             \
17         R(RX_DROP_M_BAD_MGMT_KEYIDX)            \
18 /* this line for the trailing \ - add before this */
19
20 #define MAC80211_DROP_REASONS_UNUSABLE(R)       \
21         R(RX_DROP_U_MIC_FAIL)                   \
22         R(RX_DROP_U_REPLAY)                     \
23         R(RX_DROP_U_BAD_MMIE)                   \
24 /* this line for the trailing \ - add before this */
25
26 /* having two enums allows for checking ieee80211_rx_result use with sparse */
27 enum ___mac80211_drop_reason {
28 /* if we get to the end of handlers with RX_CONTINUE this will be the reason */
29         ___RX_CONTINUE  = SKB_CONSUMED,
30
31 /* this never gets used as an argument to kfree_skb_reason() */
32         ___RX_QUEUED    = SKB_NOT_DROPPED_YET,
33
34 #define ENUM(x) ___ ## x,
35         ___RX_DROP_MONITOR = SKB_DROP_REASON_SUBSYS_MAC80211_MONITOR <<
36                 SKB_DROP_REASON_SUBSYS_SHIFT,
37         MAC80211_DROP_REASONS_MONITOR(ENUM)
38
39         ___RX_DROP_UNUSABLE = SKB_DROP_REASON_SUBSYS_MAC80211_UNUSABLE <<
40                 SKB_DROP_REASON_SUBSYS_SHIFT,
41         MAC80211_DROP_REASONS_UNUSABLE(ENUM)
42 #undef ENUM
43 };
44
45 enum mac80211_drop_reason {
46         RX_CONTINUE      = (__force ieee80211_rx_result)___RX_CONTINUE,
47         RX_QUEUED        = (__force ieee80211_rx_result)___RX_QUEUED,
48         RX_DROP_MONITOR  = (__force ieee80211_rx_result)___RX_DROP_MONITOR,
49         RX_DROP_UNUSABLE = (__force ieee80211_rx_result)___RX_DROP_UNUSABLE,
50 #define DEF(x) x = (__force ieee80211_rx_result)___ ## x,
51         MAC80211_DROP_REASONS_MONITOR(DEF)
52         MAC80211_DROP_REASONS_UNUSABLE(DEF)
53 #undef DEF
54 };
55
56 #endif /* MAC80211_DROP_H */