300c89c3daf53499ef60cb101b77f871b4e674c8
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rockchip_wlan / mt5931_kk / drv_wlan / include / mgmt / bss.h
1 /*
2 ** $Id: @(#) bss.h
3 */
4
5 /*! \file   "bss.h"
6     \brief  In this file we define the function prototype used in BSS/IBSS.
7
8     The file contains the function declarations and defines for used in BSS/IBSS.
9 */
10
11 /*******************************************************************************
12 * Copyright (c) 2010 MediaTek Inc.
13 *
14 * All rights reserved. Copying, compilation, modification, distribution
15 * or any other use whatsoever of this material is strictly prohibited
16 * except in accordance with a Software License Agreement with
17 * MediaTek Inc.
18 ********************************************************************************
19 */
20
21 /*******************************************************************************
22 * LEGAL DISCLAIMER
23 *
24 * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND
25 * AGREES THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK
26 * SOFTWARE") RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE
27 * PROVIDED TO BUYER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY
28 * DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT
29 * LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
30 * PARTICULAR PURPOSE OR NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE
31 * ANY WARRANTY WHATSOEVER WITH RESPECT TO THE SOFTWARE OF ANY THIRD PARTY
32 * WHICH MAY BE USED BY, INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK
33 * SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY
34 * WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE
35 * FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S SPECIFICATION OR TO
36 * CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
37 *
38 * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
39 * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL
40 * BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT
41 * ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY
42 * BUYER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
43 *
44 * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
45 * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT
46 * OF LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING
47 * THEREOF AND RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN
48 * FRANCISCO, CA, UNDER THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE
49 * (ICC).
50 ********************************************************************************
51 */
52
53 /*
54 ** $Log: bss.h $
55  *
56  * 07 17 2012 yuche.tsai
57  * NULL
58  * Let netdev bring up.
59  *
60  * 07 17 2012 yuche.tsai
61  * NULL
62  * Compile no error before trial run.
63  *
64  * 03 02 2012 terry.wu
65  * NULL
66  * Sync CFG80211 modification from branch 2,2.
67  *
68  * 09 14 2011 yuche.tsai
69  * NULL
70  * Add P2P IE in assoc response.
71  *
72  * 03 19 2011 yuche.tsai
73  * [WCXRP00000581] [Volunteer Patch][MT6620][Driver] P2P IE in Assoc Req Issue
74  * Make assoc req to append P2P IE if wifi direct is enabled.
75  *
76  * 03 02 2011 wh.su
77  * [WCXRP00000448] [MT6620 Wi-Fi][Driver] Fixed WSC IE not send out at probe request
78  * Add code to send beacon and probe response WSC IE at Auto GO.
79  *
80  * 02 23 2011 eddie.chen
81  * [WCXRP00000463] [MT6620 Wi-Fi][FW/Driver][Hotspot] Cannot update WMM PS STA's partital bitmap
82  * Fix parsing WMM INFO and bmp delivery bitmap definition.
83  *
84  * 01 31 2011 george.huang
85  * [WCXRP00000333] [MT5931][FW] support SRAM power control drivers
86  * Extend TIM PVB, from 2 to 3 octets.
87  *
88  * 11 29 2010 cp.wu
89  * [WCXRP00000210] [MT6620 Wi-Fi][Driver][FW] Set RCPI value in STA_REC for initial TX rate selection of auto-rate algorithm
90  * update ucRcpi of STA_RECORD_T for AIS when
91  * 1) Beacons for IBSS merge is received
92  * 2) Associate Response for a connecting peer is received
93  *
94  * 09 03 2010 kevin.huang
95  * NULL
96  * Refine #include sequence and solve recursive/nested #include issue
97  *
98  * 08 12 2010 kevin.huang
99  * NULL
100  * Update bssProcessProbeRequest() and bssSendBeaconProbeResponse() declarations
101  *
102  * 07 19 2010 cp.wu
103  *
104  * [WPD00003833] [MT6620 and MT5931] Driver migration.
105  * when IBSS is being merged-in, send command packet to PM for connected indication
106  *
107  * 07 08 2010 cp.wu
108  *
109  * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
110  *
111  * 06 25 2010 george.huang
112  * [WPD00001556]Basic power managemenet function
113  * Create beacon update path, with expose bssUpdateBeaconContent()
114  *
115  * 06 17 2010 yuche.tsai
116  * [WPD00003839][MT6620 5931][P2P] Feature migration
117  * Add CTRL FLAGS for Probe Response.
118  *
119  * 06 09 2010 cp.wu
120  * [WPD00003833][MT6620 and MT5931] Driver migration
121  * add necessary changes to driver data paths.
122  *
123  * 06 07 2010 cp.wu
124  * [WPD00003833][MT6620 and MT5931] Driver migration
125  * add aa_fsm.h, ais_fsm.h, bss.h, mib.h and scan.h.
126  *
127  * 06 04 2010 george.huang
128  * [BORA00000678][MT6620]WiFi LP integration
129  * [PM] Support U-APSD for STA mode
130  *
131  * 05 28 2010 kevin.huang
132  * [BORA00000794][WIFISYS][New Feature]Power Management Support
133  * Add ClientList handling API - bssClearClientList, bssAddStaRecToClientList
134  *
135  * 05 14 2010 kevin.huang
136  * [BORA00000794][WIFISYS][New Feature]Power Management Support
137  * Remove unused typedef.
138  *
139  * 05 12 2010 kevin.huang
140  * [BORA00000794][WIFISYS][New Feature]Power Management Support
141  * Fix file merge error
142  *
143  * 05 12 2010 kevin.huang
144  * [BORA00000794][WIFISYS][New Feature]Power Management Support
145  * Add Power Management - Legacy PS-POLL support.
146  *
147  * 04 19 2010 kevin.huang
148  * [BORA00000714][WIFISYS][New Feature]Beacon Timeout Support
149  * Add Beacon Timeout Support
150  *  *  *  and will send Null frame to diagnose connection
151  *
152  * 03 16 2010 kevin.huang
153  * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support
154  * Add AdHoc Mode
155  *
156  * 02 23 2010 kevin.huang
157  * [BORA00000603][WIFISYS] [New Feature] AAA Module Support
158  * Add DTIM count update while TX Beacon
159  *
160  * 02 04 2010 kevin.huang
161  * [BORA00000603][WIFISYS] [New Feature] AAA Module Support
162  * Add AAA Module Support, Revise Net Type to Net Type Index for array lookup
163 */
164
165 #ifndef _BSS_H
166 #define _BSS_H
167
168 /*******************************************************************************
169 *                         C O M P I L E R   F L A G S
170 ********************************************************************************
171 */
172
173 /*******************************************************************************
174 *                    E X T E R N A L   R E F E R E N C E S
175 ********************************************************************************
176 */
177
178 /*******************************************************************************
179 *                              C O N S T A N T S
180 ********************************************************************************
181 */
182 //NOTE(Kevin): change define for george
183 //#define MAX_LEN_TIM_PARTIAL_BMP     (((MAX_ASSOC_ID + 1) + 7) / 8)   /* Required bits = (MAX_ASSOC_ID + 1) */
184 #define MAX_LEN_TIM_PARTIAL_BMP                     ((CFG_STA_REC_NUM + 7) / 8)  /* reserve length greater than maximum size of STA_REC */ //obsoleted: Assume we only use AID:1~15
185
186 /* CTRL FLAGS for Probe Response */
187 #define BSS_PROBE_RESP_USE_P2P_DEV_ADDR             BIT(0)
188 #define BSS_PROBE_RESP_INCLUDE_P2P_IE               BIT(1)
189
190 /*******************************************************************************
191 *                             D A T A   T Y P E S
192 ********************************************************************************
193 */
194
195 /*******************************************************************************
196 *                            P U B L I C   D A T A
197 ********************************************************************************
198 */
199
200 /*******************************************************************************
201 *                           P R I V A T E   D A T A
202 ********************************************************************************
203 */
204
205 /*******************************************************************************
206 *                                 M A C R O S
207 ********************************************************************************
208 */
209 #define bssAssignAssocID(_prStaRec)      ((_prStaRec)->ucIndex + 1)
210
211 /*******************************************************************************
212 *                   F U N C T I O N   D E C L A R A T I O N S
213 ********************************************************************************
214 */
215 /*----------------------------------------------------------------------------*/
216 /* Routines for all Operation Modes                                           */
217 /*----------------------------------------------------------------------------*/
218 P_STA_RECORD_T
219 bssCreateStaRecFromBssDesc (
220     IN P_ADAPTER_T                  prAdapter,
221     IN ENUM_STA_TYPE_T              eStaType,
222     IN ENUM_NETWORK_TYPE_INDEX_T    eNetTypeIndex,
223     IN P_BSS_DESC_T                 prBssDesc
224     );
225
226 VOID
227 bssComposeNullFrame (
228     IN P_ADAPTER_T      prAdapter,
229     IN PUINT_8          pucBuffer,
230     IN P_STA_RECORD_T   prStaRec
231     );
232
233 VOID
234 bssComposeQoSNullFrame (
235     IN P_ADAPTER_T      prAdapter,
236     IN PUINT_8          pucBuffer,
237     IN P_STA_RECORD_T   prStaRec,
238     IN UINT_8           ucUP,
239     IN BOOLEAN          fgSetEOSP
240     );
241
242 WLAN_STATUS
243 bssSendNullFrame (
244     IN P_ADAPTER_T          prAdapter,
245     IN P_STA_RECORD_T       prStaRec,
246     IN PFN_TX_DONE_HANDLER  pfTxDoneHandler
247     );
248
249 WLAN_STATUS
250 bssSendQoSNullFrame (
251     IN P_ADAPTER_T          prAdapter,
252     IN P_STA_RECORD_T       prStaRec,
253     IN UINT_8               ucUP,
254     IN PFN_TX_DONE_HANDLER  pfTxDoneHandler
255     );
256
257
258 /*----------------------------------------------------------------------------*/
259 /* Routines for both IBSS(AdHoc) and BSS(AP)                                  */
260 /*----------------------------------------------------------------------------*/
261 VOID
262 bssGenerateExtSuppRate_IE (
263     IN P_ADAPTER_T      prAdapter,
264     IN P_MSDU_INFO_T    prMsduInfo
265     );
266
267 VOID
268 bssBuildBeaconProbeRespFrameCommonIEs (
269     IN P_MSDU_INFO_T    prMsduInfo,
270     IN P_BSS_INFO_T     prBssInfo,
271     IN PUINT_8          pucDestAddr
272     );
273
274 VOID
275 bssComposeBeaconProbeRespFrameHeaderAndFF (
276     IN PUINT_8      pucBuffer,
277     IN PUINT_8      pucDestAddr,
278     IN PUINT_8      pucOwnMACAddress,
279     IN PUINT_8      pucBSSID,
280     IN UINT_16      u2BeaconInterval,
281     IN UINT_16      u2CapInfo
282     );
283
284 WLAN_STATUS
285 bssSendBeaconProbeResponse (
286     IN P_ADAPTER_T prAdapter,
287     IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex,
288     IN PUINT_8 pucDestAddr,
289     IN UINT_32 u4ControlFlags
290     );
291
292 WLAN_STATUS
293 bssProcessProbeRequest (
294     IN P_ADAPTER_T  prAdapter,
295     IN P_SW_RFB_T   prSwRfb
296     );
297
298 VOID
299 bssClearClientList (
300     IN P_ADAPTER_T  prAdapter,
301     IN P_BSS_INFO_T prBssInfo
302     );
303
304 VOID
305 bssAddStaRecToClientList (
306     IN P_ADAPTER_T  prAdapter,
307     IN P_BSS_INFO_T prBssInfo,
308     IN P_STA_RECORD_T prStaRec
309     );
310
311 VOID
312 bssRemoveStaRecFromClientList (
313     IN P_ADAPTER_T  prAdapter,
314     IN P_BSS_INFO_T prBssInfo,
315     IN P_STA_RECORD_T prStaRec
316     );
317
318
319 /*----------------------------------------------------------------------------*/
320 /* Routines for IBSS(AdHoc) only                                              */
321 /*----------------------------------------------------------------------------*/
322 VOID
323 ibssProcessMatchedBeacon (
324     IN P_ADAPTER_T  prAdapter,
325     IN P_BSS_INFO_T prBssInfo,
326     IN P_BSS_DESC_T prBssDesc,
327     IN UINT_8       ucRCPI
328     );
329
330 WLAN_STATUS
331 ibssCheckCapabilityForAdHocMode (
332     IN P_ADAPTER_T  prAdapter,
333     IN P_BSS_DESC_T prBssDesc
334     );
335
336 VOID
337 ibssInitForAdHoc (
338     IN P_ADAPTER_T  prAdapter,
339     IN P_BSS_INFO_T prBssInfo
340     );
341
342 WLAN_STATUS
343 bssUpdateBeaconContent (
344     IN P_ADAPTER_T prAdapter,
345     IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex
346     );
347
348
349 /*----------------------------------------------------------------------------*/
350 /* Routines for BSS(AP) only                                                  */
351 /*----------------------------------------------------------------------------*/
352 VOID
353 bssInitForAP (
354     IN P_ADAPTER_T  prAdapter,
355     IN P_BSS_INFO_T prBssInfo,
356     IN BOOLEAN fgIsRateUpdate
357     );
358
359 VOID
360 bssUpdateDTIMCount (
361     IN P_ADAPTER_T  prAdapter,
362     IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex
363     );
364
365 VOID
366 bssSetTIMBitmap (
367     IN P_ADAPTER_T  prAdapter,
368     IN P_BSS_INFO_T prBssInfo,
369     IN UINT_16 u2AssocId
370     );
371
372
373 /*link function to p2p module for txBcnIETable*/
374
375 /* WMM-2.2.2 WMM ACI to AC coding */
376 typedef enum _ENUM_ACI_T {
377     ACI_BE = 0,
378     ACI_BK = 1,
379     ACI_VI = 2,
380     ACI_VO = 3,
381     ACI_NUM
382 } ENUM_ACI_T, *P_ENUM_ACI_T;
383
384 typedef enum _ENUM_AC_PRIORITY_T {
385     AC_BK_PRIORITY = 0,
386     AC_BE_PRIORITY,
387     AC_VI_PRIORITY,
388     AC_VO_PRIORITY
389 } ENUM_AC_PRIORITY_T, *P_ENUM_AC_PRIORITY_T;
390
391
392 #endif /* _BSS_H */
393