]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - drivers/staging/rtl8192su/ieee80211/ieee80211_r8192s.h
staging: rtl8192su: fix compile error from wireless-testing commit
[mirror_ubuntu-artful-kernel.git] / drivers / staging / rtl8192su / ieee80211 / ieee80211_r8192s.h
1 #ifndef __IEEE80211_R8192S_H
2 #define __IEEE80211_R8192S_H
3
4 /* added for rtl819x tx procedure */
5 #define MAX_QUEUE_SIZE 0x10
6
7 /* 8190 queue mapping */
8 enum {
9 BK_QUEUE = 0,
10 BE_QUEUE = 1,
11 VI_QUEUE = 2,
12 VO_QUEUE = 3,
13 HCCA_QUEUE = 4,
14 TXCMD_QUEUE = 5,
15 MGNT_QUEUE = 6,
16 HIGH_QUEUE = 7,
17 BEACON_QUEUE = 8,
18
19 LOW_QUEUE = BE_QUEUE,
20 NORMAL_QUEUE = MGNT_QUEUE
21 };
22
23 #define SWRF_TIMEOUT 50
24
25 /* LEAP related */
26 /* Flag byte: byte 8, numbered from 0. */
27 #define IE_CISCO_FLAG_POSITION 0x08
28 #define SUPPORT_CKIP_MIC 0x08 /* bit3 */
29 #define SUPPORT_CKIP_PK 0x10 /* bit4 */
30
31 /* defined for skb cb field, at most 28 byte */
32 typedef struct cb_desc {
33 /* Tx Desc Related flags (8-9) */
34 u8 bLastIniPkt:1;
35 u8 bCmdOrInit:1;
36 u8 bFirstSeg:1;
37 u8 bLastSeg:1;
38 u8 bEncrypt:1;
39 u8 bTxDisableRateFallBack:1;
40 u8 bTxUseDriverAssingedRate:1;
41 u8 bHwSec:1; /* indicate whether use Hw security */
42
43 u8 reserved1;
44
45 /* Tx Firmware Relaged flags (10-11) */
46 u8 bCTSEnable:1;
47 u8 bRTSEnable:1;
48 u8 bUseShortGI:1;
49 u8 bUseShortPreamble:1;
50 u8 bTxEnableFwCalcDur:1;
51 u8 bAMPDUEnable:1;
52 u8 bRTSSTBC:1;
53 u8 RTSSC:1;
54
55 u8 bRTSBW:1;
56 u8 bPacketBW:1;
57 u8 bRTSUseShortPreamble:1;
58 u8 bRTSUseShortGI:1;
59 u8 bMulticast:1;
60 u8 bBroadcast:1;
61 u8 drv_agg_enable:1;
62 u8 reserved2:1;
63
64 /* Tx Desc related element(12-19) */
65 u8 rata_index;
66 u8 queue_index;
67 u16 txbuf_size;
68 u8 RATRIndex;
69 u8 reserved6;
70 u8 reserved7;
71 u8 reserved8;
72
73 /* Tx firmware related element(20-27) */
74 u8 data_rate;
75 u8 rts_rate;
76 u8 ampdu_factor;
77 u8 ampdu_density;
78 u8 DrvAggrNum;
79 u16 pkt_size;
80 u8 reserved12;
81 } cb_desc, *pcb_desc;
82
83 enum {
84 MGN_1M = 0x02,
85 MGN_2M = 0x04,
86 MGN_5_5M = 0x0b,
87 MGN_11M = 0x16,
88
89 MGN_6M = 0x0c,
90 MGN_9M = 0x12,
91 MGN_12M = 0x18,
92 MGN_18M = 0x24,
93 MGN_24M = 0x30,
94 MGN_36M = 0x48,
95 MGN_48M = 0x60,
96 MGN_54M = 0x6c,
97
98 MGN_MCS0 = 0x80,
99 MGN_MCS1 = 0x81,
100 MGN_MCS2 = 0x82,
101 MGN_MCS3 = 0x83,
102 MGN_MCS4 = 0x84,
103 MGN_MCS5 = 0x85,
104 MGN_MCS6 = 0x86,
105 MGN_MCS7 = 0x87,
106 MGN_MCS8 = 0x88,
107 MGN_MCS9 = 0x89,
108 MGN_MCS10 = 0x8a,
109 MGN_MCS11 = 0x8b,
110 MGN_MCS12 = 0x8c,
111 MGN_MCS13 = 0x8d,
112 MGN_MCS14 = 0x8e,
113 MGN_MCS15 = 0x8f,
114
115 MGN_MCS0_SG = 0x90,
116 MGN_MCS1_SG = 0x91,
117 MGN_MCS2_SG = 0x92,
118 MGN_MCS3_SG = 0x93,
119 MGN_MCS4_SG = 0x94,
120 MGN_MCS5_SG = 0x95,
121 MGN_MCS6_SG = 0x96,
122 MGN_MCS7_SG = 0x97,
123 MGN_MCS8_SG = 0x98,
124 MGN_MCS9_SG = 0x99,
125 MGN_MCS10_SG = 0x9a,
126 MGN_MCS11_SG = 0x9b,
127 MGN_MCS12_SG = 0x9c,
128 MGN_MCS13_SG = 0x9d,
129 MGN_MCS14_SG = 0x9e,
130 MGN_MCS15_SG = 0x9f,
131 };
132
133 #define FC_QOS_BIT BIT7
134
135 #define IsDataFrame(pdu) (((pdu[0] & 0x0C) == 0x08) ? true : false)
136 #define IsLegacyDataFrame(pdu) (IsDataFrame(pdu) && (!(pdu[0] & FC_QOS_BIT)))
137 #define IsQoSDataFrame(pframe) \
138 ((*(u16 *)pframe & (IEEE80211_STYPE_QOS_DATA | IEEE80211_FTYPE_DATA)) \
139 == (IEEE80211_STYPE_QOS_DATA | IEEE80211_FTYPE_DATA))
140
141 #define Frame_Order(pframe) (*(u16 *)pframe & IEEE80211_FCTL_ORDER)
142
143 #define SN_LESS(a, b) (((a - b) & 0x800) != 0)
144 #define SN_EQUAL(a, b) (a == b)
145
146 #define MAX_DEV_ADDR_SIZE 8
147
148 enum {
149 /* ACT_CATEGORY */
150 ACT_CAT_QOS = 1,
151 ACT_CAT_DLS = 2,
152 ACT_CAT_BA = 3,
153 ACT_CAT_HT = 7,
154 ACT_CAT_WMM = 17,
155
156 /* TS_ACTION */
157 ACT_ADDTSREQ = 0,
158 ACT_ADDTSRSP = 1,
159 ACT_DELTS = 2,
160 ACT_SCHEDULE = 3,
161
162 /* BA_ACTION */
163 ACT_ADDBAREQ = 0,
164 ACT_ADDBARSP = 1,
165 ACT_DELBA = 2,
166 };
167
168 /* InitialGainOpType */
169 enum {
170 IG_Backup = 0,
171 IG_Restore,
172 IG_Max
173 };
174
175 typedef enum _LED_CTL_MODE {
176 LED_CTL_POWER_ON = 1,
177 LED_CTL_LINK = 2,
178 LED_CTL_NO_LINK = 3,
179 LED_CTL_TX = 4,
180 LED_CTL_RX = 5,
181 LED_CTL_SITE_SURVEY = 6,
182 LED_CTL_POWER_OFF = 7,
183 LED_CTL_START_TO_LINK = 8,
184 LED_CTL_START_WPS = 9,
185 LED_CTL_STOP_WPS = 10,
186 LED_CTL_START_WPS_BOTTON = 11,
187 } LED_CTL_MODE;
188
189 typedef union _frameqos {
190 u16 shortdata;
191 u8 chardata[2];
192 struct {
193 u16 tid:4;
194 u16 eosp:1;
195 u16 ack_policy:2;
196 u16 reserved:1;
197 u16 txop:8;
198 } field;
199 } frameqos;
200
201 static inline u8 Frame_QoSTID(u8 *buf)
202 {
203 struct ieee80211_hdr_3addr *hdr = (struct ieee80211_hdr_3addr *)buf;
204 u16 fc = le16_to_cpu(hdr->frame_control);
205
206 return (u8)((frameqos *)(buf +
207 (((fc & IEEE80211_FCTL_TODS) &&
208 (fc & IEEE80211_FCTL_FROMDS)) ? 30 : 24)))->field.tid;
209 }
210
211 enum {
212 ERP_NonERPpresent = 1,
213 ERP_UseProtection = 2,
214 ERP_BarkerPreambleMode = 4,
215 };
216
217 struct bandwidth_autoswitch {
218 long threshold_20Mhzto40Mhz;
219 long threshold_40Mhzto20Mhz;
220 bool bforced_tx20Mhz;
221 bool bautoswitch_enable;
222 };
223
224 #define REORDER_WIN_SIZE 128
225 #define REORDER_ENTRY_NUM 128
226 typedef struct _RX_REORDER_ENTRY {
227 struct list_head List;
228 u16 SeqNum;
229 struct ieee80211_rxb *prxb;
230 } RX_REORDER_ENTRY, *PRX_REORDER_ENTRY;
231
232 typedef enum _Fsync_State{
233 Default_Fsync,
234 HW_Fsync,
235 SW_Fsync
236 } Fsync_State;
237
238 /* Power save mode configured. */
239 typedef enum _RT_PS_MODE {
240 eActive, /* Active/Continuous access. */
241 eMaxPs, /* Max power save mode. */
242 eFastPs /* Fast power save mode. */
243 } RT_PS_MODE;
244
245 typedef enum _IPS_CALLBACK_FUNCION {
246 IPS_CALLBACK_NONE = 0,
247 IPS_CALLBACK_MGNT_LINK_REQUEST = 1,
248 IPS_CALLBACK_JOIN_REQUEST = 2,
249 } IPS_CALLBACK_FUNCION;
250
251 typedef enum _RT_JOIN_ACTION {
252 RT_JOIN_INFRA = 1,
253 RT_JOIN_IBSS = 2,
254 RT_START_IBSS = 3,
255 RT_NO_ACTION = 4,
256 } RT_JOIN_ACTION;
257
258 struct ibss_parms {
259 u16 atimWin;
260 };
261
262 /* Max num of support rates element: 8, Max num of ext. support rate: 255. */
263 #define MAX_NUM_RATES 264
264
265 typedef enum _RT_RF_POWER_STATE {
266 eRfOn,
267 eRfSleep,
268 eRfOff
269 } RT_RF_POWER_STATE;
270
271 struct rt_power_save_control {
272 /* Inactive Power Save (IPS): disable RF when disconnected */
273 bool bInactivePs;
274 bool bIPSModeBackup;
275 bool bHaltAdapterClkRQ;
276 bool bSwRfProcessing;
277 RT_RF_POWER_STATE eInactivePowerState;
278 struct work_struct InactivePsWorkItem;
279 struct timer_list InactivePsTimer;
280
281 /* return point for join action */
282 IPS_CALLBACK_FUNCION ReturnPoint;
283
284 /* Recored Parameters for rescheduled JoinRequest */
285 bool bTmpBssDesc;
286 RT_JOIN_ACTION tmpJoinAction;
287 struct ieee80211_network tmpBssDesc;
288
289 /* Recored Parameters for rescheduled MgntLinkRequest */
290 bool bTmpScanOnly;
291 bool bTmpActiveScan;
292 bool bTmpFilterHiddenAP;
293 bool bTmpUpdateParms;
294 u8 tmpSsidBuf[33];
295 OCTET_STRING tmpSsid2Scan;
296 bool bTmpSsid2Scan;
297 u8 tmpNetworkType;
298 u8 tmpChannelNumber;
299 u16 tmpBcnPeriod;
300 u8 tmpDtimPeriod;
301 u16 tmpmCap;
302 OCTET_STRING tmpSuppRateSet;
303 u8 tmpSuppRateBuf[MAX_NUM_RATES];
304 bool bTmpSuppRate;
305 struct ibss_parms tmpIbpm;
306 bool bTmpIbpm;
307
308 /* Leisre Poswer Save: disable RF if connected but traffic isn't busy */
309 bool bLeisurePs;
310 u32 PowerProfile;
311 u8 LpsIdleCount;
312 u8 RegMaxLPSAwakeIntvl;
313 u8 LPSAwakeIntvl;
314
315 /* RF OFF Level */
316 u32 CurPsLevel;
317 u32 RegRfPsLevel;
318
319 /* Fw Control LPS */
320 bool bFwCtrlLPS;
321 u8 FWCtrlPSMode;
322
323 /* Record if there is a link request in IPS RF off progress. */
324 bool LinkReqInIPSRFOffPgs;
325 /*
326 * To make sure that connect info should be executed, so we set the
327 * bit to filter the link info which comes after the connect info.
328 */
329 bool BufConnectinfoBefore;
330 };
331
332 enum {
333 RF_CHANGE_BY_SW = BIT31,
334 RF_CHANGE_BY_HW = BIT30,
335 RF_CHANGE_BY_PS = BIT29,
336 RF_CHANGE_BY_IPS = BIT28,
337 };
338
339 /* Firmware related CMD IO. */
340 typedef enum _FW_CMD_IO_TYPE {
341 FW_CMD_DIG_ENABLE = 0, /* for DIG DM */
342 FW_CMD_DIG_DISABLE = 1,
343 FW_CMD_DIG_HALT = 2,
344 FW_CMD_DIG_RESUME = 3,
345 FW_CMD_HIGH_PWR_ENABLE = 4, /* for High Power DM */
346 FW_CMD_HIGH_PWR_DISABLE = 5,
347 FW_CMD_RA_RESET = 6, /* for Rate adaptive DM */
348 FW_CMD_RA_ACTIVE = 7,
349 FW_CMD_RA_REFRESH_N = 8,
350 FW_CMD_RA_REFRESH_BG = 9,
351 FW_CMD_IQK_ENABLE = 10, /* for FW supported IQK */
352 FW_CMD_TXPWR_TRACK_ENABLE = 11, /* Tx power tracking switch */
353 FW_CMD_TXPWR_TRACK_DISABLE = 12,/* Tx power tracking switch */
354 FW_CMD_PAUSE_DM_BY_SCAN = 13,
355 FW_CMD_RESUME_DM_BY_SCAN = 14,
356 FW_CMD_MID_HIGH_PWR_ENABLE = 15,
357 /* indicate firmware that driver enters LPS, for PS-Poll hardware bug */
358 FW_CMD_LPS_ENTER = 16,
359 /* indicate firmware that driver leave LPS */
360 FW_CMD_LPS_LEAVE = 17,
361 } FW_CMD_IO_TYPE;
362
363 #define RT_MAX_LD_SLOT_NUM 10
364 struct rt_link_detect {
365 u32 NumRecvBcnInPeriod;
366 u32 NumRecvDataInPeriod;
367
368 /* number of Rx beacon / CheckForHang_period to determine link status */
369 u32 RxBcnNum[RT_MAX_LD_SLOT_NUM];
370 /* number of Rx data / CheckForHang_period to determine link status */
371 u32 RxDataNum[RT_MAX_LD_SLOT_NUM];
372 /* number of CheckForHang period to determine link status */
373 u16 SlotNum;
374 u16 SlotIndex;
375
376 u32 NumTxOkInPeriod;
377 u32 NumRxOkInPeriod;
378 bool bBusyTraffic;
379 };
380
381 /* HT */
382 #define MAX_RECEIVE_BUFFER_SIZE 9100
383 extern void HTDebugHTCapability(u8 *CapIE, u8 *TitleString);
384 extern void HTDebugHTInfo(u8 *InfoIE, u8 *TitleString);
385
386 extern void HTSetConnectBwMode(struct ieee80211_device *ieee,
387 HT_CHANNEL_WIDTH Bandwidth,
388 HT_EXTCHNL_OFFSET Offset);
389 extern void HTUpdateDefaultSetting(struct ieee80211_device *ieee);
390 extern void HTConstructCapabilityElement(struct ieee80211_device *ieee,
391 u8 *posHTCap, u8 *len, u8 isEncrypt);
392 extern void HTConstructInfoElement(struct ieee80211_device *ieee,
393 u8 *posHTInfo, u8 *len, u8 isEncrypt);
394 extern void HTConstructRT2RTAggElement(struct ieee80211_device *ieee,
395 u8 *posRT2RTAgg, u8 *len);
396 extern void HTOnAssocRsp(struct ieee80211_device *ieee);
397 extern void HTInitializeHTInfo(struct ieee80211_device *ieee);
398 extern void HTInitializeBssDesc(PBSS_HT pBssHT);
399 extern void HTResetSelfAndSavePeerSetting(struct ieee80211_device *ieee,
400 struct ieee80211_network *pNetwork);
401 extern void HTUpdateSelfAndPeerSetting(struct ieee80211_device *ieee,
402 struct ieee80211_network *pNetwork);
403 extern u8 HTGetHighestMCSRate(struct ieee80211_device *ieee, u8 *pMCSRateSet,
404 u8 *pMCSFilter);
405 extern u8 MCS_FILTER_ALL[];
406 extern u16 MCS_DATA_RATE[2][2][77] ;
407 extern u8 HTCCheck(struct ieee80211_device *ieee, u8 *pFrame);
408 extern void HTResetIOTSetting(PRT_HIGH_THROUGHPUT pHTInfo);
409 extern bool IsHTHalfNmodeAPs(struct ieee80211_device *ieee);
410 extern u16 HTHalfMcsToDataRate(struct ieee80211_device *ieee, u8 nMcsRate);
411 extern u16 HTMcsToDataRate(struct ieee80211_device *ieee, u8 nMcsRate);
412 extern u16 TxCountToDataRate(struct ieee80211_device *ieee, u8 nDataRate);
413 extern int ieee80211_rx_ADDBAReq(struct ieee80211_device *ieee,
414 struct sk_buff *skb);
415 extern int ieee80211_rx_ADDBARsp(struct ieee80211_device *ieee,
416 struct sk_buff *skb);
417 extern int ieee80211_rx_DELBA(struct ieee80211_device *ieee,
418 struct sk_buff *skb);
419 extern void TsInitAddBA(struct ieee80211_device *ieee, PTX_TS_RECORD pTS,
420 u8 Policy, u8 bOverwritePending);
421 extern void TsInitDelBA(struct ieee80211_device *ieee,
422 PTS_COMMON_INFO pTsCommonInfo, TR_SELECT TxRxSelect);
423 extern void BaSetupTimeOut(unsigned long data);
424 extern void TxBaInactTimeout(unsigned long data);
425 extern void RxBaInactTimeout(unsigned long data);
426 extern void ResetBaEntry(PBA_RECORD pBA);
427 extern bool GetTs(struct ieee80211_device *ieee, PTS_COMMON_INFO *ppTS,
428 u8 *Addr, u8 TID, TR_SELECT TxRxSelect, /* Rx:1, Tx:0 */
429 bool bAddNewTs);
430 extern void TSInitialize(struct ieee80211_device *ieee);
431 extern void TsStartAddBaProcess(struct ieee80211_device *ieee,
432 PTX_TS_RECORD pTxTS);
433 extern void RemovePeerTS(struct ieee80211_device *ieee, u8 *Addr);
434 extern void RemoveAllTS(struct ieee80211_device *ieee);
435
436 #endif /* __IEEE80211_R8192S_H */