support different wifi bt chip auto compatible
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rockchip_wlan / mt5931_kk / drv_wlan / include / mgmt / cnm_mem.h
1 /*
2 ** $Id: //Department/DaVinci/BRANCHES/MT662X_593X_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 * Copyright (c) 2009 MediaTek Inc.
12 *
13 * All rights reserved. Copying, compilation, modification, distribution
14 * or any other use whatsoever of this material is strictly prohibited
15 * except in accordance with a Software License Agreement with
16 * MediaTek Inc.
17 ********************************************************************************
18 */
19
20 /*******************************************************************************
21 * LEGAL DISCLAIMER
22 *
23 * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND
24 * AGREES THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK
25 * SOFTWARE") RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE
26 * PROVIDED TO BUYER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY
27 * DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT
28 * LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
29 * PARTICULAR PURPOSE OR NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE
30 * ANY WARRANTY WHATSOEVER WITH RESPECT TO THE SOFTWARE OF ANY THIRD PARTY
31 * WHICH MAY BE USED BY, INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK
32 * SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY
33 * WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE
34 * FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S SPECIFICATION OR TO
35 * CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
36 *
37 * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
38 * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL
39 * BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT
40 * ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY
41 * BUYER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
42 *
43 * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
44 * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT
45 * OF LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING
46 * THEREOF AND RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN
47 * FRANCISCO, CA, UNDER THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE
48 * (ICC).
49 ********************************************************************************
50 */
51
52 /*
53 ** $Log: cnm_mem.h $
54  *
55  * 03 02 2012 terry.wu
56  * NULL
57  * Snc CFG80211 modification for ICS migration from branch 2.2.
58  *
59  * 01 05 2012 tsaiyuan.hsu
60  * [WCXRP00001157] [MT6620 Wi-Fi][FW][DRV] add timing measurement support for 802.11v
61  * add timing measurement support for 802.11v.
62  *
63  * 03 17 2011 yuche.tsai
64  * NULL
65  * Resize the Secondary Device Type array when WiFi Direct is enabled.
66  *
67  * 03 16 2011 wh.su
68  * [WCXRP00000530] [MT6620 Wi-Fi] [Driver] skip doing p2pRunEventAAAComplete after send assoc response Tx Done
69  * enable the protected while at P2P start GO, and skip some security check .
70  *
71  * 01 26 2011 cm.chang
72  * [WCXRP00000395] [MT6620 Wi-Fi][Driver][FW] Search STA_REC with additional net type index argument
73  * .
74  *
75  * 01 11 2011 eddie.chen
76  * [WCXRP00000322] Add WMM IE in beacon,
77
78 Add per station flow control when STA is in PS
79
80
81  * Add per STA flow control when STA is in PS mode
82  *
83  * 12 29 2010 eddie.chen
84  * [WCXRP00000322] Add WMM IE in beacon,
85 Add per station flow control when STA is in PS
86
87  * 1) PS flow control event
88  *
89  * 2) WMM IE in beacon, assoc resp, probe resp
90  *
91  * 12 23 2010 george.huang
92  * [WCXRP00000152] [MT6620 Wi-Fi] AP mode power saving function
93  * 1. update WMM IE parsing, with ASSOC REQ handling
94  * 2. extend U-APSD parameter passing from driver to FW
95  *
96  * 12 07 2010 cm.chang
97  * [WCXRP00000239] MT6620 Wi-Fi][Driver][FW] Merge concurrent branch back to maintrunk
98  * 1. BSSINFO include RLM parameter
99  * 2. free all sta records when network is disconnected
100  *
101  * 11 29 2010 cm.chang
102  * [WCXRP00000210] [MT6620 Wi-Fi][Driver][FW] Set RCPI value in STA_REC for initial TX rate selection of auto-rate algorithm
103  * Sync RCPI of STA_REC to FW as reference of initial TX rate
104  *
105  * 10 18 2010 cp.wu
106  * [WCXRP00000053] [MT6620 Wi-Fi][Driver] Reset incomplete and might leads to BSOD when entering RF test with AIS associated
107  * 1. remove redundant variables in STA_REC structure
108  * 2. add STA-REC uninitialization routine for clearing pending events
109  *
110  * 09 21 2010 kevin.huang
111  * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning
112  * Eliminate Linux Compile Warning
113  *
114  * 09 03 2010 kevin.huang
115  * NULL
116  * Refine #include sequence and solve recursive/nested #include issue
117  *
118  * 07 12 2010 cp.wu
119  *
120  * SAA will take a record for tracking request sequence number.
121  *
122  * 07 08 2010 cp.wu
123  *
124  * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
125  *
126  * 07 07 2010 cm.chang
127  * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
128  * Support state of STA record change from 1 to 1
129  *
130  * 07 01 2010 cm.chang
131  * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
132  * Support sync command of STA_REC
133  *
134  * 06 21 2010 wh.su
135  * [WPD00003840][MT6620 5931] Security migration
136  * modify some code for concurrent network.
137  *
138  * 06 21 2010 yuche.tsai
139  * [WPD00003839][MT6620 5931][P2P] Feature migration
140  * Fix compile error for P2P related defination.
141  *
142  * 06 18 2010 cm.chang
143  * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
144  * Provide cnmMgtPktAlloc() and alloc/free function of msg/buf
145  *
146  * 06 17 2010 yuche.tsai
147  * [WPD00003839][MT6620 5931][P2P] Feature migration
148  * Add P2P related fields.
149  *
150  * 06 14 2010 cp.wu
151  * [WPD00003833][MT6620 and MT5931] Driver migration
152  * saa_fsm.c is migrated.
153  *
154  * 06 14 2010 cp.wu
155  * [WPD00003833][MT6620 and MT5931] Driver migration
156  * restore utility function invoking via hem_mbox to direct calls
157  *
158  * 06 10 2010 cp.wu
159  * [WPD00003833][MT6620 and MT5931] Driver migration
160  * add buildable & linkable ais_fsm.c
161  *
162  * related reference are still waiting to be resolved
163  *
164  * 06 08 2010 cp.wu
165  * [WPD00003833][MT6620 and MT5931] Driver migration
166  * hem_mbox is migrated.
167  *
168  * 06 08 2010 cp.wu
169  * [WPD00003833][MT6620 and MT5931] Driver migration
170  * add hem_mbox.c and cnm_mem.h (but disabled some feature) for further migration
171  *
172  * 06 04 2010 george.huang
173  * [BORA00000678][MT6620]WiFi LP integration
174  * [BORA00000678] [MT6620]WiFi LP integration
175  * 1. add u8TimeStamp in MSDU_INFO
176  * 2. move fgIsRxTSFUpdated/fgIsTxTSFUpdated from static to BSS_INFO
177  * 3. add new member for supporting PM in STA_RECORD, which is for AP PS mode
178  *
179  * 05 31 2010 yarco.yang
180  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
181  * Add RX TSF Log Feature and ADDBA Rsp with DECLINE handling
182  *
183  * 05 28 2010 cm.chang
184  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
185  * Support checking  of duplicated buffer free
186  *
187  * 05 28 2010 kevin.huang
188  * [BORA00000794][WIFISYS][New Feature]Power Management Support
189  * Move define of STA_REC_NUM to config.h and rename to CFG_STA_REC_NUM
190  *
191  * 05 21 2010 kevin.huang
192  * [BORA00000794][WIFISYS][New Feature]Power Management Support
193  * Refine txmInitWtblTxRateTable() - set TX initial rate according to AP's operation rate set
194  *
195  * 05 19 2010 yarco.yang
196  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
197  * Fixed MAC RX Desc be overwritten issue
198  *
199  * 05 12 2010 kevin.huang
200  * [BORA00000794][WIFISYS][New Feature]Power Management Support
201  * Add Power Management - Legacy PS-POLL support.
202  *
203  * 05 10 2010 yarco.yang
204  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
205  * Support Rx header translation for A-MSDU subframe
206  *
207  * 05 07 2010 george.huang
208  * [BORA00000678][MT6620]WiFi LP integration
209  * add more sanity check about setting timer
210  *
211  * 04 29 2010 george.huang
212  * [BORA00000678][MT6620]WiFi LP integration
213  * modify the compiling flag for RAM usage
214  *
215  * 04 28 2010 tehuang.liu
216  * [BORA00000605][WIFISYS] Phase3 Integration
217  * Modified some MQM-related data structures (SN counter, TX/RX BA table)
218  *
219  * 04 27 2010 tehuang.liu
220  * [BORA00000605][WIFISYS] Phase3 Integration
221  * Added new TX/RX BA tables in STA_REC
222  *
223  * 04 19 2010 kevin.huang
224  * [BORA00000714][WIFISYS][New Feature]Beacon Timeout Support
225  * Add Beacon Timeout Support and will send Null frame to diagnose connection
226  *
227  * 04 09 2010 tehuang.liu
228  * [BORA00000605][WIFISYS] Phase3 Integration
229  * [BORA00000644] WiFi phase 4 integration
230  * Added per-TID SN cache in STA_REC
231  *
232  * 03 24 2010 cm.chang
233  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
234  * Support power control
235  *
236  * 03 16 2010 kevin.huang
237  * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support
238  * Add AdHoc Mode
239  *
240  * 03 11 2010 yuche.tsai
241  * [BORA00000343][MT6620] Emulation For TX
242  * .
243  *
244  * 03 05 2010 yarco.yang
245  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
246  * Remove Emulation definition
247  *
248  * 03 04 2010 cp.wu
249  * [BORA00000368]Integrate HIF part into BORA
250  * eliminate HIF_EMULATION in cnm_mem.h
251  *
252  * 03 04 2010 kevin.huang
253  * [BORA00000603][WIFISYS] [New Feature] AAA Module Support
254  * Add cnmStaRecChangeState() declaration.
255  *
256  * 03 03 2010 cm.chang
257  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
258  * Remove compiling warning for some emulation flags
259  *
260  * 03 03 2010 wh.su
261  * [BORA00000637][MT6620 Wi-Fi] [Bug] WPA2 pre-authentication timer not correctly initialize
262  * move the AIS specific variable for security to AIS specific structure.
263  *
264  * 03 03 2010 wh.su
265  * [BORA00000637][MT6620 Wi-Fi] [Bug] WPA2 pre-authentication timer not correctly initialize
266  * Fixed the pre-authentication timer not correctly init issue, and modify the security related callback function prototype.
267  *
268  * 03 01 2010 tehuang.liu
269  * [BORA00000569][WIFISYS] Phase 2 Integration Test
270  * To store field AMPDU Parameters in STA_REC
271  *
272  * 02 26 2010 tehuang.liu
273  * [BORA00000569][WIFISYS] Phase 2 Integration Test
274  * Added fgIsWmmSupported in STA_RECORD_T.
275  *
276  * 02 26 2010 tehuang.liu
277  * [BORA00000569][WIFISYS] Phase 2 Integration Test
278  * Added fgIsUapsdSupported in STA_RECORD_T
279  *
280  * 02 13 2010 tehuang.liu
281  * [BORA00000569][WIFISYS] Phase 2 Integration Test
282  * Added arTspecTable in STA_REC for TSPEC management
283  *
284  * 02 12 2010 cm.chang
285  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
286  * Enable mgmt buffer debug by default
287  *
288  * 02 12 2010 tehuang.liu
289  * [BORA00000569][WIFISYS] Phase 2 Integration Test
290  * Added BUFFER_SOURCE_BCN
291  *
292  * 02 10 2010 tehuang.liu
293  * [BORA00000569][WIFISYS] Phase 2 Integration Test
294  * Renamed MSDU_INFO.ucFixedRateIndex as MSDU_INFO.ucFixedRateCode
295  *
296  * 02 04 2010 kevin.huang
297  * [BORA00000603][WIFISYS] [New Feature] AAA Module Support
298  * Add AAA Module Support, Revise Net Type to Net Type Index for array lookup
299  *
300  * 02 02 2010 tehuang.liu
301  * [BORA00000569][WIFISYS] Phase 2 Integration Test
302  * Added SN info in MSDU_INFO_T
303  *
304  * 01 27 2010 wh.su
305  * [BORA00000476][Wi-Fi][firmware] Add the security module initialize code
306  * add and fixed some security function.
307  *
308  * 01 11 2010 kevin.huang
309  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
310  * Add Deauth and Disassoc Handler
311  *
312  * 01 08 2010 cp.wu
313  * [BORA00000368]Integrate HIF part into BORA
314  * 1) separate wifi_var_emu.c/.h from wifi_var.c/.h
315  * 2) eliminate HIF_EMULATION code sections appeared in wifi_var/cnm_mem
316  * 3) use cnmMemAlloc() instead to allocate SRAM buffer
317  *
318  * 12 31 2009 cp.wu
319  * [BORA00000368]Integrate HIF part into BORA
320  * 1) surpress debug message emitted from hal_hif.c
321  * 2) add two set of field for recording buffer process time
322  *
323  * 12 31 2009 cp.wu
324  * [BORA00000368]Integrate HIF part into BORA
325  * 1. move wifi task initialization from wifi_task.c(rom) to wifi_init.c (TCM) for integrating F/W download later
326  *  *  *  *  * 2. WIFI_Event_Dispatcher() prototype changed to return to suspend mode from normal operation mode
327  *  *  *  *  * 2. HIF emulation logic revised
328  *
329  * 12 29 2009 yuche.tsai
330  * [BORA00000343][MT6620] Emulation For TX
331  * .Using global buffer declaring by SD1 instead of using another one.
332  *
333  * 12 25 2009 tehuang.liu
334  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
335  * Integrated modifications for 1st connection (mainly on FW modules MQM, TXM, and RXM)
336  *  * MQM: BA handling
337  *  * TXM: Macros updates
338  *  * RXM: Macros/Duplicate Removal updates
339  *
340  * 12 24 2009 yarco.yang
341  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
342  * .
343  *
344  * 12 23 2009 cp.wu
345  * [BORA00000368]Integrate HIF part into BORA
346  * allocating SRAM for emulation purpose by ruducing MEM_BANK3_BUF_SZ
347  *
348  * 12 21 2009 cm.chang
349  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
350  * Remove individual DATA_BUF_BLOCK_NUM definition for emulation compiling flagsu1rwduu`wvpghlqg|fh+fmdkb
351  *
352  * 12 21 2009 cm.chang
353  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
354  * Support several data buffer banks.
355  *
356  * 12 18 2009 cm.chang
357  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
358  * .For new FPGA memory size
359  *
360  * 12 18 2009 cm.chang
361  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
362  * .
363  *
364  * 12 17 2009 george.huang
365  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
366  * .
367  *
368  * Dec 17 2009 MTK02468
369  * [BORA00000337] To check in codes for FPGA emulation
370  * Modified the DATA_BLOCK_SIZE from 1620 to 2048
371  *
372  * Dec 16 2009 mtk01426
373  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
374  * Add CFG_TEST_SEC_EMULATION flag
375  *
376  * Dec 9 2009 mtk01104
377  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
378  * Add HT cap to sta record
379  *
380  * Dec 9 2009 mtk02752
381  * [BORA00000368] Integrate HIF part into BORA
382  * add cnmDataPktFree() for emulation loopback purpose
383  *
384  * Dec 8 2009 mtk01088
385  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
386  * add the buffer for key handshake 1x and cmd key order issue
387  *
388  * Dec 7 2009 mtk01088
389  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
390  * move the tx call back function proto type to typedef.h
391  *
392  * Dec 3 2009 mtk01461
393  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
394  * Add cnmGetStaRecByAddress() and modify variable in STA_RECORD_T
395  *
396  * Dec 1 2009 mtk01088
397  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
398  * rename the port block flag
399  *
400  * Nov 23 2009 mtk01461
401  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
402  * Add variables to STA_RECORD_T for assoc/auth
403  *
404  * Nov 23 2009 mtk02468
405  * [BORA00000337] To check in codes for FPGA emulation
406  * Fixed the value of STA_WAIT_QUEUE_NUM (from 7 to 5)
407  *
408  * Nov 20 2009 mtk02468
409  * [BORA00000337] To check in codes for FPGA emulation
410  * Removed u2FrameLength from SW_RFB
411  *
412  * Nov 20 2009 mtk02468
413  * [BORA00000337] To check in codes for FPGA emulation
414  * Fixed indenting
415  *
416  * Nov 20 2009 mtk02468
417  * [BORA00000337] To check in codes for FPGA emulation
418  * Updated MSDU_INFO and SW_RFB
419  *
420  * Nov 19 2009 mtk01088
421  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
422  * update the variable for security
423  *
424  * Nov 18 2009 mtk01088
425  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
426  * remove the variable to make the compiler ok
427  *
428  * Nov 18 2009 mtk01088
429  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
430  * add the variable for security module
431  *
432  * Nov 16 2009 mtk01461
433  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
434  * Fix typo in define of MSG_BUF_BLOCK_SIZE
435  *
436  * Nov 13 2009 mtk02468
437  * [BORA00000337] To check in codes for FPGA emulation
438  * Let typedef STA_REC_T precede typedef MSDU_INFO_T and SW_RFB_T
439  *
440  * Nov 13 2009 mtk02468
441  * [BORA00000337] To check in codes for FPGA emulation
442  * Modified MSDU_INFO and STA_REC for TXM and MQM
443  *
444  * Nov 12 2009 mtk01104
445  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
446  * Rename STA_REC_T to STA_RECORD_T and add ucIndex member
447  *
448  * Nov 9 2009 mtk01104
449  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
450  * Make sure ucBufferSource the same offset in MSDU_INFO and SW_RFB
451  *
452  * Nov 6 2009 mtk01426
453  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
454  *
455  *
456  * Nov 5 2009 mtk01426
457  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
458  *
459  *
460  * Nov 5 2009 mtk01461
461  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
462  * Update comment
463  *
464  * Oct 30 2009 mtk01461
465  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
466  * Add draft content of MSDU_INFO_T and SW_RFB_T
467  *
468  * Oct 30 2009 mtk01084
469  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
470  *
471  *
472  * Oct 28 2009 mtk01104
473  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
474  *
475  *
476  * Oct 23 2009 mtk01461
477  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
478  * Fix lint warning
479  *
480  * Oct 21 2009 mtk01426
481  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
482  * Add CFG_TEST_RX_EMULATION flag
483  *
484  * Oct 20 2009 mtk01426
485  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
486  *
487  *
488  * Oct 9 2009 mtk02468
489  * [BORA00000337] To check in codes for FPGA emulation
490  * Added field ucTC to MSDU_INFO_T and field pucHifRxPacket to SW_RFB_T
491  *
492  * Oct 8 2009 mtk01104
493  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
494  *
495 **
496 */
497
498 #ifndef _CNM_MEM_H
499 #define _CNM_MEM_H
500
501 /*******************************************************************************
502 *                         C O M P I L E R   F L A G S
503 ********************************************************************************
504 */
505
506 /*******************************************************************************
507 *                    E X T E R N A L   R E F E R E N C E S
508 ********************************************************************************
509 */
510
511 /*******************************************************************************
512 *                              C O N S T A N T S
513 ********************************************************************************
514 */
515
516 #ifndef POWER_OF_2
517 #define POWER_OF_2(n)                           BIT(n)
518 #endif
519
520 /* Size of a basic management buffer block in power of 2 */
521 #define MGT_BUF_BLOCK_SIZE_IN_POWER_OF_2        7 /* 7 to the power of 2 = 128 */
522 #define MSG_BUF_BLOCK_SIZE_IN_POWER_OF_2        5 /* 5 to the power of 2 = 32 */
523
524 /* Size of a basic management buffer block */
525 #define MGT_BUF_BLOCK_SIZE                      POWER_OF_2(MGT_BUF_BLOCK_SIZE_IN_POWER_OF_2)
526 #define MSG_BUF_BLOCK_SIZE                      POWER_OF_2(MSG_BUF_BLOCK_SIZE_IN_POWER_OF_2)
527
528 /* Total size of (n) basic management buffer blocks */
529 #define MGT_BUF_BLOCKS_SIZE(n)                  ((UINT_32)(n) << MGT_BUF_BLOCK_SIZE_IN_POWER_OF_2)
530 #define MSG_BUF_BLOCKS_SIZE(n)                  ((UINT_32)(n) << MSG_BUF_BLOCK_SIZE_IN_POWER_OF_2)
531
532 /* Number of management buffer block */
533 #define MAX_NUM_OF_BUF_BLOCKS                   32 /* Range: 1~32 */
534
535 /* Size of overall management frame buffer */
536 #define MGT_BUFFER_SIZE                         (MAX_NUM_OF_BUF_BLOCKS * MGT_BUF_BLOCK_SIZE)
537 #define MSG_BUFFER_SIZE                         (MAX_NUM_OF_BUF_BLOCKS * MSG_BUF_BLOCK_SIZE)
538
539
540 /* STA_REC related definitions */
541 #define STA_REC_INDEX_BMCAST        0xFF
542 #define STA_REC_INDEX_NOT_FOUND     0xFE
543 #define STA_WAIT_QUEUE_NUM          5       /* Number of SW queues in each STA_REC: AC0~AC4 */
544 #define SC_CACHE_INDEX_NUM          5       /* Number of SC caches in each STA_REC: AC0~AC4 */
545
546
547 /* P2P related definitions */
548 #ifdef CFG_ENABLE_WIFI_DIRECT
549 /* Moved from p2p_fsm.h */
550 #define WPS_ATTRI_MAX_LEN_DEVICE_NAME               32  /* 0x1011 */
551 #define P2P_GC_MAX_CACHED_SEC_DEV_TYPE_COUNT        8 /* NOTE(Kevin): Shall <= 16 */
552 #endif
553
554
555 /*******************************************************************************
556 *                             D A T A   T Y P E S
557 ********************************************************************************
558 */
559 #if ((MAX_NUM_OF_BUF_BLOCKS > 32) || (MAX_NUM_OF_BUF_BLOCKS <= 0))
560     #error > #define MAX_NUM_OF_MGT_BUF_BLOCKS : Out of boundary !
561 #elif MAX_NUM_OF_BUF_BLOCKS > 16
562     typedef UINT_32 BUF_BITMAP;
563 #elif MAX_NUM_OF_BUF_BLOCKS > 8
564     typedef UINT_16 BUF_BITMAP;
565 #else
566     typedef UINT_8 BUF_BITMAP;
567 #endif /* MAX_NUM_OF_MGT_BUF_BLOCKS */
568
569
570 /* Control variable of TX management memory pool */
571 typedef struct _BUF_INFO_T {
572     PUINT_8     pucBuf;
573
574 #if CFG_DBG_MGT_BUF
575     UINT_32     u4AllocCount;
576     UINT_32     u4FreeCount;
577     UINT_32     u4AllocNullCount;
578 #endif /* CFG_DBG_MGT_BUF */
579
580     BUF_BITMAP  rFreeBlocksBitmap;
581     UINT_8      aucAllocatedBlockNum[MAX_NUM_OF_BUF_BLOCKS];
582 } BUF_INFO_T, *P_BUF_INFO_T;
583
584
585 /* Wi-Fi divides RAM into three types
586  * MSG:     Mailbox message (Small size)
587  * BUF:     HW DMA buffers (HIF/MAC)
588  */
589 typedef enum _ENUM_RAM_TYPE_T {
590     RAM_TYPE_MSG = 0,
591     RAM_TYPE_BUF
592 } ENUM_RAM_TYPE_T, P_ENUM_RAM_TYPE_T;
593
594 typedef enum _ENUM_BUFFER_SOURCE_T {
595     BUFFER_SOURCE_HIF_TX0 =0,
596     BUFFER_SOURCE_HIF_TX1,
597     BUFFER_SOURCE_MAC_RX,
598     BUFFER_SOURCE_MNG,
599     BUFFER_SOURCE_BCN,
600     BUFFER_SOURCE_NUM
601 } ENUM_BUFFER_SOURCE_T, *P_ENUM_BUFFER_SOURCE_T;
602
603
604 typedef enum _ENUM_SEC_STATE_T {
605     SEC_STATE_INIT,
606     SEC_STATE_INITIATOR_PORT_BLOCKED,
607     SEC_STATE_RESPONDER_PORT_BLOCKED,
608     SEC_STATE_CHECK_OK,
609     SEC_STATE_SEND_EAPOL,
610     SEC_STATE_SEND_DEAUTH,
611     SEC_STATE_COUNTERMEASURE,
612     SEC_STATE_NUM
613 } ENUM_SEC_STATE_T;
614
615 typedef struct _TSPEC_ENTRY_T {
616     UINT_8  ucStatus;
617     UINT_8  ucToken; /* Dialog Token in ADDTS_REQ or ADDTS_RSP */
618     UINT_16 u2MediumTime;
619     UINT_32 u4TsInfo;
620     //PARAM_QOS_TS_INFO rParamTsInfo;
621     /* Add other retained QoS parameters below */
622 } TSPEC_ENTRY_T, *P_TSPEC_ENTRY_T, TSPEC_TABLE_ENTRY_T, *P_TSPEC_TABLE_ENTRY_T;
623
624 typedef struct _SEC_INFO_T {
625
626     ENUM_SEC_STATE_T        ePreviousState;
627     ENUM_SEC_STATE_T        eCurrentState;
628
629     BOOL                    fg2nd1xSend;
630     BOOL                    fgKeyStored;
631
632     UINT_8                  aucStoredKey[64];
633
634     BOOL                    fgAllowOnly1x;
635 } SEC_INFO_T, *P_SEC_INFO_T;
636
637 #define MAX_NUM_CONCURRENT_FRAGMENTED_MSDUS     3
638
639 #define UPDATE_BSS_RSSI_INTERVAL_SEC            3 // Seconds
640
641 /* Fragment information structure */
642 typedef struct _FRAG_INFO_T {
643     UINT_16     u2NextFragSeqCtrl;
644     PUINT_8     pucNextFragStart;
645     P_SW_RFB_T  pr1stFrag;
646     OS_SYSTIME  rReceiveLifetimeLimit; /* The receive time of 1st fragment */
647 } FRAG_INFO_T, *P_FRAG_INFO_T;
648
649
650 /* Define STA record structure */
651 struct _STA_RECORD_T {
652     LINK_ENTRY_T            rLinkEntry;
653     UINT_8                  ucIndex;                    /* Not modify it except initializing */
654
655     BOOLEAN                 fgIsInUse;                  /* Indicate if this entry is in use or not */
656     UINT_8                  aucMacAddr[MAC_ADDR_LEN];   /* MAC address */
657
658     /* SAA/AAA */
659     ENUM_AA_STATE_T         eAuthAssocState;        /* Store STATE Value used in SAA/AAA */
660     UINT_8                  ucAuthAssocReqSeqNum;
661
662     ENUM_STA_TYPE_T         eStaType;               /* Indicate the role of this STA in
663                                                      * the network (for example, P2P GO)
664                                                      */
665
666     UINT_8                  ucNetTypeIndex;         /* ENUM_NETWORK_TYPE_INDEX_T */
667
668     UINT_8                  ucStaState;             /* STATE_1,2,3 */
669
670     UINT_8                  ucPhyTypeSet;           /* Available PHY Type Set of this peer
671                                                      * (may deduced from received BSS_DESC_T)
672                                                      */
673     UINT_8                  ucDesiredPhyTypeSet;    /* The match result by AND operation of peer's
674                                                      * PhyTypeSet and ours.
675                                                      */
676     BOOLEAN                 fgHasBasicPhyType;      /* A flag to indicate a Basic Phy Type which
677                                                      * is used to generate some Phy Attribute IE
678                                                      * (e.g. capability, MIB) during association.
679                                                      */
680     UINT_8                  ucNonHTBasicPhyType;    /* The Basic Phy Type choosen among the
681                                                      * ucDesiredPhyTypeSet.
682                                                      */
683
684     UINT_16                 u2CapInfo;              /* For Infra Mode, to store Capability Info. from Association Resp(SAA).
685                                                      * For AP Mode, to store Capability Info. from Association Req(AAA).
686                                                      */
687     UINT_16                 u2AssocId;              /* For Infra Mode, to store AID from Association Resp(SAA).
688                                                      * For AP Mode, to store the Assigned AID(AAA).
689                                                      */
690
691     UINT_16                 u2ListenInterval;       /* Listen Interval from STA(AAA) */
692
693     UINT_16                 u2DesiredNonHTRateSet;  /* Our Current Desired Rate Set after
694                                                      * match with STA's Operational Rate Set
695                                                      */
696
697     UINT_16                 u2OperationalRateSet;   /* Operational Rate Set of peer BSS */
698     UINT_16                 u2BSSBasicRateSet;      /* Basic Rate Set of peer BSS */
699
700     BOOLEAN                 fgIsMerging;            /* For IBSS Mode, to indicate that Merge is ongoing */
701
702     BOOLEAN                 fgDiagnoseConnection;   /* For Infra/AP Mode, to diagnose the Connection with
703                                                      * this peer by sending ProbeReq/Null frame */
704
705     /*------------------------------------------------------------------------------------------*/
706     /* 802.11n HT capabilities when (prStaRec->ucPhyTypeSet & PHY_TYPE_BIT_HT) is true          */
707     /* They have the same definition with fields of information element                         */
708     /*------------------------------------------------------------------------------------------*/
709     UINT_8                  ucMcsSet;               /* MCS0~7 rate set of peer BSS */
710     BOOLEAN                 fgSupMcs32;             /* MCS32 is supported by peer BSS */
711     UINT_16                 u2HtCapInfo;            /* HT cap info field by HT cap IE */
712     UINT_8                  ucAmpduParam;           /* Field A-MPDU Parameters in HT cap IE */
713     UINT_16                 u2HtExtendedCap;        /* HT extended cap field by HT cap IE */
714     UINT_32                 u4TxBeamformingCap;     /* TX beamforming cap field by HT cap IE */
715     UINT_8                  ucAselCap;              /* ASEL cap field by HT cap IE */
716
717     UINT_8                  ucRCPI;                 /* RCPI of peer */
718
719     UINT_8                  ucDTIMPeriod;           /* Target BSS's DTIM Period, we use this
720                                                      * value for setup Listen Interval
721                                                      * TODO(Kevin): TBD
722                                                      */
723     UINT_8                  ucAuthAlgNum;           /* For Infra/AP Mode, the Auth Alogrithm Num used in Authentication(SAA/AAA) */
724     BOOLEAN                 fgIsReAssoc;            /* For Infra/AP Mode, to indicate ReAssoc Frame was in used(SAA/AAA) */
725
726     UINT_8                  ucTxAuthAssocRetryCount;/* For Infra Mode, the Retry Count of TX Auth/Assod Frame(SAA) */
727     UINT_8                  ucTxAuthAssocRetryLimit;/* For Infra Mode, the Retry Limit of TX Auth/Assod Frame(SAA) */
728
729     UINT_16                 u2StatusCode;       /* Status of Auth/Assoc Req */
730     UINT_16                 u2ReasonCode;       /* Reason that been Deauth/Disassoc */
731
732
733     P_IE_CHALLENGE_TEXT_T   prChallengeText;    /* Point to an allocated buffer for storing Challenge Text for Shared Key Authentication */
734
735     TIMER_T                 rTxReqDoneOrRxRespTimer;/* For Infra Mode, a timer used to send a timeout event
736                                                      * while waiting for TX request done or RX response.
737                                                      */
738
739     /*------------------------------------------------------------------------------------------*/
740     /* Power Management related fields  (for STA/ AP/ P2P/ BOW power saving mode)                                                        */
741     /*------------------------------------------------------------------------------------------*/
742     BOOLEAN                 fgSetPwrMgtBit;         /* For Infra Mode, to indicate that outgoing frame need toggle
743                                                      * the Pwr Mgt Bit in its Frame Control Field.
744                                                      */
745
746     BOOLEAN                 fgIsInPS;               /* For AP Mode, to indicate the client PS state(PM).
747                                                      * TRUE: In PS Mode; FALSE: In Active Mode. */
748
749     BOOLEAN                 fgIsInPsPollSP;             /* For Infra Mode, to indicate we've sent a PS POLL to AP and start
750                                                          * the PS_POLL Service Period(LP)
751                                                          */
752
753     BOOLEAN                 fgIsInTriggerSP;            /* For Infra Mode, to indicate we've sent a Trigger Frame to AP and start
754                                                          * the Delivery Service Period(LP)
755                                                          */
756
757     UINT_8                  ucBmpDeliveryAC;        /* 0: AC0, 1: AC1, 2: AC2, 3: AC3 */
758
759     UINT_8                  ucBmpTriggerAC;         /* 0: AC0, 1: AC1, 2: AC2, 3: AC3 */
760
761     UINT_8                  ucUapsdSp;  /* Max SP length */
762
763     /*------------------------------------------------------------------------------------------*/
764
765     BOOLEAN                 fgIsRtsEnabled;
766
767     OS_SYSTIME              rUpdateTime;        /* (4) System Timestamp of Successful TX and RX  */
768
769     OS_SYSTIME              rLastJoinTime;      /* (4) System Timestamp of latest JOIN process */
770
771     UINT_8                  ucJoinFailureCount; /* Retry Count of JOIN process */
772
773     LINK_T                  arStaWaitQueue[STA_WAIT_QUEUE_NUM];     /* For TXM to defer pkt forwarding to MAC TX DMA */
774
775     UINT_16                 au2CachedSeqCtrl[TID_NUM + 1];          /* Duplicate removal for HT STA on a per-TID basis ("+1" is for MMPDU and non-QoS) */
776
777 #if 0
778     /* RXM */
779     P_RX_BA_ENTRY_T         aprRxBaTable[TID_NUM];
780
781     /* TXM */
782     P_TX_BA_ENTRY_T         aprTxBaTable[TID_NUM];
783 #endif
784
785     FRAG_INFO_T             rFragInfo[MAX_NUM_CONCURRENT_FRAGMENTED_MSDUS];
786
787     SEC_INFO_T              rSecInfo; /* The security state machine */
788
789     BOOLEAN                 fgPortBlock; /* The 802.1x Port Control flag */
790
791     BOOLEAN                 fgTransmitKeyExist; /* Unicast key exist for this STA */
792
793     UINT_8                  ucWTEntry;
794
795     BOOLEAN                 fgTxAmpduEn; /* Enable TX AMPDU for this Peer */
796     BOOLEAN                 fgRxAmpduEn; /* Enable RX AMPDU for this Peer */
797
798     PUINT_8                 pucAssocReqIe;
799     UINT_16                 u2AssocReqIeLen;
800     /*------------------------------------------------------------------------------------------*/
801     /* WMM/QoS related fields                                                                   */
802     /*------------------------------------------------------------------------------------------*/
803     BOOLEAN                 fgIsQoS;             /* If the STA is associated as a QSTA or QAP (for TX/RX) */
804     BOOLEAN                 fgIsWmmSupported;    /* If the peer supports WMM, set to TRUE (for association)*/
805     BOOLEAN                 fgIsUapsdSupported;  /* Set according to the scan result (for association) */
806
807     /*------------------------------------------------------------------------------------------*/
808     /* P2P related fields                                                                       */
809     /*------------------------------------------------------------------------------------------*/
810 #if CFG_ENABLE_WIFI_DIRECT
811     UINT_8                  u2DevNameLen;
812     UINT_8                  aucDevName[WPS_ATTRI_MAX_LEN_DEVICE_NAME];
813
814     UINT_8                  aucDevAddr[MAC_ADDR_LEN];   /* P2P Device Address */
815
816     UINT_16                 u2ConfigMethods;
817
818     UINT_8                  ucDeviceCap;
819
820     UINT_8                  ucSecondaryDevTypeCount;
821
822     DEVICE_TYPE_T           rPrimaryDevTypeBE;
823
824     DEVICE_TYPE_T           arSecondaryDevTypeBE[P2P_GC_MAX_CACHED_SEC_DEV_TYPE_COUNT];
825 #endif /* CFG_SUPPORT_P2P */
826
827
828     /*------------------------------------------------------------------------------------------*/
829     /* QM related fields                                                                       */
830     /*------------------------------------------------------------------------------------------*/
831
832     UINT_8                  ucFreeQuota;   /* Per Sta flow controal. Valid when fgIsInPS is TRUE. Chnage it for per Queue flow control  */
833     //UINT_8                  aucFreeQuotaPerQueue[NUM_OF_PER_STA_TX_QUEUES]; /* used in future */
834     UINT_8                  ucFreeQuotaForDelivery;
835     UINT_8                  ucFreeQuotaForNonDelivery;
836
837 #if 1
838     /*------------------------------------------------------------------------------------------*/
839     /* To be removed, this is to make que_mgt compilation success only                          */
840     /*------------------------------------------------------------------------------------------*/
841     /* When this STA_REC is in use, set to TRUE. */
842     BOOLEAN fgIsValid;
843
844     /* Per-STA Queues: [0] AC0, [1] AC1, [2] AC2, [3] AC3, [4] 802.1x */
845     QUE_T   arTxQueue[NUM_OF_PER_STA_TX_QUEUES];
846
847     /* When this STA is in PS Mode, set to TRUE. */
848     //BOOLEAN fgIsPS;
849
850     /* When this STA enters Power-Saving, FW will notify the driver with a Session ID */
851     UINT_8  ucPsSessionID;
852
853     BOOLEAN fgIsAp;
854
855     /* Reorder Parameter reference table */
856     P_RX_BA_ENTRY_T  aprRxReorderParamRefTbl[CFG_RX_MAX_BA_TID_NUM];
857 #endif
858
859 #if CFG_SUPPORT_802_11V_TIMING_MEASUREMENT
860     TIMINGMSMT_PARAM_T rWNMTimingMsmt;
861 #endif
862 };
863
864 #if 0
865 /* use nic_tx.h instead */
866 /* MSDU_INFO and SW_RFB structure */
867 typedef struct _MSDU_INFO_T {
868
869   //4  /* ----------------MSDU_INFO and SW_RFB Common Fields------------------ */
870
871     LINK_ENTRY_T    rLinkEntry;
872     PUINT_8         pucBuffer;          /* Pointer to the associated buffer */
873
874     UINT_8          ucBufferSource;     /* HIF TX0, HIF TX1, MAC RX, or MNG Pool */
875     UINT_8          ucNetworkTypeIndex; /* Network type index that this TX packet is assocaited with */
876     UINT_8          ucTC;               /* 0 to 5 (used by HIF TX to increment the corresponding TC counter) */
877     UINT_8          ucTID;              /* Traffic Identification */
878
879     BOOLEAN         fgIs802_11Frame;    /* Set to TRUE for 802.11 frame */
880     UINT_8          ucMacHeaderLength;
881     UINT_16         u2PayloadLength;
882     PUINT_8         pucMacHeader;       /* 802.11 header  */
883     PUINT_8         pucPayload;         /* 802.11 payload */
884
885     OS_SYSTIME      rArrivalTime;       /* System Timestamp (4) */
886     P_STA_RECORD_T  prStaRec;
887
888 #if CFG_PROFILE_BUFFER_TRACING
889     ENUM_BUFFER_ACTIVITY_TYPE_T eActivity[2];
890     UINT_32                     rActivityTime[2];
891 #endif
892 #if DBG && CFG_BUFFER_FREE_CHK
893     BOOLEAN         fgBufferInSource;
894 #endif
895
896     UINT_8          ucControlFlag;      /* For specify some Control Flags, e.g. Basic Rate */
897
898     //4 /* -----------------------Non-Common ------------------------- */
899     /* TODO: move flags to ucControlFlag */
900
901     BOOLEAN     fgIs1xFrame;                /* Set to TRUE for 802.1x frame */
902
903     /* TXM: For TX Done handling, callback function & parameter (5) */
904     BOOLEAN     fgIsTxFailed;               /* Set to TRUE if transmission failure */
905
906     PFN_TX_DONE_HANDLER     pfTxDoneHandler;
907
908     UINT_64     u8TimeStamp; /* record the TX timestamp */
909
910     /* TXM: For PS forwarding control (per-STA flow control) */
911     UINT_8      ucPsForwardingType;         /* Delivery-enabled, non-delivery-enabled, non-PS */
912     UINT_8      ucPsSessionID;              /* The Power Save session id for PS forwarding control*/
913
914     /* TXM: For MAC TX DMA operations */
915     UINT_8      ucMacTxQueIdx;              /*  MAC TX queue: AC0-AC6, BCM, or BCN */
916     BOOLEAN     fgNoAck;                    /* Set to true if Ack is not requred for this packet */
917     BOOLEAN     fgBIP;                      /* Set to true if BIP is used for this packet */
918     UINT_8      ucFragTotalCount;
919     UINT_8      ucFragFinishedCount;
920     UINT_16     u2FragThreshold;     /* Fragmentation threshold without WLAN Header & FCS */
921     BOOLEAN     fgFixedRate;                /* If a fixed rate is used, set to TRUE. */
922     UINT_8      ucFixedRateCode;            /* The rate code copied to MAC TX Desc */
923     UINT_8      ucFixedRateRetryLimit;      /* The retry limit when a fixed rate is used */
924     BOOLEAN     fgIsBmcQueueEnd;            /* Set to true if this packet is the end of BMC */
925
926     /* TXM: For flushing ACL frames */
927     UINT_16     u2PalLLH;                   /* 802.11 PAL LLH */
928     //UINT_16     u2LLH;
929     UINT_16     u2ACLSeq;                   /* u2LLH+u2ACLSeq for AM HCI flush ACL frame */
930
931     /* TXM for retransmitting a flushed packet */
932     BOOLEAN     fgIsSnAssigned;
933     UINT_16     u2SequenceNumber;          /* To remember the Sequence Control field of this MPDU */
934
935 } MSDU_INFO_T, *P_MSDU_INFO_T;
936 #endif
937
938 #if 0
939 /* nic_rx.h */
940 typedef struct _SW_RFB_T {
941
942     //4 /* ----------------MSDU_INFO and SW_RFB Common Fields------------------ */
943
944     LINK_ENTRY_T    rLinkEntry;
945     PUINT_8         pucBuffer;          /* Pointer to the associated buffer */
946
947     UINT_8          ucBufferSource;     /* HIF TX0, HIF TX1, MAC RX, or MNG Pool */
948     UINT_8          ucNetworkTypeIndex; /* Network type index that this TX packet is assocaited with */
949     UINT_8          ucTC;               /* 0 to 5 (used by HIF TX to increment the corresponding TC counter) */
950     UINT_8          ucTID;              /* Traffic Identification */
951
952     BOOLEAN         fgIs802_11Frame;    /* Set to TRUE for 802.11 frame */
953     UINT_8          ucMacHeaderLength;
954     UINT_16         u2PayloadLength;
955     PUINT_8         pucMacHeader;       /* 802.11 header  */
956     PUINT_8         pucPayload;         /* 802.11 payload */
957
958     OS_SYSTIME      rArrivalTime;       /* System Timestamp (4) */
959     P_STA_RECORD_T  prStaRec;
960
961 #if CFG_PROFILE_BUFFER_TRACING
962     ENUM_BUFFER_ACTIVITY_TYPE_T eActivity[2];
963     UINT_32                     rActivityTime[2];
964 #endif
965 #if DBG && CFG_BUFFER_FREE_CHK
966     BOOLEAN         fgBufferInSource;
967 #endif
968
969     UINT_8          ucControlFlag;      /* For specify some Control Flags, e.g. Basic Rate */
970
971     //4 /* -----------------------Non-Common ------------------------- */
972
973     /* For composing the HIF RX Header (TODO: move flags to ucControlFlag) */
974     PUINT_8     pucHifRxPacket;             /* Pointer to the Response packet to HIF RX0 or RX1 */
975     UINT_16     u2HifRxPacketLength;
976     UINT_8      ucHeaderOffset;
977     UINT_8      ucHifRxPortIndex;
978
979     UINT_16     u2SequenceControl;
980     BOOLEAN     fgIsA4Frame;                /* (For MAC RX packet parsing) set to TRUE if 4 addresses are present */
981     BOOLEAN     fgIsBAR;
982     BOOLEAN     fgIsQoSData;
983     BOOLEAN     fgIsAmsduSubframe;  /* Set to TRUE for A-MSDU Subframe */
984
985     /* For HIF RX DMA Desc */
986     BOOLEAN     fgTUChecksumCheckRequired;
987     BOOLEAN     fgIPChecksumCheckRequired;
988     UINT_8      ucEtherTypeOffset;
989
990 } SW_RFB_T, *P_SW_RFB_T;
991 #endif
992
993
994 /*******************************************************************************
995 *                            P U B L I C   D A T A
996 ********************************************************************************
997 */
998
999 /*******************************************************************************
1000 *                           P R I V A T E   D A T A
1001 ********************************************************************************
1002 */
1003
1004 /*******************************************************************************
1005 *                                 M A C R O S
1006 ********************************************************************************
1007 */
1008
1009 /*******************************************************************************
1010 *                   F U N C T I O N   D E C L A R A T I O N S
1011 ********************************************************************************
1012 */
1013
1014 P_MSDU_INFO_T
1015 cnmMgtPktAlloc (
1016     IN P_ADAPTER_T  prAdapter,
1017     IN UINT_32      u4Length
1018     );
1019
1020 VOID
1021 cnmMgtPktFree (
1022     IN P_ADAPTER_T      prAdapter,
1023     IN P_MSDU_INFO_T    prMsduInfo
1024     );
1025
1026 VOID
1027 cnmMemInit (
1028     IN P_ADAPTER_T  prAdapter
1029     );
1030
1031 PVOID
1032 cnmMemAlloc (
1033     IN P_ADAPTER_T      prAdapter,
1034     IN ENUM_RAM_TYPE_T  eRamType,
1035     IN UINT_32          u4Length
1036     );
1037
1038 VOID
1039 cnmMemFree (
1040     IN P_ADAPTER_T  prAdapter,
1041     IN PVOID pvMemory
1042     );
1043
1044 VOID
1045 cnmStaRecInit (
1046     IN P_ADAPTER_T  prAdapter
1047     );
1048
1049 VOID
1050 cnmStaRecUninit (
1051     IN P_ADAPTER_T  prAdapter
1052     );
1053
1054 P_STA_RECORD_T
1055 cnmStaRecAlloc (
1056     IN P_ADAPTER_T  prAdapter,
1057     IN UINT_8       ucNetTypeIndex
1058     );
1059
1060 VOID
1061 cnmStaRecFree (
1062     IN P_ADAPTER_T      prAdapter,
1063     IN P_STA_RECORD_T   prStaRec,
1064     IN BOOLEAN          fgSyncToChip
1065     );
1066
1067 VOID
1068 cnmStaFreeAllStaByNetType (
1069     P_ADAPTER_T                 prAdapter,
1070     ENUM_NETWORK_TYPE_INDEX_T   eNetTypeIndex,
1071     BOOLEAN                     fgSyncToChip
1072     );
1073
1074 P_STA_RECORD_T
1075 cnmGetStaRecByIndex (
1076     IN P_ADAPTER_T  prAdapter,
1077     IN UINT_8       ucIndex
1078     );
1079
1080 P_STA_RECORD_T
1081 cnmGetStaRecByAddress (
1082     IN P_ADAPTER_T  prAdapter,
1083     IN UINT_8       ucNetTypeIndex,
1084     IN UINT_8       aucPeerMACAddress[]
1085     );
1086
1087 VOID
1088 cnmStaRecResetStatus (
1089     IN P_ADAPTER_T                  prAdapter,
1090     IN ENUM_NETWORK_TYPE_INDEX_T    eNetTypeIndex
1091     );
1092
1093 VOID
1094 cnmStaRecChangeState (
1095     IN P_ADAPTER_T          prAdapter,
1096     IN OUT P_STA_RECORD_T   prStaRec,
1097     IN UINT_8               ucNewState
1098     );
1099
1100 /*******************************************************************************
1101 *                              F U N C T I O N S
1102 ********************************************************************************
1103 */
1104 #ifndef _lint
1105 /* Kevin: we don't have to call following function to inspect the data structure.
1106  * It will check automatically while at compile time.
1107  * We'll need this for porting driver to different RTOS.
1108  */
1109 __KAL_INLINE__ VOID
1110 cnmMemDataTypeCheck (
1111     VOID
1112     )
1113 {
1114 #if 0
1115     DATA_STRUC_INSPECTING_ASSERT(
1116         OFFSET_OF(MSDU_INFO_T,rLinkEntry) == 0);
1117
1118     DATA_STRUC_INSPECTING_ASSERT(
1119         OFFSET_OF(MSDU_INFO_T,rLinkEntry) == OFFSET_OF(SW_RFB_T,rLinkEntry));
1120
1121     DATA_STRUC_INSPECTING_ASSERT(
1122         OFFSET_OF(MSDU_INFO_T,pucBuffer) == OFFSET_OF(SW_RFB_T,pucBuffer));
1123
1124     DATA_STRUC_INSPECTING_ASSERT(
1125         OFFSET_OF(MSDU_INFO_T,ucBufferSource) ==
1126         OFFSET_OF(SW_RFB_T,ucBufferSource));
1127
1128     DATA_STRUC_INSPECTING_ASSERT(
1129         OFFSET_OF(MSDU_INFO_T,pucMacHeader) ==
1130         OFFSET_OF(SW_RFB_T,pucMacHeader));
1131
1132     DATA_STRUC_INSPECTING_ASSERT(
1133         OFFSET_OF(MSDU_INFO_T,ucMacHeaderLength) ==
1134         OFFSET_OF(SW_RFB_T,ucMacHeaderLength));
1135
1136     DATA_STRUC_INSPECTING_ASSERT(
1137         OFFSET_OF(MSDU_INFO_T,pucPayload) ==
1138         OFFSET_OF(SW_RFB_T,pucPayload));
1139
1140     DATA_STRUC_INSPECTING_ASSERT(
1141         OFFSET_OF(MSDU_INFO_T,u2PayloadLength) ==
1142         OFFSET_OF(SW_RFB_T,u2PayloadLength));
1143
1144     DATA_STRUC_INSPECTING_ASSERT(
1145         OFFSET_OF(MSDU_INFO_T,prStaRec) ==
1146         OFFSET_OF(SW_RFB_T,prStaRec));
1147
1148     DATA_STRUC_INSPECTING_ASSERT(
1149         OFFSET_OF(MSDU_INFO_T,ucNetworkTypeIndex) ==
1150         OFFSET_OF(SW_RFB_T,ucNetworkTypeIndex));
1151
1152     DATA_STRUC_INSPECTING_ASSERT(
1153         OFFSET_OF(MSDU_INFO_T,ucTID) ==
1154         OFFSET_OF(SW_RFB_T,ucTID));
1155
1156     DATA_STRUC_INSPECTING_ASSERT(
1157         OFFSET_OF(MSDU_INFO_T,fgIs802_11Frame) ==
1158         OFFSET_OF(SW_RFB_T,fgIs802_11Frame));
1159
1160     DATA_STRUC_INSPECTING_ASSERT(
1161         OFFSET_OF(MSDU_INFO_T,ucControlFlag) ==
1162         OFFSET_OF(SW_RFB_T,ucControlFlag));
1163
1164     DATA_STRUC_INSPECTING_ASSERT(
1165         OFFSET_OF(MSDU_INFO_T,rArrivalTime) ==
1166         OFFSET_OF(SW_RFB_T,rArrivalTime));
1167
1168     DATA_STRUC_INSPECTING_ASSERT(
1169         OFFSET_OF(MSDU_INFO_T,ucTC) ==
1170         OFFSET_OF(SW_RFB_T,ucTC));
1171
1172 #if CFG_PROFILE_BUFFER_TRACING
1173     DATA_STRUC_INSPECTING_ASSERT(
1174         OFFSET_OF(MSDU_INFO_T,eActivity[0]) ==
1175         OFFSET_OF(SW_RFB_T,eActivity[0]));
1176
1177     DATA_STRUC_INSPECTING_ASSERT(
1178         OFFSET_OF(MSDU_INFO_T,rActivityTime[0]) ==
1179         OFFSET_OF(SW_RFB_T,rActivityTime[0]));
1180 #endif
1181
1182 #if DBG && CFG_BUFFER_FREE_CHK
1183     DATA_STRUC_INSPECTING_ASSERT(
1184         OFFSET_OF(MSDU_INFO_T,fgBufferInSource) ==
1185         OFFSET_OF(SW_RFB_T,fgBufferInSource));
1186 #endif
1187
1188
1189     DATA_STRUC_INSPECTING_ASSERT(
1190         OFFSET_OF(STA_RECORD_T,rLinkEntry) == 0);
1191
1192     return;
1193 #endif
1194 }
1195 #endif /* _lint */
1196
1197 #endif /* _CNM_MEM_H */
1198
1199