1 /****************************************************************************** 2 * 3 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. 4 * 5 * This program is free software; you can redistribute it and/or modify it 6 * under the terms of version 2 of the GNU General Public License as 7 * published by the Free Software Foundation. 8 * 9 * This program is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 * more details. 13 * 14 * You should have received a copy of the GNU General Public License along with 15 * this program; if not, write to the Free Software Foundation, Inc., 16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA 17 * 18 * 19 ******************************************************************************/ 20 21 /*This header file is for all driver teams to use the same station info. 22 If you want to change this file please make sure notify all driver teams maintainers.*/ 23 24 /*Created by YuChen 20170301*/ 25 26 #ifndef __INC_RTW_STA_INFO_H 27 #define __INC_RTW_STA_INFO_H 28 29 /*--------------------Define ---------------------------------------*/ 30 31 #define STA_DM_CTRL_ACTIVE BIT(0) 32 #define STA_DM_CTRL_CFO_TRACKING BIT(1) 33 34 #ifdef CONFIG_BEAMFORMING 35 #define BEAMFORMING_HT_BEAMFORMER_ENABLE BIT(0) /*Declare sta support beamformer*/ 36 #define BEAMFORMING_HT_BEAMFORMEE_ENABLE BIT(1) /*Declare sta support beamformee*/ 37 #define BEAMFORMING_HT_BEAMFORMER_TEST BIT(2) /*Transmiting Beamforming no matter the target supports it or not*/ 38 #define BEAMFORMING_HT_BEAMFORMER_STEER_NUM (BIT(4)|BIT(5)) /*Sta Bfer's capability*/ 39 #define BEAMFORMING_HT_BEAMFORMEE_CHNL_EST_CAP (BIT(6)|BIT(7)) /*Sta BFee's capability*/ 40 41 #define BEAMFORMING_VHT_BEAMFORMER_ENABLE BIT(0) /*Declare sta support beamformer*/ 42 #define BEAMFORMING_VHT_BEAMFORMEE_ENABLE BIT(1) /*Declare sta support beamformee*/ 43 #define BEAMFORMING_VHT_MU_MIMO_AP_ENABLE BIT(2) /*Declare sta support MU beamformer*/ 44 #define BEAMFORMING_VHT_MU_MIMO_STA_ENABLE BIT(3) /*Declare sta support MU beamformer*/ 45 #define BEAMFORMING_VHT_BEAMFORMER_TEST BIT(4) /*Transmiting Beamforming no matter the target supports it or not*/ 46 #define BEAMFORMING_VHT_BEAMFORMER_STS_CAP (BIT(8)|BIT(9)|BIT(10)) /*Sta BFee's capability*/ 47 #define BEAMFORMING_VHT_BEAMFORMEE_SOUND_DIM (BIT(12)|BIT(13)|BIT(14)) /*Sta Bfer's capability*/ 48 #endif 49 50 #define HT_STBC_EN BIT(0) 51 #define VHT_STBC_EN BIT(1) 52 53 #define HT_LDPC_EN BIT(0) 54 #define VHT_LDPC_EN BIT(1) 55 56 #define SM_PS_STATIC 0 57 #define SM_PS_DYNAMIC 1 58 #define SM_PS_INVALID 2 59 #define SM_PS_DISABLE 3 60 61 62 /*cmn_sta_info.ra_sta_info.txrx_state*/ 63 #define TX_STATE 0 64 #define RX_STATE 1 65 #define BI_DIRECTION_STATE 2 66 67 /*--------------------Define Enum-----------------------------------*/ 68 enum channel_width { 69 CHANNEL_WIDTH_20 = 0, 70 CHANNEL_WIDTH_40 = 1, 71 CHANNEL_WIDTH_80 = 2, 72 CHANNEL_WIDTH_160 = 3, 73 CHANNEL_WIDTH_80_80 = 4, 74 CHANNEL_WIDTH_5 = 5, 75 CHANNEL_WIDTH_10 = 6, 76 CHANNEL_WIDTH_MAX = 7, 77 }; 78 79 enum rf_type { 80 RF_1T1R = 0, 81 RF_1T2R = 1, 82 RF_2T2R = 2, 83 RF_2T3R = 3, 84 RF_2T4R = 4, 85 RF_3T3R = 5, 86 RF_3T4R = 6, 87 RF_4T4R = 7, 88 RF_4T3R = 8, 89 RF_4T2R = 9, 90 RF_4T1R = 10, 91 RF_3T2R = 11, 92 RF_3T1R = 12, 93 RF_2T1R = 13, 94 RF_1T4R = 14, 95 RF_1T3R = 15, 96 RF_TYPE_MAX, 97 }; 98 99 enum bb_path { 100 BB_PATH_NON = 0, 101 BB_PATH_A = 0x00000001, 102 BB_PATH_B = 0x00000002, 103 BB_PATH_C = 0x00000004, 104 BB_PATH_D = 0x00000008, 105 106 BB_PATH_AB = (BB_PATH_A | BB_PATH_B), 107 BB_PATH_AC = (BB_PATH_A | BB_PATH_C), 108 BB_PATH_AD = (BB_PATH_A | BB_PATH_D), 109 BB_PATH_BC = (BB_PATH_B | BB_PATH_C), 110 BB_PATH_BD = (BB_PATH_B | BB_PATH_D), 111 BB_PATH_CD = (BB_PATH_C | BB_PATH_D), 112 113 BB_PATH_ABC = (BB_PATH_A | BB_PATH_B | BB_PATH_C), 114 BB_PATH_ABD = (BB_PATH_A | BB_PATH_B | BB_PATH_D), 115 BB_PATH_ACD = (BB_PATH_A | BB_PATH_C | BB_PATH_D), 116 BB_PATH_BCD = (BB_PATH_B | BB_PATH_C | BB_PATH_D), 117 118 BB_PATH_ABCD = (BB_PATH_A | BB_PATH_B | BB_PATH_C | BB_PATH_D), 119 BB_PATH_AUTO = 0xff /*for path diversity*/ 120 }; 121 122 enum rf_path { 123 RF_PATH_A = 0, 124 RF_PATH_B = 1, 125 RF_PATH_C = 2, 126 RF_PATH_D = 3, 127 RF_PATH_AB, 128 RF_PATH_AC, 129 RF_PATH_AD, 130 RF_PATH_BC, 131 RF_PATH_BD, 132 RF_PATH_CD, 133 RF_PATH_ABC, 134 RF_PATH_ABD, 135 RF_PATH_ACD, 136 RF_PATH_BCD, 137 RF_PATH_ABCD, 138 }; 139 140 enum rf_syn { 141 RF_SYN0 = 0, 142 RF_SYN1 = 1, 143 }; 144 145 enum rfc_mode { 146 rfc_4x4 = 0, 147 rfc_2x2 = 1, 148 }; 149 150 enum wireless_set { 151 WIRELESS_CCK = 0x00000001, 152 WIRELESS_OFDM = 0x00000002, 153 WIRELESS_HT = 0x00000004, 154 WIRELESS_VHT = 0x00000008, 155 }; 156 157 /*--------------------Define MACRO---------------------------------*/ 158 159 /*--------------------Define Struct-----------------------------------*/ 160 161 #ifdef CONFIG_BEAMFORMING 162 struct bf_cmn_info { 163 u8 ht_beamform_cap; /*Sta capablity*/ 164 u16 vht_beamform_cap; /*Sta capablity*/ 165 u16 p_aid; 166 u8 g_id; 167 }; 168 #endif 169 struct rssi_info { 170 s8 rssi; 171 s8 rssi_cck; 172 s8 rssi_ofdm; 173 u8 packet_map; 174 u8 ofdm_pkt_cnt; 175 u8 cck_pkt_cnt; 176 u16 cck_sum_power; 177 u8 is_send_rssi; 178 u8 valid_bit; 179 s16 rssi_acc; /*accumulate RSSI for per packet MA sum*/ 180 }; 181 182 struct ra_sta_info { 183 u8 rate_id; /*[PHYDM] ratr_idx*/ 184 u8 rssi_level; /*[PHYDM]*/ 185 u8 is_first_connect:1; /*[PHYDM] CE: ra_rpt_linked, AP: H2C_rssi_rpt*/ 186 u8 is_support_sgi:1; /*[driver]*/ 187 u8 is_vht_enable:2; /*[driver]*/ 188 u8 disable_ra:1; /*[driver]*/ 189 u8 disable_pt:1; /*[driver] remove is_disable_power_training*/ 190 u8 txrx_state:2; /*[PHYDM] 0: Tx, 1:Rx, 2:bi-direction*/ 191 u8 is_noisy:1; /*[PHYDM]*/ 192 u8 curr_tx_rate; /*[PHYDM] FW->Driver*/ 193 enum channel_width ra_bw_mode; /*[Driver] max bandwidth, for RA only*/ 194 enum channel_width curr_tx_bw; /*[PHYDM] FW->Driver*/ 195 u8 curr_retry_ratio; /*[PHYDM] FW->Driver*/ 196 u64 ramask; 197 }; 198 199 struct dtp_info { 200 u8 dyn_tx_power; /*Dynamic Tx power offset*/ 201 u8 last_tx_power; 202 boolean sta_is_alive; 203 u8 sta_tx_high_power_lvl:4; 204 u8 sta_last_dtp_lvl:4; 205 }; 206 207 struct cmn_sta_info { 208 u16 dm_ctrl; /*[Driver]*/ 209 enum channel_width bw_mode; /*[Driver] max support BW*/ 210 u8 mac_id; /*[Driver]*/ 211 u8 mac_addr[6]; /*[Driver]*/ 212 u16 aid; /*[Driver]*/ 213 enum rf_type mimo_type; /*[Driver] sta XTXR*/ 214 struct rssi_info rssi_stat; /*[PHYDM]*/ 215 struct ra_sta_info ra_info; /*[Driver&PHYDM]*/ 216 u16 tx_moving_average_tp; /*[Driver] tx average MBps*/ 217 u16 rx_moving_average_tp; /*[Driver] rx average MBps*/ 218 u8 stbc_en:2; /*[Driver] really transmitt STBC*/ 219 u8 ldpc_en:2; /*[Driver] really transmitt LDPC*/ 220 enum wireless_set support_wireless_set;/*[Driver]*/ 221 #ifdef CONFIG_BEAMFORMING 222 struct bf_cmn_info bf_info; /*[Driver]*/ 223 #endif 224 u8 sm_ps:2; /*[Driver]*/ 225 struct dtp_info dtp_stat; /*[PHYDM] Dynamic Tx power offset*/ 226 /*u8 pw2cca_over_TH_cnt;*/ 227 /*u8 total_pw2cca_cnt;*/ 228 }; 229 230 struct phydm_phyinfo_fw_struct { 231 u8 rx_rssi[4]; /* RSSI in 0~100 index */ 232 }; 233 234 struct phydm_phyinfo_struct { 235 boolean physts_rpt_valid; /* @if physts_rpt_valid is false, please ignore the parsing result in this structure*/ 236 u8 rx_pwdb_all; 237 u8 signal_quality; /* OFDM: signal_quality=rx_mimo_signal_quality[0], CCK: signal qualityin 0-100 index. */ 238 u8 rx_mimo_signal_strength[4]; /* RSSI in 0~100 index */ 239 s8 rx_mimo_signal_quality[4]; /* OFDM: per-path's EVM translate to 0~100% , no used for CCK*/ 240 u8 rx_mimo_evm_dbm[4]; /* per-path's original EVM (dbm) */ 241 s16 cfo_short[4]; /* per-path's cfo_short */ 242 s16 cfo_tail[4]; /* per-path's cfo_tail */ 243 s8 rx_power; /* in dBm Translate from PWdB */ 244 s8 recv_signal_power; /* Real power in dBm for this packet, no beautification and aggregation. Keep this raw info to be used for the other procedures. */ 245 u8 bt_rx_rssi_percentage; 246 u8 signal_strength; /* in 0-100 index. */ 247 s8 rx_pwr[4]; /* per-path's pwdb */ 248 s8 rx_snr[4]; /* per-path's SNR */ 249 u8 ant_idx[4]; /*per-path's antenna index*/ 250 /*ODM_PHY_STATUS_NEW_TYPE_SUPPORT*/ 251 u8 rx_count:2; /* RX path counter---*/ 252 u8 band_width:3; 253 u8 rxsc:4; /* sub-channel---*/ 254 u8 channel; /* channel number---*/ 255 u8 is_mu_packet:1; /* is MU packet or not---boolean*/ 256 u8 is_beamformed:1; /* BF packet---boolean*/ 257 u8 cnt_pw2cca; 258 u8 cnt_cca2agc_rdy; 259 /*ODM_PHY_STATUS_NEW_TYPE_SUPPORT*/ 260 u8 rx_cck_evm; 261 }; 262 263 struct phydm_perpkt_info_struct { 264 u8 data_rate; 265 u8 station_id; 266 u8 is_cck_rate: 1; 267 u8 rate_ss:3; /*spatial stream of data rate*/ 268 u8 is_packet_match_bssid:1; /*boolean*/ 269 u8 is_packet_to_self:1; /*boolean*/ 270 u8 is_packet_beacon:1; /*boolean*/ 271 u8 is_to_self:1; /*boolean*/ 272 u8 ppdu_cnt; 273 }; 274 275 /*--------------------Export global variable----------------------------*/ 276 277 /*--------------------Function declaration-----------------------------*/ 278 279 #endif 280