import PULS_20160108
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / misc / mediatek / connectivity / combo / drv_wlan / mt6630 / wlan / nic / nic_rx.c
1 /*
2 ** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/nic/nic_rx.c#5 $
3 */
4
5 /*! \file nic_rx.c
6 \brief Functions that provide many rx-related functions
7
8 This file includes the functions used to process RFB and dispatch RFBs to
9 the appropriate related rx functions for protocols.
10 */
11
12
13
14 /*
15 ** $Log: nic_rx.c $
16 **
17 ** 06 12 2014 eason.tsai
18 ** [ALPS01070904] [Need Patch] [Volunteer Patch]
19 ** update BLBIST dump burst mode
20 **
21 ** Review: http://mtksap20:8080/go?page=NewReview&reviewid=110351
22 **
23 ** 03 11 2014 eason.tsai
24 ** [ALPS01070904] [Need Patch] [Volunteer Patch][MT6630][Driver]MT6630 Wi-Fi Patch
25 ** update rssi command
26 **
27 ** 09 03 2013 tsaiyuan.hsu
28 ** [BORA00002775] MT6630 unified MAC ROAMING
29 ** 1. modify roaming fsm.
30 ** 2. add roaming control.
31 **
32 ** 08 26 2013 eason.tsai
33 ** [BORA00002255] [MT6630 Wi-Fi][Driver] develop
34 ** revise host code for ICAP structure
35 **
36 ** 08 23 2013 terry.wu
37 ** [BORA00002207] [MT6630 Wi-Fi] TXM & MQM Implementation
38 ** 1. Reset MSDU_INFO for data packet to avoid unexpected Tx status
39 ** 2. Drop Tx packet to non-associated STA in driver
40 **
41 ** 08 20 2013 eason.tsai
42 ** [BORA00002255] [MT6630 Wi-Fi][Driver] develop
43 ** Icap function
44 **
45 ** 08 19 2013 wh.su
46 ** [BORA00002446] [MT6630] [Wi-Fi] [Driver] Update the security function code
47 ** .Adjust some debug message, refine the wlan table assign for bss
48 **
49 ** 08 13 2013 yuche.tsai
50 ** [BORA00002398] [MT6630][Volunteer Patch] P2P Driver Re-Design for Multiple BSS support
51 ** Update driver for P2P scan & listen.
52 **
53 ** 08 13 2013 terry.wu
54 ** [BORA00002207] [MT6630 Wi-Fi] TXM & MQM Implementation
55 ** 1. Assign TXD.PID by wlan index
56 ** 2. Some bug fix
57 **
58 ** 08 02 2013 terry.wu
59 ** [BORA00002207] [MT6630 Wi-Fi] TXM & MQM Implementation
60 ** Fix BMC forwarding packet KE issue
61 **
62 ** 07 31 2013 terry.wu
63 ** [BORA00002207] [MT6630 Wi-Fi] TXM & MQM Implementation
64 ** 1. Fix NetDev binding issue
65 **
66 ** 07 31 2013 tsaiyuan.hsu
67 ** [BORA00002222] MT6630 unified MAC RXM
68 ** remove unnecessary reference pointer.
69 **
70 ** 07 30 2013 tsaiyuan.hsu
71 ** [BORA00002222] MT6630 unified MAC RXM
72 ** move CIPHER_MISMATCH forom Rx HiF RFB to Data process.
73 **
74 ** 07 30 2013 wh.su
75 ** [BORA00002446] [MT6630] [Wi-Fi] [Driver] Update the security function code
76 ** update some debug code
77 **
78 ** 07 30 2013 tsaiyuan.hsu
79 ** [BORA00002222] MT6630 unified MAC RXM
80 ** add defragmentation.
81 **
82 ** 07 30 2013 yuche.tsai
83 ** [BORA00002398] [MT6630][Volunteer Patch] P2P Driver Re-Design for Multiple BSS support
84 ** Driver update for Hot-Spot mode.
85 **
86 ** 07 30 2013 yuche.tsai
87 ** [BORA00002398] [MT6630][Volunteer Patch] P2P Driver Re-Design for Multiple BSS support
88 ** MT6630 Driver Update for Hot-Spot.
89 **
90 ** 07 29 2013 tsaiyuan.hsu
91 ** [BORA00002222] MT6630 unified MAC RXM
92 ** enable rx duplicate check.
93 **
94 ** 07 29 2013 cp.wu
95 ** [BORA00002725] [MT6630][Wi-Fi] Add MGMT TX/RX support for Linux port
96 ** Preparation for porting remain_on_channel support
97 **
98 ** 07 26 2013 terry.wu
99 ** [BORA00002207] [MT6630 Wi-Fi] TXM & MQM Implementation
100 ** 1. Reduce extra Tx frame header parsing
101 ** 2. Add TX port control
102 ** 3. Add net interface to BSS binding
103 **
104 ** 07 23 2013 wh.su
105 ** [BORA00002446] [MT6630] [Wi-Fi] [Driver] Update the security function code
106 ** Modify some security code for 11w and p2p
107 **
108 ** 07 23 2013 wh.su
109 ** [BORA00002446] [MT6630] [Wi-Fi] [Driver] Update the security function code
110 ** Sync the latest jb2.mp 11w code as draft version
111 ** Not the CM bit for avoid wapi 1x drop at re-key
112 **
113 ** 07 22 2013 wh.su
114 ** [BORA00002446] [MT6630] [Wi-Fi] [Driver] Update the security function code
115 ** Handle the add key done event
116 **
117 ** 07 17 2013 wh.su
118 ** [BORA00002446] [MT6630] [Wi-Fi] [Driver] Update the security function code
119 ** fix and modify some security code
120 **
121 ** 07 12 2013 tsaiyuan.hsu
122 ** [BORA00002222] MT6630 unified MAC RXM
123 ** 1. fix rx groups retrival.
124 ** 2. avoid reordering if bmc packets
125 **
126 ** 07 05 2013 wh.su
127 ** [BORA00002446] [MT6630] [Wi-Fi] [Driver] Update the security function code
128 ** Fix to let the wpa-psk ok
129 **
130 ** 07 04 2013 wh.su
131 ** [BORA00002446] [MT6630] [Wi-Fi] [Driver] Update the security function code
132 ** Add the function to got the STA index via the wlan index
133 ** report at Rx status
134 **
135 ** 07 04 2013 tsaiyuan.hsu
136 ** [BORA00002222] MT6630 unified MAC RXM
137 ** fix seq number parser for duplication detection.
138 **
139 ** 07 03 2013 tsaiyuan.hsu
140 ** [BORA00002222] MT6630 unified MAC RXM
141 ** .
142 **
143 ** 07 03 2013 tsaiyuan.hsu
144 ** [BORA00002222] MT6630 unified MAC RXM
145 ** 1. correct header offset
146 ** 2. tentatively disable duplicate check .
147 **
148 ** 07 02 2013 wh.su
149 ** [BORA00002446] [MT6630] [Wi-Fi] [Driver] Update the security function code
150 ** Refine security BMC wlan index assign
151 ** Fix some compiling warning
152 **
153 ** 06 18 2013 cm.chang
154 ** [BORA00002149] [MT6630 Wi-Fi] Initial software development
155 ** Get MAC address by NIC_CAPABILITY command
156 **
157 ** 06 18 2013 terry.wu
158 ** [BORA00002207] [MT6630 Wi-Fi] TXM & MQM Implementation
159 ** Update for 1st connection
160 **
161 ** 05 08 2013 cp.wu
162 ** [BORA00002227] [MT6630 Wi-Fi][Driver] Update for Makefile and HIFSYS modifications
163 ** add option to workaround HIFSYS RX status 4-bytes count-in issue
164 **
165 ** 03 29 2013 cp.wu
166 ** [BORA00002227] [MT6630 Wi-Fi][Driver] Update for Makefile and HIFSYS modifications
167 ** 1. remove unused HIF definitions
168 ** 2. enable NDIS 5.1 build success
169 **
170 ** 03 20 2013 tsaiyuan.hsu
171 ** [BORA00002222] MT6630 unified MAC RXM
172 ** add rx duplicate check.
173 **
174 ** 03 13 2013 terry.wu
175 ** [BORA00002207] [MT6630 Wi-Fi] TXM & MQM Implementation
176 ** .
177 **
178 ** 03 12 2013 tsaiyuan.hsu
179 ** [BORA00002222] MT6630 unified MAC RXM
180 ** remove hif_rx_hdr usage.
181 **
182 ** 03 12 2013 tsaiyuan.hsu
183 ** [BORA00002222] MT6630 unified MAC RXM
184 ** add rx data and mangement processing.
185 **
186 ** 03 07 2013 tsaiyuan.hsu
187 ** [BORA00002222] MT6630 unified MAC RXM
188 ** use rx_status to locate packet type instead of hif_rx_header.
189 **
190 ** 02 27 2013 yuche.tsai
191 ** [BORA00002398] [MT6630][Volunteer Patch] P2P Driver Re-Design for Multiple BSS support
192 ** Add aaa_fsm.c, p2p_ie.c, fix compile warning & error.
193 **
194 ** 02 27 2013 yuche.tsai
195 ** [BORA00002398] [MT6630][Volunteer Patch] P2P Driver Re-Design for Multiple BSS support
196 ** Add new code, fix compile warning.
197 **
198 ** 02 19 2013 cp.wu
199 ** [BORA00002227] [MT6630 Wi-Fi][Driver] Update for Makefile and HIFSYS modifications
200 ** take use of GET_BSS_INFO_BY_INDEX() and MAX_BSS_INDEX macros
201 ** for correctly indexing of BSS-INFO pointers
202 **
203 ** 02 19 2013 cp.wu
204 ** [BORA00002227] [MT6630 Wi-Fi][Driver] Update for Makefile and HIFSYS modifications
205 ** enable build for nic_rx.c & nic_cmd_event.c
206 **
207 ** 02 06 2013 yuche.tsai
208 ** [BORA00002398] [MT6630][Volunteer Patch] P2P Driver Re-Design for Multiple BSS support
209 ** Fix BSS index to BSS Info MACRO
210 **
211 ** 02 01 2013 cp.wu
212 ** [BORA00002227] [MT6630 Wi-Fi][Driver] Update for Makefile and HIFSYS modifications
213 ** 1. eliminate MT5931/MT6620/MT6628 logic
214 ** 2. add firmware download control sequence
215 **
216 ** 01 22 2013 cp.wu
217 ** [BORA00002253] [MT6630 Wi-Fi][Driver][Firmware] Add NLO and timeout mechanism to SCN module
218 ** modification for ucBssIndex migration
219 **
220 ** 11 01 2012 cp.wu
221 ** [BORA00002227] [MT6630 Wi-Fi][Driver] Update for Makefile and HIFSYS modifications
222 ** update to MT6630 CMD/EVENT definitions.
223 **
224 ** 09 17 2012 cm.chang
225 ** [BORA00002149] [MT6630 Wi-Fi] Initial software development
226 ** Duplicate source from MT6620 v2.3 driver branch
227 ** (Davinci label: MT6620_WIFI_Driver_V2_3_120913_1942_As_MT6630_Base)
228 **
229 ** 08 30 2012 yuche.tsai
230 ** NULL
231 ** Fix disconnect issue possible leads KE.
232 **
233 ** 08 24 2012 yuche.tsai
234 ** NULL
235 ** Fix bug of invitation request.
236 *
237 * 07 17 2012 yuche.tsai
238 * NULL
239 * Let netdev bring up.
240 *
241 * 07 17 2012 yuche.tsai
242 * NULL
243 * Compile no error before trial run.
244 *
245 * 03 02 2012 terry.wu
246 * NULL
247 * Sync CFG80211 modification from branch 2,2.
248 *
249 * 02 14 2012 cp.wu
250 * NULL
251 * remove another assertion by error message dump
252 *
253 * 01 05 2012 tsaiyuan.hsu
254 * [WCXRP00001157] [MT6620 Wi-Fi][FW][DRV] add timing measurement support for 802.11v
255 * add timing measurement support for 802.11v.
256 *
257 * 11 19 2011 yuche.tsai
258 * NULL
259 * Update RSSI for P2P.
260 *
261 * 11 18 2011 yuche.tsai
262 * NULL
263 * CONFIG P2P support RSSI query, default turned off.
264 *
265 * 11 17 2011 tsaiyuan.hsu
266 * [WCXRP00001115] [MT6620 Wi-Fi][DRV] avoid deactivating staRec when changing state 3 to 3.
267 * avoid deactivating staRec when changing state from 3 to 3.
268 *
269 * 11 11 2011 wh.su
270 * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG
271 * modify the xlog related code.
272 *
273 * 11 10 2011 eddie.chen
274 * [WCXRP00001096] [MT6620 Wi-Fi][Driver/FW] Enhance the log function (xlog)
275 * Modify the QM xlog level and remove LOG_FUNC.
276 *
277 * 11 09 2011 eddie.chen
278 * [WCXRP00001096] [MT6620 Wi-Fi][Driver/FW] Enhance the log function (xlog)
279 * Add xlog for beacon timeout and sta aging timeout.
280 *
281 * 11 08 2011 eddie.chen
282 * [WCXRP00001096] [MT6620 Wi-Fi][Driver/FW] Enhance the log function (xlog)
283 * Add xlog function.
284 *
285 * 11 07 2011 tsaiyuan.hsu
286 * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered
287 * add debug counters and periodically dump counters for debugging.
288 *
289 * 10 21 2011 eddie.chen
290 * [WCXRP00001051] [MT6620 Wi-Fi][Driver/Fw] Adjust the STA aging timeout
291 * Add switch to ignore the STA aging timeout.
292 *
293 * 10 12 2011 wh.su
294 * [WCXRP00001036] [MT6620 Wi-Fi][Driver][FW] Adding the 802.11w code for MFP
295 * adding the 802.11w related function and define .
296 *
297 * 08 26 2011 cp.wu
298 * [WCXRP00000958] [MT6620 Wi-Fi][Driver] Extend polling timeout from 25ms to 1sec due to RF calibration might took up to 600ms
299 * extend polling RX response timeout period from 25ms to 1000ms.
300 *
301 * 08 11 2011 cp.wu
302 * [WCXRP00000830] [MT6620 Wi-Fi][Firmware] Use MDRDY counter to detect empty channel for shortening scan time
303 * sparse channel detection:
304 * driver: collect sparse channel information with scan-done event
305 *
306 * 07 28 2011 chinghwa.yu
307 * [WCXRP00000063] Update BCM CoEx design and settings
308 * Add BWCS cmd and event.
309 *
310 * 07 27 2011 cp.wu
311 * [WCXRP00000876] [MT5931][Drver] Decide to retain according to currently availble RX counter and QUE_MGT used count
312 * correct comment.
313 *
314 * 07 27 2011 cp.wu
315 * [WCXRP00000876] [MT5931][Drver] Decide to retain according to currently availble RX counter and QUE_MGT used count
316 * take use of QUE_MGT exported function to estimate currently RX buffer usage count.
317 *
318 * 07 18 2011 chinghwa.yu
319 * [WCXRP00000063] Update BCM CoEx design and settings[WCXRP00000612] [MT6620 Wi-Fi] [FW] CSD update SWRDD algorithm
320 * Add CMD/Event for RDD and BWCS.
321 *
322 * 06 09 2011 tsaiyuan.hsu
323 * [WCXRP00000760] [MT5931 Wi-Fi][FW] Refine rxmHandleMacRxDone to reduce code size
324 * move send_auth at rxmHandleMacRxDone in firmware to driver to reduce code size.
325 *
326 * 05 11 2011 eddie.chen
327 * [WCXRP00000709] [MT6620 Wi-Fi][Driver] Check free number before copying broadcast packet
328 * Fix dest type when GO packet copying.
329 *
330 * 05 09 2011 eddie.chen
331 * [WCXRP00000709] [MT6620 Wi-Fi][Driver] Check free number before copying broadcast packet
332 * Check free number before copying broadcast packet.
333 *
334 * 05 05 2011 cp.wu
335 * [WCXRP00000702] [MT5931][Driver] Modify initialization sequence for E1 ASIC
336 * add delay after whole-chip resetting for MT5931 E1 ASIC.
337 *
338 * 04 18 2011 terry.wu
339 * [WCXRP00000660] [MT6620 Wi-Fi][Driver] Remove flag CFG_WIFI_DIRECT_MOVED
340 * Remove flag CFG_WIFI_DIRECT_MOVED.
341 *
342 * 04 12 2011 cm.chang
343 * [WCXRP00000634] [MT6620 Wi-Fi][Driver][FW] 2nd BSS will not support 40MHz bandwidth for concurrency
344 * .
345 *
346 * 04 08 2011 yuche.tsai
347 * [WCXRP00000624] [Volunteer Patch][MT6620][Driver] Add device discoverability support for GO.
348 * Add device discoverability support for GO.
349 *
350 * 04 01 2011 tsaiyuan.hsu
351 * [WCXRP00000615] [MT 6620 Wi-Fi][Driver] Fix klocwork issues
352 * fix the klocwork issues, 57500, 57501, 57502 and 57503.
353 *
354 * 03 19 2011 yuche.tsai
355 * [WCXRP00000584] [Volunteer Patch][MT6620][Driver] Add beacon timeout support for WiFi Direct.
356 * Add beacon timeout support for WiFi Direct Network.
357 *
358 * 03 18 2011 wh.su
359 * [WCXRP00000530] [MT6620 Wi-Fi] [Driver] skip doing p2pRunEventAAAComplete after send assoc response Tx Done
360 * enable the Anti_piracy check at driver .
361 *
362 * 03 17 2011 cp.wu
363 * [WCXRP00000562] [MT6620 Wi-Fi][Driver] I/O buffer pre-allocation to avoid physically continuous memory shortage after system running for a long period
364 * use pre-allocated buffer for storing enhanced interrupt response as well
365 *
366 * 03 15 2011 cp.wu
367 * [WCXRP00000559] [MT6620 Wi-Fi][Driver] Combine TX/RX DMA buffers into a single one to reduce physically continuous memory consumption
368 * 1. deprecate CFG_HANDLE_IST_IN_SDIO_CALLBACK
369 * 2. Use common coalescing buffer for both TX/RX directions
370 *
371 *
372 * 03 07 2011 wh.su
373 * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code
374 * rename the define to anti_pviracy.
375 *
376 * 03 05 2011 wh.su
377 * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code
378 * add the code to get the check rsponse and indicate to app.
379 *
380 * 03 02 2011 wh.su
381 * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code
382 * Add security check code.
383 *
384 * 03 02 2011 cp.wu
385 * [WCXRP00000503] [MT6620 Wi-Fi][Driver] Take RCPI brought by association response as initial RSSI right after connection is built.
386 * use RCPI brought by ASSOC-RESP after connection is built as initial RCPI to avoid using a uninitialized MAC-RX RCPI.
387 *
388 * 02 10 2011 yuche.tsai
389 * [WCXRP00000419] [Volunteer Patch][MT6620/MT5931][Driver] Provide function of disconnect to target station for AAA module.
390 * Remove Station Record after Aging timeout.
391 *
392 * 02 10 2011 cp.wu
393 * [WCXRP00000434] [MT6620 Wi-Fi][Driver] Obsolete unused event packet handlers
394 * EVENT_ID_CONNECTION_STATUS has been obsoleted and no need to handle.
395 *
396 * 02 09 2011 yuche.tsai
397 * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode.
398 * Add MLME deauthentication support for Hot-Spot mode.
399 *
400 * 02 09 2011 eddie.chen
401 * [WCXRP00000426] [MT6620 Wi-Fi][FW/Driver] Add STA aging timeout and defualtHwRatein AP mode
402 * Adjust variable order.
403 *
404 * 02 08 2011 eddie.chen
405 * [WCXRP00000426] [MT6620 Wi-Fi][FW/Driver] Add STA aging timeout and defualtHwRatein AP mode
406 * Add event STA agint timeout
407 *
408 * 01 27 2011 tsaiyuan.hsu
409 * [WCXRP00000392] [MT6620 Wi-Fi][Driver] Add Roaming Support
410 * add roaming fsm
411 * 1. not support 11r, only use strength of signal to determine roaming.
412 * 2. not enable CFG_SUPPORT_ROAMING until completion of full test.
413 * 3. in 6620, adopt work-around to avoid sign extension problem of cck of hw
414 * 4. assume that change of link quality in smooth way.
415 *
416 * 01 26 2011 cm.chang
417 * [WCXRP00000395] [MT6620 Wi-Fi][Driver][FW] Search STA_REC with additional net type index argument
418 * .
419 *
420 * 01 24 2011 eddie.chen
421 * [WCXRP00000385] [MT6620 Wi-Fi][DRV] Add destination decision for forwarding packets
422 * Remove comments.
423 *
424 * 01 24 2011 eddie.chen
425 * [WCXRP00000385] [MT6620 Wi-Fi][DRV] Add destination decision for forwarding packets
426 * Add destination decision in AP mode.
427 *
428 * 01 24 2011 cm.chang
429 * [WCXRP00000384] [MT6620 Wi-Fi][Driver][FW] Handle 20/40 action frame in AP mode and stop ampdu timer when sta_rec is freed
430 * Process received 20/40 coexistence action frame for AP mode
431 *
432 * 01 24 2011 cp.wu
433 * [WCXRP00000382] [MT6620 Wi-Fi][Driver] Track forwarding packet number with notifying tx thread for serving
434 * 1. add an extra counter for tracking pending forward frames.
435 * 2. notify TX service thread as well when there is pending forward frame
436 * 3. correct build errors leaded by introduction of Wi-Fi direct separation module
437 *
438 * 01 12 2011 cp.wu
439 * [WCXRP00000357] [MT6620 Wi-Fi][Driver][Bluetooth over Wi-Fi] add another net device interface for BT AMP
440 * implementation of separate BT_OVER_WIFI data path.
441 *
442 * 12 29 2010 eddie.chen
443 * [WCXRP00000322] Add WMM IE in beacon,
444 Add per station flow control when STA is in PS
445
446 * 1) PS flow control event
447 *
448 * 2) WMM IE in beacon, assoc resp, probe resp
449 *
450 * 12 15 2010 george.huang
451 * [WCXRP00000152] [MT6620 Wi-Fi] AP mode power saving function
452 * update beacon for NoA
453 *
454 * 11 01 2010 cp.wu
455 * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000150] [MT6620 Wi-Fi][Driver] Add implementation for querying current TX rate from firmware auto rate module
456 * 1) Query link speed (TX rate) from firmware directly with buffering mechanism to reduce overhead
457 * 2) Remove CNM CH-RECOVER event handling
458 * 3) cfg read/write API renamed with kal prefix for unified naming rules.
459 *
460 * 10 27 2010 george.huang
461 * [WCXRP00000127] [MT6620 Wi-Fi][Driver] Add a registry to disable Beacon Timeout function for SQA test by using E1 EVB
462 * Support registry option for disable beacon lost detection.
463 *
464 * 10 20 2010 wh.su
465 * NULL
466 * add a cmd to reset the p2p key
467 *
468 * 10 20 2010 wh.su
469 * [WCXRP00000124] [MT6620 Wi-Fi] [Driver] Support the dissolve P2P Group
470 * Add the code to support disconnect p2p group
471 *
472 * 09 29 2010 wh.su
473 * [WCXRP00000072] [MT6620 Wi-Fi][Driver] Fix TKIP Counter Measure EAPoL callback register issue
474 * fixed compilier error.
475 *
476 * 09 29 2010 wh.su
477 * [WCXRP00000072] [MT6620 Wi-Fi][Driver] Fix TKIP Counter Measure EAPoL callback register issue
478 * [MT6620 Wi-Fi][Driver] Fix TKIP Counter Measure EAPoL callback register issue.
479 *
480 * 09 23 2010 cp.wu
481 * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning
482 * eliminate reference of CFG_RESPONSE_MAX_PKT_SIZE
483 *
484 * 09 21 2010 cp.wu
485 * [WCXRP00000053] [MT6620 Wi-Fi][Driver] Reset incomplete and might leads to BSOD when entering RF test with AIS associated
486 * release RX packet to packet pool when in RF test mode
487 *
488 * 09 21 2010 cp.wu
489 * [WCXRP00000053] [MT6620 Wi-Fi][Driver] Reset incomplete and might leads to BSOD when entering RF test with AIS associated
490 * Do a complete reset with STA-REC null checking for RF test re-entry
491 *
492 * 09 08 2010 cp.wu
493 * NULL
494 * use static memory pool for storing IEs of scanning result.
495 *
496 * 09 07 2010 yuche.tsai
497 * NULL
498 * Add a common buffer, store the IE of a P2P device in this common buffer.
499 *
500 * 09 03 2010 kevin.huang
501 * NULL
502 * Refine #include sequence and solve recursive/nested #include issue
503 *
504 * 08 31 2010 kevin.huang
505 * NULL
506 * Use LINK LIST operation to process SCAN result
507 *
508 * 08 30 2010 cp.wu
509 * NULL
510 * eliminate klockwork errors
511 *
512 * 08 20 2010 cm.chang
513 * NULL
514 * Migrate RLM code to host from FW
515 *
516 * 08 20 2010 yuche.tsai
517 * NULL
518 * When enable WiFi Direct function, check each packet to tell which interface to indicate.
519 *
520 * 08 05 2010 yuche.tsai
521 * NULL
522 * Add P2P Device Discovery Function.
523 *
524 * 08 03 2010 cp.wu
525 * NULL
526 * surpress compilation warning.
527 *
528 * 08 03 2010 george.huang
529 * NULL
530 * handle event for updating NOA parameters indicated from FW
531 *
532 * 08 02 2010 yuche.tsai
533 * NULL
534 * Add support API for RX public action frame.
535 *
536 * 08 02 2010 jeffrey.chang
537 * NULL
538 * 1) modify tx service thread to avoid busy looping
539 * 2) add spin lock declartion for linux build
540 *
541 * 07 30 2010 cp.wu
542 * NULL
543 * 1) BoW wrapper: use definitions instead of hard-coded constant for error code
544 * 2) AIS-FSM: eliminate use of desired RF parameters, use prTargetBssDesc instead
545 * 3) add handling for RX_PKT_DESTINATION_HOST_WITH_FORWARD for GO-broadcast frames
546 *
547 * 07 26 2010 yuche.tsai
548 *
549 * Update Device Capability Bitmap & Group Capability Bitmap from 16 bits to 8 bits.
550 *
551 * 07 24 2010 wh.su
552 *
553 * .support the Wi-Fi RSN
554 *
555 * 07 23 2010 cp.wu
556 *
557 * add AIS-FSM handling for beacon timeout event.
558 *
559 * 07 21 2010 yuche.tsai
560 *
561 * Add P2P Scan & Scan Result Parsing & Saving.
562 *
563 * 07 19 2010 cm.chang
564 *
565 * Set RLM parameters and enable CNM channel manager
566 *
567 * 07 19 2010 cp.wu
568 *
569 * [WPD00003833] [MT6620 and MT5931] Driver migration.
570 * Add Ad-Hoc support to AIS-FSM
571 *
572 * 07 19 2010 jeffrey.chang
573 *
574 * Linux port modification
575 *
576 * 07 16 2010 yarco.yang
577 *
578 * 1. Support BSS Absence/Presence Event
579 * 2. Support STA change PS mode Event
580 * 3. Support BMC forwarding for AP mode.
581 *
582 * 07 15 2010 cp.wu
583 *
584 * sync. bluetooth-over-Wi-Fi interface to driver interface document v0.2.6.
585 *
586 * 07 08 2010 cp.wu
587 *
588 * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
589 *
590 * 07 07 2010 cp.wu
591 * [WPD00003833][MT6620 and MT5931] Driver migration
592 * fill ucStaRecIdx into SW_RFB_T.
593 *
594 * 07 02 2010 cp.wu
595 * [WPD00003833][MT6620 and MT5931] Driver migration
596 * 1) for event packet, no need to fill RFB.
597 * 2) when wlanAdapterStart() failed, no need to initialize state machines
598 * 3) after Beacon/ProbeResp parsing, corresponding BSS_DESC_T should be marked as IE-parsed
599 *
600 * 07 01 2010 cp.wu
601 * [WPD00003833][MT6620 and MT5931] Driver migration
602 * implementation of DRV-SCN and related mailbox message handling.
603 *
604 * 06 29 2010 yarco.yang
605 * [WPD00003837][MT6620]Data Path Refine
606 * replace g_rQM with Adpater->rQM
607 *
608 * 06 23 2010 yarco.yang
609 * [WPD00003837][MT6620]Data Path Refine
610 * Merge g_arStaRec[] into adapter->arStaRec[]
611 *
612 * 06 22 2010 cp.wu
613 * [WPD00003833][MT6620 and MT5931] Driver migration
614 * 1) add command warpper for STA-REC/BSS-INFO sync.
615 * 2) enhance command packet sending procedure for non-oid part
616 * 3) add command packet definitions for STA-REC/BSS-INFO sync.
617 *
618 * 06 21 2010 cp.wu
619 * [WPD00003833][MT6620 and MT5931] Driver migration
620 * refine TX-DONE callback.
621 *
622 * 06 21 2010 cp.wu
623 * [WPD00003833][MT6620 and MT5931] Driver migration
624 * implement TX_DONE callback path.
625 *
626 * 06 21 2010 yarco.yang
627 * [WPD00003837][MT6620]Data Path Refine
628 * Add TX Done Event handle entry
629 *
630 * 06 21 2010 wh.su
631 * [WPD00003840][MT6620 5931] Security migration
632 * remove duplicate variable for migration.
633 *
634 * 06 15 2010 cp.wu
635 * [WPD00003833][MT6620 and MT5931] Driver migration
636 * .
637 *
638 * 06 15 2010 cp.wu
639 * [WPD00003833][MT6620 and MT5931] Driver migration
640 * .
641 *
642 * 06 14 2010 cp.wu
643 * [WPD00003833][MT6620 and MT5931] Driver migration
644 * saa_fsm.c is migrated.
645 *
646 * 06 14 2010 cp.wu
647 * [WPD00003833][MT6620 and MT5931] Driver migration
648 * add management dispatching function table.
649 *
650 * 06 11 2010 cp.wu
651 * [WPD00003833][MT6620 and MT5931] Driver migration
652 * 1) migrate assoc.c.
653 * 2) add ucTxSeqNum for tracking frames which needs TX-DONE awareness
654 * 3) add configuration options for CNM_MEM and RSN modules
655 * 4) add data path for management frames
656 * 5) eliminate rPacketInfo of MSDU_INFO_T
657 *
658 * 06 10 2010 cp.wu
659 * [WPD00003833][MT6620 and MT5931] Driver migration
660 * 1) eliminate CFG_CMD_EVENT_VERSION_0_9
661 * 2) when disconnected, indicate nic directly (no event is needed)
662 *
663 * 06 08 2010 cp.wu
664 * [WPD00003833][MT6620 and MT5931] Driver migration
665 * cnm_timer has been migrated.
666 *
667 * 06 07 2010 cp.wu
668 * [WPD00003833][MT6620 and MT5931] Driver migration
669 * merge wlan_def.h.
670 *
671 * 06 07 2010 cp.wu
672 * [WPD00003833][MT6620 and MT5931] Driver migration
673 * sync with MT6620 driver for scan result replacement policy
674 *
675 * 06 06 2010 kevin.huang
676 * [WPD00003832][MT6620 5931] Create driver base
677 * [MT6620 5931] Create driver base
678 *
679 * 05 20 2010 cp.wu
680 * [WPD00001943]Create WiFi test driver framework on WinXP
681 * 1) integrate OID_GEN_NETWORK_LAYER_ADDRESSES with CMD_ID_SET_IP_ADDRESS
682 * 2) buffer statistics data for 2 seconds
683 * 3) use default value for adhoc parameters instead of 0
684 *
685 * 05 19 2010 cp.wu
686 * [WPD00001943]Create WiFi test driver framework on WinXP
687 * 1) do not take timeout mechanism for power mode oids
688 * 2) retrieve network type from connection status
689 * 3) after disassciation, set radio state to off
690 * 4) TCP option over IPv6 is supported
691 *
692 * 04 29 2010 wh.su
693 * [WPD00003816][MT6620 Wi-Fi] Adding the security support
694 * fixing the PMKID candicate indicate code.
695 *
696 * 04 28 2010 cp.wu
697 * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support
698 * change prefix for data structure used to communicate with 802.11 PAL
699 * to avoid ambiguous naming with firmware interface
700 *
701 * 04 27 2010 cp.wu
702 * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support
703 * basic implementation for EVENT_BT_OVER_WIFI
704 *
705 * 04 23 2010 cp.wu
706 * [WPD00001943]Create WiFi test driver framework on WinXP
707 * surpress compiler warning
708 *
709 * 04 22 2010 jeffrey.chang
710 * [WPD00003826]Initial import for Linux port
711 *
712 * 1) modify rx path code for supporting Wi-Fi direct
713 * 2) modify config.h since Linux dont need to consider retaining packet
714 *
715 * 04 16 2010 cp.wu
716 * [WPD00001943]Create WiFi test driver framework on WinXP
717 * treat BUS access failure as kind of card removal.
718 *
719 * 04 14 2010 cp.wu
720 * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support
721 * nicRxProcessEvent packet doesn't access spin-lock directly from now on.
722 *
723 * 04 14 2010 cp.wu
724 * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support
725 * do not need to release the spin lock due to it is done inside nicGetPendingCmdInfo()
726 *
727 * 04 13 2010 cp.wu
728 * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support
729 * add framework for BT-over-Wi-Fi support.
730 * * * * * * * * * * * * * * * 1) prPendingCmdInfo is replaced by queue for multiple handler capability
731 * * * * * * * * * * * * * * * 2) command sequence number is now increased atomically
732 * * * * * * * * * * * * * * * 3) private data could be hold and taken use for other purpose
733 *
734 * 04 12 2010 cp.wu
735 * [WPD00001943]Create WiFi test driver framework on WinXP
736 * add channel frequency <-> number conversion
737 *
738 * 04 09 2010 jeffrey.chang
739 * [WPD00003826]Initial import for Linux port
740 * 1) add spinlock
741 * 2) add KAPI for handling association info
742 *
743 * 04 07 2010 cp.wu
744 * [WPD00001943]Create WiFi test driver framework on WinXP
745 * rWlanInfo should be placed at adapter rather than glue due to most operations
746 * * * * * are done in adapter layer.
747 *
748 * 04 07 2010 cp.wu
749 * [WPD00001943]Create WiFi test driver framework on WinXP
750 * eliminate direct access to prGlueInfo->eParamMediaStateIndicated from non-glue layer
751 *
752 * 04 06 2010 cp.wu
753 * [WPD00001943]Create WiFi test driver framework on WinXP
754 * eliminate direct access for prGlueInfo->fgIsCardRemoved in non-glue layer
755 *
756 * 04 01 2010 jeffrey.chang
757 * [WPD00003826]Initial import for Linux port
758 * improve Linux supplicant compliance
759 *
760 * 03 31 2010 jeffrey.chang
761 * [WPD00003826]Initial import for Linux port
762 * fix ioctl which may cause cmdinfo memory leak
763 *
764 * 03 30 2010 cp.wu
765 * [WPD00001943]Create WiFi test driver framework on WinXP
766 * remove driver-land statistics.
767 *
768 * 03 29 2010 jeffrey.chang
769 * [WPD00003826]Initial import for Linux port
770 * improve none-glue code portability
771 *
772 * 03 28 2010 jeffrey.chang
773 * [WPD00003826]Initial import for Linux port
774 * rWlanInfo is modified before data is indicated to OS
775 *
776 * 03 28 2010 jeffrey.chang
777 * [WPD00003826]Initial import for Linux port
778 * rWlanInfo is modified before data is indicated to OS
779 *
780 * 03 26 2010 cp.wu
781 * [WPD00001943]Create WiFi test driver framework on WinXP
782 * add a temporary flag for integration with CMD/EVENT v0.9.
783 *
784 * 03 25 2010 cp.wu
785 * [WPD00001943]Create WiFi test driver framework on WinXP
786 * 1) correct OID_802_11_CONFIGURATION with frequency setting behavior.
787 * * * the frequency is used for adhoc connection only
788 * * * 2) update with SD1 v0.9 CMD/EVENT documentation
789 *
790 * 03 24 2010 jeffrey.chang
791 * [WPD00003826]Initial import for Linux port
792 * initial import for Linux port
793 *
794 * 03 24 2010 cp.wu
795 * [WPD00001943]Create WiFi test driver framework on WinXP
796 * .
797 *
798 * 03 24 2010 cp.wu
799 * [WPD00001943]Create WiFi test driver framework on WinXP
800 * generate information for OID_GEN_RCV_OK & OID_GEN_XMIT_OK
801 * * * *
802 *
803 * 03 19 2010 cp.wu
804 * [WPD00001943]Create WiFi test driver framework on WinXP
805 * 1) add ACPI D0/D3 state switching support
806 * * * * * * * * * 2) use more formal way to handle interrupt when the status is retrieved from enhanced RX response
807 *
808 * 03 15 2010 kevin.huang
809 * [WPD00003820][MT6620 Wi-Fi] Modify the code for meet the WHQL test
810 * Add event for activate STA_RECORD_T
811 *
812 * 03 12 2010 cp.wu
813 * [WPD00001943]Create WiFi test driver framework on WinXP
814 * correct fgSetQuery/fgNeedResp check
815 *
816 * 03 11 2010 cp.wu
817 * [WPD00003821][BUG] Host driver stops processing RX packets from HIF RX0
818 * add RX starvation warning debug message controlled by CFG_HIF_RX_STARVATION_WARNING
819 *
820 * 03 10 2010 cp.wu
821 * [WPD00001943]Create WiFi test driver framework on WinXP
822 * code clean: removing unused variables and structure definitions
823 *
824 * 03 08 2010 cp.wu
825 * [WPD00001943]Create WiFi test driver framework on WinXP
826 * 1) add another spin-lock to protect MsduInfoList due to it might be accessed by different thread.
827 * * * 2) change own-back acquiring procedure to wait for up to 16.67 seconds
828 *
829 * 03 02 2010 cp.wu
830 * [WPD00001943]Create WiFi test driver framework on WinXP
831 * 1) the use of prPendingOid revised, all accessing are now protected by spin lock
832 * * * * 2) ensure wlanReleasePendingOid will clear all command queues
833 *
834 * 03 02 2010 cp.wu
835 * [WPD00001943]Create WiFi test driver framework on WinXP
836 * add mutex to avoid multiple access to qmTxQueue simultaneously.
837 *
838 * 02 26 2010 cp.wu
839 * [WPD00001943]Create WiFi test driver framework on WinXP
840 * move EVENT_ID_ASSOC_INFO from nic_rx.c to gl_kal_ndis_51.c
841 * * 'cause it involves OS dependent data structure handling
842 *
843 * 02 25 2010 cp.wu
844 * [WPD00001943]Create WiFi test driver framework on WinXP
845 * correct behavior to prevent duplicated RX handling for RX0_DONE and RX1_DONE
846 *
847 * 02 24 2010 tehuang.liu
848 * [WPD00001943]Create WiFi test driver framework on WinXP
849 * Updated API interfaces for qmHandleEventRxAddBa() and qmHandleEventRxDelBa()
850 *
851 * 02 10 2010 cp.wu
852 * [WPD00001943]Create WiFi test driver framework on WinXP
853 * implement host-side firmware download logic
854 *
855 * 02 10 2010 cp.wu
856 * [WPD00001943]Create WiFi test driver framework on WinXP
857 * 1) remove unused function in nic_rx.c [which has been handled in que_mgt.c]
858 * * * * * 2) firmware image length is now retrieved via NdisFileOpen
859 * * * * * 3) firmware image is not structured by (P_IMG_SEC_HDR_T) anymore
860 * * * * * 4) nicRxWaitResponse() revised
861 * * * * * 5) another set of TQ counter default value is added for fw-download state
862 * * * * * 6) Wi-Fi load address is now retrieved from registry too
863 *
864 * 02 09 2010 cp.wu
865 * [WPD00001943]Create WiFi test driver framework on WinXP
866 * 1. Permanent and current MAC address are now retrieved by CMD/EVENT packets instead of hard-coded address
867 * * * * * * * * 2. follow MSDN defined behavior when associates to another AP
868 * * * * * * * * 3. for firmware download, packet size could be up to 2048 bytes
869 *
870 * 01 27 2010 wh.su
871 * [WPD00003816][MT6620 Wi-Fi] Adding the security support
872 * .
873 *
874 * 01 22 2010 cp.wu
875 * [WPD00001943]Create WiFi test driver framework on WinXP
876 * implement following 802.11 OIDs:
877 * * * * * * OID_802_11_RSSI,
878 * * * * * * OID_802_11_RSSI_TRIGGER,
879 * * * * * * OID_802_11_STATISTICS,
880 * * * * * * OID_802_11_DISASSOCIATE,
881 * * * * * * OID_802_11_POWER_MODE
882 *
883 * 12 30 2009 cp.wu
884 * [WPD00001943]Create WiFi test driver framework on WinXP
885 * 1) According to CMD/EVENT documentation v0.8,
886 * * * * * * * * * OID_CUSTOM_TEST_RX_STATUS & OID_CUSTOM_TEST_TX_STATUS is no longer used,
887 * * * * * * * * * and result is retrieved by get ATInfo instead
888 * * * * * * * * * 2) add 4 counter for recording aggregation statistics
889 *
890 * 12 23 2009 cp.wu
891 * [WPD00001943]Create WiFi test driver framework on WinXP
892 * add a precheck: if free sw rfb is not enough, do not invoke read transactionu1rwduu`wvpghlqg|fu+rp
893 *
894 * 12 22 2009 cp.wu
895 * [WPD00003809][Bug] Host driver will crash when processing reordered MSDUs
896 * The root cause is pointer accessing by mistake. After dequeued from reordering-buffer, handling logic should access returned pointer instead of pointer which has been passed in before.
897 ** \main\maintrunk.MT6620WiFiDriver_Prj\58 2009-12-17 13:40:33 GMT mtk02752
898 ** always update prAdapter->rSDIOCtrl when enhanced response is read by RX
899 ** \main\maintrunk.MT6620WiFiDriver_Prj\57 2009-12-16 18:01:38 GMT mtk02752
900 ** if interrupt enhanced response is fetched by RX enhanced response, RX needs to invoke interrupt handlers too
901 ** \main\maintrunk.MT6620WiFiDriver_Prj\56 2009-12-16 14:16:52 GMT mtk02752
902 ** \main\maintrunk.MT6620WiFiDriver_Prj\55 2009-12-15 20:03:12 GMT mtk02752
903 ** ASSERT when RX FreeSwRfb is not enough
904 ** \main\maintrunk.MT6620WiFiDriver_Prj\54 2009-12-15 17:01:29 GMT mtk02752
905 ** when CFG_SDIO_RX_ENHANCE is enabled, after enhanced response is read, rx procedure should process 1) TX_DONE_INT 2) D2H INT as well
906 ** \main\maintrunk.MT6620WiFiDriver_Prj\53 2009-12-14 20:45:28 GMT mtk02752
907 ** when CFG_SDIO_RX_ENHANCE is set, TC counter must be updated each time RX enhance response is read
908 **
909 ** \main\maintrunk.MT6620WiFiDriver_Prj\52 2009-12-14 11:34:16 GMT mtk02752
910 ** correct a trivial logic issue
911 ** \main\maintrunk.MT6620WiFiDriver_Prj\51 2009-12-14 10:28:25 GMT mtk02752
912 ** add a protection to avoid out-of-boundary access
913 ** \main\maintrunk.MT6620WiFiDriver_Prj\50 2009-12-10 16:55:18 GMT mtk02752
914 ** code clean
915 ** \main\maintrunk.MT6620WiFiDriver_Prj\49 2009-12-09 14:06:47 GMT MTK02468
916 ** Added parsing event packets with EVENT_ID_RX_ADDBA or EVENT_ID_RX_DELBA
917 ** \main\maintrunk.MT6620WiFiDriver_Prj\48 2009-12-08 17:37:51 GMT mtk02752
918 ** handle EVENT_ID_TEST_STATUS as well
919 ** \main\maintrunk.MT6620WiFiDriver_Prj\47 2009-12-04 17:59:11 GMT mtk02752
920 ** to pass free-build compilation check
921 ** \main\maintrunk.MT6620WiFiDriver_Prj\46 2009-12-04 12:09:52 GMT mtk02752
922 ** correct trivial mistake
923 ** \main\maintrunk.MT6620WiFiDriver_Prj\45 2009-12-04 11:53:37 GMT mtk02752
924 ** all API should be compilable under SD1_SD3_DATAPATH_INTEGRATION == 0
925 ** \main\maintrunk.MT6620WiFiDriver_Prj\44 2009-12-03 16:19:48 GMT mtk01461
926 ** Fix the Connected Event
927 ** \main\maintrunk.MT6620WiFiDriver_Prj\43 2009-11-30 10:56:18 GMT mtk02752
928 ** 1st DW of WIFI_EVENT_T is shared with HIF_RX_HEADER_T
929 ** \main\maintrunk.MT6620WiFiDriver_Prj\42 2009-11-30 10:11:27 GMT mtk02752
930 ** implement replacement for bss scan result
931 ** \main\maintrunk.MT6620WiFiDriver_Prj\41 2009-11-27 11:08:05 GMT mtk02752
932 ** add flush for reset
933 ** \main\maintrunk.MT6620WiFiDriver_Prj\40 2009-11-26 09:38:59 GMT mtk02752
934 ** \main\maintrunk.MT6620WiFiDriver_Prj\39 2009-11-26 09:29:40 GMT mtk02752
935 ** enable packet forwarding path (for AP mode)
936 ** \main\maintrunk.MT6620WiFiDriver_Prj\38 2009-11-25 21:37:00 GMT mtk02752
937 ** sync. with EVENT_SCAN_RESULT_T change, and add an assert for checking event size
938 ** \main\maintrunk.MT6620WiFiDriver_Prj\37 2009-11-25 20:17:41 GMT mtk02752
939 ** fill HIF_TX_HEADER_T.u2SeqNo
940 ** \main\maintrunk.MT6620WiFiDriver_Prj\36 2009-11-25 18:18:57 GMT mtk02752
941 ** buffer scan result to prGlueInfo->rWlanInfo.arScanResult directly.
942 ** \main\maintrunk.MT6620WiFiDriver_Prj\35 2009-11-24 22:42:45 GMT mtk02752
943 ** add nicRxAddScanResult() to prepare to handle SCAN_RESULT event (not implemented yet)
944 ** \main\maintrunk.MT6620WiFiDriver_Prj\34 2009-11-24 20:51:41 GMT mtk02752
945 ** integrate with SD1's data path API
946 ** \main\maintrunk.MT6620WiFiDriver_Prj\33 2009-11-24 19:56:17 GMT mtk02752
947 ** adopt P_HIF_RX_HEADER_T in new path
948 ** \main\maintrunk.MT6620WiFiDriver_Prj\32 2009-11-23 20:31:21 GMT mtk02752
949 ** payload to send into pfCmdDoneHandler() will not include WIFI_EVENT_T
950 ** \main\maintrunk.MT6620WiFiDriver_Prj\31 2009-11-23 17:51:34 GMT mtk02752
951 ** when event packet corresponding to some pendingOID is received, pendingOID should be cleared
952 ** \main\maintrunk.MT6620WiFiDriver_Prj\30 2009-11-23 14:46:54 GMT mtk02752
953 ** implement nicRxProcessEventPacket()
954 ** \main\maintrunk.MT6620WiFiDriver_Prj\29 2009-11-17 22:40:54 GMT mtk01084
955 ** \main\maintrunk.MT6620WiFiDriver_Prj\28 2009-11-16 21:48:22 GMT mtk02752
956 ** add SD1_SD3_DATAPATH_INTEGRATION data path handling
957 ** \main\maintrunk.MT6620WiFiDriver_Prj\27 2009-11-16 15:41:18 GMT mtk01084
958 ** modify the length to be read in emu mode
959 ** \main\maintrunk.MT6620WiFiDriver_Prj\26 2009-11-13 17:00:12 GMT mtk02752
960 ** add blank function for event packet
961 ** \main\maintrunk.MT6620WiFiDriver_Prj\25 2009-11-13 13:54:24 GMT mtk01084
962 ** \main\maintrunk.MT6620WiFiDriver_Prj\24 2009-11-11 14:41:51 GMT mtk02752
963 ** fix typo
964 ** \main\maintrunk.MT6620WiFiDriver_Prj\23 2009-11-11 14:33:46 GMT mtk02752
965 ** add protection when there is no packet avilable
966 ** \main\maintrunk.MT6620WiFiDriver_Prj\22 2009-11-11 12:33:36 GMT mtk02752
967 ** add RX1 read path for aggregated/enhanced/normal packet read procedures
968 ** \main\maintrunk.MT6620WiFiDriver_Prj\21 2009-11-11 10:36:18 GMT mtk01084
969 ** \main\maintrunk.MT6620WiFiDriver_Prj\20 2009-11-04 14:11:08 GMT mtk01084
970 ** modify lines in RX aggregation
971 ** \main\maintrunk.MT6620WiFiDriver_Prj\19 2009-10-30 18:17:23 GMT mtk01084
972 ** modify RX aggregation handling
973 ** \main\maintrunk.MT6620WiFiDriver_Prj\18 2009-10-29 19:56:12 GMT mtk01084
974 ** modify HAL part
975 ** \main\maintrunk.MT6620WiFiDriver_Prj\17 2009-10-23 16:08:34 GMT mtk01084
976 ** \main\maintrunk.MT6620WiFiDriver_Prj\16 2009-10-13 21:59:20 GMT mtk01084
977 ** update for new HW design
978 ** \main\maintrunk.MT6620WiFiDriver_Prj\15 2009-10-02 13:59:08 GMT mtk01725
979 ** \main\maintrunk.MT6620WiFiDriver_Prj\14 2009-05-21 23:39:05 GMT mtk01461
980 ** Fix the paste error of RX STATUS in OOB of HIF Loopback CTRL
981 ** \main\maintrunk.MT6620WiFiDriver_Prj\13 2009-05-20 12:25:32 GMT mtk01461
982 ** Fix process of Read Done, and add u4MaxEventBufferLen to nicRxWaitResponse()
983 ** \main\maintrunk.MT6620WiFiDriver_Prj\12 2009-05-18 21:13:18 GMT mtk01426
984 ** Fixed compiler error
985 ** \main\maintrunk.MT6620WiFiDriver_Prj\11 2009-05-18 21:05:29 GMT mtk01426
986 ** Fixed nicRxSDIOAggReceiveRFBs() ASSERT issue
987 ** \main\maintrunk.MT6620WiFiDriver_Prj\10 2009-04-28 10:38:43 GMT mtk01461
988 ** Fix RX STATUS is DW align for SDIO_STATUS_ENHANCE mode and refine nicRxSDIOAggeceiveRFBs() for RX Aggregation
989 ** \main\maintrunk.MT6620WiFiDriver_Prj\9 2009-04-22 09:12:17 GMT mtk01461
990 ** Fix nicRxProcessHIFLoopbackPacket(), the size of HIF CTRL LENTH field is 1 byte
991 ** \main\maintrunk.MT6620WiFiDriver_Prj\8 2009-04-14 15:51:26 GMT mtk01426
992 ** Update RX OOB Setting
993 ** \main\maintrunk.MT6620WiFiDriver_Prj\7 2009-04-03 14:58:58 GMT mtk01426
994 ** Fixed logical error
995 ** \main\maintrunk.MT6620WiFiDriver_Prj\6 2009-04-01 10:58:31 GMT mtk01461
996 ** Rename the HIF_PKT_TYPE_DATA
997 ** \main\maintrunk.MT6620WiFiDriver_Prj\5 2009-03-23 21:51:18 GMT mtk01461
998 ** Fix u4HeaderOffset in nicRxProcessHIFLoopbackPacket()
999 ** \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-03-18 21:02:58 GMT mtk01426
1000 ** Add CFG_SDIO_RX_ENHANCE and CFG_HIF_LOOPBACK support
1001 ** \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-03-17 20:20:59 GMT mtk01426
1002 ** Add nicRxWaitResponse function
1003 ** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-10 20:26:01 GMT mtk01426
1004 ** Init for develop
1005 **
1006 */
1007
1008 /*******************************************************************************
1009 * C O M P I L E R F L A G S
1010 ********************************************************************************
1011 */
1012
1013 /*******************************************************************************
1014 * E X T E R N A L R E F E R E N C E S
1015 ********************************************************************************
1016 */
1017 #include "precomp.h"
1018 #include "que_mgt.h"
1019
1020 #ifndef LINUX
1021 #include <limits.h>
1022 #else
1023 #include <linux/limits.h>
1024 #endif
1025
1026
1027
1028 /*******************************************************************************
1029 * C O N S T A N T S
1030 ********************************************************************************
1031 */
1032 #define RX_RESPONSE_TIMEOUT (1000)
1033
1034 /*******************************************************************************
1035 * D A T A T Y P E S
1036 ********************************************************************************
1037 */
1038
1039 /*******************************************************************************
1040 * P U B L I C D A T A
1041 ********************************************************************************
1042 */
1043
1044 /*******************************************************************************
1045 * P R I V A T E D A T A
1046 ********************************************************************************
1047 */
1048
1049 #if CFG_MGMT_FRAME_HANDLING
1050 static PROCESS_RX_MGT_FUNCTION apfnProcessRxMgtFrame[MAX_NUM_OF_FC_SUBTYPES] = {
1051 #if CFG_SUPPORT_AAA
1052 aaaFsmRunEventRxAssoc, /* subtype 0000: Association request */
1053 #else
1054 NULL, /* subtype 0000: Association request */
1055 #endif /* CFG_SUPPORT_AAA */
1056 saaFsmRunEventRxAssoc, /* subtype 0001: Association response */
1057 #if CFG_SUPPORT_AAA
1058 aaaFsmRunEventRxAssoc, /* subtype 0010: Reassociation request */
1059 #else
1060 NULL, /* subtype 0010: Reassociation request */
1061 #endif /* CFG_SUPPORT_AAA */
1062 saaFsmRunEventRxAssoc, /* subtype 0011: Reassociation response */
1063 #if CFG_SUPPORT_ADHOC || CFG_ENABLE_WIFI_DIRECT
1064 bssProcessProbeRequest, /* subtype 0100: Probe request */
1065 #else
1066 NULL, /* subtype 0100: Probe request */
1067 #endif /* CFG_SUPPORT_ADHOC */
1068 scanProcessBeaconAndProbeResp, /* subtype 0101: Probe response */
1069 NULL, /* subtype 0110: reserved */
1070 NULL, /* subtype 0111: reserved */
1071 scanProcessBeaconAndProbeResp, /* subtype 1000: Beacon */
1072 NULL, /* subtype 1001: ATIM */
1073 saaFsmRunEventRxDisassoc, /* subtype 1010: Disassociation */
1074 authCheckRxAuthFrameTransSeq, /* subtype 1011: Authentication */
1075 saaFsmRunEventRxDeauth, /* subtype 1100: Deauthentication */
1076 nicRxProcessActionFrame, /* subtype 1101: Action */
1077 NULL, /* subtype 1110: reserved */
1078 NULL /* subtype 1111: reserved */
1079 };
1080 #endif
1081
1082
1083 /*******************************************************************************
1084 * M A C R O S
1085 ********************************************************************************
1086 */
1087
1088 /*******************************************************************************
1089 * F U N C T I O N D E C L A R A T I O N S
1090 ********************************************************************************
1091 */
1092
1093 /*******************************************************************************
1094 * F U N C T I O N S
1095 ********************************************************************************
1096 */
1097 /*----------------------------------------------------------------------------*/
1098 /*!
1099 * @brief Initialize the RFBs
1100 *
1101 * @param prAdapter Pointer to the Adapter structure.
1102 *
1103 * @return (none)
1104 */
1105 /*----------------------------------------------------------------------------*/
1106 VOID nicRxInitialize(IN P_ADAPTER_T prAdapter)
1107 {
1108 P_RX_CTRL_T prRxCtrl;
1109 PUINT_8 pucMemHandle;
1110 P_SW_RFB_T prSwRfb = (P_SW_RFB_T) NULL;
1111 UINT_32 i;
1112
1113 DEBUGFUNC("nicRxInitialize");
1114
1115 ASSERT(prAdapter);
1116 prRxCtrl = &prAdapter->rRxCtrl;
1117
1118 /* 4 <0> Clear allocated memory. */
1119 kalMemZero((PVOID) prRxCtrl->pucRxCached, prRxCtrl->u4RxCachedSize);
1120
1121 /* 4 <1> Initialize the RFB lists */
1122 QUEUE_INITIALIZE(&prRxCtrl->rFreeSwRfbList);
1123 QUEUE_INITIALIZE(&prRxCtrl->rReceivedRfbList);
1124 QUEUE_INITIALIZE(&prRxCtrl->rIndicatedRfbList);
1125
1126 pucMemHandle = prRxCtrl->pucRxCached;
1127 for (i = CFG_RX_MAX_PKT_NUM; i != 0; i--) {
1128 prSwRfb = (P_SW_RFB_T) pucMemHandle;
1129
1130 nicRxSetupRFB(prAdapter, prSwRfb);
1131 nicRxReturnRFB(prAdapter, prSwRfb);
1132
1133 pucMemHandle += ALIGN_4(sizeof(SW_RFB_T));
1134 }
1135
1136 ASSERT(prRxCtrl->rFreeSwRfbList.u4NumElem == CFG_RX_MAX_PKT_NUM);
1137 /* Check if the memory allocation consist with this initialization function */
1138 ASSERT((UINT_32) (pucMemHandle - prRxCtrl->pucRxCached) == prRxCtrl->u4RxCachedSize);
1139
1140 /* 4 <2> Clear all RX counters */
1141 RX_RESET_ALL_CNTS(prRxCtrl);
1142
1143 #if CFG_SDIO_RX_AGG
1144 prRxCtrl->pucRxCoalescingBufPtr = prAdapter->pucCoalescingBufCached;
1145 HAL_CFG_MAX_HIF_RX_LEN_NUM(prAdapter, CFG_SDIO_MAX_RX_AGG_NUM);
1146 #else
1147 HAL_CFG_MAX_HIF_RX_LEN_NUM(prAdapter, 1);
1148 #endif
1149
1150 #if CFG_HIF_STATISTICS
1151 prRxCtrl->u4TotalRxAccessNum = 0;
1152 prRxCtrl->u4TotalRxPacketNum = 0;
1153 #endif
1154
1155 #if CFG_HIF_RX_STARVATION_WARNING
1156 prRxCtrl->u4QueuedCnt = 0;
1157 prRxCtrl->u4DequeuedCnt = 0;
1158 #endif
1159
1160 return;
1161 } /* end of nicRxInitialize() */
1162
1163
1164 /*----------------------------------------------------------------------------*/
1165 /*!
1166 * @brief Uninitialize the RFBs
1167 *
1168 * @param prAdapter Pointer to the Adapter structure.
1169 *
1170 * @return (none)
1171 */
1172 /*----------------------------------------------------------------------------*/
1173 VOID nicRxUninitialize(IN P_ADAPTER_T prAdapter)
1174 {
1175 P_RX_CTRL_T prRxCtrl;
1176 P_SW_RFB_T prSwRfb = (P_SW_RFB_T) NULL;
1177 KAL_SPIN_LOCK_DECLARATION();
1178
1179 ASSERT(prAdapter);
1180 prRxCtrl = &prAdapter->rRxCtrl;
1181 ASSERT(prRxCtrl);
1182
1183 nicRxFlush(prAdapter);
1184
1185 do {
1186 KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE);
1187 QUEUE_REMOVE_HEAD(&prRxCtrl->rReceivedRfbList, prSwRfb, P_SW_RFB_T);
1188 KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE);
1189 if (prSwRfb) {
1190 if (prSwRfb->pvPacket) {
1191 kalPacketFree(prAdapter->prGlueInfo, prSwRfb->pvPacket);
1192 }
1193 prSwRfb->pvPacket = NULL;
1194 } else {
1195 break;
1196 }
1197 } while (TRUE);
1198
1199 do {
1200 KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_FREE_QUE);
1201 QUEUE_REMOVE_HEAD(&prRxCtrl->rFreeSwRfbList, prSwRfb, P_SW_RFB_T);
1202 KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_FREE_QUE);
1203 if (prSwRfb) {
1204 if (prSwRfb->pvPacket) {
1205 kalPacketFree(prAdapter->prGlueInfo, prSwRfb->pvPacket);
1206 }
1207 prSwRfb->pvPacket = NULL;
1208 } else {
1209 break;
1210 }
1211 } while (TRUE);
1212
1213 return;
1214 } /* end of nicRxUninitialize() */
1215
1216
1217 /*----------------------------------------------------------------------------*/
1218 /*!
1219 * @brief Fill RFB
1220 *
1221 * @param prAdapter pointer to the Adapter handler
1222 * @param prSWRfb specify the RFB to receive rx data
1223 *
1224 * @return (none)
1225 *
1226 */
1227 /*----------------------------------------------------------------------------*/
1228 VOID nicRxFillRFB(IN P_ADAPTER_T prAdapter, IN OUT P_SW_RFB_T prSwRfb)
1229 {
1230 P_HW_MAC_RX_DESC_T prRxStatus;
1231
1232 UINT_32 u4PktLen = 0;
1233 /* UINT_32 u4MacHeaderLen; */
1234 UINT_32 u4HeaderOffset;
1235 UINT_16 u2RxStatusOffset;
1236
1237 DEBUGFUNC("nicRxFillRFB");
1238
1239 ASSERT(prAdapter);
1240 ASSERT(prSwRfb);
1241
1242 prRxStatus = prSwRfb->prRxStatus;
1243 ASSERT(prRxStatus);
1244
1245 u4PktLen = (UINT_32) HAL_RX_STATUS_GET_RX_BYTE_CNT(prRxStatus);
1246 u4HeaderOffset = (UINT_32) (HAL_RX_STATUS_GET_HEADER_OFFSET(prRxStatus));
1247 /* u4MacHeaderLen = (UINT_32)(HAL_RX_STATUS_GET_HEADER_LEN(prRxStatus)); */
1248
1249 /* DBGLOG(RX, TRACE, ("u4HeaderOffset = %d, u4MacHeaderLen = %d\n", */
1250 /* u4HeaderOffset, u4MacHeaderLen)); */
1251 u2RxStatusOffset = sizeof(HW_MAC_RX_DESC_T);
1252 prSwRfb->ucGroupVLD = (UINT_8) HAL_RX_STATUS_GET_GROUP_VLD(prRxStatus);
1253 if (prSwRfb->ucGroupVLD & BIT(RX_GROUP_VLD_4)) {
1254 prSwRfb->prRxStatusGroup4 =
1255 (P_HW_MAC_RX_STS_GROUP_4_T) ((P_UINT_8) prRxStatus + u2RxStatusOffset);
1256 u2RxStatusOffset += sizeof(HW_MAC_RX_STS_GROUP_4_T);
1257
1258 }
1259 if (prSwRfb->ucGroupVLD & BIT(RX_GROUP_VLD_1)) {
1260 prSwRfb->prRxStatusGroup1 =
1261 (P_HW_MAC_RX_STS_GROUP_1_T) ((P_UINT_8) prRxStatus + u2RxStatusOffset);
1262 u2RxStatusOffset += sizeof(HW_MAC_RX_STS_GROUP_1_T);
1263
1264 }
1265 if (prSwRfb->ucGroupVLD & BIT(RX_GROUP_VLD_2)) {
1266 prSwRfb->prRxStatusGroup2 =
1267 (P_HW_MAC_RX_STS_GROUP_2_T) ((P_UINT_8) prRxStatus + u2RxStatusOffset);
1268 u2RxStatusOffset += sizeof(HW_MAC_RX_STS_GROUP_2_T);
1269
1270 }
1271 if (prSwRfb->ucGroupVLD & BIT(RX_GROUP_VLD_3)) {
1272 prSwRfb->prRxStatusGroup3 =
1273 (P_HW_MAC_RX_STS_GROUP_3_T) ((P_UINT_8) prRxStatus + u2RxStatusOffset);
1274 u2RxStatusOffset += sizeof(HW_MAC_RX_STS_GROUP_3_T);
1275 }
1276
1277 prSwRfb->u2RxStatusOffst = u2RxStatusOffset;
1278 prSwRfb->pvHeader = (PUINT_8) prRxStatus + u2RxStatusOffset + u4HeaderOffset;
1279 prSwRfb->u2PacketLen = (UINT_16) (u4PktLen - (u2RxStatusOffset + u4HeaderOffset));
1280 prSwRfb->ucWlanIdx = (UINT_8) HAL_RX_STATUS_GET_WLAN_IDX(prRxStatus);
1281 prSwRfb->ucStaRecIdx =
1282 secGetStaIdxByWlanIdx(prAdapter, (UINT_8) HAL_RX_STATUS_GET_WLAN_IDX(prRxStatus));
1283 prSwRfb->prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx);
1284
1285 /* DBGLOG(RX, TRACE, ("Dump Rx packet, u2PacketLen = %d\n", prSwRfb->u2PacketLen)); */
1286 /* DBGLOG_MEM8(RX, TRACE, prSwRfb->pvHeader, prSwRfb->u2PacketLen); */
1287
1288 #if 0
1289 if (prHifRxHdr->ucReorder & HIF_RX_HDR_80211_HEADER_FORMAT) {
1290 prSwRfb->u4HifRxHdrFlag |= HIF_RX_HDR_FLAG_802_11_FORMAT;
1291 DBGLOG(RX, TRACE, ("HIF_RX_HDR_FLAG_802_11_FORMAT\n"));
1292 }
1293
1294 if (prHifRxHdr->ucReorder & HIF_RX_HDR_DO_REORDER) {
1295 prSwRfb->u4HifRxHdrFlag |= HIF_RX_HDR_FLAG_DO_REORDERING;
1296 DBGLOG(RX, TRACE, ("HIF_RX_HDR_FLAG_DO_REORDERING\n"));
1297
1298 /* Get Seq. No and TID, Wlan Index info */
1299 if (prHifRxHdr->u2SeqNoTid & HIF_RX_HDR_BAR_FRAME) {
1300 prSwRfb->u4HifRxHdrFlag |= HIF_RX_HDR_FLAG_BAR_FRAME;
1301 DBGLOG(RX, TRACE, ("HIF_RX_HDR_FLAG_BAR_FRAME\n"));
1302 }
1303
1304 prSwRfb->u2SSN = prHifRxHdr->u2SeqNoTid & HIF_RX_HDR_SEQ_NO_MASK;
1305 prSwRfb->ucTid = (UINT_8) ((prHifRxHdr->u2SeqNoTid & HIF_RX_HDR_TID_MASK)
1306 >> HIF_RX_HDR_TID_OFFSET);
1307 DBGLOG(RX, TRACE, ("u2SSN = %d, ucTid = %d\n", prSwRfb->u2SSN, prSwRfb->ucTid));
1308 }
1309
1310 if (prHifRxHdr->ucReorder & HIF_RX_HDR_WDS) {
1311 prSwRfb->u4HifRxHdrFlag |= HIF_RX_HDR_FLAG_AMP_WDS;
1312 DBGLOG(RX, TRACE, ("HIF_RX_HDR_FLAG_AMP_WDS\n"));
1313 }
1314 #endif
1315 }
1316
1317
1318 #if CFG_TCP_IP_CHKSUM_OFFLOAD || CFG_TCP_IP_CHKSUM_OFFLOAD_NDIS_60
1319 /*----------------------------------------------------------------------------*/
1320 /*!
1321 * @brief Fill checksum status in RFB
1322 *
1323 * @param prAdapter pointer to the Adapter handler
1324 * @param prSWRfb the RFB to receive rx data
1325 * @param u4TcpUdpIpCksStatus specify the Checksum status
1326 *
1327 * @return (none)
1328 *
1329 */
1330 /*----------------------------------------------------------------------------*/
1331 VOID
1332 nicRxFillChksumStatus(IN P_ADAPTER_T prAdapter,
1333 IN OUT P_SW_RFB_T prSwRfb, IN UINT_32 u4TcpUdpIpCksStatus)
1334 {
1335
1336 ASSERT(prAdapter);
1337 ASSERT(prSwRfb);
1338
1339 if (prAdapter->u4CSUMFlags != CSUM_NOT_SUPPORTED) {
1340 if (u4TcpUdpIpCksStatus & RX_CS_TYPE_IPv4) { /* IPv4 packet */
1341 prSwRfb->aeCSUM[CSUM_TYPE_IPV6] = CSUM_RES_NONE;
1342 if (u4TcpUdpIpCksStatus & RX_CS_STATUS_IP) { /* IP packet csum failed */
1343 prSwRfb->aeCSUM[CSUM_TYPE_IPV4] = CSUM_RES_FAILED;
1344 } else {
1345 prSwRfb->aeCSUM[CSUM_TYPE_IPV4] = CSUM_RES_SUCCESS;
1346 }
1347
1348 if (u4TcpUdpIpCksStatus & RX_CS_TYPE_TCP) { /* TCP packet */
1349 prSwRfb->aeCSUM[CSUM_TYPE_UDP] = CSUM_RES_NONE;
1350 if (u4TcpUdpIpCksStatus & RX_CS_STATUS_TCP) { /* TCP packet csum failed */
1351 prSwRfb->aeCSUM[CSUM_TYPE_TCP] = CSUM_RES_FAILED;
1352 } else {
1353 prSwRfb->aeCSUM[CSUM_TYPE_TCP] = CSUM_RES_SUCCESS;
1354 }
1355 } else if (u4TcpUdpIpCksStatus & RX_CS_TYPE_UDP) { /* UDP packet */
1356 prSwRfb->aeCSUM[CSUM_TYPE_TCP] = CSUM_RES_NONE;
1357 if (u4TcpUdpIpCksStatus & RX_CS_STATUS_UDP) { /* UDP packet csum failed */
1358 prSwRfb->aeCSUM[CSUM_TYPE_UDP] = CSUM_RES_FAILED;
1359 } else {
1360 prSwRfb->aeCSUM[CSUM_TYPE_UDP] = CSUM_RES_SUCCESS;
1361 }
1362 } else {
1363 prSwRfb->aeCSUM[CSUM_TYPE_UDP] = CSUM_RES_NONE;
1364 prSwRfb->aeCSUM[CSUM_TYPE_TCP] = CSUM_RES_NONE;
1365 }
1366 } else if (u4TcpUdpIpCksStatus & RX_CS_TYPE_IPv6) { /* IPv6 packet */
1367 prSwRfb->aeCSUM[CSUM_TYPE_IPV4] = CSUM_RES_NONE;
1368 prSwRfb->aeCSUM[CSUM_TYPE_IPV6] = CSUM_RES_SUCCESS;
1369
1370 if (u4TcpUdpIpCksStatus & RX_CS_TYPE_TCP) { /* TCP packet */
1371 prSwRfb->aeCSUM[CSUM_TYPE_UDP] = CSUM_RES_NONE;
1372 if (u4TcpUdpIpCksStatus & RX_CS_STATUS_TCP) { /* TCP packet csum failed */
1373 prSwRfb->aeCSUM[CSUM_TYPE_TCP] = CSUM_RES_FAILED;
1374 } else {
1375 prSwRfb->aeCSUM[CSUM_TYPE_TCP] = CSUM_RES_SUCCESS;
1376 }
1377 } else if (u4TcpUdpIpCksStatus & RX_CS_TYPE_UDP) { /* UDP packet */
1378 prSwRfb->aeCSUM[CSUM_TYPE_TCP] = CSUM_RES_NONE;
1379 if (u4TcpUdpIpCksStatus & RX_CS_STATUS_UDP) { /* UDP packet csum failed */
1380 prSwRfb->aeCSUM[CSUM_TYPE_UDP] = CSUM_RES_FAILED;
1381 } else {
1382 prSwRfb->aeCSUM[CSUM_TYPE_UDP] = CSUM_RES_SUCCESS;
1383 }
1384 } else {
1385 prSwRfb->aeCSUM[CSUM_TYPE_UDP] = CSUM_RES_NONE;
1386 prSwRfb->aeCSUM[CSUM_TYPE_TCP] = CSUM_RES_NONE;
1387 }
1388 } else {
1389 prSwRfb->aeCSUM[CSUM_TYPE_IPV4] = CSUM_RES_NONE;
1390 prSwRfb->aeCSUM[CSUM_TYPE_IPV6] = CSUM_RES_NONE;
1391 }
1392 }
1393
1394 }
1395 #endif /* CFG_TCP_IP_CHKSUM_OFFLOAD */
1396
1397
1398 /*----------------------------------------------------------------------------*/
1399 /*!
1400 * \brief rxDefragMPDU() is used to defragment the incoming packets.
1401 *
1402 * \param[in] prSWRfb The RFB which is being processed.
1403 * \param[in] UINT_16 u2FrameCtrl
1404 *
1405 * \retval NOT NULL Receive the last fragment data
1406 * \retval NULL Receive the fragment packet which is not the last
1407 */
1408 /*----------------------------------------------------------------------------*/
1409 P_SW_RFB_T
1410 incRxDefragMPDU(IN P_ADAPTER_T prAdapter, IN P_SW_RFB_T prSWRfb, OUT P_QUE_T prReturnedQue)
1411 {
1412
1413 P_SW_RFB_T prOutputSwRfb = (P_SW_RFB_T) NULL;
1414 #if 1
1415 P_RX_CTRL_T prRxCtrl;
1416 P_FRAG_INFO_T prFragInfo;
1417 UINT_32 i = 0, j;
1418 UINT_16 u2SeqCtrl, u2FrameCtrl;
1419 UINT_8 ucFragNum;
1420 BOOLEAN fgFirst = FALSE;
1421 BOOLEAN fgLast = FALSE;
1422 OS_SYSTIME rCurrentTime;
1423 P_WLAN_MAC_HEADER_T prWlanHeader = NULL;
1424 P_HW_MAC_RX_DESC_T prRxStatus = NULL;
1425 P_HW_MAC_RX_STS_GROUP_4_T prRxStatusGroup4 = NULL;
1426
1427 DEBUGFUNC("nicRx: rxmDefragMPDU\n");
1428
1429 ASSERT(prSWRfb);
1430
1431 prRxCtrl = &prAdapter->rRxCtrl;
1432
1433 prRxStatus = prSWRfb->prRxStatus;
1434 ASSERT(prRxStatus);
1435
1436 if (HAL_RX_STATUS_IS_HEADER_TRAN(prRxStatus) == FALSE) {
1437 prWlanHeader = (P_WLAN_MAC_HEADER_T) prSWRfb->pvHeader;
1438 prSWRfb->u2SequenceControl = prWlanHeader->u2SeqCtrl;
1439 u2FrameCtrl = prWlanHeader->u2FrameCtrl;
1440 } else {
1441 prRxStatusGroup4 = prSWRfb->prRxStatusGroup4;
1442 prSWRfb->u2SequenceControl = HAL_RX_STATUS_GET_SEQFrag_NUM(prRxStatusGroup4);
1443 u2FrameCtrl = HAL_RX_STATUS_GET_FRAME_CTL_FIELD(prRxStatusGroup4);
1444 }
1445 u2SeqCtrl = prSWRfb->u2SequenceControl;
1446 ucFragNum = (UINT_8) (u2SeqCtrl & MASK_SC_FRAG_NUM);
1447 prSWRfb->u2FrameCtrl = u2FrameCtrl;
1448
1449 if (!(u2FrameCtrl & MASK_FC_MORE_FRAG)) {
1450 /* The last fragment frame */
1451 if (ucFragNum) {
1452 DBGLOG(RX, LOUD,
1453 ("FC %04x M %04x SQ %04x\n", u2FrameCtrl,
1454 (u2FrameCtrl & MASK_FC_MORE_FRAG), u2SeqCtrl));
1455 fgLast = TRUE;
1456 }
1457 /* Non-fragment frame */
1458 else {
1459 return prSWRfb;
1460 }
1461 }
1462 /* The fragment frame except the last one */
1463 else {
1464 if (ucFragNum == 0) {
1465 DBGLOG(RX, LOUD,
1466 ("FC %04x M %04x SQ %04x\n", u2FrameCtrl,
1467 (u2FrameCtrl & MASK_FC_MORE_FRAG), u2SeqCtrl));
1468 fgFirst = TRUE;
1469 } else {
1470 DBGLOG(RX, LOUD,
1471 ("FC %04x M %04x SQ %04x\n", u2FrameCtrl,
1472 (u2FrameCtrl & MASK_FC_MORE_FRAG), u2SeqCtrl));
1473 }
1474 }
1475
1476 GET_CURRENT_SYSTIME(&rCurrentTime);
1477
1478 for (j = 0; j < MAX_NUM_CONCURRENT_FRAGMENTED_MSDUS; j++) {
1479 prFragInfo = &prSWRfb->prStaRec->rFragInfo[j];
1480 if (prFragInfo->pr1stFrag) {
1481 /* I. If the receive timer for the MSDU or MMPDU that is stored in the
1482 * fragments queue exceeds dot11MaxReceiveLifetime, we discard the
1483 * uncompleted fragments.
1484 * II. If we didn't receive the last MPDU for a period, we use
1485 * this function for remove frames.
1486 */
1487 if (CHECK_FOR_EXPIRATION(rCurrentTime, prFragInfo->rReceiveLifetimeLimit)) {
1488
1489 /* cnmPktFree((P_PKT_INFO_T)prFragInfo->pr1stFrag, TRUE); */
1490 prFragInfo->pr1stFrag->eDst = RX_PKT_DESTINATION_NULL;
1491 QUEUE_INSERT_TAIL(prReturnedQue,
1492 (P_QUE_ENTRY_T) prFragInfo->pr1stFrag);
1493
1494 prFragInfo->pr1stFrag = (P_SW_RFB_T) NULL;
1495 }
1496 }
1497 }
1498
1499
1500 for (i = 0; i < MAX_NUM_CONCURRENT_FRAGMENTED_MSDUS; i++) {
1501
1502 prFragInfo = &prSWRfb->prStaRec->rFragInfo[i];
1503
1504 if (fgFirst) { /* looking for timed-out frag buffer */
1505
1506 if (prFragInfo->pr1stFrag == (P_SW_RFB_T) NULL) { /* find a free frag buffer */
1507 break;
1508 }
1509 } else { /* looking for a buffer with desired next seqctrl */
1510
1511 if (prFragInfo->pr1stFrag == (P_SW_RFB_T) NULL) {
1512 continue;
1513 }
1514
1515 if (RXM_IS_QOS_DATA_FRAME(u2FrameCtrl)) {
1516 if (RXM_IS_QOS_DATA_FRAME(prFragInfo->pr1stFrag->u2FrameCtrl)) {
1517 if (u2SeqCtrl == prFragInfo->u2NextFragSeqCtrl) {
1518 break;
1519 }
1520 }
1521 } else {
1522 if (!RXM_IS_QOS_DATA_FRAME(prFragInfo->pr1stFrag->u2FrameCtrl)) {
1523 if (u2SeqCtrl == prFragInfo->u2NextFragSeqCtrl) {
1524 break;
1525 }
1526 }
1527 }
1528 }
1529 }
1530
1531 if (i >= MAX_NUM_CONCURRENT_FRAGMENTED_MSDUS) {
1532
1533 /* Can't find a proper FRAG_INFO_T.
1534 * I. 1st Fragment MPDU, all of the FragInfo are exhausted
1535 * II. 2nd ~ (n-1)th Fragment MPDU, can't find the right FragInfo for defragment.
1536 * Because we won't process fragment frame outside this function, so
1537 * we should free it right away.
1538 */
1539 nicRxReturnRFB(prAdapter, prSWRfb);
1540
1541 return (P_SW_RFB_T) NULL;
1542 }
1543
1544 ASSERT(prFragInfo);
1545
1546 /* retrive Rx payload */
1547 prSWRfb->u2HeaderLen = HAL_RX_STATUS_GET_HEADER_LEN(prRxStatus);
1548 prSWRfb->pucPayload =
1549 (PUINT_8) (((ULONG)prSWRfb->pvHeader) + prSWRfb->u2HeaderLen);
1550 prSWRfb->u2PayloadLength =
1551 (UINT_16) (HAL_RX_STATUS_GET_RX_BYTE_CNT(prRxStatus) -
1552 ((ULONG) prSWRfb->pucPayload - (ULONG) prRxStatus));
1553
1554 if (fgFirst) {
1555 DBGLOG(RX, LOUD, ("rxDefragMPDU first\n"));
1556
1557 SET_EXPIRATION_TIME(prFragInfo->rReceiveLifetimeLimit,
1558 TU_TO_SYSTIME(DOT11_RECEIVE_LIFETIME_TU_DEFAULT));
1559
1560 prFragInfo->pr1stFrag = prSWRfb;
1561
1562 prFragInfo->pucNextFragStart =
1563 (PUINT_8) prSWRfb->pucRecvBuff + HAL_RX_STATUS_GET_RX_BYTE_CNT(prRxStatus);
1564
1565 prFragInfo->u2NextFragSeqCtrl = u2SeqCtrl + 1;
1566 DBGLOG(RX, LOUD, ("First: nextFragmentSeqCtrl = %04x, u2SeqCtrl = %04x\n",
1567 prFragInfo->u2NextFragSeqCtrl, u2SeqCtrl));
1568
1569 /* prSWRfb->fgFragmented = TRUE; */
1570 /* whsu: todo for checksum */
1571 } else {
1572 prFragInfo->pr1stFrag->prRxStatus->u2RxByteCount += prSWRfb->u2PayloadLength;
1573
1574 if (prFragInfo->pr1stFrag->prRxStatus->u2RxByteCount > CFG_RX_MAX_PKT_SIZE) {
1575
1576 prFragInfo->pr1stFrag->eDst = RX_PKT_DESTINATION_NULL;
1577 QUEUE_INSERT_TAIL(prReturnedQue, (P_QUE_ENTRY_T) prFragInfo->pr1stFrag);
1578
1579 prFragInfo->pr1stFrag = (P_SW_RFB_T) NULL;
1580
1581 nicRxReturnRFB(prAdapter, prSWRfb);
1582 } else {
1583 kalMemCopy(prFragInfo->pucNextFragStart,
1584 prSWRfb->pucPayload, prSWRfb->u2PayloadLength);
1585 /* [6630] update rx byte count and packet length */
1586 prFragInfo->pr1stFrag->u2PacketLen += prSWRfb->u2PayloadLength;
1587 prFragInfo->pr1stFrag->u2PayloadLength += prSWRfb->u2PayloadLength;
1588
1589 if (fgLast) { /* The last one, free the buffer */
1590 DBGLOG(RX, LOUD, ("Defrag: finished\n"));
1591
1592 prOutputSwRfb = prFragInfo->pr1stFrag;
1593
1594 prFragInfo->pr1stFrag = (P_SW_RFB_T) NULL;
1595 } else {
1596 DBGLOG(RX, LOUD, ("Defrag: mid fraged\n"));
1597
1598 prFragInfo->pucNextFragStart += prSWRfb->u2PayloadLength;
1599
1600 prFragInfo->u2NextFragSeqCtrl++;
1601 }
1602
1603 nicRxReturnRFB(prAdapter, prSWRfb);
1604 }
1605 }
1606
1607 /* DBGLOG_MEM8(RXM, INFO, */
1608 /* prFragInfo->pr1stFrag->pucPayload, */
1609 /* prFragInfo->pr1stFrag->u2PayloadLength); */
1610 #endif
1611 return prOutputSwRfb;
1612 } /* end of rxmDefragMPDU() */
1613
1614
1615 /*----------------------------------------------------------------------------*/
1616 /*!
1617 * @brief Do duplicate detection
1618 *
1619 * @param prSwRfb Pointer to the RX packet
1620 *
1621 * @return TRUE: a duplicate, FALSE: not a duplicate
1622 */
1623 /*----------------------------------------------------------------------------*/
1624 BOOLEAN nicRxIsDuplicateFrame(IN OUT P_SW_RFB_T prSwRfb)
1625 {
1626
1627 /* Non-QoS Unicast Data or Unicast MMPDU: SC Cache #4;
1628 * QoS Unicast Data: SC Cache #0~3;
1629 * Broadcast/Multicast: RetryBit == 0
1630 */
1631 UINT_32 u4SeqCtrlCacheIdx;
1632 UINT_16 u2SequenceControl, u2FrameCtrl;
1633 BOOLEAN fgIsDuplicate = FALSE, fgIsAmsduSubframe = FALSE;
1634 P_WLAN_MAC_HEADER_T prWlanHeader = NULL;
1635 P_HW_MAC_RX_DESC_T prRxStatus = NULL;
1636 P_HW_MAC_RX_STS_GROUP_4_T prRxStatusGroup4 = NULL;
1637
1638 DEBUGFUNC("nicRx: Enter rxmIsDuplicateFrame()\n");
1639
1640 ASSERT(prSwRfb);
1641
1642 /* Situations in which the STC_REC is missing include:
1643 * (1) Probe Request (2) (Re)Association Request (3) IBSS data frames (4) Probe Response
1644 */
1645 if (!prSwRfb->prStaRec) {
1646 return FALSE;
1647 }
1648
1649 prRxStatus = prSwRfb->prRxStatus;
1650 ASSERT(prRxStatus);
1651
1652 fgIsAmsduSubframe = HAL_RX_STATUS_GET_PAYLOAD_FORMAT(prRxStatus);
1653 if (HAL_RX_STATUS_IS_HEADER_TRAN(prRxStatus) == FALSE) {
1654 prWlanHeader = (P_WLAN_MAC_HEADER_T) prSwRfb->pvHeader;
1655 u2SequenceControl = prWlanHeader->u2SeqCtrl;
1656 u2FrameCtrl = prWlanHeader->u2FrameCtrl;
1657 } else {
1658 prRxStatusGroup4 = prSwRfb->prRxStatusGroup4;
1659 u2SequenceControl = HAL_RX_STATUS_GET_SEQFrag_NUM(prRxStatusGroup4);
1660 u2FrameCtrl = HAL_RX_STATUS_GET_FRAME_CTL_FIELD(prRxStatusGroup4);
1661 }
1662 prSwRfb->u2SequenceControl = u2SequenceControl;
1663
1664
1665 /* Case 1: Unicast QoS data */
1666 if (RXM_IS_QOS_DATA_FRAME(u2FrameCtrl)) { /* WLAN header shall exist when doing duplicate detection */
1667 if (prSwRfb->prStaRec->aprRxReorderParamRefTbl[prSwRfb->ucTid]) {
1668
1669 /* QoS data with an RX BA agreement
1670 * Case 1: The packet is not an AMPDU subframe, so the RetryBit may be set to 1 (TBC).
1671 * Case 2: The RX BA agreement was just established. Some enqueued packets may not be
1672 * sent with aggregation.
1673 */
1674
1675 DBGLOG(RX, LOUD, ("RX: SC=0x%X (BA Entry present)\n", u2SequenceControl));
1676
1677 /* Update the SN cache in order to ensure the correctness of duplicate removal in case the BA agreement is deleted */
1678 prSwRfb->prStaRec->au2CachedSeqCtrl[prSwRfb->ucTid] = u2SequenceControl;
1679
1680
1681 /* debug */
1682 #if 0
1683 DBGLOG(RXM, LOUD, ("RXM: SC= 0x%X (Cache[%d] updated) with BA\n",
1684 u2SequenceControl, prSwRfb->ucTID));
1685
1686 if (g_prMqm->arRxBaTable[prSwRfb->prStaRec->aucRxBaTable[prSwRfb->ucTID]].
1687 ucStatus == BA_ENTRY_STATUS_DELETING) {
1688 DBGLOG(RXM, LOUD,
1689 ("RXM: SC= 0x%X (Cache[%d] updated) with DELETING BA ****************\n",
1690 u2SequenceControl, prSwRfb->ucTID));
1691 }
1692 #endif
1693
1694 /* HW scoreboard shall take care Case 1. Let the layer layer handle Case 2. */
1695 return FALSE; /* Not a duplicate */
1696 } else {
1697
1698 if (prSwRfb->prStaRec->
1699 ucDesiredPhyTypeSet & (PHY_TYPE_BIT_HT | PHY_TYPE_BIT_VHT)) {
1700 u4SeqCtrlCacheIdx = prSwRfb->ucTid;
1701 } else {
1702 if (prSwRfb->ucTid < 8) { /* UP = 0~7 */
1703 u4SeqCtrlCacheIdx = aucTid2ACI[prSwRfb->ucTid];
1704 } else {
1705 DBGLOG(RX, WARN,
1706 ("RXM: (Warning) Unkown QoS Data with TID=%d\n",
1707 prSwRfb->ucTid));
1708
1709 return TRUE; /* Will be dropped */
1710 }
1711 }
1712
1713 }
1714 }
1715 /* Case 2: Unicast non-QoS data or MMPDUs */
1716 else {
1717 u4SeqCtrlCacheIdx = TID_NUM;
1718 }
1719
1720
1721 /* If this is a retransmission */
1722 if (u2FrameCtrl & MASK_FC_RETRY) {
1723 if (u2SequenceControl != prSwRfb->prStaRec->au2CachedSeqCtrl[u4SeqCtrlCacheIdx]) {
1724 prSwRfb->prStaRec->au2CachedSeqCtrl[u4SeqCtrlCacheIdx] = u2SequenceControl;
1725 if (fgIsAmsduSubframe == RX_PAYLOAD_FORMAT_FIRST_SUB_AMSDU) {
1726 prSwRfb->prStaRec->afgIsIgnoreAmsduDuplicate[u4SeqCtrlCacheIdx] =
1727 TRUE;
1728 }
1729 DBGLOG(RX, LOUD, ("RXM: SC= 0x%X (Cache[%lu] updated)\n",
1730 u2SequenceControl, u4SeqCtrlCacheIdx));
1731 } else {
1732 /* A duplicate. */
1733 if (prSwRfb->prStaRec->afgIsIgnoreAmsduDuplicate[u4SeqCtrlCacheIdx]) {
1734 if (fgIsAmsduSubframe == RX_PAYLOAD_FORMAT_LAST_SUB_AMSDU) {
1735 prSwRfb->prStaRec->
1736 afgIsIgnoreAmsduDuplicate[u4SeqCtrlCacheIdx] = FALSE;
1737 }
1738 } else {
1739 fgIsDuplicate = TRUE;
1740 DBGLOG(RX, LOUD, ("RXM: SC= 0x%X (Cache[%lu] duplicate)\n",
1741 u2SequenceControl, u4SeqCtrlCacheIdx));
1742 }
1743 }
1744 }
1745
1746 /* Not a retransmission */
1747 else {
1748
1749 prSwRfb->prStaRec->au2CachedSeqCtrl[u4SeqCtrlCacheIdx] = u2SequenceControl;
1750 prSwRfb->prStaRec->afgIsIgnoreAmsduDuplicate[u4SeqCtrlCacheIdx] = FALSE;
1751
1752 DBGLOG(RX, LOUD, ("RXM: SC= 0x%X (Cache[%lu] updated)\n",
1753 u2SequenceControl, u4SeqCtrlCacheIdx));
1754 }
1755
1756 return fgIsDuplicate;
1757 }
1758
1759 /*----------------------------------------------------------------------------*/
1760 /*!
1761 * @brief Process packet doesn't need to do buffer reordering
1762 *
1763 * @param prAdapter pointer to the Adapter handler
1764 * @param prSWRfb the RFB to receive rx data
1765 *
1766 * @return (none)
1767 *
1768 */
1769 /*----------------------------------------------------------------------------*/
1770 VOID nicRxProcessPktWithoutReorder(IN P_ADAPTER_T prAdapter, IN P_SW_RFB_T prSwRfb)
1771 {
1772 P_RX_CTRL_T prRxCtrl;
1773 P_TX_CTRL_T prTxCtrl;
1774 BOOL fgIsRetained = FALSE;
1775 UINT_32 u4CurrentRxBufferCount;
1776 /* P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL; */
1777 #if CFG_SUPPORT_MULTITHREAD
1778 KAL_SPIN_LOCK_DECLARATION();
1779 #endif
1780 DEBUGFUNC("nicRxProcessPktWithoutReorder");
1781 /* DBGLOG(RX, TRACE, ("\n")); */
1782
1783 ASSERT(prAdapter);
1784 ASSERT(prSwRfb);
1785
1786 prRxCtrl = &prAdapter->rRxCtrl;
1787 ASSERT(prRxCtrl);
1788
1789 prTxCtrl = &prAdapter->rTxCtrl;
1790 ASSERT(prTxCtrl);
1791
1792 u4CurrentRxBufferCount = prRxCtrl->rFreeSwRfbList.u4NumElem;
1793 /* QM USED = $A, AVAILABLE COUNT = $B, INDICATED TO OS = $C
1794 * TOTAL = $A + $B + $C
1795 *
1796 * Case #1 (Retain)
1797 * -------------------------------------------------------
1798 * $A + $B < THRESHOLD := $A + $B + $C < THRESHOLD + $C := $TOTAL - THRESHOLD < $C
1799 * => $C used too much, retain
1800 *
1801 * Case #2 (Non-Retain)
1802 * -------------------------------------------------------
1803 * $A + $B > THRESHOLD := $A + $B + $C > THRESHOLD + $C := $TOTAL - THRESHOLD > $C
1804 * => still availble for $C to use
1805 *
1806 */
1807
1808 #if defined(LINUX)
1809 fgIsRetained = FALSE;
1810 #else
1811 fgIsRetained = (((u4CurrentRxBufferCount +
1812 qmGetRxReorderQueuedBufferCount(prAdapter) +
1813 prTxCtrl->i4PendingFwdFrameCount) < CFG_RX_RETAINED_PKT_THRESHOLD) ?
1814 TRUE : FALSE);
1815 #endif
1816
1817 /* DBGLOG(RX, INFO, ("fgIsRetained = %d\n", fgIsRetained)); */
1818 #if CFG_ENABLE_PER_STA_STATISTICS
1819 if (prSwRfb->prStaRec && (prAdapter->rWifiVar.rWfdConfigureSettings.ucWfdEnable > 0)) {
1820 prSwRfb->prStaRec->u4TotalRxPktsNumber++;
1821 }
1822 #endif
1823 if (kalProcessRxPacket(prAdapter->prGlueInfo,
1824 prSwRfb->pvPacket,
1825 prSwRfb->pvHeader,
1826 (UINT_32) prSwRfb->u2PacketLen,
1827 fgIsRetained, prSwRfb->aeCSUM) != WLAN_STATUS_SUCCESS) {
1828 DBGLOG(RX, ERROR, ("kalProcessRxPacket return value != WLAN_STATUS_SUCCESS\n"));
1829 ASSERT(0);
1830
1831 nicRxReturnRFB(prAdapter, prSwRfb);
1832 return;
1833 } else {
1834 #if !CFG_SUPPORT_MULTITHREAD
1835 prRxCtrl->apvIndPacket[prRxCtrl->ucNumIndPacket] = prSwRfb->pvPacket;
1836 prRxCtrl->ucNumIndPacket++;
1837 #endif
1838 }
1839
1840 #if CFG_SUPPORT_MULTITHREAD
1841 KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_TO_OS_QUE);
1842 QUEUE_INSERT_TAIL(&(prAdapter->rRxQueue),
1843 (P_QUE_ENTRY_T) GLUE_GET_PKT_QUEUE_ENTRY(prSwRfb->pvPacket));
1844 prRxCtrl->ucNumIndPacket++;
1845 #endif
1846
1847 if (fgIsRetained) {
1848 prRxCtrl->apvRetainedPacket[prRxCtrl->ucNumRetainedPacket] = prSwRfb->pvPacket;
1849 prRxCtrl->ucNumRetainedPacket++;
1850 /* TODO : error handling of nicRxSetupRFB */
1851 nicRxSetupRFB(prAdapter, prSwRfb);
1852 nicRxReturnRFB(prAdapter, prSwRfb);
1853 } else {
1854 prSwRfb->pvPacket = NULL;
1855 nicRxReturnRFB(prAdapter, prSwRfb);
1856 }
1857
1858 #if CFG_SUPPORT_MULTITHREAD
1859 KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_TO_OS_QUE);
1860 #endif
1861 }
1862
1863
1864 /*----------------------------------------------------------------------------*/
1865 /*!
1866 * @brief Process forwarding data packet
1867 *
1868 * @param prAdapter pointer to the Adapter handler
1869 * @param prSWRfb the RFB to receive rx data
1870 *
1871 * @return (none)
1872 *
1873 */
1874 /*----------------------------------------------------------------------------*/
1875 VOID nicRxProcessForwardPkt(IN P_ADAPTER_T prAdapter, IN P_SW_RFB_T prSwRfb)
1876 {
1877 P_MSDU_INFO_T prMsduInfo, prRetMsduInfoList;
1878 P_TX_CTRL_T prTxCtrl;
1879 P_RX_CTRL_T prRxCtrl;
1880 KAL_SPIN_LOCK_DECLARATION();
1881
1882 DEBUGFUNC("nicRxProcessForwardPkt");
1883
1884 ASSERT(prAdapter);
1885 ASSERT(prSwRfb);
1886
1887 prTxCtrl = &prAdapter->rTxCtrl;
1888 prRxCtrl = &prAdapter->rRxCtrl;
1889
1890 KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_TX_MSDU_INFO_LIST);
1891 QUEUE_REMOVE_HEAD(&prTxCtrl->rFreeMsduInfoList, prMsduInfo, P_MSDU_INFO_T);
1892 KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_TX_MSDU_INFO_LIST);
1893
1894 if (prMsduInfo &&
1895 kalProcessRxPacket(prAdapter->prGlueInfo,
1896 prSwRfb->pvPacket,
1897 prSwRfb->pvHeader,
1898 (UINT_32) prSwRfb->u2PacketLen,
1899 prRxCtrl->rFreeSwRfbList.u4NumElem <
1900 CFG_RX_RETAINED_PKT_THRESHOLD ? TRUE : FALSE,
1901 prSwRfb->aeCSUM) == WLAN_STATUS_SUCCESS) {
1902
1903 prMsduInfo->eSrc = TX_PACKET_FORWARDING;
1904
1905 /* parsing forward frame */
1906 wlanProcessTxFrame(prAdapter, (P_NATIVE_PACKET) (prSwRfb->pvPacket));
1907 /* pack into MSDU_INFO_T */
1908 nicTxFillMsduInfo(prAdapter, prMsduInfo, (P_NATIVE_PACKET) (prSwRfb->pvPacket));
1909
1910 prMsduInfo->ucBssIndex = secGetBssIdxByWlanIdx(prAdapter, prSwRfb->ucWlanIdx);
1911
1912 /* release RX buffer (to rIndicatedRfbList) */
1913 prSwRfb->pvPacket = NULL;
1914 nicRxReturnRFB(prAdapter, prSwRfb);
1915
1916 /* increase forward frame counter */
1917 GLUE_INC_REF_CNT(prTxCtrl->i4PendingFwdFrameCount);
1918
1919 /* send into TX queue */
1920 KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_QM_TX_QUEUE);
1921 prRetMsduInfoList = qmEnqueueTxPackets(prAdapter, prMsduInfo);
1922 KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_QM_TX_QUEUE);
1923
1924 if (prRetMsduInfoList != NULL) { /* TX queue refuses queuing the packet */
1925 nicTxFreeMsduInfoPacket(prAdapter, prRetMsduInfoList);
1926 nicTxReturnMsduInfo(prAdapter, prRetMsduInfoList);
1927 }
1928 /* indicate service thread for sending */
1929 if (prTxCtrl->i4PendingFwdFrameCount > 0) {
1930 kalSetEvent(prAdapter->prGlueInfo);
1931 }
1932 } else { /* no TX resource */
1933 DBGLOG(QM, INFO, ("No Tx MSDU_INFO for forwarding frames\n"));
1934 nicRxReturnRFB(prAdapter, prSwRfb);
1935 }
1936
1937 return;
1938 }
1939
1940
1941 /*----------------------------------------------------------------------------*/
1942 /*!
1943 * @brief Process broadcast data packet for both host and forwarding
1944 *
1945 * @param prAdapter pointer to the Adapter handler
1946 * @param prSWRfb the RFB to receive rx data
1947 *
1948 * @return (none)
1949 *
1950 */
1951 /*----------------------------------------------------------------------------*/
1952 VOID nicRxProcessGOBroadcastPkt(IN P_ADAPTER_T prAdapter, IN P_SW_RFB_T prSwRfb)
1953 {
1954 P_SW_RFB_T prSwRfbDuplicated;
1955 P_TX_CTRL_T prTxCtrl;
1956 P_RX_CTRL_T prRxCtrl;
1957 P_HW_MAC_RX_DESC_T prRxStatus;
1958
1959 KAL_SPIN_LOCK_DECLARATION();
1960
1961 DEBUGFUNC("nicRxProcessGOBroadcastPkt");
1962
1963 ASSERT(prAdapter);
1964 ASSERT(prSwRfb);
1965
1966 prTxCtrl = &prAdapter->rTxCtrl;
1967 prRxCtrl = &prAdapter->rRxCtrl;
1968
1969 prRxStatus = prSwRfb->prRxStatus;
1970 ASSERT(prRxStatus);
1971
1972 ASSERT(CFG_NUM_OF_QM_RX_PKT_NUM >= 16);
1973
1974 if (prRxCtrl->rFreeSwRfbList.u4NumElem
1975 >= (CFG_RX_MAX_PKT_NUM - (CFG_NUM_OF_QM_RX_PKT_NUM - 16 /* Reserved for others */))) {
1976
1977 /* 1. Duplicate SW_RFB_T */
1978 KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_FREE_QUE);
1979 QUEUE_REMOVE_HEAD(&prRxCtrl->rFreeSwRfbList, prSwRfbDuplicated, P_SW_RFB_T);
1980 KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_FREE_QUE);
1981
1982 if (prSwRfbDuplicated) {
1983 kalMemCopy(prSwRfbDuplicated->pucRecvBuff,
1984 prSwRfb->pucRecvBuff,
1985 ALIGN_4(prRxStatus->u2RxByteCount + HIF_RX_HW_APPENDED_LEN));
1986
1987 prSwRfbDuplicated->ucPacketType = RX_PKT_TYPE_RX_DATA;
1988 prSwRfbDuplicated->ucStaRecIdx = prSwRfb->ucStaRecIdx;
1989 nicRxFillRFB(prAdapter, prSwRfbDuplicated);
1990
1991 /* 2. Modify eDst */
1992 prSwRfbDuplicated->eDst = RX_PKT_DESTINATION_FORWARD;
1993
1994 /* 4. Forward */
1995 nicRxProcessForwardPkt(prAdapter, prSwRfbDuplicated);
1996 }
1997 } else {
1998 DBGLOG(RX, WARN,
1999 ("Stop to forward BMC packet due to less free Sw Rfb %lu\n",
2000 prRxCtrl->rFreeSwRfbList.u4NumElem));
2001 }
2002
2003 /* 3. Indicate to host */
2004 prSwRfb->eDst = RX_PKT_DESTINATION_HOST;
2005 nicRxProcessPktWithoutReorder(prAdapter, prSwRfb);
2006
2007 return;
2008 }
2009
2010
2011 /*----------------------------------------------------------------------------*/
2012 /*!
2013 * @brief Process HIF data packet
2014 *
2015 * @param prAdapter pointer to the Adapter handler
2016 * @param prSWRfb the RFB to receive rx data
2017 *
2018 * @return (none)
2019 *
2020 */
2021 /*----------------------------------------------------------------------------*/
2022 VOID nicRxProcessDataPacket(IN P_ADAPTER_T prAdapter, IN OUT P_SW_RFB_T prSwRfb)
2023 {
2024 P_RX_CTRL_T prRxCtrl;
2025 P_SW_RFB_T prRetSwRfb, prNextSwRfb;
2026 P_HW_MAC_RX_DESC_T prRxStatus;
2027 BOOLEAN fgDrop;
2028
2029 DEBUGFUNC("nicRxProcessDataPacket");
2030 /* DBGLOG(INIT, TRACE, ("\n")); */
2031
2032 ASSERT(prAdapter);
2033 ASSERT(prSwRfb);
2034
2035 fgDrop = FALSE;
2036
2037 prRxStatus = prSwRfb->prRxStatus;
2038 prRxCtrl = &prAdapter->rRxCtrl;
2039
2040 /* Check AMPDU_nERR_Bitmap */
2041 prSwRfb->fgDataFrame = TRUE;
2042 prSwRfb->fgFragFrame = FALSE;
2043 prSwRfb->fgReorderBuffer = FALSE;
2044
2045 /* ToDo: Add comments by WH.Su */
2046 if (HAL_RX_STATUS_IS_CIPHER_MISMATCH(prRxStatus)) {
2047 /* DBGLOG(RX, TRACE, ("Not the CM bit\n")); */
2048 prRxStatus->u2StatusFlag =
2049 prRxStatus->u2StatusFlag & !RX_STATUS_FLAG_CIPHER_MISMATCH;
2050 }
2051 /* BA session */
2052 if (prRxStatus->u2StatusFlag == RXS_DW2_AMPDU_nERR_VALUE) {
2053 prSwRfb->fgReorderBuffer = TRUE;
2054 }
2055 /* non BA session */
2056 else if ((prRxStatus->u2StatusFlag & RXS_DW2_RX_nERR_BITMAP) == RXS_DW2_RX_nERR_VALUE) {
2057 if ((prRxStatus->u2StatusFlag & RXS_DW2_RX_nDATA_BITMAP) == RXS_DW2_RX_nDATA_VALUE) {
2058 prSwRfb->fgDataFrame = FALSE;
2059 }
2060 if ((prRxStatus->u2StatusFlag & RXS_DW2_RX_FRAG_BITMAP) == RXS_DW2_RX_FRAG_VALUE) {
2061 prSwRfb->fgFragFrame = TRUE;
2062 }
2063 } else {
2064 fgDrop = TRUE;
2065 if (!HAL_RX_STATUS_IS_ICV_ERROR(prRxStatus)
2066 && HAL_RX_STATUS_IS_TKIP_MIC_ERROR(prRxStatus)) {
2067 P_STA_RECORD_T prStaRec;
2068
2069 prStaRec = cnmGetStaRecByAddress(prAdapter,
2070 prAdapter->prAisBssInfo->ucBssIndex,
2071 prAdapter->rWlanInfo.rCurrBssId.
2072 arMacAddress);
2073 if (prStaRec) {
2074 DBGLOG(RSN, EVENT, ("MIC_ERR_PKT\n"));
2075 rsnTkipHandleMICFailure(prAdapter, prStaRec, 0);
2076 }
2077 } else if (HAL_RX_STATUS_IS_LLC_MIS(prRxStatus)) {
2078 DBGLOG(RSN, EVENT, ("LLC_MIS_ERR\n"));
2079 fgDrop = FALSE; /* Drop after send de-auth */
2080 }
2081 }
2082
2083 #if 0 /* Check 1x Pkt */
2084 if (prSwRfb->u2PacketLen > 14) {
2085 PUINT_8 pc = (PUINT_8) prSwRfb->pvHeader;
2086 UINT_16 u2Etype = 0;
2087
2088 u2Etype = (pc[ETHER_TYPE_LEN_OFFSET] << 8) | (pc[ETHER_TYPE_LEN_OFFSET + 1]);
2089
2090 #if CFG_SUPPORT_WAPI
2091 if (u2Etype == ETH_P_1X || u2Etype == ETH_WPI_1X) {
2092 DBGLOG(RSN, INFO, ("R1X len=%d\n", prSwRfb->u2PacketLen));
2093 }
2094 #else
2095 if (u2Etype == ETH_P_1X) {
2096 DBGLOG(RSN, INFO, ("R1X len=%d\n", prSwRfb->u2PacketLen));
2097 }
2098 #endif
2099 else if (u2Etype == ETH_P_PRE_1X) {
2100 DBGLOG(RSN, INFO, ("Pre R1X len=%d\n", prSwRfb->u2PacketLen));
2101 }
2102 }
2103 #endif
2104
2105 #if CFG_TCP_IP_CHKSUM_OFFLOAD || CFG_TCP_IP_CHKSUM_OFFLOAD_NDIS_60
2106 if (fgDrop == FALSE) {
2107 UINT_32 u4TcpUdpIpCksStatus;
2108 PUINT_32 pu4Temp;
2109 pu4Temp = (PUINT_32)prRxStatus;
2110 u4TcpUdpIpCksStatus = *(pu4Temp+(ALIGN_4(prRxStatus->u2RxByteCount)>>2));
2111 nicRxFillChksumStatus(prAdapter, prSwRfb, u4TcpUdpIpCksStatus);
2112 }
2113 #endif /* CFG_TCP_IP_CHKSUM_OFFLOAD */
2114
2115 /* if(secCheckClassError(prAdapter, prSwRfb, prStaRec) == TRUE && */
2116 if (prAdapter->fgTestMode == FALSE && fgDrop == FALSE) {
2117 #if CFG_HIF_RX_STARVATION_WARNING
2118 prRxCtrl->u4QueuedCnt++;
2119 #endif
2120 nicRxFillRFB(prAdapter, prSwRfb);
2121 GLUE_SET_PKT_BSS_IDX(prSwRfb->pvPacket,
2122 secGetBssIdxByWlanIdx(prAdapter, prSwRfb->ucWlanIdx));
2123
2124 prRetSwRfb = qmHandleRxPackets(prAdapter, prSwRfb);
2125 if (prRetSwRfb != NULL) {
2126 do {
2127 /* save next first */
2128 prNextSwRfb =
2129 (P_SW_RFB_T) QUEUE_GET_NEXT_ENTRY((P_QUE_ENTRY_T) prRetSwRfb);
2130
2131 switch (prRetSwRfb->eDst) {
2132 case RX_PKT_DESTINATION_HOST:
2133 nicRxProcessPktWithoutReorder(prAdapter, prRetSwRfb);
2134 break;
2135
2136 case RX_PKT_DESTINATION_FORWARD:
2137 nicRxProcessForwardPkt(prAdapter, prRetSwRfb);
2138 break;
2139
2140 case RX_PKT_DESTINATION_HOST_WITH_FORWARD:
2141 nicRxProcessGOBroadcastPkt(prAdapter, prRetSwRfb);
2142 break;
2143
2144 case RX_PKT_DESTINATION_NULL:
2145 nicRxReturnRFB(prAdapter, prRetSwRfb);
2146 RX_INC_CNT(prRxCtrl, RX_DST_NULL_DROP_COUNT);
2147 RX_INC_CNT(prRxCtrl, RX_DROP_TOTAL_COUNT);
2148 break;
2149
2150 default:
2151 break;
2152 }
2153 #if CFG_HIF_RX_STARVATION_WARNING
2154 prRxCtrl->u4DequeuedCnt++;
2155 #endif
2156 prRetSwRfb = prNextSwRfb;
2157 } while (prRetSwRfb);
2158 }
2159 } else {
2160 nicRxReturnRFB(prAdapter, prSwRfb);
2161 RX_INC_CNT(prRxCtrl, RX_CLASS_ERR_DROP_COUNT);
2162 RX_INC_CNT(prRxCtrl, RX_DROP_TOTAL_COUNT);
2163 }
2164 }
2165
2166
2167 /*----------------------------------------------------------------------------*/
2168 /*!
2169 * @brief Process HIF event packet
2170 *
2171 * @param prAdapter pointer to the Adapter handler
2172 * @param prSWRfb the RFB to receive rx data
2173 *
2174 * @return (none)
2175 *
2176 */
2177 /*----------------------------------------------------------------------------*/
2178 VOID nicRxProcessEventPacket(IN P_ADAPTER_T prAdapter, IN OUT P_SW_RFB_T prSwRfb)
2179 {
2180 P_CMD_INFO_T prCmdInfo;
2181 P_MSDU_INFO_T prMsduInfo;
2182 P_WIFI_EVENT_T prEvent;
2183 P_GLUE_INFO_T prGlueInfo;
2184
2185 DEBUGFUNC("nicRxProcessEventPacket");
2186 /* DBGLOG(INIT, TRACE, ("\n")); */
2187
2188 ASSERT(prAdapter);
2189 ASSERT(prSwRfb);
2190
2191 prEvent = (P_WIFI_EVENT_T) prSwRfb->pucRecvBuff;
2192 prGlueInfo = prAdapter->prGlueInfo;
2193
2194 DBGLOG(INIT, INFO, ("RX EVENT: ID[0x%02X] SEQ[%u] LEN[%u]\n",
2195 prEvent->ucEID, prEvent->ucSeqNum, prEvent->u2PacketLength));
2196
2197 /* Event Handling */
2198 switch (prEvent->ucEID) {
2199 #if 0 /* It is removed now */
2200 case EVENT_ID_CMD_RESULT:
2201 prCmdInfo = nicGetPendingCmdInfo(prAdapter, prEvent->ucSeqNum);
2202
2203 if (prCmdInfo != NULL) {
2204 P_EVENT_CMD_RESULT prCmdResult;
2205 prCmdResult = (P_EVENT_CMD_RESULT) ((PUINT_8) prEvent + EVENT_HDR_SIZE);
2206
2207 /* CMD_RESULT should be only in response to Set commands */
2208 ASSERT(prCmdInfo->fgSetQuery == FALSE || prCmdInfo->fgNeedResp == TRUE);
2209
2210 if (prCmdResult->ucStatus == 0) { /* success */
2211 if (prCmdInfo->pfCmdDoneHandler) {
2212 prCmdInfo->pfCmdDoneHandler(prAdapter, prCmdInfo,
2213 prEvent->aucBuffer);
2214 } else if (prCmdInfo->fgIsOid == TRUE) {
2215 kalOidComplete(prAdapter->prGlueInfo, prCmdInfo->fgSetQuery,
2216 0, WLAN_STATUS_SUCCESS);
2217 }
2218 } else if (prCmdResult->ucStatus == 1) { /* reject */
2219 if (prCmdInfo->fgIsOid == TRUE)
2220 kalOidComplete(prAdapter->prGlueInfo, prCmdInfo->fgSetQuery,
2221 0, WLAN_STATUS_FAILURE);
2222 } else if (prCmdResult->ucStatus == 2) { /* unknown CMD */
2223 if (prCmdInfo->fgIsOid == TRUE)
2224 kalOidComplete(prAdapter->prGlueInfo, prCmdInfo->fgSetQuery,
2225 0, WLAN_STATUS_NOT_SUPPORTED);
2226 }
2227 /* return prCmdInfo */
2228 cmdBufFreeCmdInfo(prAdapter, prCmdInfo);
2229 }
2230
2231 break;
2232 #endif
2233
2234 #if 0
2235 case EVENT_ID_CONNECTION_STATUS:
2236 /* OBSELETE */
2237 {
2238 P_EVENT_CONNECTION_STATUS prConnectionStatus;
2239 prConnectionStatus = (P_EVENT_CONNECTION_STATUS) (prEvent->aucBuffer);
2240
2241 DbgPrint("RX EVENT: EVENT_ID_CONNECTION_STATUS = %d\n",
2242 prConnectionStatus->ucMediaStatus);
2243 if (prConnectionStatus->ucMediaStatus == PARAM_MEDIA_STATE_DISCONNECTED) { /* disconnected */
2244 if (kalGetMediaStateIndicated(prGlueInfo) !=
2245 PARAM_MEDIA_STATE_DISCONNECTED) {
2246
2247 kalIndicateStatusAndComplete(prGlueInfo,
2248 WLAN_STATUS_MEDIA_DISCONNECT,
2249 NULL, 0);
2250
2251 prAdapter->rWlanInfo.u4SysTime = kalGetTimeTick();
2252 }
2253 } else if (prConnectionStatus->ucMediaStatus == PARAM_MEDIA_STATE_CONNECTED) { /* connected */
2254 prAdapter->rWlanInfo.u4SysTime = kalGetTimeTick();
2255
2256 /* fill information for association result */
2257 prAdapter->rWlanInfo.rCurrBssId.rSsid.u4SsidLen
2258 = prConnectionStatus->ucSsidLen;
2259 kalMemCopy(prAdapter->rWlanInfo.rCurrBssId.rSsid.aucSsid,
2260 prConnectionStatus->aucSsid,
2261 prConnectionStatus->ucSsidLen);
2262
2263 kalMemCopy(prAdapter->rWlanInfo.rCurrBssId.arMacAddress,
2264 prConnectionStatus->aucBssid, MAC_ADDR_LEN);
2265
2266 prAdapter->rWlanInfo.rCurrBssId.u4Privacy = prConnectionStatus->ucEncryptStatus; /* @FIXME */
2267 prAdapter->rWlanInfo.rCurrBssId.rRssi = 0; /* @FIXME */
2268 prAdapter->rWlanInfo.rCurrBssId.eNetworkTypeInUse = PARAM_NETWORK_TYPE_AUTOMODE; /* @FIXME */
2269 prAdapter->rWlanInfo.rCurrBssId.rConfiguration.u4BeaconPeriod
2270 = prConnectionStatus->u2BeaconPeriod;
2271 prAdapter->rWlanInfo.rCurrBssId.rConfiguration.u4ATIMWindow
2272 = prConnectionStatus->u2ATIMWindow;
2273 prAdapter->rWlanInfo.rCurrBssId.rConfiguration.u4DSConfig
2274 = prConnectionStatus->u4FreqInKHz;
2275 prAdapter->rWlanInfo.ucNetworkType
2276 = prConnectionStatus->ucNetworkType;
2277
2278 switch (prConnectionStatus->ucInfraMode) {
2279 case 0:
2280 prAdapter->rWlanInfo.rCurrBssId.eOpMode = NET_TYPE_IBSS;
2281 break;
2282 case 1:
2283 prAdapter->rWlanInfo.rCurrBssId.eOpMode = NET_TYPE_INFRA;
2284 break;
2285 case 2:
2286 default:
2287 prAdapter->rWlanInfo.rCurrBssId.eOpMode =
2288 NET_TYPE_AUTO_SWITCH;
2289 break;
2290 }
2291 /* always indicate to OS according to MSDN (re-association/roaming) */
2292 kalIndicateStatusAndComplete(prGlueInfo,
2293 WLAN_STATUS_MEDIA_CONNECT, NULL, 0);
2294 }
2295 }
2296 break;
2297
2298 case EVENT_ID_SCAN_RESULT:
2299 /* OBSELETE */
2300 break;
2301 #endif
2302
2303 case EVENT_ID_RX_ADDBA:
2304 /* The FW indicates that an RX BA agreement will be established */
2305 qmHandleEventRxAddBa(prAdapter, prEvent);
2306 break;
2307
2308 case EVENT_ID_RX_DELBA:
2309 /* The FW indicates that an RX BA agreement has been deleted */
2310 qmHandleEventRxDelBa(prAdapter, prEvent);
2311 break;
2312
2313 case EVENT_ID_CHECK_REORDER_BUBBLE:
2314 qmHandleEventCheckReorderBubble(prAdapter, prEvent);
2315 break;
2316
2317 case EVENT_ID_LINK_QUALITY:
2318 #if CFG_ENABLE_WIFI_DIRECT && CFG_SUPPORT_P2P_RSSI_QUERY
2319 if (prEvent->u2PacketLen == EVENT_HDR_SIZE + sizeof(EVENT_LINK_QUALITY_EX)) {
2320 P_EVENT_LINK_QUALITY_EX prLqEx =
2321 (P_EVENT_LINK_QUALITY_EX) (prEvent->aucBuffer);
2322
2323 if (prLqEx->ucIsLQ0Rdy) {
2324 nicUpdateLinkQuality(prAdapter, 0, (P_EVENT_LINK_QUALITY) prLqEx);
2325 }
2326 if (prLqEx->ucIsLQ1Rdy) {
2327 nicUpdateLinkQuality(prAdapter, 1, (P_EVENT_LINK_QUALITY) prLqEx);
2328 }
2329 } else {
2330 /* For old FW, P2P may invoke link quality query, and make driver flag becone TRUE. */
2331 DBGLOG(P2P, WARN, ("Old FW version, not support P2P RSSI query.\n"));
2332
2333 /* Must not use NETWORK_TYPE_P2P_INDEX, cause the structure is mismatch. */
2334 nicUpdateLinkQuality(prAdapter, 0,
2335 (P_EVENT_LINK_QUALITY) (prEvent->aucBuffer));
2336 }
2337 #else
2338 /*only support ais query */
2339 {
2340 UINT_8 ucBssIndex;
2341 P_BSS_INFO_T prBssInfo;
2342 for (ucBssIndex = 0; ucBssIndex < BSS_INFO_NUM; ucBssIndex++) {
2343 prBssInfo = prAdapter->aprBssInfo[ucBssIndex];
2344
2345 if ((prBssInfo->eNetworkType == NETWORK_TYPE_AIS)
2346 && (prBssInfo->fgIsInUse))
2347 break;
2348 }
2349
2350 if (ucBssIndex >= BSS_INFO_NUM) {
2351 ucBssIndex = 1; /* No hit(bss1 for default ais network) */
2352 }
2353 /* printk("=======> rssi with bss%d ,%d\n",ucBssIndex,((P_EVENT_LINK_QUALITY_V2)(prEvent->aucBuffer))->rLq[ucBssIndex].cRssi); */
2354 nicUpdateLinkQuality(prAdapter, ucBssIndex,
2355 (P_EVENT_LINK_QUALITY_V2) (prEvent->aucBuffer));
2356 }
2357
2358 #endif
2359
2360 /* command response handling */
2361 prCmdInfo = nicGetPendingCmdInfo(prAdapter, prEvent->ucSeqNum);
2362
2363 if (prCmdInfo != NULL) {
2364 if (prCmdInfo->pfCmdDoneHandler) {
2365 prCmdInfo->pfCmdDoneHandler(prAdapter, prCmdInfo,
2366 prEvent->aucBuffer);
2367 } else if (prCmdInfo->fgIsOid) {
2368 kalOidComplete(prAdapter->prGlueInfo, prCmdInfo->fgSetQuery, 0,
2369 WLAN_STATUS_SUCCESS);
2370 }
2371 /* return prCmdInfo */
2372 cmdBufFreeCmdInfo(prAdapter, prCmdInfo);
2373 }
2374 #ifndef LINUX
2375 if (prAdapter->rWlanInfo.eRssiTriggerType == ENUM_RSSI_TRIGGER_GREATER &&
2376 prAdapter->rWlanInfo.rRssiTriggerValue >=
2377 (PARAM_RSSI) (prAdapter->rLinkQuality.cRssi)) {
2378 prAdapter->rWlanInfo.eRssiTriggerType = ENUM_RSSI_TRIGGER_TRIGGERED;
2379
2380 kalIndicateStatusAndComplete(prGlueInfo,
2381 WLAN_STATUS_MEDIA_SPECIFIC_INDICATION,
2382 (PVOID) & (prAdapter->rWlanInfo.
2383 rRssiTriggerValue),
2384 sizeof(PARAM_RSSI));
2385 } else if (prAdapter->rWlanInfo.eRssiTriggerType == ENUM_RSSI_TRIGGER_LESS
2386 && prAdapter->rWlanInfo.rRssiTriggerValue <=
2387 (PARAM_RSSI) (prAdapter->rLinkQuality.cRssi)) {
2388 prAdapter->rWlanInfo.eRssiTriggerType = ENUM_RSSI_TRIGGER_TRIGGERED;
2389
2390 kalIndicateStatusAndComplete(prGlueInfo,
2391 WLAN_STATUS_MEDIA_SPECIFIC_INDICATION,
2392 (PVOID) & (prAdapter->rWlanInfo.
2393 rRssiTriggerValue),
2394 sizeof(PARAM_RSSI));
2395 }
2396 #endif
2397
2398 break;
2399
2400 case EVENT_ID_MIC_ERR_INFO:
2401 {
2402 P_EVENT_MIC_ERR_INFO prMicError;
2403 /* P_PARAM_AUTH_EVENT_T prAuthEvent; */
2404 P_STA_RECORD_T prStaRec;
2405
2406 DBGLOG(RSN, EVENT, ("EVENT_ID_MIC_ERR_INFO\n"));
2407
2408 prMicError = (P_EVENT_MIC_ERR_INFO) (prEvent->aucBuffer);
2409 prStaRec = cnmGetStaRecByAddress(prAdapter,
2410 prAdapter->prAisBssInfo->ucBssIndex,
2411 prAdapter->rWlanInfo.rCurrBssId.
2412 arMacAddress);
2413 ASSERT(prStaRec);
2414
2415 if (prStaRec) {
2416 rsnTkipHandleMICFailure(prAdapter, prStaRec,
2417 (BOOLEAN) prMicError->u4Flags);
2418 } else {
2419 DBGLOG(RSN, INFO, ("No STA rec!!\n"));
2420 }
2421 #if 0
2422 prAuthEvent = (P_PARAM_AUTH_EVENT_T) prAdapter->aucIndicationEventBuffer;
2423
2424 /* Status type: Authentication Event */
2425 prAuthEvent->rStatus.eStatusType = ENUM_STATUS_TYPE_AUTHENTICATION;
2426
2427 /* Authentication request */
2428 prAuthEvent->arRequest[0].u4Length = sizeof(PARAM_AUTH_REQUEST_T);
2429 kalMemCopy((PVOID) prAuthEvent->arRequest[0].arBssid, (PVOID) prAdapter->rWlanInfo.rCurrBssId.arMacAddress, /* whsu:Todo? */
2430 PARAM_MAC_ADDR_LEN);
2431
2432 if (prMicError->u4Flags != 0) {
2433 prAuthEvent->arRequest[0].u4Flags = PARAM_AUTH_REQUEST_GROUP_ERROR;
2434 } else {
2435 prAuthEvent->arRequest[0].u4Flags =
2436 PARAM_AUTH_REQUEST_PAIRWISE_ERROR;
2437 }
2438
2439 kalIndicateStatusAndComplete(prAdapter->prGlueInfo,
2440 WLAN_STATUS_MEDIA_SPECIFIC_INDICATION,
2441 (PVOID) prAuthEvent,
2442 sizeof(PARAM_STATUS_INDICATION_T) +
2443 sizeof(PARAM_AUTH_REQUEST_T));
2444 #endif
2445 }
2446 break;
2447
2448 #if 0 /* Marked for MT6630 */
2449 case EVENT_ID_ASSOC_INFO:
2450 {
2451 P_EVENT_ASSOC_INFO prAssocInfo;
2452 prAssocInfo = (P_EVENT_ASSOC_INFO) (prEvent->aucBuffer);
2453
2454 kalHandleAssocInfo(prAdapter->prGlueInfo, prAssocInfo);
2455 }
2456 break;
2457
2458 case EVENT_ID_802_11_PMKID:
2459 {
2460 P_PARAM_AUTH_EVENT_T prAuthEvent;
2461 PUINT_8 cp;
2462 UINT_32 u4LenOfUsedBuffer;
2463
2464 prAuthEvent = (P_PARAM_AUTH_EVENT_T) prAdapter->aucIndicationEventBuffer;
2465
2466 prAuthEvent->rStatus.eStatusType = ENUM_STATUS_TYPE_CANDIDATE_LIST;
2467
2468 u4LenOfUsedBuffer = (UINT_32) (prEvent->u2PacketLength - 8);
2469
2470 prAuthEvent->arRequest[0].u4Length = u4LenOfUsedBuffer;
2471
2472 cp = (PUINT_8) &prAuthEvent->arRequest[0];
2473
2474 /* Status type: PMKID Candidatelist Event */
2475 kalMemCopy(cp, (P_EVENT_PMKID_CANDIDATE_LIST_T) (prEvent->aucBuffer),
2476 prEvent->u2PacketLength - 8);
2477
2478 kalIndicateStatusAndComplete(prAdapter->prGlueInfo,
2479 WLAN_STATUS_MEDIA_SPECIFIC_INDICATION,
2480 (PVOID) prAuthEvent,
2481 sizeof(PARAM_STATUS_INDICATION_T) +
2482 u4LenOfUsedBuffer);
2483 }
2484 break;
2485 #endif
2486
2487 #if 0
2488 case EVENT_ID_ACTIVATE_STA_REC_T:
2489 {
2490 P_EVENT_ACTIVATE_STA_REC_T prActivateStaRec;
2491 prActivateStaRec = (P_EVENT_ACTIVATE_STA_REC_T) (prEvent->aucBuffer);
2492
2493 DbgPrint("RX EVENT: EVENT_ID_ACTIVATE_STA_REC_T Index:%d, MAC:[" MACSTR
2494 "]\n", prActivateStaRec->ucStaRecIdx,
2495 MAC2STR(prActivateStaRec->aucMacAddr));
2496
2497 qmActivateStaRec(prAdapter,
2498 (UINT_32) prActivateStaRec->ucStaRecIdx,
2499 ((prActivateStaRec->fgIsQoS) ? TRUE : FALSE),
2500 prActivateStaRec->ucNetworkTypeIndex,
2501 ((prActivateStaRec->fgIsAP) ? TRUE : FALSE),
2502 prActivateStaRec->aucMacAddr);
2503
2504 }
2505 break;
2506
2507 case EVENT_ID_DEACTIVATE_STA_REC_T:
2508 {
2509 P_EVENT_DEACTIVATE_STA_REC_T prDeactivateStaRec;
2510 prDeactivateStaRec = (P_EVENT_DEACTIVATE_STA_REC_T) (prEvent->aucBuffer);
2511
2512 DbgPrint("RX EVENT: EVENT_ID_DEACTIVATE_STA_REC_T Index:%d, MAC:[" MACSTR
2513 "]\n", prDeactivateStaRec->ucStaRecIdx);
2514
2515 qmDeactivateStaRec(prAdapter, prDeactivateStaRec->ucStaRecIdx);
2516 }
2517 break;
2518 #endif
2519
2520 case EVENT_ID_SCAN_DONE:
2521 scnEventScanDone(prAdapter, (P_EVENT_SCAN_DONE) (prEvent->aucBuffer));
2522 break;
2523
2524 case EVENT_ID_NLO_DONE:
2525 scnEventNloDone(prAdapter, (P_EVENT_NLO_DONE_T) (prEvent->aucBuffer));
2526 break;
2527
2528 case EVENT_ID_TX_DONE:
2529 {
2530 P_EVENT_TX_DONE_T prTxDone;
2531 prTxDone = (P_EVENT_TX_DONE_T) (prEvent->aucBuffer);
2532
2533 DBGLOG(INIT, INFO,("EVENT_ID_TX_DONE WIDX:PID[%u:%u] Status[%u] SN[%u]\n",
2534 prTxDone->ucWlanIndex, prTxDone->ucPacketSeq, prTxDone->ucStatus, prTxDone->u2SequenceNumber));
2535
2536 /* call related TX Done Handler */
2537 prMsduInfo =
2538 nicGetPendingTxMsduInfo(prAdapter, prTxDone->ucWlanIndex,
2539 prTxDone->ucPacketSeq);
2540
2541 #if CFG_SUPPORT_802_11V_TIMING_MEASUREMENT
2542 DBGLOG(INIT, TRACE, ("EVENT_ID_TX_DONE u4TimeStamp = %x u2AirDelay = %x\n",
2543 prTxDone->au4Reserved1, prTxDone->au4Reserved2));
2544
2545 wnmReportTimingMeas(prAdapter, prMsduInfo->ucStaRecIndex,
2546 prTxDone->au4Reserved1,
2547 prTxDone->au4Reserved1 + prTxDone->au4Reserved2);
2548 #endif
2549
2550 if (prMsduInfo) {
2551 prMsduInfo->pfTxDoneHandler(prAdapter, prMsduInfo,
2552 (ENUM_TX_RESULT_CODE_T) (prTxDone->
2553 ucStatus));
2554
2555 cnmMgtPktFree(prAdapter, prMsduInfo);
2556 }
2557 }
2558 break;
2559
2560 case EVENT_ID_SLEEPY_INFO:
2561 {
2562 P_EVENT_SLEEPY_INFO_T prEventSleepyNotify;
2563 prEventSleepyNotify = (P_EVENT_SLEEPY_INFO_T) (prEvent->aucBuffer);
2564
2565 /* DBGLOG(RX, INFO, ("ucSleepyState = %d\n", prEventSleepyNotify->ucSleepyState)); */
2566
2567 prAdapter->fgWiFiInSleepyState =
2568 (BOOLEAN) (prEventSleepyNotify->ucSleepyState);
2569
2570 #if CFG_SUPPORT_MULTITHREAD
2571 if (prEventSleepyNotify->ucSleepyState) {
2572 kalSetFwOwnEvent2Hif(prGlueInfo);
2573 }
2574 #endif
2575 }
2576 break;
2577 case EVENT_ID_BT_OVER_WIFI:
2578 #if CFG_ENABLE_BT_OVER_WIFI
2579 {
2580 UINT_8 aucTmp[sizeof(AMPC_EVENT) + sizeof(BOW_LINK_DISCONNECTED)];
2581 P_EVENT_BT_OVER_WIFI prEventBtOverWifi;
2582 P_AMPC_EVENT prBowEvent;
2583 P_BOW_LINK_CONNECTED prBowLinkConnected;
2584 P_BOW_LINK_DISCONNECTED prBowLinkDisconnected;
2585
2586 prEventBtOverWifi = (P_EVENT_BT_OVER_WIFI) (prEvent->aucBuffer);
2587
2588 /* construct event header */
2589 prBowEvent = (P_AMPC_EVENT) aucTmp;
2590
2591 if (prEventBtOverWifi->ucLinkStatus == 0) {
2592 /* Connection */
2593 prBowEvent->rHeader.ucEventId = BOW_EVENT_ID_LINK_CONNECTED;
2594 prBowEvent->rHeader.ucSeqNumber = 0;
2595 prBowEvent->rHeader.u2PayloadLength = sizeof(BOW_LINK_CONNECTED);
2596
2597 /* fill event body */
2598 prBowLinkConnected =
2599 (P_BOW_LINK_CONNECTED) (prBowEvent->aucPayload);
2600 prBowLinkConnected->rChannel.ucChannelNum =
2601 prEventBtOverWifi->ucSelectedChannel;
2602 kalMemZero(prBowLinkConnected->aucPeerAddress, MAC_ADDR_LEN); /* @FIXME */
2603
2604 kalIndicateBOWEvent(prAdapter->prGlueInfo, prBowEvent);
2605 } else {
2606 /* Disconnection */
2607 prBowEvent->rHeader.ucEventId = BOW_EVENT_ID_LINK_DISCONNECTED;
2608 prBowEvent->rHeader.ucSeqNumber = 0;
2609 prBowEvent->rHeader.u2PayloadLength = sizeof(BOW_LINK_DISCONNECTED);
2610
2611 /* fill event body */
2612 prBowLinkDisconnected =
2613 (P_BOW_LINK_DISCONNECTED) (prBowEvent->aucPayload);
2614 prBowLinkDisconnected->ucReason = 0; /* @FIXME */
2615 kalMemZero(prBowLinkDisconnected->aucPeerAddress, MAC_ADDR_LEN); /* @FIXME */
2616
2617 kalIndicateBOWEvent(prAdapter->prGlueInfo, prBowEvent);
2618 }
2619 }
2620 break;
2621 #endif
2622 case EVENT_ID_STATISTICS:
2623 /* buffer statistics for further query */
2624 prAdapter->fgIsStatValid = TRUE;
2625 prAdapter->rStatUpdateTime = kalGetTimeTick();
2626 kalMemCopy(&prAdapter->rStatStruct, prEvent->aucBuffer, sizeof(EVENT_STATISTICS));
2627
2628 /* command response handling */
2629 prCmdInfo = nicGetPendingCmdInfo(prAdapter, prEvent->ucSeqNum);
2630
2631 if (prCmdInfo != NULL) {
2632 if (prCmdInfo->pfCmdDoneHandler) {
2633 prCmdInfo->pfCmdDoneHandler(prAdapter, prCmdInfo,
2634 prEvent->aucBuffer);
2635 } else if (prCmdInfo->fgIsOid) {
2636 kalOidComplete(prAdapter->prGlueInfo, prCmdInfo->fgSetQuery, 0,
2637 WLAN_STATUS_SUCCESS);
2638 }
2639 /* return prCmdInfo */
2640 cmdBufFreeCmdInfo(prAdapter, prCmdInfo);
2641 }
2642
2643 break;
2644
2645 case EVENT_ID_CH_PRIVILEGE:
2646 cnmChMngrHandleChEvent(prAdapter, prEvent);
2647 break;
2648
2649 case EVENT_ID_BSS_ABSENCE_PRESENCE:
2650 qmHandleEventBssAbsencePresence(prAdapter, prEvent);
2651 break;
2652
2653 case EVENT_ID_STA_CHANGE_PS_MODE:
2654 qmHandleEventStaChangePsMode(prAdapter, prEvent);
2655 break;
2656 #if CFG_ENABLE_WIFI_DIRECT
2657 case EVENT_ID_STA_UPDATE_FREE_QUOTA:
2658 qmHandleEventStaUpdateFreeQuota(prAdapter, prEvent);
2659 break;
2660 #endif
2661 case EVENT_ID_BSS_BEACON_TIMEOUT:
2662 DBGLOG(INIT, INFO, ("EVENT_ID_BSS_BEACON_TIMEOUT\n"));
2663
2664 if (prAdapter->fgDisBcnLostDetection == FALSE) {
2665 P_BSS_INFO_T prBssInfo = (P_BSS_INFO_T) NULL;
2666 P_EVENT_BSS_BEACON_TIMEOUT_T prEventBssBeaconTimeout;
2667 prEventBssBeaconTimeout =
2668 (P_EVENT_BSS_BEACON_TIMEOUT_T) (prEvent->aucBuffer);
2669
2670 if (prEventBssBeaconTimeout->ucBssIndex >= BSS_INFO_NUM) {
2671 break;
2672 }
2673
2674 prBssInfo =
2675 GET_BSS_INFO_BY_INDEX(prAdapter, prEventBssBeaconTimeout->ucBssIndex);
2676
2677 if (prEventBssBeaconTimeout->ucBssIndex ==
2678 prAdapter->prAisBssInfo->ucBssIndex) {
2679 aisBssBeaconTimeout(prAdapter);
2680 }
2681 #if CFG_ENABLE_WIFI_DIRECT
2682 else if ((prBssInfo->eNetworkType == NETWORK_TYPE_P2P)) {
2683 p2pRoleFsmRunEventBeaconTimeout(prAdapter, prBssInfo);
2684 }
2685 #endif
2686 #if CFG_ENABLE_BT_OVER_WIFI
2687 else if (GET_BSS_INFO_BY_INDEX
2688 (prAdapter,
2689 prEventBssBeaconTimeout->ucBssIndex)->eNetworkType ==
2690 NETWORK_TYPE_BOW) {
2691 }
2692 #endif
2693 else {
2694 DBGLOG(RX, ERROR,
2695 ("EVENT_ID_BSS_BEACON_TIMEOUT: (ucBssIndex = %d)\n",
2696 prEventBssBeaconTimeout->ucBssIndex));
2697 }
2698 }
2699
2700 break;
2701 case EVENT_ID_UPDATE_NOA_PARAMS:
2702 #if CFG_ENABLE_WIFI_DIRECT
2703 if (prAdapter->fgIsP2PRegistered) {
2704 P_EVENT_UPDATE_NOA_PARAMS_T prEventUpdateNoaParam;
2705 prEventUpdateNoaParam = (P_EVENT_UPDATE_NOA_PARAMS_T) (prEvent->aucBuffer);
2706
2707 if (GET_BSS_INFO_BY_INDEX(prAdapter, prEventUpdateNoaParam->ucBssIndex)->
2708 eNetworkType == NETWORK_TYPE_P2P) {
2709 p2pProcessEvent_UpdateNOAParam(prAdapter,
2710 prEventUpdateNoaParam->ucBssIndex,
2711 prEventUpdateNoaParam);
2712 } else {
2713 ASSERT(0);
2714 }
2715 }
2716 #else
2717 ASSERT(0);
2718 #endif
2719 break;
2720
2721 case EVENT_ID_STA_AGING_TIMEOUT:
2722 #if CFG_ENABLE_WIFI_DIRECT
2723 {
2724 if (prAdapter->fgDisStaAgingTimeoutDetection == FALSE) {
2725 P_EVENT_STA_AGING_TIMEOUT_T prEventStaAgingTimeout;
2726 P_STA_RECORD_T prStaRec;
2727 P_BSS_INFO_T prBssInfo = (P_BSS_INFO_T) NULL;
2728
2729 prEventStaAgingTimeout =
2730 (P_EVENT_STA_AGING_TIMEOUT_T) (prEvent->aucBuffer);
2731 prStaRec =
2732 cnmGetStaRecByIndex(prAdapter,
2733 prEventStaAgingTimeout->ucStaRecIdx);
2734 if (prStaRec == NULL) {
2735 break;
2736 }
2737
2738 DBGLOG(INIT, INFO, ("EVENT_ID_STA_AGING_TIMEOUT %u " MACSTR "\n",
2739 prEventStaAgingTimeout->ucStaRecIdx,
2740 MAC2STR(prStaRec->aucMacAddr)));
2741
2742 prBssInfo = GET_BSS_INFO_BY_INDEX(prAdapter, prStaRec->ucBssIndex);
2743
2744 bssRemoveStaRecFromClientList(prAdapter, prBssInfo, prStaRec);
2745
2746 /* Call False Auth */
2747 if (prAdapter->fgIsP2PRegistered) {
2748 p2pFuncDisconnect(prAdapter, prBssInfo, prStaRec, TRUE,
2749 REASON_CODE_DISASSOC_INACTIVITY);
2750 }
2751
2752
2753 }
2754 /* gDisStaAgingTimeoutDetection */
2755 }
2756 #endif
2757 break;
2758
2759 case EVENT_ID_AP_OBSS_STATUS:
2760 #if CFG_ENABLE_WIFI_DIRECT
2761 if (prAdapter->fgIsP2PRegistered) {
2762 rlmHandleObssStatusEventPkt(prAdapter,
2763 (P_EVENT_AP_OBSS_STATUS_T) prEvent->aucBuffer);
2764 }
2765 #endif
2766 break;
2767
2768 case EVENT_ID_ROAMING_STATUS:
2769 #if CFG_SUPPORT_ROAMING
2770 {
2771 P_CMD_ROAMING_TRANSIT_T prTransit;
2772
2773 prTransit = (P_CMD_ROAMING_TRANSIT_T) (prEvent->aucBuffer);
2774 roamingFsmProcessEvent(prAdapter, prTransit);
2775 }
2776 #endif /* CFG_SUPPORT_ROAMING */
2777 break;
2778 case EVENT_ID_SEND_DEAUTH:
2779 #if DBG
2780 {
2781 P_WLAN_MAC_HEADER_T prWlanMacHeader;
2782
2783 prWlanMacHeader = (P_WLAN_MAC_HEADER_T) &prEvent->aucBuffer[0];
2784 DBGLOG(RX, INFO,
2785 ("nicRx: aucAddr1: " MACSTR "\n",
2786 MAC2STR(prWlanMacHeader->aucAddr1)));
2787 DBGLOG(RX, INFO,
2788 ("nicRx: aucAddr2: " MACSTR "\n",
2789 MAC2STR(prWlanMacHeader->aucAddr2)));
2790 }
2791 #endif
2792 /* receive packets without StaRec */
2793 prSwRfb->pvHeader = (P_WLAN_MAC_HEADER_T) &prEvent->aucBuffer[0];
2794 if (WLAN_STATUS_SUCCESS == authSendDeauthFrame(prAdapter,
2795 NULL,
2796 NULL,
2797 prSwRfb,
2798 REASON_CODE_CLASS_3_ERR,
2799 (PFN_TX_DONE_HANDLER) NULL)) {
2800 DBGLOG(RX, INFO, ("Send Deauth Error\n"));
2801 }
2802 break;
2803
2804 #if CFG_SUPPORT_RDD_TEST_MODE
2805 case EVENT_ID_UPDATE_RDD_STATUS:
2806 {
2807 P_EVENT_RDD_STATUS_T prEventRddStatus;
2808
2809 prEventRddStatus = (P_EVENT_RDD_STATUS_T) (prEvent->aucBuffer);
2810
2811 prAdapter->ucRddStatus = prEventRddStatus->ucRddStatus;
2812 }
2813
2814 break;
2815 #endif
2816
2817 #if CFG_SUPPORT_BCM && CFG_SUPPORT_BCM_BWCS
2818 case EVENT_ID_UPDATE_BWCS_STATUS:
2819 {
2820 P_PTA_IPC_T prEventBwcsStatus;
2821
2822 prEventBwcsStatus = (P_PTA_IPC_T) (prEvent->aucBuffer);
2823
2824 #if CFG_SUPPORT_BCM_BWCS_DEBUG
2825 printk(KERN_INFO DRV_NAME "BCM BWCS Event: %02x%02x%02x%02x\n",
2826 prEventBwcsStatus->u.aucBTPParams[0],
2827 prEventBwcsStatus->u.aucBTPParams[1],
2828 prEventBwcsStatus->u.aucBTPParams[2],
2829 prEventBwcsStatus->u.aucBTPParams[3]);
2830
2831 printk(KERN_INFO DRV_NAME
2832 "BCM BWCS Event: aucBTPParams[0] = %02x, aucBTPParams[1] = %02x, aucBTPParams[2] = %02x, aucBTPParams[3] = %02x\n",
2833 prEventBwcsStatus->u.aucBTPParams[0],
2834 prEventBwcsStatus->u.aucBTPParams[1],
2835 prEventBwcsStatus->u.aucBTPParams[2],
2836 prEventBwcsStatus->u.aucBTPParams[3]);
2837 #endif
2838
2839 kalIndicateStatusAndComplete(prAdapter->prGlueInfo,
2840 WLAN_STATUS_BWCS_UPDATE,
2841 (PVOID) prEventBwcsStatus, sizeof(PTA_IPC_T));
2842 }
2843
2844 break;
2845
2846 case EVENT_ID_UPDATE_BCM_DEBUG:
2847 {
2848 P_PTA_IPC_T prEventBwcsStatus;
2849
2850 prEventBwcsStatus = (P_PTA_IPC_T) (prEvent->aucBuffer);
2851
2852 #if CFG_SUPPORT_BCM_BWCS_DEBUG
2853 printk(KERN_INFO DRV_NAME "BCM FW status: %02x%02x%02x%02x\n",
2854 prEventBwcsStatus->u.aucBTPParams[0],
2855 prEventBwcsStatus->u.aucBTPParams[1],
2856 prEventBwcsStatus->u.aucBTPParams[2],
2857 prEventBwcsStatus->u.aucBTPParams[3]);
2858
2859 printk(KERN_INFO DRV_NAME
2860 "BCM FW status: aucBTPParams[0] = %02x, aucBTPParams[1] = %02x, aucBTPParams[2] = %02x, aucBTPParams[3] = %02x\n",
2861 prEventBwcsStatus->u.aucBTPParams[0],
2862 prEventBwcsStatus->u.aucBTPParams[1],
2863 prEventBwcsStatus->u.aucBTPParams[2],
2864 prEventBwcsStatus->u.aucBTPParams[3]);
2865 #endif
2866 }
2867
2868 break;
2869 #endif
2870 case EVENT_ID_ADD_PKEY_DONE:
2871 {
2872 P_EVENT_ADD_KEY_DONE_INFO prAddKeyDone;
2873 P_STA_RECORD_T prStaRec;
2874
2875 prAddKeyDone = (P_EVENT_ADD_KEY_DONE_INFO) (prEvent->aucBuffer);
2876
2877 DBGLOG(RSN, EVENT,
2878 ("EVENT_ID_ADD_PKEY_DONE BSSIDX=%d " MACSTR "\n",
2879 prAddKeyDone->ucBSSIndex, MAC2STR(prAddKeyDone->aucStaAddr)));
2880
2881 prStaRec = cnmGetStaRecByAddress(prAdapter,
2882 prAddKeyDone->ucBSSIndex,
2883 prAddKeyDone->aucStaAddr);
2884
2885 if (prStaRec) {
2886 DBGLOG(RSN, EVENT,
2887 ("STA " MACSTR " Add Key Done!!\n",
2888 MAC2STR(prStaRec->aucMacAddr)));
2889 prStaRec->fgIsTxKeyReady = TRUE;
2890 qmUpdateStaRec(prAdapter, prStaRec);
2891 }
2892 }
2893 break;
2894 case EVENT_ID_ICAP_DONE:
2895 {
2896 P_EVENT_ICAP_STATUS_T prEventIcapStatus;
2897 PARAM_CUSTOM_MEM_DUMP_STRUC_T rMemDumpInfo;
2898 UINT_32 u4QueryInfo;
2899
2900 prEventIcapStatus = (P_EVENT_ICAP_STATUS_T) (prEvent->aucBuffer);
2901
2902 rMemDumpInfo.u4Address = prEventIcapStatus->u4StartAddress;
2903 rMemDumpInfo.u4Length = prEventIcapStatus->u4IcapSieze;
2904
2905 wlanoidQueryMemDump(prAdapter, &rMemDumpInfo, sizeof(rMemDumpInfo),
2906 &u4QueryInfo);
2907
2908 }
2909
2910 break;
2911 case EVENT_ID_DEBUG_MSG:
2912 {
2913 P_EVENT_DEBUG_MSG_T prEventDebugMsg;
2914 UINT_16 u2DebugMsgId;
2915 UINT_8 ucMsgType;
2916 UINT_8 ucFlags;
2917 UINT_32 u4Value;
2918 UINT_16 u2MsgSize;
2919 P_UINT_8 pucMsg;
2920
2921 prEventDebugMsg = (P_EVENT_DEBUG_MSG_T) (prEvent->aucBuffer);
2922
2923 u2DebugMsgId = prEventDebugMsg->u2DebugMsgId;
2924 ucMsgType = prEventDebugMsg->ucMsgType;
2925 ucFlags = prEventDebugMsg->ucFlags;
2926 u4Value = prEventDebugMsg->u4Value;
2927 u2MsgSize = prEventDebugMsg->u2MsgSize;
2928 pucMsg = prEventDebugMsg->aucMsg;
2929
2930 DBGLOG(SW4, INFO, ("DEBUG_MSG Id %u Type %u Fg 0x%x Val 0x%x Size %u\n",
2931 u2DebugMsgId, ucMsgType, ucFlags, u4Value, u2MsgSize));
2932
2933 if (u2MsgSize <= DEBUG_MSG_SIZE_MAX) {
2934 if (ucMsgType >= DEBUG_MSG_TYPE_END) {
2935 ucMsgType = DEBUG_MSG_TYPE_MEM32;
2936 }
2937
2938 if (ucMsgType == DEBUG_MSG_TYPE_ASCII) {
2939 pucMsg[u2MsgSize] = '\0';
2940 DBGLOG(SW4, INFO, ("%s\n", pucMsg));
2941 } else if (ucMsgType == DEBUG_MSG_TYPE_MEM32) {
2942
2943 #if CFG_SUPPORT_XLOG
2944 /* dumpMemory32(ANDROID_LOG_INFO, pucMsg, u2MsgSize); */
2945 #else
2946 /* dumpMemory32(pucMsg, u2MsgSize); */
2947 #endif
2948 DBGLOG_MEM32(SW4, INFO, pucMsg, u2MsgSize);
2949 } else if (prEventDebugMsg->ucMsgType == DEBUG_MSG_TYPE_MEM8) {
2950 #if CFG_SUPPORT_XLOG
2951 /* dumpMemory8(ANDROID_LOG_INFO, pucMsg, u2MsgSize); */
2952 #else
2953 /* dumpMemory8(pucMsg, u2MsgSize); */
2954 #endif
2955 DBGLOG_MEM8(SW4, INFO, pucMsg, u2MsgSize);
2956 } else {
2957 #if CFG_SUPPORT_XLOG
2958 /* dumpMemory32(ANDROID_LOG_INFO, pucMsg, u2MsgSize); */
2959 #else
2960 /* dumpMemory32(pucMsg, u2MsgSize); */
2961 #endif
2962 DBGLOG_MEM32(SW4, INFO, pucMsg, u2MsgSize);
2963 }
2964 } /* DEBUG_MSG_SIZE_MAX */
2965 else {
2966 DBGLOG(SW4, INFO, ("Debug msg size %u is too large.\n", u2MsgSize));
2967 }
2968 }
2969 break;
2970
2971 #if CFG_SUPPORT_BATCH_SCAN
2972 case EVENT_ID_BATCH_RESULT:
2973 DBGLOG(SCN, TRACE, ("Got EVENT_ID_BATCH_RESULT"));
2974
2975 /* command response handling */
2976 prCmdInfo = nicGetPendingCmdInfo(prAdapter, prEvent->ucSeqNum);
2977
2978 if (prCmdInfo != NULL) {
2979 if (prCmdInfo->pfCmdDoneHandler) {
2980 prCmdInfo->pfCmdDoneHandler(prAdapter, prCmdInfo,
2981 prEvent->aucBuffer);
2982 } else if (prCmdInfo->fgIsOid) {
2983 kalOidComplete(prAdapter->prGlueInfo, prCmdInfo->fgSetQuery, 0,
2984 WLAN_STATUS_SUCCESS);
2985 }
2986 /* return prCmdInfo */
2987 cmdBufFreeCmdInfo(prAdapter, prCmdInfo);
2988 }
2989
2990 break;
2991 #endif /* CFG_SUPPORT_BATCH_SCAN */
2992
2993
2994 #if CFG_SUPPORT_TDLS
2995 case EVENT_ID_TDLS:
2996
2997 TdlsexEventHandle(prAdapter->prGlueInfo,
2998 (UINT_8 *) prEvent->aucBuffer,
2999 (UINT_32) (prEvent->u2PacketLength - 8));
3000 break;
3001 #endif /* CFG_SUPPORT_TDLS */
3002
3003 case EVENT_ID_DUMP_MEM:
3004 DBGLOG(INIT, INFO, ("%s: EVENT_ID_DUMP_MEM\n", __func__));
3005
3006 prCmdInfo = nicGetPendingCmdInfo(prAdapter, prEvent->ucSeqNum);
3007
3008 if (prCmdInfo != NULL) {
3009 DBGLOG(INIT, INFO, (": ==> 1\n"));
3010 if (prCmdInfo->pfCmdDoneHandler) {
3011 prCmdInfo->pfCmdDoneHandler(prAdapter, prCmdInfo,
3012 prEvent->aucBuffer);
3013 } else if (prCmdInfo->fgIsOid) {
3014 kalOidComplete(prAdapter->prGlueInfo, prCmdInfo->fgSetQuery, 0,
3015 WLAN_STATUS_SUCCESS);
3016 }
3017 /* return prCmdInfo */
3018 cmdBufFreeCmdInfo(prAdapter, prCmdInfo);
3019 } else {
3020 /* Burst mode */
3021 DBGLOG(INIT, INFO, (": ==> 2\n"));
3022 nicEventQueryMemDump(prAdapter, prEvent->aucBuffer);
3023 }
3024 break;
3025
3026 case EVENT_ID_ACCESS_REG:
3027 case EVENT_ID_NIC_CAPABILITY:
3028 /* case EVENT_ID_MAC_MCAST_ADDR: */
3029 case EVENT_ID_ACCESS_EEPROM:
3030 case EVENT_ID_TEST_STATUS:
3031 default:
3032 prCmdInfo = nicGetPendingCmdInfo(prAdapter, prEvent->ucSeqNum);
3033
3034 if (prCmdInfo != NULL) {
3035 if (prCmdInfo->pfCmdDoneHandler) {
3036 prCmdInfo->pfCmdDoneHandler(prAdapter, prCmdInfo,
3037 prEvent->aucBuffer);
3038 } else if (prCmdInfo->fgIsOid) {
3039 kalOidComplete(prAdapter->prGlueInfo, prCmdInfo->fgSetQuery, 0,
3040 WLAN_STATUS_SUCCESS);
3041 }
3042 /* return prCmdInfo */
3043 cmdBufFreeCmdInfo(prAdapter, prCmdInfo);
3044 }
3045
3046 break;
3047 }
3048
3049 /* Reset Chip NoAck flag */
3050 if (prGlueInfo->prAdapter->fgIsChipNoAck) {
3051 DBGLOG(INIT, WARN, ("Got response from chip, clear NoAck flag!\n"));
3052 WARN_ON(TRUE);
3053 }
3054 prGlueInfo->prAdapter->ucOidTimeoutCount = 0;
3055 prGlueInfo->prAdapter->fgIsChipNoAck = FALSE;
3056
3057 nicRxReturnRFB(prAdapter, prSwRfb);
3058 }
3059
3060
3061 /*----------------------------------------------------------------------------*/
3062 /*!
3063 * @brief nicRxProcessMgmtPacket is used to dispatch management frames
3064 * to corresponding modules
3065 *
3066 * @param prAdapter Pointer to the Adapter structure.
3067 * @param prSWRfb the RFB to receive rx data
3068 *
3069 * @return (none)
3070 */
3071 /*----------------------------------------------------------------------------*/
3072 VOID nicRxProcessMgmtPacket(IN P_ADAPTER_T prAdapter, IN OUT P_SW_RFB_T prSwRfb)
3073 {
3074 UINT_8 ucSubtype;
3075 #if CFG_SUPPORT_802_11W
3076 /* BOOL fgMfgDrop = FALSE; */
3077 #endif
3078 ASSERT(prAdapter);
3079 ASSERT(prSwRfb);
3080
3081 nicRxFillRFB(prAdapter, prSwRfb);
3082
3083 ucSubtype = (*(PUINT_8) (prSwRfb->pvHeader) & MASK_FC_SUBTYPE) >> OFFSET_OF_FC_SUBTYPE;
3084
3085 #if CFG_RX_PKTS_DUMP
3086 {
3087 P_WLAN_MAC_MGMT_HEADER_T prWlanMgmtHeader;
3088 UINT_16 u2TxFrameCtrl;
3089
3090 u2TxFrameCtrl = (*(PUINT_8) (prSwRfb->pvHeader) & MASK_FRAME_TYPE);
3091 if (prAdapter->rRxCtrl.u4RxPktsDumpTypeMask & BIT(HIF_RX_PKT_TYPE_MANAGEMENT)) {
3092 if (u2TxFrameCtrl == MAC_FRAME_BEACON ||
3093 u2TxFrameCtrl == MAC_FRAME_PROBE_RSP) {
3094
3095 prWlanMgmtHeader = (P_WLAN_MAC_MGMT_HEADER_T) (prSwRfb->pvHeader);
3096
3097 DBGLOG(SW4, INFO, ("QM RX MGT: net %u sta idx %u wlan idx %u ssn %u ptype %u subtype %u 11 %u\n", prSwRfb->prStaRec->ucBssIndex, prSwRfb->ucStaRecIdx, prSwRfb->ucWlanIdx, prWlanMgmtHeader->u2SeqCtrl, /* The new SN of the frame */
3098 prSwRfb->ucPacketType, ucSubtype));
3099 /* HIF_RX_HDR_GET_80211_FLAG(prHifRxHdr))); */
3100
3101 DBGLOG_MEM8(SW4, TRACE, (PUINT_8) prSwRfb->pvHeader,
3102 prSwRfb->u2PacketLen);
3103 }
3104 }
3105 }
3106 #endif
3107 #if CFG_SUPPORT_802_11W
3108 if (HAL_RX_STATUS_IS_ICV_ERROR(prSwRfb->prRxStatus)) {
3109 if (HAL_RX_STATUS_GET_SEC_MODE(prSwRfb->prRxStatus) == CIPHER_SUITE_BIP) {
3110 DBGLOG(RSN, INFO, ("[MFP] RX with BIP ICV ERROR\n"));
3111 } else {
3112 DBGLOG(RSN, INFO, ("[MFP] RX with ICV ERROR\n"));
3113 }
3114 nicRxReturnRFB(prAdapter, prSwRfb);
3115 RX_INC_CNT(&prAdapter->rRxCtrl, RX_DROP_TOTAL_COUNT);
3116 return;
3117 }
3118 #endif
3119
3120 if (prAdapter->fgTestMode == FALSE) {
3121 #if CFG_MGMT_FRAME_HANDLING
3122 if (apfnProcessRxMgtFrame[ucSubtype]) {
3123 switch (apfnProcessRxMgtFrame[ucSubtype] (prAdapter, prSwRfb)) {
3124 case WLAN_STATUS_PENDING:
3125 return;
3126 case WLAN_STATUS_SUCCESS:
3127 case WLAN_STATUS_FAILURE:
3128 break;
3129
3130 default:
3131 DBGLOG(RX, WARN,
3132 ("Unexpected MMPDU(0x%02X) returned with abnormal status\n",
3133 ucSubtype));
3134 break;
3135 }
3136 }
3137 #endif
3138 }
3139
3140 nicRxReturnRFB(prAdapter, prSwRfb);
3141 }
3142
3143 /*----------------------------------------------------------------------------*/
3144 /*!
3145 * @brief nicProcessRFBs is used to process RFBs in the rReceivedRFBList queue.
3146 *
3147 * @param prAdapter Pointer to the Adapter structure.
3148 *
3149 * @return (none)
3150 */
3151 /*----------------------------------------------------------------------------*/
3152 VOID nicRxProcessRFBs(IN P_ADAPTER_T prAdapter)
3153 {
3154 P_RX_CTRL_T prRxCtrl;
3155 P_SW_RFB_T prSwRfb = (P_SW_RFB_T)NULL;
3156 QUE_T rTempRfbList;
3157 P_QUE_T prTempRfbList = &rTempRfbList;
3158 UINT_32 u4RxLoopCount;
3159
3160 KAL_SPIN_LOCK_DECLARATION();
3161
3162 DEBUGFUNC("nicRxProcessRFBs");
3163
3164 ASSERT(prAdapter);
3165
3166 prRxCtrl = &prAdapter->rRxCtrl;
3167 ASSERT(prRxCtrl);
3168
3169 prRxCtrl->ucNumIndPacket = 0;
3170 prRxCtrl->ucNumRetainedPacket = 0;
3171 u4RxLoopCount = prAdapter->rWifiVar.u4TxRxLoopCount;
3172
3173 QUEUE_INITIALIZE(prTempRfbList);
3174
3175 while(u4RxLoopCount--) {
3176 while(QUEUE_IS_NOT_EMPTY(&prRxCtrl->rReceivedRfbList)) {
3177
3178 KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE);
3179 QUEUE_MOVE_ALL(prTempRfbList, &prRxCtrl->rReceivedRfbList);
3180 KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE);
3181
3182 while(QUEUE_IS_NOT_EMPTY(prTempRfbList)) {
3183 QUEUE_REMOVE_HEAD(prTempRfbList, prSwRfb, P_SW_RFB_T);
3184
3185 switch(prSwRfb->ucPacketType){
3186 case RX_PKT_TYPE_RX_DATA:
3187 nicRxProcessDataPacket(prAdapter, prSwRfb);
3188 break;
3189
3190 case RX_PKT_TYPE_SW_DEFINED:
3191 //HIF_RX_PKT_TYPE_EVENT
3192 if ((prSwRfb->prRxStatus->u2PktTYpe & RXM_RXD_PKT_TYPE_SW_BITMAP) == RXM_RXD_PKT_TYPE_SW_EVENT) {
3193 nicRxProcessEventPacket(prAdapter, prSwRfb);
3194 }
3195 //case HIF_RX_PKT_TYPE_MANAGEMENT:
3196 else if ((prSwRfb->prRxStatus->u2PktTYpe & RXM_RXD_PKT_TYPE_SW_BITMAP) == RXM_RXD_PKT_TYPE_SW_FRAME) {
3197 nicRxProcessMgmtPacket(prAdapter, prSwRfb);
3198 }
3199 else {
3200 DBGLOG(RX, ERROR, ("[%s]ERROR: u2PktTYpe(0x%04X) is OUT OF DEF.!!!\n", __func__, prSwRfb->prRxStatus->u2PktTYpe));
3201 ASSERT(0);
3202 }
3203 break;
3204
3205 //case HIF_RX_PKT_TYPE_TX_LOOPBACK:
3206 //case HIF_RX_PKT_TYPE_MANAGEMENT:
3207 case RX_PKT_TYPE_TX_STATUS:
3208 case RX_PKT_TYPE_RX_VECTOR:
3209 case RX_PKT_TYPE_TM_REPORT:
3210 default:
3211 RX_INC_CNT(prRxCtrl, RX_TYPE_ERR_DROP_COUNT);
3212 RX_INC_CNT(prRxCtrl, RX_DROP_TOTAL_COUNT);
3213 DBGLOG(RX, ERROR, ("ucPacketType = %d\n", prSwRfb->ucPacketType));
3214 break;
3215 }
3216
3217 }
3218
3219 if (prRxCtrl->ucNumIndPacket > 0) {
3220 RX_ADD_CNT(prRxCtrl, RX_DATA_INDICATION_COUNT, prRxCtrl->ucNumIndPacket);
3221 RX_ADD_CNT(prRxCtrl, RX_DATA_RETAINED_COUNT, prRxCtrl->ucNumRetainedPacket);
3222 #if CFG_SUPPORT_MULTITHREAD
3223 kalSetTxEvent2Rx(prAdapter->prGlueInfo);
3224 #else
3225 //DBGLOG(RX, INFO, ("%d packets indicated, Retained cnt = %d\n",
3226 // prRxCtrl->ucNumIndPacket, prRxCtrl->ucNumRetainedPacket));
3227 #if CFG_NATIVE_802_11
3228 kalRxIndicatePkts(prAdapter->prGlueInfo, (UINT_32)prRxCtrl->ucNumIndPacket, (UINT_32)prRxCtrl->ucNumRetainedPacket);
3229 #else
3230 kalRxIndicatePkts(prAdapter->prGlueInfo, prRxCtrl->apvIndPacket, (UINT_32)prRxCtrl->ucNumIndPacket);
3231 #endif
3232 #endif
3233 }
3234 }
3235 }
3236 } /* end of nicRxProcessRFBs() */
3237
3238
3239 #if !CFG_SDIO_INTR_ENHANCE
3240 /*----------------------------------------------------------------------------*/
3241 /*!
3242 * @brief Read the rx data from data port and setup RFB
3243 *
3244 * @param prAdapter pointer to the Adapter handler
3245 * @param prSWRfb the RFB to receive rx data
3246 *
3247 * @retval WLAN_STATUS_SUCCESS: SUCCESS
3248 * @retval WLAN_STATUS_FAILURE: FAILURE
3249 *
3250 */
3251 /*----------------------------------------------------------------------------*/
3252 WLAN_STATUS nicRxReadBuffer(IN P_ADAPTER_T prAdapter, IN OUT P_SW_RFB_T prSwRfb)
3253 {
3254 P_RX_CTRL_T prRxCtrl;
3255 PUINT_8 pucBuf;
3256 P_HW_MAC_RX_DESC_T prRxStatus;
3257 UINT_32 u4PktLen = 0, u4ReadBytes;
3258 WLAN_STATUS u4Status = WLAN_STATUS_SUCCESS;
3259 BOOL fgResult = TRUE;
3260 UINT_32 u4RegValue;
3261 UINT_32 rxNum;
3262
3263 DEBUGFUNC("nicRxReadBuffer");
3264
3265 ASSERT(prAdapter);
3266 ASSERT(prSwRfb);
3267
3268 prRxCtrl = &prAdapter->rRxCtrl;
3269 ASSERT(prRxCtrl);
3270
3271 pucBuf = prSwRfb->pucRecvBuff;
3272 prRxStatus = prSwRfb->prRxStatus;
3273
3274 ASSERT(prRxStatus);
3275 ASSERT(pucBuf);
3276 DBGLOG(RX, TRACE, ("pucBuf= 0x%x, prRxStatus= 0x%x\n", pucBuf, prRxStatus));
3277
3278 do {
3279 /* Read the RFB DW length and packet length */
3280 HAL_MCR_RD(prAdapter, MCR_WRPLR, &u4RegValue);
3281 if (!fgResult) {
3282 DBGLOG(RX, ERROR, ("Read RX Packet Lentgh Error\n"));
3283 return WLAN_STATUS_FAILURE;
3284 }
3285 /* 20091021 move the line to get the HIF RX header (for RX0/1) */
3286 if (u4RegValue == 0) {
3287 DBGLOG(RX, ERROR, ("No RX packet\n"));
3288 return WLAN_STATUS_FAILURE;
3289 }
3290
3291 u4PktLen = u4RegValue & BITS(0, 15);
3292 if (u4PktLen != 0) {
3293 rxNum = 0;
3294 } else {
3295 rxNum = 1;
3296 u4PktLen = (u4RegValue & BITS(16, 31)) >> 16;
3297 }
3298
3299 DBGLOG(RX, TRACE, ("RX%d: u4PktLen = %d\n", rxNum, u4PktLen));
3300
3301 /* 4 <4> Read Entire RFB and packet, include HW appended DW (Checksum Status) */
3302 u4ReadBytes = ALIGN_4(u4PktLen) + 4;
3303 HAL_READ_RX_PORT(prAdapter, rxNum, u4ReadBytes, pucBuf, CFG_RX_MAX_PKT_SIZE);
3304
3305 /* 20091021 move the line to get the HIF RX header */
3306 /* u4PktLen = (UINT_32)prHifRxHdr->u2PacketLen; */
3307 if (u4PktLen != (UINT_32) HAL_RX_STATUS_GET_RX_BYTE_CNT(prRxStatus)) {
3308 DBGLOG(RX, ERROR, ("Read u4PktLen = %d, prHifRxHdr->u2PacketLen: %d\n",
3309 u4PktLen, HAL_RX_STATUS_GET_RX_BYTE_CNT(prRxStatus)));
3310 #if DBG
3311 dumpMemory8((PUINT_8) prRxStatus,
3312 (HAL_RX_STATUS_GET_RX_BYTE_CNT(prRxStatus) >
3313 4096) ? 4096 : prRxStatus->u2RxByteCount);
3314 #endif
3315 ASSERT(0);
3316 }
3317 /* u4PktLen is byte unit, not inlude HW appended DW */
3318
3319 prSwRfb->ucPacketType = (UINT_8) HAL_RX_STATUS_GET_PKT_TYPE(prRxStatus);
3320 DBGLOG(RX, TRACE, ("ucPacketType = %d\n", prSwRfb->ucPacketType));
3321
3322 prSwRfb->ucStaRecIdx =
3323 secGetStaIdxByWlanIdx(prAdapter,
3324 (UINT_8) HAL_RX_STATUS_GET_WLAN_IDX(prRxStatus));
3325
3326 /* fgResult will be updated in MACRO */
3327 if (!fgResult) {
3328 return WLAN_STATUS_FAILURE;
3329 }
3330
3331 DBGLOG(RX, TRACE, ("Dump RX buffer, length = 0x%x\n", u4ReadBytes));
3332 DBGLOG_MEM8(RX, TRACE, pucBuf, u4ReadBytes);
3333 } while (FALSE);
3334
3335 return u4Status;
3336 }
3337
3338
3339 /*----------------------------------------------------------------------------*/
3340 /*!
3341 * @brief Read frames from the data port, fill RFB
3342 * and put each frame into the rReceivedRFBList queue.
3343 *
3344 * @param prAdapter Pointer to the Adapter structure.
3345 *
3346 * @return (none)
3347 */
3348 /*----------------------------------------------------------------------------*/
3349 VOID nicRxReceiveRFBs(IN P_ADAPTER_T prAdapter)
3350 {
3351 P_RX_CTRL_T prRxCtrl;
3352 P_SW_RFB_T prSwRfb = (P_SW_RFB_T) NULL;
3353 P_HW_MAC_RX_DESC_T prRxStatus;
3354 UINT_32 u4HwAppendDW;
3355 PUINT_32 pu4Temp;
3356
3357 KAL_SPIN_LOCK_DECLARATION();
3358
3359 DEBUGFUNC("nicRxReceiveRFBs");
3360
3361 ASSERT(prAdapter);
3362
3363 prRxCtrl = &prAdapter->rRxCtrl;
3364 ASSERT(prRxCtrl);
3365
3366 do {
3367 KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_FREE_QUE);
3368 QUEUE_REMOVE_HEAD(&prRxCtrl->rFreeSwRfbList, prSwRfb, P_SW_RFB_T);
3369 KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_FREE_QUE);
3370
3371 if (!prSwRfb) {
3372 DBGLOG(RX, TRACE, ("No More RFB\n"));
3373 break;
3374 }
3375 /* need to consider */
3376 if (nicRxReadBuffer(prAdapter, prSwRfb) == WLAN_STATUS_FAILURE) {
3377 DBGLOG(RX, TRACE, ("halRxFillRFB failed\n"));
3378 nicRxReturnRFB(prAdapter, prSwRfb);
3379 break;
3380 }
3381
3382 KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE);
3383 QUEUE_INSERT_TAIL(&prRxCtrl->rReceivedRfbList, &prSwRfb->rQueEntry);
3384 RX_INC_CNT(prRxCtrl, RX_MPDU_TOTAL_COUNT);
3385 KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE);
3386
3387 prRxStatus = prSwRfb->prRxStatus;
3388 ASSERT(prRxStatus);
3389
3390 pu4Temp = (PUINT_32)prRxStatus;
3391 u4HwAppendDW = *(pu4Temp+(ALIGN_4(prRxStatus->u2RxByteCount)>>2));
3392 DBGLOG(RX, TRACE, ("u4HwAppendDW = 0x%x\n", u4HwAppendDW));
3393 DBGLOG(RX, TRACE, ("u2PacketLen = 0x%x\n", HAL_RX_STATUS_GET_RX_BYTE_CNT(prRxStatus)));
3394 } while (FALSE);
3395
3396 return;
3397
3398 } /* end of nicReceiveRFBs() */
3399
3400 #else
3401 /*----------------------------------------------------------------------------*/
3402 /*!
3403 * @brief Read frames from the data port, fill RFB
3404 * and put each frame into the rReceivedRFBList queue.
3405 *
3406 * @param prAdapter Pointer to the Adapter structure.
3407 * @param u4DataPort Specify which port to read
3408 * @param u2RxLength Specify to the the rx packet length in Byte.
3409 * @param prSwRfb the RFB to receive rx data.
3410 *
3411 * @return (none)
3412 */
3413 /*----------------------------------------------------------------------------*/
3414
3415 WLAN_STATUS
3416 nicRxEnhanceReadBuffer(IN P_ADAPTER_T prAdapter,
3417 IN UINT_32 u4DataPort, IN UINT_16 u2RxLength, IN OUT P_SW_RFB_T prSwRfb)
3418 {
3419 P_RX_CTRL_T prRxCtrl;
3420 PUINT_8 pucBuf;
3421 P_HW_MAC_RX_DESC_T prRxStatus;
3422 UINT_32 u4PktLen = 0;
3423 WLAN_STATUS u4Status = WLAN_STATUS_FAILURE;
3424 BOOL fgResult = TRUE;
3425
3426 DEBUGFUNC("nicRxEnhanceReadBuffer");
3427
3428 ASSERT(prAdapter);
3429 ASSERT(prSwRfb);
3430
3431 prRxCtrl = &prAdapter->rRxCtrl;
3432 ASSERT(prRxCtrl);
3433
3434 pucBuf = prSwRfb->pucRecvBuff;
3435 ASSERT(pucBuf);
3436
3437 prRxStatus = prSwRfb->prRxStatus;
3438 ASSERT(prRxStatus);
3439
3440 /* DBGLOG(RX, TRACE, ("u2RxLength = %d\n", u2RxLength)); */
3441
3442 do {
3443 /* 4 <1> Read RFB frame from MCR_WRDR0, include HW appended DW */
3444 HAL_READ_RX_PORT(prAdapter,
3445 u4DataPort,
3446 ALIGN_4(u2RxLength + HIF_RX_HW_APPENDED_LEN),
3447 pucBuf, CFG_RX_MAX_PKT_SIZE);
3448
3449 if (!fgResult) {
3450 DBGLOG(RX, ERROR, ("Read RX Packet Lentgh Error\n"));
3451 break;
3452 }
3453
3454 u4PktLen = (UINT_32) (HAL_RX_STATUS_GET_RX_BYTE_CNT(prRxStatus));
3455 /* DBGLOG(RX, TRACE, ("u4PktLen = %d\n", u4PktLen)); */
3456
3457 prSwRfb->ucPacketType = (UINT_8) HAL_RX_STATUS_GET_PKT_TYPE(prRxStatus);
3458 /* DBGLOG(RX, TRACE, ("ucPacketType = %d\n", prSwRfb->ucPacketType)); */
3459
3460 prSwRfb->ucStaRecIdx =
3461 secGetStaIdxByWlanIdx(prAdapter,
3462 (UINT_8) HAL_RX_STATUS_GET_WLAN_IDX(prRxStatus));
3463
3464 /* 4 <2> if the RFB dw size or packet size is zero */
3465 if (u4PktLen == 0) {
3466 DBGLOG(RX, ERROR, ("Packet Length = %lu\n", u4PktLen));
3467 ASSERT(0);
3468 break;
3469 }
3470 /* 4 <3> if the packet is too large or too small */
3471 /* ToDo[6630]: adjust CFG_RX_MAX_PKT_SIZE */
3472 if (u4PktLen > CFG_RX_MAX_PKT_SIZE) {
3473 DBGLOG(RX, TRACE, ("Read RX Packet Lentgh Error (%lu)\n", u4PktLen));
3474 ASSERT(0);
3475 break;
3476 }
3477
3478 u4Status = WLAN_STATUS_SUCCESS;
3479 } while (FALSE);
3480
3481 DBGLOG_MEM8(RX, TRACE, pucBuf, ALIGN_4(u2RxLength + HIF_RX_HW_APPENDED_LEN));
3482 return u4Status;
3483 }
3484
3485
3486 /*----------------------------------------------------------------------------*/
3487 /*!
3488 * @brief Read frames from the data port for SDIO
3489 * I/F, fill RFB and put each frame into the rReceivedRFBList queue.
3490 *
3491 * @param prAdapter Pointer to the Adapter structure.
3492 *
3493 * @return (none)
3494 */
3495 /*----------------------------------------------------------------------------*/
3496 VOID nicRxSDIOReceiveRFBs(IN P_ADAPTER_T prAdapter)
3497 {
3498 P_SDIO_CTRL_T prSDIOCtrl;
3499 P_RX_CTRL_T prRxCtrl;
3500 P_SW_RFB_T prSwRfb = (P_SW_RFB_T) NULL;
3501 UINT_32 i, rxNum;
3502 UINT_16 u2RxPktNum, u2RxLength = 0, u2Tmp = 0;
3503 KAL_SPIN_LOCK_DECLARATION();
3504
3505 DEBUGFUNC("nicRxSDIOReceiveRFBs");
3506
3507 ASSERT(prAdapter);
3508
3509 prSDIOCtrl = prAdapter->prSDIOCtrl;
3510 ASSERT(prSDIOCtrl);
3511
3512 prRxCtrl = &prAdapter->rRxCtrl;
3513 ASSERT(prRxCtrl);
3514
3515 for (rxNum = 0; rxNum < 2; rxNum++) {
3516 u2RxPktNum =
3517 (rxNum ==
3518 0 ? prSDIOCtrl->rRxInfo.u.u2NumValidRx0Len : prSDIOCtrl->rRxInfo.u.
3519 u2NumValidRx1Len);
3520
3521 if (u2RxPktNum == 0) {
3522 continue;
3523 }
3524
3525 for (i = 0; i < u2RxPktNum; i++) {
3526 if (rxNum == 0) {
3527 HAL_READ_RX_LENGTH(prAdapter, &u2RxLength, &u2Tmp);
3528 } else if (rxNum == 1) {
3529 HAL_READ_RX_LENGTH(prAdapter, &u2Tmp, &u2RxLength);
3530 }
3531
3532 if (!u2RxLength) {
3533 break;
3534 }
3535
3536
3537 KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_FREE_QUE);
3538 QUEUE_REMOVE_HEAD(&prRxCtrl->rFreeSwRfbList, prSwRfb, P_SW_RFB_T);
3539 KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_FREE_QUE);
3540
3541 if (!prSwRfb) {
3542 DBGLOG(RX, TRACE, ("No More RFB\n"));
3543 break;
3544 }
3545 ASSERT(prSwRfb);
3546
3547 if (nicRxEnhanceReadBuffer(prAdapter, rxNum, u2RxLength, prSwRfb) ==
3548 WLAN_STATUS_FAILURE) {
3549 DBGLOG(RX, TRACE, ("nicRxEnhanceRxReadBuffer failed\n"));
3550 nicRxReturnRFB(prAdapter, prSwRfb);
3551 break;
3552 }
3553 /* prSDIOCtrl->au4RxLength[i] = 0; */
3554
3555 KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE);
3556 QUEUE_INSERT_TAIL(&prRxCtrl->rReceivedRfbList, &prSwRfb->rQueEntry);
3557 RX_INC_CNT(prRxCtrl, RX_MPDU_TOTAL_COUNT);
3558 KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE);
3559 }
3560 }
3561
3562 prSDIOCtrl->rRxInfo.u.u2NumValidRx0Len = 0;
3563 prSDIOCtrl->rRxInfo.u.u2NumValidRx1Len = 0;
3564
3565 return;
3566 } /* end of nicRxSDIOReceiveRFBs() */
3567
3568 #endif /* CFG_SDIO_INTR_ENHANCE */
3569
3570
3571
3572 #if CFG_SDIO_RX_AGG
3573 /*----------------------------------------------------------------------------*/
3574 /*!
3575 * @brief Read frames from the data port for SDIO with Rx aggregation enabled
3576 * I/F, fill RFB and put each frame into the rReceivedRFBList queue.
3577 *
3578 * @param prAdapter Pointer to the Adapter structure.
3579 *
3580 * @return (none)
3581 */
3582 /*----------------------------------------------------------------------------*/
3583 VOID nicRxSDIOAggReceiveRFBs(IN P_ADAPTER_T prAdapter)
3584 {
3585 P_ENHANCE_MODE_DATA_STRUCT_T prEnhDataStr;
3586 P_RX_CTRL_T prRxCtrl;
3587 P_SDIO_CTRL_T prSDIOCtrl;
3588 P_SW_RFB_T prSwRfb = (P_SW_RFB_T) NULL;
3589 UINT_32 u4RxLength;
3590 UINT_32 i, rxNum;
3591 UINT_32 u4RxAggCount = 0, u4RxAggLength = 0;
3592 UINT_32 u4RxAvailAggLen, u4CurrAvailFreeRfbCnt;
3593 PUINT_8 pucSrcAddr;
3594 P_HW_MAC_RX_DESC_T prRxStatus;
3595 BOOL fgResult = TRUE;
3596 BOOLEAN fgIsRxEnhanceMode;
3597 UINT_16 u2RxPktNum;
3598 #if CFG_SDIO_RX_ENHANCE
3599 UINT_32 u4MaxLoopCount = CFG_MAX_RX_ENHANCE_LOOP_COUNT;
3600 #endif
3601
3602 KAL_SPIN_LOCK_DECLARATION();
3603
3604 DEBUGFUNC("nicRxSDIOAggReceiveRFBs");
3605
3606 ASSERT(prAdapter);
3607 prEnhDataStr = prAdapter->prSDIOCtrl;
3608 prRxCtrl = &prAdapter->rRxCtrl;
3609 prSDIOCtrl = prAdapter->prSDIOCtrl;
3610
3611 #if CFG_SDIO_RX_ENHANCE
3612 fgIsRxEnhanceMode = TRUE;
3613 #else
3614 fgIsRxEnhanceMode = FALSE;
3615 #endif
3616
3617 do {
3618 #if CFG_SDIO_RX_ENHANCE
3619 /* to limit maximum loop for RX */
3620 u4MaxLoopCount--;
3621 if (u4MaxLoopCount == 0) {
3622 break;
3623 }
3624 #endif
3625
3626 if (prEnhDataStr->rRxInfo.u.u2NumValidRx0Len == 0 &&
3627 prEnhDataStr->rRxInfo.u.u2NumValidRx1Len == 0) {
3628 break;
3629 }
3630
3631 for (rxNum = 0; rxNum < 2; rxNum++) {
3632 u2RxPktNum =
3633 (rxNum ==
3634 0 ? prEnhDataStr->rRxInfo.u.u2NumValidRx0Len : prEnhDataStr->rRxInfo.u.
3635 u2NumValidRx1Len);
3636
3637 /* if this assertion happened, it is most likely a F/W bug */
3638 ASSERT(u2RxPktNum <= 16);
3639
3640 if (u2RxPktNum > 16)
3641 continue;
3642
3643 if (u2RxPktNum == 0)
3644 continue;
3645
3646 #if CFG_HIF_STATISTICS
3647 prRxCtrl->u4TotalRxAccessNum++;
3648 prRxCtrl->u4TotalRxPacketNum += u2RxPktNum;
3649 #endif
3650
3651 u4CurrAvailFreeRfbCnt = prRxCtrl->rFreeSwRfbList.u4NumElem;
3652
3653 /* if SwRfb is not enough, abort reading this time */
3654 if (u4CurrAvailFreeRfbCnt < u2RxPktNum) {
3655 #if CFG_HIF_RX_STARVATION_WARNING
3656 DbgPrint("FreeRfb is not enough: %d available, need %d\n",
3657 u4CurrAvailFreeRfbCnt, u2RxPktNum);
3658 DbgPrint("Queued Count: %d / Dequeud Count: %d\n",
3659 prRxCtrl->u4QueuedCnt, prRxCtrl->u4DequeuedCnt);
3660 #endif
3661 continue;
3662 }
3663 #if CFG_SDIO_RX_ENHANCE
3664 u4RxAvailAggLen =
3665 CFG_RX_COALESCING_BUFFER_SIZE - (sizeof(ENHANCE_MODE_DATA_STRUCT_T) +
3666 4 /* extra HW padding */);
3667 #else
3668 u4RxAvailAggLen = CFG_RX_COALESCING_BUFFER_SIZE;
3669 #endif
3670 u4RxAggCount = 0;
3671
3672 for (i = 0; i < u2RxPktNum; i++) {
3673 u4RxLength = (rxNum == 0 ?
3674 (UINT_32) prEnhDataStr->rRxInfo.u.au2Rx0Len[i] :
3675 (UINT_32) prEnhDataStr->rRxInfo.u.au2Rx1Len[i]);
3676
3677 if (!u4RxLength) {
3678 ASSERT(0);
3679 break;
3680 }
3681
3682 if (ALIGN_4(u4RxLength + HIF_RX_HW_APPENDED_LEN) < u4RxAvailAggLen) {
3683 if (u4RxAggCount < u4CurrAvailFreeRfbCnt) {
3684 u4RxAvailAggLen -=
3685 ALIGN_4(u4RxLength + HIF_RX_HW_APPENDED_LEN);
3686 u4RxAggCount++;
3687 } else {
3688 /* no FreeSwRfb for rx packet */
3689 DBGLOG(RX, ERROR,
3690 ("[%s] RxAggCount(%d) is greater than AvailableFreeCount(%d)\n",
3691 __func__, u4RxAggCount,
3692 u4CurrAvailFreeRfbCnt));
3693
3694 ASSERT(0);
3695 break;
3696 }
3697 } else {
3698 /* CFG_RX_COALESCING_BUFFER_SIZE is not large enough */
3699 DBGLOG(RX, ERROR,
3700 ("[%s] Request_len(%d) is greater than Available_len(%d)\n",
3701 __func__,
3702 (ALIGN_4(u4RxLength + HIF_RX_HW_APPENDED_LEN)),
3703 u4RxAvailAggLen));
3704 ASSERT(0);
3705 break;
3706 }
3707 }
3708
3709 u4RxAggLength = (CFG_RX_COALESCING_BUFFER_SIZE - u4RxAvailAggLen);
3710 /* DBGLOG(RX, INFO, ("u4RxAggCount = %d, u4RxAggLength = %d\n", */
3711 /* u4RxAggCount, u4RxAggLength)); */
3712
3713 HAL_READ_RX_PORT(prAdapter,
3714 rxNum,
3715 u4RxAggLength,
3716 prRxCtrl->pucRxCoalescingBufPtr,
3717 CFG_RX_COALESCING_BUFFER_SIZE);
3718 if (!fgResult) {
3719 DBGLOG(RX, ERROR, ("Read RX Agg Packet Error\n"));
3720 continue;
3721 }
3722
3723 pucSrcAddr = prRxCtrl->pucRxCoalescingBufPtr;
3724 for (i = 0; i < u4RxAggCount; i++) {
3725 UINT_16 u2PktLength;
3726
3727 u2PktLength = (rxNum == 0 ?
3728 prEnhDataStr->rRxInfo.u.au2Rx0Len[i] :
3729 prEnhDataStr->rRxInfo.u.au2Rx1Len[i]);
3730
3731 if (ALIGN_4(u2PktLength + HIF_RX_HW_APPENDED_LEN) > CFG_RX_MAX_PKT_SIZE) {
3732 DBGLOG(RX, ERROR, ("[%s] Request_len(%d) is greater than CFG_RX_MAX_PKT_SIZE(%d)...Drop the unexpected packet...\n",
3733 __func__,
3734 (ALIGN_4(u2PktLength + HIF_RX_HW_APPENDED_LEN)),
3735 CFG_RX_MAX_PKT_SIZE));
3736 DBGLOG_MEM32(RX, ERROR, pucSrcAddr, ALIGN_4(u2PktLength + HIF_RX_HW_APPENDED_LEN));
3737
3738 pucSrcAddr += ALIGN_4(u2PktLength + HIF_RX_HW_APPENDED_LEN);
3739 RX_INC_CNT(prRxCtrl, RX_DROP_TOTAL_COUNT);
3740 continue;
3741 }
3742
3743 KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_FREE_QUE);
3744 QUEUE_REMOVE_HEAD(&prRxCtrl->rFreeSwRfbList, prSwRfb, P_SW_RFB_T);
3745 KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_FREE_QUE);
3746
3747 ASSERT(prSwRfb);
3748 kalMemCopy(prSwRfb->pucRecvBuff, pucSrcAddr,
3749 ALIGN_4(u2PktLength + HIF_RX_HW_APPENDED_LEN));
3750
3751 /* prHifRxHdr = prSwRfb->prHifRxHdr; */
3752 /* ASSERT(prHifRxHdr); */
3753
3754 prRxStatus = prSwRfb->prRxStatus;
3755 ASSERT(prRxStatus);
3756
3757 prSwRfb->ucPacketType =
3758 (UINT_8) HAL_RX_STATUS_GET_PKT_TYPE(prRxStatus);
3759 /* DBGLOG(RX, TRACE, ("ucPacketType = %d\n", prSwRfb->ucPacketType)); */
3760 #if DBG
3761 DBGLOG(RX, TRACE,
3762 ("Rx status flag = %x wlan index = %d SecMode = %d\n",
3763 prRxStatus->u2StatusFlag, prRxStatus->ucWlanIdx,
3764 HAL_RX_STATUS_GET_SEC_MODE(prRxStatus)));
3765 #endif
3766
3767 KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE);
3768 QUEUE_INSERT_TAIL(&prRxCtrl->rReceivedRfbList, &prSwRfb->rQueEntry);
3769 RX_INC_CNT(prRxCtrl, RX_MPDU_TOTAL_COUNT);
3770 KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE);
3771
3772 pucSrcAddr += ALIGN_4(u2PktLength + HIF_RX_HW_APPENDED_LEN);
3773 /* prEnhDataStr->au4RxLength[i] = 0; */
3774 }
3775
3776 #if CFG_SDIO_RX_ENHANCE
3777 kalMemCopy(prAdapter->prSDIOCtrl, (pucSrcAddr + 4),
3778 sizeof(ENHANCE_MODE_DATA_STRUCT_T));
3779
3780 /* do the same thing what nicSDIOReadIntStatus() does */
3781 if ((prSDIOCtrl->u4WHISR & WHISR_TX_DONE_INT) == 0 &&
3782 (prSDIOCtrl->rTxInfo.au4WTSR[0] | prSDIOCtrl->rTxInfo.au4WTSR[1])) {
3783 prSDIOCtrl->u4WHISR |= WHISR_TX_DONE_INT;
3784 }
3785
3786 if ((prSDIOCtrl->u4WHISR & BIT(31)) == 0 &&
3787 HAL_GET_MAILBOX_READ_CLEAR(prAdapter) == TRUE &&
3788 (prSDIOCtrl->u4RcvMailbox0 != 0 || prSDIOCtrl->u4RcvMailbox1 != 0)) {
3789 prSDIOCtrl->u4WHISR |= BIT(31);
3790 }
3791
3792 /* dispatch to interrupt handler with RX bits masked */
3793 nicProcessIST_impl(prAdapter,
3794 prSDIOCtrl->
3795 u4WHISR & (~(WHISR_RX0_DONE_INT | WHISR_RX1_DONE_INT)));
3796 #endif
3797 }
3798
3799 #if !CFG_SDIO_RX_ENHANCE
3800 prEnhDataStr->rRxInfo.u.u2NumValidRx0Len = 0;
3801 prEnhDataStr->rRxInfo.u.u2NumValidRx1Len = 0;
3802 #endif
3803 } while ((prEnhDataStr->rRxInfo.u.u2NumValidRx0Len
3804 || prEnhDataStr->rRxInfo.u.u2NumValidRx1Len)
3805 && fgIsRxEnhanceMode);
3806
3807 return;
3808 }
3809 #endif /* CFG_SDIO_RX_AGG */
3810
3811
3812 /*----------------------------------------------------------------------------*/
3813 /*!
3814 * @brief Setup a RFB and allocate the os packet to the RFB
3815 *
3816 * @param prAdapter Pointer to the Adapter structure.
3817 * @param prSwRfb Pointer to the RFB
3818 *
3819 * @retval WLAN_STATUS_SUCCESS
3820 * @retval WLAN_STATUS_RESOURCES
3821 */
3822 /*----------------------------------------------------------------------------*/
3823 WLAN_STATUS nicRxSetupRFB(IN P_ADAPTER_T prAdapter, IN P_SW_RFB_T prSwRfb)
3824 {
3825 PVOID pvPacket;
3826 PUINT_8 pucRecvBuff;
3827
3828 ASSERT(prAdapter);
3829 ASSERT(prSwRfb);
3830
3831 if (!prSwRfb->pvPacket) {
3832 kalMemZero(prSwRfb, sizeof(SW_RFB_T));
3833 pvPacket = kalPacketAlloc(prAdapter->prGlueInfo, CFG_RX_MAX_PKT_SIZE, &pucRecvBuff);
3834 if (pvPacket == NULL) {
3835 return WLAN_STATUS_RESOURCES;
3836 }
3837
3838 prSwRfb->pvPacket = pvPacket;
3839 prSwRfb->pucRecvBuff = (PVOID) pucRecvBuff;
3840 } else {
3841 kalMemZero(((PUINT_8) prSwRfb + OFFSET_OF(SW_RFB_T, prRxStatus)),
3842 (sizeof(SW_RFB_T) - OFFSET_OF(SW_RFB_T, prRxStatus)));
3843 }
3844
3845 /* ToDo: remove prHifRxHdr */
3846 /* prSwRfb->prHifRxHdr = (P_HIF_RX_HEADER_T)(prSwRfb->pucRecvBuff); */
3847 prSwRfb->prRxStatus = (P_HW_MAC_RX_DESC_T) (prSwRfb->pucRecvBuff);
3848
3849 return WLAN_STATUS_SUCCESS;
3850
3851 } /* end of nicRxSetupRFB() */
3852
3853
3854 /*----------------------------------------------------------------------------*/
3855 /*!
3856 * @brief This routine is called to put a RFB back onto the "RFB with Buffer" list
3857 * or "RFB without buffer" list according to pvPacket.
3858 *
3859 * @param prAdapter Pointer to the Adapter structure.
3860 * @param prSwRfb Pointer to the RFB
3861 *
3862 * @return (none)
3863 */
3864 /*----------------------------------------------------------------------------*/
3865 VOID nicRxReturnRFB(IN P_ADAPTER_T prAdapter, IN P_SW_RFB_T prSwRfb)
3866 {
3867 P_RX_CTRL_T prRxCtrl;
3868 P_QUE_ENTRY_T prQueEntry;
3869 KAL_SPIN_LOCK_DECLARATION();
3870
3871 ASSERT(prAdapter);
3872 ASSERT(prSwRfb);
3873 prRxCtrl = &prAdapter->rRxCtrl;
3874 prQueEntry = &prSwRfb->rQueEntry;
3875
3876 ASSERT(prQueEntry);
3877
3878 /* The processing on this RFB is done, so put it back on the tail of
3879 our list */
3880 KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_FREE_QUE);
3881
3882 if (prSwRfb->pvPacket) {
3883 QUEUE_INSERT_TAIL(&prRxCtrl->rFreeSwRfbList, prQueEntry);
3884 } else {
3885 QUEUE_INSERT_TAIL(&prRxCtrl->rIndicatedRfbList, prQueEntry);
3886 }
3887
3888 KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_FREE_QUE);
3889 return;
3890 } /* end of nicRxReturnRFB() */
3891
3892 /*----------------------------------------------------------------------------*/
3893 /*!
3894 * @brief Process rx interrupt. When the rx
3895 * Interrupt is asserted, it means there are frames in queue.
3896 *
3897 * @param prAdapter Pointer to the Adapter structure.
3898 *
3899 * @return (none)
3900 */
3901 /*----------------------------------------------------------------------------*/
3902 VOID nicProcessRxInterrupt(IN P_ADAPTER_T prAdapter)
3903 {
3904 ASSERT(prAdapter);
3905
3906 #if CFG_SDIO_INTR_ENHANCE
3907 #if CFG_SDIO_RX_AGG
3908 nicRxSDIOAggReceiveRFBs(prAdapter);
3909 #else
3910 nicRxSDIOReceiveRFBs(prAdapter);
3911 #endif
3912 #else
3913 nicRxReceiveRFBs(prAdapter);
3914 #endif /* CFG_SDIO_INTR_ENHANCE */
3915
3916 #if CFG_SUPPORT_MULTITHREAD
3917 set_bit(GLUE_FLAG_RX_BIT, &(prAdapter->prGlueInfo->ulFlag));
3918 wake_up_interruptible(&(prAdapter->prGlueInfo->waitq));
3919 #else
3920 nicRxProcessRFBs(prAdapter);
3921 #endif
3922
3923 return;
3924
3925 } /* end of nicProcessRxInterrupt() */
3926
3927
3928 #if CFG_TCP_IP_CHKSUM_OFFLOAD
3929 /*----------------------------------------------------------------------------*/
3930 /*!
3931 * @brief Used to update IP/TCP/UDP checksum statistics of RX Module.
3932 *
3933 * @param prAdapter Pointer to the Adapter structure.
3934 * @param aeCSUM The array of checksum result.
3935 *
3936 * @return (none)
3937 */
3938 /*----------------------------------------------------------------------------*/
3939 VOID nicRxUpdateCSUMStatistics(IN P_ADAPTER_T prAdapter, IN const ENUM_CSUM_RESULT_T aeCSUM[]
3940 )
3941 {
3942 P_RX_CTRL_T prRxCtrl;
3943
3944 ASSERT(prAdapter);
3945 ASSERT(aeCSUM);
3946
3947 prRxCtrl = &prAdapter->rRxCtrl;
3948 ASSERT(prRxCtrl);
3949
3950 if ((aeCSUM[CSUM_TYPE_IPV4] == CSUM_RES_SUCCESS) ||
3951 (aeCSUM[CSUM_TYPE_IPV6] == CSUM_RES_SUCCESS)) {
3952
3953 RX_INC_CNT(prRxCtrl, RX_CSUM_IP_SUCCESS_COUNT);
3954 } else if ((aeCSUM[CSUM_TYPE_IPV4] == CSUM_RES_FAILED) ||
3955 (aeCSUM[CSUM_TYPE_IPV6] == CSUM_RES_FAILED)) {
3956
3957 RX_INC_CNT(prRxCtrl, RX_CSUM_IP_FAILED_COUNT);
3958 } else if ((aeCSUM[CSUM_TYPE_IPV4] == CSUM_RES_NONE) &&
3959 (aeCSUM[CSUM_TYPE_IPV6] == CSUM_RES_NONE)) {
3960
3961 RX_INC_CNT(prRxCtrl, RX_CSUM_UNKNOWN_L3_PKT_COUNT);
3962 } else {
3963 ASSERT(0);
3964 }
3965
3966 if (aeCSUM[CSUM_TYPE_TCP] == CSUM_RES_SUCCESS) {
3967 RX_INC_CNT(prRxCtrl, RX_CSUM_TCP_SUCCESS_COUNT);
3968 } else if (aeCSUM[CSUM_TYPE_TCP] == CSUM_RES_FAILED) {
3969 RX_INC_CNT(prRxCtrl, RX_CSUM_TCP_FAILED_COUNT);
3970 } else if (aeCSUM[CSUM_TYPE_UDP] == CSUM_RES_SUCCESS) {
3971 RX_INC_CNT(prRxCtrl, RX_CSUM_UDP_SUCCESS_COUNT);
3972 } else if (aeCSUM[CSUM_TYPE_UDP] == CSUM_RES_FAILED) {
3973 RX_INC_CNT(prRxCtrl, RX_CSUM_UDP_FAILED_COUNT);
3974 } else if ((aeCSUM[CSUM_TYPE_UDP] == CSUM_RES_NONE) &&
3975 (aeCSUM[CSUM_TYPE_TCP] == CSUM_RES_NONE)) {
3976
3977 RX_INC_CNT(prRxCtrl, RX_CSUM_UNKNOWN_L4_PKT_COUNT);
3978 } else {
3979 ASSERT(0);
3980 }
3981
3982 return;
3983 } /* end of nicRxUpdateCSUMStatistics() */
3984 #endif /* CFG_TCP_IP_CHKSUM_OFFLOAD */
3985
3986
3987 /*----------------------------------------------------------------------------*/
3988 /*!
3989 * @brief This function is used to query current status of RX Module.
3990 *
3991 * @param prAdapter Pointer to the Adapter structure.
3992 * @param pucBuffer Pointer to the message buffer.
3993 * @param pu4Count Pointer to the buffer of message length count.
3994 *
3995 * @return (none)
3996 */
3997 /*----------------------------------------------------------------------------*/
3998 VOID nicRxQueryStatus(IN P_ADAPTER_T prAdapter, IN PUINT_8 pucBuffer, OUT PUINT_32 pu4Count)
3999 {
4000 P_RX_CTRL_T prRxCtrl;
4001 PUINT_8 pucCurrBuf = pucBuffer;
4002
4003
4004 ASSERT(prAdapter);
4005 prRxCtrl = &prAdapter->rRxCtrl;
4006 ASSERT(prRxCtrl);
4007
4008 /* if (pucBuffer) {} *//* For Windows, we'll print directly instead of sprintf() */
4009 ASSERT(pu4Count);
4010
4011 SPRINTF(pucCurrBuf, ("\n\nRX CTRL STATUS:"));
4012 SPRINTF(pucCurrBuf, ("\n==============="));
4013 SPRINTF(pucCurrBuf, ("\nFREE RFB w/i BUF LIST :%9ld", prRxCtrl->rFreeSwRfbList.u4NumElem));
4014 SPRINTF(pucCurrBuf,
4015 ("\nFREE RFB w/o BUF LIST :%9ld", prRxCtrl->rIndicatedRfbList.u4NumElem));
4016 SPRINTF(pucCurrBuf,
4017 ("\nRECEIVED RFB LIST :%9ld", prRxCtrl->rReceivedRfbList.u4NumElem));
4018
4019 SPRINTF(pucCurrBuf, ("\n\n"));
4020
4021 /* *pu4Count = (UINT_32)((UINT_32)pucCurrBuf - (UINT_32)pucBuffer); */
4022
4023 return;
4024 } /* end of nicRxQueryStatus() */
4025
4026
4027 /*----------------------------------------------------------------------------*/
4028 /*!
4029 * @brief Clear RX related counters
4030 *
4031 * @param prAdapter Pointer of Adapter Data Structure
4032 *
4033 * @return - (none)
4034 */
4035 /*----------------------------------------------------------------------------*/
4036 VOID nicRxClearStatistics(IN P_ADAPTER_T prAdapter)
4037 {
4038 P_RX_CTRL_T prRxCtrl;
4039
4040 ASSERT(prAdapter);
4041 prRxCtrl = &prAdapter->rRxCtrl;
4042 ASSERT(prRxCtrl);
4043
4044 RX_RESET_ALL_CNTS(prRxCtrl);
4045 return;
4046 }
4047
4048
4049 /*----------------------------------------------------------------------------*/
4050 /*!
4051 * @brief This function is used to query current statistics of RX Module.
4052 *
4053 * @param prAdapter Pointer to the Adapter structure.
4054 * @param pucBuffer Pointer to the message buffer.
4055 * @param pu4Count Pointer to the buffer of message length count.
4056 *
4057 * @return (none)
4058 */
4059 /*----------------------------------------------------------------------------*/
4060 VOID nicRxQueryStatistics(IN P_ADAPTER_T prAdapter, IN PUINT_8 pucBuffer, OUT PUINT_32 pu4Count)
4061 {
4062 P_RX_CTRL_T prRxCtrl;
4063 PUINT_8 pucCurrBuf = pucBuffer;
4064
4065 ASSERT(prAdapter);
4066 prRxCtrl = &prAdapter->rRxCtrl;
4067 ASSERT(prRxCtrl);
4068
4069 /* if (pucBuffer) {} *//* For Windows, we'll print directly instead of sprintf() */
4070 ASSERT(pu4Count);
4071
4072 #define SPRINTF_RX_COUNTER(eCounter) \
4073 SPRINTF(pucCurrBuf, ("%-30s : %ld\n", #eCounter, (UINT_32)prRxCtrl->au8Statistics[eCounter]))
4074
4075 SPRINTF_RX_COUNTER(RX_MPDU_TOTAL_COUNT);
4076 SPRINTF_RX_COUNTER(RX_SIZE_ERR_DROP_COUNT);
4077 SPRINTF_RX_COUNTER(RX_DATA_INDICATION_COUNT);
4078 SPRINTF_RX_COUNTER(RX_DATA_RETURNED_COUNT);
4079 SPRINTF_RX_COUNTER(RX_DATA_RETAINED_COUNT);
4080
4081 #if CFG_TCP_IP_CHKSUM_OFFLOAD || CFG_TCP_IP_CHKSUM_OFFLOAD_NDIS_60
4082 SPRINTF_RX_COUNTER(RX_CSUM_TCP_FAILED_COUNT);
4083 SPRINTF_RX_COUNTER(RX_CSUM_UDP_FAILED_COUNT);
4084 SPRINTF_RX_COUNTER(RX_CSUM_IP_FAILED_COUNT);
4085 SPRINTF_RX_COUNTER(RX_CSUM_TCP_SUCCESS_COUNT);
4086 SPRINTF_RX_COUNTER(RX_CSUM_UDP_SUCCESS_COUNT);
4087 SPRINTF_RX_COUNTER(RX_CSUM_IP_SUCCESS_COUNT);
4088 SPRINTF_RX_COUNTER(RX_CSUM_UNKNOWN_L4_PKT_COUNT);
4089 SPRINTF_RX_COUNTER(RX_CSUM_UNKNOWN_L3_PKT_COUNT);
4090 SPRINTF_RX_COUNTER(RX_IP_V6_PKT_CCOUNT);
4091 #endif
4092
4093 /* *pu4Count = (UINT_32)(pucCurrBuf - pucBuffer); */
4094
4095 nicRxClearStatistics(prAdapter);
4096
4097 return;
4098 }
4099
4100 /*----------------------------------------------------------------------------*/
4101 /*!
4102 * @brief Read the Response data from data port
4103 *
4104 * @param prAdapter pointer to the Adapter handler
4105 * @param pucRspBuffer pointer to the Response buffer
4106 *
4107 * @retval WLAN_STATUS_SUCCESS: Response packet has been read
4108 * @retval WLAN_STATUS_FAILURE: Read Response packet timeout or error occurred
4109 *
4110 */
4111 /*----------------------------------------------------------------------------*/
4112 WLAN_STATUS
4113 nicRxWaitResponse(IN P_ADAPTER_T prAdapter,
4114 IN UINT_8 ucPortIdx,
4115 OUT PUINT_8 pucRspBuffer, IN UINT_32 u4MaxRespBufferLen, OUT PUINT_32 pu4Length)
4116 {
4117 UINT_32 u4Value = 0, u4PktLen = 0, i = 0;
4118 WLAN_STATUS u4Status = WLAN_STATUS_SUCCESS;
4119 BOOL fgResult = TRUE;
4120 UINT_32 u4Time, u4Current;
4121 P_RX_CTRL_T prRxCtrl;
4122 P_WIFI_EVENT_T prEvent;
4123
4124 DEBUGFUNC("nicRxWaitResponse");
4125
4126 ASSERT(prAdapter);
4127 ASSERT(pucRspBuffer);
4128 ASSERT(ucPortIdx < 2);
4129
4130 prRxCtrl = &prAdapter->rRxCtrl;
4131
4132 u4Time = (UINT_32) kalGetTimeTick();
4133
4134 do {
4135 /* Read the packet length */
4136 HAL_MCR_RD(prAdapter, MCR_WRPLR, &u4Value);
4137
4138 if (!fgResult) {
4139 DBGLOG(RX, ERROR, ("Read Response Packet Error\n"));
4140 return WLAN_STATUS_FAILURE;
4141 }
4142
4143 if (ucPortIdx == 0) {
4144 u4PktLen = u4Value & 0xFFFF;
4145 } else {
4146 u4PktLen = (u4Value >> 16) & 0xFFFF;
4147 }
4148
4149 DBGLOG(RX, TRACE, ("i = %lu, u4PktLen = %lu\n", i, u4PktLen));
4150
4151 if (u4PktLen == 0) {
4152 /* timeout exceeding check */
4153 u4Current = (UINT_32) kalGetTimeTick();
4154
4155 if ((u4Current > u4Time) && ((u4Current - u4Time) > RX_RESPONSE_TIMEOUT)) {
4156 return WLAN_STATUS_FAILURE;
4157 } else if (u4Current < u4Time
4158 && ((u4Current + (0xFFFFFFFF - u4Time)) > RX_RESPONSE_TIMEOUT)) {
4159 return WLAN_STATUS_FAILURE;
4160 }
4161
4162 /* Response packet is not ready */
4163 kalUdelay(50);
4164
4165 i++;
4166 } else if (u4PktLen > u4MaxRespBufferLen) {
4167 DBGLOG(RX, WARN,
4168 ("Not enough Event Buffer: required length = 0x%lx, available buffer length = %lu\n",
4169 u4PktLen, u4MaxRespBufferLen));
4170
4171 return WLAN_STATUS_FAILURE;
4172 } else {
4173 #if (CFG_ENABLE_READ_EXTRA_4_BYTES == 1)
4174 #if CFG_SDIO_RX_AGG
4175 HAL_PORT_RD(prAdapter,
4176 ucPortIdx == 0 ? MCR_WRDR0 : MCR_WRDR1,
4177 ALIGN_4(u4PktLen + 4),
4178 prRxCtrl->pucRxCoalescingBufPtr, CFG_RX_COALESCING_BUFFER_SIZE);
4179 kalMemCopy(pucRspBuffer, prRxCtrl->pucRxCoalescingBufPtr, u4PktLen);
4180 #else
4181 #error "Please turn on RX coalescing"
4182 #endif
4183 #else
4184 HAL_PORT_RD(prAdapter,
4185 ucPortIdx == 0 ? MCR_WRDR0 : MCR_WRDR1,
4186 u4PktLen, pucRspBuffer, u4MaxRespBufferLen);
4187 #endif
4188
4189 /* fgResult will be updated in MACRO */
4190 if (!fgResult) {
4191 DBGLOG(RX, ERROR, ("Read Response Packet Error\n"));
4192 return WLAN_STATUS_FAILURE;
4193 }
4194
4195 DBGLOG(RX, TRACE, ("Dump Response buffer, length = 0x%lx\n", u4PktLen));
4196 DBGLOG_MEM8(RX, TRACE, pucRspBuffer, u4PktLen);
4197
4198 prEvent = (P_WIFI_EVENT_T) pucRspBuffer;
4199 DBGLOG(INIT, TRACE, ("RX EVENT: ID[0x%02X] SEQ[%u] LEN[%u]\n",
4200 prEvent->ucEID,
4201 prEvent->ucSeqNum, prEvent->u2PacketLength));
4202
4203 *pu4Length = u4PktLen;
4204 break;
4205 }
4206 } while (TRUE);
4207
4208 return u4Status;
4209 }
4210
4211 /*----------------------------------------------------------------------------*/
4212 /*!
4213 * @brief Set filter to enable Promiscuous Mode
4214 *
4215 * @param prAdapter Pointer to the Adapter structure.
4216 *
4217 * @return (none)
4218 */
4219 /*----------------------------------------------------------------------------*/
4220 VOID nicRxEnablePromiscuousMode(IN P_ADAPTER_T prAdapter)
4221 {
4222 ASSERT(prAdapter);
4223
4224 return;
4225 } /* end of nicRxEnablePromiscuousMode() */
4226
4227
4228 /*----------------------------------------------------------------------------*/
4229 /*!
4230 * @brief Set filter to disable Promiscuous Mode
4231 *
4232 * @param prAdapter Pointer to the Adapter structure.
4233 *
4234 * @return (none)
4235 */
4236 /*----------------------------------------------------------------------------*/
4237 VOID nicRxDisablePromiscuousMode(IN P_ADAPTER_T prAdapter)
4238 {
4239 ASSERT(prAdapter);
4240
4241 return;
4242 } /* end of nicRxDisablePromiscuousMode() */
4243
4244
4245 /*----------------------------------------------------------------------------*/
4246 /*!
4247 * @brief this function flushes all packets queued in reordering module
4248 *
4249 * @param prAdapter Pointer to the Adapter structure.
4250 *
4251 * @retval WLAN_STATUS_SUCCESS Flushed successfully
4252 */
4253 /*----------------------------------------------------------------------------*/
4254 WLAN_STATUS nicRxFlush(IN P_ADAPTER_T prAdapter)
4255 {
4256 P_SW_RFB_T prSwRfb;
4257
4258 ASSERT(prAdapter);
4259 prSwRfb = qmFlushRxQueues(prAdapter);
4260 if (prSwRfb != NULL) {
4261 do {
4262 P_SW_RFB_T prNextSwRfb;
4263
4264 /* save next first */
4265 prNextSwRfb = (P_SW_RFB_T) QUEUE_GET_NEXT_ENTRY((P_QUE_ENTRY_T) prSwRfb);
4266
4267 /* free */
4268 nicRxReturnRFB(prAdapter, prSwRfb);
4269
4270 prSwRfb = prNextSwRfb;
4271 } while (prSwRfb);
4272 }
4273
4274 return WLAN_STATUS_SUCCESS;
4275 }
4276
4277
4278 /*----------------------------------------------------------------------------*/
4279 /*!
4280 * @brief
4281 *
4282 * @param
4283 *
4284 * @retval
4285 */
4286 /*----------------------------------------------------------------------------*/
4287 WLAN_STATUS nicRxProcessActionFrame(IN P_ADAPTER_T prAdapter, IN P_SW_RFB_T prSwRfb)
4288 {
4289 P_WLAN_ACTION_FRAME prActFrame;
4290 #if CFG_SUPPORT_802_11W
4291 BOOL fgRobustAction = FALSE;
4292 P_AIS_SPECIFIC_BSS_INFO_T prAisSpecBssInfo;
4293 #endif
4294
4295 ASSERT(prAdapter);
4296 ASSERT(prSwRfb);
4297
4298 DBGLOG(RSN, TRACE, ("[Rx] nicRxProcessActionFrame\n"));
4299
4300 if (prSwRfb->u2PacketLen < sizeof(WLAN_ACTION_FRAME) - 1) {
4301 return WLAN_STATUS_INVALID_PACKET;
4302 }
4303 prActFrame = (P_WLAN_ACTION_FRAME) prSwRfb->pvHeader;
4304
4305 /* DBGLOG(RSN, TRACE, ("[Rx] nicRxProcessActionFrame\n")); */
4306
4307 #if CFG_SUPPORT_802_11W
4308 if ((prActFrame->ucCategory <= CATEGORY_PROTECTED_DUAL_OF_PUBLIC_ACTION &&
4309 prActFrame->ucCategory != CATEGORY_PUBLIC_ACTION &&
4310 prActFrame->ucCategory != CATEGORY_HT_ACTION) /* At 11W spec Code 7 is reserved */ ||
4311 (prActFrame->ucCategory == CATEGORY_VENDOR_SPECIFIC_ACTION_PROTECTED)) {
4312 fgRobustAction = TRUE;
4313 }
4314 /* DBGLOG(RSN, TRACE, ("[Rx] fgRobustAction=%d\n", fgRobustAction)); */
4315
4316 if (fgRobustAction && prSwRfb->prStaRec &&
4317 GET_BSS_INFO_BY_INDEX(prAdapter,
4318 prSwRfb->prStaRec->ucBssIndex)->eNetworkType ==
4319 NETWORK_TYPE_AIS) {
4320 prAisSpecBssInfo = &(prAdapter->rWifiVar.rAisSpecificBssInfo);
4321
4322 DBGLOG(RSN, INFO,
4323 ("[Rx]RobustAction %x %x %x\n", prSwRfb->prRxStatus->u2StatusFlag,
4324 prSwRfb->prRxStatus->ucWlanIdx, prSwRfb->prRxStatus->ucTidSecMode));
4325
4326 if (prAisSpecBssInfo->fgMgmtProtection
4327 && (!(prActFrame->u2FrameCtrl & MASK_FC_PROTECTED_FRAME)
4328 && (HAL_RX_STATUS_GET_SEC_MODE(prSwRfb->prRxStatus) ==
4329 CIPHER_SUITE_CCMP))) {
4330 DBGLOG(RSN, INFO,
4331 ("[MFP] Not handle and drop un-protected robust action frame!!\n"));
4332 return WLAN_STATUS_INVALID_PACKET;
4333 }
4334 }
4335 /* DBGLOG(RSN, TRACE, ("[Rx] pre check done, handle cateory %d\n", prActFrame->ucCategory)); */
4336 #endif
4337
4338 switch (prActFrame->ucCategory) {
4339 #if CFG_M0VE_BA_TO_DRIVER
4340 case CATEGORY_BLOCK_ACK_ACTION:
4341 DBGLOG(RX, WARN, ("[Puff][%s] Rx CATEGORY_BLOCK_ACK_ACTION\n", __func__));
4342
4343 if (prSwRfb->prStaRec) {
4344 mqmHandleBaActionFrame(prAdapter, prSwRfb);
4345 }
4346
4347 break;
4348 #endif
4349 case CATEGORY_PUBLIC_ACTION:
4350 #if 0 /* CFG_SUPPORT_802_11W */
4351 /* Sigma */
4352 #else
4353 if (prAdapter->prAisBssInfo &&
4354 prSwRfb->prStaRec &&
4355 prSwRfb->prStaRec->ucBssIndex == prAdapter->prAisBssInfo->ucBssIndex) {
4356 aisFuncValidateRxActionFrame(prAdapter, prSwRfb);
4357 }
4358 #endif
4359
4360 if (prAdapter->prAisBssInfo &&
4361 prAdapter->prAisBssInfo->ucBssIndex == KAL_NETWORK_TYPE_AIS_INDEX) {
4362 aisFuncValidateRxActionFrame(prAdapter, prSwRfb);
4363 }
4364 #if CFG_ENABLE_WIFI_DIRECT
4365 if (prAdapter->fgIsP2PRegistered) {
4366 rlmProcessPublicAction(prAdapter, prSwRfb);
4367
4368 p2pFuncValidateRxActionFrame(prAdapter, prSwRfb);
4369
4370 }
4371 #endif
4372 break;
4373
4374 case CATEGORY_HT_ACTION:
4375 #if CFG_ENABLE_WIFI_DIRECT
4376 if (prAdapter->fgIsP2PRegistered) {
4377 rlmProcessHtAction(prAdapter, prSwRfb);
4378 }
4379 #endif
4380 break;
4381 case CATEGORY_VENDOR_SPECIFIC_ACTION:
4382 #if CFG_ENABLE_WIFI_DIRECT
4383 if (prAdapter->fgIsP2PRegistered) {
4384 p2pFuncValidateRxActionFrame(prAdapter, prSwRfb);
4385 }
4386 #endif
4387 break;
4388 #if CFG_SUPPORT_802_11W
4389 case CATEGORY_SA_QUERY_ACTION:
4390 {
4391 P_BSS_INFO_T prBssInfo;
4392
4393 if (prSwRfb->prStaRec) {
4394 prBssInfo =
4395 GET_BSS_INFO_BY_INDEX(prAdapter, prSwRfb->prStaRec->ucBssIndex);
4396 ASSERT(prBssInfo);
4397 if ((prBssInfo->eNetworkType == NETWORK_TYPE_AIS) &&
4398 prAdapter->rWifiVar.rAisSpecificBssInfo.
4399 fgMgmtProtection /* Use MFP */) {
4400 /* MFP test plan 5.3.3.4 */
4401 rsnSaQueryAction(prAdapter, prSwRfb);
4402 }
4403 }
4404 }
4405 break;
4406 #endif
4407 #if CFG_SUPPORT_802_11V
4408 case CATEGORY_WNM_ACTION:
4409 {
4410 wnmWNMAction(prAdapter, prSwRfb);
4411 }
4412 break;
4413 #endif
4414
4415 #if CFG_SUPPORT_DFS
4416 case CATEGORY_SPEC_MGT:
4417 {
4418 //if (prAdapter->fgEnable5GBand) {
4419 DBGLOG(RLM, INFO, ("[Channel Switch]nicRxProcessActionFrame\n"));
4420 //rlmProcessSpecMgtAction(prAdapter, prSwRfb);
4421
4422 //}
4423 }
4424 break;
4425 #endif
4426 default:
4427 break;
4428 } /* end of switch case */
4429
4430
4431 return WLAN_STATUS_SUCCESS;
4432 }