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 /* 0x00 == ___RX_DROP_UNUSABLE */ \ 22 R(RX_DROP_U_MIC_FAIL) \ 23 R(RX_DROP_U_REPLAY) \ 24 R(RX_DROP_U_BAD_MMIE) \ 25 R(RX_DROP_U_DUP) \ 26 R(RX_DROP_U_SPURIOUS) \ 27 R(RX_DROP_U_DECRYPT_FAIL) \ 28 R(RX_DROP_U_NO_KEY_ID) \ 29 R(RX_DROP_U_BAD_CIPHER) \ 30 R(RX_DROP_U_OOM) \ 31 R(RX_DROP_U_NONSEQ_PN) \ 32 R(RX_DROP_U_BAD_KEY_COLOR) \ 33 R(RX_DROP_U_BAD_4ADDR) \ 34 R(RX_DROP_U_BAD_AMSDU) \ 35 R(RX_DROP_U_BAD_AMSDU_CIPHER) \ 36 R(RX_DROP_U_INVALID_8023) \ 37 /* 0x10 */ \ 38 R(RX_DROP_U_RUNT_ACTION) \ 39 R(RX_DROP_U_UNPROT_ACTION) \ 40 R(RX_DROP_U_UNPROT_DUAL) \ 41 R(RX_DROP_U_UNPROT_UCAST_MGMT) \ 42 R(RX_DROP_U_UNPROT_MCAST_MGMT) \ 43 R(RX_DROP_U_UNPROT_BEACON) \ 44 R(RX_DROP_U_UNPROT_UNICAST_PUB_ACTION) \ 45 R(RX_DROP_U_UNPROT_ROBUST_ACTION) \ 46 R(RX_DROP_U_ACTION_UNKNOWN_SRC) \ 47 R(RX_DROP_U_REJECTED_ACTION_RESPONSE) \ 48 R(RX_DROP_U_EXPECT_DEFRAG_PROT) \ 49 R(RX_DROP_U_WEP_DEC_FAIL) \ 50 R(RX_DROP_U_NO_IV) \ 51 R(RX_DROP_U_NO_ICV) \ 52 R(RX_DROP_U_AP_RX_GROUPCAST) \ 53 R(RX_DROP_U_SHORT_MMIC) \ 54 /* 0x20 */ \ 55 R(RX_DROP_U_MMIC_FAIL) \ 56 R(RX_DROP_U_SHORT_TKIP) \ 57 R(RX_DROP_U_TKIP_FAIL) \ 58 R(RX_DROP_U_SHORT_CCMP) \ 59 R(RX_DROP_U_SHORT_CCMP_MIC) \ 60 R(RX_DROP_U_SHORT_GCMP) \ 61 R(RX_DROP_U_SHORT_GCMP_MIC) \ 62 R(RX_DROP_U_SHORT_CMAC) \ 63 R(RX_DROP_U_SHORT_CMAC256) \ 64 R(RX_DROP_U_SHORT_GMAC) \ 65 R(RX_DROP_U_UNEXPECTED_VLAN_4ADDR) \ 66 R(RX_DROP_U_UNEXPECTED_STA_4ADDR) \ 67 R(RX_DROP_U_UNEXPECTED_VLAN_MCAST) \ 68 R(RX_DROP_U_NOT_PORT_CONTROL) \ 69 /* this line for the trailing \ - add before this */ 70 71 /* having two enums allows for checking ieee80211_rx_result use with sparse */ 72 enum ___mac80211_drop_reason { 73 /* if we get to the end of handlers with RX_CONTINUE this will be the reason */ 74 ___RX_CONTINUE = SKB_CONSUMED, 75 76 /* this never gets used as an argument to kfree_skb_reason() */ 77 ___RX_QUEUED = SKB_NOT_DROPPED_YET, 78 79 #define ENUM(x) ___ ## x, 80 ___RX_DROP_MONITOR = SKB_DROP_REASON_SUBSYS_MAC80211_MONITOR << 81 SKB_DROP_REASON_SUBSYS_SHIFT, 82 MAC80211_DROP_REASONS_MONITOR(ENUM) 83 84 ___RX_DROP_UNUSABLE = SKB_DROP_REASON_SUBSYS_MAC80211_UNUSABLE << 85 SKB_DROP_REASON_SUBSYS_SHIFT, 86 MAC80211_DROP_REASONS_UNUSABLE(ENUM) 87 #undef ENUM 88 }; 89 90 enum mac80211_drop_reason { 91 RX_CONTINUE = (__force ieee80211_rx_result)___RX_CONTINUE, 92 RX_QUEUED = (__force ieee80211_rx_result)___RX_QUEUED, 93 RX_DROP_MONITOR = (__force ieee80211_rx_result)___RX_DROP_MONITOR, 94 #define DEF(x) x = (__force ieee80211_rx_result)___ ## x, 95 MAC80211_DROP_REASONS_MONITOR(DEF) 96 MAC80211_DROP_REASONS_UNUSABLE(DEF) 97 #undef DEF 98 }; 99 100 #define RX_RES_IS_UNUSABLE(result) \ 101 (((__force u32)(result) & SKB_DROP_REASON_SUBSYS_MASK) == ___RX_DROP_UNUSABLE) 102 103 #endif /* MAC80211_DROP_H */ 104