import PULS_20160108
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / misc / mediatek / connectivity / conn_soc / drv_wlan / mt_wifi / wlan / nic / nic_cmd_event.c
CommitLineData
6fa3eb70
S
1/*
2** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/nic/nic_cmd_event.c#1 $
3*/
4
5/*! \file nic_cmd_event.c
6 \brief Callback functions for Command packets.
7
8 Various Event packet handlers which will be setup in the callback function of
9 a command packet.
10*/
11
12
13
14/*
15** $Log: nic_cmd_event.c $
16 *
17 * 04 10 2012 yuche.tsai
18 * NULL
19 * Update address for wifi direct connection issue.
20 *
21 * 06 15 2011 cm.chang
22 * [WCXRP00000785] [MT6620 Wi-Fi][Driver][FW] P2P/BOW MAC address is XOR with AIS MAC address
23 * P2P/BOW mac address XOR with local bit instead of OR
24 *
25 * 03 05 2011 wh.su
26 * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code
27 * add the code to get the check rsponse and indicate to app.
28 *
29 * 03 02 2011 wh.su
30 * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code
31 * Add security check code.
32 *
33 * 02 24 2011 cp.wu
34 * [WCXRP00000493] [MT6620 Wi-Fi][Driver] Do not indicate redundant disconnection to host when entering into RF test mode
35 * only indicate DISCONNECTION to host when entering RF test if necessary (connected -> disconnected cases)
36 *
37 * 01 20 2011 eddie.chen
38 * [WCXRP00000374] [MT6620 Wi-Fi][DRV] SW debug control
39 * Add Oid for sw control debug command
40 *
41 * 12 31 2010 cp.wu
42 * [WCXRP00000335] [MT6620 Wi-Fi][Driver] change to use milliseconds sleep instead of delay to avoid blocking to system scheduling
43 * change to use msleep() and shorten waiting interval to reduce blocking to other task while Wi-Fi driver is being loaded
44 *
45 * 12 01 2010 cp.wu
46 * [WCXRP00000223] MT6620 Wi-Fi][Driver][FW] Adopt NVRAM parameters when enter/exit RF test mode
47 * reload NVRAM settings before entering RF test mode and leaving from RF test mode.
48 *
49 * 11 01 2010 cp.wu
50 * [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
51 * 1) Query link speed (TX rate) from firmware directly with buffering mechanism to reduce overhead
52 * 2) Remove CNM CH-RECOVER event handling
53 * 3) cfg read/write API renamed with kal prefix for unified naming rules.
54 *
55 * 10 20 2010 cp.wu
56 * [WCXRP00000117] [MT6620 Wi-Fi][Driver] Add logic for suspending driver when MT6620 is not responding anymore
57 * use OID_CUSTOM_TEST_MODE as indication for driver reset
58 * by dropping pending TX packets
59 *
60 * 10 18 2010 cp.wu
61 * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000086] [MT6620 Wi-Fi][Driver] The mac address is all zero at android
62 * complete implementation of Android NVRAM access
63 *
64 * 09 21 2010 cp.wu
65 * [WCXRP00000053] [MT6620 Wi-Fi][Driver] Reset incomplete and might leads to BSOD when entering RF test with AIS associated
66 * Do a complete reset with STA-REC null checking for RF test re-entry
67 *
68 * 09 15 2010 yuche.tsai
69 * NULL
70 * Start to test AT GO only when P2P state is not IDLE.
71 *
72 * 09 09 2010 yuche.tsai
73 * NULL
74 * Add AT GO Test mode after MAC address available.
75 *
76 * 09 03 2010 kevin.huang
77 * NULL
78 * Refine #include sequence and solve recursive/nested #include issue
79 *
80 * 08 30 2010 cp.wu
81 * NULL
82 * eliminate klockwork errors
83 *
84 * 08 16 2010 cp.wu
85 * NULL
86 * Replace CFG_SUPPORT_BOW by CFG_ENABLE_BT_OVER_WIFI.
87 * There is no CFG_SUPPORT_BOW in driver domain source.
88 *
89 * 08 12 2010 cp.wu
90 * NULL
91 * [AIS-FSM] honor registry setting for adhoc running mode. (A/B/G)
92 *
93 * 08 11 2010 yuche.tsai
94 * NULL
95 * Add support for P2P Device Address query from FW.
96 *
97 * 08 03 2010 cp.wu
98 * NULL
99 * Centralize mgmt/system service procedures into independent calls.
100 *
101 * 08 02 2010 cp.wu
102 * NULL
103 * reset FSMs before entering RF test mode.
104 *
105 * 07 22 2010 cp.wu
106 *
107 * 1) refine AIS-FSM indent.
108 * 2) when entering RF Test mode, flush 802.1X frames as well
109 * 3) when entering D3 state, flush 802.1X frames as well
110 *
111 * 07 08 2010 cp.wu
112 *
113 * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
114 *
115 * 07 05 2010 cp.wu
116 * [WPD00003833][MT6620 and MT5931] Driver migration
117 * 1) change fake BSS_DESC from channel 6 to channel 1 due to channel switching is not done yet.
118 * 2) after MAC address is queried from firmware, all related variables in driver domain should be updated as well
119 *
120 * 06 21 2010 wh.su
121 * [WPD00003840][MT6620 5931] Security migration
122 * remove duplicate variable for migration.
123 *
124 * 06 06 2010 kevin.huang
125 * [WPD00003832][MT6620 5931] Create driver base
126 * [MT6620 5931] Create driver base
127 *
128 * 05 29 2010 cp.wu
129 * [WPD00001943]Create WiFi test driver framework on WinXP
130 * change upon request: indicate as disconnected in driver domain when leaving from RF test mode
131 *
132 * 05 24 2010 cp.wu
133 * [WPD00001943]Create WiFi test driver framework on WinXP
134 * do not clear scanning list array after disassociation
135 *
136 * 05 22 2010 cp.wu
137 * [WPD00001943]Create WiFi test driver framework on WinXP
138 * 1) disable NETWORK_LAYER_ADDRESSES handling temporally.
139 * 2) finish statistics OIDs
140 *
141 * 05 22 2010 cp.wu
142 * [WPD00001943]Create WiFi test driver framework on WinXP
143 * change OID behavior to meet WHQL requirement.
144 *
145 * 05 20 2010 cp.wu
146 * [WPD00001943]Create WiFi test driver framework on WinXP
147 * 1) integrate OID_GEN_NETWORK_LAYER_ADDRESSES with CMD_ID_SET_IP_ADDRESS
148 * 2) buffer statistics data for 2 seconds
149 * 3) use default value for adhoc parameters instead of 0
150 *
151 * 05 19 2010 cp.wu
152 * [WPD00001943]Create WiFi test driver framework on WinXP
153 * 1) do not take timeout mechanism for power mode oids
154 * 2) retrieve network type from connection status
155 * 3) after disassciation, set radio state to off
156 * 4) TCP option over IPv6 is supported
157 *
158 * 05 17 2010 cp.wu
159 * [WPD00001943]Create WiFi test driver framework on WinXP
160 * correct OID_802_11_DISASSOCIATE handling.
161 *
162 * 05 17 2010 cp.wu
163 * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support
164 * 1) add timeout handler mechanism for pending command packets
165 * 2) add p2p add/removal key
166 *
167 * 04 16 2010 cp.wu
168 * [WPD00001943]Create WiFi test driver framework on WinXP
169 * treat BUS access failure as kind of card removal.
170 *
171 * 04 14 2010 cp.wu
172 * [WPD00001943]Create WiFi test driver framework on WinXP
173 * information buffer for query oid/ioctl is now buffered in prCmdInfo
174 * * * * * * instead of glue-layer variable to improve multiple oid/ioctl capability
175 *
176 * 04 13 2010 cp.wu
177 * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support
178 * add framework for BT-over-Wi-Fi support.
179 * * * * * * * * * * * * * * 1) prPendingCmdInfo is replaced by queue for multiple handler capability
180 * * * * * * * * * * * * * * 2) command sequence number is now increased atomically
181 * * * * * * * * * * * * * * 3) private data could be hold and taken use for other purpose
182 *
183 * 04 07 2010 cp.wu
184 * [WPD00001943]Create WiFi test driver framework on WinXP
185 * accessing to firmware load/start address, and access to OID handling information
186 * are now handled in glue layer
187 *
188 * 04 07 2010 cp.wu
189 * [WPD00001943]Create WiFi test driver framework on WinXP
190 * rWlanInfo should be placed at adapter rather than glue due to most operations
191 * * * * are done in adapter layer.
192 *
193 * 04 06 2010 cp.wu
194 * [WPD00001943]Create WiFi test driver framework on WinXP
195 * add KAL API: kalFlushPendingTxPackets(), and take use of the API
196 *
197 * 04 06 2010 cp.wu
198 * [WPD00001943]Create WiFi test driver framework on WinXP
199 * eliminate direct access to prGlueInfo->rWlanInfo.eLinkAttr.ucMediaStreamMode from non-glue layer.
200 *
201 * 04 06 2010 jeffrey.chang
202 * [WPD00003826]Initial import for Linux port
203 * improve none-glude code portability
204 *
205 * 04 06 2010 cp.wu
206 * [WPD00001943]Create WiFi test driver framework on WinXP
207 * sync statistics data structure definition with firmware implementation
208 *
209 * 04 06 2010 cp.wu
210 * [WPD00001943]Create WiFi test driver framework on WinXP
211 * code refine: fgTestMode should be at adapter rather than glue due to the device/fw is also involved
212 *
213 * 04 06 2010 cp.wu
214 * [WPD00001943]Create WiFi test driver framework on WinXP
215 * eliminate direct access for prGlueInfo->fgIsCardRemoved in non-glue layer
216 *
217 * 03 30 2010 cp.wu
218 * [WPD00001943]Create WiFi test driver framework on WinXP
219 * statistics information OIDs are now handled by querying from firmware domain
220 *
221 * 03 26 2010 cp.wu
222 * [WPD00001943]Create WiFi test driver framework on WinXP
223 * indicate media stream mode after set is done
224 *
225 * 03 24 2010 jeffrey.chang
226 * [WPD00003826]Initial import for Linux port
227 * initial import for Linux port
228 *
229 * 03 03 2010 cp.wu
230 * [WPD00001943]Create WiFi test driver framework on WinXP
231 * implement custom OID: EEPROM read/write access
232 *
233 * 03 03 2010 cp.wu
234 * [WPD00001943]Create WiFi test driver framework on WinXP
235 * implement OID_802_3_MULTICAST_LIST oid handling
236 *
237 * 02 25 2010 cp.wu
238 * [WPD00001943]Create WiFi test driver framework on WinXP
239 * limit RSSI return value to micxxsoft defined range.
240 *
241 * 02 09 2010 cp.wu
242 * [WPD00001943]Create WiFi test driver framework on WinXP
243 * 1. Permanent and current MAC address are now retrieved by CMD/EVENT packets instead of hard-coded address
244 * * * * * * * 2. follow MSDN defined behavior when associates to another AP
245 * * * * * * * 3. for firmware download, packet size could be up to 2048 bytes
246 *
247 * 01 29 2010 cp.wu
248 * [WPD00001943]Create WiFi test driver framework on WinXP
249 * block until firmware finished RF test enter/leave then indicate completion to upper layer
250 *
251 * 01 29 2010 cp.wu
252 * [WPD00001943]Create WiFi test driver framework on WinXP
253 * when entering RF test mode and leaving from RF test mode, wait for W_FUNC_RDY bit to be asserted forever until it is set or card is removed.
254 *
255 * 01 27 2010 cp.wu
256 * [WPD00001943]Create WiFi test driver framework on WinXP
257 * 1. eliminate improper variable in rHifInfo
258 * * * * * * * * 2. block TX/ordinary OID when RF test mode is engaged
259 * * * * * * * * 3. wait until firmware finish operation when entering into and leaving from RF test mode
260 * * * * * * * * 4. correct some HAL implementation
261 *
262 * 01 26 2010 cp.wu
263 * [WPD00001943]Create WiFi test driver framework on WinXP
264 * Under WinXP with SDIO, use prGlueInfo->rHifInfo.pvInformationBuffer instead of prGlueInfo->pvInformationBuffer
265 *
266 * 01 22 2010 cp.wu
267 * [WPD00001943]Create WiFi test driver framework on WinXP
268 * implement following 802.11 OIDs:
269 * * * * * OID_802_11_RSSI,
270 * * * * * OID_802_11_RSSI_TRIGGER,
271 * * * * * OID_802_11_STATISTICS,
272 * * * * * OID_802_11_DISASSOCIATE,
273 * * * * * OID_802_11_POWER_MODE
274 *
275 * 01 21 2010 cp.wu
276 * [WPD00001943]Create WiFi test driver framework on WinXP
277 * implement OID_802_11_MEDIA_STREAM_MODE
278 *
279 * 12 30 2009 cp.wu
280 * [WPD00001943]Create WiFi test driver framework on WinXP
281 * 1) According to CMD/EVENT documentation v0.8,
282 * * * * * * * * OID_CUSTOM_TEST_RX_STATUS & OID_CUSTOM_TEST_TX_STATUS is no longer used,
283 * * * * * * * * and result is retrieved by get ATInfo instead
284 * * * * * * * * 2) add 4 counter for recording aggregation statistics
285** \main\maintrunk.MT6620WiFiDriver_Prj\10 2009-12-10 16:47:47 GMT mtk02752
286** only handle MCR read when accessing FW domain register
287** \main\maintrunk.MT6620WiFiDriver_Prj\9 2009-12-08 17:37:28 GMT mtk02752
288** * refine nicCmdEventQueryMcrRead
289** + add TxStatus/RxStatus for RF test QueryInformation OIDs
290** \main\maintrunk.MT6620WiFiDriver_Prj\8 2009-12-02 22:05:45 GMT mtk02752
291** kalOidComplete() will decrease i4OidPendingCount
292** \main\maintrunk.MT6620WiFiDriver_Prj\7 2009-12-01 23:02:57 GMT mtk02752
293** remove unnecessary spin locks
294** \main\maintrunk.MT6620WiFiDriver_Prj\6 2009-12-01 22:51:18 GMT mtk02752
295** maintein i4OidPendingCount
296** \main\maintrunk.MT6620WiFiDriver_Prj\5 2009-11-30 10:55:03 GMT mtk02752
297** modify for compatibility
298** \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-11-23 14:46:32 GMT mtk02752
299** add another version of command-done handler upon new event structure
300** \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-04-29 15:42:33 GMT mtk01461
301** Add comment
302** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-04-21 19:32:42 GMT mtk01461
303** Add nicCmdEventSetCommon() for general set OID
304** \main\maintrunk.MT6620WiFiDriver_Prj\1 2009-04-21 01:40:35 GMT mtk01461
305** Command Done Handler
306*/
307
308/*******************************************************************************
309* C O M P I L E R F L A G S
310********************************************************************************
311*/
312
313/*******************************************************************************
314* E X T E R N A L R E F E R E N C E S
315********************************************************************************
316*/
317#include "precomp.h"
318
319
320/*******************************************************************************
321* C O N S T A N T S
322********************************************************************************
323*/
324
325/*******************************************************************************
326* D A T A T Y P E S
327********************************************************************************
328*/
329
330/*******************************************************************************
331* P U B L I C D A T A
332********************************************************************************
333*/
334
335VOID
336nicCmdEventQueryMcrRead (
337 IN P_ADAPTER_T prAdapter,
338 IN P_CMD_INFO_T prCmdInfo,
339 IN PUINT_8 pucEventBuf
340 )
341{
342 UINT_32 u4QueryInfoLen;
343 P_PARAM_CUSTOM_MCR_RW_STRUC_T prMcrRdInfo;
344 P_GLUE_INFO_T prGlueInfo;
345 P_CMD_ACCESS_REG prCmdAccessReg;
346
347
348 ASSERT(prAdapter);
349 ASSERT(prCmdInfo);
350 ASSERT(pucEventBuf);
351
352 //4 <2> Update information of OID
353 if (prCmdInfo->fgIsOid) {
354 prGlueInfo = prAdapter->prGlueInfo;
355 prCmdAccessReg = (P_CMD_ACCESS_REG)(pucEventBuf);
356
357 u4QueryInfoLen = sizeof(PARAM_CUSTOM_MCR_RW_STRUC_T);
358
359 prMcrRdInfo = (P_PARAM_CUSTOM_MCR_RW_STRUC_T) prCmdInfo->pvInformationBuffer;
360 prMcrRdInfo->u4McrOffset = prCmdAccessReg->u4Address;
361 prMcrRdInfo->u4McrData = prCmdAccessReg->u4Data;
362
363 kalOidComplete(prGlueInfo, prCmdInfo->fgSetQuery, u4QueryInfoLen, WLAN_STATUS_SUCCESS);
364 }
365
366 return;
367
368}
369
370
371VOID
372nicCmdEventQuerySwCtrlRead (
373 IN P_ADAPTER_T prAdapter,
374 IN P_CMD_INFO_T prCmdInfo,
375 IN PUINT_8 pucEventBuf
376 )
377{
378 UINT_32 u4QueryInfoLen;
379 P_PARAM_CUSTOM_SW_CTRL_STRUC_T prSwCtrlInfo;
380 P_GLUE_INFO_T prGlueInfo;
381 P_CMD_SW_DBG_CTRL_T prCmdSwCtrl;
382
383 ASSERT(prAdapter);
384 ASSERT(prCmdInfo);
385 ASSERT(pucEventBuf);
386
387 //4 <2> Update information of OID
388 if (prCmdInfo->fgIsOid) {
389 prGlueInfo = prAdapter->prGlueInfo;
390 prCmdSwCtrl = (P_CMD_SW_DBG_CTRL_T)(pucEventBuf);
391
392 u4QueryInfoLen = sizeof(PARAM_CUSTOM_SW_CTRL_STRUC_T);
393
394 prSwCtrlInfo = (P_PARAM_CUSTOM_SW_CTRL_STRUC_T) prCmdInfo->pvInformationBuffer;
395 prSwCtrlInfo->u4Id = prCmdSwCtrl->u4Id;
396 prSwCtrlInfo->u4Data = prCmdSwCtrl->u4Data;
397
398 kalOidComplete(prGlueInfo, prCmdInfo->fgSetQuery, u4QueryInfoLen, WLAN_STATUS_SUCCESS);
399 }
400
401 return;
402
403}
404
405
406
407VOID
408nicCmdEventSetCommon (
409 IN P_ADAPTER_T prAdapter,
410 IN P_CMD_INFO_T prCmdInfo,
411 IN PUINT_8 pucEventBuf
412 )
413{
414 ASSERT(prAdapter);
415 ASSERT(prCmdInfo);
416
417 if (prCmdInfo->fgIsOid) {
418 /* Update Set Infomation Length */
419 kalOidComplete(prAdapter->prGlueInfo,
420 prCmdInfo->fgSetQuery,
421 prCmdInfo->u4InformationBufferLength,
422 WLAN_STATUS_SUCCESS);
423 }
424
425 return;
426}
427
428VOID
429nicCmdEventSetDisassociate (
430 IN P_ADAPTER_T prAdapter,
431 IN P_CMD_INFO_T prCmdInfo,
432 IN PUINT_8 pucEventBuf
433 )
434{
435 ASSERT(prAdapter);
436 ASSERT(prCmdInfo);
437
438 if (prCmdInfo->fgIsOid) {
439 /* Update Set Infomation Length */
440 kalOidComplete(prAdapter->prGlueInfo,
441 prCmdInfo->fgSetQuery,
442 0,
443 WLAN_STATUS_SUCCESS);
444 }
445
446 DBGLOG(INIT, TRACE, ("DisByCmdE\n"));
447 kalIndicateStatusAndComplete(prAdapter->prGlueInfo,
448 WLAN_STATUS_MEDIA_DISCONNECT,
449 NULL,
450 0);
451
452#if !defined(LINUX)
453 prAdapter->fgIsRadioOff = TRUE;
454#endif
455
456 return;
457}
458
459VOID
460nicCmdEventSetIpAddress (
461 IN P_ADAPTER_T prAdapter,
462 IN P_CMD_INFO_T prCmdInfo,
463 IN PUINT_8 pucEventBuf
464 )
465{
466 UINT_32 u4Count;
467
468 ASSERT(prAdapter);
469 ASSERT(prCmdInfo);
470
471 u4Count = (prCmdInfo->u4SetInfoLen - OFFSET_OF(CMD_SET_NETWORK_ADDRESS_LIST, arNetAddress))
472 / sizeof(IPV4_NETWORK_ADDRESS) ;
473
474 if (prCmdInfo->fgIsOid) {
475 /* Update Set Infomation Length */
476 kalOidComplete(prAdapter->prGlueInfo,
477 prCmdInfo->fgSetQuery,
478 OFFSET_OF(PARAM_NETWORK_ADDRESS_LIST, arAddress) + u4Count *
479 (OFFSET_OF(PARAM_NETWORK_ADDRESS, aucAddress) + sizeof(PARAM_NETWORK_ADDRESS_IP)),
480 WLAN_STATUS_SUCCESS);
481 }
482
483 return;
484}
485
486VOID
487nicCmdEventQueryRfTestATInfo(
488 IN P_ADAPTER_T prAdapter,
489 IN P_CMD_INFO_T prCmdInfo,
490 IN PUINT_8 pucEventBuf
491 )
492{
493 P_EVENT_TEST_STATUS prTestStatus, prQueryBuffer;
494 P_GLUE_INFO_T prGlueInfo;
495 UINT_32 u4QueryInfoLen;
496
497 ASSERT(prAdapter);
498 ASSERT(prCmdInfo);
499
500 prTestStatus = (P_EVENT_TEST_STATUS)pucEventBuf;
501
502 if (prCmdInfo->fgIsOid) {
503 prGlueInfo = prAdapter->prGlueInfo;
504 prQueryBuffer = (P_EVENT_TEST_STATUS) prCmdInfo->pvInformationBuffer;
505
506 kalMemCopy(prQueryBuffer, prTestStatus, sizeof(EVENT_TEST_STATUS));
507
508 u4QueryInfoLen = sizeof(EVENT_TEST_STATUS);
509
510 /* Update Query Infomation Length */
511 kalOidComplete(prGlueInfo,
512 prCmdInfo->fgSetQuery,
513 u4QueryInfoLen,
514 WLAN_STATUS_SUCCESS);
515 }
516
517 return;
518}
519
520VOID
521nicCmdEventQueryLinkQuality(
522 IN P_ADAPTER_T prAdapter,
523 IN P_CMD_INFO_T prCmdInfo,
524 IN PUINT_8 pucEventBuf
525 )
526{
527 PARAM_RSSI rRssi, *prRssi;
528 P_EVENT_LINK_QUALITY prLinkQuality;
529 P_GLUE_INFO_T prGlueInfo;
530 UINT_32 u4QueryInfoLen;
531
532 ASSERT(prAdapter);
533 ASSERT(prCmdInfo);
534
535 prLinkQuality = (P_EVENT_LINK_QUALITY)pucEventBuf;
536
537 rRssi = (PARAM_RSSI)prLinkQuality->cRssi; // ranged from (-128 ~ 30) in unit of dBm
538 DBGLOG(INIT, INFO, ("<rxm> %s: rRssi = %d\n", __FUNCTION__, rRssi));
539
540 if(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX].eConnectionState == PARAM_MEDIA_STATE_CONNECTED) {
541 if(rRssi > PARAM_WHQL_RSSI_MAX_DBM)
542 rRssi = PARAM_WHQL_RSSI_MAX_DBM;
543 else if(rRssi < PARAM_WHQL_RSSI_MIN_DBM)
544 rRssi = PARAM_WHQL_RSSI_MIN_DBM;
545 }
546 else {
547 rRssi = PARAM_WHQL_RSSI_MIN_DBM;
548 }
549
550 if (prCmdInfo->fgIsOid) {
551 prGlueInfo = prAdapter->prGlueInfo;
552 prRssi = (PARAM_RSSI *) prCmdInfo->pvInformationBuffer;
553
554 kalMemCopy(prRssi, &rRssi, sizeof(PARAM_RSSI));
555 u4QueryInfoLen = sizeof(PARAM_RSSI);
556
557 kalOidComplete(prGlueInfo,
558 prCmdInfo->fgSetQuery,
559 u4QueryInfoLen,
560 WLAN_STATUS_SUCCESS);
561 }
562}
563
564
565/*----------------------------------------------------------------------------*/
566/*!
567* @brief This routine is in response of OID_GEN_LINK_SPEED query request
568*
569* @param prAdapter Pointer to the Adapter structure.
570* @param prCmdInfo Pointer to the pending command info
571* @param pucEventBuf
572*
573* @retval none
574*/
575/*----------------------------------------------------------------------------*/
576VOID
577nicCmdEventQueryLinkSpeed(
578 IN P_ADAPTER_T prAdapter,
579 IN P_CMD_INFO_T prCmdInfo,
580 IN PUINT_8 pucEventBuf
581 )
582{
583 P_EVENT_LINK_QUALITY prLinkQuality;
584 P_GLUE_INFO_T prGlueInfo;
585 UINT_32 u4QueryInfoLen;
586 PUINT_32 pu4LinkSpeed;
587
588 ASSERT(prAdapter);
589 ASSERT(prCmdInfo);
590
591 prLinkQuality = (P_EVENT_LINK_QUALITY)pucEventBuf;
592
593 if (prCmdInfo->fgIsOid) {
594 prGlueInfo = prAdapter->prGlueInfo;
595 pu4LinkSpeed = (PUINT_32)(prCmdInfo->pvInformationBuffer);
596
597 if(prLinkQuality->u2LinkSpeed == 0) {
598 *pu4LinkSpeed = 10000; /* 10K * 100bps = 1Mbps */
599 }
600 else {
601 *pu4LinkSpeed = prLinkQuality->u2LinkSpeed * 5000;
602 }
603
604 u4QueryInfoLen = sizeof(UINT_32);
605
606 kalOidComplete(prGlueInfo,
607 prCmdInfo->fgSetQuery,
608 u4QueryInfoLen,
609 WLAN_STATUS_SUCCESS);
610 }
611}
612
613
614VOID
615nicCmdEventQueryStatistics(
616 IN P_ADAPTER_T prAdapter,
617 IN P_CMD_INFO_T prCmdInfo,
618 IN PUINT_8 pucEventBuf
619 )
620{
621 P_PARAM_802_11_STATISTICS_STRUCT_T prStatistics;
622 P_EVENT_STATISTICS prEventStatistics;
623 P_GLUE_INFO_T prGlueInfo;
624 UINT_32 u4QueryInfoLen;
625
626 ASSERT(prAdapter);
627 ASSERT(prCmdInfo);
628
629 prEventStatistics = (P_EVENT_STATISTICS)pucEventBuf;
630
631 if (prCmdInfo->fgIsOid) {
632 prGlueInfo = prAdapter->prGlueInfo;
633
634 u4QueryInfoLen = sizeof(PARAM_802_11_STATISTICS_STRUCT_T);
635 prStatistics = (P_PARAM_802_11_STATISTICS_STRUCT_T) prCmdInfo->pvInformationBuffer;
636
637 prStatistics->u4Length = sizeof(PARAM_802_11_STATISTICS_STRUCT_T);
638 prStatistics->rTransmittedFragmentCount
639 = prEventStatistics->rTransmittedFragmentCount;
640 prStatistics->rMulticastTransmittedFrameCount
641 = prEventStatistics->rMulticastTransmittedFrameCount;
642 prStatistics->rFailedCount
643 = prEventStatistics->rFailedCount;
644 prStatistics->rRetryCount
645 = prEventStatistics->rRetryCount;
646 prStatistics->rMultipleRetryCount
647 = prEventStatistics->rMultipleRetryCount;
648 prStatistics->rRTSSuccessCount
649 = prEventStatistics->rRTSSuccessCount;
650 prStatistics->rRTSFailureCount
651 = prEventStatistics->rRTSFailureCount;
652 prStatistics->rACKFailureCount
653 = prEventStatistics->rACKFailureCount;
654 prStatistics->rFrameDuplicateCount
655 = prEventStatistics->rFrameDuplicateCount;
656 prStatistics->rReceivedFragmentCount
657 = prEventStatistics->rReceivedFragmentCount;
658 prStatistics->rMulticastReceivedFrameCount
659 = prEventStatistics->rMulticastReceivedFrameCount;
660 prStatistics->rFCSErrorCount
661 = prEventStatistics->rFCSErrorCount;
662 prStatistics->rTKIPLocalMICFailures.QuadPart
663 = 0;
664 prStatistics->rTKIPICVErrors.QuadPart
665 = 0;
666 prStatistics->rTKIPCounterMeasuresInvoked.QuadPart
667 = 0;
668 prStatistics->rTKIPReplays.QuadPart
669 = 0;
670 prStatistics->rCCMPFormatErrors.QuadPart
671 = 0;
672 prStatistics->rCCMPReplays.QuadPart
673 = 0;
674 prStatistics->rCCMPDecryptErrors.QuadPart
675 = 0;
676 prStatistics->rFourWayHandshakeFailures.QuadPart
677 = 0;
678 prStatistics->rWEPUndecryptableCount.QuadPart
679 = 0;
680 prStatistics->rWEPICVErrorCount.QuadPart
681 = 0;
682 prStatistics->rDecryptSuccessCount.QuadPart
683 = 0;
684 prStatistics->rDecryptFailureCount.QuadPart
685 = 0;
686
687 kalOidComplete(prGlueInfo,
688 prCmdInfo->fgSetQuery,
689 u4QueryInfoLen,
690 WLAN_STATUS_SUCCESS);
691 }
692}
693
694VOID
695nicCmdEventEnterRfTest(
696 IN P_ADAPTER_T prAdapter,
697 IN P_CMD_INFO_T prCmdInfo,
698 IN PUINT_8 pucEventBuf
699 )
700{
701 UINT_32 u4WHISR = 0, u4Value = 0;
702 UINT_8 aucTxCount[8];
703
704 ASSERT(prAdapter);
705 ASSERT(prCmdInfo);
706
707 // [driver-land]
708 prAdapter->fgTestMode = TRUE;
709
710 // 0. always indicate disconnection
711 if(kalGetMediaStateIndicated(prAdapter->prGlueInfo) != PARAM_MEDIA_STATE_DISCONNECTED) {
712 kalIndicateStatusAndComplete(prAdapter->prGlueInfo,
713 WLAN_STATUS_MEDIA_DISCONNECT,
714 NULL,
715 0);
716 }
717
718 // 1. Remove pending TX
719 nicTxRelease(prAdapter);
720
721 // 1.1 clear pending Security / Management Frames
722 kalClearSecurityFrames(prAdapter->prGlueInfo);
723 kalClearMgmtFrames(prAdapter->prGlueInfo);
724
725 // 1.2 clear pending TX packet queued in glue layer
726 kalFlushPendingTxPackets(prAdapter->prGlueInfo);
727
728 // 2. Reset driver-domain FSMs
729 nicUninitMGMT(prAdapter);
730
731 nicResetSystemService(prAdapter);
732 nicInitMGMT(prAdapter, NULL);
733
734 // 3. Disable Interrupt
735 HAL_INTR_DISABLE(prAdapter);
736
737 // 4. Block til firmware completed entering into RF test mode
738 kalMsleep(500);
739 while(1) {
740 HAL_MCR_RD(prAdapter, MCR_WCIR, &u4Value);
741
742 if (u4Value & WCIR_WLAN_READY) {
743 break;
744 }
745 else if(kalIsCardRemoved(prAdapter->prGlueInfo) == TRUE
746 || fgIsBusAccessFailed == TRUE) {
747 if (prCmdInfo->fgIsOid) {
748 /* Update Set Infomation Length */
749 kalOidComplete(prAdapter->prGlueInfo,
750 prCmdInfo->fgSetQuery,
751 prCmdInfo->u4SetInfoLen,
752 WLAN_STATUS_NOT_SUPPORTED);
753
754 }
755 return;
756 }
757 else
758 kalMsleep(10);
759 }
760
761 // 5. Clear Interrupt Status
762 HAL_READ_INTR_STATUS(prAdapter, 4, (PUINT_8)&u4WHISR);
763 if(HAL_IS_TX_DONE_INTR(u4WHISR)) {
764 HAL_READ_TX_RELEASED_COUNT(prAdapter, aucTxCount);
765 }
766
767 // 6. Reset TX Counter
768 nicTxResetResource(prAdapter);
769
770 // 7. Re-enable Interrupt
771 HAL_INTR_ENABLE(prAdapter);
772
773 // 8. completion indication
774 if (prCmdInfo->fgIsOid) {
775 /* Update Set Infomation Length */
776 kalOidComplete(prAdapter->prGlueInfo,
777 prCmdInfo->fgSetQuery,
778 prCmdInfo->u4SetInfoLen,
779 WLAN_STATUS_SUCCESS);
780 }
781
782#if CFG_SUPPORT_NVRAM
783 // 9. load manufacture data
784 wlanLoadManufactureData(prAdapter, kalGetConfiguration(prAdapter->prGlueInfo));
785#endif
786
787 return;
788}
789
790VOID
791nicCmdEventLeaveRfTest(
792 IN P_ADAPTER_T prAdapter,
793 IN P_CMD_INFO_T prCmdInfo,
794 IN PUINT_8 pucEventBuf
795 )
796{
797 UINT_32 u4WHISR = 0, u4Value = 0;
798 UINT_8 aucTxCount[8];
799
800 ASSERT(prAdapter);
801 ASSERT(prCmdInfo);
802
803 // 1. Disable Interrupt
804 HAL_INTR_DISABLE(prAdapter);
805
806 // 2. Block til firmware completed leaving from RF test mode
807 kalMsleep(500);
808 while(1) {
809 HAL_MCR_RD(prAdapter, MCR_WCIR, &u4Value);
810
811 if (u4Value & WCIR_WLAN_READY) {
812 break;
813 }
814 else if(kalIsCardRemoved(prAdapter->prGlueInfo) == TRUE
815 || fgIsBusAccessFailed == TRUE) {
816 if (prCmdInfo->fgIsOid) {
817 /* Update Set Infomation Length */
818 kalOidComplete(prAdapter->prGlueInfo,
819 prCmdInfo->fgSetQuery,
820 prCmdInfo->u4SetInfoLen,
821 WLAN_STATUS_NOT_SUPPORTED);
822
823 }
824 return;
825 }
826 else {
827 kalMsleep(10);
828 }
829 }
830
831 // 3. Clear Interrupt Status
832 HAL_READ_INTR_STATUS(prAdapter, 4, (PUINT_8)&u4WHISR);
833 if(HAL_IS_TX_DONE_INTR(u4WHISR)) {
834 HAL_READ_TX_RELEASED_COUNT(prAdapter, aucTxCount);
835 }
836
837 // 4. Reset TX Counter
838 nicTxResetResource(prAdapter);
839
840 // 5. Re-enable Interrupt
841 HAL_INTR_ENABLE(prAdapter);
842
843 // 6. set driver-land variable
844 prAdapter->fgTestMode = FALSE;
845
846 // 7. completion indication
847 if (prCmdInfo->fgIsOid) {
848 /* Update Set Infomation Length */
849 kalOidComplete(prAdapter->prGlueInfo,
850 prCmdInfo->fgSetQuery,
851 prCmdInfo->u4SetInfoLen,
852 WLAN_STATUS_SUCCESS);
853 }
854
855 /* 8. Indicate as disconnected */
856 if(kalGetMediaStateIndicated(prAdapter->prGlueInfo) != PARAM_MEDIA_STATE_DISCONNECTED) {
857
858 kalIndicateStatusAndComplete(prAdapter->prGlueInfo,
859 WLAN_STATUS_MEDIA_DISCONNECT,
860 NULL,
861 0);
862
863 prAdapter->rWlanInfo.u4SysTime = kalGetTimeTick();
864 }
865
866#if CFG_SUPPORT_NVRAM
867 /* 9. load manufacture data */
868 wlanLoadManufactureData(prAdapter, kalGetConfiguration(prAdapter->prGlueInfo));
869#endif
870
871 /* 10. Override network address */
872 wlanUpdateNetworkAddress(prAdapter);
873
874 return;
875}
876
877VOID
878nicCmdEventQueryAddress(
879 IN P_ADAPTER_T prAdapter,
880 IN P_CMD_INFO_T prCmdInfo,
881 IN PUINT_8 pucEventBuf
882 )
883{
884 UINT_32 u4QueryInfoLen;
885 P_GLUE_INFO_T prGlueInfo;
886 P_EVENT_BASIC_CONFIG prEventBasicConfig;
887
888 ASSERT(prAdapter);
889 ASSERT(prCmdInfo);
890 ASSERT(pucEventBuf);
891
892 prEventBasicConfig = (P_EVENT_BASIC_CONFIG)(pucEventBuf);
893
894 // copy to adapter
895 kalMemCopy(&(prAdapter->rMyMacAddr), &(prEventBasicConfig->rMyMacAddr), MAC_ADDR_LEN);
896
897 //4 <2> Update information of OID
898 if (prCmdInfo->fgIsOid) {
899 prGlueInfo = prAdapter->prGlueInfo;
900
901 kalMemCopy(prCmdInfo->pvInformationBuffer, &(prEventBasicConfig->rMyMacAddr), MAC_ADDR_LEN);
902 u4QueryInfoLen = MAC_ADDR_LEN;
903
904 kalOidComplete(prGlueInfo, prCmdInfo->fgSetQuery, u4QueryInfoLen, WLAN_STATUS_SUCCESS);
905 }
906
907 //4 <3> Update new MAC address and all 3 networks
908 COPY_MAC_ADDR(prAdapter->rWifiVar.aucMacAddress, prAdapter->rMyMacAddr);
909 COPY_MAC_ADDR(prAdapter->rWifiVar.aucDeviceAddress, prAdapter->rMyMacAddr);
910 prAdapter->rWifiVar.aucDeviceAddress[0] ^= MAC_ADDR_LOCAL_ADMIN;
911
912 COPY_MAC_ADDR(prAdapter->rWifiVar.aucInterfaceAddress, prAdapter->rMyMacAddr);
913 prAdapter->rWifiVar.aucInterfaceAddress[0] ^= MAC_ADDR_LOCAL_ADMIN;
914
915 COPY_MAC_ADDR(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX].aucOwnMacAddr,
916 prAdapter->rMyMacAddr);
917
918#if CFG_ENABLE_WIFI_DIRECT
919 if(prAdapter->fgIsP2PRegistered) {
920 COPY_MAC_ADDR(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX].aucOwnMacAddr,
921 prAdapter->rWifiVar.aucDeviceAddress);
922 }
923#endif
924
925#if CFG_ENABLE_BT_OVER_WIFI
926 COPY_MAC_ADDR(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_BOW_INDEX].aucOwnMacAddr,
927 prAdapter->rWifiVar.aucDeviceAddress);
928#endif
929
930#if CFG_TEST_WIFI_DIRECT_GO
931 if (prAdapter->rWifiVar.prP2pFsmInfo->eCurrentState == P2P_STATE_IDLE) {
932 wlanEnableP2pFunction(prAdapter);
933
934 wlanEnableATGO(prAdapter);
935 }
936#endif
937
938 kalUpdateMACAddress(prAdapter->prGlueInfo, prAdapter->rWifiVar.aucMacAddress);
939
940 return;
941}
942
943VOID
944nicCmdEventQueryMcastAddr(
945 IN P_ADAPTER_T prAdapter,
946 IN P_CMD_INFO_T prCmdInfo,
947 IN PUINT_8 pucEventBuf
948 )
949{
950 UINT_32 u4QueryInfoLen;
951 P_GLUE_INFO_T prGlueInfo;
952 P_EVENT_MAC_MCAST_ADDR prEventMacMcastAddr;
953
954 ASSERT(prAdapter);
955 ASSERT(prCmdInfo);
956 ASSERT(pucEventBuf);
957
958 //4 <2> Update information of OID
959 if (prCmdInfo->fgIsOid) {
960 prGlueInfo = prAdapter->prGlueInfo;
961 prEventMacMcastAddr = (P_EVENT_MAC_MCAST_ADDR)(pucEventBuf);
962
963 u4QueryInfoLen = prEventMacMcastAddr->u4NumOfGroupAddr * MAC_ADDR_LEN;
964
965 // buffer length check
966 if (prCmdInfo->u4InformationBufferLength < u4QueryInfoLen) {
967 kalOidComplete(prGlueInfo, prCmdInfo->fgSetQuery, u4QueryInfoLen, WLAN_STATUS_BUFFER_TOO_SHORT);
968 }
969 else {
970 kalMemCopy(prCmdInfo->pvInformationBuffer,
971 prEventMacMcastAddr->arAddress,
972 prEventMacMcastAddr->u4NumOfGroupAddr * MAC_ADDR_LEN);
973
974 kalOidComplete(prGlueInfo, prCmdInfo->fgSetQuery, u4QueryInfoLen, WLAN_STATUS_SUCCESS);
975 }
976 }
977}
978
979VOID
980nicCmdEventQueryEepromRead(
981 IN P_ADAPTER_T prAdapter,
982 IN P_CMD_INFO_T prCmdInfo,
983 IN PUINT_8 pucEventBuf
984 )
985{
986 UINT_32 u4QueryInfoLen;
987 P_PARAM_CUSTOM_EEPROM_RW_STRUC_T prEepromRdInfo;
988 P_GLUE_INFO_T prGlueInfo;
989 P_EVENT_ACCESS_EEPROM prEventAccessEeprom;
990
991 ASSERT(prAdapter);
992 ASSERT(prCmdInfo);
993 ASSERT(pucEventBuf);
994
995 //4 <2> Update information of OID
996 if (prCmdInfo->fgIsOid) {
997 prGlueInfo = prAdapter->prGlueInfo;
998 prEventAccessEeprom = (P_EVENT_ACCESS_EEPROM)(pucEventBuf);
999
1000 u4QueryInfoLen = sizeof(PARAM_CUSTOM_EEPROM_RW_STRUC_T);
1001
1002 prEepromRdInfo = (P_PARAM_CUSTOM_EEPROM_RW_STRUC_T) prCmdInfo->pvInformationBuffer;
1003 prEepromRdInfo->ucEepromIndex = (UINT_8)(prEventAccessEeprom->u2Offset);
1004 prEepromRdInfo->u2EepromData = prEventAccessEeprom->u2Data;
1005
1006 kalOidComplete(prGlueInfo, prCmdInfo->fgSetQuery, u4QueryInfoLen, WLAN_STATUS_SUCCESS);
1007 }
1008
1009 return;
1010
1011}
1012
1013
1014VOID
1015nicCmdEventSetMediaStreamMode(
1016 IN P_ADAPTER_T prAdapter,
1017 IN P_CMD_INFO_T prCmdInfo,
1018 IN PUINT_8 pucEventBuf
1019 )
1020{
1021 PARAM_MEDIA_STREAMING_INDICATION rParamMediaStreamIndication;
1022
1023 ASSERT(prAdapter);
1024 ASSERT(prCmdInfo);
1025
1026 if (prCmdInfo->fgIsOid) {
1027 /* Update Set Infomation Length */
1028 kalOidComplete(prAdapter->prGlueInfo,
1029 prCmdInfo->fgSetQuery,
1030 prCmdInfo->u4SetInfoLen,
1031 WLAN_STATUS_SUCCESS);
1032 }
1033
1034 rParamMediaStreamIndication.rStatus.eStatusType =
1035 ENUM_STATUS_TYPE_MEDIA_STREAM_MODE;
1036 rParamMediaStreamIndication.eMediaStreamMode =
1037 prAdapter->rWlanInfo.eLinkAttr.ucMediaStreamMode == 0 ?
1038 ENUM_MEDIA_STREAM_OFF : ENUM_MEDIA_STREAM_ON;
1039
1040 kalIndicateStatusAndComplete(prAdapter->prGlueInfo,
1041 WLAN_STATUS_MEDIA_SPECIFIC_INDICATION,
1042 (PVOID)&rParamMediaStreamIndication,
1043 sizeof(PARAM_MEDIA_STREAMING_INDICATION));
1044}
1045
1046
1047/* Statistics responder */
1048VOID
1049nicCmdEventQueryXmitOk(
1050 IN P_ADAPTER_T prAdapter,
1051 IN P_CMD_INFO_T prCmdInfo,
1052 IN PUINT_8 pucEventBuf
1053 )
1054{
1055 P_EVENT_STATISTICS prEventStatistics;
1056 P_GLUE_INFO_T prGlueInfo;
1057 UINT_32 u4QueryInfoLen;
1058 PUINT_32 pu4Data;
1059 PUINT_64 pu8Data;
1060
1061 ASSERT(prAdapter);
1062 ASSERT(prCmdInfo);
1063
1064 prEventStatistics = (P_EVENT_STATISTICS)pucEventBuf;
1065
1066 if (prCmdInfo->fgIsOid) {
1067 prGlueInfo = prAdapter->prGlueInfo;
1068
1069 if(prCmdInfo->u4InformationBufferLength == sizeof(UINT_32)) {
1070 u4QueryInfoLen = sizeof(UINT_32);
1071
1072 pu4Data = (PUINT_32) prCmdInfo->pvInformationBuffer;
1073 *pu4Data = (UINT_32) prEventStatistics->rTransmittedFragmentCount.QuadPart;
1074 }
1075 else {
1076 u4QueryInfoLen = sizeof(UINT_64);
1077
1078 pu8Data = (PUINT_64) prCmdInfo->pvInformationBuffer;
1079 *pu8Data = prEventStatistics->rTransmittedFragmentCount.QuadPart;
1080 }
1081
1082 kalOidComplete(prGlueInfo,
1083 prCmdInfo->fgSetQuery,
1084 u4QueryInfoLen,
1085 WLAN_STATUS_SUCCESS);
1086 }
1087}
1088
1089
1090VOID
1091nicCmdEventQueryRecvOk(
1092 IN P_ADAPTER_T prAdapter,
1093 IN P_CMD_INFO_T prCmdInfo,
1094 IN PUINT_8 pucEventBuf
1095 )
1096{
1097 P_EVENT_STATISTICS prEventStatistics;
1098 P_GLUE_INFO_T prGlueInfo;
1099 UINT_32 u4QueryInfoLen;
1100 PUINT_32 pu4Data;
1101 PUINT_64 pu8Data;
1102
1103 ASSERT(prAdapter);
1104 ASSERT(prCmdInfo);
1105
1106 prEventStatistics = (P_EVENT_STATISTICS)pucEventBuf;
1107
1108 if (prCmdInfo->fgIsOid) {
1109 prGlueInfo = prAdapter->prGlueInfo;
1110
1111 if(prCmdInfo->u4InformationBufferLength == sizeof(UINT_32)) {
1112 u4QueryInfoLen = sizeof(UINT_32);
1113
1114 pu4Data = (PUINT_32) prCmdInfo->pvInformationBuffer;
1115 *pu4Data = (UINT_32) prEventStatistics->rReceivedFragmentCount.QuadPart;
1116 }
1117 else {
1118 u4QueryInfoLen = sizeof(UINT_64);
1119
1120 pu8Data = (PUINT_64) prCmdInfo->pvInformationBuffer;
1121 *pu8Data = prEventStatistics->rReceivedFragmentCount.QuadPart;
1122 }
1123
1124 kalOidComplete(prGlueInfo,
1125 prCmdInfo->fgSetQuery,
1126 u4QueryInfoLen,
1127 WLAN_STATUS_SUCCESS);
1128 }
1129}
1130
1131VOID
1132nicCmdEventQueryXmitError(
1133 IN P_ADAPTER_T prAdapter,
1134 IN P_CMD_INFO_T prCmdInfo,
1135 IN PUINT_8 pucEventBuf
1136 )
1137{
1138 P_EVENT_STATISTICS prEventStatistics;
1139 P_GLUE_INFO_T prGlueInfo;
1140 UINT_32 u4QueryInfoLen;
1141 PUINT_32 pu4Data;
1142 PUINT_64 pu8Data;
1143
1144 ASSERT(prAdapter);
1145 ASSERT(prCmdInfo);
1146
1147 prEventStatistics = (P_EVENT_STATISTICS)pucEventBuf;
1148
1149 if (prCmdInfo->fgIsOid) {
1150 prGlueInfo = prAdapter->prGlueInfo;
1151
1152 if(prCmdInfo->u4InformationBufferLength == sizeof(UINT_32)) {
1153 u4QueryInfoLen = sizeof(UINT_32);
1154
1155 pu4Data = (PUINT_32) prCmdInfo->pvInformationBuffer;
1156 *pu4Data = (UINT_32) prEventStatistics->rFailedCount.QuadPart;
1157 }
1158 else {
1159 u4QueryInfoLen = sizeof(UINT_64);
1160
1161 pu8Data = (PUINT_64) prCmdInfo->pvInformationBuffer;
1162 *pu8Data = (UINT_64) prEventStatistics->rFailedCount.QuadPart;
1163 }
1164
1165 kalOidComplete(prGlueInfo,
1166 prCmdInfo->fgSetQuery,
1167 u4QueryInfoLen,
1168 WLAN_STATUS_SUCCESS);
1169 }
1170}
1171
1172
1173VOID
1174nicCmdEventQueryRecvError(
1175 IN P_ADAPTER_T prAdapter,
1176 IN P_CMD_INFO_T prCmdInfo,
1177 IN PUINT_8 pucEventBuf
1178 )
1179{
1180 P_EVENT_STATISTICS prEventStatistics;
1181 P_GLUE_INFO_T prGlueInfo;
1182 UINT_32 u4QueryInfoLen;
1183 PUINT_32 pu4Data;
1184 PUINT_64 pu8Data;
1185
1186 ASSERT(prAdapter);
1187 ASSERT(prCmdInfo);
1188
1189 prEventStatistics = (P_EVENT_STATISTICS)pucEventBuf;
1190
1191 if (prCmdInfo->fgIsOid) {
1192 prGlueInfo = prAdapter->prGlueInfo;
1193
1194 if(prCmdInfo->u4InformationBufferLength == sizeof(UINT_32)) {
1195 u4QueryInfoLen = sizeof(UINT_32);
1196
1197 pu4Data = (PUINT_32) prCmdInfo->pvInformationBuffer;
1198 *pu4Data = (UINT_32) prEventStatistics->rFCSErrorCount.QuadPart;
1199 // @FIXME, RX_ERROR_DROP_COUNT/RX_FIFO_FULL_DROP_COUNT is not calculated
1200 }
1201 else {
1202 u4QueryInfoLen = sizeof(UINT_64);
1203
1204 pu8Data = (PUINT_64) prCmdInfo->pvInformationBuffer;
1205 *pu8Data = prEventStatistics->rFCSErrorCount.QuadPart;
1206 // @FIXME, RX_ERROR_DROP_COUNT/RX_FIFO_FULL_DROP_COUNT is not calculated
1207 }
1208
1209 kalOidComplete(prGlueInfo,
1210 prCmdInfo->fgSetQuery,
1211 u4QueryInfoLen,
1212 WLAN_STATUS_SUCCESS);
1213 }
1214}
1215
1216
1217VOID
1218nicCmdEventQueryRecvNoBuffer(
1219 IN P_ADAPTER_T prAdapter,
1220 IN P_CMD_INFO_T prCmdInfo,
1221 IN PUINT_8 pucEventBuf
1222 )
1223{
1224 P_EVENT_STATISTICS prEventStatistics;
1225 P_GLUE_INFO_T prGlueInfo;
1226 UINT_32 u4QueryInfoLen;
1227 PUINT_32 pu4Data;
1228 PUINT_64 pu8Data;
1229
1230 ASSERT(prAdapter);
1231 ASSERT(prCmdInfo);
1232
1233 prEventStatistics = (P_EVENT_STATISTICS)pucEventBuf;
1234
1235 if (prCmdInfo->fgIsOid) {
1236 prGlueInfo = prAdapter->prGlueInfo;
1237
1238 if(prCmdInfo->u4InformationBufferLength == sizeof(UINT_32)) {
1239 u4QueryInfoLen = sizeof(UINT_32);
1240
1241 pu4Data = (PUINT_32) prCmdInfo->pvInformationBuffer;
1242 *pu4Data = 0; // @FIXME?
1243 }
1244 else {
1245 u4QueryInfoLen = sizeof(UINT_64);
1246
1247 pu8Data = (PUINT_64) prCmdInfo->pvInformationBuffer;
1248 *pu8Data = 0; //@FIXME?
1249 }
1250
1251 kalOidComplete(prGlueInfo,
1252 prCmdInfo->fgSetQuery,
1253 u4QueryInfoLen,
1254 WLAN_STATUS_SUCCESS);
1255 }
1256}
1257
1258
1259VOID
1260nicCmdEventQueryRecvCrcError(
1261 IN P_ADAPTER_T prAdapter,
1262 IN P_CMD_INFO_T prCmdInfo,
1263 IN PUINT_8 pucEventBuf
1264 )
1265{
1266 P_EVENT_STATISTICS prEventStatistics;
1267 P_GLUE_INFO_T prGlueInfo;
1268 UINT_32 u4QueryInfoLen;
1269 PUINT_32 pu4Data;
1270 PUINT_64 pu8Data;
1271
1272 ASSERT(prAdapter);
1273 ASSERT(prCmdInfo);
1274
1275 prEventStatistics = (P_EVENT_STATISTICS)pucEventBuf;
1276
1277 if (prCmdInfo->fgIsOid) {
1278 prGlueInfo = prAdapter->prGlueInfo;
1279
1280 if(prCmdInfo->u4InformationBufferLength == sizeof(UINT_32)) {
1281 u4QueryInfoLen = sizeof(UINT_32);
1282
1283 pu4Data = (PUINT_32) prCmdInfo->pvInformationBuffer;
1284 *pu4Data = (UINT_32) prEventStatistics->rFCSErrorCount.QuadPart;
1285 }
1286 else {
1287 u4QueryInfoLen = sizeof(UINT_64);
1288
1289 pu8Data = (PUINT_64) prCmdInfo->pvInformationBuffer;
1290 *pu8Data = prEventStatistics->rFCSErrorCount.QuadPart;
1291 }
1292
1293 kalOidComplete(prGlueInfo,
1294 prCmdInfo->fgSetQuery,
1295 u4QueryInfoLen,
1296 WLAN_STATUS_SUCCESS);
1297 }
1298}
1299
1300
1301VOID
1302nicCmdEventQueryRecvErrorAlignment(
1303 IN P_ADAPTER_T prAdapter,
1304 IN P_CMD_INFO_T prCmdInfo,
1305 IN PUINT_8 pucEventBuf
1306 )
1307{
1308 P_EVENT_STATISTICS prEventStatistics;
1309 P_GLUE_INFO_T prGlueInfo;
1310 UINT_32 u4QueryInfoLen;
1311 PUINT_32 pu4Data;
1312 PUINT_64 pu8Data;
1313
1314 ASSERT(prAdapter);
1315 ASSERT(prCmdInfo);
1316
1317 prEventStatistics = (P_EVENT_STATISTICS)pucEventBuf;
1318
1319 if (prCmdInfo->fgIsOid) {
1320 prGlueInfo = prAdapter->prGlueInfo;
1321
1322 if(prCmdInfo->u4InformationBufferLength == sizeof(UINT_32)) {
1323 u4QueryInfoLen = sizeof(UINT_32);
1324
1325 pu4Data = (PUINT_32) prCmdInfo->pvInformationBuffer;
1326 *pu4Data = (UINT_32) 0; //@FIXME
1327 }
1328 else {
1329 u4QueryInfoLen = sizeof(UINT_64);
1330
1331 pu8Data = (PUINT_64) prCmdInfo->pvInformationBuffer;
1332 *pu8Data = 0; //@FIXME
1333 }
1334
1335 kalOidComplete(prGlueInfo,
1336 prCmdInfo->fgSetQuery,
1337 u4QueryInfoLen,
1338 WLAN_STATUS_SUCCESS);
1339 }
1340}
1341
1342
1343VOID
1344nicCmdEventQueryXmitOneCollision(
1345 IN P_ADAPTER_T prAdapter,
1346 IN P_CMD_INFO_T prCmdInfo,
1347 IN PUINT_8 pucEventBuf
1348 )
1349{
1350 P_EVENT_STATISTICS prEventStatistics;
1351 P_GLUE_INFO_T prGlueInfo;
1352 UINT_32 u4QueryInfoLen;
1353 PUINT_32 pu4Data;
1354 PUINT_64 pu8Data;
1355
1356 ASSERT(prAdapter);
1357 ASSERT(prCmdInfo);
1358
1359 prEventStatistics = (P_EVENT_STATISTICS)pucEventBuf;
1360
1361 if (prCmdInfo->fgIsOid) {
1362 prGlueInfo = prAdapter->prGlueInfo;
1363
1364 if(prCmdInfo->u4InformationBufferLength == sizeof(UINT_32)) {
1365 u4QueryInfoLen = sizeof(UINT_32);
1366
1367 pu4Data = (PUINT_32) prCmdInfo->pvInformationBuffer;
1368 *pu4Data = (UINT_32) (prEventStatistics->rMultipleRetryCount.QuadPart - prEventStatistics->rRetryCount.QuadPart);
1369 }
1370 else {
1371 u4QueryInfoLen = sizeof(UINT_64);
1372
1373 pu8Data = (PUINT_64) prCmdInfo->pvInformationBuffer;
1374 *pu8Data = (UINT_64) (prEventStatistics->rMultipleRetryCount.QuadPart - prEventStatistics->rRetryCount.QuadPart);
1375 }
1376
1377 kalOidComplete(prGlueInfo,
1378 prCmdInfo->fgSetQuery,
1379 u4QueryInfoLen,
1380 WLAN_STATUS_SUCCESS);
1381 }
1382}
1383
1384
1385VOID
1386nicCmdEventQueryXmitMoreCollisions(
1387 IN P_ADAPTER_T prAdapter,
1388 IN P_CMD_INFO_T prCmdInfo,
1389 IN PUINT_8 pucEventBuf
1390 )
1391{
1392 P_EVENT_STATISTICS prEventStatistics;
1393 P_GLUE_INFO_T prGlueInfo;
1394 UINT_32 u4QueryInfoLen;
1395 PUINT_32 pu4Data;
1396 PUINT_64 pu8Data;
1397
1398 ASSERT(prAdapter);
1399 ASSERT(prCmdInfo);
1400
1401 prEventStatistics = (P_EVENT_STATISTICS)pucEventBuf;
1402
1403 if (prCmdInfo->fgIsOid) {
1404 prGlueInfo = prAdapter->prGlueInfo;
1405
1406 if(prCmdInfo->u4InformationBufferLength == sizeof(UINT_32)) {
1407 u4QueryInfoLen = sizeof(UINT_32);
1408
1409 pu4Data = (PUINT_32) prCmdInfo->pvInformationBuffer;
1410 *pu4Data = (UINT_32) prEventStatistics->rMultipleRetryCount.QuadPart;
1411 }
1412 else {
1413 u4QueryInfoLen = sizeof(UINT_64);
1414
1415 pu8Data = (PUINT_64) prCmdInfo->pvInformationBuffer;
1416 *pu8Data = (UINT_64) prEventStatistics->rMultipleRetryCount.QuadPart;
1417 }
1418
1419 kalOidComplete(prGlueInfo,
1420 prCmdInfo->fgSetQuery,
1421 u4QueryInfoLen,
1422 WLAN_STATUS_SUCCESS);
1423 }
1424}
1425
1426
1427VOID
1428nicCmdEventQueryXmitMaxCollisions(
1429 IN P_ADAPTER_T prAdapter,
1430 IN P_CMD_INFO_T prCmdInfo,
1431 IN PUINT_8 pucEventBuf
1432 )
1433{
1434 P_EVENT_STATISTICS prEventStatistics;
1435 P_GLUE_INFO_T prGlueInfo;
1436 UINT_32 u4QueryInfoLen;
1437 PUINT_32 pu4Data;
1438 PUINT_64 pu8Data;
1439
1440 ASSERT(prAdapter);
1441 ASSERT(prCmdInfo);
1442
1443 prEventStatistics = (P_EVENT_STATISTICS)pucEventBuf;
1444
1445 if (prCmdInfo->fgIsOid) {
1446 prGlueInfo = prAdapter->prGlueInfo;
1447
1448 if(prCmdInfo->u4InformationBufferLength == sizeof(UINT_32)) {
1449 u4QueryInfoLen = sizeof(UINT_32);
1450
1451 pu4Data = (PUINT_32) prCmdInfo->pvInformationBuffer;
1452 *pu4Data = (UINT_32) prEventStatistics->rFailedCount.QuadPart;
1453 }
1454 else {
1455 u4QueryInfoLen = sizeof(UINT_64);
1456
1457 pu8Data = (PUINT_64) prCmdInfo->pvInformationBuffer;
1458 *pu8Data = (UINT_64) prEventStatistics->rFailedCount.QuadPart;
1459 }
1460
1461 kalOidComplete(prGlueInfo,
1462 prCmdInfo->fgSetQuery,
1463 u4QueryInfoLen,
1464 WLAN_STATUS_SUCCESS);
1465 }
1466}
1467
1468
1469/*----------------------------------------------------------------------------*/
1470/*!
1471* @brief This function is called when command by OID/ioctl has been timeout
1472*
1473* @param prAdapter Pointer to the Adapter structure.
1474* @param prCmdInfo Pointer to the command information
1475*
1476* @return TRUE
1477* FALSE
1478*/
1479/*----------------------------------------------------------------------------*/
1480VOID
1481nicOidCmdTimeoutCommon (
1482 IN P_ADAPTER_T prAdapter,
1483 IN P_CMD_INFO_T prCmdInfo
1484 )
1485{
1486 ASSERT(prAdapter);
1487
1488 kalOidComplete(prAdapter->prGlueInfo,
1489 prCmdInfo->fgSetQuery,
1490 0,
1491 WLAN_STATUS_FAILURE);
1492}
1493
1494
1495/*----------------------------------------------------------------------------*/
1496/*!
1497* @brief This function is a generic command timeout handler
1498*
1499* @param pfnOidHandler Pointer to the OID handler
1500*
1501* @return none
1502*/
1503/*----------------------------------------------------------------------------*/
1504VOID
1505nicCmdTimeoutCommon (
1506 IN P_ADAPTER_T prAdapter,
1507 IN P_CMD_INFO_T prCmdInfo
1508 )
1509{
1510 ASSERT(prAdapter);
1511}
1512
1513
1514/*----------------------------------------------------------------------------*/
1515/*!
1516* @brief This function is called when command for entering RF test has
1517* failed sending due to timeout (highly possibly by firmware crash)
1518*
1519* @param prAdapter Pointer to the Adapter structure.
1520* @param prCmdInfo Pointer to the command information
1521*
1522* @return none
1523*
1524*/
1525/*----------------------------------------------------------------------------*/
1526VOID
1527nicOidCmdEnterRFTestTimeout (
1528 IN P_ADAPTER_T prAdapter,
1529 IN P_CMD_INFO_T prCmdInfo
1530 )
1531{
1532 ASSERT(prAdapter);
1533
1534 // 1. Remove pending TX frames
1535 nicTxRelease(prAdapter);
1536
1537 // 1.1 clear pending Security / Management Frames
1538 kalClearSecurityFrames(prAdapter->prGlueInfo);
1539 kalClearMgmtFrames(prAdapter->prGlueInfo);
1540
1541 // 1.2 clear pending TX packet queued in glue layer
1542 kalFlushPendingTxPackets(prAdapter->prGlueInfo);
1543
1544 // 2. indiate for OID failure
1545 kalOidComplete(prAdapter->prGlueInfo,
1546 prCmdInfo->fgSetQuery,
1547 0,
1548 WLAN_STATUS_FAILURE);
1549}
1550
1551
1552/*----------------------------------------------------------------------------*/
1553/*!
1554* @brief This function is called when command for memory dump has
1555* replied a event.
1556*
1557* @param prAdapter Pointer to the Adapter structure.
1558* @param prCmdInfo Pointer to the command information
1559* @param pucEventBuf Pointer to event buffer
1560*
1561* @return none
1562*
1563*/
1564/*----------------------------------------------------------------------------*/
1565VOID
1566nicCmdEventQueryMemDump (
1567 IN P_ADAPTER_T prAdapter,
1568 IN P_CMD_INFO_T prCmdInfo,
1569 IN PUINT_8 pucEventBuf
1570 )
1571{
1572 UINT_32 u4QueryInfoLen;
1573 P_PARAM_CUSTOM_MEM_DUMP_STRUC_T prMemDumpInfo;
1574 P_GLUE_INFO_T prGlueInfo;
1575 P_EVENT_DUMP_MEM_T prEventDumpMem;
1576 static UINT_8 aucPath[256];
1577 static UINT_32 u4CurTimeTick;
1578
1579 ASSERT(prAdapter);
1580 ASSERT(prCmdInfo);
1581 ASSERT(pucEventBuf);
1582
1583 //4 <2> Update information of OID
1584 if (prCmdInfo->fgIsOid) {
1585 prGlueInfo = prAdapter->prGlueInfo;
1586 prEventDumpMem = (P_EVENT_DUMP_MEM_T)(pucEventBuf);
1587
1588 u4QueryInfoLen = sizeof(P_PARAM_CUSTOM_MEM_DUMP_STRUC_T);
1589
1590 prMemDumpInfo = (P_PARAM_CUSTOM_MEM_DUMP_STRUC_T) prCmdInfo->pvInformationBuffer;
1591 prMemDumpInfo->u4Address = prEventDumpMem->u4Address;
1592 prMemDumpInfo->u4Length = prEventDumpMem->u4Length;
1593 prMemDumpInfo->u4RemainLength = prEventDumpMem->u4RemainLength;
1594 prMemDumpInfo->ucFragNum = prEventDumpMem->ucFragNum;
1595
1596#if 0
1597 do{
1598 UINT_32 i = 0;
1599 printk("Rx dump address 0x%X, Length %d, FragNum %d, remain %d\n",
1600 prEventDumpMem->u4Address,
1601 prEventDumpMem->u4Length,
1602 prEventDumpMem->ucFragNum,
1603 prEventDumpMem->u4RemainLength);
1604#if 0
1605 for(i = 0; i < prEventDumpMem->u4Length; i++) {
1606 printk("%02X ", prEventDumpMem->aucBuffer[i]);
1607 if(i % 32 == 31) {
1608 printk("\n");
1609 }
1610 }
1611#endif
1612 }while(FALSE);
1613#endif
1614
1615 if(prEventDumpMem->ucFragNum == 1) {
1616 /* Store memory dump into sdcard,
1617 * path /sdcard/dump_<current system tick>_<memory address>_<memory length>.hex
1618 */
1619 u4CurTimeTick = kalGetTimeTick();
1620 sprintf(aucPath, "/sdcard/dump_%d_0x%08X_%d.hex",
1621 u4CurTimeTick,
1622 prEventDumpMem->u4Address,
1623 prEventDumpMem->u4Length + prEventDumpMem->u4RemainLength);
1624 kalWriteToFile(aucPath, FALSE, &prEventDumpMem->aucBuffer[0], prEventDumpMem->u4Length);
1625 }
1626 else {
1627 /* Append current memory dump to the hex file */
1628 kalWriteToFile(aucPath, TRUE, &prEventDumpMem->aucBuffer[0], prEventDumpMem->u4Length);
1629 }
1630
1631 if(prEventDumpMem->u4RemainLength == 0 ||
1632 prEventDumpMem->u4Address == 0xFFFFFFFF) {
1633 /* The request is finished or firmware response a error */
1634 /* Reply time tick to iwpriv */
1635 *((PUINT_32)prCmdInfo->pvInformationBuffer) = u4CurTimeTick;
1636 kalOidComplete(prGlueInfo, prCmdInfo->fgSetQuery, u4QueryInfoLen, WLAN_STATUS_SUCCESS);
1637 }
1638 else {
1639 /* The memory dump request is not finished, Send next command*/
1640 wlanSendMemDumpCmd(
1641 prAdapter,
1642 prCmdInfo->pvInformationBuffer,
1643 prCmdInfo->u4InformationBufferLength);
1644 }
1645 }
1646
1647 return;
1648
1649}
1650
1651#if CFG_SUPPORT_BUILD_DATE_CODE
1652/*----------------------------------------------------------------------------*/
1653/*!
1654* @brief This function is called when event for build date code information
1655* has been retrieved
1656*
1657* @param prAdapter Pointer to the Adapter structure.
1658* @param prCmdInfo Pointer to the command information
1659* @param pucEventBuf Pointer to the event buffer
1660*
1661* @return none
1662*
1663*/
1664/*----------------------------------------------------------------------------*/
1665VOID
1666nicCmdEventBuildDateCode (
1667 IN P_ADAPTER_T prAdapter,
1668 IN P_CMD_INFO_T prCmdInfo,
1669 IN PUINT_8 pucEventBuf
1670 )
1671{
1672 UINT_32 u4QueryInfoLen;
1673 P_EVENT_BUILD_DATE_CODE prEvent;
1674 P_GLUE_INFO_T prGlueInfo;
1675
1676 ASSERT(prAdapter);
1677 ASSERT(prCmdInfo);
1678 ASSERT(pucEventBuf);
1679
1680 //4 <2> Update information of OID
1681 if (prCmdInfo->fgIsOid) {
1682 prGlueInfo = prAdapter->prGlueInfo;
1683 prEvent = (P_EVENT_BUILD_DATE_CODE)pucEventBuf;
1684
1685 u4QueryInfoLen = sizeof(UINT_8) * 16;
1686 kalMemCopy(prCmdInfo->pvInformationBuffer, prEvent->aucDateCode, sizeof(UINT_8) * 16);
1687
1688 kalOidComplete(prGlueInfo, prCmdInfo->fgSetQuery, u4QueryInfoLen, WLAN_STATUS_SUCCESS);
1689 }
1690
1691 return;
1692}
1693#endif
1694
1695
1696/*----------------------------------------------------------------------------*/
1697/*!
1698* @brief This function is called when event for query STA link status
1699* has been retrieved
1700*
1701* @param prAdapter Pointer to the Adapter structure.
1702* @param prCmdInfo Pointer to the command information
1703* @param pucEventBuf Pointer to the event buffer
1704*
1705* @return none
1706*
1707*/
1708/*----------------------------------------------------------------------------*/
1709VOID
1710nicCmdEventQueryStaStatistics (
1711 IN P_ADAPTER_T prAdapter,
1712 IN P_CMD_INFO_T prCmdInfo,
1713 IN PUINT_8 pucEventBuf
1714 )
1715{
1716 UINT_32 u4QueryInfoLen;
1717 P_EVENT_STA_STATISTICS_T prEvent;
1718 P_GLUE_INFO_T prGlueInfo;
1719 P_PARAM_GET_STA_STATISTICS prStaStatistics;
1720
1721 ASSERT(prAdapter);
1722 ASSERT(prCmdInfo);
1723 ASSERT(pucEventBuf);
1724 ASSERT(prCmdInfo->pvInformationBuffer);
1725
1726 if (prCmdInfo->fgIsOid) {
1727 prGlueInfo = prAdapter->prGlueInfo;
1728 prEvent = (P_EVENT_STA_STATISTICS_T)pucEventBuf;
1729 prStaStatistics = (P_PARAM_GET_STA_STATISTICS)prCmdInfo->pvInformationBuffer;
1730
1731 u4QueryInfoLen = sizeof(PARAM_GET_STA_STA_STATISTICS);
1732
1733 /* Statistics from FW is valid */
1734 if(prEvent->u4Flags & BIT(0)) {
1735 prStaStatistics->ucPer = prEvent->ucPer;
1736 prStaStatistics->ucRcpi = prEvent->ucRcpi;
1737 prStaStatistics->u4PhyMode = prEvent->u4PhyMode;
1738 prStaStatistics->u2LinkSpeed = prEvent->u2LinkSpeed;
1739
1740 prStaStatistics->u4TxFailCount = prEvent->u4TxFailCount;
1741 prStaStatistics->u4TxLifeTimeoutCount = prEvent->u4TxLifeTimeoutCount;
1742
1743 if(prEvent->u4TxCount) {
1744 UINT_32 u4TxDoneAirTimeMs = USEC_TO_MSEC(prEvent->u4TxDoneAirTime * 32);
1745
1746 prStaStatistics->u4TxAverageAirTime = (u4TxDoneAirTimeMs / prEvent->u4TxCount);
1747 }
1748 else {
1749 prStaStatistics->u4TxAverageAirTime = 0;
1750 }
1751 }
1752
1753 kalOidComplete(prGlueInfo, prCmdInfo->fgSetQuery, u4QueryInfoLen, WLAN_STATUS_SUCCESS);
1754 }
1755
1756}
1757#if CFG_AUTO_CHANNEL_SEL_SUPPORT
1758
1759//4 Auto Channel Selection
1760
1761/*----------------------------------------------------------------------------*/
1762/*!
1763* @brief This function is called when event for query STA link status
1764* has been retrieved
1765*
1766* @param prAdapter Pointer to the Adapter structure.
1767* @param prCmdInfo Pointer to the command information
1768* @param pucEventBuf Pointer to the event buffer
1769*
1770* @return none
1771*
1772*/
1773/*----------------------------------------------------------------------------*/
1774VOID
1775nicCmdEventQueryChannelLoad (
1776 IN P_ADAPTER_T prAdapter,
1777 IN P_CMD_INFO_T prCmdInfo,
1778 IN PUINT_8 pucEventBuf
1779 )
1780{
1781 UINT_32 u4QueryInfoLen;
1782 P_EVENT_CHN_LOAD_T prEvent;
1783 P_GLUE_INFO_T prGlueInfo;
1784 P_PARAM_GET_CHN_LOAD prChnLoad;
1785
1786 ASSERT(prAdapter);
1787 ASSERT(prCmdInfo);
1788 ASSERT(pucEventBuf);
1789 ASSERT(prCmdInfo->pvInformationBuffer);
1790
1791 if (prCmdInfo->fgIsOid) {
1792 prGlueInfo = prAdapter->prGlueInfo;
1793 prEvent = (P_EVENT_CHN_LOAD_T)pucEventBuf;//4 The firmware responsed data
1794 prChnLoad = (P_PARAM_GET_CHN_LOAD)prCmdInfo->pvInformationBuffer; //4 Fill the firmware data in and send it back to host
1795
1796 u4QueryInfoLen = sizeof(PARAM_GET_CHN_LOAD);
1797
1798 /* Statistics from FW is valid */
1799 if(prEvent->u4Flags & BIT(0)) {
1800 prChnLoad->rEachChnLoad[0].ucChannel = prEvent->ucChannel;
1801 prChnLoad->rEachChnLoad[0].u2ChannelLoad = prEvent->u2ChannelLoad;
1802 printk("CHN[%d]=%d\n",prEvent->ucChannel,prEvent->u2ChannelLoad);
1803
1804 }
1805
1806 kalOidComplete(prGlueInfo, prCmdInfo->fgSetQuery, u4QueryInfoLen, WLAN_STATUS_SUCCESS);
1807 }
1808
1809}
1810VOID
1811nicCmdEventQueryLTESafeChn (
1812 IN P_ADAPTER_T prAdapter,
1813 IN P_CMD_INFO_T prCmdInfo,
1814 IN PUINT_8 pucEventBuf
1815 )
1816{
1817 UINT_32 u4QueryInfoLen;
1818 P_EVENT_LTE_MODE_T prEvent;
1819 P_GLUE_INFO_T prGlueInfo;
1820 P_PARAM_GET_CHN_LOAD prLteSafeChnInfo;
1821
1822 ASSERT(prAdapter);
1823 ASSERT(prCmdInfo);
1824 ASSERT(pucEventBuf);
1825 ASSERT(prCmdInfo->pvInformationBuffer);
1826 if (prCmdInfo->fgIsOid) {
1827 prGlueInfo = prAdapter->prGlueInfo;
1828 prEvent = (P_EVENT_LTE_MODE_T)pucEventBuf;//4 The firmware responsed data
1829
1830 prLteSafeChnInfo = (P_PARAM_GET_CHN_LOAD)prCmdInfo->pvInformationBuffer;
1831
1832 u4QueryInfoLen = sizeof(PARAM_GET_CHN_LOAD);
1833
1834 /* Statistics from FW is valid */
1835 if(prEvent->u4Flags & BIT(0)) {
1836 prLteSafeChnInfo->rLteSafeChnList.ucChannelHigh= prEvent->rLteSafeChn.ucChannelHigh;
1837 prLteSafeChnInfo->rLteSafeChnList.ucChannelLow= prEvent->rLteSafeChn.ucChannelLow;
1838 DBGLOG(P2P, INFO,("[Auto Channel]LTE safe channels from[%d]-[%d]\n",prLteSafeChnInfo->rLteSafeChnList.ucChannelLow,prLteSafeChnInfo->rLteSafeChnList.ucChannelHigh));
1839 }
1840
1841 kalOidComplete(prGlueInfo, prCmdInfo->fgSetQuery, u4QueryInfoLen, WLAN_STATUS_SUCCESS);
1842 }
1843
1844}
1845#endif
1846/*----------------------------------------------------------------------------*/
1847/*!
1848* @brief This function is called when event for query FW bss info
1849* has been retrieved
1850*
1851* @param prAdapter Pointer to the Adapter structure.
1852* @param prCmdInfo Pointer to the command information
1853* @param pucEventBuf Pointer to the event buffer
1854*
1855* @return none
1856*
1857*/
1858/*----------------------------------------------------------------------------*/
1859
1860VOID
1861nicCmdEventGetBSSInfo (
1862 IN P_ADAPTER_T prAdapter,
1863 IN P_CMD_INFO_T prCmdInfo,
1864 IN PUINT_8 pucEventBuf
1865 )
1866{
1867 UINT_32 u4QueryInfoLen;
1868 P_EVENT_AIS_BSS_INFO_T prEvent;
1869 P_GLUE_INFO_T prGlueInfo;
1870 P_BSS_INFO_T prAisBssInfo;
1871
1872 ASSERT(prAdapter);
1873
1874 ASSERT(prCmdInfo);
1875 ASSERT(pucEventBuf);
1876
1877 //4 <2> Update information of OID
1878 if (prCmdInfo->fgIsOid) {
1879 prGlueInfo = prAdapter->prGlueInfo;
1880 prEvent = (P_EVENT_AIS_BSS_INFO_T)pucEventBuf;
1881
1882 u4QueryInfoLen = sizeof(EVENT_AIS_BSS_INFO_T);
1883 kalMemCopy(prCmdInfo->pvInformationBuffer, prEvent, sizeof(EVENT_AIS_BSS_INFO_T));
1884 prAisBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]);
1885
1886 if(prEvent->eCurrentOPMode == OP_MODE_INFRASTRUCTURE){
1887 if (prEvent->eConnectionState != prAisBssInfo->eConnectionState) {
1888 DBGLOG(INIT, ERROR, ("driver[%d] & FW[%d] status didn't sync !!!\n",
1889 prAisBssInfo->eConnectionState, prEvent->eCurrentOPMode));
1890 aisFsmStateAbort(prAdapter, DISCONNECT_REASON_CODE_RADIO_LOST, FALSE);
1891 }
1892 }
1893
1894 kalOidComplete(prGlueInfo, prCmdInfo->fgSetQuery, u4QueryInfoLen, WLAN_STATUS_SUCCESS);
1895 }
1896
1897 return;
1898}
1899
1900
1901
1902