85ab71281b58f868947134904b6a59258c3111df
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rockchip_wlan / combo_mt66xx / mt6620 / wlan / include / mgmt / scan.h
1 /*
2 ** $Id: @(#)
3 */
4
5 /*! \file   "scan.h"
6     \brief
7
8 */
9
10
11
12 /*
13 ** $Log: scan.h $
14  *
15  * 01 16 2012 cp.wu
16  * [MT6620 Wi-Fi][Driver] API and behavior modification for preferred band configuration with corresponding network configuration 
17  * add wlanSetPreferBandByNetwork() for glue layer to invoke for setting preferred band configuration corresponding to network type.
18  *
19  * 08 11 2011 cp.wu
20  * [WCXRP00000830] [MT6620 Wi-Fi][Firmware] Use MDRDY counter to detect empty channel for shortening scan time
21  * sparse channel detection:
22  * driver: collect sparse channel information with scan-done event
23
24  *
25  * 07 18 2011 cp.wu
26  * [WCXRP00000858] [MT5931][Driver][Firmware] Add support for scan to search for more than one SSID in a single scanning request
27  * add framework in driver domain for supporting new SCAN_REQ_V2 for more than 1 SSID support as well as uProbeDelay in NDIS 6.x driver model
28  *
29  * 06 27 2011 cp.wu
30  * [WCXRP00000815] [MT6620 Wi-Fi][Driver] allow single BSSID with multiple SSID settings to work around some tricky AP which use space character as hidden SSID
31  * allow to have a single BSSID with multiple SSID to be presented in scanning result
32  *
33  * 04 18 2011 terry.wu
34  * [WCXRP00000660] [MT6620 Wi-Fi][Driver] Remove flag CFG_WIFI_DIRECT_MOVED
35  * Remove flag CFG_WIFI_DIRECT_MOVED.
36  *
37  * 02 09 2011 wh.su
38  * [WCXRP00000433] [MT6620 Wi-Fi][Driver] Remove WAPI structure define for avoid P2P module with structure miss-align pointer issue
39  * always pre-allio WAPI related structure for align p2p module.
40  *
41  * 01 14 2011 yuche.tsai
42  * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue
43  * Fix compile error.
44  *
45  * 09 08 2010 cp.wu
46  * NULL
47  * use static memory pool for storing IEs of scanning result.
48  *
49  * 09 03 2010 kevin.huang
50  * NULL
51  * Refine #include sequence and solve recursive/nested #include issue
52  *
53  * 08 31 2010 kevin.huang
54  * NULL
55  * Use LINK LIST operation to process SCAN result
56  *
57  * 08 30 2010 cp.wu
58  * NULL
59  * eliminate klockwork errors
60  *
61  * 08 16 2010 cp.wu
62  * NULL
63  * add interface for RLM to trigger OBSS-SCAN.
64  *
65  * 08 12 2010 yuche.tsai
66  * NULL
67  * Add a functio prototype to find p2p descriptor of a bss descriptor directly.
68  *
69  * 08 11 2010 yuche.tsai
70  * NULL
71  * Add function prototype for return channel.
72  * modify data structure for scan specific device ID or TYPE. (Move from P2P Connection Settings to Scan Param)
73  *
74  * 08 05 2010 yuche.tsai
75  * NULL
76  * Check-in P2P Device Discovery Feature.
77  *
78  * 08 02 2010 yuche.tsai
79  * NULL
80  * P2P Group Negotiation Code Check in.
81  *
82  * 07 26 2010 yuche.tsai
83  *
84  * Add a option for channel time extention in scan abort command.
85  *
86  * 07 21 2010 yuche.tsai
87  *
88  * Add for P2P Scan Result Parsing & Saving.
89  *
90  * 07 19 2010 yuche.tsai
91  *
92  * Scan status "FIND" is used for P2P FSM find state.
93  *
94  * 07 19 2010 cp.wu
95  *
96  * [WPD00003833] [MT6620 and MT5931] Driver migration.
97  * SCN module is now able to handle multiple concurrent scanning requests
98  *
99  * 07 14 2010 cp.wu
100  *
101  * [WPD00003833] [MT6620 and MT5931] Driver migration.
102  * pass band with channel number information as scan parameter
103  *
104  * 07 14 2010 cp.wu
105  *
106  * [WPD00003833] [MT6620 and MT5931] Driver migration.
107  * remove timer in DRV-SCN.
108  *
109  * 07 09 2010 cp.wu
110  *
111  * 1) separate AIS_FSM state for two kinds of scanning. (OID triggered scan, and scan-for-connection)
112  * 2) eliminate PRE_BSS_DESC_T, Beacon/PrebResp is now parsed in single pass
113  * 3) implment DRV-SCN module, currently only accepts single scan request, other request will be directly dropped by returning BUSY
114  *
115  * 07 08 2010 cp.wu
116  *
117  * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
118  *
119  * 07 01 2010 cp.wu
120  * [WPD00003833][MT6620 and MT5931] Driver migration
121  * add scan uninitialization procedure
122  *
123  * 07 01 2010 cp.wu
124  * [WPD00003833][MT6620 and MT5931] Driver migration
125  * implementation of DRV-SCN and related mailbox message handling.
126  *
127  * 06 25 2010 cp.wu
128  * [WPD00003833][MT6620 and MT5931] Driver migration
129  * modify Beacon/ProbeResp to complete parsing,
130  * because host software has looser memory usage restriction
131  *
132  * 06 17 2010 yuche.tsai
133  * [WPD00003839][MT6620 5931][P2P] Feature migration
134  * Add P2P related field in SCAN_PARAM_T.
135  *
136  * 06 14 2010 cp.wu
137  * [WPD00003833][MT6620 and MT5931] Driver migration
138  * saa_fsm.c is migrated.
139  *
140  * 06 14 2010 cp.wu
141  * [WPD00003833][MT6620 and MT5931] Driver migration
142  * add management dispatching function table.
143  *
144  * 06 14 2010 cp.wu
145  * [WPD00003833][MT6620 and MT5931] Driver migration
146  * restore utility function invoking via hem_mbox to direct calls
147  *
148  * 06 11 2010 cp.wu
149  * [WPD00003833][MT6620 and MT5931] Driver migration
150  * auth.c is migrated.
151  *
152  * 06 10 2010 cp.wu
153  * [WPD00003833][MT6620 and MT5931] Driver migration
154  * add buildable & linkable ais_fsm.c
155  *
156  * related reference are still waiting to be resolved
157  *
158  * 06 07 2010 cp.wu
159  * [WPD00003833][MT6620 and MT5931] Driver migration
160  * add aa_fsm.h, ais_fsm.h, bss.h, mib.h and scan.h.
161  *
162  * 05 12 2010 kevin.huang
163  * [BORA00000794][WIFISYS][New Feature]Power Management Support
164  * Add Power Management - Legacy PS-POLL support.
165  *
166  * 04 13 2010 kevin.huang
167  * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support
168  *
169  * Add new HW CH macro support
170  *
171  * 03 16 2010 kevin.huang
172  * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support
173  * Add AdHoc Mode
174  *
175  * 03 10 2010 kevin.huang
176  * [BORA00000654][WIFISYS][New Feature] CNM Module - Ch Manager Support
177  *
178  *  *  *  *  *  * Add Channel Manager for arbitration of JOIN and SCAN Req
179  *
180  * 02 26 2010 kevin.huang
181  * [BORA00000603][WIFISYS] [New Feature] AAA Module Support
182  * Modify scanBuildProbeReqFrameCommonIEs() to support P2P SCAN
183  *
184  * 02 23 2010 wh.su
185  * [BORA00000592][MT6620 Wi-Fi] Adding the security related code for driver
186  * refine the scan procedure, reduce the WPA and WAPI IE parsing, and move the parsing to the time for join.
187  *
188  * 02 23 2010 kevin.huang
189  * [BORA00000603][WIFISYS] [New Feature] AAA Module Support
190  * Add support scan channel 1~14 and update scan result's frequency infou1rwduu`wvpghlqg|n`slk+mpdkb
191  *
192  * 02 04 2010 kevin.huang
193  * [BORA00000603][WIFISYS] [New Feature] AAA Module Support
194  * Add AAA Module Support, Revise Net Type to Net Type Index for array lookup
195  *
196  * 01 27 2010 wh.su
197  * [BORA00000476][Wi-Fi][firmware] Add the security module initialize code
198  * add and fixed some security function.
199  *
200  * 01 07 2010 kevin.huang
201  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
202  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
203  *
204  * Simplify the process of Beacon during SCAN and remove redundant variable in PRE_BSS_DESC_T
205  *
206  * Dec 7 2009 mtk01088
207  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
208  * adding variable for wapi ap
209  *
210  * Dec 4 2009 mtk01088
211  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
212  * remove non-used secuirty variavle
213  *
214  * Dec 3 2009 mtk01461
215  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
216  * Refine data structure of BSS_DESC_T and PRE_BSS_DESC_T
217  *
218  * Nov 24 2009 mtk01461
219  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
220  * Add eNetType to rScanParam and revise MGMT Handler with Retain Status
221  *
222  * Nov 23 2009 mtk01461
223  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
224  * Add ucAvailablePhyTypeSet to BSS_DESC_T
225  *
226  * Nov 20 2009 mtk01461
227  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
228  * Add aucSrcAddress to SCAN_PARAM_T for P2P's Device Address
229  *
230  * Nov 19 2009 mtk01088
231  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
232  * adding the security related variable
233  *
234  * Nov 18 2009 mtk01088
235  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
236  * adding the security ie filed for scan parsing
237  *
238  * Nov 16 2009 mtk01461
239  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
240  * Add scanSearchBssDescByPolicy()
241  *
242  * Nov 5 2009 mtk01461
243  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
244  * Add function declarations of scan_fsm.c
245  *
246  * Oct 30 2009 mtk01461
247  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
248  * Add scan.h to source control
249 **
250 */
251
252 #ifndef _SCAN_H
253 #define _SCAN_H
254
255 /*******************************************************************************
256 *                         C O M P I L E R   F L A G S
257 ********************************************************************************
258 */
259
260 /*******************************************************************************
261 *                    E X T E R N A L   R E F E R E N C E S
262 ********************************************************************************
263 */
264
265 /*******************************************************************************
266 *                              C O N S T A N T S
267 ********************************************************************************
268 */
269 /*! Maximum buffer size of SCAN list */
270 #define SCN_MAX_BUFFER_SIZE                 (CFG_MAX_NUM_BSS_LIST * ALIGN_4(sizeof(BSS_DESC_T)))
271
272 #define SCN_RM_POLICY_EXCLUDE_CONNECTED     BIT(0) // Remove SCAN result except the connected one.
273 #define SCN_RM_POLICY_TIMEOUT               BIT(1) // Remove the timeout one
274 #define SCN_RM_POLICY_OLDEST_HIDDEN         BIT(2) // Remove the oldest one with hidden ssid
275 #define SCN_RM_POLICY_SMART_WEAKEST         BIT(3) /* If there are more than half BSS which has the
276                                                     * same ssid as connection setting, remove the weakest one from them
277                                                     * Else remove the weakest one.
278                                                     */
279 #define SCN_RM_POLICY_ENTIRE                BIT(4) // Remove entire SCAN result
280
281 #define SCN_BSS_DESC_SAME_SSID_THRESHOLD    3 /* This is used by POLICY SMART WEAKEST,
282                                                * If exceed this value, remove weakest BSS_DESC_T
283                                                * with same SSID first in large network.
284                                                */
285
286 #define SCN_BSS_DESC_REMOVE_TIMEOUT_SEC     5 // Second.
287                                               /* This is used by POLICY TIMEOUT,
288                                                * If exceed this value, remove timeout BSS_DESC_T.
289                                                */
290
291
292
293
294 #define SCN_PROBE_DELAY_MSEC                0
295
296 #define SCN_ADHOC_BSS_DESC_TIMEOUT_SEC      5 // Second.
297
298 /*----------------------------------------------------------------------------*/
299 /* MSG_SCN_SCAN_REQ                                                           */
300 /*----------------------------------------------------------------------------*/
301 #define SCAN_REQ_SSID_WILDCARD              BIT(0)
302 #define SCAN_REQ_SSID_P2P_WILDCARD          BIT(1)
303 #define SCAN_REQ_SSID_SPECIFIED             BIT(2)
304
305
306 /*----------------------------------------------------------------------------*/
307 /* Support Multiple SSID SCAN                                                 */
308 /*----------------------------------------------------------------------------*/
309 #define SCN_SSID_MAX_NUM                        4
310
311
312 /*******************************************************************************
313 *                             D A T A   T Y P E S
314 ********************************************************************************
315 */
316 typedef enum _ENUM_SCAN_TYPE_T {
317     SCAN_TYPE_PASSIVE_SCAN = 0,
318     SCAN_TYPE_ACTIVE_SCAN,
319     SCAN_TYPE_NUM
320 } ENUM_SCAN_TYPE_T, *P_ENUM_SCAN_TYPE_T;
321
322 typedef enum _ENUM_SCAN_STATE_T {
323     SCAN_STATE_IDLE = 0,
324     SCAN_STATE_SCANNING,
325     SCAN_STATE_NUM
326 } ENUM_SCAN_STATE_T;
327
328 typedef enum _ENUM_SCAN_CHANNEL_T {
329     SCAN_CHANNEL_FULL = 0,
330     SCAN_CHANNEL_2G4,
331     SCAN_CHANNEL_5G,
332     SCAN_CHANNEL_P2P_SOCIAL,
333     SCAN_CHANNEL_SPECIFIED,
334     SCAN_CHANNEL_NUM
335 } ENUM_SCAN_CHANNEL, *P_ENUM_SCAN_CHANNEL;
336
337 typedef struct _MSG_SCN_FSM_T {
338     MSG_HDR_T       rMsgHdr;        /* Must be the first member */
339     UINT_32         u4Dummy;
340 } MSG_SCN_FSM_T, *P_MSG_SCN_FSM_T;
341
342
343
344 /*----------------------------------------------------------------------------*/
345 /* BSS Descriptors                                                            */
346 /*----------------------------------------------------------------------------*/
347 struct _BSS_DESC_T {
348     LINK_ENTRY_T            rLinkEntry;
349
350     UINT_8                  aucBSSID[MAC_ADDR_LEN];
351     UINT_8                  aucSrcAddr[MAC_ADDR_LEN]; /* For IBSS, the SrcAddr is different from BSSID */
352
353     BOOLEAN                 fgIsConnecting; /* If we are going to connect to this BSS
354                                              * (JOIN or ROAMING to another BSS), don't
355                                              * remove this record from BSS List.
356                                              */
357     BOOLEAN                 fgIsConnected; /* If we have connected to this BSS (NORMAL_TR),
358                                             * don't removed this record from BSS list.
359                                             */
360
361     BOOLEAN                 fgIsHiddenSSID; /* When this flag is TRUE, means the SSID
362                                              * of this BSS is not known yet.
363                                              */
364     UINT_8                  ucSSIDLen;
365     UINT_8                  aucSSID[ELEM_MAX_LEN_SSID];
366
367     OS_SYSTIME              rUpdateTime;
368
369     ENUM_BSS_TYPE_T         eBSSType;
370
371     UINT_16                 u2CapInfo;
372
373     UINT_16                 u2BeaconInterval;
374     UINT_16                 u2ATIMWindow;
375
376     UINT_16                 u2OperationalRateSet;
377     UINT_16                 u2BSSBasicRateSet;
378     BOOLEAN                 fgIsUnknownBssBasicRate;
379
380     BOOLEAN                 fgIsERPPresent;
381     BOOLEAN                 fgIsHTPresent;
382
383     UINT_8                  ucPhyTypeSet;           /* Available PHY Type Set of this BSS */
384
385     UINT_8                  ucChannelNum;
386
387     ENUM_CHNL_EXT_T         eSco;                   /* Record bandwidth for association process
388                                                        Some AP will send association resp by 40MHz BW */
389     ENUM_BAND_T             eBand;
390
391     UINT_8                  ucDTIMPeriod;
392
393     BOOLEAN                 fgIsLargerTSF; /* This BSS's TimeStamp is larger than us(TCL == 1 in RX_STATUS_T) */
394
395     UINT_8                  ucRCPI;
396
397     UINT_8                  ucWmmFlag; /* A flag to indicate this BSS's WMM capability */
398
399     /*! \brief The srbiter Search State will matched the scan result,
400                and saved the selected cipher and akm, and report the score,
401                for arbiter join state, join module will carry this target BSS
402                to rsn generate ie function, for gen wpa/rsn ie */
403     UINT_32                 u4RsnSelectedGroupCipher;
404     UINT_32                 u4RsnSelectedPairwiseCipher;
405     UINT_32                 u4RsnSelectedAKMSuite;
406
407     UINT_16                 u2RsnCap;
408
409     RSN_INFO_T              rRSNInfo;
410     RSN_INFO_T              rWPAInfo;
411 #if 1//CFG_SUPPORT_WAPI
412     WAPI_INFO_T             rIEWAPI;
413     BOOL                    fgIEWAPI;
414 #endif
415     BOOL                    fgIERSN;
416     BOOL                    fgIEWPA;
417
418     /*! \brief RSN parameters selected for connection */
419     /*! \brief The Select score for final AP selection,
420                0, no sec, 1,2,3 group cipher is WEP, TKIP, CCMP */
421     UINT_8                  ucEncLevel;
422
423 #if CFG_ENABLE_WIFI_DIRECT
424     BOOLEAN               fgIsP2PPresent;
425     P_P2P_DEVICE_DESC_T  prP2pDesc;
426
427     UINT_8                  aucIntendIfAddr[MAC_ADDR_LEN]; /* For IBSS, the SrcAddr is different from BSSID */
428 //    UINT_8 ucDevCapabilityBitmap;  /* Device Capability Attribute. (P2P_DEV_CAPABILITY_XXXX) */
429 //    UINT_8 ucGroupCapabilityBitmap;  /* Group Capability Attribute. (P2P_GROUP_CAPABILITY_XXXX) */
430
431     LINK_T rP2pDeviceList;
432
433 //    P_LINK_T prP2pDeviceList;
434
435     /* For
436       *    1. P2P Capability.
437       *    2. P2P Device ID. ( in aucSrcAddr[] )
438       *    3. NOA   (TODO:)
439       *    4. Extend Listen Timing. (Probe Rsp)  (TODO:)
440       *    5. P2P Device Info. (Probe Rsp)
441       *    6. P2P Group Info. (Probe Rsp)
442       */
443 #endif
444
445     BOOLEAN                 fgIsIEOverflow; /* The received IE length exceed the maximum IE buffer size */
446     UINT_16                 u2IELength; /* The byte count of aucIEBuf[] */
447
448     ULARGE_INTEGER          u8TimeStamp; /* Place u8TimeStamp before aucIEBuf[1] to force DW align */
449
450     UINT_8                  aucIEBuf[CFG_IE_BUFFER_SIZE];
451 };
452
453
454 typedef struct _SCAN_PARAM_T { /* Used by SCAN FSM */
455     /* Active or Passive */
456     ENUM_SCAN_TYPE_T            eScanType;
457
458     /* Network Type */
459     ENUM_NETWORK_TYPE_INDEX_T   eNetTypeIndex;
460
461     /* Specified SSID Type */
462     UINT_8                      ucSSIDType;
463     UINT_8                      ucSSIDNum;
464
465     /* Length of Specified SSID */
466     UINT_8                      ucSpecifiedSSIDLen[SCN_SSID_MAX_NUM];
467
468     /* Specified SSID */
469     UINT_8                      aucSpecifiedSSID[SCN_SSID_MAX_NUM][ELEM_MAX_LEN_SSID];
470
471 #if CFG_ENABLE_WIFI_DIRECT
472     BOOLEAN                     fgFindSpecificDev;                  /* P2P: Discovery Protocol */
473     UINT_8                      aucDiscoverDevAddr[MAC_ADDR_LEN];
474     BOOLEAN                     fgIsDevType;
475     P2P_DEVICE_TYPE_T           rDiscoverDevType;
476
477     UINT_16                     u2PassiveListenInterval;
478     // TODO: Find Specific Device Type.
479 #endif /* CFG_SUPPORT_P2P */
480
481     BOOLEAN                     fgIsObssScan;
482     BOOLEAN                     fgIsScanV2;
483
484     /* Run time flags */
485     UINT_16                     u2ProbeDelayTime;
486
487     /* channel information */
488     ENUM_SCAN_CHANNEL   eScanChannel;
489     UINT_8              ucChannelListNum;
490     RF_CHANNEL_INFO_T   arChnlInfoList[MAXIMUM_OPERATION_CHANNEL_LIST];
491
492     /* Feedback information */
493     UINT_8              ucSeqNum;
494
495     /* Information Element */
496     UINT_16             u2IELen;
497     UINT_8              aucIE[MAX_IE_LENGTH];
498
499 } SCAN_PARAM_T, *P_SCAN_PARAM_T;
500
501 typedef struct _SCAN_INFO_T {
502     ENUM_SCAN_STATE_T       eCurrentState;  /* Store the STATE variable of SCAN FSM */
503
504     OS_SYSTIME              rLastScanCompletedTime;
505
506     SCAN_PARAM_T            rScanParam;
507
508     UINT_32                 u4NumOfBssDesc;
509
510     UINT_8                  aucScanBuffer[SCN_MAX_BUFFER_SIZE];
511
512     LINK_T                  rBSSDescList;
513
514     LINK_T                  rFreeBSSDescList;
515
516     LINK_T                  rPendingMsgList;
517
518     /* Sparse Channel Detection */
519     BOOLEAN                 fgIsSparseChannelValid;
520     RF_CHANNEL_INFO_T       rSparseChannel;
521
522 } SCAN_INFO_T, *P_SCAN_INFO_T;
523
524
525 /* Incoming Mailbox Messages */
526 typedef struct _MSG_SCN_SCAN_REQ_T {
527     MSG_HDR_T           rMsgHdr;        /* Must be the first member */
528     UINT_8              ucSeqNum;
529     UINT_8              ucNetTypeIndex;
530     ENUM_SCAN_TYPE_T    eScanType;
531     UINT_8              ucSSIDType;     /* BIT(0) wildcard / BIT(1) P2P-wildcard / BIT(2) specific */
532     UINT_8              ucSSIDLength;
533     UINT_8              aucSSID[PARAM_MAX_LEN_SSID];
534 #if CFG_ENABLE_WIFI_DIRECT
535     UINT_16             u2ChannelDwellTime;  /* In TU. 1024us. */
536 #endif
537     ENUM_SCAN_CHANNEL   eScanChannel;
538     UINT_8              ucChannelListNum;
539     RF_CHANNEL_INFO_T   arChnlInfoList[MAXIMUM_OPERATION_CHANNEL_LIST];
540     UINT_16             u2IELen;
541     UINT_8              aucIE[MAX_IE_LENGTH];
542 } MSG_SCN_SCAN_REQ, *P_MSG_SCN_SCAN_REQ;
543
544 typedef struct _MSG_SCN_SCAN_REQ_V2_T {
545     MSG_HDR_T           rMsgHdr;        /* Must be the first member */
546     UINT_8              ucSeqNum;
547     UINT_8              ucNetTypeIndex;
548     ENUM_SCAN_TYPE_T    eScanType;
549     UINT_8              ucSSIDType;     /* BIT(0) wildcard / BIT(1) P2P-wildcard / BIT(2) specific */
550     UINT_8              ucSSIDNum;
551     P_PARAM_SSID_T      prSsid;
552     UINT_16             u2ProbeDelay;
553     UINT_16             u2ChannelDwellTime;  /* In TU. 1024us. */
554     ENUM_SCAN_CHANNEL   eScanChannel;
555     UINT_8              ucChannelListNum;
556     RF_CHANNEL_INFO_T   arChnlInfoList[MAXIMUM_OPERATION_CHANNEL_LIST];
557     UINT_16             u2IELen;
558     UINT_8              aucIE[MAX_IE_LENGTH];
559 } MSG_SCN_SCAN_REQ_V2, *P_MSG_SCN_SCAN_REQ_V2;
560
561
562 typedef struct _MSG_SCN_SCAN_CANCEL_T {
563     MSG_HDR_T           rMsgHdr;        /* Must be the first member */
564     UINT_8              ucSeqNum;
565     UINT_8              ucNetTypeIndex;
566 #if CFG_ENABLE_WIFI_DIRECT
567     BOOLEAN           fgIsChannelExt;
568 #endif
569 } MSG_SCN_SCAN_CANCEL, *P_MSG_SCN_SCAN_CANCEL;
570
571 /* Outgoing Mailbox Messages */
572 typedef enum _ENUM_SCAN_STATUS_T {
573     SCAN_STATUS_DONE = 0,
574     SCAN_STATUS_CANCELLED,
575     SCAN_STATUS_FAIL,
576     SCAN_STATUS_BUSY,
577     SCAN_STATUS_NUM
578 } ENUM_SCAN_STATUS, *P_ENUM_SCAN_STATUS;
579
580 typedef struct _MSG_SCN_SCAN_DONE_T {
581     MSG_HDR_T           rMsgHdr;        /* Must be the first member */
582     UINT_8              ucSeqNum;
583     UINT_8              ucNetTypeIndex;
584     ENUM_SCAN_STATUS    eScanStatus;
585 } MSG_SCN_SCAN_DONE, *P_MSG_SCN_SCAN_DONE;
586
587 /*******************************************************************************
588 *                            P U B L I C   D A T A
589 ********************************************************************************
590 */
591
592 /*******************************************************************************
593 *                           P R I V A T E   D A T A
594 ********************************************************************************
595 */
596
597 /*******************************************************************************
598 *                                 M A C R O S
599 ********************************************************************************
600 */
601
602 /*******************************************************************************
603 *                   F U N C T I O N   D E C L A R A T I O N S
604 ********************************************************************************
605 */
606 /*----------------------------------------------------------------------------*/
607 /* Routines in scan.c                                                         */
608 /*----------------------------------------------------------------------------*/
609 VOID
610 scnInit (
611     IN P_ADAPTER_T prAdapter
612     );
613
614 VOID
615 scnUninit (
616     IN P_ADAPTER_T prAdapter
617     );
618
619 /* BSS-DESC Search */
620 P_BSS_DESC_T
621 scanSearchBssDescByBssid (
622     IN P_ADAPTER_T prAdapter,
623     IN UINT_8 aucBSSID[]
624     );
625
626 P_BSS_DESC_T
627 scanSearchBssDescByBssidAndSsid (
628     IN P_ADAPTER_T prAdapter,
629     IN UINT_8 aucBSSID[],
630     IN BOOLEAN fgCheckSsid,
631     IN P_PARAM_SSID_T prSsid
632     );
633
634 P_BSS_DESC_T
635 scanSearchBssDescByTA (
636     IN P_ADAPTER_T prAdapter,
637     IN UINT_8 aucSrcAddr[]
638     );
639
640 P_BSS_DESC_T
641 scanSearchBssDescByTAAndSsid (
642     IN P_ADAPTER_T prAdapter,
643     IN UINT_8 aucSrcAddr[],
644     IN BOOLEAN fgCheckSsid,
645     IN P_PARAM_SSID_T prSsid
646     );
647
648
649 /* BSS-DESC Search - Alternative */
650 P_BSS_DESC_T
651 scanSearchExistingBssDesc (
652     IN P_ADAPTER_T prAdapter,
653     IN ENUM_BSS_TYPE_T eBSSType,
654     IN UINT_8 aucBSSID[],
655     IN UINT_8 aucSrcAddr[]
656     );
657
658 P_BSS_DESC_T
659 scanSearchExistingBssDescWithSsid (
660     IN P_ADAPTER_T prAdapter,
661     IN ENUM_BSS_TYPE_T eBSSType,
662     IN UINT_8 aucBSSID[],
663     IN UINT_8 aucSrcAddr[],
664     IN BOOLEAN fgCheckSsid,
665     IN P_PARAM_SSID_T prSsid
666     );
667
668
669 /* BSS-DESC Allocation */
670 P_BSS_DESC_T
671 scanAllocateBssDesc (
672     IN P_ADAPTER_T prAdapter
673     );
674
675 /* BSS-DESC Removal */
676 VOID
677 scanRemoveBssDescsByPolicy (
678     IN P_ADAPTER_T prAdapter,
679     IN UINT_32 u4RemovePolicy
680     );
681
682 VOID
683 scanRemoveBssDescByBssid (
684     IN P_ADAPTER_T prAdapter,
685     IN UINT_8 aucBSSID[]
686     );
687
688 VOID
689 scanRemoveBssDescByBandAndNetwork (
690     IN P_ADAPTER_T prAdapter,
691     IN ENUM_BAND_T eBand,
692     IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex
693     );
694
695 /* BSS-DESC State Change */
696 VOID
697 scanRemoveConnFlagOfBssDescByBssid (
698     IN P_ADAPTER_T prAdapter,
699     IN UINT_8 aucBSSID[]
700     );
701
702 #if 0
703 /* BSS-DESC Insertion */
704 P_BSS_DESC_T
705 scanAddToInternalScanResult (
706     IN P_ADAPTER_T prAdapter,
707     IN P_SW_RFB_T prSWRfb,
708     IN P_BSS_DESC_T prBssDesc
709     );
710 #endif
711
712 /* BSS-DESC Insertion - ALTERNATIVE */
713 P_BSS_DESC_T
714 scanAddToBssDesc (
715     IN P_ADAPTER_T prAdapter,
716     IN P_SW_RFB_T prSwRfb
717     );
718
719 WLAN_STATUS
720 scanProcessBeaconAndProbeResp (
721     IN P_ADAPTER_T prAdapter,
722     IN P_SW_RFB_T prSWRfb
723     );
724
725 VOID
726 scanBuildProbeReqFrameCommonIEs (
727     IN P_MSDU_INFO_T    prMsduInfo,
728     IN PUINT_8          pucDesiredSsid,
729     IN UINT_32          u4DesiredSsidLen,
730     IN UINT_16          u2SupportedRateSet
731     );
732
733 WLAN_STATUS
734 scanSendProbeReqFrames (
735     IN P_ADAPTER_T prAdapter,
736     IN P_SCAN_PARAM_T prScanParam
737     );
738
739 VOID
740 scanUpdateBssDescForSearch (
741     IN P_ADAPTER_T prAdapter,
742     IN P_BSS_DESC_T prBssDesc
743     );
744
745 P_BSS_DESC_T
746 scanSearchBssDescByPolicy (
747     IN P_ADAPTER_T prAdapter,
748     IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex
749     );
750
751 WLAN_STATUS
752 scanAddScanResult (
753     IN P_ADAPTER_T prAdapter,
754     IN P_BSS_DESC_T prBssDesc,
755     IN P_SW_RFB_T prSwRfb
756     );
757
758 /*----------------------------------------------------------------------------*/
759 /* Routines in scan_fsm.c                                                     */
760 /*----------------------------------------------------------------------------*/
761 VOID
762 scnFsmSteps (
763     IN P_ADAPTER_T prAdapter,
764     IN ENUM_SCAN_STATE_T eNextState
765     );
766
767 /*----------------------------------------------------------------------------*/
768 /* Command Routines                                                           */
769 /*----------------------------------------------------------------------------*/
770 VOID
771 scnSendScanReq (
772     IN P_ADAPTER_T prAdapter
773     );
774
775 VOID
776 scnSendScanReqV2 (
777     IN P_ADAPTER_T prAdapter
778     );
779
780 /*----------------------------------------------------------------------------*/
781 /* RX Event Handling                                                          */
782 /*----------------------------------------------------------------------------*/
783 VOID
784 scnEventScanDone(
785     IN P_ADAPTER_T          prAdapter,
786     IN P_EVENT_SCAN_DONE    prScanDone
787     );
788
789 /*----------------------------------------------------------------------------*/
790 /* Mailbox Message Handling                                                   */
791 /*----------------------------------------------------------------------------*/
792 VOID
793 scnFsmMsgStart (
794     IN P_ADAPTER_T prAdapter,
795     IN P_MSG_HDR_T prMsgHdr
796     );
797
798 VOID
799 scnFsmMsgAbort (
800     IN P_ADAPTER_T prAdapter,
801     IN P_MSG_HDR_T prMsgHdr
802     );
803
804 VOID
805 scnFsmHandleScanMsg (
806     IN P_ADAPTER_T prAdapter,
807     IN P_MSG_SCN_SCAN_REQ prScanReqMsg
808     );
809
810 VOID
811 scnFsmHandleScanMsgV2 (
812     IN P_ADAPTER_T prAdapter,
813     IN P_MSG_SCN_SCAN_REQ_V2 prScanReqMsg
814     );
815
816 VOID
817 scnFsmRemovePendingMsg (
818     IN P_ADAPTER_T  prAdapter,
819     IN UINT_8       ucSeqNum,
820     IN UINT_8       ucNetTypeIndex
821     );
822
823 /*----------------------------------------------------------------------------*/
824 /* Mailbox Message Generation                                                 */
825 /*----------------------------------------------------------------------------*/
826 VOID
827 scnFsmGenerateScanDoneMsg (
828     IN P_ADAPTER_T          prAdapter,
829     IN UINT_8               ucSeqNum,
830     IN UINT_8               ucNetTypeIndex,
831     IN ENUM_SCAN_STATUS     eScanStatus
832     );
833
834 /*----------------------------------------------------------------------------*/
835 /* Query for sparse channel                                                   */
836 /*----------------------------------------------------------------------------*/
837 BOOLEAN
838 scnQuerySparseChannel (
839     IN P_ADAPTER_T      prAdapter,
840     P_ENUM_BAND_T       prSparseBand,
841     PUINT_8             pucSparseChannel
842     );
843
844
845 #endif /* _SCAN_H */
846
847