2 ** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/mgmt/cnm_mem.h#1 $
6 \brief In this file we define the structure of the control unit of
7 packet buffer and MGT/MSG Memory Buffer.
17 * Snc CFG80211 modification for ICS migration from branch 2.2.
19 * 01 05 2012 tsaiyuan.hsu
20 * [WCXRP00001157] [MT6620 Wi-Fi][FW][DRV] add timing measurement support for 802.11v
21 * add timing measurement support for 802.11v.
23 * 03 17 2011 yuche.tsai
25 * Resize the Secondary Device Type array when WiFi Direct is enabled.
28 * [WCXRP00000530] [MT6620 Wi-Fi] [Driver] skip doing p2pRunEventAAAComplete after send assoc response Tx Done
29 * enable the protected while at P2P start GO, and skip some security check .
32 * [WCXRP00000395] [MT6620 Wi-Fi][Driver][FW] Search STA_REC with additional net type index argument
35 * 01 11 2011 eddie.chen
36 * [WCXRP00000322] Add WMM IE in beacon,
38 Add per station flow control when STA is in PS
41 * Add per STA flow control when STA is in PS mode
43 * 12 29 2010 eddie.chen
44 * [WCXRP00000322] Add WMM IE in beacon,
45 Add per station flow control when STA is in PS
47 * 1) PS flow control event
49 * 2) WMM IE in beacon, assoc resp, probe resp
51 * 12 23 2010 george.huang
52 * [WCXRP00000152] [MT6620 Wi-Fi] AP mode power saving function
53 * 1. update WMM IE parsing, with ASSOC REQ handling
54 * 2. extend U-APSD parameter passing from driver to FW
57 * [WCXRP00000239] MT6620 Wi-Fi][Driver][FW] Merge concurrent branch back to maintrunk
58 * 1. BSSINFO include RLM parameter
59 * 2. free all sta records when network is disconnected
62 * [WCXRP00000210] [MT6620 Wi-Fi][Driver][FW] Set RCPI value in STA_REC for initial TX rate selection of auto-rate algorithm
63 * Sync RCPI of STA_REC to FW as reference of initial TX rate
66 * [WCXRP00000053] [MT6620 Wi-Fi][Driver] Reset incomplete and might leads to BSOD when entering RF test with AIS associated
67 * 1. remove redundant variables in STA_REC structure
68 * 2. add STA-REC uninitialization routine for clearing pending events
70 * 09 21 2010 kevin.huang
71 * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning
72 * Eliminate Linux Compile Warning
74 * 09 03 2010 kevin.huang
76 * Refine #include sequence and solve recursive/nested #include issue
80 * SAA will take a record for tracking request sequence number.
84 * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
87 * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
88 * Support state of STA record change from 1 to 1
91 * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
92 * Support sync command of STA_REC
95 * [WPD00003840][MT6620 5931] Security migration
96 * modify some code for concurrent network.
98 * 06 21 2010 yuche.tsai
99 * [WPD00003839][MT6620 5931][P2P] Feature migration
100 * Fix compile error for P2P related defination.
102 * 06 18 2010 cm.chang
103 * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
104 * Provide cnmMgtPktAlloc() and alloc/free function of msg/buf
106 * 06 17 2010 yuche.tsai
107 * [WPD00003839][MT6620 5931][P2P] Feature migration
108 * Add P2P related fields.
111 * [WPD00003833][MT6620 and MT5931] Driver migration
112 * saa_fsm.c is migrated.
115 * [WPD00003833][MT6620 and MT5931] Driver migration
116 * restore utility function invoking via hem_mbox to direct calls
119 * [WPD00003833][MT6620 and MT5931] Driver migration
120 * add buildable & linkable ais_fsm.c
122 * related reference are still waiting to be resolved
125 * [WPD00003833][MT6620 and MT5931] Driver migration
126 * hem_mbox is migrated.
129 * [WPD00003833][MT6620 and MT5931] Driver migration
130 * add hem_mbox.c and cnm_mem.h (but disabled some feature) for further migration
132 * 06 04 2010 george.huang
133 * [BORA00000678][MT6620]WiFi LP integration
134 * [BORA00000678] [MT6620]WiFi LP integration
135 * 1. add u8TimeStamp in MSDU_INFO
136 * 2. move fgIsRxTSFUpdated/fgIsTxTSFUpdated from static to BSS_INFO
137 * 3. add new member for supporting PM in STA_RECORD, which is for AP PS mode
139 * 05 31 2010 yarco.yang
140 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
141 * Add RX TSF Log Feature and ADDBA Rsp with DECLINE handling
143 * 05 28 2010 cm.chang
144 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
145 * Support checking of duplicated buffer free
147 * 05 28 2010 kevin.huang
148 * [BORA00000794][WIFISYS][New Feature]Power Management Support
149 * Move define of STA_REC_NUM to config.h and rename to CFG_STA_REC_NUM
151 * 05 21 2010 kevin.huang
152 * [BORA00000794][WIFISYS][New Feature]Power Management Support
153 * Refine txmInitWtblTxRateTable() - set TX initial rate according to AP's operation rate set
155 * 05 19 2010 yarco.yang
156 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
157 * Fixed MAC RX Desc be overwritten issue
159 * 05 12 2010 kevin.huang
160 * [BORA00000794][WIFISYS][New Feature]Power Management Support
161 * Add Power Management - Legacy PS-POLL support.
163 * 05 10 2010 yarco.yang
164 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
165 * Support Rx header translation for A-MSDU subframe
167 * 05 07 2010 george.huang
168 * [BORA00000678][MT6620]WiFi LP integration
169 * add more sanity check about setting timer
171 * 04 29 2010 george.huang
172 * [BORA00000678][MT6620]WiFi LP integration
173 * modify the compiling flag for RAM usage
175 * 04 28 2010 tehuang.liu
176 * [BORA00000605][WIFISYS] Phase3 Integration
177 * Modified some MQM-related data structures (SN counter, TX/RX BA table)
179 * 04 27 2010 tehuang.liu
180 * [BORA00000605][WIFISYS] Phase3 Integration
181 * Added new TX/RX BA tables in STA_REC
183 * 04 19 2010 kevin.huang
184 * [BORA00000714][WIFISYS][New Feature]Beacon Timeout Support
185 * Add Beacon Timeout Support and will send Null frame to diagnose connection
187 * 04 09 2010 tehuang.liu
188 * [BORA00000605][WIFISYS] Phase3 Integration
189 * [BORA00000644] WiFi phase 4 integration
190 * Added per-TID SN cache in STA_REC
192 * 03 24 2010 cm.chang
193 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
194 * Support power control
196 * 03 16 2010 kevin.huang
197 * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support
200 * 03 11 2010 yuche.tsai
201 * [BORA00000343][MT6620] Emulation For TX
204 * 03 05 2010 yarco.yang
205 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
206 * Remove Emulation definition
209 * [BORA00000368]Integrate HIF part into BORA
210 * eliminate HIF_EMULATION in cnm_mem.h
212 * 03 04 2010 kevin.huang
213 * [BORA00000603][WIFISYS] [New Feature] AAA Module Support
214 * Add cnmStaRecChangeState() declaration.
216 * 03 03 2010 cm.chang
217 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
218 * Remove compiling warning for some emulation flags
221 * [BORA00000637][MT6620 Wi-Fi] [Bug] WPA2 pre-authentication timer not correctly initialize
222 * move the AIS specific variable for security to AIS specific structure.
225 * [BORA00000637][MT6620 Wi-Fi] [Bug] WPA2 pre-authentication timer not correctly initialize
226 * Fixed the pre-authentication timer not correctly init issue, and modify the security related callback function prototype.
228 * 03 01 2010 tehuang.liu
229 * [BORA00000569][WIFISYS] Phase 2 Integration Test
230 * To store field AMPDU Parameters in STA_REC
232 * 02 26 2010 tehuang.liu
233 * [BORA00000569][WIFISYS] Phase 2 Integration Test
234 * Added fgIsWmmSupported in STA_RECORD_T.
236 * 02 26 2010 tehuang.liu
237 * [BORA00000569][WIFISYS] Phase 2 Integration Test
238 * Added fgIsUapsdSupported in STA_RECORD_T
240 * 02 13 2010 tehuang.liu
241 * [BORA00000569][WIFISYS] Phase 2 Integration Test
242 * Added arTspecTable in STA_REC for TSPEC management
244 * 02 12 2010 cm.chang
245 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
246 * Enable mgmt buffer debug by default
248 * 02 12 2010 tehuang.liu
249 * [BORA00000569][WIFISYS] Phase 2 Integration Test
250 * Added BUFFER_SOURCE_BCN
252 * 02 10 2010 tehuang.liu
253 * [BORA00000569][WIFISYS] Phase 2 Integration Test
254 * Renamed MSDU_INFO.ucFixedRateIndex as MSDU_INFO.ucFixedRateCode
256 * 02 04 2010 kevin.huang
257 * [BORA00000603][WIFISYS] [New Feature] AAA Module Support
258 * Add AAA Module Support, Revise Net Type to Net Type Index for array lookup
260 * 02 02 2010 tehuang.liu
261 * [BORA00000569][WIFISYS] Phase 2 Integration Test
262 * Added SN info in MSDU_INFO_T
265 * [BORA00000476][Wi-Fi][firmware] Add the security module initialize code
266 * add and fixed some security function.
268 * 01 11 2010 kevin.huang
269 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
270 * Add Deauth and Disassoc Handler
273 * [BORA00000368]Integrate HIF part into BORA
274 * 1) separate wifi_var_emu.c/.h from wifi_var.c/.h
275 * 2) eliminate HIF_EMULATION code sections appeared in wifi_var/cnm_mem
276 * 3) use cnmMemAlloc() instead to allocate SRAM buffer
279 * [BORA00000368]Integrate HIF part into BORA
280 * 1) surpress debug message emitted from hal_hif.c
281 * 2) add two set of field for recording buffer process time
284 * [BORA00000368]Integrate HIF part into BORA
285 * 1. move wifi task initialization from wifi_task.c(rom) to wifi_init.c (TCM) for integrating F/W download later
286 * * * * * 2. WIFI_Event_Dispatcher() prototype changed to return to suspend mode from normal operation mode
287 * * * * * 2. HIF emulation logic revised
289 * 12 29 2009 yuche.tsai
290 * [BORA00000343][MT6620] Emulation For TX
291 * .Using global buffer declaring by SD1 instead of using another one.
293 * 12 25 2009 tehuang.liu
294 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
295 * Integrated modifications for 1st connection (mainly on FW modules MQM, TXM, and RXM)
297 * * TXM: Macros updates
298 * * RXM: Macros/Duplicate Removal updates
300 * 12 24 2009 yarco.yang
301 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
305 * [BORA00000368]Integrate HIF part into BORA
306 * allocating SRAM for emulation purpose by ruducing MEM_BANK3_BUF_SZ
308 * 12 21 2009 cm.chang
309 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
310 * Remove individual DATA_BUF_BLOCK_NUM definition for emulation compiling flagsu1rwduu`wvpghlqg|fh+fmdkb
312 * 12 21 2009 cm.chang
313 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
314 * Support several data buffer banks.
316 * 12 18 2009 cm.chang
317 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
318 * .For new FPGA memory size
320 * 12 18 2009 cm.chang
321 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
324 * 12 17 2009 george.huang
325 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
328 * Dec 17 2009 MTK02468
329 * [BORA00000337] To check in codes for FPGA emulation
330 * Modified the DATA_BLOCK_SIZE from 1620 to 2048
332 * Dec 16 2009 mtk01426
333 * [BORA00000018] Integrate WIFI part into BORA for the 1st time
334 * Add CFG_TEST_SEC_EMULATION flag
336 * Dec 9 2009 mtk01104
337 * [BORA00000018] Integrate WIFI part into BORA for the 1st time
338 * Add HT cap to sta record
340 * Dec 9 2009 mtk02752
341 * [BORA00000368] Integrate HIF part into BORA
342 * add cnmDataPktFree() for emulation loopback purpose
344 * Dec 8 2009 mtk01088
345 * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
346 * add the buffer for key handshake 1x and cmd key order issue
348 * Dec 7 2009 mtk01088
349 * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
350 * move the tx call back function proto type to typedef.h
352 * Dec 3 2009 mtk01461
353 * [BORA00000018] Integrate WIFI part into BORA for the 1st time
354 * Add cnmGetStaRecByAddress() and modify variable in STA_RECORD_T
356 * Dec 1 2009 mtk01088
357 * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
358 * rename the port block flag
360 * Nov 23 2009 mtk01461
361 * [BORA00000018] Integrate WIFI part into BORA for the 1st time
362 * Add variables to STA_RECORD_T for assoc/auth
364 * Nov 23 2009 mtk02468
365 * [BORA00000337] To check in codes for FPGA emulation
366 * Fixed the value of STA_WAIT_QUEUE_NUM (from 7 to 5)
368 * Nov 20 2009 mtk02468
369 * [BORA00000337] To check in codes for FPGA emulation
370 * Removed u2FrameLength from SW_RFB
372 * Nov 20 2009 mtk02468
373 * [BORA00000337] To check in codes for FPGA emulation
376 * Nov 20 2009 mtk02468
377 * [BORA00000337] To check in codes for FPGA emulation
378 * Updated MSDU_INFO and SW_RFB
380 * Nov 19 2009 mtk01088
381 * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
382 * update the variable for security
384 * Nov 18 2009 mtk01088
385 * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
386 * remove the variable to make the compiler ok
388 * Nov 18 2009 mtk01088
389 * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
390 * add the variable for security module
392 * Nov 16 2009 mtk01461
393 * [BORA00000018] Integrate WIFI part into BORA for the 1st time
394 * Fix typo in define of MSG_BUF_BLOCK_SIZE
396 * Nov 13 2009 mtk02468
397 * [BORA00000337] To check in codes for FPGA emulation
398 * Let typedef STA_REC_T precede typedef MSDU_INFO_T and SW_RFB_T
400 * Nov 13 2009 mtk02468
401 * [BORA00000337] To check in codes for FPGA emulation
402 * Modified MSDU_INFO and STA_REC for TXM and MQM
404 * Nov 12 2009 mtk01104
405 * [BORA00000018] Integrate WIFI part into BORA for the 1st time
406 * Rename STA_REC_T to STA_RECORD_T and add ucIndex member
408 * Nov 9 2009 mtk01104
409 * [BORA00000018] Integrate WIFI part into BORA for the 1st time
410 * Make sure ucBufferSource the same offset in MSDU_INFO and SW_RFB
412 * Nov 6 2009 mtk01426
413 * [BORA00000018] Integrate WIFI part into BORA for the 1st time
416 * Nov 5 2009 mtk01426
417 * [BORA00000018] Integrate WIFI part into BORA for the 1st time
420 * Nov 5 2009 mtk01461
421 * [BORA00000018] Integrate WIFI part into BORA for the 1st time
424 * Oct 30 2009 mtk01461
425 * [BORA00000018] Integrate WIFI part into BORA for the 1st time
426 * Add draft content of MSDU_INFO_T and SW_RFB_T
428 * Oct 30 2009 mtk01084
429 * [BORA00000018] Integrate WIFI part into BORA for the 1st time
432 * Oct 28 2009 mtk01104
433 * [BORA00000018] Integrate WIFI part into BORA for the 1st time
436 * Oct 23 2009 mtk01461
437 * [BORA00000018] Integrate WIFI part into BORA for the 1st time
440 * Oct 21 2009 mtk01426
441 * [BORA00000018] Integrate WIFI part into BORA for the 1st time
442 * Add CFG_TEST_RX_EMULATION flag
444 * Oct 20 2009 mtk01426
445 * [BORA00000018] Integrate WIFI part into BORA for the 1st time
448 * Oct 9 2009 mtk02468
449 * [BORA00000337] To check in codes for FPGA emulation
450 * Added field ucTC to MSDU_INFO_T and field pucHifRxPacket to SW_RFB_T
452 * Oct 8 2009 mtk01104
453 * [BORA00000018] Integrate WIFI part into BORA for the 1st time
461 /*******************************************************************************
462 * C O M P I L E R F L A G S
463 ********************************************************************************
466 /*******************************************************************************
467 * E X T E R N A L R E F E R E N C E S
468 ********************************************************************************
471 /*******************************************************************************
473 ********************************************************************************
477 #define POWER_OF_2(n) BIT(n)
480 /* Size of a basic management buffer block in power of 2 */
481 #define MGT_BUF_BLOCK_SIZE_IN_POWER_OF_2 7 /* 7 to the power of 2 = 128 */
482 #define MSG_BUF_BLOCK_SIZE_IN_POWER_OF_2 5 /* 5 to the power of 2 = 32 */
484 /* Size of a basic management buffer block */
485 #define MGT_BUF_BLOCK_SIZE POWER_OF_2(MGT_BUF_BLOCK_SIZE_IN_POWER_OF_2)
486 #define MSG_BUF_BLOCK_SIZE POWER_OF_2(MSG_BUF_BLOCK_SIZE_IN_POWER_OF_2)
488 /* Total size of (n) basic management buffer blocks */
489 #define MGT_BUF_BLOCKS_SIZE(n) ((UINT_32)(n) << MGT_BUF_BLOCK_SIZE_IN_POWER_OF_2)
490 #define MSG_BUF_BLOCKS_SIZE(n) ((UINT_32)(n) << MSG_BUF_BLOCK_SIZE_IN_POWER_OF_2)
492 /* Number of management buffer block */
493 #define MAX_NUM_OF_BUF_BLOCKS 32 /* Range: 1~32 */
495 /* Size of overall management frame buffer */
496 #define MGT_BUFFER_SIZE (MAX_NUM_OF_BUF_BLOCKS * MGT_BUF_BLOCK_SIZE)
497 #define MSG_BUFFER_SIZE (MAX_NUM_OF_BUF_BLOCKS * MSG_BUF_BLOCK_SIZE)
500 /* STA_REC related definitions */
501 #define STA_REC_INDEX_BMCAST 0xFF
502 #define STA_REC_INDEX_NOT_FOUND 0xFE
503 #define STA_WAIT_QUEUE_NUM 5 /* Number of SW queues in each STA_REC: AC0~AC4 */
504 #define SC_CACHE_INDEX_NUM 5 /* Number of SC caches in each STA_REC: AC0~AC4 */
507 /* P2P related definitions */
508 #ifdef CFG_ENABLE_WIFI_DIRECT
509 /* Moved from p2p_fsm.h */
510 #define WPS_ATTRI_MAX_LEN_DEVICE_NAME 32 /* 0x1011 */
511 #define P2P_GC_MAX_CACHED_SEC_DEV_TYPE_COUNT 8 /* NOTE(Kevin): Shall <= 16 */
515 /*******************************************************************************
517 ********************************************************************************
519 #if ((MAX_NUM_OF_BUF_BLOCKS > 32) || (MAX_NUM_OF_BUF_BLOCKS <= 0))
520 #error > #define MAX_NUM_OF_MGT_BUF_BLOCKS : Out of boundary !
521 #elif MAX_NUM_OF_BUF_BLOCKS > 16
522 typedef UINT_32 BUF_BITMAP;
523 #elif MAX_NUM_OF_BUF_BLOCKS > 8
524 typedef UINT_16 BUF_BITMAP;
526 typedef UINT_8 BUF_BITMAP;
527 #endif /* MAX_NUM_OF_MGT_BUF_BLOCKS */
530 /* Control variable of TX management memory pool */
531 typedef struct _BUF_INFO_T {
535 UINT_32 u4AllocCount;
537 UINT_32 u4AllocNullCount;
538 #endif /* CFG_DBG_MGT_BUF */
540 BUF_BITMAP rFreeBlocksBitmap;
541 UINT_8 aucAllocatedBlockNum[MAX_NUM_OF_BUF_BLOCKS];
542 } BUF_INFO_T, *P_BUF_INFO_T;
545 /* Wi-Fi divides RAM into three types
546 * MSG: Mailbox message (Small size)
547 * BUF: HW DMA buffers (HIF/MAC)
549 typedef enum _ENUM_RAM_TYPE_T {
552 } ENUM_RAM_TYPE_T, P_ENUM_RAM_TYPE_T;
554 typedef enum _ENUM_BUFFER_SOURCE_T {
555 BUFFER_SOURCE_HIF_TX0 =0,
556 BUFFER_SOURCE_HIF_TX1,
557 BUFFER_SOURCE_MAC_RX,
561 } ENUM_BUFFER_SOURCE_T, *P_ENUM_BUFFER_SOURCE_T;
564 typedef enum _ENUM_SEC_STATE_T {
566 SEC_STATE_INITIATOR_PORT_BLOCKED,
567 SEC_STATE_RESPONDER_PORT_BLOCKED,
569 SEC_STATE_SEND_EAPOL,
570 SEC_STATE_SEND_DEAUTH,
571 SEC_STATE_COUNTERMEASURE,
575 typedef struct _TSPEC_ENTRY_T {
577 UINT_8 ucToken; /* Dialog Token in ADDTS_REQ or ADDTS_RSP */
578 UINT_16 u2MediumTime;
580 //PARAM_QOS_TS_INFO rParamTsInfo;
581 /* Add other retained QoS parameters below */
582 } TSPEC_ENTRY_T, *P_TSPEC_ENTRY_T, TSPEC_TABLE_ENTRY_T, *P_TSPEC_TABLE_ENTRY_T;
584 typedef struct _SEC_INFO_T {
586 ENUM_SEC_STATE_T ePreviousState;
587 ENUM_SEC_STATE_T eCurrentState;
592 UINT_8 aucStoredKey[64];
595 } SEC_INFO_T, *P_SEC_INFO_T;
597 #define MAX_NUM_CONCURRENT_FRAGMENTED_MSDUS 3
599 #define UPDATE_BSS_RSSI_INTERVAL_SEC 3 // Seconds
601 /* Fragment information structure */
602 typedef struct _FRAG_INFO_T {
603 UINT_16 u2NextFragSeqCtrl;
604 PUINT_8 pucNextFragStart;
605 P_SW_RFB_T pr1stFrag;
606 OS_SYSTIME rReceiveLifetimeLimit; /* The receive time of 1st fragment */
607 } FRAG_INFO_T, *P_FRAG_INFO_T;
610 /* Define STA record structure */
611 struct _STA_RECORD_T {
612 LINK_ENTRY_T rLinkEntry;
613 UINT_8 ucIndex; /* Not modify it except initializing */
615 BOOLEAN fgIsInUse; /* Indicate if this entry is in use or not */
616 UINT_8 aucMacAddr[MAC_ADDR_LEN]; /* MAC address */
619 ENUM_AA_STATE_T eAuthAssocState; /* Store STATE Value used in SAA/AAA */
620 UINT_8 ucAuthAssocReqSeqNum;
622 ENUM_STA_TYPE_T eStaType; /* Indicate the role of this STA in
623 * the network (for example, P2P GO)
626 UINT_8 ucNetTypeIndex; /* ENUM_NETWORK_TYPE_INDEX_T */
628 UINT_8 ucStaState; /* STATE_1,2,3 */
630 UINT_8 ucPhyTypeSet; /* Available PHY Type Set of this peer
631 * (may deduced from received BSS_DESC_T)
633 UINT_8 ucDesiredPhyTypeSet; /* The match result by AND operation of peer's
634 * PhyTypeSet and ours.
636 BOOLEAN fgHasBasicPhyType; /* A flag to indicate a Basic Phy Type which
637 * is used to generate some Phy Attribute IE
638 * (e.g. capability, MIB) during association.
640 UINT_8 ucNonHTBasicPhyType; /* The Basic Phy Type choosen among the
641 * ucDesiredPhyTypeSet.
644 UINT_16 u2CapInfo; /* For Infra Mode, to store Capability Info. from Association Resp(SAA).
645 * For AP Mode, to store Capability Info. from Association Req(AAA).
647 UINT_16 u2AssocId; /* For Infra Mode, to store AID from Association Resp(SAA).
648 * For AP Mode, to store the Assigned AID(AAA).
651 UINT_16 u2ListenInterval; /* Listen Interval from STA(AAA) */
653 UINT_16 u2DesiredNonHTRateSet; /* Our Current Desired Rate Set after
654 * match with STA's Operational Rate Set
657 UINT_16 u2OperationalRateSet; /* Operational Rate Set of peer BSS */
658 UINT_16 u2BSSBasicRateSet; /* Basic Rate Set of peer BSS */
660 BOOLEAN fgIsMerging; /* For IBSS Mode, to indicate that Merge is ongoing */
662 BOOLEAN fgDiagnoseConnection; /* For Infra/AP Mode, to diagnose the Connection with
663 * this peer by sending ProbeReq/Null frame */
665 /*------------------------------------------------------------------------------------------*/
666 /* 802.11n HT capabilities when (prStaRec->ucPhyTypeSet & PHY_TYPE_BIT_HT) is true */
667 /* They have the same definition with fields of information element */
668 /*------------------------------------------------------------------------------------------*/
669 UINT_8 ucMcsSet; /* MCS0~7 rate set of peer BSS */
670 BOOLEAN fgSupMcs32; /* MCS32 is supported by peer BSS */
671 UINT_16 u2HtCapInfo; /* HT cap info field by HT cap IE */
672 UINT_8 ucAmpduParam; /* Field A-MPDU Parameters in HT cap IE */
673 UINT_16 u2HtExtendedCap; /* HT extended cap field by HT cap IE */
674 UINT_32 u4TxBeamformingCap; /* TX beamforming cap field by HT cap IE */
675 UINT_8 ucAselCap; /* ASEL cap field by HT cap IE */
677 UINT_8 ucRCPI; /* RCPI of peer */
679 UINT_8 ucDTIMPeriod; /* Target BSS's DTIM Period, we use this
680 * value for setup Listen Interval
683 UINT_8 ucAuthAlgNum; /* For Infra/AP Mode, the Auth Alogrithm Num used in Authentication(SAA/AAA) */
684 BOOLEAN fgIsReAssoc; /* For Infra/AP Mode, to indicate ReAssoc Frame was in used(SAA/AAA) */
686 UINT_8 ucTxAuthAssocRetryCount;/* For Infra Mode, the Retry Count of TX Auth/Assod Frame(SAA) */
687 UINT_8 ucTxAuthAssocRetryLimit;/* For Infra Mode, the Retry Limit of TX Auth/Assod Frame(SAA) */
689 UINT_16 u2StatusCode; /* Status of Auth/Assoc Req */
690 UINT_16 u2ReasonCode; /* Reason that been Deauth/Disassoc */
693 P_IE_CHALLENGE_TEXT_T prChallengeText; /* Point to an allocated buffer for storing Challenge Text for Shared Key Authentication */
695 TIMER_T rTxReqDoneOrRxRespTimer;/* For Infra Mode, a timer used to send a timeout event
696 * while waiting for TX request done or RX response.
699 /*------------------------------------------------------------------------------------------*/
700 /* Power Management related fields (for STA/ AP/ P2P/ BOW power saving mode) */
701 /*------------------------------------------------------------------------------------------*/
702 BOOLEAN fgSetPwrMgtBit; /* For Infra Mode, to indicate that outgoing frame need toggle
703 * the Pwr Mgt Bit in its Frame Control Field.
706 BOOLEAN fgIsInPS; /* For AP Mode, to indicate the client PS state(PM).
707 * TRUE: In PS Mode; FALSE: In Active Mode. */
709 BOOLEAN fgIsInPsPollSP; /* For Infra Mode, to indicate we've sent a PS POLL to AP and start
710 * the PS_POLL Service Period(LP)
713 BOOLEAN fgIsInTriggerSP; /* For Infra Mode, to indicate we've sent a Trigger Frame to AP and start
714 * the Delivery Service Period(LP)
717 UINT_8 ucBmpDeliveryAC; /* 0: AC0, 1: AC1, 2: AC2, 3: AC3 */
719 UINT_8 ucBmpTriggerAC; /* 0: AC0, 1: AC1, 2: AC2, 3: AC3 */
721 UINT_8 ucUapsdSp; /* Max SP length */
723 /*------------------------------------------------------------------------------------------*/
725 BOOLEAN fgIsRtsEnabled;
727 OS_SYSTIME rUpdateTime; /* (4) System Timestamp of Successful TX and RX */
729 OS_SYSTIME rLastJoinTime; /* (4) System Timestamp of latest JOIN process */
731 UINT_8 ucJoinFailureCount; /* Retry Count of JOIN process */
733 LINK_T arStaWaitQueue[STA_WAIT_QUEUE_NUM]; /* For TXM to defer pkt forwarding to MAC TX DMA */
735 UINT_16 au2CachedSeqCtrl[TID_NUM + 1]; /* Duplicate removal for HT STA on a per-TID basis ("+1" is for MMPDU and non-QoS) */
739 P_RX_BA_ENTRY_T aprRxBaTable[TID_NUM];
742 P_TX_BA_ENTRY_T aprTxBaTable[TID_NUM];
745 FRAG_INFO_T rFragInfo[MAX_NUM_CONCURRENT_FRAGMENTED_MSDUS];
747 SEC_INFO_T rSecInfo; /* The security state machine */
749 BOOLEAN fgPortBlock; /* The 802.1x Port Control flag */
751 BOOLEAN fgTransmitKeyExist; /* Unicast key exist for this STA */
755 BOOLEAN fgTxAmpduEn; /* Enable TX AMPDU for this Peer */
756 BOOLEAN fgRxAmpduEn; /* Enable RX AMPDU for this Peer */
758 PUINT_8 pucAssocReqIe;
759 UINT_16 u2AssocReqIeLen;
760 /*------------------------------------------------------------------------------------------*/
761 /* WMM/QoS related fields */
762 /*------------------------------------------------------------------------------------------*/
763 BOOLEAN fgIsQoS; /* If the STA is associated as a QSTA or QAP (for TX/RX) */
764 BOOLEAN fgIsWmmSupported; /* If the peer supports WMM, set to TRUE (for association)*/
765 BOOLEAN fgIsUapsdSupported; /* Set according to the scan result (for association) */
767 /*------------------------------------------------------------------------------------------*/
768 /* P2P related fields */
769 /*------------------------------------------------------------------------------------------*/
770 #if CFG_ENABLE_WIFI_DIRECT
772 UINT_8 aucDevName[WPS_ATTRI_MAX_LEN_DEVICE_NAME];
774 UINT_8 aucDevAddr[MAC_ADDR_LEN]; /* P2P Device Address */
776 UINT_16 u2ConfigMethods;
780 UINT_8 ucSecondaryDevTypeCount;
782 DEVICE_TYPE_T rPrimaryDevTypeBE;
784 DEVICE_TYPE_T arSecondaryDevTypeBE[P2P_GC_MAX_CACHED_SEC_DEV_TYPE_COUNT];
785 #endif /* CFG_SUPPORT_P2P */
788 /*------------------------------------------------------------------------------------------*/
789 /* QM related fields */
790 /*------------------------------------------------------------------------------------------*/
792 UINT_8 ucFreeQuota; /* Per Sta flow controal. Valid when fgIsInPS is TRUE. Chnage it for per Queue flow control */
793 //UINT_8 aucFreeQuotaPerQueue[NUM_OF_PER_STA_TX_QUEUES]; /* used in future */
794 UINT_8 ucFreeQuotaForDelivery;
795 UINT_8 ucFreeQuotaForNonDelivery;
798 /*------------------------------------------------------------------------------------------*/
799 /* To be removed, this is to make que_mgt compilation success only */
800 /*------------------------------------------------------------------------------------------*/
801 /* When this STA_REC is in use, set to TRUE. */
804 /* Per-STA Queues: [0] AC0, [1] AC1, [2] AC2, [3] AC3, [4] 802.1x */
805 QUE_T arTxQueue[NUM_OF_PER_STA_TX_QUEUES];
807 /* When this STA is in PS Mode, set to TRUE. */
810 /* When this STA enters Power-Saving, FW will notify the driver with a Session ID */
811 UINT_8 ucPsSessionID;
815 /* Reorder Parameter reference table */
816 P_RX_BA_ENTRY_T aprRxReorderParamRefTbl[CFG_RX_MAX_BA_TID_NUM];
819 #if CFG_SUPPORT_802_11V_TIMING_MEASUREMENT
820 TIMINGMSMT_PARAM_T rWNMTimingMsmt;
825 /* use nic_tx.h instead */
826 /* MSDU_INFO and SW_RFB structure */
827 typedef struct _MSDU_INFO_T {
829 //4 /* ----------------MSDU_INFO and SW_RFB Common Fields------------------ */
831 LINK_ENTRY_T rLinkEntry;
832 PUINT_8 pucBuffer; /* Pointer to the associated buffer */
834 UINT_8 ucBufferSource; /* HIF TX0, HIF TX1, MAC RX, or MNG Pool */
835 UINT_8 ucNetworkTypeIndex; /* Network type index that this TX packet is assocaited with */
836 UINT_8 ucTC; /* 0 to 5 (used by HIF TX to increment the corresponding TC counter) */
837 UINT_8 ucTID; /* Traffic Identification */
839 BOOLEAN fgIs802_11Frame; /* Set to TRUE for 802.11 frame */
840 UINT_8 ucMacHeaderLength;
841 UINT_16 u2PayloadLength;
842 PUINT_8 pucMacHeader; /* 802.11 header */
843 PUINT_8 pucPayload; /* 802.11 payload */
845 OS_SYSTIME rArrivalTime; /* System Timestamp (4) */
846 P_STA_RECORD_T prStaRec;
848 #if CFG_PROFILE_BUFFER_TRACING
849 ENUM_BUFFER_ACTIVITY_TYPE_T eActivity[2];
850 UINT_32 rActivityTime[2];
852 #if DBG && CFG_BUFFER_FREE_CHK
853 BOOLEAN fgBufferInSource;
856 UINT_8 ucControlFlag; /* For specify some Control Flags, e.g. Basic Rate */
858 //4 /* -----------------------Non-Common ------------------------- */
859 /* TODO: move flags to ucControlFlag */
861 BOOLEAN fgIs1xFrame; /* Set to TRUE for 802.1x frame */
863 /* TXM: For TX Done handling, callback function & parameter (5) */
864 BOOLEAN fgIsTxFailed; /* Set to TRUE if transmission failure */
866 PFN_TX_DONE_HANDLER pfTxDoneHandler;
868 UINT_64 u8TimeStamp; /* record the TX timestamp */
870 /* TXM: For PS forwarding control (per-STA flow control) */
871 UINT_8 ucPsForwardingType; /* Delivery-enabled, non-delivery-enabled, non-PS */
872 UINT_8 ucPsSessionID; /* The Power Save session id for PS forwarding control*/
874 /* TXM: For MAC TX DMA operations */
875 UINT_8 ucMacTxQueIdx; /* MAC TX queue: AC0-AC6, BCM, or BCN */
876 BOOLEAN fgNoAck; /* Set to true if Ack is not requred for this packet */
877 BOOLEAN fgBIP; /* Set to true if BIP is used for this packet */
878 UINT_8 ucFragTotalCount;
879 UINT_8 ucFragFinishedCount;
880 UINT_16 u2FragThreshold; /* Fragmentation threshold without WLAN Header & FCS */
881 BOOLEAN fgFixedRate; /* If a fixed rate is used, set to TRUE. */
882 UINT_8 ucFixedRateCode; /* The rate code copied to MAC TX Desc */
883 UINT_8 ucFixedRateRetryLimit; /* The retry limit when a fixed rate is used */
884 BOOLEAN fgIsBmcQueueEnd; /* Set to true if this packet is the end of BMC */
886 /* TXM: For flushing ACL frames */
887 UINT_16 u2PalLLH; /* 802.11 PAL LLH */
889 UINT_16 u2ACLSeq; /* u2LLH+u2ACLSeq for AM HCI flush ACL frame */
891 /* TXM for retransmitting a flushed packet */
892 BOOLEAN fgIsSnAssigned;
893 UINT_16 u2SequenceNumber; /* To remember the Sequence Control field of this MPDU */
895 } MSDU_INFO_T, *P_MSDU_INFO_T;
900 typedef struct _SW_RFB_T {
902 //4 /* ----------------MSDU_INFO and SW_RFB Common Fields------------------ */
904 LINK_ENTRY_T rLinkEntry;
905 PUINT_8 pucBuffer; /* Pointer to the associated buffer */
907 UINT_8 ucBufferSource; /* HIF TX0, HIF TX1, MAC RX, or MNG Pool */
908 UINT_8 ucNetworkTypeIndex; /* Network type index that this TX packet is assocaited with */
909 UINT_8 ucTC; /* 0 to 5 (used by HIF TX to increment the corresponding TC counter) */
910 UINT_8 ucTID; /* Traffic Identification */
912 BOOLEAN fgIs802_11Frame; /* Set to TRUE for 802.11 frame */
913 UINT_8 ucMacHeaderLength;
914 UINT_16 u2PayloadLength;
915 PUINT_8 pucMacHeader; /* 802.11 header */
916 PUINT_8 pucPayload; /* 802.11 payload */
918 OS_SYSTIME rArrivalTime; /* System Timestamp (4) */
919 P_STA_RECORD_T prStaRec;
921 #if CFG_PROFILE_BUFFER_TRACING
922 ENUM_BUFFER_ACTIVITY_TYPE_T eActivity[2];
923 UINT_32 rActivityTime[2];
925 #if DBG && CFG_BUFFER_FREE_CHK
926 BOOLEAN fgBufferInSource;
929 UINT_8 ucControlFlag; /* For specify some Control Flags, e.g. Basic Rate */
931 //4 /* -----------------------Non-Common ------------------------- */
933 /* For composing the HIF RX Header (TODO: move flags to ucControlFlag) */
934 PUINT_8 pucHifRxPacket; /* Pointer to the Response packet to HIF RX0 or RX1 */
935 UINT_16 u2HifRxPacketLength;
936 UINT_8 ucHeaderOffset;
937 UINT_8 ucHifRxPortIndex;
939 UINT_16 u2SequenceControl;
940 BOOLEAN fgIsA4Frame; /* (For MAC RX packet parsing) set to TRUE if 4 addresses are present */
943 BOOLEAN fgIsAmsduSubframe; /* Set to TRUE for A-MSDU Subframe */
945 /* For HIF RX DMA Desc */
946 BOOLEAN fgTUChecksumCheckRequired;
947 BOOLEAN fgIPChecksumCheckRequired;
948 UINT_8 ucEtherTypeOffset;
950 } SW_RFB_T, *P_SW_RFB_T;
954 /*******************************************************************************
955 * P U B L I C D A T A
956 ********************************************************************************
959 /*******************************************************************************
960 * P R I V A T E D A T A
961 ********************************************************************************
964 /*******************************************************************************
966 ********************************************************************************
969 /*******************************************************************************
970 * F U N C T I O N D E C L A R A T I O N S
971 ********************************************************************************
976 IN P_ADAPTER_T prAdapter,
982 IN P_ADAPTER_T prAdapter,
983 IN P_MSDU_INFO_T prMsduInfo
988 IN P_ADAPTER_T prAdapter
993 IN P_ADAPTER_T prAdapter,
994 IN ENUM_RAM_TYPE_T eRamType,
1000 IN P_ADAPTER_T prAdapter,
1006 IN P_ADAPTER_T prAdapter
1011 IN P_ADAPTER_T prAdapter
1016 IN P_ADAPTER_T prAdapter,
1017 IN UINT_8 ucNetTypeIndex
1022 IN P_ADAPTER_T prAdapter,
1023 IN P_STA_RECORD_T prStaRec,
1024 IN BOOLEAN fgSyncToChip
1028 cnmStaFreeAllStaByNetType (
1029 P_ADAPTER_T prAdapter,
1030 ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex,
1031 BOOLEAN fgSyncToChip
1035 cnmGetStaRecByIndex (
1036 IN P_ADAPTER_T prAdapter,
1041 cnmGetStaRecByAddress (
1042 IN P_ADAPTER_T prAdapter,
1043 IN UINT_8 ucNetTypeIndex,
1044 IN UINT_8 aucPeerMACAddress[]
1048 cnmStaRecResetStatus (
1049 IN P_ADAPTER_T prAdapter,
1050 IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex
1054 cnmStaRecChangeState (
1055 IN P_ADAPTER_T prAdapter,
1056 IN OUT P_STA_RECORD_T prStaRec,
1057 IN UINT_8 ucNewState
1060 /*******************************************************************************
1062 ********************************************************************************
1065 /* Kevin: we don't have to call following function to inspect the data structure.
1066 * It will check automatically while at compile time.
1067 * We'll need this for porting driver to different RTOS.
1070 cnmMemDataTypeCheck (
1075 DATA_STRUC_INSPECTING_ASSERT(
1076 OFFSET_OF(MSDU_INFO_T,rLinkEntry) == 0);
1078 DATA_STRUC_INSPECTING_ASSERT(
1079 OFFSET_OF(MSDU_INFO_T,rLinkEntry) == OFFSET_OF(SW_RFB_T,rLinkEntry));
1081 DATA_STRUC_INSPECTING_ASSERT(
1082 OFFSET_OF(MSDU_INFO_T,pucBuffer) == OFFSET_OF(SW_RFB_T,pucBuffer));
1084 DATA_STRUC_INSPECTING_ASSERT(
1085 OFFSET_OF(MSDU_INFO_T,ucBufferSource) ==
1086 OFFSET_OF(SW_RFB_T,ucBufferSource));
1088 DATA_STRUC_INSPECTING_ASSERT(
1089 OFFSET_OF(MSDU_INFO_T,pucMacHeader) ==
1090 OFFSET_OF(SW_RFB_T,pucMacHeader));
1092 DATA_STRUC_INSPECTING_ASSERT(
1093 OFFSET_OF(MSDU_INFO_T,ucMacHeaderLength) ==
1094 OFFSET_OF(SW_RFB_T,ucMacHeaderLength));
1096 DATA_STRUC_INSPECTING_ASSERT(
1097 OFFSET_OF(MSDU_INFO_T,pucPayload) ==
1098 OFFSET_OF(SW_RFB_T,pucPayload));
1100 DATA_STRUC_INSPECTING_ASSERT(
1101 OFFSET_OF(MSDU_INFO_T,u2PayloadLength) ==
1102 OFFSET_OF(SW_RFB_T,u2PayloadLength));
1104 DATA_STRUC_INSPECTING_ASSERT(
1105 OFFSET_OF(MSDU_INFO_T,prStaRec) ==
1106 OFFSET_OF(SW_RFB_T,prStaRec));
1108 DATA_STRUC_INSPECTING_ASSERT(
1109 OFFSET_OF(MSDU_INFO_T,ucNetworkTypeIndex) ==
1110 OFFSET_OF(SW_RFB_T,ucNetworkTypeIndex));
1112 DATA_STRUC_INSPECTING_ASSERT(
1113 OFFSET_OF(MSDU_INFO_T,ucTID) ==
1114 OFFSET_OF(SW_RFB_T,ucTID));
1116 DATA_STRUC_INSPECTING_ASSERT(
1117 OFFSET_OF(MSDU_INFO_T,fgIs802_11Frame) ==
1118 OFFSET_OF(SW_RFB_T,fgIs802_11Frame));
1120 DATA_STRUC_INSPECTING_ASSERT(
1121 OFFSET_OF(MSDU_INFO_T,ucControlFlag) ==
1122 OFFSET_OF(SW_RFB_T,ucControlFlag));
1124 DATA_STRUC_INSPECTING_ASSERT(
1125 OFFSET_OF(MSDU_INFO_T,rArrivalTime) ==
1126 OFFSET_OF(SW_RFB_T,rArrivalTime));
1128 DATA_STRUC_INSPECTING_ASSERT(
1129 OFFSET_OF(MSDU_INFO_T,ucTC) ==
1130 OFFSET_OF(SW_RFB_T,ucTC));
1132 #if CFG_PROFILE_BUFFER_TRACING
1133 DATA_STRUC_INSPECTING_ASSERT(
1134 OFFSET_OF(MSDU_INFO_T,eActivity[0]) ==
1135 OFFSET_OF(SW_RFB_T,eActivity[0]));
1137 DATA_STRUC_INSPECTING_ASSERT(
1138 OFFSET_OF(MSDU_INFO_T,rActivityTime[0]) ==
1139 OFFSET_OF(SW_RFB_T,rActivityTime[0]));
1142 #if DBG && CFG_BUFFER_FREE_CHK
1143 DATA_STRUC_INSPECTING_ASSERT(
1144 OFFSET_OF(MSDU_INFO_T,fgBufferInSource) ==
1145 OFFSET_OF(SW_RFB_T,fgBufferInSource));
1149 DATA_STRUC_INSPECTING_ASSERT(
1150 OFFSET_OF(STA_RECORD_T,rLinkEntry) == 0);
1157 #endif /* _CNM_MEM_H */