Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Merged with mainline rtllib.h in Aug 2004. Original ieee802_11 |
| 3 | * remains copyright by the original authors |
| 4 | * |
| 5 | * Portions of the merged code are based on Host AP (software wireless |
| 6 | * LAN access point) driver for Intersil Prism2/2.5/3. |
| 7 | * |
| 8 | * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen |
| 9 | * <jkmaline@cc.hut.fi> |
| 10 | * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi> |
| 11 | * |
| 12 | * Adaption to a generic IEEE 802.11 stack by James Ketrenos |
| 13 | * <jketreno@linux.intel.com> |
| 14 | * Copyright (c) 2004, Intel Corporation |
| 15 | * |
| 16 | * Modified for Realtek's wi-fi cards by Andrea Merello |
Andrea Merello | 559a4c3 | 2013-08-26 13:53:30 +0200 | [diff] [blame] | 17 | * <andrea.merello@gmail.com> |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 18 | * |
| 19 | * This program is free software; you can redistribute it and/or modify |
| 20 | * it under the terms of the GNU General Public License version 2 as |
| 21 | * published by the Free Software Foundation. See README and COPYING for |
| 22 | * more details. |
| 23 | */ |
| 24 | #ifndef RTLLIB_H |
| 25 | #define RTLLIB_H |
| 26 | #include <linux/if_ether.h> /* ETH_ALEN */ |
| 27 | #include <linux/kernel.h> /* ARRAY_SIZE */ |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 28 | #include <linux/module.h> |
| 29 | #include <linux/interrupt.h> |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 30 | #include <linux/jiffies.h> |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 31 | #include <linux/timer.h> |
| 32 | #include <linux/sched.h> |
Binoy Jayan | 9afa937 | 2016-06-01 14:56:52 +0530 | [diff] [blame] | 33 | #include <linux/mutex.h> |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 34 | |
| 35 | #include <linux/delay.h> |
| 36 | #include <linux/wireless.h> |
| 37 | |
Sean MacLennan | ea74fed | 2011-11-28 20:19:33 -0500 | [diff] [blame] | 38 | #include "rtllib_debug.h" |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 39 | #include "rtl819x_HT.h" |
| 40 | #include "rtl819x_BA.h" |
| 41 | #include "rtl819x_TS.h" |
| 42 | |
| 43 | #include <linux/netdevice.h> |
| 44 | #include <linux/if_arp.h> /* ARPHRD_ETHER */ |
Sean MacLennan | 184f193 | 2011-12-19 23:19:23 -0500 | [diff] [blame] | 45 | #include <net/lib80211.h> |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 46 | |
Larry Finger | 2eed3de | 2011-09-01 12:23:20 -0500 | [diff] [blame] | 47 | #define MAX_PRECMD_CNT 16 |
| 48 | #define MAX_RFDEPENDCMD_CNT 16 |
| 49 | #define MAX_POSTCMD_CNT 16 |
| 50 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 51 | #ifndef WIRELESS_SPY |
| 52 | #define WIRELESS_SPY |
| 53 | #endif |
| 54 | #include <net/iw_handler.h> |
| 55 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 56 | #ifndef IW_MODE_MONITOR |
| 57 | #define IW_MODE_MONITOR 6 |
| 58 | #endif |
| 59 | |
| 60 | #ifndef IWEVCUSTOM |
| 61 | #define IWEVCUSTOM 0x8c02 |
| 62 | #endif |
| 63 | |
| 64 | #ifndef IW_CUSTOM_MAX |
| 65 | /* Max number of char in custom event - use multiple of them if needed */ |
| 66 | #define IW_CUSTOM_MAX 256 /* In bytes */ |
| 67 | #endif |
| 68 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 69 | #define skb_tail_pointer_rsl(skb) skb_tail_pointer(skb) |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 70 | |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 71 | #define queue_delayed_work_rsl(x, y, z) queue_delayed_work(x, y, z) |
| 72 | #define INIT_DELAYED_WORK_RSL(x, y, z) INIT_DELAYED_WORK(x, y) |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 73 | |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 74 | #define queue_work_rsl(x, y) queue_work(x, y) |
| 75 | #define INIT_WORK_RSL(x, y, z) INIT_WORK(x, y) |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 76 | |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 77 | #define container_of_work_rsl(x, y, z) container_of(x, y, z) |
| 78 | #define container_of_dwork_rsl(x, y, z) \ |
Geliang Tang | be53a0d | 2015-12-28 23:43:39 +0800 | [diff] [blame] | 79 | container_of(to_delayed_work(x), y, z) |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 80 | |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 81 | #define iwe_stream_add_event_rsl(info, start, stop, iwe, len) \ |
| 82 | iwe_stream_add_event(info, start, stop, iwe, len) |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 83 | |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 84 | #define iwe_stream_add_point_rsl(info, start, stop, iwe, p) \ |
| 85 | iwe_stream_add_point(info, start, stop, iwe, p) |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 86 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 87 | static inline void *netdev_priv_rsl(struct net_device *dev) |
| 88 | { |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 89 | return netdev_priv(dev); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 90 | } |
| 91 | |
| 92 | #define KEY_TYPE_NA 0x0 |
| 93 | #define KEY_TYPE_WEP40 0x1 |
| 94 | #define KEY_TYPE_TKIP 0x2 |
| 95 | #define KEY_TYPE_CCMP 0x4 |
| 96 | #define KEY_TYPE_WEP104 0x5 |
| 97 | /* added for rtl819x tx procedure */ |
| 98 | #define MAX_QUEUE_SIZE 0x10 |
| 99 | |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 100 | #define BK_QUEUE 0 |
| 101 | #define BE_QUEUE 1 |
| 102 | #define VI_QUEUE 2 |
| 103 | #define VO_QUEUE 3 |
| 104 | #define HCCA_QUEUE 4 |
| 105 | #define TXCMD_QUEUE 5 |
| 106 | #define MGNT_QUEUE 6 |
| 107 | #define HIGH_QUEUE 7 |
| 108 | #define BEACON_QUEUE 8 |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 109 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 110 | #ifndef IW_MODE_MESH |
| 111 | #define IW_MODE_MESH 7 |
| 112 | #endif |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 113 | |
| 114 | #define IE_CISCO_FLAG_POSITION 0x08 |
| 115 | #define SUPPORT_CKIP_MIC 0x08 |
| 116 | #define SUPPORT_CKIP_PK 0x10 |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 117 | #define RT_RF_OFF_LEVL_HALT_NIC BIT3 |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 118 | #define RT_IN_PS_LEVEL(pPSC, _PS_FLAG) \ |
| 119 | ((pPSC->CurPsLevel & _PS_FLAG) ? true : false) |
| 120 | #define RT_CLEAR_PS_LEVEL(pPSC, _PS_FLAG) \ |
| 121 | (pPSC->CurPsLevel &= (~(_PS_FLAG))) |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 122 | #define RT_SET_PS_LEVEL(pPSC, _PS_FLAG) (pPSC->CurPsLevel |= _PS_FLAG) |
| 123 | |
| 124 | /* defined for skb cb field */ |
| 125 | /* At most 28 byte */ |
Larry Finger | 3b83db4 | 2011-07-19 00:01:29 -0500 | [diff] [blame] | 126 | struct cb_desc { |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 127 | /* Tx Desc Related flags (8-9) */ |
| 128 | u8 bLastIniPkt:1; |
| 129 | u8 bCmdOrInit:1; |
| 130 | u8 bFirstSeg:1; |
| 131 | u8 bLastSeg:1; |
| 132 | u8 bEncrypt:1; |
| 133 | u8 bTxDisableRateFallBack:1; |
| 134 | u8 bTxUseDriverAssingedRate:1; |
| 135 | u8 bHwSec:1; |
| 136 | |
| 137 | u8 nStuckCount; |
| 138 | |
Justin P. Mattock | cd01712 | 2012-04-23 07:36:52 -0700 | [diff] [blame] | 139 | /* Tx Firmware Related flags (10-11)*/ |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 140 | u8 bCTSEnable:1; |
| 141 | u8 bRTSEnable:1; |
| 142 | u8 bUseShortGI:1; |
| 143 | u8 bUseShortPreamble:1; |
| 144 | u8 bTxEnableFwCalcDur:1; |
| 145 | u8 bAMPDUEnable:1; |
| 146 | u8 bRTSSTBC:1; |
| 147 | u8 RTSSC:1; |
| 148 | |
| 149 | u8 bRTSBW:1; |
| 150 | u8 bPacketBW:1; |
| 151 | u8 bRTSUseShortPreamble:1; |
| 152 | u8 bRTSUseShortGI:1; |
| 153 | u8 bMulticast:1; |
| 154 | u8 bBroadcast:1; |
| 155 | u8 drv_agg_enable:1; |
| 156 | u8 reserved2:1; |
| 157 | |
| 158 | /* Tx Desc related element(12-19) */ |
| 159 | u8 rata_index; |
| 160 | u8 queue_index; |
| 161 | u16 txbuf_size; |
| 162 | u8 RATRIndex; |
| 163 | u8 bAMSDU:1; |
| 164 | u8 bFromAggrQ:1; |
| 165 | u8 reserved6:6; |
| 166 | u8 macId; |
| 167 | u8 priority; |
| 168 | |
| 169 | /* Tx firmware related element(20-27) */ |
| 170 | u8 data_rate; |
| 171 | u8 rts_rate; |
| 172 | u8 ampdu_factor; |
| 173 | u8 ampdu_density; |
| 174 | u8 DrvAggrNum; |
| 175 | u8 bdhcp; |
| 176 | u16 pkt_size; |
| 177 | u8 bIsSpecialDataFrame; |
| 178 | |
| 179 | u8 bBTTxPacket; |
| 180 | u8 bIsBTProbRsp; |
Larry Finger | d3b2c17 | 2011-07-19 12:50:41 -0500 | [diff] [blame] | 181 | }; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 182 | |
Larry Finger | 2eed3de | 2011-09-01 12:23:20 -0500 | [diff] [blame] | 183 | enum sw_chnl_cmd_id { |
| 184 | CmdID_End, |
| 185 | CmdID_SetTxPowerLevel, |
| 186 | CmdID_BBRegWrite10, |
| 187 | CmdID_WritePortUlong, |
| 188 | CmdID_WritePortUshort, |
| 189 | CmdID_WritePortUchar, |
| 190 | CmdID_RF_WriteReg, |
| 191 | }; |
| 192 | |
| 193 | struct sw_chnl_cmd { |
| 194 | enum sw_chnl_cmd_id CmdID; |
| 195 | u32 Para1; |
| 196 | u32 Para2; |
| 197 | u32 msDelay; |
| 198 | } __packed; |
| 199 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 200 | /*--------------------------Define -------------------------------------------*/ |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 201 | #define MGN_1M 0x02 |
| 202 | #define MGN_2M 0x04 |
| 203 | #define MGN_5_5M 0x0b |
| 204 | #define MGN_11M 0x16 |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 205 | |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 206 | #define MGN_6M 0x0c |
| 207 | #define MGN_9M 0x12 |
| 208 | #define MGN_12M 0x18 |
| 209 | #define MGN_18M 0x24 |
| 210 | #define MGN_24M 0x30 |
| 211 | #define MGN_36M 0x48 |
| 212 | #define MGN_48M 0x60 |
| 213 | #define MGN_54M 0x6c |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 214 | |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 215 | #define MGN_MCS0 0x80 |
| 216 | #define MGN_MCS1 0x81 |
| 217 | #define MGN_MCS2 0x82 |
| 218 | #define MGN_MCS3 0x83 |
| 219 | #define MGN_MCS4 0x84 |
| 220 | #define MGN_MCS5 0x85 |
| 221 | #define MGN_MCS6 0x86 |
| 222 | #define MGN_MCS7 0x87 |
| 223 | #define MGN_MCS8 0x88 |
| 224 | #define MGN_MCS9 0x89 |
| 225 | #define MGN_MCS10 0x8a |
| 226 | #define MGN_MCS11 0x8b |
| 227 | #define MGN_MCS12 0x8c |
| 228 | #define MGN_MCS13 0x8d |
| 229 | #define MGN_MCS14 0x8e |
| 230 | #define MGN_MCS15 0x8f |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 231 | |
Larry Finger | bb5e482 | 2011-07-19 20:23:18 -0500 | [diff] [blame] | 232 | enum hw_variables { |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 233 | HW_VAR_ETHER_ADDR, |
| 234 | HW_VAR_MULTICAST_REG, |
| 235 | HW_VAR_BASIC_RATE, |
| 236 | HW_VAR_BSSID, |
| 237 | HW_VAR_MEDIA_STATUS, |
| 238 | HW_VAR_SECURITY_CONF, |
| 239 | HW_VAR_BEACON_INTERVAL, |
| 240 | HW_VAR_ATIM_WINDOW, |
| 241 | HW_VAR_LISTEN_INTERVAL, |
| 242 | HW_VAR_CS_COUNTER, |
| 243 | HW_VAR_DEFAULTKEY0, |
| 244 | HW_VAR_DEFAULTKEY1, |
| 245 | HW_VAR_DEFAULTKEY2, |
| 246 | HW_VAR_DEFAULTKEY3, |
| 247 | HW_VAR_SIFS, |
| 248 | HW_VAR_DIFS, |
| 249 | HW_VAR_EIFS, |
| 250 | HW_VAR_SLOT_TIME, |
| 251 | HW_VAR_ACK_PREAMBLE, |
| 252 | HW_VAR_CW_CONFIG, |
| 253 | HW_VAR_CW_VALUES, |
| 254 | HW_VAR_RATE_FALLBACK_CONTROL, |
| 255 | HW_VAR_CONTENTION_WINDOW, |
| 256 | HW_VAR_RETRY_COUNT, |
| 257 | HW_VAR_TR_SWITCH, |
| 258 | HW_VAR_COMMAND, |
| 259 | HW_VAR_WPA_CONFIG, |
| 260 | HW_VAR_AMPDU_MIN_SPACE, |
| 261 | HW_VAR_SHORTGI_DENSITY, |
| 262 | HW_VAR_AMPDU_FACTOR, |
| 263 | HW_VAR_MCS_RATE_AVAILABLE, |
| 264 | HW_VAR_AC_PARAM, |
| 265 | HW_VAR_ACM_CTRL, |
| 266 | HW_VAR_DIS_Req_Qsize, |
| 267 | HW_VAR_CCX_CHNL_LOAD, |
| 268 | HW_VAR_CCX_NOISE_HISTOGRAM, |
| 269 | HW_VAR_CCX_CLM_NHM, |
| 270 | HW_VAR_TxOPLimit, |
| 271 | HW_VAR_TURBO_MODE, |
| 272 | HW_VAR_RF_STATE, |
| 273 | HW_VAR_RF_OFF_BY_HW, |
| 274 | HW_VAR_BUS_SPEED, |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 275 | HW_VAR_SET_DEV_POWER, |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 276 | |
| 277 | HW_VAR_RCR, |
| 278 | HW_VAR_RATR_0, |
| 279 | HW_VAR_RRSR, |
| 280 | HW_VAR_CPU_RST, |
| 281 | HW_VAR_CECHK_BSSID, |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 282 | HW_VAR_LBK_MODE, |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 283 | HW_VAR_AES_11N_FIX, |
| 284 | HW_VAR_USB_RX_AGGR, |
| 285 | HW_VAR_USER_CONTROL_TURBO_MODE, |
| 286 | HW_VAR_RETRY_LIMIT, |
| 287 | HW_VAR_INIT_TX_RATE, |
| 288 | HW_VAR_TX_RATE_REG, |
| 289 | HW_VAR_EFUSE_USAGE, |
| 290 | HW_VAR_EFUSE_BYTES, |
| 291 | HW_VAR_AUTOLOAD_STATUS, |
| 292 | HW_VAR_RF_2R_DISABLE, |
| 293 | HW_VAR_SET_RPWM, |
| 294 | HW_VAR_H2C_FW_PWRMODE, |
| 295 | HW_VAR_H2C_FW_JOINBSSRPT, |
| 296 | HW_VAR_1X1_RECV_COMBINE, |
| 297 | HW_VAR_STOP_SEND_BEACON, |
| 298 | HW_VAR_TSF_TIMER, |
| 299 | HW_VAR_IO_CMD, |
| 300 | |
| 301 | HW_VAR_RF_RECOVERY, |
| 302 | HW_VAR_H2C_FW_UPDATE_GTK, |
| 303 | HW_VAR_WF_MASK, |
| 304 | HW_VAR_WF_CRC, |
| 305 | HW_VAR_WF_IS_MAC_ADDR, |
| 306 | HW_VAR_H2C_FW_OFFLOAD, |
| 307 | HW_VAR_RESET_WFCRC, |
| 308 | |
| 309 | HW_VAR_HANDLE_FW_C2H, |
| 310 | HW_VAR_DL_FW_RSVD_PAGE, |
| 311 | HW_VAR_AID, |
| 312 | HW_VAR_HW_SEQ_ENABLE, |
| 313 | HW_VAR_CORRECT_TSF, |
| 314 | HW_VAR_BCN_VALID, |
| 315 | HW_VAR_FWLPS_RF_ON, |
| 316 | HW_VAR_DUAL_TSF_RST, |
| 317 | HW_VAR_SWITCH_EPHY_WoWLAN, |
| 318 | HW_VAR_INT_MIGRATION, |
| 319 | HW_VAR_INT_AC, |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 320 | HW_VAR_RF_TIMING, |
Larry Finger | bb5e482 | 2011-07-19 20:23:18 -0500 | [diff] [blame] | 321 | }; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 322 | |
Larry Finger | e93e0f6 | 2011-07-19 20:24:49 -0500 | [diff] [blame] | 323 | enum rt_op_mode { |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 324 | RT_OP_MODE_AP, |
| 325 | RT_OP_MODE_INFRASTRUCTURE, |
| 326 | RT_OP_MODE_IBSS, |
| 327 | RT_OP_MODE_NO_LINK, |
Larry Finger | e93e0f6 | 2011-07-19 20:24:49 -0500 | [diff] [blame] | 328 | }; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 329 | |
| 330 | |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 331 | #define aSifsTime \ |
| 332 | (((priv->rtllib->current_network.mode == IEEE_A) \ |
| 333 | || (priv->rtllib->current_network.mode == IEEE_N_24G) \ |
| 334 | || (priv->rtllib->current_network.mode == IEEE_N_5G)) ? 16 : 10) |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 335 | |
| 336 | #define MGMT_QUEUE_NUM 5 |
| 337 | |
| 338 | #define IEEE_CMD_SET_WPA_PARAM 1 |
| 339 | #define IEEE_CMD_SET_WPA_IE 2 |
| 340 | #define IEEE_CMD_SET_ENCRYPTION 3 |
| 341 | #define IEEE_CMD_MLME 4 |
| 342 | |
| 343 | #define IEEE_PARAM_WPA_ENABLED 1 |
| 344 | #define IEEE_PARAM_TKIP_COUNTERMEASURES 2 |
| 345 | #define IEEE_PARAM_DROP_UNENCRYPTED 3 |
| 346 | #define IEEE_PARAM_PRIVACY_INVOKED 4 |
| 347 | #define IEEE_PARAM_AUTH_ALGS 5 |
| 348 | #define IEEE_PARAM_IEEE_802_1X 6 |
| 349 | #define IEEE_PARAM_WPAX_SELECT 7 |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 350 | |
| 351 | #define IEEE_MLME_STA_DEAUTH 1 |
| 352 | #define IEEE_MLME_STA_DISASSOC 2 |
| 353 | |
| 354 | |
| 355 | #define IEEE_CRYPT_ERR_UNKNOWN_ALG 2 |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 356 | #define IEEE_CRYPT_ERR_CRYPT_INIT_FAILED 4 |
| 357 | #define IEEE_CRYPT_ERR_KEY_SET_FAILED 5 |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 358 | #define IEEE_CRYPT_ERR_CARD_CONF_FAILED 7 |
| 359 | #define IEEE_CRYPT_ALG_NAME_LEN 16 |
| 360 | |
| 361 | #define MAX_IE_LEN 0xff |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 362 | |
Larry Finger | 65dab9a | 2011-07-19 00:14:16 -0500 | [diff] [blame] | 363 | struct ieee_param { |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 364 | u32 cmd; |
| 365 | u8 sta_addr[ETH_ALEN]; |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 366 | union { |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 367 | struct { |
| 368 | u8 name; |
| 369 | u32 value; |
| 370 | } wpa_param; |
| 371 | struct { |
| 372 | u32 len; |
| 373 | u8 reserved[32]; |
| 374 | u8 data[0]; |
| 375 | } wpa_ie; |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 376 | struct { |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 377 | int command; |
| 378 | int reason_code; |
| 379 | } mlme; |
| 380 | struct { |
| 381 | u8 alg[IEEE_CRYPT_ALG_NAME_LEN]; |
| 382 | u8 set_tx; |
| 383 | u32 err; |
| 384 | u8 idx; |
| 385 | u8 seq[8]; /* sequence counter (set: RX, get: TX) */ |
| 386 | u16 key_len; |
| 387 | u8 key[0]; |
| 388 | } crypt; |
| 389 | } u; |
Larry Finger | d3b2c17 | 2011-07-19 12:50:41 -0500 | [diff] [blame] | 390 | }; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 391 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 392 | #define msleep_interruptible_rsl msleep_interruptible |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 393 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 394 | /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section |
Mateusz Kulikowski | 14b40d9 | 2015-04-01 00:24:37 +0200 | [diff] [blame] | 395 | * 6.2.1.1.2. |
| 396 | * |
| 397 | * The figure in section 7.1.2 suggests a body size of up to 2312 |
| 398 | * bytes is allowed, which is a bit confusing, I suspect this |
| 399 | * represents the 2304 bytes of real data, plus a possible 8 bytes of |
| 400 | * WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) |
| 401 | */ |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 402 | #define RTLLIB_1ADDR_LEN 10 |
| 403 | #define RTLLIB_2ADDR_LEN 16 |
| 404 | #define RTLLIB_3ADDR_LEN 24 |
| 405 | #define RTLLIB_4ADDR_LEN 30 |
| 406 | #define RTLLIB_FCS_LEN 4 |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 407 | |
| 408 | #define RTLLIB_SKBBUFFER_SIZE 2500 |
| 409 | |
| 410 | #define MIN_FRAG_THRESHOLD 256U |
| 411 | #define MAX_FRAG_THRESHOLD 2346U |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 412 | |
| 413 | /* Frame control field constants */ |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 414 | #define RTLLIB_FCTL_FTYPE 0x000c |
| 415 | #define RTLLIB_FCTL_STYPE 0x00f0 |
| 416 | #define RTLLIB_FCTL_FRAMETYPE 0x00fc |
| 417 | #define RTLLIB_FCTL_TODS 0x0100 |
| 418 | #define RTLLIB_FCTL_FROMDS 0x0200 |
| 419 | #define RTLLIB_FCTL_DSTODS 0x0300 |
| 420 | #define RTLLIB_FCTL_MOREFRAGS 0x0400 |
| 421 | #define RTLLIB_FCTL_RETRY 0x0800 |
| 422 | #define RTLLIB_FCTL_PM 0x1000 |
| 423 | #define RTLLIB_FCTL_MOREDATA 0x2000 |
| 424 | #define RTLLIB_FCTL_WEP 0x4000 |
| 425 | #define RTLLIB_FCTL_ORDER 0x8000 |
| 426 | |
| 427 | #define RTLLIB_FTYPE_MGMT 0x0000 |
| 428 | #define RTLLIB_FTYPE_CTL 0x0004 |
| 429 | #define RTLLIB_FTYPE_DATA 0x0008 |
| 430 | |
| 431 | /* management */ |
| 432 | #define RTLLIB_STYPE_ASSOC_REQ 0x0000 |
| 433 | #define RTLLIB_STYPE_ASSOC_RESP 0x0010 |
| 434 | #define RTLLIB_STYPE_REASSOC_REQ 0x0020 |
| 435 | #define RTLLIB_STYPE_REASSOC_RESP 0x0030 |
| 436 | #define RTLLIB_STYPE_PROBE_REQ 0x0040 |
| 437 | #define RTLLIB_STYPE_PROBE_RESP 0x0050 |
| 438 | #define RTLLIB_STYPE_BEACON 0x0080 |
| 439 | #define RTLLIB_STYPE_ATIM 0x0090 |
| 440 | #define RTLLIB_STYPE_DISASSOC 0x00A0 |
| 441 | #define RTLLIB_STYPE_AUTH 0x00B0 |
| 442 | #define RTLLIB_STYPE_DEAUTH 0x00C0 |
| 443 | #define RTLLIB_STYPE_MANAGE_ACT 0x00D0 |
| 444 | |
| 445 | /* control */ |
| 446 | #define RTLLIB_STYPE_PSPOLL 0x00A0 |
| 447 | #define RTLLIB_STYPE_RTS 0x00B0 |
| 448 | #define RTLLIB_STYPE_CTS 0x00C0 |
| 449 | #define RTLLIB_STYPE_ACK 0x00D0 |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 450 | |
| 451 | /* data */ |
| 452 | #define RTLLIB_STYPE_DATA 0x0000 |
| 453 | #define RTLLIB_STYPE_DATA_CFACK 0x0010 |
| 454 | #define RTLLIB_STYPE_DATA_CFPOLL 0x0020 |
| 455 | #define RTLLIB_STYPE_DATA_CFACKPOLL 0x0030 |
| 456 | #define RTLLIB_STYPE_NULLFUNC 0x0040 |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 457 | #define RTLLIB_STYPE_QOS_DATA 0x0080 |
| 458 | #define RTLLIB_STYPE_QOS_NULL 0x00C0 |
| 459 | |
| 460 | #define RTLLIB_SCTL_FRAG 0x000F |
| 461 | #define RTLLIB_SCTL_SEQ 0xFFF0 |
| 462 | |
| 463 | /* QOS control */ |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 464 | #define RTLLIB_QCTL_TID 0x000F |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 465 | |
| 466 | #define FC_QOS_BIT BIT7 |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 467 | #define IsDataFrame(pdu) (((pdu[0] & 0x0C) == 0x08) ? true : false) |
| 468 | #define IsLegacyDataFrame(pdu) (IsDataFrame(pdu) && (!(pdu[0]&FC_QOS_BIT))) |
| 469 | #define IsQoSDataFrame(pframe) \ |
| 470 | ((*(u16 *)pframe&(RTLLIB_STYPE_QOS_DATA|RTLLIB_FTYPE_DATA)) == \ |
| 471 | (RTLLIB_STYPE_QOS_DATA|RTLLIB_FTYPE_DATA)) |
| 472 | #define Frame_Order(pframe) (*(u16 *)pframe&RTLLIB_FCTL_ORDER) |
| 473 | #define SN_LESS(a, b) (((a-b)&0x800) != 0) |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 474 | #define SN_EQUAL(a, b) (a == b) |
| 475 | #define MAX_DEV_ADDR_SIZE 8 |
| 476 | |
Larry Finger | 09ced23 | 2011-07-19 20:26:18 -0500 | [diff] [blame] | 477 | enum act_category { |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 478 | ACT_CAT_QOS = 1, |
| 479 | ACT_CAT_DLS = 2, |
| 480 | ACT_CAT_BA = 3, |
| 481 | ACT_CAT_HT = 7, |
| 482 | ACT_CAT_WMM = 17, |
Larry Finger | 09ced23 | 2011-07-19 20:26:18 -0500 | [diff] [blame] | 483 | }; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 484 | |
Larry Finger | 07276ba | 2011-07-19 20:29:12 -0500 | [diff] [blame] | 485 | enum ba_action { |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 486 | ACT_ADDBAREQ = 0, |
| 487 | ACT_ADDBARSP = 1, |
| 488 | ACT_DELBA = 2, |
Larry Finger | 07276ba | 2011-07-19 20:29:12 -0500 | [diff] [blame] | 489 | }; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 490 | |
Larry Finger | 062de0a | 2011-07-19 20:46:02 -0500 | [diff] [blame] | 491 | enum init_gain_op_type { |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 492 | IG_Backup = 0, |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 493 | IG_Restore, |
| 494 | IG_Max |
Larry Finger | 062de0a | 2011-07-19 20:46:02 -0500 | [diff] [blame] | 495 | }; |
Larry Finger | d3b2c17 | 2011-07-19 12:50:41 -0500 | [diff] [blame] | 496 | |
Larry Finger | 4fd7ced | 2011-07-19 20:47:28 -0500 | [diff] [blame] | 497 | enum led_ctl_mode { |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 498 | LED_CTL_POWER_ON = 1, |
| 499 | LED_CTL_LINK = 2, |
| 500 | LED_CTL_NO_LINK = 3, |
| 501 | LED_CTL_TX = 4, |
| 502 | LED_CTL_RX = 5, |
| 503 | LED_CTL_SITE_SURVEY = 6, |
| 504 | LED_CTL_POWER_OFF = 7, |
| 505 | LED_CTL_START_TO_LINK = 8, |
Larry Finger | 4fd7ced | 2011-07-19 20:47:28 -0500 | [diff] [blame] | 506 | }; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 507 | |
Larry Finger | e608063 | 2011-07-19 20:48:58 -0500 | [diff] [blame] | 508 | enum rt_rf_type_def { |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 509 | RF_1T2R = 0, |
| 510 | RF_2T4R, |
Larry Finger | e608063 | 2011-07-19 20:48:58 -0500 | [diff] [blame] | 511 | }; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 512 | |
Larry Finger | dc20a32 | 2011-07-19 20:50:21 -0500 | [diff] [blame] | 513 | enum wireless_mode { |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 514 | WIRELESS_MODE_UNKNOWN = 0x00, |
| 515 | WIRELESS_MODE_A = 0x01, |
| 516 | WIRELESS_MODE_B = 0x02, |
| 517 | WIRELESS_MODE_G = 0x04, |
| 518 | WIRELESS_MODE_AUTO = 0x08, |
| 519 | WIRELESS_MODE_N_24G = 0x10, |
| 520 | WIRELESS_MODE_N_5G = 0x20 |
Larry Finger | dc20a32 | 2011-07-19 20:50:21 -0500 | [diff] [blame] | 521 | }; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 522 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 523 | #ifndef ETH_P_PAE |
Georgiana Rodica Chelu | 7b170ba | 2016-09-29 00:07:15 +0300 | [diff] [blame] | 524 | #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 525 | #define ETH_P_IP 0x0800 /* Internet Protocol packet */ |
| 526 | #define ETH_P_ARP 0x0806 /* Address Resolution packet */ |
| 527 | #endif /* ETH_P_PAE */ |
| 528 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 529 | #ifndef ETH_P_80211_RAW |
| 530 | #define ETH_P_80211_RAW (ETH_P_ECONET + 1) |
| 531 | #endif |
| 532 | |
| 533 | /* IEEE 802.11 defines */ |
| 534 | |
| 535 | #define P80211_OUI_LEN 3 |
| 536 | |
| 537 | struct rtllib_snap_hdr { |
| 538 | |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 539 | u8 dsap; /* always 0xAA */ |
| 540 | u8 ssap; /* always 0xAA */ |
| 541 | u8 ctrl; /* always 0x03 */ |
| 542 | u8 oui[P80211_OUI_LEN]; /* organizational universal id */ |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 543 | |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 544 | } __packed; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 545 | |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 546 | enum _REG_PREAMBLE_MODE { |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 547 | PREAMBLE_LONG = 1, |
| 548 | PREAMBLE_AUTO = 2, |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 549 | PREAMBLE_SHORT = 3, |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 550 | }; |
| 551 | |
| 552 | #define SNAP_SIZE sizeof(struct rtllib_snap_hdr) |
| 553 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 554 | #define WLAN_FC_GET_TYPE(fc) ((fc) & RTLLIB_FCTL_FTYPE) |
| 555 | #define WLAN_FC_GET_STYPE(fc) ((fc) & RTLLIB_FCTL_STYPE) |
| 556 | #define WLAN_FC_MORE_DATA(fc) ((fc) & RTLLIB_FCTL_MOREDATA) |
| 557 | |
| 558 | #define WLAN_FC_GET_FRAMETYPE(fc) ((fc) & RTLLIB_FCTL_FRAMETYPE) |
| 559 | #define WLAN_GET_SEQ_FRAG(seq) ((seq) & RTLLIB_SCTL_FRAG) |
| 560 | #define WLAN_GET_SEQ_SEQ(seq) (((seq) & RTLLIB_SCTL_SEQ) >> 4) |
| 561 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 562 | /* Authentication algorithms */ |
| 563 | #define WLAN_AUTH_OPEN 0 |
| 564 | #define WLAN_AUTH_SHARED_KEY 1 |
| 565 | #define WLAN_AUTH_LEAP 128 |
| 566 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 567 | #define WLAN_CAPABILITY_ESS (1<<0) |
| 568 | #define WLAN_CAPABILITY_IBSS (1<<1) |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 569 | #define WLAN_CAPABILITY_PRIVACY (1<<4) |
| 570 | #define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5) |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 571 | #define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10) |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 572 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 573 | #define RTLLIB_STATMASK_SIGNAL (1<<0) |
| 574 | #define RTLLIB_STATMASK_RSSI (1<<1) |
| 575 | #define RTLLIB_STATMASK_NOISE (1<<2) |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 576 | #define RTLLIB_STATMASK_WEMASK 0x7 |
| 577 | |
| 578 | #define RTLLIB_CCK_MODULATION (1<<0) |
| 579 | #define RTLLIB_OFDM_MODULATION (1<<1) |
| 580 | |
| 581 | #define RTLLIB_24GHZ_BAND (1<<0) |
| 582 | #define RTLLIB_52GHZ_BAND (1<<1) |
| 583 | |
| 584 | #define RTLLIB_CCK_RATE_LEN 4 |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 585 | #define RTLLIB_CCK_RATE_1MB 0x02 |
| 586 | #define RTLLIB_CCK_RATE_2MB 0x04 |
| 587 | #define RTLLIB_CCK_RATE_5MB 0x0B |
| 588 | #define RTLLIB_CCK_RATE_11MB 0x16 |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 589 | #define RTLLIB_OFDM_RATE_LEN 8 |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 590 | #define RTLLIB_OFDM_RATE_6MB 0x0C |
| 591 | #define RTLLIB_OFDM_RATE_9MB 0x12 |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 592 | #define RTLLIB_OFDM_RATE_12MB 0x18 |
| 593 | #define RTLLIB_OFDM_RATE_18MB 0x24 |
| 594 | #define RTLLIB_OFDM_RATE_24MB 0x30 |
| 595 | #define RTLLIB_OFDM_RATE_36MB 0x48 |
| 596 | #define RTLLIB_OFDM_RATE_48MB 0x60 |
| 597 | #define RTLLIB_OFDM_RATE_54MB 0x6C |
| 598 | #define RTLLIB_BASIC_RATE_MASK 0x80 |
| 599 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 600 | /* this is stolen and modified from the madwifi driver*/ |
| 601 | #define RTLLIB_FC0_TYPE_MASK 0x0c |
| 602 | #define RTLLIB_FC0_TYPE_DATA 0x08 |
| 603 | #define RTLLIB_FC0_SUBTYPE_MASK 0xB0 |
| 604 | #define RTLLIB_FC0_SUBTYPE_QOS 0x80 |
| 605 | |
| 606 | #define RTLLIB_QOS_HAS_SEQ(fc) \ |
| 607 | (((fc) & (RTLLIB_FC0_TYPE_MASK | RTLLIB_FC0_SUBTYPE_MASK)) == \ |
| 608 | (RTLLIB_FC0_TYPE_DATA | RTLLIB_FC0_SUBTYPE_QOS)) |
| 609 | |
| 610 | /* this is stolen from ipw2200 driver */ |
| 611 | #define IEEE_IBSS_MAC_HASH_SIZE 31 |
| 612 | struct ieee_ibss_seq { |
| 613 | u8 mac[ETH_ALEN]; |
| 614 | u16 seq_num[17]; |
| 615 | u16 frag_num[17]; |
| 616 | unsigned long packet_time[17]; |
| 617 | struct list_head list; |
| 618 | }; |
| 619 | |
| 620 | /* NOTE: This data is for statistical purposes; not all hardware provides this |
| 621 | * information for frames received. Not setting these will not cause |
| 622 | * any adverse affects. */ |
| 623 | struct rtllib_rx_stats { |
Larry Finger | 0dd5650 | 2011-08-25 11:48:12 -0500 | [diff] [blame] | 624 | u64 mac_time; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 625 | s8 rssi; |
| 626 | u8 signal; |
| 627 | u8 noise; |
| 628 | u16 rate; /* in 100 kbps */ |
| 629 | u8 received_channel; |
| 630 | u8 control; |
| 631 | u8 mask; |
| 632 | u8 freq; |
| 633 | u16 len; |
| 634 | u64 tsf; |
| 635 | u32 beacon_time; |
| 636 | u8 nic_type; |
| 637 | u16 Length; |
| 638 | u8 SignalQuality; |
| 639 | s32 RecvSignalPower; |
| 640 | s8 RxPower; |
| 641 | u8 SignalStrength; |
| 642 | u16 bHwError:1; |
| 643 | u16 bCRC:1; |
| 644 | u16 bICV:1; |
| 645 | u16 bShortPreamble:1; |
| 646 | u16 Antenna:1; |
| 647 | u16 Decrypted:1; |
| 648 | u16 Wakeup:1; |
| 649 | u16 Reserved0:1; |
| 650 | u8 AGC; |
| 651 | u32 TimeStampLow; |
| 652 | u32 TimeStampHigh; |
| 653 | bool bShift; |
| 654 | bool bIsQosData; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 655 | |
| 656 | u8 RxDrvInfoSize; |
| 657 | u8 RxBufShift; |
| 658 | bool bIsAMPDU; |
| 659 | bool bFirstMPDU; |
| 660 | bool bContainHTC; |
| 661 | bool RxIs40MHzPacket; |
| 662 | u32 RxPWDBAll; |
| 663 | u8 RxMIMOSignalStrength[4]; |
| 664 | s8 RxMIMOSignalQuality[2]; |
| 665 | bool bPacketMatchBSSID; |
| 666 | bool bIsCCK; |
| 667 | bool bPacketToSelf; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 668 | u16 packetlength; |
| 669 | u16 fraglength; |
| 670 | u16 fragoffset; |
| 671 | u16 ntotalfrag; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 672 | bool bPacketBeacon; |
| 673 | bool bToSelfBA; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 674 | u16 Seq_Num; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 675 | }; |
| 676 | |
| 677 | /* IEEE 802.11 requires that STA supports concurrent reception of at least |
| 678 | * three fragmented frames. This define can be increased to support more |
| 679 | * concurrent frames, but it should be noted that each entry can consume about |
Mateusz Kulikowski | 14b40d9 | 2015-04-01 00:24:37 +0200 | [diff] [blame] | 680 | * 2 kB of RAM and increasing cache size will slow down frame reassembly. |
| 681 | */ |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 682 | #define RTLLIB_FRAG_CACHE_LEN 4 |
| 683 | |
| 684 | struct rtllib_frag_entry { |
| 685 | unsigned long first_frag_time; |
| 686 | unsigned int seq; |
| 687 | unsigned int last_frag; |
| 688 | struct sk_buff *skb; |
| 689 | u8 src_addr[ETH_ALEN]; |
| 690 | u8 dst_addr[ETH_ALEN]; |
| 691 | }; |
| 692 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 693 | struct rtllib_device; |
| 694 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 695 | #define SEC_ACTIVE_KEY (1<<4) |
| 696 | #define SEC_AUTH_MODE (1<<5) |
| 697 | #define SEC_UNICAST_GROUP (1<<6) |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 698 | #define SEC_LEVEL (1<<7) |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 699 | #define SEC_ENABLED (1<<8) |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 700 | |
| 701 | #define SEC_LEVEL_0 0 /* None */ |
| 702 | #define SEC_LEVEL_1 1 /* WEP 40 and 104 bit */ |
| 703 | #define SEC_LEVEL_2 2 /* Level 1 + TKIP */ |
| 704 | #define SEC_LEVEL_2_CKIP 3 /* Level 1 + CKIP */ |
| 705 | #define SEC_LEVEL_3 4 /* Level 2 + CCMP */ |
| 706 | |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 707 | #define SEC_ALG_NONE 0 |
| 708 | #define SEC_ALG_WEP 1 |
| 709 | #define SEC_ALG_TKIP 2 |
| 710 | #define SEC_ALG_CCMP 4 |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 711 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 712 | #define WEP_KEY_LEN 13 |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 713 | #define SCM_KEY_LEN 32 |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 714 | |
| 715 | struct rtllib_security { |
| 716 | u16 active_key:2, |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 717 | enabled:1, |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 718 | auth_mode:2, |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 719 | auth_algo:4, |
| 720 | unicast_uses_group:1, |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 721 | encrypt:1; |
Sean MacLennan | 184f193 | 2011-12-19 23:19:23 -0500 | [diff] [blame] | 722 | u8 key_sizes[NUM_WEP_KEYS]; |
| 723 | u8 keys[NUM_WEP_KEYS][SCM_KEY_LEN]; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 724 | u8 level; |
| 725 | u16 flags; |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 726 | } __packed; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 727 | |
| 728 | |
Mateusz Kulikowski | 14b40d9 | 2015-04-01 00:24:37 +0200 | [diff] [blame] | 729 | /* 802.11 data frame from AP |
| 730 | * ,-------------------------------------------------------------------. |
| 731 | * Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 | |
| 732 | * |------|------|---------|---------|---------|------|---------|------| |
| 733 | * Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs | |
| 734 | * | | tion | (BSSID) | | | ence | data | | |
| 735 | * `-------------------------------------------------------------------' |
| 736 | * Total: 28-2340 bytes |
| 737 | */ |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 738 | |
| 739 | /* Management Frame Information Element Types */ |
| 740 | enum rtllib_mfie { |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 741 | MFIE_TYPE_SSID = 0, |
| 742 | MFIE_TYPE_RATES = 1, |
| 743 | MFIE_TYPE_FH_SET = 2, |
| 744 | MFIE_TYPE_DS_SET = 3, |
| 745 | MFIE_TYPE_CF_SET = 4, |
| 746 | MFIE_TYPE_TIM = 5, |
| 747 | MFIE_TYPE_IBSS_SET = 6, |
| 748 | MFIE_TYPE_COUNTRY = 7, |
| 749 | MFIE_TYPE_HOP_PARAMS = 8, |
| 750 | MFIE_TYPE_HOP_TABLE = 9, |
| 751 | MFIE_TYPE_REQUEST = 10, |
| 752 | MFIE_TYPE_CHALLENGE = 16, |
| 753 | MFIE_TYPE_POWER_CONSTRAINT = 32, |
| 754 | MFIE_TYPE_POWER_CAPABILITY = 33, |
| 755 | MFIE_TYPE_TPC_REQUEST = 34, |
| 756 | MFIE_TYPE_TPC_REPORT = 35, |
| 757 | MFIE_TYPE_SUPP_CHANNELS = 36, |
| 758 | MFIE_TYPE_CSA = 37, |
| 759 | MFIE_TYPE_MEASURE_REQUEST = 38, |
| 760 | MFIE_TYPE_MEASURE_REPORT = 39, |
| 761 | MFIE_TYPE_QUIET = 40, |
| 762 | MFIE_TYPE_IBSS_DFS = 41, |
| 763 | MFIE_TYPE_ERP = 42, |
| 764 | MFIE_TYPE_HT_CAP = 45, |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 765 | MFIE_TYPE_RSN = 48, |
| 766 | MFIE_TYPE_RATES_EX = 50, |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 767 | MFIE_TYPE_HT_INFO = 61, |
| 768 | MFIE_TYPE_AIRONET = 133, |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 769 | MFIE_TYPE_GENERIC = 221, |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 770 | MFIE_TYPE_QOS_PARAMETER = 222, |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 771 | }; |
| 772 | |
| 773 | /* Minimal header; can be used for passing 802.11 frames with sufficient |
| 774 | * information to determine what type of underlying data type is actually |
Mateusz Kulikowski | 14b40d9 | 2015-04-01 00:24:37 +0200 | [diff] [blame] | 775 | * stored in the data. |
| 776 | */ |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 777 | struct rtllib_pspoll_hdr { |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 778 | __le16 frame_ctl; |
| 779 | __le16 aid; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 780 | u8 bssid[ETH_ALEN]; |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 781 | u8 ta[ETH_ALEN]; |
| 782 | } __packed; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 783 | |
| 784 | struct rtllib_hdr { |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 785 | __le16 frame_ctl; |
| 786 | __le16 duration_id; |
| 787 | u8 payload[0]; |
| 788 | } __packed; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 789 | |
| 790 | struct rtllib_hdr_1addr { |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 791 | __le16 frame_ctl; |
| 792 | __le16 duration_id; |
| 793 | u8 addr1[ETH_ALEN]; |
| 794 | u8 payload[0]; |
| 795 | } __packed; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 796 | |
| 797 | struct rtllib_hdr_2addr { |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 798 | __le16 frame_ctl; |
| 799 | __le16 duration_id; |
| 800 | u8 addr1[ETH_ALEN]; |
| 801 | u8 addr2[ETH_ALEN]; |
| 802 | u8 payload[0]; |
| 803 | } __packed; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 804 | |
| 805 | struct rtllib_hdr_3addr { |
| 806 | __le16 frame_ctl; |
| 807 | __le16 duration_id; |
| 808 | u8 addr1[ETH_ALEN]; |
| 809 | u8 addr2[ETH_ALEN]; |
| 810 | u8 addr3[ETH_ALEN]; |
| 811 | __le16 seq_ctl; |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 812 | u8 payload[0]; |
| 813 | } __packed; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 814 | |
| 815 | struct rtllib_hdr_4addr { |
| 816 | __le16 frame_ctl; |
| 817 | __le16 duration_id; |
| 818 | u8 addr1[ETH_ALEN]; |
| 819 | u8 addr2[ETH_ALEN]; |
| 820 | u8 addr3[ETH_ALEN]; |
| 821 | __le16 seq_ctl; |
| 822 | u8 addr4[ETH_ALEN]; |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 823 | u8 payload[0]; |
| 824 | } __packed; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 825 | |
| 826 | struct rtllib_hdr_3addrqos { |
| 827 | __le16 frame_ctl; |
| 828 | __le16 duration_id; |
| 829 | u8 addr1[ETH_ALEN]; |
| 830 | u8 addr2[ETH_ALEN]; |
| 831 | u8 addr3[ETH_ALEN]; |
| 832 | __le16 seq_ctl; |
| 833 | __le16 qos_ctl; |
| 834 | u8 payload[0]; |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 835 | } __packed; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 836 | |
| 837 | struct rtllib_hdr_4addrqos { |
| 838 | __le16 frame_ctl; |
| 839 | __le16 duration_id; |
| 840 | u8 addr1[ETH_ALEN]; |
| 841 | u8 addr2[ETH_ALEN]; |
| 842 | u8 addr3[ETH_ALEN]; |
| 843 | __le16 seq_ctl; |
| 844 | u8 addr4[ETH_ALEN]; |
| 845 | __le16 qos_ctl; |
| 846 | u8 payload[0]; |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 847 | } __packed; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 848 | |
| 849 | struct rtllib_info_element { |
| 850 | u8 id; |
| 851 | u8 len; |
| 852 | u8 data[0]; |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 853 | } __packed; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 854 | |
| 855 | struct rtllib_authentication { |
| 856 | struct rtllib_hdr_3addr header; |
| 857 | __le16 algorithm; |
| 858 | __le16 transaction; |
| 859 | __le16 status; |
| 860 | /*challenge*/ |
| 861 | struct rtllib_info_element info_element[0]; |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 862 | } __packed; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 863 | |
| 864 | struct rtllib_disauth { |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 865 | struct rtllib_hdr_3addr header; |
| 866 | __le16 reason; |
| 867 | } __packed; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 868 | |
| 869 | struct rtllib_disassoc { |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 870 | struct rtllib_hdr_3addr header; |
| 871 | __le16 reason; |
| 872 | } __packed; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 873 | |
| 874 | struct rtllib_probe_request { |
| 875 | struct rtllib_hdr_3addr header; |
| 876 | /* SSID, supported rates */ |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 877 | struct rtllib_info_element info_element[0]; |
| 878 | } __packed; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 879 | |
| 880 | struct rtllib_probe_response { |
| 881 | struct rtllib_hdr_3addr header; |
| 882 | u32 time_stamp[2]; |
| 883 | __le16 beacon_interval; |
| 884 | __le16 capability; |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 885 | /* SSID, supported rates, FH params, DS params, |
Mateusz Kulikowski | 14b40d9 | 2015-04-01 00:24:37 +0200 | [diff] [blame] | 886 | * CF params, IBSS params, TIM (if beacon), RSN |
| 887 | */ |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 888 | struct rtllib_info_element info_element[0]; |
| 889 | } __packed; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 890 | |
| 891 | /* Alias beacon for probe_response */ |
| 892 | #define rtllib_beacon rtllib_probe_response |
| 893 | |
| 894 | struct rtllib_assoc_request_frame { |
| 895 | struct rtllib_hdr_3addr header; |
| 896 | __le16 capability; |
| 897 | __le16 listen_interval; |
| 898 | /* SSID, supported rates, RSN */ |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 899 | struct rtllib_info_element info_element[0]; |
| 900 | } __packed; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 901 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 902 | struct rtllib_assoc_response_frame { |
| 903 | struct rtllib_hdr_3addr header; |
| 904 | __le16 capability; |
| 905 | __le16 status; |
| 906 | __le16 aid; |
| 907 | struct rtllib_info_element info_element[0]; /* supported rates */ |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 908 | } __packed; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 909 | |
| 910 | struct rtllib_txb { |
| 911 | u8 nr_frags; |
| 912 | u8 encrypted; |
| 913 | u8 queue_index; |
| 914 | u8 rts_included; |
| 915 | u16 reserved; |
| 916 | __le16 frag_size; |
| 917 | __le16 payload_size; |
| 918 | struct sk_buff *fragments[0]; |
| 919 | }; |
| 920 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 921 | #define MAX_SUBFRAME_COUNT 64 |
| 922 | struct rtllib_rxb { |
| 923 | u8 nr_subframes; |
| 924 | struct sk_buff *subframes[MAX_SUBFRAME_COUNT]; |
| 925 | u8 dst[ETH_ALEN]; |
| 926 | u8 src[ETH_ALEN]; |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 927 | } __packed; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 928 | |
Larry Finger | 66ba443 | 2011-07-19 10:37:34 -0500 | [diff] [blame] | 929 | union frameqos { |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 930 | u16 shortdata; |
| 931 | u8 chardata[2]; |
| 932 | struct { |
| 933 | u16 tid:4; |
| 934 | u16 eosp:1; |
| 935 | u16 ack_policy:2; |
| 936 | u16 reserved:1; |
| 937 | u16 txop:8; |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 938 | } field; |
Larry Finger | 66ba443 | 2011-07-19 10:37:34 -0500 | [diff] [blame] | 939 | }; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 940 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 941 | /* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs |
| 942 | * only use 8, and then use extended rates for the remaining supported |
| 943 | * rates. Other APs, however, stick all of their supported rates on the |
Mateusz Kulikowski | 14b40d9 | 2015-04-01 00:24:37 +0200 | [diff] [blame] | 944 | * main rates information element... |
| 945 | */ |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 946 | #define MAX_RATES_LENGTH ((u8)12) |
| 947 | #define MAX_RATES_EX_LENGTH ((u8)16) |
| 948 | #define MAX_NETWORK_COUNT 96 |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 949 | |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 950 | #define MAX_CHANNEL_NUMBER 161 |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 951 | #define RTLLIB_SOFTMAC_SCAN_TIME 100 |
| 952 | #define RTLLIB_SOFTMAC_ASSOC_RETRY_TIME (HZ * 2) |
| 953 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 954 | #define MAX_WPA_IE_LEN 64 |
| 955 | #define MAX_WZC_IE_LEN 256 |
| 956 | |
| 957 | #define NETWORK_EMPTY_ESSID (1<<0) |
| 958 | #define NETWORK_HAS_OFDM (1<<1) |
| 959 | #define NETWORK_HAS_CCK (1<<2) |
| 960 | |
| 961 | /* QoS structure */ |
| 962 | #define NETWORK_HAS_QOS_PARAMETERS (1<<3) |
| 963 | #define NETWORK_HAS_QOS_INFORMATION (1<<4) |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 964 | #define NETWORK_HAS_QOS_MASK (NETWORK_HAS_QOS_PARAMETERS | \ |
| 965 | NETWORK_HAS_QOS_INFORMATION) |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 966 | /* 802.11h */ |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 967 | #define NETWORK_HAS_ERP_VALUE (1<<10) |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 968 | |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 969 | #define QOS_QUEUE_NUM 4 |
| 970 | #define QOS_OUI_LEN 3 |
| 971 | #define QOS_OUI_TYPE 2 |
| 972 | #define QOS_ELEMENT_ID 221 |
| 973 | #define QOS_OUI_INFO_SUB_TYPE 0 |
| 974 | #define QOS_OUI_PARAM_SUB_TYPE 1 |
| 975 | #define QOS_VERSION_1 1 |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 976 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 977 | struct rtllib_qos_information_element { |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 978 | u8 elementID; |
| 979 | u8 length; |
| 980 | u8 qui[QOS_OUI_LEN]; |
| 981 | u8 qui_type; |
| 982 | u8 qui_subtype; |
| 983 | u8 version; |
| 984 | u8 ac_info; |
| 985 | } __packed; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 986 | |
| 987 | struct rtllib_qos_ac_parameter { |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 988 | u8 aci_aifsn; |
| 989 | u8 ecw_min_max; |
| 990 | __le16 tx_op_limit; |
| 991 | } __packed; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 992 | |
| 993 | struct rtllib_qos_parameter_info { |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 994 | struct rtllib_qos_information_element info_element; |
| 995 | u8 reserved; |
| 996 | struct rtllib_qos_ac_parameter ac_params_record[QOS_QUEUE_NUM]; |
| 997 | } __packed; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 998 | |
| 999 | struct rtllib_qos_parameters { |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1000 | __le16 cw_min[QOS_QUEUE_NUM]; |
| 1001 | __le16 cw_max[QOS_QUEUE_NUM]; |
| 1002 | u8 aifs[QOS_QUEUE_NUM]; |
| 1003 | u8 flag[QOS_QUEUE_NUM]; |
| 1004 | __le16 tx_op_limit[QOS_QUEUE_NUM]; |
| 1005 | } __packed; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1006 | |
| 1007 | struct rtllib_qos_data { |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1008 | struct rtllib_qos_parameters parameters; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1009 | unsigned int wmm_acm; |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1010 | int active; |
| 1011 | int supported; |
| 1012 | u8 param_count; |
| 1013 | u8 old_param_count; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1014 | }; |
| 1015 | |
| 1016 | struct rtllib_tim_parameters { |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1017 | u8 tim_count; |
| 1018 | u8 tim_period; |
| 1019 | } __packed; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1020 | |
| 1021 | struct rtllib_wmm_ac_param { |
| 1022 | u8 ac_aci_acm_aifsn; |
| 1023 | u8 ac_ecwmin_ecwmax; |
| 1024 | u16 ac_txop_limit; |
| 1025 | }; |
| 1026 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1027 | enum eap_type { |
| 1028 | EAP_PACKET = 0, |
| 1029 | EAPOL_START, |
| 1030 | EAPOL_LOGOFF, |
| 1031 | EAPOL_KEY, |
| 1032 | EAPOL_ENCAP_ASF_ALERT |
| 1033 | }; |
| 1034 | |
Melike Yurtoglu | 84780ec | 2014-09-30 20:43:15 +0300 | [diff] [blame] | 1035 | static const char * const eap_types[] = { |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1036 | [EAP_PACKET] = "EAP-Packet", |
| 1037 | [EAPOL_START] = "EAPOL-Start", |
| 1038 | [EAPOL_LOGOFF] = "EAPOL-Logoff", |
| 1039 | [EAPOL_KEY] = "EAPOL-Key", |
| 1040 | [EAPOL_ENCAP_ASF_ALERT] = "EAPOL-Encap-ASF-Alert" |
| 1041 | }; |
| 1042 | |
| 1043 | static inline const char *eap_get_type(int type) |
| 1044 | { |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1045 | return ((u32)type >= ARRAY_SIZE(eap_types)) ? "Unknown" : |
| 1046 | eap_types[type]; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1047 | } |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1048 | static inline u8 Frame_QoSTID(u8 *buf) |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1049 | { |
| 1050 | struct rtllib_hdr_3addr *hdr; |
| 1051 | u16 fc; |
Matthew Casey | 3a6b70c | 2014-08-22 06:27:52 -0400 | [diff] [blame] | 1052 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1053 | hdr = (struct rtllib_hdr_3addr *)buf; |
| 1054 | fc = le16_to_cpu(hdr->frame_ctl); |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1055 | return (u8)((union frameqos *)(buf + (((fc & RTLLIB_FCTL_TODS) && |
| 1056 | (fc & RTLLIB_FCTL_FROMDS)) ? 30 : 24)))->field.tid; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1057 | } |
| 1058 | |
| 1059 | |
| 1060 | struct eapol { |
| 1061 | u8 snap[6]; |
| 1062 | u16 ethertype; |
| 1063 | u8 version; |
| 1064 | u8 type; |
| 1065 | u16 length; |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1066 | } __packed; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1067 | |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1068 | struct rtllib_softmac_stats { |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1069 | unsigned int rx_ass_ok; |
| 1070 | unsigned int rx_ass_err; |
| 1071 | unsigned int rx_probe_rq; |
| 1072 | unsigned int tx_probe_rs; |
| 1073 | unsigned int tx_beacons; |
| 1074 | unsigned int rx_auth_rq; |
| 1075 | unsigned int rx_auth_rs_ok; |
| 1076 | unsigned int rx_auth_rs_err; |
| 1077 | unsigned int tx_auth_rq; |
| 1078 | unsigned int no_auth_rs; |
| 1079 | unsigned int no_ass_rs; |
| 1080 | unsigned int tx_ass_rq; |
| 1081 | unsigned int rx_ass_rq; |
| 1082 | unsigned int tx_probe_rq; |
| 1083 | unsigned int reassoc; |
| 1084 | unsigned int swtxstop; |
| 1085 | unsigned int swtxawake; |
| 1086 | unsigned char CurrentShowTxate; |
| 1087 | unsigned char last_packet_rate; |
| 1088 | unsigned int txretrycount; |
| 1089 | }; |
| 1090 | |
Mateusz Kulikowski | 14b40d9 | 2015-04-01 00:24:37 +0200 | [diff] [blame] | 1091 | /* These are the data types that can make up management packets |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1092 | * |
Mateusz Kulikowski | 14b40d9 | 2015-04-01 00:24:37 +0200 | [diff] [blame] | 1093 | * u16 auth_algorithm; |
| 1094 | * u16 auth_sequence; |
| 1095 | * u16 beacon_interval; |
| 1096 | * u16 capability; |
| 1097 | * u8 current_ap[ETH_ALEN]; |
| 1098 | * u16 listen_interval; |
| 1099 | * struct { |
| 1100 | * u16 association_id:14, reserved:2; |
| 1101 | * } __packed; |
| 1102 | * u32 time_stamp[2]; |
| 1103 | * u16 reason; |
| 1104 | * u16 status; |
| 1105 | */ |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1106 | |
| 1107 | #define RTLLIB_DEFAULT_TX_ESSID "Penguin" |
| 1108 | #define RTLLIB_DEFAULT_BASIC_RATE 2 |
| 1109 | |
| 1110 | enum {WMM_all_frame, WMM_two_frame, WMM_four_frame, WMM_six_frame}; |
| 1111 | #define MAX_SP_Len (WMM_all_frame << 4) |
| 1112 | #define RTLLIB_QOS_TID 0x0f |
| 1113 | #define QOS_CTL_NOTCONTAIN_ACK (0x01 << 5) |
| 1114 | |
| 1115 | #define RTLLIB_DTIM_MBCAST 4 |
| 1116 | #define RTLLIB_DTIM_UCAST 2 |
| 1117 | #define RTLLIB_DTIM_VALID 1 |
| 1118 | #define RTLLIB_DTIM_INVALID 0 |
| 1119 | |
| 1120 | #define RTLLIB_PS_DISABLED 0 |
| 1121 | #define RTLLIB_PS_UNICAST RTLLIB_DTIM_UCAST |
| 1122 | #define RTLLIB_PS_MBCAST RTLLIB_DTIM_MBCAST |
| 1123 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1124 | #define WME_AC_BK 0x00 |
| 1125 | #define WME_AC_BE 0x01 |
| 1126 | #define WME_AC_VI 0x02 |
| 1127 | #define WME_AC_VO 0x03 |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1128 | #define WME_AC_PRAM_LEN 16 |
| 1129 | |
| 1130 | #define MAX_RECEIVE_BUFFER_SIZE 9100 |
| 1131 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1132 | #define UP2AC(up) ( \ |
| 1133 | ((up) < 1) ? WME_AC_BE : \ |
| 1134 | ((up) < 3) ? WME_AC_BK : \ |
| 1135 | ((up) < 4) ? WME_AC_BE : \ |
| 1136 | ((up) < 6) ? WME_AC_VI : \ |
| 1137 | WME_AC_VO) |
Larry Finger | eccf634 | 2011-07-14 09:43:36 -0500 | [diff] [blame] | 1138 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1139 | #define ETHER_ADDR_LEN 6 /* length of an Ethernet address */ |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1140 | #define ETHERNET_HEADER_SIZE 14 /* length of two Ethernet address |
| 1141 | * plus ether type*/ |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1142 | |
Larry Finger | 3b45eb8 | 2011-07-19 20:53:13 -0500 | [diff] [blame] | 1143 | enum erp_t { |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1144 | ERP_NonERPpresent = 0x01, |
| 1145 | ERP_UseProtection = 0x02, |
| 1146 | ERP_BarkerPreambleMode = 0x04, |
Larry Finger | 3b45eb8 | 2011-07-19 20:53:13 -0500 | [diff] [blame] | 1147 | }; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1148 | |
| 1149 | struct rtllib_network { |
| 1150 | /* These entries are used to identify a unique network */ |
| 1151 | u8 bssid[ETH_ALEN]; |
| 1152 | u8 channel; |
| 1153 | /* Ensure null-terminated for any debug msgs */ |
| 1154 | u8 ssid[IW_ESSID_MAX_SIZE + 1]; |
| 1155 | u8 ssid_len; |
| 1156 | u8 hidden_ssid[IW_ESSID_MAX_SIZE + 1]; |
| 1157 | u8 hidden_ssid_len; |
| 1158 | struct rtllib_qos_data qos_data; |
| 1159 | |
| 1160 | bool bWithAironetIE; |
| 1161 | bool bCkipSupported; |
| 1162 | bool bCcxRmEnable; |
| 1163 | u16 CcxRmState[2]; |
| 1164 | bool bMBssidValid; |
| 1165 | u8 MBssidMask; |
Mateusz Kulikowski | 06c1110 | 2015-05-31 20:19:21 +0200 | [diff] [blame] | 1166 | u8 MBssid[ETH_ALEN]; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1167 | bool bWithCcxVerNum; |
| 1168 | u8 BssCcxVerNumber; |
| 1169 | /* These are network statistics */ |
| 1170 | struct rtllib_rx_stats stats; |
| 1171 | u16 capability; |
| 1172 | u8 rates[MAX_RATES_LENGTH]; |
| 1173 | u8 rates_len; |
| 1174 | u8 rates_ex[MAX_RATES_EX_LENGTH]; |
| 1175 | u8 rates_ex_len; |
| 1176 | unsigned long last_scanned; |
| 1177 | u8 mode; |
| 1178 | u32 flags; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1179 | u32 time_stamp[2]; |
| 1180 | u16 beacon_interval; |
| 1181 | u16 listen_interval; |
| 1182 | u16 atim_window; |
| 1183 | u8 erp_value; |
| 1184 | u8 wpa_ie[MAX_WPA_IE_LEN]; |
| 1185 | size_t wpa_ie_len; |
| 1186 | u8 rsn_ie[MAX_WPA_IE_LEN]; |
| 1187 | size_t rsn_ie_len; |
| 1188 | u8 wzc_ie[MAX_WZC_IE_LEN]; |
| 1189 | size_t wzc_ie_len; |
| 1190 | |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1191 | struct rtllib_tim_parameters tim; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1192 | u8 dtim_period; |
| 1193 | u8 dtim_data; |
Larry Finger | 0dd5650 | 2011-08-25 11:48:12 -0500 | [diff] [blame] | 1194 | u64 last_dtim_sta_time; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1195 | |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1196 | u8 wmm_info; |
| 1197 | struct rtllib_wmm_ac_param wmm_param[4]; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1198 | u8 Turbo_Enable; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1199 | u16 CountryIeLen; |
| 1200 | u8 CountryIeBuf[MAX_IE_LEN]; |
Larry Finger | a15e76a | 2011-07-18 20:26:49 -0500 | [diff] [blame] | 1201 | struct bss_ht bssht; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1202 | bool broadcom_cap_exist; |
| 1203 | bool realtek_cap_exit; |
| 1204 | bool marvell_cap_exist; |
| 1205 | bool ralink_cap_exist; |
| 1206 | bool atheros_cap_exist; |
| 1207 | bool cisco_cap_exist; |
| 1208 | bool airgo_cap_exist; |
| 1209 | bool unknown_cap_exist; |
| 1210 | bool berp_info_valid; |
| 1211 | bool buseprotection; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1212 | u8 SignalStrength; |
| 1213 | u8 RSSI; |
| 1214 | struct list_head list; |
| 1215 | }; |
| 1216 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1217 | enum rtllib_state { |
| 1218 | |
| 1219 | /* the card is not linked at all */ |
| 1220 | RTLLIB_NOLINK = 0, |
| 1221 | |
| 1222 | /* RTLLIB_ASSOCIATING* are for BSS client mode |
| 1223 | * the driver shall not perform RX filtering unless |
| 1224 | * the state is LINKED. |
| 1225 | * The driver shall just check for the state LINKED and |
| 1226 | * defaults to NOLINK for ALL the other states (including |
| 1227 | * LINKED_SCANNING) |
| 1228 | */ |
| 1229 | |
| 1230 | /* the association procedure will start (wq scheduling)*/ |
| 1231 | RTLLIB_ASSOCIATING, |
| 1232 | RTLLIB_ASSOCIATING_RETRY, |
| 1233 | |
| 1234 | /* the association procedure is sending AUTH request*/ |
| 1235 | RTLLIB_ASSOCIATING_AUTHENTICATING, |
| 1236 | |
Justin P. Mattock | cd01712 | 2012-04-23 07:36:52 -0700 | [diff] [blame] | 1237 | /* the association procedure has successfully authenticated |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1238 | * and is sending association request |
| 1239 | */ |
| 1240 | RTLLIB_ASSOCIATING_AUTHENTICATED, |
| 1241 | |
| 1242 | /* the link is ok. the card associated to a BSS or linked |
| 1243 | * to a ibss cell or acting as an AP and creating the bss |
| 1244 | */ |
| 1245 | RTLLIB_LINKED, |
| 1246 | |
| 1247 | /* same as LINKED, but the driver shall apply RX filter |
| 1248 | * rules as we are in NO_LINK mode. As the card is still |
| 1249 | * logically linked, but it is doing a syncro site survey |
| 1250 | * then it will be back to LINKED state. |
| 1251 | */ |
| 1252 | RTLLIB_LINKED_SCANNING, |
| 1253 | }; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1254 | |
| 1255 | #define DEFAULT_MAX_SCAN_AGE (15 * HZ) |
| 1256 | #define DEFAULT_FTS 2346 |
| 1257 | |
| 1258 | #define CFG_RTLLIB_RESERVE_FCS (1<<0) |
| 1259 | #define CFG_RTLLIB_COMPUTE_FCS (1<<1) |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1260 | |
Larry Finger | 0ce6004 | 2011-07-18 23:44:27 -0500 | [diff] [blame] | 1261 | struct tx_pending { |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1262 | int frag; |
| 1263 | struct rtllib_txb *txb; |
Larry Finger | d3b2c17 | 2011-07-19 12:50:41 -0500 | [diff] [blame] | 1264 | }; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1265 | |
Larry Finger | dca0eb1 | 2011-07-19 00:04:08 -0500 | [diff] [blame] | 1266 | struct bandwidth_autoswitch { |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1267 | long threshold_20Mhzto40Mhz; |
| 1268 | long threshold_40Mhzto20Mhz; |
| 1269 | bool bforced_tx20Mhz; |
| 1270 | bool bautoswitch_enable; |
Larry Finger | d3b2c17 | 2011-07-19 12:50:41 -0500 | [diff] [blame] | 1271 | }; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1272 | |
| 1273 | |
| 1274 | |
| 1275 | #define REORDER_WIN_SIZE 128 |
| 1276 | #define REORDER_ENTRY_NUM 128 |
Larry Finger | 8cba143 | 2011-07-18 22:16:48 -0500 | [diff] [blame] | 1277 | struct rx_reorder_entry { |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1278 | struct list_head List; |
| 1279 | u16 SeqNum; |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1280 | struct rtllib_rxb *prxb; |
Larry Finger | 8cba143 | 2011-07-18 22:16:48 -0500 | [diff] [blame] | 1281 | }; |
Larry Finger | 3c093c2 | 2011-07-19 20:54:40 -0500 | [diff] [blame] | 1282 | enum fsync_state { |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1283 | Default_Fsync, |
| 1284 | HW_Fsync, |
| 1285 | SW_Fsync |
Larry Finger | 3c093c2 | 2011-07-19 20:54:40 -0500 | [diff] [blame] | 1286 | }; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1287 | |
Larry Finger | f6e3d4f | 2011-07-19 20:56:03 -0500 | [diff] [blame] | 1288 | enum rt_ps_mode { |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1289 | eActive, |
| 1290 | eMaxPs, |
| 1291 | eFastPs, |
| 1292 | eAutoPs, |
Larry Finger | f6e3d4f | 2011-07-19 20:56:03 -0500 | [diff] [blame] | 1293 | }; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1294 | |
Larry Finger | 8304cc6 | 2011-07-19 20:57:34 -0500 | [diff] [blame] | 1295 | enum ips_callback_function { |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1296 | IPS_CALLBACK_NONE = 0, |
| 1297 | IPS_CALLBACK_MGNT_LINK_REQUEST = 1, |
| 1298 | IPS_CALLBACK_JOIN_REQUEST = 2, |
Larry Finger | 8304cc6 | 2011-07-19 20:57:34 -0500 | [diff] [blame] | 1299 | }; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1300 | |
Larry Finger | de7c885 | 2011-07-19 21:00:33 -0500 | [diff] [blame] | 1301 | enum rt_rf_power_state { |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1302 | eRfOn, |
| 1303 | eRfSleep, |
| 1304 | eRfOff |
Larry Finger | de7c885 | 2011-07-19 21:00:33 -0500 | [diff] [blame] | 1305 | }; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1306 | |
Larry Finger | ca99001 | 2011-07-18 22:06:47 -0500 | [diff] [blame] | 1307 | struct rt_pwr_save_ctrl { |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1308 | |
| 1309 | bool bInactivePs; |
| 1310 | bool bIPSModeBackup; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1311 | bool bSwRfProcessing; |
Larry Finger | de7c885 | 2011-07-19 21:00:33 -0500 | [diff] [blame] | 1312 | enum rt_rf_power_state eInactivePowerState; |
Larry Finger | 8304cc6 | 2011-07-19 20:57:34 -0500 | [diff] [blame] | 1313 | enum ips_callback_function ReturnPoint; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1314 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1315 | bool bLeisurePs; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1316 | u8 LpsIdleCount; |
| 1317 | u8 RegMaxLPSAwakeIntvl; |
| 1318 | u8 LPSAwakeIntvl; |
| 1319 | |
| 1320 | u32 CurPsLevel; |
| 1321 | u32 RegRfPsLevel; |
| 1322 | |
| 1323 | bool bFwCtrlLPS; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1324 | |
Larry Finger | d3b2c17 | 2011-07-19 12:50:41 -0500 | [diff] [blame] | 1325 | }; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1326 | |
Larry Finger | 9de9f96 | 2011-07-19 21:17:25 -0500 | [diff] [blame] | 1327 | #define RT_RF_CHANGE_SOURCE u32 |
| 1328 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1329 | #define RF_CHANGE_BY_SW BIT31 |
| 1330 | #define RF_CHANGE_BY_HW BIT30 |
| 1331 | #define RF_CHANGE_BY_PS BIT29 |
| 1332 | #define RF_CHANGE_BY_IPS BIT28 |
| 1333 | #define RF_CHANGE_BY_INIT 0 |
| 1334 | |
Larry Finger | 569e595 | 2011-07-19 21:03:26 -0500 | [diff] [blame] | 1335 | enum country_code_type { |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1336 | COUNTRY_CODE_FCC = 0, |
| 1337 | COUNTRY_CODE_IC = 1, |
| 1338 | COUNTRY_CODE_ETSI = 2, |
| 1339 | COUNTRY_CODE_SPAIN = 3, |
| 1340 | COUNTRY_CODE_FRANCE = 4, |
| 1341 | COUNTRY_CODE_MKK = 5, |
| 1342 | COUNTRY_CODE_MKK1 = 6, |
| 1343 | COUNTRY_CODE_ISRAEL = 7, |
| 1344 | COUNTRY_CODE_TELEC = 8, |
| 1345 | COUNTRY_CODE_MIC = 9, |
| 1346 | COUNTRY_CODE_GLOBAL_DOMAIN = 10, |
| 1347 | COUNTRY_CODE_WORLD_WIDE_13 = 11, |
| 1348 | COUNTRY_CODE_TELEC_NETGEAR = 12, |
| 1349 | COUNTRY_CODE_MAX |
Larry Finger | 569e595 | 2011-07-19 21:03:26 -0500 | [diff] [blame] | 1350 | }; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1351 | |
Larry Finger | 472ba32 | 2011-07-19 21:04:56 -0500 | [diff] [blame] | 1352 | enum scan_op_backup_opt { |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1353 | SCAN_OPT_BACKUP = 0, |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1354 | SCAN_OPT_RESTORE, |
| 1355 | SCAN_OPT_MAX |
Larry Finger | 472ba32 | 2011-07-19 21:04:56 -0500 | [diff] [blame] | 1356 | }; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1357 | |
Larry Finger | 74082c9 | 2011-07-19 21:06:24 -0500 | [diff] [blame] | 1358 | enum fw_cmd_io_type { |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1359 | FW_CMD_DIG_ENABLE = 0, |
| 1360 | FW_CMD_DIG_DISABLE = 1, |
| 1361 | FW_CMD_DIG_HALT = 2, |
| 1362 | FW_CMD_DIG_RESUME = 3, |
| 1363 | FW_CMD_HIGH_PWR_ENABLE = 4, |
| 1364 | FW_CMD_HIGH_PWR_DISABLE = 5, |
| 1365 | FW_CMD_RA_RESET = 6, |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1366 | FW_CMD_RA_ACTIVE = 7, |
| 1367 | FW_CMD_RA_REFRESH_N = 8, |
| 1368 | FW_CMD_RA_REFRESH_BG = 9, |
| 1369 | FW_CMD_RA_INIT = 10, |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1370 | FW_CMD_IQK_ENABLE = 11, |
| 1371 | FW_CMD_TXPWR_TRACK_ENABLE = 12, |
| 1372 | FW_CMD_TXPWR_TRACK_DISABLE = 13, |
| 1373 | FW_CMD_TXPWR_TRACK_THERMAL = 14, |
| 1374 | FW_CMD_PAUSE_DM_BY_SCAN = 15, |
| 1375 | FW_CMD_RESUME_DM_BY_SCAN = 16, |
| 1376 | FW_CMD_RA_REFRESH_N_COMB = 17, |
| 1377 | FW_CMD_RA_REFRESH_BG_COMB = 18, |
| 1378 | FW_CMD_ANTENNA_SW_ENABLE = 19, |
| 1379 | FW_CMD_ANTENNA_SW_DISABLE = 20, |
| 1380 | FW_CMD_TX_FEEDBACK_CCX_ENABLE = 21, |
| 1381 | FW_CMD_LPS_ENTER = 22, |
| 1382 | FW_CMD_LPS_LEAVE = 23, |
Larry Finger | 74082c9 | 2011-07-19 21:06:24 -0500 | [diff] [blame] | 1383 | }; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1384 | |
| 1385 | #define RT_MAX_LD_SLOT_NUM 10 |
Larry Finger | 0e86753 | 2011-07-18 22:08:19 -0500 | [diff] [blame] | 1386 | struct rt_link_detect { |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1387 | |
| 1388 | u32 NumRecvBcnInPeriod; |
| 1389 | u32 NumRecvDataInPeriod; |
| 1390 | |
| 1391 | u32 RxBcnNum[RT_MAX_LD_SLOT_NUM]; |
| 1392 | u32 RxDataNum[RT_MAX_LD_SLOT_NUM]; |
| 1393 | u16 SlotNum; |
| 1394 | u16 SlotIndex; |
| 1395 | |
| 1396 | u32 NumTxOkInPeriod; |
| 1397 | u32 NumRxOkInPeriod; |
| 1398 | u32 NumRxUnicastOkInPeriod; |
| 1399 | bool bBusyTraffic; |
| 1400 | bool bHigherBusyTraffic; |
| 1401 | bool bHigherBusyRxTraffic; |
Larry Finger | d3b2c17 | 2011-07-19 12:50:41 -0500 | [diff] [blame] | 1402 | }; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1403 | |
Larry Finger | 5ea0448 | 2011-07-18 22:09:44 -0500 | [diff] [blame] | 1404 | struct sw_cam_table { |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1405 | |
Mateusz Kulikowski | 06c1110 | 2015-05-31 20:19:21 +0200 | [diff] [blame] | 1406 | u8 macaddr[ETH_ALEN]; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1407 | bool bused; |
| 1408 | u8 key_buf[16]; |
| 1409 | u16 key_type; |
| 1410 | u8 useDK; |
| 1411 | u8 key_index; |
| 1412 | |
Larry Finger | d3b2c17 | 2011-07-19 12:50:41 -0500 | [diff] [blame] | 1413 | }; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1414 | #define TOTAL_CAM_ENTRY 32 |
Larry Finger | 9be6f10 | 2011-07-19 00:09:03 -0500 | [diff] [blame] | 1415 | struct rate_adaptive { |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1416 | u8 rate_adaptive_disabled; |
| 1417 | u8 ratr_state; |
| 1418 | u16 reserve; |
| 1419 | |
| 1420 | u32 high_rssi_thresh_for_ra; |
| 1421 | u32 high2low_rssi_thresh_for_ra; |
| 1422 | u8 low2high_rssi_thresh_for_ra40M; |
| 1423 | u32 low_rssi_thresh_for_ra40M; |
| 1424 | u8 low2high_rssi_thresh_for_ra20M; |
| 1425 | u32 low_rssi_thresh_for_ra20M; |
| 1426 | u32 upper_rssi_threshold_ratr; |
| 1427 | u32 middle_rssi_threshold_ratr; |
| 1428 | u32 low_rssi_threshold_ratr; |
| 1429 | u32 low_rssi_threshold_ratr_40M; |
| 1430 | u32 low_rssi_threshold_ratr_20M; |
| 1431 | u8 ping_rssi_enable; |
| 1432 | u32 ping_rssi_ratr; |
| 1433 | u32 ping_rssi_thresh_for_ra; |
| 1434 | u32 last_ratr; |
| 1435 | u8 PreRATRState; |
| 1436 | |
Larry Finger | 9be6f10 | 2011-07-19 00:09:03 -0500 | [diff] [blame] | 1437 | }; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1438 | |
| 1439 | #define NUM_PMKID_CACHE 16 |
Larry Finger | 74d0497 | 2011-07-18 22:11:20 -0500 | [diff] [blame] | 1440 | struct rt_pmkid_list { |
Mateusz Kulikowski | 06c1110 | 2015-05-31 20:19:21 +0200 | [diff] [blame] | 1441 | u8 Bssid[ETH_ALEN]; |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1442 | u8 PMKID[16]; |
| 1443 | u8 SsidBuf[33]; |
Mateusz Kulikowski | 06c1110 | 2015-05-31 20:19:21 +0200 | [diff] [blame] | 1444 | u8 bUsed; |
Larry Finger | 74d0497 | 2011-07-18 22:11:20 -0500 | [diff] [blame] | 1445 | }; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1446 | |
Larry Finger | ca39405 | 2011-07-18 22:13:13 -0500 | [diff] [blame] | 1447 | struct rt_intel_promisc_mode { |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1448 | bool bPromiscuousOn; |
| 1449 | bool bFilterSourceStationFrame; |
Larry Finger | ca39405 | 2011-07-18 22:13:13 -0500 | [diff] [blame] | 1450 | }; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1451 | |
| 1452 | |
| 1453 | /*************** DRIVER STATUS *****/ |
| 1454 | #define STATUS_SCANNING 0 |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1455 | /*************** DRIVER STATUS *****/ |
| 1456 | |
| 1457 | enum { |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1458 | LPS_IS_WAKE = 0, |
| 1459 | LPS_IS_SLEEP = 1, |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1460 | LPS_WAIT_NULL_DATA_SEND = 2, |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1461 | }; |
| 1462 | |
| 1463 | struct rtllib_device { |
| 1464 | struct pci_dev *pdev; |
| 1465 | struct net_device *dev; |
| 1466 | struct rtllib_security sec; |
| 1467 | |
| 1468 | bool disable_mgnt_queue; |
| 1469 | |
| 1470 | unsigned long status; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1471 | u8 CntAfterLink; |
| 1472 | |
Larry Finger | e93e0f6 | 2011-07-19 20:24:49 -0500 | [diff] [blame] | 1473 | enum rt_op_mode OpMode; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1474 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1475 | /* The last AssocReq/Resp IEs */ |
| 1476 | u8 *assocreq_ies, *assocresp_ies; |
| 1477 | size_t assocreq_ies_len, assocresp_ies_len; |
| 1478 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1479 | bool bForcedBgMode; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1480 | u8 RF_Type; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1481 | |
| 1482 | u8 hwsec_active; |
| 1483 | bool is_silent_reset; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1484 | bool is_roaming; |
| 1485 | bool ieee_up; |
| 1486 | bool cannot_notify; |
| 1487 | bool bSupportRemoteWakeUp; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1488 | bool actscanning; |
| 1489 | bool FirstIe_InScan; |
| 1490 | bool be_scan_inprogress; |
| 1491 | bool beinretry; |
Larry Finger | de7c885 | 2011-07-19 21:00:33 -0500 | [diff] [blame] | 1492 | enum rt_rf_power_state eRFPowerState; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1493 | RT_RF_CHANGE_SOURCE RfOffReason; |
| 1494 | bool is_set_key; |
| 1495 | bool wx_set_enc; |
Larry Finger | 7796d93 | 2011-07-18 20:22:19 -0500 | [diff] [blame] | 1496 | struct rt_hi_throughput *pHTInfo; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1497 | |
| 1498 | spinlock_t reorder_spinlock; |
| 1499 | u8 Regdot11HTOperationalRateSet[16]; |
| 1500 | u8 Regdot11TxHTOperationalRateSet[16]; |
| 1501 | u8 dot11HTOperationalRateSet[16]; |
| 1502 | u8 RegHTSuppRateSet[16]; |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1503 | u8 HTCurrentOperaRate; |
| 1504 | u8 HTHighestOperaRate; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1505 | u8 bTxDisableRateFallBack; |
| 1506 | u8 bTxUseDriverAssingedRate; |
| 1507 | u8 bTxEnableFwCalcDur; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1508 | atomic_t atm_swbw; |
| 1509 | |
| 1510 | struct list_head Tx_TS_Admit_List; |
| 1511 | struct list_head Tx_TS_Pending_List; |
| 1512 | struct list_head Tx_TS_Unused_List; |
Larry Finger | 60554f2 | 2011-07-18 20:10:03 -0500 | [diff] [blame] | 1513 | struct tx_ts_record TxTsRecord[TOTAL_TS_NUM]; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1514 | struct list_head Rx_TS_Admit_List; |
| 1515 | struct list_head Rx_TS_Pending_List; |
| 1516 | struct list_head Rx_TS_Unused_List; |
Larry Finger | 2c47ae2 | 2011-07-18 20:11:56 -0500 | [diff] [blame] | 1517 | struct rx_ts_record RxTsRecord[TOTAL_TS_NUM]; |
Larry Finger | 8cba143 | 2011-07-18 22:16:48 -0500 | [diff] [blame] | 1518 | struct rx_reorder_entry RxReorderEntry[128]; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1519 | struct list_head RxReorder_Unused_List; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1520 | |
| 1521 | |
| 1522 | /* Bookkeeping structures */ |
| 1523 | struct net_device_stats stats; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1524 | struct rtllib_softmac_stats softmac_stats; |
| 1525 | |
| 1526 | /* Probe / Beacon management */ |
| 1527 | struct list_head network_free_list; |
| 1528 | struct list_head network_list; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1529 | struct rtllib_network *networks; |
| 1530 | int scans; |
| 1531 | int scan_age; |
| 1532 | |
| 1533 | int iw_mode; /* operating mode (IW_MODE_*) */ |
| 1534 | bool bNetPromiscuousMode; |
Larry Finger | ca39405 | 2011-07-18 22:13:13 -0500 | [diff] [blame] | 1535 | struct rt_intel_promisc_mode IntelPromiscuousModeInfo; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1536 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1537 | spinlock_t lock; |
| 1538 | spinlock_t wpax_suitlist_lock; |
| 1539 | |
| 1540 | int tx_headroom; /* Set to size of any additional room needed at front |
Mateusz Kulikowski | 14b40d9 | 2015-04-01 00:24:37 +0200 | [diff] [blame] | 1541 | * of allocated Tx SKBs |
| 1542 | */ |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1543 | u32 config; |
| 1544 | |
| 1545 | /* WEP and other encryption related settings at the device level */ |
| 1546 | int open_wep; /* Set to 1 to allow unencrypted frames */ |
| 1547 | int auth_mode; |
| 1548 | int reset_on_keychange; /* Set to 1 if the HW needs to be reset on |
Mateusz Kulikowski | 14b40d9 | 2015-04-01 00:24:37 +0200 | [diff] [blame] | 1549 | * WEP key changes |
| 1550 | */ |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1551 | |
| 1552 | /* If the host performs {en,de}cryption, then set to 1 */ |
| 1553 | int host_encrypt; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1554 | int host_decrypt; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1555 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1556 | int ieee802_1x; /* is IEEE 802.1X used */ |
| 1557 | |
| 1558 | /* WPA data */ |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1559 | bool bHalfWirelessN24GMode; |
| 1560 | int wpa_enabled; |
| 1561 | int drop_unencrypted; |
| 1562 | int tkip_countermeasures; |
| 1563 | int privacy_invoked; |
| 1564 | size_t wpa_ie_len; |
| 1565 | u8 *wpa_ie; |
| 1566 | size_t wps_ie_len; |
| 1567 | u8 *wps_ie; |
Mateusz Kulikowski | 06c1110 | 2015-05-31 20:19:21 +0200 | [diff] [blame] | 1568 | u8 ap_mac_addr[ETH_ALEN]; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1569 | u16 pairwise_key_type; |
| 1570 | u16 group_key_type; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1571 | |
Sean MacLennan | 0ddcf5f | 2011-12-19 23:21:41 -0500 | [diff] [blame] | 1572 | struct lib80211_crypt_info crypt_info; |
| 1573 | |
Larry Finger | 5ea0448 | 2011-07-18 22:09:44 -0500 | [diff] [blame] | 1574 | struct sw_cam_table swcamtable[TOTAL_CAM_ENTRY]; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1575 | |
Larry Finger | 74d0497 | 2011-07-18 22:11:20 -0500 | [diff] [blame] | 1576 | struct rt_pmkid_list PMKIDList[NUM_PMKID_CACHE]; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1577 | |
| 1578 | /* Fragmentation structures */ |
| 1579 | struct rtllib_frag_entry frag_cache[17][RTLLIB_FRAG_CACHE_LEN]; |
| 1580 | unsigned int frag_next_idx[17]; |
| 1581 | u16 fts; /* Fragmentation Threshold */ |
| 1582 | #define DEFAULT_RTS_THRESHOLD 2346U |
| 1583 | #define MIN_RTS_THRESHOLD 1 |
| 1584 | #define MAX_RTS_THRESHOLD 2346U |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1585 | u16 rts; /* RTS threshold */ |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1586 | |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1587 | /* Association info */ |
| 1588 | u8 bssid[ETH_ALEN]; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1589 | |
| 1590 | /* This stores infos for the current network. |
| 1591 | * Either the network we are associated in INFRASTRUCTURE |
| 1592 | * or the network that we are creating in MASTER mode. |
| 1593 | * ad-hoc is a mixture ;-). |
| 1594 | * Note that in infrastructure mode, even when not associated, |
| 1595 | * fields bssid and essid may be valid (if wpa_set and essid_set |
| 1596 | * are true) as thy carry the value set by the user via iwconfig |
| 1597 | */ |
| 1598 | struct rtllib_network current_network; |
| 1599 | |
| 1600 | enum rtllib_state state; |
| 1601 | |
| 1602 | int short_slot; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1603 | int mode; /* A, B, G */ |
| 1604 | int modulation; /* CCK, OFDM */ |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1605 | |
| 1606 | /* used for forcing the ibss workqueue to terminate |
| 1607 | * without wait for the syncro scan to terminate |
| 1608 | */ |
| 1609 | short sync_scan_hurryup; |
| 1610 | u16 scan_watch_dog; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1611 | |
| 1612 | /* map of allowed channels. 0 is dummy */ |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1613 | void *pDot11dInfo; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1614 | bool bGlobalDomain; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1615 | u8 active_channel_map[MAX_CHANNEL_NUMBER+1]; |
| 1616 | |
| 1617 | u8 IbssStartChnl; |
| 1618 | u8 ibss_maxjoin_chal; |
| 1619 | |
| 1620 | int rate; /* current rate */ |
| 1621 | int basic_rate; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1622 | |
| 1623 | short active_scan; |
| 1624 | |
| 1625 | /* this contains flags for selectively enable softmac support */ |
| 1626 | u16 softmac_features; |
| 1627 | |
| 1628 | /* if the sequence control field is not filled by HW */ |
| 1629 | u16 seq_ctrl[5]; |
| 1630 | |
| 1631 | /* association procedure transaction sequence number */ |
| 1632 | u16 associate_seq; |
| 1633 | |
| 1634 | /* AID for RTXed association responses */ |
| 1635 | u16 assoc_id; |
| 1636 | |
| 1637 | /* power save mode related*/ |
| 1638 | u8 ack_tx_to_ieee; |
| 1639 | short ps; |
| 1640 | short sta_sleep; |
| 1641 | int ps_timeout; |
| 1642 | int ps_period; |
| 1643 | struct tasklet_struct ps_task; |
Larry Finger | 0dd5650 | 2011-08-25 11:48:12 -0500 | [diff] [blame] | 1644 | u64 ps_time; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1645 | bool polling; |
| 1646 | |
| 1647 | short raw_tx; |
| 1648 | /* used if IEEE_SOFTMAC_TX_QUEUE is set */ |
| 1649 | short queue_stop; |
Mateusz Kulikowski | dc986e3 | 2015-03-17 00:00:49 +0100 | [diff] [blame] | 1650 | short scanning_continue; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1651 | short proto_started; |
| 1652 | short proto_stoppping; |
| 1653 | |
Binoy Jayan | 9afa937 | 2016-06-01 14:56:52 +0530 | [diff] [blame] | 1654 | struct mutex wx_mutex; |
Binoy Jayan | be10cee | 2016-06-01 14:56:55 +0530 | [diff] [blame] | 1655 | struct mutex scan_mutex; |
Binoy Jayan | 38bee76 | 2016-06-01 14:56:56 +0530 | [diff] [blame] | 1656 | struct mutex ips_mutex; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1657 | |
| 1658 | spinlock_t mgmt_tx_lock; |
| 1659 | spinlock_t beacon_lock; |
| 1660 | |
| 1661 | short beacon_txing; |
| 1662 | |
| 1663 | short wap_set; |
| 1664 | short ssid_set; |
| 1665 | |
| 1666 | /* set on initialization */ |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1667 | unsigned int wmm_acm; |
| 1668 | |
| 1669 | /* for discarding duplicated packets in IBSS */ |
| 1670 | struct list_head ibss_mac_hash[IEEE_IBSS_MAC_HASH_SIZE]; |
| 1671 | |
| 1672 | /* for discarding duplicated packets in BSS */ |
| 1673 | u16 last_rxseq_num[17]; /* rx seq previous per-tid */ |
| 1674 | u16 last_rxfrag_num[17];/* tx frag previous per-tid */ |
| 1675 | unsigned long last_packet_time[17]; |
| 1676 | |
| 1677 | /* for PS mode */ |
| 1678 | unsigned long last_rx_ps_time; |
| 1679 | bool bAwakePktSent; |
| 1680 | u8 LPSDelayCnt; |
| 1681 | |
| 1682 | /* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */ |
| 1683 | struct sk_buff *mgmt_queue_ring[MGMT_QUEUE_NUM]; |
| 1684 | int mgmt_queue_head; |
| 1685 | int mgmt_queue_tail; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1686 | u8 AsocRetryCount; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1687 | struct sk_buff_head skb_waitQ[MAX_QUEUE_SIZE]; |
| 1688 | struct sk_buff_head skb_aggQ[MAX_QUEUE_SIZE]; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1689 | |
| 1690 | bool bdynamic_txpower_enable; |
| 1691 | |
| 1692 | bool bCTSToSelfEnable; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1693 | |
| 1694 | u32 fsync_time_interval; |
| 1695 | u32 fsync_rate_bitmap; |
| 1696 | u8 fsync_rssi_threshold; |
| 1697 | bool bfsync_enable; |
| 1698 | |
| 1699 | u8 fsync_multiple_timeinterval; |
| 1700 | u32 fsync_firstdiff_ratethreshold; |
| 1701 | u32 fsync_seconddiff_ratethreshold; |
Larry Finger | 3c093c2 | 2011-07-19 20:54:40 -0500 | [diff] [blame] | 1702 | enum fsync_state fsync_state; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1703 | bool bis_any_nonbepkts; |
Larry Finger | dca0eb1 | 2011-07-19 00:04:08 -0500 | [diff] [blame] | 1704 | struct bandwidth_autoswitch bandwidth_auto_switch; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1705 | bool FwRWRF; |
| 1706 | |
Larry Finger | 0e86753 | 2011-07-18 22:08:19 -0500 | [diff] [blame] | 1707 | struct rt_link_detect LinkDetectInfo; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1708 | bool bIsAggregateFrame; |
Larry Finger | ca99001 | 2011-07-18 22:06:47 -0500 | [diff] [blame] | 1709 | struct rt_pwr_save_ctrl PowerSaveControl; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1710 | |
| 1711 | /* used if IEEE_SOFTMAC_TX_QUEUE is set */ |
Larry Finger | 0ce6004 | 2011-07-18 23:44:27 -0500 | [diff] [blame] | 1712 | struct tx_pending tx_pending; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1713 | |
| 1714 | /* used if IEEE_SOFTMAC_ASSOCIATE is set */ |
| 1715 | struct timer_list associate_timer; |
| 1716 | |
| 1717 | /* used if IEEE_SOFTMAC_BEACONS is set */ |
| 1718 | struct timer_list beacon_timer; |
| 1719 | u8 need_sw_enc; |
Larry Finger | edc4b2c | 2011-07-19 00:46:24 -0500 | [diff] [blame] | 1720 | struct work_struct associate_complete_wq; |
| 1721 | struct work_struct ips_leave_wq; |
| 1722 | struct delayed_work associate_procedure_wq; |
| 1723 | struct delayed_work softmac_scan_wq; |
Larry Finger | edc4b2c | 2011-07-19 00:46:24 -0500 | [diff] [blame] | 1724 | struct delayed_work associate_retry_wq; |
| 1725 | struct delayed_work start_ibss_wq; |
| 1726 | struct delayed_work hw_wakeup_wq; |
| 1727 | struct delayed_work hw_sleep_wq; |
| 1728 | struct delayed_work link_change_wq; |
| 1729 | struct work_struct wx_sync_scan_wq; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1730 | |
Larry Finger | 2eed3de | 2011-09-01 12:23:20 -0500 | [diff] [blame] | 1731 | union { |
| 1732 | struct rtllib_rxb *RfdArray[REORDER_WIN_SIZE]; |
| 1733 | struct rtllib_rxb *stats_IndicateArray[REORDER_WIN_SIZE]; |
| 1734 | struct rtllib_rxb *prxbIndicateArray[REORDER_WIN_SIZE]; |
| 1735 | struct { |
| 1736 | struct sw_chnl_cmd PreCommonCmd[MAX_PRECMD_CNT]; |
| 1737 | struct sw_chnl_cmd PostCommonCmd[MAX_POSTCMD_CNT]; |
| 1738 | struct sw_chnl_cmd RfDependCmd[MAX_RFDEPENDCMD_CNT]; |
| 1739 | }; |
| 1740 | }; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1741 | |
| 1742 | /* Callback functions */ |
| 1743 | void (*set_security)(struct net_device *dev, |
| 1744 | struct rtllib_security *sec); |
| 1745 | |
| 1746 | /* Used to TX data frame by using txb structs. |
| 1747 | * this is not used if in the softmac_features |
| 1748 | * is set the flag IEEE_SOFTMAC_TX_QUEUE |
| 1749 | */ |
| 1750 | int (*hard_start_xmit)(struct rtllib_txb *txb, |
| 1751 | struct net_device *dev); |
| 1752 | |
| 1753 | int (*reset_port)(struct net_device *dev); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1754 | |
Masanari Iida | db2c8da | 2012-08-10 01:37:31 +0900 | [diff] [blame] | 1755 | /* Softmac-generated frames (management) are TXed via this |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1756 | * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is |
| 1757 | * not set. As some cards may have different HW queues that |
| 1758 | * one might want to use for data and management frames |
| 1759 | * the option to have two callbacks might be useful. |
Masanari Iida | db2c8da | 2012-08-10 01:37:31 +0900 | [diff] [blame] | 1760 | * This function can't sleep. |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1761 | */ |
| 1762 | int (*softmac_hard_start_xmit)(struct sk_buff *skb, |
| 1763 | struct net_device *dev); |
| 1764 | |
| 1765 | /* used instead of hard_start_xmit (not softmac_hard_start_xmit) |
| 1766 | * if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data |
Justin P. Mattock | cd01712 | 2012-04-23 07:36:52 -0700 | [diff] [blame] | 1767 | * frames. If the option IEEE_SOFTMAC_SINGLE_QUEUE is also set |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1768 | * then also management frames are sent via this callback. |
| 1769 | * This function can't sleep. |
| 1770 | */ |
| 1771 | void (*softmac_data_hard_start_xmit)(struct sk_buff *skb, |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1772 | struct net_device *dev, int rate); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1773 | |
| 1774 | /* stops the HW queue for DATA frames. Useful to avoid |
| 1775 | * waste time to TX data frame when we are reassociating |
| 1776 | * This function can sleep. |
| 1777 | */ |
| 1778 | void (*data_hard_stop)(struct net_device *dev); |
| 1779 | |
Justin P. Mattock | cd01712 | 2012-04-23 07:36:52 -0700 | [diff] [blame] | 1780 | /* OK this is complementing to data_poll_hard_stop */ |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1781 | void (*data_hard_resume)(struct net_device *dev); |
| 1782 | |
Mateusz Kulikowski | 14b40d9 | 2015-04-01 00:24:37 +0200 | [diff] [blame] | 1783 | /* ask to the driver to retune the radio. |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1784 | * This function can sleep. the driver should ensure |
Justin P. Mattock | cd01712 | 2012-04-23 07:36:52 -0700 | [diff] [blame] | 1785 | * the radio has been switched before return. |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1786 | */ |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1787 | void (*set_chan)(struct net_device *dev, short ch); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1788 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1789 | void (*rtllib_start_hw_scan)(struct net_device *dev); |
| 1790 | void (*rtllib_stop_hw_scan)(struct net_device *dev); |
| 1791 | |
| 1792 | /* indicate the driver that the link state is changed |
| 1793 | * for example it may indicate the card is associated now. |
| 1794 | * Driver might be interested in this to apply RX filter |
| 1795 | * rules or simply light the LINK led |
| 1796 | */ |
| 1797 | void (*link_change)(struct net_device *dev); |
| 1798 | |
| 1799 | /* these two function indicates to the HW when to start |
| 1800 | * and stop to send beacons. This is used when the |
| 1801 | * IEEE_SOFTMAC_BEACONS is not set. For now the |
| 1802 | * stop_send_bacons is NOT guaranteed to be called only |
| 1803 | * after start_send_beacons. |
| 1804 | */ |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1805 | void (*start_send_beacons)(struct net_device *dev); |
| 1806 | void (*stop_send_beacons)(struct net_device *dev); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1807 | |
| 1808 | /* power save mode related */ |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1809 | void (*sta_wake_up)(struct net_device *dev); |
| 1810 | void (*enter_sleep_state)(struct net_device *dev, u64 time); |
| 1811 | short (*ps_is_queue_empty)(struct net_device *dev); |
| 1812 | int (*handle_beacon)(struct net_device *dev, |
| 1813 | struct rtllib_beacon *beacon, |
| 1814 | struct rtllib_network *network); |
| 1815 | int (*handle_assoc_response)(struct net_device *dev, |
| 1816 | struct rtllib_assoc_response_frame *resp, |
| 1817 | struct rtllib_network *network); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1818 | |
| 1819 | |
Justin P. Mattock | cd01712 | 2012-04-23 07:36:52 -0700 | [diff] [blame] | 1820 | /* check whether Tx hw resource available */ |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1821 | short (*check_nic_enough_desc)(struct net_device *dev, int queue_index); |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1822 | void (*SetBWModeHandler)(struct net_device *dev, |
| 1823 | enum ht_channel_width Bandwidth, |
| 1824 | enum ht_extchnl_offset Offset); |
| 1825 | bool (*GetNmodeSupportBySecCfg)(struct net_device *dev); |
| 1826 | void (*SetWirelessMode)(struct net_device *dev, u8 wireless_mode); |
| 1827 | bool (*GetHalfNmodeSupportByAPsHandler)(struct net_device *dev); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1828 | u8 (*rtllib_ap_sec_type)(struct rtllib_device *ieee); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1829 | void (*InitialGainHandler)(struct net_device *dev, u8 Operation); |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1830 | bool (*SetFwCmdHandler)(struct net_device *dev, |
| 1831 | enum fw_cmd_io_type FwCmdIO); |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1832 | void (*UpdateBeaconInterruptHandler)(struct net_device *dev, |
| 1833 | bool start); |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1834 | void (*ScanOperationBackupHandler)(struct net_device *dev, |
| 1835 | u8 Operation); |
| 1836 | void (*LedControlHandler)(struct net_device *dev, |
| 1837 | enum led_ctl_mode LedAction); |
| 1838 | void (*SetHwRegHandler)(struct net_device *dev, u8 variable, u8 *val); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1839 | |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1840 | void (*AllowAllDestAddrHandler)(struct net_device *dev, |
| 1841 | bool bAllowAllDA, bool WriteIntoReg); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1842 | |
Melike Yurtoglu | 042b623 | 2014-09-30 20:43:16 +0300 | [diff] [blame] | 1843 | void (*rtllib_ips_leave_wq)(struct net_device *dev); |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1844 | void (*rtllib_ips_leave)(struct net_device *dev); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1845 | void (*LeisurePSLeave)(struct net_device *dev); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1846 | |
| 1847 | /* This must be the last item so that it points to the data |
Mateusz Kulikowski | 14b40d9 | 2015-04-01 00:24:37 +0200 | [diff] [blame] | 1848 | * allocated beyond this structure by alloc_rtllib |
| 1849 | */ |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1850 | u8 priv[0]; |
| 1851 | }; |
| 1852 | |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1853 | #define IEEE_A (1<<0) |
| 1854 | #define IEEE_B (1<<1) |
| 1855 | #define IEEE_G (1<<2) |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1856 | #define IEEE_N_24G (1<<4) |
| 1857 | #define IEEE_N_5G (1<<5) |
| 1858 | #define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G) |
| 1859 | |
| 1860 | /* Generate a 802.11 header */ |
| 1861 | |
| 1862 | /* Uses the channel change callback directly |
| 1863 | * instead of [start/stop] scan callbacks |
| 1864 | */ |
| 1865 | #define IEEE_SOFTMAC_SCAN (1<<2) |
| 1866 | |
| 1867 | /* Perform authentication and association handshake */ |
| 1868 | #define IEEE_SOFTMAC_ASSOCIATE (1<<3) |
| 1869 | |
| 1870 | /* Generate probe requests */ |
| 1871 | #define IEEE_SOFTMAC_PROBERQ (1<<4) |
| 1872 | |
Justin P. Mattock | cd01712 | 2012-04-23 07:36:52 -0700 | [diff] [blame] | 1873 | /* Generate response to probe requests */ |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1874 | #define IEEE_SOFTMAC_PROBERS (1<<5) |
| 1875 | |
Justin P. Mattock | cd01712 | 2012-04-23 07:36:52 -0700 | [diff] [blame] | 1876 | /* The ieee802.11 stack will manage the netif queue |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1877 | * wake/stop for the driver, taking care of 802.11 |
Mateusz Kulikowski | 14b40d9 | 2015-04-01 00:24:37 +0200 | [diff] [blame] | 1878 | * fragmentation. See softmac.c for details. |
| 1879 | */ |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1880 | #define IEEE_SOFTMAC_TX_QUEUE (1<<7) |
| 1881 | |
| 1882 | /* Uses only the softmac_data_hard_start_xmit |
| 1883 | * even for TX management frames. |
| 1884 | */ |
| 1885 | #define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8) |
| 1886 | |
| 1887 | /* Generate beacons. The stack will enqueue beacons |
| 1888 | * to the card |
| 1889 | */ |
| 1890 | #define IEEE_SOFTMAC_BEACONS (1<<6) |
| 1891 | |
| 1892 | |
| 1893 | static inline void *rtllib_priv(struct net_device *dev) |
| 1894 | { |
| 1895 | return ((struct rtllib_device *)netdev_priv(dev))->priv; |
| 1896 | } |
| 1897 | |
Peter Huewe | 9d8a20a | 2012-10-29 22:18:05 +0100 | [diff] [blame] | 1898 | static inline int rtllib_is_empty_essid(const char *essid, int essid_len) |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1899 | { |
| 1900 | /* Single white space is for Linksys APs */ |
| 1901 | if (essid_len == 1 && essid[0] == ' ') |
| 1902 | return 1; |
| 1903 | |
| 1904 | /* Otherwise, if the entire essid is 0, we assume it is hidden */ |
| 1905 | while (essid_len) { |
| 1906 | essid_len--; |
| 1907 | if (essid[essid_len] != '\0') |
| 1908 | return 0; |
| 1909 | } |
| 1910 | |
| 1911 | return 1; |
| 1912 | } |
| 1913 | |
Peter Huewe | 9d8a20a | 2012-10-29 22:18:05 +0100 | [diff] [blame] | 1914 | static inline int rtllib_get_hdrlen(u16 fc) |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1915 | { |
| 1916 | int hdrlen = RTLLIB_3ADDR_LEN; |
| 1917 | |
| 1918 | switch (WLAN_FC_GET_TYPE(fc)) { |
| 1919 | case RTLLIB_FTYPE_DATA: |
| 1920 | if ((fc & RTLLIB_FCTL_FROMDS) && (fc & RTLLIB_FCTL_TODS)) |
| 1921 | hdrlen = RTLLIB_4ADDR_LEN; /* Addr4 */ |
| 1922 | if (RTLLIB_QOS_HAS_SEQ(fc)) |
| 1923 | hdrlen += 2; /* QOS ctrl*/ |
| 1924 | break; |
| 1925 | case RTLLIB_FTYPE_CTL: |
| 1926 | switch (WLAN_FC_GET_STYPE(fc)) { |
| 1927 | case RTLLIB_STYPE_CTS: |
| 1928 | case RTLLIB_STYPE_ACK: |
| 1929 | hdrlen = RTLLIB_1ADDR_LEN; |
| 1930 | break; |
| 1931 | default: |
| 1932 | hdrlen = RTLLIB_2ADDR_LEN; |
| 1933 | break; |
| 1934 | } |
| 1935 | break; |
| 1936 | } |
| 1937 | |
| 1938 | return hdrlen; |
| 1939 | } |
| 1940 | |
| 1941 | static inline u8 *rtllib_get_payload(struct rtllib_hdr *hdr) |
| 1942 | { |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1943 | switch (rtllib_get_hdrlen(le16_to_cpu(hdr->frame_ctl))) { |
| 1944 | case RTLLIB_1ADDR_LEN: |
| 1945 | return ((struct rtllib_hdr_1addr *)hdr)->payload; |
| 1946 | case RTLLIB_2ADDR_LEN: |
| 1947 | return ((struct rtllib_hdr_2addr *)hdr)->payload; |
| 1948 | case RTLLIB_3ADDR_LEN: |
| 1949 | return ((struct rtllib_hdr_3addr *)hdr)->payload; |
| 1950 | case RTLLIB_4ADDR_LEN: |
| 1951 | return ((struct rtllib_hdr_4addr *)hdr)->payload; |
| 1952 | } |
| 1953 | return NULL; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1954 | } |
| 1955 | |
| 1956 | static inline int rtllib_is_ofdm_rate(u8 rate) |
| 1957 | { |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1958 | switch (rate & ~RTLLIB_BASIC_RATE_MASK) { |
| 1959 | case RTLLIB_OFDM_RATE_6MB: |
| 1960 | case RTLLIB_OFDM_RATE_9MB: |
| 1961 | case RTLLIB_OFDM_RATE_12MB: |
| 1962 | case RTLLIB_OFDM_RATE_18MB: |
| 1963 | case RTLLIB_OFDM_RATE_24MB: |
| 1964 | case RTLLIB_OFDM_RATE_36MB: |
| 1965 | case RTLLIB_OFDM_RATE_48MB: |
| 1966 | case RTLLIB_OFDM_RATE_54MB: |
| 1967 | return 1; |
| 1968 | } |
| 1969 | return 0; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1970 | } |
| 1971 | |
| 1972 | static inline int rtllib_is_cck_rate(u8 rate) |
| 1973 | { |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 1974 | switch (rate & ~RTLLIB_BASIC_RATE_MASK) { |
| 1975 | case RTLLIB_CCK_RATE_1MB: |
| 1976 | case RTLLIB_CCK_RATE_2MB: |
| 1977 | case RTLLIB_CCK_RATE_5MB: |
| 1978 | case RTLLIB_CCK_RATE_11MB: |
| 1979 | return 1; |
| 1980 | } |
| 1981 | return 0; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1982 | } |
| 1983 | |
| 1984 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1985 | /* rtllib.c */ |
Joe Perches | ee233d3 | 2015-08-10 14:51:29 -0700 | [diff] [blame] | 1986 | void free_rtllib(struct net_device *dev); |
| 1987 | struct net_device *alloc_rtllib(int sizeof_priv); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1988 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1989 | /* rtllib_tx.c */ |
| 1990 | |
Joe Perches | ee233d3 | 2015-08-10 14:51:29 -0700 | [diff] [blame] | 1991 | int rtllib_encrypt_fragment( |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1992 | struct rtllib_device *ieee, |
| 1993 | struct sk_buff *frag, |
| 1994 | int hdr_len); |
| 1995 | |
Joe Perches | ee233d3 | 2015-08-10 14:51:29 -0700 | [diff] [blame] | 1996 | int rtllib_xmit(struct sk_buff *skb, struct net_device *dev); |
| 1997 | void rtllib_txb_free(struct rtllib_txb *); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 1998 | |
| 1999 | /* rtllib_rx.c */ |
Joe Perches | ee233d3 | 2015-08-10 14:51:29 -0700 | [diff] [blame] | 2000 | int rtllib_rx(struct rtllib_device *ieee, struct sk_buff *skb, |
| 2001 | struct rtllib_rx_stats *rx_stats); |
| 2002 | void rtllib_rx_probe_rq(struct rtllib_device *ieee, |
| 2003 | struct sk_buff *skb); |
| 2004 | int rtllib_legal_channel(struct rtllib_device *rtllib, u8 channel); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2005 | |
| 2006 | /* rtllib_wx.c */ |
Joe Perches | ee233d3 | 2015-08-10 14:51:29 -0700 | [diff] [blame] | 2007 | int rtllib_wx_get_scan(struct rtllib_device *ieee, |
| 2008 | struct iw_request_info *info, |
| 2009 | union iwreq_data *wrqu, char *key); |
| 2010 | int rtllib_wx_set_encode(struct rtllib_device *ieee, |
| 2011 | struct iw_request_info *info, |
| 2012 | union iwreq_data *wrqu, char *key); |
| 2013 | int rtllib_wx_get_encode(struct rtllib_device *ieee, |
| 2014 | struct iw_request_info *info, |
| 2015 | union iwreq_data *wrqu, char *key); |
| 2016 | int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, |
| 2017 | struct iw_request_info *info, |
| 2018 | union iwreq_data *wrqu, char *extra); |
| 2019 | int rtllib_wx_set_auth(struct rtllib_device *ieee, |
| 2020 | struct iw_request_info *info, |
| 2021 | struct iw_param *data, char *extra); |
| 2022 | int rtllib_wx_set_mlme(struct rtllib_device *ieee, |
| 2023 | struct iw_request_info *info, |
| 2024 | union iwreq_data *wrqu, char *extra); |
| 2025 | int rtllib_wx_set_gen_ie(struct rtllib_device *ieee, u8 *ie, size_t len); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2026 | |
| 2027 | /* rtllib_softmac.c */ |
Joe Perches | ee233d3 | 2015-08-10 14:51:29 -0700 | [diff] [blame] | 2028 | int rtllib_rx_frame_softmac(struct rtllib_device *ieee, struct sk_buff *skb, |
| 2029 | struct rtllib_rx_stats *rx_stats, u16 type, |
| 2030 | u16 stype); |
| 2031 | void rtllib_softmac_new_net(struct rtllib_device *ieee, |
| 2032 | struct rtllib_network *net); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2033 | |
| 2034 | void SendDisassociation(struct rtllib_device *ieee, bool deauth, u16 asRsn); |
Joe Perches | ee233d3 | 2015-08-10 14:51:29 -0700 | [diff] [blame] | 2035 | void rtllib_softmac_xmit(struct rtllib_txb *txb, struct rtllib_device *ieee); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2036 | |
Joe Perches | ee233d3 | 2015-08-10 14:51:29 -0700 | [diff] [blame] | 2037 | void rtllib_stop_send_beacons(struct rtllib_device *ieee); |
| 2038 | void notify_wx_assoc_event(struct rtllib_device *ieee); |
| 2039 | void rtllib_start_ibss(struct rtllib_device *ieee); |
| 2040 | void rtllib_softmac_init(struct rtllib_device *ieee); |
| 2041 | void rtllib_softmac_free(struct rtllib_device *ieee); |
| 2042 | void rtllib_disassociate(struct rtllib_device *ieee); |
| 2043 | void rtllib_stop_scan(struct rtllib_device *ieee); |
| 2044 | bool rtllib_act_scanning(struct rtllib_device *ieee, bool sync_scan); |
| 2045 | void rtllib_stop_scan_syncro(struct rtllib_device *ieee); |
| 2046 | void rtllib_start_scan_syncro(struct rtllib_device *ieee, u8 is_mesh); |
| 2047 | void rtllib_sta_ps_send_null_frame(struct rtllib_device *ieee, short pwr); |
| 2048 | void rtllib_sta_ps_send_pspoll_frame(struct rtllib_device *ieee); |
| 2049 | void rtllib_start_protocol(struct rtllib_device *ieee); |
| 2050 | void rtllib_stop_protocol(struct rtllib_device *ieee, u8 shutdown); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2051 | |
Joe Perches | ee233d3 | 2015-08-10 14:51:29 -0700 | [diff] [blame] | 2052 | void rtllib_EnableNetMonitorMode(struct net_device *dev, bool bInitState); |
| 2053 | void rtllib_DisableNetMonitorMode(struct net_device *dev, bool bInitState); |
| 2054 | void rtllib_EnableIntelPromiscuousMode(struct net_device *dev, bool bInitState); |
| 2055 | void rtllib_DisableIntelPromiscuousMode(struct net_device *dev, |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 2056 | bool bInitState); |
Joe Perches | ee233d3 | 2015-08-10 14:51:29 -0700 | [diff] [blame] | 2057 | void rtllib_softmac_stop_protocol(struct rtllib_device *ieee, |
| 2058 | u8 mesh_flag, u8 shutdown); |
| 2059 | void rtllib_softmac_start_protocol(struct rtllib_device *ieee, u8 mesh_flag); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2060 | |
Joe Perches | ee233d3 | 2015-08-10 14:51:29 -0700 | [diff] [blame] | 2061 | void rtllib_reset_queue(struct rtllib_device *ieee); |
| 2062 | void rtllib_wake_all_queues(struct rtllib_device *ieee); |
| 2063 | void rtllib_stop_all_queues(struct rtllib_device *ieee); |
| 2064 | struct sk_buff *rtllib_get_beacon(struct rtllib_device *ieee); |
| 2065 | void rtllib_start_send_beacons(struct rtllib_device *ieee); |
| 2066 | void rtllib_stop_send_beacons(struct rtllib_device *ieee); |
| 2067 | int rtllib_wpa_supplicant_ioctl(struct rtllib_device *ieee, |
| 2068 | struct iw_point *p, u8 is_mesh); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2069 | |
Joe Perches | ee233d3 | 2015-08-10 14:51:29 -0700 | [diff] [blame] | 2070 | void notify_wx_assoc_event(struct rtllib_device *ieee); |
| 2071 | void rtllib_ps_tx_ack(struct rtllib_device *ieee, short success); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2072 | |
Joe Perches | ee233d3 | 2015-08-10 14:51:29 -0700 | [diff] [blame] | 2073 | void softmac_mgmt_xmit(struct sk_buff *skb, struct rtllib_device *ieee); |
| 2074 | u8 rtllib_ap_sec_type(struct rtllib_device *ieee); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2075 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2076 | /* rtllib_softmac_wx.c */ |
| 2077 | |
Joe Perches | ee233d3 | 2015-08-10 14:51:29 -0700 | [diff] [blame] | 2078 | int rtllib_wx_get_wap(struct rtllib_device *ieee, struct iw_request_info *info, |
| 2079 | union iwreq_data *wrqu, char *ext); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2080 | |
Joe Perches | ee233d3 | 2015-08-10 14:51:29 -0700 | [diff] [blame] | 2081 | int rtllib_wx_set_wap(struct rtllib_device *ieee, struct iw_request_info *info, |
| 2082 | union iwreq_data *awrq, char *extra); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2083 | |
Joe Perches | ee233d3 | 2015-08-10 14:51:29 -0700 | [diff] [blame] | 2084 | int rtllib_wx_get_essid(struct rtllib_device *ieee, struct iw_request_info *a, |
| 2085 | union iwreq_data *wrqu, char *b); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2086 | |
Joe Perches | ee233d3 | 2015-08-10 14:51:29 -0700 | [diff] [blame] | 2087 | int rtllib_wx_set_rate(struct rtllib_device *ieee, struct iw_request_info *info, |
| 2088 | union iwreq_data *wrqu, char *extra); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2089 | |
Joe Perches | ee233d3 | 2015-08-10 14:51:29 -0700 | [diff] [blame] | 2090 | int rtllib_wx_get_rate(struct rtllib_device *ieee, struct iw_request_info *info, |
| 2091 | union iwreq_data *wrqu, char *extra); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2092 | |
Joe Perches | ee233d3 | 2015-08-10 14:51:29 -0700 | [diff] [blame] | 2093 | int rtllib_wx_set_mode(struct rtllib_device *ieee, struct iw_request_info *a, |
| 2094 | union iwreq_data *wrqu, char *b); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2095 | |
Joe Perches | ee233d3 | 2015-08-10 14:51:29 -0700 | [diff] [blame] | 2096 | int rtllib_wx_set_scan(struct rtllib_device *ieee, struct iw_request_info *a, |
| 2097 | union iwreq_data *wrqu, char *b); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2098 | |
Joe Perches | ee233d3 | 2015-08-10 14:51:29 -0700 | [diff] [blame] | 2099 | int rtllib_wx_set_essid(struct rtllib_device *ieee, struct iw_request_info *a, |
| 2100 | union iwreq_data *wrqu, char *extra); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2101 | |
Joe Perches | ee233d3 | 2015-08-10 14:51:29 -0700 | [diff] [blame] | 2102 | int rtllib_wx_get_mode(struct rtllib_device *ieee, struct iw_request_info *a, |
| 2103 | union iwreq_data *wrqu, char *b); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2104 | |
Joe Perches | ee233d3 | 2015-08-10 14:51:29 -0700 | [diff] [blame] | 2105 | int rtllib_wx_set_freq(struct rtllib_device *ieee, struct iw_request_info *a, |
| 2106 | union iwreq_data *wrqu, char *b); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2107 | |
Joe Perches | ee233d3 | 2015-08-10 14:51:29 -0700 | [diff] [blame] | 2108 | int rtllib_wx_get_freq(struct rtllib_device *ieee, struct iw_request_info *a, |
| 2109 | union iwreq_data *wrqu, char *b); |
| 2110 | void rtllib_wx_sync_scan_wq(void *data); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2111 | |
Joe Perches | ee233d3 | 2015-08-10 14:51:29 -0700 | [diff] [blame] | 2112 | int rtllib_wx_set_rawtx(struct rtllib_device *ieee, |
| 2113 | struct iw_request_info *info, |
| 2114 | union iwreq_data *wrqu, char *extra); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2115 | |
Joe Perches | ee233d3 | 2015-08-10 14:51:29 -0700 | [diff] [blame] | 2116 | int rtllib_wx_get_name(struct rtllib_device *ieee, struct iw_request_info *info, |
| 2117 | union iwreq_data *wrqu, char *extra); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2118 | |
Joe Perches | ee233d3 | 2015-08-10 14:51:29 -0700 | [diff] [blame] | 2119 | int rtllib_wx_set_power(struct rtllib_device *ieee, |
| 2120 | struct iw_request_info *info, |
| 2121 | union iwreq_data *wrqu, char *extra); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2122 | |
Joe Perches | ee233d3 | 2015-08-10 14:51:29 -0700 | [diff] [blame] | 2123 | int rtllib_wx_get_power(struct rtllib_device *ieee, |
| 2124 | struct iw_request_info *info, |
| 2125 | union iwreq_data *wrqu, char *extra); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2126 | |
Joe Perches | ee233d3 | 2015-08-10 14:51:29 -0700 | [diff] [blame] | 2127 | int rtllib_wx_set_rts(struct rtllib_device *ieee, struct iw_request_info *info, |
| 2128 | union iwreq_data *wrqu, char *extra); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2129 | |
Joe Perches | ee233d3 | 2015-08-10 14:51:29 -0700 | [diff] [blame] | 2130 | int rtllib_wx_get_rts(struct rtllib_device *ieee, struct iw_request_info *info, |
| 2131 | union iwreq_data *wrqu, char *extra); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2132 | #define MAX_RECEIVE_BUFFER_SIZE 9100 |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2133 | |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 2134 | void HTSetConnectBwMode(struct rtllib_device *ieee, |
| 2135 | enum ht_channel_width Bandwidth, |
| 2136 | enum ht_extchnl_offset Offset); |
Joe Perches | ee233d3 | 2015-08-10 14:51:29 -0700 | [diff] [blame] | 2137 | void HTUpdateDefaultSetting(struct rtllib_device *ieee); |
| 2138 | void HTConstructCapabilityElement(struct rtllib_device *ieee, |
| 2139 | u8 *posHTCap, u8 *len, |
| 2140 | u8 isEncrypt, bool bAssoc); |
| 2141 | void HTConstructInfoElement(struct rtllib_device *ieee, |
| 2142 | u8 *posHTInfo, u8 *len, u8 isEncrypt); |
| 2143 | void HTConstructRT2RTAggElement(struct rtllib_device *ieee, |
| 2144 | u8 *posRT2RTAgg, u8 *len); |
| 2145 | void HTOnAssocRsp(struct rtllib_device *ieee); |
| 2146 | void HTInitializeHTInfo(struct rtllib_device *ieee); |
| 2147 | void HTInitializeBssDesc(struct bss_ht *pBssHT); |
| 2148 | void HTResetSelfAndSavePeerSetting(struct rtllib_device *ieee, |
| 2149 | struct rtllib_network *pNetwork); |
| 2150 | void HT_update_self_and_peer_setting(struct rtllib_device *ieee, |
| 2151 | struct rtllib_network *pNetwork); |
| 2152 | u8 HTGetHighestMCSRate(struct rtllib_device *ieee, u8 *pMCSRateSet, |
| 2153 | u8 *pMCSFilter); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2154 | extern u8 MCS_FILTER_ALL[]; |
Mateusz Kulikowski | dc986e3 | 2015-03-17 00:00:49 +0100 | [diff] [blame] | 2155 | extern u16 MCS_DATA_RATE[2][2][77]; |
Joe Perches | ee233d3 | 2015-08-10 14:51:29 -0700 | [diff] [blame] | 2156 | u8 HTCCheck(struct rtllib_device *ieee, u8 *pFrame); |
| 2157 | void HTResetIOTSetting(struct rt_hi_throughput *pHTInfo); |
| 2158 | bool IsHTHalfNmodeAPs(struct rtllib_device *ieee); |
| 2159 | u16 TxCountToDataRate(struct rtllib_device *ieee, u8 nDataRate); |
| 2160 | int rtllib_rx_ADDBAReq(struct rtllib_device *ieee, struct sk_buff *skb); |
| 2161 | int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb); |
| 2162 | int rtllib_rx_DELBA(struct rtllib_device *ieee, struct sk_buff *skb); |
| 2163 | void TsInitAddBA(struct rtllib_device *ieee, struct tx_ts_record *pTS, |
| 2164 | u8 Policy, u8 bOverwritePending); |
| 2165 | void TsInitDelBA(struct rtllib_device *ieee, |
| 2166 | struct ts_common_info *pTsCommonInfo, |
| 2167 | enum tr_select TxRxSelect); |
| 2168 | void BaSetupTimeOut(unsigned long data); |
| 2169 | void TxBaInactTimeout(unsigned long data); |
| 2170 | void RxBaInactTimeout(unsigned long data); |
| 2171 | void ResetBaEntry(struct ba_record *pBA); |
| 2172 | bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS, u8 *Addr, |
| 2173 | u8 TID, enum tr_select TxRxSelect, bool bAddNewTs); |
| 2174 | void TSInitialize(struct rtllib_device *ieee); |
| 2175 | void TsStartAddBaProcess(struct rtllib_device *ieee, |
| 2176 | struct tx_ts_record *pTxTS); |
| 2177 | void RemovePeerTS(struct rtllib_device *ieee, u8 *Addr); |
| 2178 | void RemoveAllTS(struct rtllib_device *ieee); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2179 | |
| 2180 | extern const long rtllib_wlan_frequencies[]; |
| 2181 | |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 2182 | static inline const char *escape_essid(const char *essid, u8 essid_len) |
| 2183 | { |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2184 | static char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2185 | |
| 2186 | if (rtllib_is_empty_essid(essid, essid_len)) { |
| 2187 | memcpy(escaped, "<hidden>", sizeof("<hidden>")); |
| 2188 | return escaped; |
| 2189 | } |
| 2190 | |
Andy Shevchenko | 50d5e53 | 2014-10-13 15:55:31 -0700 | [diff] [blame] | 2191 | snprintf(escaped, sizeof(escaped), "%*pEn", essid_len, essid); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2192 | return escaped; |
| 2193 | } |
| 2194 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2195 | /* fun with the built-in rtllib stack... */ |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 2196 | bool rtllib_MgntDisconnect(struct rtllib_device *rtllib, u8 asRsn); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2197 | |
| 2198 | |
| 2199 | /* For the function is more related to hardware setting, it's better to use the |
| 2200 | * ieee handler to refer to it. |
| 2201 | */ |
Joe Perches | ee233d3 | 2015-08-10 14:51:29 -0700 | [diff] [blame] | 2202 | void rtllib_FlushRxTsPendingPkts(struct rtllib_device *ieee, |
| 2203 | struct rx_ts_record *pTS); |
| 2204 | int rtllib_parse_info_param(struct rtllib_device *ieee, |
| 2205 | struct rtllib_info_element *info_element, |
| 2206 | u16 length, |
| 2207 | struct rtllib_network *network, |
| 2208 | struct rtllib_rx_stats *stats); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2209 | |
Larry Finger | 8567829 | 2011-08-25 11:48:24 -0500 | [diff] [blame] | 2210 | void rtllib_indicate_packets(struct rtllib_device *ieee, |
| 2211 | struct rtllib_rxb **prxbIndicateArray, u8 index); |
Joe Perches | ee233d3 | 2015-08-10 14:51:29 -0700 | [diff] [blame] | 2212 | void HTUseDefaultSetting(struct rtllib_device *ieee); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2213 | #define RT_ASOC_RETRY_LIMIT 5 |
| 2214 | u8 MgntQuery_TxRateExcludeCCKRates(struct rtllib_device *ieee); |
Sean MacLennan | 3b148be | 2011-12-19 23:23:08 -0500 | [diff] [blame] | 2215 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 2216 | #endif /* RTLLIB_H */ |