wifi: renew patch drivers/net/wireless
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / mt5931 / include / mgmt / cnm_mem.h
1 /*
2 ** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/mgmt/cnm_mem.h#1 $
3 */
4
5 /*! \file   "cnm_mem.h"
6     \brief  In this file we define the structure of the control unit of
7             packet buffer and MGT/MSG Memory Buffer.
8 */
9
10
11
12 /*
13 ** $Log: cnm_mem.h $
14  *
15  * 03 02 2012 terry.wu
16  * NULL
17  * Snc CFG80211 modification for ICS migration from branch 2.2.
18  *
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.
22  *
23  * 03 17 2011 yuche.tsai
24  * NULL
25  * Resize the Secondary Device Type array when WiFi Direct is enabled.
26  *
27  * 03 16 2011 wh.su
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 .
30  *
31  * 01 26 2011 cm.chang
32  * [WCXRP00000395] [MT6620 Wi-Fi][Driver][FW] Search STA_REC with additional net type index argument
33  * .
34  *
35  * 01 11 2011 eddie.chen
36  * [WCXRP00000322] Add WMM IE in beacon,
37
38 Add per station flow control when STA is in PS
39
40
41  * Add per STA flow control when STA is in PS mode
42  *
43  * 12 29 2010 eddie.chen
44  * [WCXRP00000322] Add WMM IE in beacon,
45 Add per station flow control when STA is in PS
46
47  * 1) PS flow control event
48  *
49  * 2) WMM IE in beacon, assoc resp, probe resp
50  *
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
55  *
56  * 12 07 2010 cm.chang
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
60  *
61  * 11 29 2010 cm.chang
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
64  *
65  * 10 18 2010 cp.wu
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
69  *
70  * 09 21 2010 kevin.huang
71  * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning
72  * Eliminate Linux Compile Warning
73  *
74  * 09 03 2010 kevin.huang
75  * NULL
76  * Refine #include sequence and solve recursive/nested #include issue
77  *
78  * 07 12 2010 cp.wu
79  *
80  * SAA will take a record for tracking request sequence number.
81  *
82  * 07 08 2010 cp.wu
83  *
84  * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
85  *
86  * 07 07 2010 cm.chang
87  * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
88  * Support state of STA record change from 1 to 1
89  *
90  * 07 01 2010 cm.chang
91  * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
92  * Support sync command of STA_REC
93  *
94  * 06 21 2010 wh.su
95  * [WPD00003840][MT6620 5931] Security migration
96  * modify some code for concurrent network.
97  *
98  * 06 21 2010 yuche.tsai
99  * [WPD00003839][MT6620 5931][P2P] Feature migration
100  * Fix compile error for P2P related defination.
101  *
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
105  *
106  * 06 17 2010 yuche.tsai
107  * [WPD00003839][MT6620 5931][P2P] Feature migration
108  * Add P2P related fields.
109  *
110  * 06 14 2010 cp.wu
111  * [WPD00003833][MT6620 and MT5931] Driver migration
112  * saa_fsm.c is migrated.
113  *
114  * 06 14 2010 cp.wu
115  * [WPD00003833][MT6620 and MT5931] Driver migration
116  * restore utility function invoking via hem_mbox to direct calls
117  *
118  * 06 10 2010 cp.wu
119  * [WPD00003833][MT6620 and MT5931] Driver migration
120  * add buildable & linkable ais_fsm.c
121  *
122  * related reference are still waiting to be resolved
123  *
124  * 06 08 2010 cp.wu
125  * [WPD00003833][MT6620 and MT5931] Driver migration
126  * hem_mbox is migrated.
127  *
128  * 06 08 2010 cp.wu
129  * [WPD00003833][MT6620 and MT5931] Driver migration
130  * add hem_mbox.c and cnm_mem.h (but disabled some feature) for further migration
131  *
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
138  *
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
142  *
143  * 05 28 2010 cm.chang
144  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
145  * Support checking  of duplicated buffer free
146  *
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
150  *
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
154  *
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
158  *
159  * 05 12 2010 kevin.huang
160  * [BORA00000794][WIFISYS][New Feature]Power Management Support
161  * Add Power Management - Legacy PS-POLL support.
162  *
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
166  *
167  * 05 07 2010 george.huang
168  * [BORA00000678][MT6620]WiFi LP integration
169  * add more sanity check about setting timer
170  *
171  * 04 29 2010 george.huang
172  * [BORA00000678][MT6620]WiFi LP integration
173  * modify the compiling flag for RAM usage
174  *
175  * 04 28 2010 tehuang.liu
176  * [BORA00000605][WIFISYS] Phase3 Integration
177  * Modified some MQM-related data structures (SN counter, TX/RX BA table)
178  *
179  * 04 27 2010 tehuang.liu
180  * [BORA00000605][WIFISYS] Phase3 Integration
181  * Added new TX/RX BA tables in STA_REC
182  *
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
186  *
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
191  *
192  * 03 24 2010 cm.chang
193  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
194  * Support power control
195  *
196  * 03 16 2010 kevin.huang
197  * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support
198  * Add AdHoc Mode
199  *
200  * 03 11 2010 yuche.tsai
201  * [BORA00000343][MT6620] Emulation For TX
202  * .
203  *
204  * 03 05 2010 yarco.yang
205  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
206  * Remove Emulation definition
207  *
208  * 03 04 2010 cp.wu
209  * [BORA00000368]Integrate HIF part into BORA
210  * eliminate HIF_EMULATION in cnm_mem.h
211  *
212  * 03 04 2010 kevin.huang
213  * [BORA00000603][WIFISYS] [New Feature] AAA Module Support
214  * Add cnmStaRecChangeState() declaration.
215  *
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
219  *
220  * 03 03 2010 wh.su
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.
223  *
224  * 03 03 2010 wh.su
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.
227  *
228  * 03 01 2010 tehuang.liu
229  * [BORA00000569][WIFISYS] Phase 2 Integration Test
230  * To store field AMPDU Parameters in STA_REC
231  *
232  * 02 26 2010 tehuang.liu
233  * [BORA00000569][WIFISYS] Phase 2 Integration Test
234  * Added fgIsWmmSupported in STA_RECORD_T.
235  *
236  * 02 26 2010 tehuang.liu
237  * [BORA00000569][WIFISYS] Phase 2 Integration Test
238  * Added fgIsUapsdSupported in STA_RECORD_T
239  *
240  * 02 13 2010 tehuang.liu
241  * [BORA00000569][WIFISYS] Phase 2 Integration Test
242  * Added arTspecTable in STA_REC for TSPEC management
243  *
244  * 02 12 2010 cm.chang
245  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
246  * Enable mgmt buffer debug by default
247  *
248  * 02 12 2010 tehuang.liu
249  * [BORA00000569][WIFISYS] Phase 2 Integration Test
250  * Added BUFFER_SOURCE_BCN
251  *
252  * 02 10 2010 tehuang.liu
253  * [BORA00000569][WIFISYS] Phase 2 Integration Test
254  * Renamed MSDU_INFO.ucFixedRateIndex as MSDU_INFO.ucFixedRateCode
255  *
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
259  *
260  * 02 02 2010 tehuang.liu
261  * [BORA00000569][WIFISYS] Phase 2 Integration Test
262  * Added SN info in MSDU_INFO_T
263  *
264  * 01 27 2010 wh.su
265  * [BORA00000476][Wi-Fi][firmware] Add the security module initialize code
266  * add and fixed some security function.
267  *
268  * 01 11 2010 kevin.huang
269  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
270  * Add Deauth and Disassoc Handler
271  *
272  * 01 08 2010 cp.wu
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
277  *
278  * 12 31 2009 cp.wu
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
282  *
283  * 12 31 2009 cp.wu
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
288  *
289  * 12 29 2009 yuche.tsai
290  * [BORA00000343][MT6620] Emulation For TX
291  * .Using global buffer declaring by SD1 instead of using another one.
292  *
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)
296  *  * MQM: BA handling
297  *  * TXM: Macros updates
298  *  * RXM: Macros/Duplicate Removal updates
299  *
300  * 12 24 2009 yarco.yang
301  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
302  * .
303  *
304  * 12 23 2009 cp.wu
305  * [BORA00000368]Integrate HIF part into BORA
306  * allocating SRAM for emulation purpose by ruducing MEM_BANK3_BUF_SZ
307  *
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
311  *
312  * 12 21 2009 cm.chang
313  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
314  * Support several data buffer banks.
315  *
316  * 12 18 2009 cm.chang
317  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
318  * .For new FPGA memory size
319  *
320  * 12 18 2009 cm.chang
321  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
322  * .
323  *
324  * 12 17 2009 george.huang
325  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
326  * .
327  *
328  * Dec 17 2009 MTK02468
329  * [BORA00000337] To check in codes for FPGA emulation
330  * Modified the DATA_BLOCK_SIZE from 1620 to 2048
331  *
332  * Dec 16 2009 mtk01426
333  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
334  * Add CFG_TEST_SEC_EMULATION flag
335  *
336  * Dec 9 2009 mtk01104
337  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
338  * Add HT cap to sta record
339  *
340  * Dec 9 2009 mtk02752
341  * [BORA00000368] Integrate HIF part into BORA
342  * add cnmDataPktFree() for emulation loopback purpose
343  *
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
347  *
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
351  *
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
355  *
356  * Dec 1 2009 mtk01088
357  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
358  * rename the port block flag
359  *
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
363  *
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)
367  *
368  * Nov 20 2009 mtk02468
369  * [BORA00000337] To check in codes for FPGA emulation
370  * Removed u2FrameLength from SW_RFB
371  *
372  * Nov 20 2009 mtk02468
373  * [BORA00000337] To check in codes for FPGA emulation
374  * Fixed indenting
375  *
376  * Nov 20 2009 mtk02468
377  * [BORA00000337] To check in codes for FPGA emulation
378  * Updated MSDU_INFO and SW_RFB
379  *
380  * Nov 19 2009 mtk01088
381  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
382  * update the variable for security
383  *
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
387  *
388  * Nov 18 2009 mtk01088
389  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
390  * add the variable for security module
391  *
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
395  *
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
399  *
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
403  *
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
407  *
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
411  *
412  * Nov 6 2009 mtk01426
413  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
414  *
415  *
416  * Nov 5 2009 mtk01426
417  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
418  *
419  *
420  * Nov 5 2009 mtk01461
421  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
422  * Update comment
423  *
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
427  *
428  * Oct 30 2009 mtk01084
429  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
430  *
431  *
432  * Oct 28 2009 mtk01104
433  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
434  *
435  *
436  * Oct 23 2009 mtk01461
437  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
438  * Fix lint warning
439  *
440  * Oct 21 2009 mtk01426
441  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
442  * Add CFG_TEST_RX_EMULATION flag
443  *
444  * Oct 20 2009 mtk01426
445  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
446  *
447  *
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
451  *
452  * Oct 8 2009 mtk01104
453  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
454  *
455 **
456 */
457
458 #ifndef _CNM_MEM_H
459 #define _CNM_MEM_H
460
461 /*******************************************************************************
462 *                         C O M P I L E R   F L A G S
463 ********************************************************************************
464 */
465
466 /*******************************************************************************
467 *                    E X T E R N A L   R E F E R E N C E S
468 ********************************************************************************
469 */
470
471 /*******************************************************************************
472 *                              C O N S T A N T S
473 ********************************************************************************
474 */
475
476 #ifndef POWER_OF_2
477 #define POWER_OF_2(n)                           BIT(n)
478 #endif
479
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 */
483
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)
487
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)
491
492 /* Number of management buffer block */
493 #define MAX_NUM_OF_BUF_BLOCKS                   32 /* Range: 1~32 */
494
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)
498
499
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 */
505
506
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 */
512 #endif
513
514
515 /*******************************************************************************
516 *                             D A T A   T Y P E S
517 ********************************************************************************
518 */
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;
525 #else
526     typedef UINT_8 BUF_BITMAP;
527 #endif /* MAX_NUM_OF_MGT_BUF_BLOCKS */
528
529
530 /* Control variable of TX management memory pool */
531 typedef struct _BUF_INFO_T {
532     PUINT_8     pucBuf;
533
534 #if CFG_DBG_MGT_BUF
535     UINT_32     u4AllocCount;
536     UINT_32     u4FreeCount;
537     UINT_32     u4AllocNullCount;
538 #endif /* CFG_DBG_MGT_BUF */
539
540     BUF_BITMAP  rFreeBlocksBitmap;
541     UINT_8      aucAllocatedBlockNum[MAX_NUM_OF_BUF_BLOCKS];
542 } BUF_INFO_T, *P_BUF_INFO_T;
543
544
545 /* Wi-Fi divides RAM into three types
546  * MSG:     Mailbox message (Small size)
547  * BUF:     HW DMA buffers (HIF/MAC)
548  */
549 typedef enum _ENUM_RAM_TYPE_T {
550     RAM_TYPE_MSG = 0,
551     RAM_TYPE_BUF
552 } ENUM_RAM_TYPE_T, P_ENUM_RAM_TYPE_T;
553
554 typedef enum _ENUM_BUFFER_SOURCE_T {
555     BUFFER_SOURCE_HIF_TX0 =0,
556     BUFFER_SOURCE_HIF_TX1,
557     BUFFER_SOURCE_MAC_RX,
558     BUFFER_SOURCE_MNG,
559     BUFFER_SOURCE_BCN,
560     BUFFER_SOURCE_NUM
561 } ENUM_BUFFER_SOURCE_T, *P_ENUM_BUFFER_SOURCE_T;
562
563
564 typedef enum _ENUM_SEC_STATE_T {
565     SEC_STATE_INIT,
566     SEC_STATE_INITIATOR_PORT_BLOCKED,
567     SEC_STATE_RESPONDER_PORT_BLOCKED,
568     SEC_STATE_CHECK_OK,
569     SEC_STATE_SEND_EAPOL,
570     SEC_STATE_SEND_DEAUTH,
571     SEC_STATE_COUNTERMEASURE,
572     SEC_STATE_NUM
573 } ENUM_SEC_STATE_T;
574
575 typedef struct _TSPEC_ENTRY_T {
576     UINT_8  ucStatus;
577     UINT_8  ucToken; /* Dialog Token in ADDTS_REQ or ADDTS_RSP */
578     UINT_16 u2MediumTime;
579     UINT_32 u4TsInfo;
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;
583
584 typedef struct _SEC_INFO_T {
585
586     ENUM_SEC_STATE_T        ePreviousState;
587     ENUM_SEC_STATE_T        eCurrentState;
588
589     BOOL                    fg2nd1xSend;
590     BOOL                    fgKeyStored;
591
592     UINT_8                  aucStoredKey[64];
593
594     BOOL                    fgAllowOnly1x;
595 } SEC_INFO_T, *P_SEC_INFO_T;
596
597 #define MAX_NUM_CONCURRENT_FRAGMENTED_MSDUS     3
598
599 #define UPDATE_BSS_RSSI_INTERVAL_SEC            3 // Seconds
600
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;
608
609
610 /* Define STA record structure */
611 struct _STA_RECORD_T {
612     LINK_ENTRY_T            rLinkEntry;
613     UINT_8                  ucIndex;                    /* Not modify it except initializing */
614
615     BOOLEAN                 fgIsInUse;                  /* Indicate if this entry is in use or not */
616     UINT_8                  aucMacAddr[MAC_ADDR_LEN];   /* MAC address */
617
618     /* SAA/AAA */
619     ENUM_AA_STATE_T         eAuthAssocState;        /* Store STATE Value used in SAA/AAA */
620     UINT_8                  ucAuthAssocReqSeqNum;
621
622     ENUM_STA_TYPE_T         eStaType;               /* Indicate the role of this STA in
623                                                      * the network (for example, P2P GO)
624                                                      */
625
626     UINT_8                  ucNetTypeIndex;         /* ENUM_NETWORK_TYPE_INDEX_T */
627
628     UINT_8                  ucStaState;             /* STATE_1,2,3 */
629
630     UINT_8                  ucPhyTypeSet;           /* Available PHY Type Set of this peer
631                                                      * (may deduced from received BSS_DESC_T)
632                                                      */
633     UINT_8                  ucDesiredPhyTypeSet;    /* The match result by AND operation of peer's
634                                                      * PhyTypeSet and ours.
635                                                      */
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.
639                                                      */
640     UINT_8                  ucNonHTBasicPhyType;    /* The Basic Phy Type choosen among the
641                                                      * ucDesiredPhyTypeSet.
642                                                      */
643
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).
646                                                      */
647     UINT_16                 u2AssocId;              /* For Infra Mode, to store AID from Association Resp(SAA).
648                                                      * For AP Mode, to store the Assigned AID(AAA).
649                                                      */
650
651     UINT_16                 u2ListenInterval;       /* Listen Interval from STA(AAA) */
652
653     UINT_16                 u2DesiredNonHTRateSet;  /* Our Current Desired Rate Set after
654                                                      * match with STA's Operational Rate Set
655                                                      */
656
657     UINT_16                 u2OperationalRateSet;   /* Operational Rate Set of peer BSS */
658     UINT_16                 u2BSSBasicRateSet;      /* Basic Rate Set of peer BSS */
659
660     BOOLEAN                 fgIsMerging;            /* For IBSS Mode, to indicate that Merge is ongoing */
661
662     BOOLEAN                 fgDiagnoseConnection;   /* For Infra/AP Mode, to diagnose the Connection with
663                                                      * this peer by sending ProbeReq/Null frame */
664
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 */
676
677     UINT_8                  ucRCPI;                 /* RCPI of peer */
678
679     UINT_8                  ucDTIMPeriod;           /* Target BSS's DTIM Period, we use this
680                                                      * value for setup Listen Interval
681                                                      * TODO(Kevin): TBD
682                                                      */
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) */
685
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) */
688
689     UINT_16                 u2StatusCode;       /* Status of Auth/Assoc Req */
690     UINT_16                 u2ReasonCode;       /* Reason that been Deauth/Disassoc */
691
692
693     P_IE_CHALLENGE_TEXT_T   prChallengeText;    /* Point to an allocated buffer for storing Challenge Text for Shared Key Authentication */
694
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.
697                                                      */
698
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.
704                                                      */
705
706     BOOLEAN                 fgIsInPS;               /* For AP Mode, to indicate the client PS state(PM).
707                                                      * TRUE: In PS Mode; FALSE: In Active Mode. */
708
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)
711                                                          */
712
713     BOOLEAN                 fgIsInTriggerSP;            /* For Infra Mode, to indicate we've sent a Trigger Frame to AP and start
714                                                          * the Delivery Service Period(LP)
715                                                          */
716
717     UINT_8                  ucBmpDeliveryAC;        /* 0: AC0, 1: AC1, 2: AC2, 3: AC3 */
718
719     UINT_8                  ucBmpTriggerAC;         /* 0: AC0, 1: AC1, 2: AC2, 3: AC3 */
720
721     UINT_8                  ucUapsdSp;  /* Max SP length */
722
723     /*------------------------------------------------------------------------------------------*/
724
725     BOOLEAN                 fgIsRtsEnabled;
726
727     OS_SYSTIME              rUpdateTime;        /* (4) System Timestamp of Successful TX and RX  */
728
729     OS_SYSTIME              rLastJoinTime;      /* (4) System Timestamp of latest JOIN process */
730
731     UINT_8                  ucJoinFailureCount; /* Retry Count of JOIN process */
732
733     LINK_T                  arStaWaitQueue[STA_WAIT_QUEUE_NUM];     /* For TXM to defer pkt forwarding to MAC TX DMA */
734
735     UINT_16                 au2CachedSeqCtrl[TID_NUM + 1];          /* Duplicate removal for HT STA on a per-TID basis ("+1" is for MMPDU and non-QoS) */
736
737 #if 0
738     /* RXM */
739     P_RX_BA_ENTRY_T         aprRxBaTable[TID_NUM];
740
741     /* TXM */
742     P_TX_BA_ENTRY_T         aprTxBaTable[TID_NUM];
743 #endif
744
745     FRAG_INFO_T             rFragInfo[MAX_NUM_CONCURRENT_FRAGMENTED_MSDUS];
746
747     SEC_INFO_T              rSecInfo; /* The security state machine */
748
749     BOOLEAN                 fgPortBlock; /* The 802.1x Port Control flag */
750
751     BOOLEAN                 fgTransmitKeyExist; /* Unicast key exist for this STA */
752
753     UINT_8                  ucWTEntry;
754
755     BOOLEAN                 fgTxAmpduEn; /* Enable TX AMPDU for this Peer */
756     BOOLEAN                 fgRxAmpduEn; /* Enable RX AMPDU for this Peer */
757
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) */
766
767     /*------------------------------------------------------------------------------------------*/
768     /* P2P related fields                                                                       */
769     /*------------------------------------------------------------------------------------------*/
770 #if CFG_ENABLE_WIFI_DIRECT
771     UINT_8                  u2DevNameLen;
772     UINT_8                  aucDevName[WPS_ATTRI_MAX_LEN_DEVICE_NAME];
773
774     UINT_8                  aucDevAddr[MAC_ADDR_LEN];   /* P2P Device Address */
775
776     UINT_16                 u2ConfigMethods;
777
778     UINT_8                  ucDeviceCap;
779
780     UINT_8                  ucSecondaryDevTypeCount;
781
782     DEVICE_TYPE_T           rPrimaryDevTypeBE;
783
784     DEVICE_TYPE_T           arSecondaryDevTypeBE[P2P_GC_MAX_CACHED_SEC_DEV_TYPE_COUNT];
785 #endif /* CFG_SUPPORT_P2P */
786
787
788     /*------------------------------------------------------------------------------------------*/
789     /* QM related fields                                                                       */
790     /*------------------------------------------------------------------------------------------*/
791
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;
796
797 #if 1
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. */
802     BOOLEAN fgIsValid;
803
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];
806
807     /* When this STA is in PS Mode, set to TRUE. */
808     //BOOLEAN fgIsPS;
809
810     /* When this STA enters Power-Saving, FW will notify the driver with a Session ID */
811     UINT_8  ucPsSessionID;
812
813     BOOLEAN fgIsAp;
814
815     /* Reorder Parameter reference table */
816     P_RX_BA_ENTRY_T  aprRxReorderParamRefTbl[CFG_RX_MAX_BA_TID_NUM];
817 #endif
818
819 #if CFG_SUPPORT_802_11V_TIMING_MEASUREMENT
820     TIMINGMSMT_PARAM_T rWNMTimingMsmt;
821 #endif
822 };
823
824 #if 0
825 /* use nic_tx.h instead */
826 /* MSDU_INFO and SW_RFB structure */
827 typedef struct _MSDU_INFO_T {
828
829   //4  /* ----------------MSDU_INFO and SW_RFB Common Fields------------------ */
830
831     LINK_ENTRY_T    rLinkEntry;
832     PUINT_8         pucBuffer;          /* Pointer to the associated buffer */
833
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 */
838
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 */
844
845     OS_SYSTIME      rArrivalTime;       /* System Timestamp (4) */
846     P_STA_RECORD_T  prStaRec;
847
848 #if CFG_PROFILE_BUFFER_TRACING
849     ENUM_BUFFER_ACTIVITY_TYPE_T eActivity[2];
850     UINT_32                     rActivityTime[2];
851 #endif
852 #if DBG && CFG_BUFFER_FREE_CHK
853     BOOLEAN         fgBufferInSource;
854 #endif
855
856     UINT_8          ucControlFlag;      /* For specify some Control Flags, e.g. Basic Rate */
857
858     //4 /* -----------------------Non-Common ------------------------- */
859     /* TODO: move flags to ucControlFlag */
860
861     BOOLEAN     fgIs1xFrame;                /* Set to TRUE for 802.1x frame */
862
863     /* TXM: For TX Done handling, callback function & parameter (5) */
864     BOOLEAN     fgIsTxFailed;               /* Set to TRUE if transmission failure */
865
866     PFN_TX_DONE_HANDLER     pfTxDoneHandler;
867
868     UINT_64     u8TimeStamp; /* record the TX timestamp */
869
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*/
873
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 */
885
886     /* TXM: For flushing ACL frames */
887     UINT_16     u2PalLLH;                   /* 802.11 PAL LLH */
888     //UINT_16     u2LLH;
889     UINT_16     u2ACLSeq;                   /* u2LLH+u2ACLSeq for AM HCI flush ACL frame */
890
891     /* TXM for retransmitting a flushed packet */
892     BOOLEAN     fgIsSnAssigned;
893     UINT_16     u2SequenceNumber;          /* To remember the Sequence Control field of this MPDU */
894
895 } MSDU_INFO_T, *P_MSDU_INFO_T;
896 #endif
897
898 #if 0
899 /* nic_rx.h */
900 typedef struct _SW_RFB_T {
901
902     //4 /* ----------------MSDU_INFO and SW_RFB Common Fields------------------ */
903
904     LINK_ENTRY_T    rLinkEntry;
905     PUINT_8         pucBuffer;          /* Pointer to the associated buffer */
906
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 */
911
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 */
917
918     OS_SYSTIME      rArrivalTime;       /* System Timestamp (4) */
919     P_STA_RECORD_T  prStaRec;
920
921 #if CFG_PROFILE_BUFFER_TRACING
922     ENUM_BUFFER_ACTIVITY_TYPE_T eActivity[2];
923     UINT_32                     rActivityTime[2];
924 #endif
925 #if DBG && CFG_BUFFER_FREE_CHK
926     BOOLEAN         fgBufferInSource;
927 #endif
928
929     UINT_8          ucControlFlag;      /* For specify some Control Flags, e.g. Basic Rate */
930
931     //4 /* -----------------------Non-Common ------------------------- */
932
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;
938
939     UINT_16     u2SequenceControl;
940     BOOLEAN     fgIsA4Frame;                /* (For MAC RX packet parsing) set to TRUE if 4 addresses are present */
941     BOOLEAN     fgIsBAR;
942     BOOLEAN     fgIsQoSData;
943     BOOLEAN     fgIsAmsduSubframe;  /* Set to TRUE for A-MSDU Subframe */
944
945     /* For HIF RX DMA Desc */
946     BOOLEAN     fgTUChecksumCheckRequired;
947     BOOLEAN     fgIPChecksumCheckRequired;
948     UINT_8      ucEtherTypeOffset;
949
950 } SW_RFB_T, *P_SW_RFB_T;
951 #endif
952
953
954 /*******************************************************************************
955 *                            P U B L I C   D A T A
956 ********************************************************************************
957 */
958
959 /*******************************************************************************
960 *                           P R I V A T E   D A T A
961 ********************************************************************************
962 */
963
964 /*******************************************************************************
965 *                                 M A C R O S
966 ********************************************************************************
967 */
968
969 /*******************************************************************************
970 *                   F U N C T I O N   D E C L A R A T I O N S
971 ********************************************************************************
972 */
973
974 P_MSDU_INFO_T
975 cnmMgtPktAlloc (
976     IN P_ADAPTER_T  prAdapter,
977     IN UINT_32      u4Length
978     );
979
980 VOID
981 cnmMgtPktFree (
982     IN P_ADAPTER_T      prAdapter,
983     IN P_MSDU_INFO_T    prMsduInfo
984     );
985
986 VOID
987 cnmMemInit (
988     IN P_ADAPTER_T  prAdapter
989     );
990
991 PVOID
992 cnmMemAlloc (
993     IN P_ADAPTER_T      prAdapter,
994     IN ENUM_RAM_TYPE_T  eRamType,
995     IN UINT_32          u4Length
996     );
997
998 VOID
999 cnmMemFree (
1000     IN P_ADAPTER_T  prAdapter,
1001     IN PVOID pvMemory
1002     );
1003
1004 VOID
1005 cnmStaRecInit (
1006     IN P_ADAPTER_T  prAdapter
1007     );
1008
1009 VOID
1010 cnmStaRecUninit (
1011     IN P_ADAPTER_T  prAdapter
1012     );
1013
1014 P_STA_RECORD_T
1015 cnmStaRecAlloc (
1016     IN P_ADAPTER_T  prAdapter,
1017     IN UINT_8       ucNetTypeIndex
1018     );
1019
1020 VOID
1021 cnmStaRecFree (
1022     IN P_ADAPTER_T      prAdapter,
1023     IN P_STA_RECORD_T   prStaRec,
1024     IN BOOLEAN          fgSyncToChip
1025     );
1026
1027 VOID
1028 cnmStaFreeAllStaByNetType (
1029     P_ADAPTER_T                 prAdapter,
1030     ENUM_NETWORK_TYPE_INDEX_T   eNetTypeIndex,
1031     BOOLEAN                     fgSyncToChip
1032     );
1033
1034 P_STA_RECORD_T
1035 cnmGetStaRecByIndex (
1036     IN P_ADAPTER_T  prAdapter,
1037     IN UINT_8       ucIndex
1038     );
1039
1040 P_STA_RECORD_T
1041 cnmGetStaRecByAddress (
1042     IN P_ADAPTER_T  prAdapter,
1043     IN UINT_8       ucNetTypeIndex,
1044     IN UINT_8       aucPeerMACAddress[]
1045     );
1046
1047 VOID
1048 cnmStaRecResetStatus (
1049     IN P_ADAPTER_T                  prAdapter,
1050     IN ENUM_NETWORK_TYPE_INDEX_T    eNetTypeIndex
1051     );
1052
1053 VOID
1054 cnmStaRecChangeState (
1055     IN P_ADAPTER_T          prAdapter,
1056     IN OUT P_STA_RECORD_T   prStaRec,
1057     IN UINT_8               ucNewState
1058     );
1059
1060 /*******************************************************************************
1061 *                              F U N C T I O N S
1062 ********************************************************************************
1063 */
1064 #ifndef _lint
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.
1068  */
1069 __KAL_INLINE__ VOID
1070 cnmMemDataTypeCheck (
1071     VOID
1072     )
1073 {
1074 #if 0
1075     DATA_STRUC_INSPECTING_ASSERT(
1076         OFFSET_OF(MSDU_INFO_T,rLinkEntry) == 0);
1077
1078     DATA_STRUC_INSPECTING_ASSERT(
1079         OFFSET_OF(MSDU_INFO_T,rLinkEntry) == OFFSET_OF(SW_RFB_T,rLinkEntry));
1080
1081     DATA_STRUC_INSPECTING_ASSERT(
1082         OFFSET_OF(MSDU_INFO_T,pucBuffer) == OFFSET_OF(SW_RFB_T,pucBuffer));
1083
1084     DATA_STRUC_INSPECTING_ASSERT(
1085         OFFSET_OF(MSDU_INFO_T,ucBufferSource) ==
1086         OFFSET_OF(SW_RFB_T,ucBufferSource));
1087
1088     DATA_STRUC_INSPECTING_ASSERT(
1089         OFFSET_OF(MSDU_INFO_T,pucMacHeader) ==
1090         OFFSET_OF(SW_RFB_T,pucMacHeader));
1091
1092     DATA_STRUC_INSPECTING_ASSERT(
1093         OFFSET_OF(MSDU_INFO_T,ucMacHeaderLength) ==
1094         OFFSET_OF(SW_RFB_T,ucMacHeaderLength));
1095
1096     DATA_STRUC_INSPECTING_ASSERT(
1097         OFFSET_OF(MSDU_INFO_T,pucPayload) ==
1098         OFFSET_OF(SW_RFB_T,pucPayload));
1099
1100     DATA_STRUC_INSPECTING_ASSERT(
1101         OFFSET_OF(MSDU_INFO_T,u2PayloadLength) ==
1102         OFFSET_OF(SW_RFB_T,u2PayloadLength));
1103
1104     DATA_STRUC_INSPECTING_ASSERT(
1105         OFFSET_OF(MSDU_INFO_T,prStaRec) ==
1106         OFFSET_OF(SW_RFB_T,prStaRec));
1107
1108     DATA_STRUC_INSPECTING_ASSERT(
1109         OFFSET_OF(MSDU_INFO_T,ucNetworkTypeIndex) ==
1110         OFFSET_OF(SW_RFB_T,ucNetworkTypeIndex));
1111
1112     DATA_STRUC_INSPECTING_ASSERT(
1113         OFFSET_OF(MSDU_INFO_T,ucTID) ==
1114         OFFSET_OF(SW_RFB_T,ucTID));
1115
1116     DATA_STRUC_INSPECTING_ASSERT(
1117         OFFSET_OF(MSDU_INFO_T,fgIs802_11Frame) ==
1118         OFFSET_OF(SW_RFB_T,fgIs802_11Frame));
1119
1120     DATA_STRUC_INSPECTING_ASSERT(
1121         OFFSET_OF(MSDU_INFO_T,ucControlFlag) ==
1122         OFFSET_OF(SW_RFB_T,ucControlFlag));
1123
1124     DATA_STRUC_INSPECTING_ASSERT(
1125         OFFSET_OF(MSDU_INFO_T,rArrivalTime) ==
1126         OFFSET_OF(SW_RFB_T,rArrivalTime));
1127
1128     DATA_STRUC_INSPECTING_ASSERT(
1129         OFFSET_OF(MSDU_INFO_T,ucTC) ==
1130         OFFSET_OF(SW_RFB_T,ucTC));
1131
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]));
1136
1137     DATA_STRUC_INSPECTING_ASSERT(
1138         OFFSET_OF(MSDU_INFO_T,rActivityTime[0]) ==
1139         OFFSET_OF(SW_RFB_T,rActivityTime[0]));
1140 #endif
1141
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));
1146 #endif
1147
1148
1149     DATA_STRUC_INSPECTING_ASSERT(
1150         OFFSET_OF(STA_RECORD_T,rLinkEntry) == 0);
1151
1152     return;
1153 #endif
1154 }
1155 #endif /* _lint */
1156
1157 #endif /* _CNM_MEM_H */
1158
1159