import PULS_20160108
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / misc / mediatek / connectivity / conn_soc / drv_wlan / mt_wifi / wlan / mgmt / cnm.c
1 /*
2 ** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/mgmt/cnm.c#2 $
3 */
4
5 /*! \file "cnm.c"
6 \brief Module of Concurrent Network Management
7
8 Module of Concurrent Network Management
9 */
10
11
12
13 /*
14 ** $Log: cnm.c $
15 *
16 * 07 17 2012 yuche.tsai
17 * NULL
18 * Compile no error before trial run.
19 *
20 * 11 15 2011 cm.chang
21 * NULL
22 * Fix possible wrong message when P2P is unregistered
23 *
24 * 11 14 2011 yuche.tsai
25 * [WCXRP00001107] [Volunteer Patch][Driver] Large Network Type index assert in FW issue.
26 * Fix large network type index assert in FW issue.
27 *
28 * 11 10 2011 cm.chang
29 * NULL
30 * Modify debug message for XLOG
31 *
32 * 11 08 2011 cm.chang
33 * NULL
34 * Add RLM and CNM debug message for XLOG
35 *
36 * 11 01 2011 cm.chang
37 * [WCXRP00001077] [All Wi-Fi][Driver] Fix wrong preferred channel for AP and BOW
38 * Only check AIS channel for P2P and BOW
39 *
40 * 10 25 2011 cm.chang
41 * [WCXRP00001058] [All Wi-Fi][Driver] Fix sta_rec's phyTypeSet and OBSS scan in AP mode
42 * Extension channel of some 5G AP will not follow regulation requirement
43 *
44 * 09 30 2011 cm.chang
45 * [WCXRP00001020] [MT6620 Wi-Fi][Driver] Handle secondary channel offset of AP in 5GHz band
46 * .
47 *
48 * 09 01 2011 cm.chang
49 * [WCXRP00000937] [MT6620 Wi-Fi][Driver][FW] cnm.c line #848 assert when doing monkey test
50 * Print message only in Linux platform for monkey testing
51 *
52 * 06 23 2011 cp.wu
53 * [WCXRP00000798] [MT6620 Wi-Fi][Firmware] Follow-ups for WAPI frequency offset workaround in firmware SCN module
54 * change parameter name from PeerAddr to BSSID
55 *
56 * 06 20 2011 cp.wu
57 * [WCXRP00000798] [MT6620 Wi-Fi][Firmware] Follow-ups for WAPI frequency offset workaround in firmware SCN module
58 * 1. specify target's BSSID when requesting channel privilege.
59 * 2. pass BSSID information to firmware domain
60 *
61 * 06 01 2011 cm.chang
62 * [WCXRP00000756] [MT6620 Wi-Fi][Driver] 1. AIS follow channel of BOW 2. Provide legal channel function
63 * Limit AIS to fixed channel same with BOW
64 *
65 * 04 12 2011 cm.chang
66 * [WCXRP00000634] [MT6620 Wi-Fi][Driver][FW] 2nd BSS will not support 40MHz bandwidth for concurrency
67 * .
68 *
69 * 03 10 2011 cm.chang
70 * [WCXRP00000358] [MT6620 Wi-Fi][Driver] Provide concurrent information for each module
71 * Check if P2P network index is Tethering AP
72 *
73 * 03 10 2011 cm.chang
74 * [WCXRP00000358] [MT6620 Wi-Fi][Driver] Provide concurrent information for each module
75 * Add some functions to let AIS/Tethering or AIS/BOW be the same channel
76 *
77 * 02 17 2011 cm.chang
78 * [WCXRP00000358] [MT6620 Wi-Fi][Driver] Provide concurrent information for each module
79 * When P2P registried, invoke BOW deactivate function
80 *
81 * 01 12 2011 cm.chang
82 * [WCXRP00000358] [MT6620 Wi-Fi][Driver] Provide concurrent information for each module
83 * Provide function to decide if BSS can be activated or not
84 *
85 * 12 07 2010 cm.chang
86 * [WCXRP00000239] MT6620 Wi-Fi][Driver][FW] Merge concurrent branch back to maintrunk
87 * 1. BSSINFO include RLM parameter
88 * 2. free all sta records when network is disconnected
89 *
90 * 12 07 2010 cm.chang
91 * [WCXRP00000238] MT6620 Wi-Fi][Driver][FW] Support regulation domain setting from NVRAM and supplicant
92 * 1. Country code is from NVRAM or supplicant
93 * 2. Change band definition in CMD/EVENT.
94 *
95 * 11 08 2010 cm.chang
96 * [WCXRP00000169] [MT6620 Wi-Fi][Driver][FW] Remove unused CNM recover message ID
97 * Remove CNM channel reover message ID
98 *
99 * 10 13 2010 cm.chang
100 * [WCXRP00000094] [MT6620 Wi-Fi][Driver] Connect to 2.4GHz AP, Driver crash.
101 * Add exception handle when cmd buffer is not available
102 *
103 * 08 24 2010 cm.chang
104 * NULL
105 * Support RLM initail channel of Ad-hoc, P2P and BOW
106 *
107 * 07 19 2010 wh.su
108 *
109 * update for security supporting.
110 *
111 * 07 19 2010 cm.chang
112 *
113 * Set RLM parameters and enable CNM channel manager
114 *
115 * 07 08 2010 cp.wu
116 *
117 * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
118 *
119 * 07 08 2010 cm.chang
120 * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
121 * Rename MID_MNY_CNM_CH_RELEASE to MID_MNY_CNM_CH_ABORT
122 *
123 * 07 01 2010 cm.chang
124 * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
125 * Fix wrong message ID for channel grant to requester
126 *
127 * 07 01 2010 cm.chang
128 * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
129 * Modify CNM message handler for new flow
130 *
131 * 06 07 2010 cm.chang
132 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
133 * Set 20/40M bandwidth of AP HT OP before association process
134 *
135 * 05 31 2010 yarco.yang
136 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
137 * Add RX TSF Log Feature and ADDBA Rsp with DECLINE handling
138 *
139 * 05 21 2010 yarco.yang
140 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
141 * Support TCP/UDP/IP Checksum offload feature
142 *
143 * 05 12 2010 kevin.huang
144 * [BORA00000794][WIFISYS][New Feature]Power Management Support
145 * Add Power Management - Legacy PS-POLL support.
146 *
147 * 05 05 2010 cm.chang
148 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
149 * Add a new function to send abort message
150 *
151 * 04 27 2010 cm.chang
152 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
153 * BMC mac address shall be ignored in basic config command
154 *
155 * 04 24 2010 cm.chang
156 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
157 * g_aprBssInfo[] depends on CFG_SUPPORT_P2P and CFG_SUPPORT_BOW
158 *
159 * 04 22 2010 cm.chang
160 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
161 * Support change of MAC address by host command
162 *
163 * 04 16 2010 wh.su
164 * [BORA00000680][MT6620] Support the statistic for Micxxsoft os query
165 * adding the wpa-none for ibss beacon.
166 *
167 * 04 07 2010 cm.chang
168 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
169 * Fix bug for OBSS scan
170 *
171 * 03 30 2010 cm.chang
172 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
173 * Support 2.4G OBSS scan
174 *
175 * 03 16 2010 kevin.huang
176 * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support
177 * Add AdHoc Mode
178 *
179 * 03 10 2010 kevin.huang
180 * [BORA00000654][WIFISYS][New Feature] CNM Module - Ch Manager Support
181 *
182 * * * * * * * * * * Add Channel Manager for arbitration of JOIN and SCAN Req
183 *
184 * 02 25 2010 wh.su
185 * [BORA00000605][WIFISYS] Phase3 Integration
186 * use the Rx0 dor event indicate.
187 *
188 * 02 08 2010 cm.chang
189 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
190 * Support partial part about cmd basic configuration
191 *
192 * Dec 10 2009 mtk01104
193 * [BORA00000018] Integrate WIFI part into BORA for the 1st time
194 * Remove conditional compiling FPGA_V5
195 *
196 * Nov 18 2009 mtk01104
197 * [BORA00000018] Integrate WIFI part into BORA for the 1st time
198 * Add function cnmFsmEventInit()
199 *
200 * Nov 2 2009 mtk01104
201 * [BORA00000018] Integrate WIFI part into BORA for the 1st time
202 *
203 **
204 */
205
206 /*******************************************************************************
207 * C O M P I L E R F L A G S
208 ********************************************************************************
209 */
210
211 /*******************************************************************************
212 * E X T E R N A L R E F E R E N C E S
213 ********************************************************************************
214 */
215 #include "precomp.h"
216
217 /*******************************************************************************
218 * C O N S T A N T S
219 ********************************************************************************
220 */
221
222 /*******************************************************************************
223 * D A T A T Y P E S
224 ********************************************************************************
225 */
226
227 /*******************************************************************************
228 * P U B L I C D A T A
229 ********************************************************************************
230 */
231
232 /*******************************************************************************
233 * P R I V A T E D A T A
234 ********************************************************************************
235 */
236
237 /*******************************************************************************
238 * M A C R O S
239 ********************************************************************************
240 */
241
242 /*******************************************************************************
243 * F U N C T I O N D E C L A R A T I O N S
244 ********************************************************************************
245 */
246
247 /*******************************************************************************
248 * F U N C T I O N S
249 ********************************************************************************
250 */
251
252 /*----------------------------------------------------------------------------*/
253 /*!
254 * @brief This function is used to initialize variables in CNM_INFO_T.
255 *
256 * @param (none)
257 *
258 * @return (none)
259 */
260 /*----------------------------------------------------------------------------*/
261 VOID
262 cnmInit (
263 P_ADAPTER_T prAdapter
264 )
265 {
266 return;
267 } /* end of cnmInit() */
268
269 /*----------------------------------------------------------------------------*/
270 /*!
271 * @brief This function is used to initialize variables in CNM_INFO_T.
272 *
273 * @param (none)
274 *
275 * @return (none)
276 */
277 /*----------------------------------------------------------------------------*/
278 VOID
279 cnmUninit (
280 P_ADAPTER_T prAdapter
281 )
282 {
283 return;
284 } /* end of cnmUninit() */
285
286 /*----------------------------------------------------------------------------*/
287 /*!
288 * @brief Before handle the message from other module, it need to obtain
289 * the Channel privilege from Channel Manager
290 *
291 * @param[in] prMsgHdr The message need to be handled.
292 *
293 * @return (none)
294 */
295 /*----------------------------------------------------------------------------*/
296 VOID
297 cnmChMngrRequestPrivilege (
298 P_ADAPTER_T prAdapter,
299 P_MSG_HDR_T prMsgHdr
300 )
301 {
302 P_MSG_CH_REQ_T prMsgChReq;
303 P_CMD_CH_PRIVILEGE_T prCmdBody;
304 WLAN_STATUS rStatus;
305
306 ASSERT(prAdapter);
307 ASSERT(prMsgHdr);
308
309 prMsgChReq = (P_MSG_CH_REQ_T) prMsgHdr;
310
311 prCmdBody = (P_CMD_CH_PRIVILEGE_T)
312 cnmMemAlloc(prAdapter, RAM_TYPE_BUF, sizeof(CMD_CH_PRIVILEGE_T));
313 ASSERT(prCmdBody);
314
315 /* To do: exception handle */
316 if (!prCmdBody) {
317 DBGLOG(CNM, ERROR, ("ChReq: fail to get buf (net=%d, token=%d)\n",
318 prMsgChReq->ucNetTypeIndex, prMsgChReq->ucTokenID));
319
320 cnmMemFree(prAdapter, prMsgHdr);
321 return;
322 }
323
324 DBGLOG(CNM, INFO, ("ChReq net=%d token=%d b=%d c=%d s=%d\n",
325 prMsgChReq->ucNetTypeIndex, prMsgChReq->ucTokenID,
326 prMsgChReq->eRfBand, prMsgChReq->ucPrimaryChannel,
327 prMsgChReq->eRfSco));
328
329 prCmdBody->ucNetTypeIndex = prMsgChReq->ucNetTypeIndex;
330 prCmdBody->ucTokenID = prMsgChReq->ucTokenID;
331 prCmdBody->ucAction = CMD_CH_ACTION_REQ; /* Request */
332 prCmdBody->ucPrimaryChannel = prMsgChReq->ucPrimaryChannel;
333 prCmdBody->ucRfSco = (UINT_8) prMsgChReq->eRfSco;
334 prCmdBody->ucRfBand = (UINT_8) prMsgChReq->eRfBand;
335 prCmdBody->ucReqType = (UINT_8) prMsgChReq->eReqType;
336 prCmdBody->ucReserved = 0;
337 prCmdBody->u4MaxInterval= prMsgChReq->u4MaxInterval;
338 COPY_MAC_ADDR(prCmdBody->aucBSSID, prMsgChReq->aucBSSID);
339
340 ASSERT(prCmdBody->ucNetTypeIndex < NETWORK_TYPE_INDEX_NUM);
341
342 /* For monkey testing 20110901 */
343 if (prCmdBody->ucNetTypeIndex >= NETWORK_TYPE_INDEX_NUM) {
344 DBGLOG(CNM, ERROR, ("CNM: ChReq with wrong netIdx=%d\n\n",
345 prCmdBody->ucNetTypeIndex));
346 }
347
348 rStatus = wlanSendSetQueryCmd (
349 prAdapter, /* prAdapter */
350 CMD_ID_CH_PRIVILEGE, /* ucCID */
351 TRUE, /* fgSetQuery */
352 FALSE, /* fgNeedResp */
353 FALSE, /* fgIsOid */
354 NULL, /* pfCmdDoneHandler */
355 NULL, /* pfCmdTimeoutHandler */
356 sizeof(CMD_CH_PRIVILEGE_T), /* u4SetQueryInfoLen */
357 (PUINT_8) prCmdBody, /* pucInfoBuffer */
358 NULL, /* pvSetQueryBuffer */
359 0 /* u4SetQueryBufferLen */
360 );
361
362 ASSERT(rStatus == WLAN_STATUS_PENDING);
363
364 cnmMemFree(prAdapter, prCmdBody);
365 cnmMemFree(prAdapter, prMsgHdr);
366
367 return;
368 } /* end of cnmChMngrRequestPrivilege() */
369
370 /*----------------------------------------------------------------------------*/
371 /*!
372 * @brief Before deliver the message to other module, it need to release
373 * the Channel privilege to Channel Manager.
374 *
375 * @param[in] prMsgHdr The message need to be delivered
376 *
377 * @return (none)
378 */
379 /*----------------------------------------------------------------------------*/
380 VOID
381 cnmChMngrAbortPrivilege (
382 P_ADAPTER_T prAdapter,
383 P_MSG_HDR_T prMsgHdr
384 )
385 {
386 P_MSG_CH_ABORT_T prMsgChAbort;
387 P_CMD_CH_PRIVILEGE_T prCmdBody;
388 WLAN_STATUS rStatus;
389
390 ASSERT(prAdapter);
391 ASSERT(prMsgHdr);
392
393 prMsgChAbort = (P_MSG_CH_ABORT_T) prMsgHdr;
394
395 prCmdBody = (P_CMD_CH_PRIVILEGE_T)
396 cnmMemAlloc(prAdapter, RAM_TYPE_BUF, sizeof(CMD_CH_PRIVILEGE_T));
397 ASSERT(prCmdBody);
398
399 /* To do: exception handle */
400 if (!prCmdBody) {
401 DBGLOG(CNM, ERROR, ("ChAbort: fail to get buf (net=%d, token=%d)\n",
402 prMsgChAbort->ucNetTypeIndex, prMsgChAbort->ucTokenID));
403
404 cnmMemFree(prAdapter, prMsgHdr);
405 return;
406 }
407
408 DBGLOG(CNM, INFO, ("ChAbort net=%d token=%d\n",
409 prMsgChAbort->ucNetTypeIndex, prMsgChAbort->ucTokenID));
410
411 prCmdBody->ucNetTypeIndex = prMsgChAbort->ucNetTypeIndex;
412 prCmdBody->ucTokenID = prMsgChAbort->ucTokenID;
413 prCmdBody->ucAction = CMD_CH_ACTION_ABORT; /* Abort */
414
415 ASSERT(prCmdBody->ucNetTypeIndex < NETWORK_TYPE_INDEX_NUM);
416
417 /* For monkey testing 20110901 */
418 if (prCmdBody->ucNetTypeIndex >= NETWORK_TYPE_INDEX_NUM) {
419 DBGLOG(CNM, ERROR, ("CNM: ChAbort with wrong netIdx=%d\n\n",
420 prCmdBody->ucNetTypeIndex));
421 }
422
423 rStatus = wlanSendSetQueryCmd (
424 prAdapter, /* prAdapter */
425 CMD_ID_CH_PRIVILEGE, /* ucCID */
426 TRUE, /* fgSetQuery */
427 FALSE, /* fgNeedResp */
428 FALSE, /* fgIsOid */
429 NULL, /* pfCmdDoneHandler */
430 NULL, /* pfCmdTimeoutHandler */
431 sizeof(CMD_CH_PRIVILEGE_T), /* u4SetQueryInfoLen */
432 (PUINT_8) prCmdBody, /* pucInfoBuffer */
433 NULL, /* pvSetQueryBuffer */
434 0 /* u4SetQueryBufferLen */
435 );
436
437 ASSERT(rStatus == WLAN_STATUS_PENDING);
438
439 cnmMemFree(prAdapter, prCmdBody);
440 cnmMemFree(prAdapter, prMsgHdr);
441
442 return;
443 } /* end of cnmChMngrAbortPrivilege() */
444
445 /*----------------------------------------------------------------------------*/
446 /*!
447 * @brief
448 *
449 * @param (none)
450 *
451 * @return (none)
452 */
453 /*----------------------------------------------------------------------------*/
454 VOID
455 cnmChMngrHandleChEvent (
456 P_ADAPTER_T prAdapter,
457 P_WIFI_EVENT_T prEvent
458 )
459 {
460 P_EVENT_CH_PRIVILEGE_T prEventBody;
461 P_MSG_CH_GRANT_T prChResp;
462
463 ASSERT(prAdapter);
464 ASSERT(prEvent);
465
466 prEventBody = (P_EVENT_CH_PRIVILEGE_T) (prEvent->aucBuffer);
467 prChResp = (P_MSG_CH_GRANT_T)
468 cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_CH_GRANT_T));
469 ASSERT(prChResp);
470
471 /* To do: exception handle */
472 if (!prChResp) {
473 DBGLOG(CNM, ERROR, ("ChGrant: fail to get buf (net=%d, token=%d)\n",
474 prEventBody->ucNetTypeIndex, prEventBody->ucTokenID));
475
476 return;
477 }
478
479 DBGLOG(CNM, INFO, ("ChGrant net=%d token=%d ch=%d sco=%d\n",
480 prEventBody->ucNetTypeIndex, prEventBody->ucTokenID,
481 prEventBody->ucPrimaryChannel, prEventBody->ucRfSco));
482
483 ASSERT(prEventBody->ucNetTypeIndex < NETWORK_TYPE_INDEX_NUM);
484 ASSERT(prEventBody->ucStatus == EVENT_CH_STATUS_GRANT);
485
486 /* Decide message ID based on network and response status */
487 if (prEventBody->ucNetTypeIndex == NETWORK_TYPE_AIS_INDEX) {
488 prChResp->rMsgHdr.eMsgId = MID_CNM_AIS_CH_GRANT;
489 }
490 #if CFG_ENABLE_WIFI_DIRECT
491 else if ((prAdapter->fgIsP2PRegistered) &&
492 (prEventBody->ucNetTypeIndex == NETWORK_TYPE_P2P_INDEX)) {
493 prChResp->rMsgHdr.eMsgId = MID_CNM_P2P_CH_GRANT;
494 }
495 #endif
496 #if CFG_ENABLE_BT_OVER_WIFI
497 else if (prEventBody->ucNetTypeIndex == NETWORK_TYPE_BOW_INDEX) {
498 prChResp->rMsgHdr.eMsgId = MID_CNM_BOW_CH_GRANT;
499 }
500 #endif
501 else {
502 cnmMemFree(prAdapter, prChResp);
503 return;
504 }
505
506 prChResp->ucNetTypeIndex = prEventBody->ucNetTypeIndex;
507 prChResp->ucTokenID = prEventBody->ucTokenID;
508 prChResp->ucPrimaryChannel = prEventBody->ucPrimaryChannel;
509 prChResp->eRfSco = (ENUM_CHNL_EXT_T) prEventBody->ucRfSco;
510 prChResp->eRfBand = (ENUM_BAND_T) prEventBody->ucRfBand;
511 prChResp->eReqType = (ENUM_CH_REQ_TYPE_T) prEventBody->ucReqType;
512 prChResp->u4GrantInterval = prEventBody->u4GrantInterval;
513
514 mboxSendMsg(prAdapter,
515 MBOX_ID_0,
516 (P_MSG_HDR_T) prChResp,
517 MSG_SEND_METHOD_BUF);
518 }
519
520 /*----------------------------------------------------------------------------*/
521 /*!
522 * @brief This function is invoked for P2P or BOW networks
523 *
524 * @param (none)
525 *
526 * @return TRUE: suggest to adopt the returned preferred channel
527 * FALSE: No suggestion. Caller should adopt its preference
528 */
529 /*----------------------------------------------------------------------------*/
530 BOOLEAN
531 cnmPreferredChannel (
532 P_ADAPTER_T prAdapter,
533 P_ENUM_BAND_T prBand,
534 PUINT_8 pucPrimaryChannel,
535 P_ENUM_CHNL_EXT_T prBssSCO
536 )
537 {
538 P_BSS_INFO_T prBssInfo;
539
540 ASSERT(prAdapter);
541 ASSERT(prBand);
542 ASSERT(pucPrimaryChannel);
543 ASSERT(prBssSCO);
544
545 prBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX];
546
547 if (RLM_NET_PARAM_VALID(prBssInfo)) {
548 *prBand = prBssInfo->eBand;
549 *pucPrimaryChannel = prBssInfo->ucPrimaryChannel;
550 *prBssSCO = prBssInfo->eBssSCO;
551
552 return TRUE;
553 }
554
555 return FALSE;
556 }
557
558 /*----------------------------------------------------------------------------*/
559 /*!
560 * @brief
561 *
562 * @param (none)
563 *
564 * @return TRUE: available channel is limited to return value
565 * FALSE: no limited
566 */
567 /*----------------------------------------------------------------------------*/
568 BOOLEAN
569 cnmAisInfraChannelFixed (
570 P_ADAPTER_T prAdapter,
571 P_ENUM_BAND_T prBand,
572 PUINT_8 pucPrimaryChannel
573 )
574 {
575 #if CFG_ENABLE_WIFI_DIRECT ||(CFG_ENABLE_BT_OVER_WIFI && CFG_BOW_LIMIT_AIS_CHNL)
576 P_BSS_INFO_T prBssInfo;
577 #endif
578
579 #if CFG_ENABLE_WIFI_DIRECT
580 if (IS_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX) &&
581 p2pFuncIsAPMode(prAdapter->rWifiVar.prP2pFsmInfo)) {
582
583 ASSERT(prAdapter->fgIsP2PRegistered);
584
585 prBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX];
586
587 *prBand = prBssInfo->eBand;
588 *pucPrimaryChannel = prBssInfo->ucPrimaryChannel;
589
590 return TRUE;
591 }
592 #endif
593
594 #if CFG_ENABLE_BT_OVER_WIFI && CFG_BOW_LIMIT_AIS_CHNL
595 if (IS_NET_ACTIVE(prAdapter, NETWORK_TYPE_BOW_INDEX)) {
596
597 prBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_BOW_INDEX];
598
599 *prBand = prBssInfo->eBand;
600 *pucPrimaryChannel = prBssInfo->ucPrimaryChannel;
601
602 return TRUE;
603 }
604 #endif
605
606 return FALSE;
607 }
608 #if CFG_SUPPORT_CHNL_CONFLICT_REVISE && CFG_ENABLE_WIFI_DIRECT
609 BOOLEAN
610 cnmAisDetectP2PChannel (
611 P_ADAPTER_T prAdapter,
612 P_ENUM_BAND_T prBand,
613 PUINT_8 pucPrimaryChannel
614 )
615 {
616 P_WIFI_VAR_T prWifiVar = &prAdapter->rWifiVar;
617 P_BSS_INFO_T prP2PBssInfo = &prWifiVar->arBssInfo[NETWORK_TYPE_P2P_INDEX];
618 if (prP2PBssInfo->eConnectionState == PARAM_MEDIA_STATE_CONNECTED ||
619 (prP2PBssInfo->eCurrentOPMode == OP_MODE_ACCESS_POINT &&
620 prP2PBssInfo->eIntendOPMode == OP_MODE_NUM)) {
621 *prBand = prP2PBssInfo->eBand;
622 *pucPrimaryChannel = prP2PBssInfo->ucPrimaryChannel;
623 return TRUE;
624 }
625 return FALSE;
626 }
627 #endif
628 /*----------------------------------------------------------------------------*/
629 /*!
630 * @brief
631 *
632 * @param (none)
633 *
634 * @return (none)
635 */
636 /*----------------------------------------------------------------------------*/
637 VOID
638 cnmAisInfraConnectNotify (
639 P_ADAPTER_T prAdapter
640 )
641 {
642 #if CFG_ENABLE_BT_OVER_WIFI
643 P_BSS_INFO_T prAisBssInfo, prBowBssInfo;
644
645 prAisBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX];
646 prBowBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_BOW_INDEX];
647
648 if (RLM_NET_PARAM_VALID(prAisBssInfo) && RLM_NET_PARAM_VALID(prBowBssInfo)){
649 if (prAisBssInfo->eBand != prBowBssInfo->eBand ||
650 prAisBssInfo->ucPrimaryChannel != prBowBssInfo->ucPrimaryChannel) {
651
652 /* Notify BOW to do deactivation */
653 bowNotifyAllLinkDisconnected(prAdapter);
654 }
655 }
656 #endif
657 }
658
659 /*----------------------------------------------------------------------------*/
660 /*!
661 * @brief
662 *
663 * @param (none)
664 *
665 * @return TRUE: permitted
666 * FALSE: Not permitted
667 */
668 /*----------------------------------------------------------------------------*/
669 BOOLEAN
670 cnmAisIbssIsPermitted (
671 P_ADAPTER_T prAdapter
672 )
673 {
674 #if CFG_ENABLE_WIFI_DIRECT
675 if (IS_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX)) {
676 return FALSE;
677 }
678 #endif
679
680 #if CFG_ENABLE_BT_OVER_WIFI
681 if (IS_NET_ACTIVE(prAdapter, NETWORK_TYPE_BOW_INDEX)) {
682 return FALSE;
683 }
684 #endif
685
686 return TRUE;
687 }
688
689 /*----------------------------------------------------------------------------*/
690 /*!
691 * @brief
692 *
693 * @param (none)
694 *
695 * @return TRUE: permitted
696 * FALSE: Not permitted
697 */
698 /*----------------------------------------------------------------------------*/
699 BOOLEAN
700 cnmP2PIsPermitted (
701 P_ADAPTER_T prAdapter
702 )
703 {
704 P_BSS_INFO_T prBssInfo;
705
706 prBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX];
707
708 if (IS_BSS_ACTIVE(prBssInfo) &&
709 prBssInfo->eCurrentOPMode == OP_MODE_IBSS) {
710 return FALSE;
711 }
712
713 #if CFG_ENABLE_BT_OVER_WIFI
714 if (IS_NET_ACTIVE(prAdapter, NETWORK_TYPE_BOW_INDEX)) {
715 /* Notify BOW to do deactivation */
716 bowNotifyAllLinkDisconnected(prAdapter);
717 }
718 #endif
719
720 return TRUE;
721 }
722
723 /*----------------------------------------------------------------------------*/
724 /*!
725 * @brief
726 *
727 * @param (none)
728 *
729 * @return TRUE: permitted
730 * FALSE: Not permitted
731 */
732 /*----------------------------------------------------------------------------*/
733 BOOLEAN
734 cnmBowIsPermitted (
735 P_ADAPTER_T prAdapter
736 )
737 {
738 P_BSS_INFO_T prBssInfo;
739
740 prBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX];
741
742 if (IS_BSS_ACTIVE(prBssInfo) &&
743 prBssInfo->eCurrentOPMode == OP_MODE_IBSS) {
744 return FALSE;
745 }
746
747 #if CFG_ENABLE_WIFI_DIRECT
748 if (IS_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX)) {
749 return FALSE;
750 }
751 #endif
752
753 return TRUE;
754 }
755
756 /*----------------------------------------------------------------------------*/
757 /*!
758 * @brief
759 *
760 * @param (none)
761 *
762 * @return TRUE: permitted
763 * FALSE: Not permitted
764 */
765 /*----------------------------------------------------------------------------*/
766 BOOLEAN
767 cnmBss40mBwPermitted (
768 P_ADAPTER_T prAdapter,
769 ENUM_NETWORK_TYPE_INDEX_T eNetTypeIdx
770 )
771 {
772 P_BSS_INFO_T prBssInfo;
773 UINT_8 i;
774
775 /* Note: To support real-time decision instead of current activated-time,
776 * the STA roaming case shall be considered about synchronization
777 * problem. Another variable fgAssoc40mBwAllowed is added to
778 * represent HT capability when association
779 */
780 for (i = 0; i < NETWORK_TYPE_INDEX_NUM; i++) {
781 if (i != (UINT_8) eNetTypeIdx) {
782 prBssInfo = &prAdapter->rWifiVar.arBssInfo[i];
783
784 if (IS_BSS_ACTIVE(prBssInfo) && (prBssInfo->fg40mBwAllowed ||
785 prBssInfo->fgAssoc40mBwAllowed)) {
786 return FALSE;
787 }
788 }
789 }
790
791 return TRUE;
792 }
793
794