1 /* 2 * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for 5 * any purpose with or without fee is hereby granted, provided that the 6 * above copyright notice and this permission notice appear in all 7 * copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 16 * PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19 /** 20 * @file cdp_txrx_mon_struct.h 21 * @brief Define the monitor mode API structure 22 * shared by data path and the OS interface module 23 */ 24 25 #ifndef _CDP_TXRX_MON_STRUCT_H_ 26 #define _CDP_TXRX_MON_STRUCT_H_ 27 /* XXX not really a mode; there are really multiple PHY's */ 28 enum cdp_mon_phymode { 29 /* autoselect */ 30 CDP_IEEE80211_MODE_AUTO = 0, 31 /* 5GHz, OFDM */ 32 CDP_IEEE80211_MODE_11A = 1, 33 /* 2GHz, CCK */ 34 CDP_IEEE80211_MODE_11B = 2, 35 /* 2GHz, OFDM */ 36 CDP_IEEE80211_MODE_11G = 3, 37 /* 2GHz, GFSK */ 38 CDP_IEEE80211_MODE_FH = 4, 39 /* 5GHz, OFDM, 2x clock dynamic turbo */ 40 CDP_IEEE80211_MODE_TURBO_A = 5, 41 /* 2GHz, OFDM, 2x clock dynamic turbo */ 42 CDP_IEEE80211_MODE_TURBO_G = 6, 43 /* 5Ghz, HT20 */ 44 CDP_IEEE80211_MODE_11NA_HT20 = 7, 45 /* 2Ghz, HT20 */ 46 CDP_IEEE80211_MODE_11NG_HT20 = 8, 47 /* 5Ghz, HT40 (ext ch +1) */ 48 CDP_IEEE80211_MODE_11NA_HT40PLUS = 9, 49 /* 5Ghz, HT40 (ext ch -1) */ 50 CDP_IEEE80211_MODE_11NA_HT40MINUS = 10, 51 /* 2Ghz, HT40 (ext ch +1) */ 52 CDP_IEEE80211_MODE_11NG_HT40PLUS = 11, 53 /* 2Ghz, HT40 (ext ch -1) */ 54 CDP_IEEE80211_MODE_11NG_HT40MINUS = 12, 55 /* 2Ghz, Auto HT40 */ 56 CDP_IEEE80211_MODE_11NG_HT40 = 13, 57 /* 5Ghz, Auto HT40 */ 58 CDP_IEEE80211_MODE_11NA_HT40 = 14, 59 /* 5Ghz, VHT20 */ 60 CDP_IEEE80211_MODE_11AC_VHT20 = 15, 61 /* 5Ghz, VHT40 (Ext ch +1) */ 62 CDP_IEEE80211_MODE_11AC_VHT40PLUS = 16, 63 /* 5Ghz VHT40 (Ext ch -1) */ 64 CDP_IEEE80211_MODE_11AC_VHT40MINUS = 17, 65 /* 5Ghz, VHT40 */ 66 CDP_IEEE80211_MODE_11AC_VHT40 = 18, 67 /* 5Ghz, VHT80 */ 68 CDP_IEEE80211_MODE_11AC_VHT80 = 19, 69 /* 5Ghz, VHT160 */ 70 CDP_IEEE80211_MODE_11AC_VHT160 = 20, 71 /* 5Ghz, VHT80_80 */ 72 CDP_IEEE80211_MODE_11AC_VHT80_80 = 21, 73 }; 74 75 enum { 76 CDP_PKT_TYPE_OFDM = 0, 77 CDP_PKT_TYPE_CCK, 78 CDP_PKT_TYPE_HT, 79 CDP_PKT_TYPE_VHT, 80 CDP_PKT_TYPE_HE, 81 }; 82 83 enum { 84 CDP_SGI_0_8_US = 0, 85 CDP_SGI_0_4_US, 86 CDP_SGI_1_6_US, 87 CDP_SGI_3_2_US, 88 }; 89 90 enum { 91 CDP_RX_TYPE_SU = 0, 92 CDP_RX_TYPE_MU_MIMO, 93 CDP_RX_TYPE_MU_OFDMA, 94 CDP_RX_TYPE_MU_OFDMA_MIMO, 95 }; 96 97 enum { 98 CDP_FULL_RX_BW_20 = 0, 99 CDP_FULL_RX_BW_40, 100 CDP_FULL_RX_BW_80, 101 CDP_FULL_RX_BW_160, 102 }; 103 104 struct cdp_mon_status { 105 int rs_numchains; 106 int rs_flags; 107 #define IEEE80211_RX_FCS_ERROR 0x01 108 #define IEEE80211_RX_MIC_ERROR 0x02 109 #define IEEE80211_RX_DECRYPT_ERROR 0x04 110 /* holes in flags here between, ATH_RX_XXXX to IEEE80211_RX_XXX */ 111 #define IEEE80211_RX_KEYMISS 0x200 112 int rs_rssi; /* RSSI (noise floor ajusted) */ 113 int rs_abs_rssi; /* absolute RSSI */ 114 int rs_datarate; /* data rate received */ 115 int rs_rateieee; 116 int rs_ratephy1; 117 int rs_ratephy2; 118 int rs_ratephy3; 119 120 /* Keep the same as ATH_MAX_ANTENNA */ 121 #define IEEE80211_MAX_ANTENNA 3 122 /* RSSI (noise floor ajusted) */ 123 u_int8_t rs_rssictl[IEEE80211_MAX_ANTENNA]; 124 /* RSSI (noise floor ajusted) */ 125 u_int8_t rs_rssiextn[IEEE80211_MAX_ANTENNA]; 126 /* rs_rssi is valid or not */ 127 u_int8_t rs_isvalidrssi; 128 129 enum cdp_mon_phymode rs_phymode; 130 int rs_freq; 131 132 union { 133 u_int8_t data[8]; 134 u_int64_t tsf; 135 } rs_tstamp; 136 137 /* 138 * Detail channel structure of recv frame. 139 * It could be NULL if not available 140 */ 141 142 143 #ifdef ATH_SUPPORT_AOW 144 u_int16_t rs_rxseq; /* WLAN Sequence number */ 145 #endif 146 #ifdef ATH_VOW_EXT_STATS 147 /* Lower 16 bits holds the udp checksum offset in the data pkt */ 148 u_int32_t vow_extstats_offset; 149 /* Higher 16 bits contains offset in the data pkt at which vow 150 * ext stats are embedded 151 */ 152 #endif 153 u_int8_t rs_isaggr; 154 u_int8_t rs_isapsd; 155 int16_t rs_noisefloor; 156 u_int16_t rs_channel; 157 #ifdef ATH_SUPPORT_TxBF 158 u_int32_t rs_rpttstamp; /* txbf report time stamp*/ 159 #endif 160 161 /* The following counts are meant to assist in stats calculation. 162 * These variables are incremented only in specific situations, and 163 * should not be relied upon for any purpose other than the original 164 * stats related purpose they have been introduced for. 165 */ 166 167 u_int16_t rs_cryptodecapcount; /* Crypto bytes decapped/demic'ed. */ 168 u_int8_t rs_padspace; /* No. of padding bytes present after 169 header in wbuf. */ 170 u_int8_t rs_qosdecapcount; /* QoS/HTC bytes decapped. */ 171 172 /* End of stats calculation related counts. */ 173 174 /* 175 * uint8_t rs_lsig[IEEE80211_LSIG_LEN]; 176 * uint8_t rs_htsig[IEEE80211_HTSIG_LEN]; 177 * uint8_t rs_servicebytes[IEEE80211_SB_LEN]; 178 * uint8_t rs_fcs_error; 179 */ 180 181 /* cdp convergence monitor mode status */ 182 union { 183 u_int8_t cdp_data[8]; 184 u_int64_t cdp_tsf; 185 } cdp_rs_tstamp; 186 187 uint8_t cdp_rs_pream_type; 188 uint32_t cdp_rs_user_rssi; 189 uint8_t cdp_rs_stbc; 190 uint8_t cdp_rs_sgi; 191 uint32_t cdf_rs_rate_mcs; 192 uint32_t cdp_rs_reception_type; 193 uint32_t cdp_rs_bw; 194 uint32_t cdp_rs_nss; 195 uint8_t cdp_rs_fcs_err; 196 197 }; 198 199 enum { 200 CDP_MON_PPDU_START = 0, 201 CDP_MON_PPDU_END, 202 }; 203 204 #define MAX_PPDU_ID_HIST 128 205 206 /** 207 * struct cdp_pdev_mon_stats 208 * @status_ppdu_state: state on PPDU start and end 209 * @status_ppdu_start: status ring PPDU start TLV count 210 * @status_ppdu_end: status ring PPDU end TLV count 211 * @status_ppdu_compl: status ring matching start and end count on PPDU 212 * @status_ppdu_start_mis: status ring missing start TLV count on PPDU 213 * @status_ppdu_end_mis: status ring missing end TLV count on PPDU 214 * @status_ppdu_done: status ring PPDU done TLV count 215 * @dest_ppdu_done: destination ring PPDU count 216 * @dest_mpdu_done: destination ring MPDU count 217 * @dup_mon_linkdesc_cnt: duplicate link descriptor indications from HW 218 * @dup_mon_buf_cnt: duplicate buffer indications from HW 219 * @tlv_tag_status_err: status not correct in the tlv tag 220 */ 221 struct cdp_pdev_mon_stats { 222 #ifndef REMOVE_MON_DBG_STATS 223 uint32_t status_ppdu_state; 224 uint32_t status_ppdu_start; 225 uint32_t status_ppdu_end; 226 uint32_t status_ppdu_compl; 227 uint32_t status_ppdu_start_mis; 228 uint32_t status_ppdu_end_mis; 229 #endif 230 uint32_t status_ppdu_done; 231 uint32_t dest_ppdu_done; 232 uint32_t dest_mpdu_done; 233 uint32_t dest_mpdu_drop; 234 uint32_t dup_mon_linkdesc_cnt; 235 uint32_t dup_mon_buf_cnt; 236 uint32_t stat_ring_ppdu_id_hist[MAX_PPDU_ID_HIST]; 237 uint32_t dest_ring_ppdu_id_hist[MAX_PPDU_ID_HIST]; 238 uint32_t ppdu_id_hist_idx; 239 uint32_t mon_rx_dest_stuck; 240 uint32_t tlv_tag_status_err; 241 }; 242 #endif 243