2 ** $Id: //Department/DaVinci/TRUNK/WiFi_P2P_Driver/mgmt/p2p_fsm.c#61 $
6 \brief This file defines the FSM for P2P Module.
8 This file defines the FSM for P2P Module.
11 /*******************************************************************************
12 * Copyright (c) 2010 MediaTek Inc.
14 * All rights reserved. Copying, compilation, modification, distribution
15 * or any other use whatsoever of this material is strictly prohibited
16 * except in accordance with a Software License Agreement with
18 ********************************************************************************
21 /*******************************************************************************
24 * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND
25 * AGREES THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK
26 * SOFTWARE") RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE
27 * PROVIDED TO BUYER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY
28 * DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT
29 * LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
30 * PARTICULAR PURPOSE OR NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE
31 * ANY WARRANTY WHATSOEVER WITH RESPECT TO THE SOFTWARE OF ANY THIRD PARTY
32 * WHICH MAY BE USED BY, INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK
33 * SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY
34 * WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE
35 * FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S SPECIFICATION OR TO
36 * CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
38 * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
39 * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL
40 * BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT
41 * ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY
42 * BUYER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
44 * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
45 * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT
46 * OF LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING
47 * THEREOF AND RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN
48 * FRANCISCO, CA, UNDER THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE
50 ********************************************************************************
56 ** 08 31 2012 yuche.tsai
57 ** [ALPS00349585] [6577JB][WiFi direct][KE]Establish p2p connection while both device have connected to AP previously,one device reboots automatically with KE
58 ** Fix possible KE when concurrent & disconnect.
60 ** 08 21 2012 yuche.tsai
62 ** fix disconnect indication.
64 ** 08 16 2012 yuche.tsai
66 ** Fix compile warning.
68 ** 08 14 2012 yuche.tsai
70 ** Fix p2p bug find on ALPS.JB trunk.
72 ** 07 27 2012 yuche.tsai
73 ** [ALPS00324337] [ALPS.JB][Hot-Spot] Driver update for Hot-Spot
74 ** Update for driver unload KE issue.
76 ** 07 26 2012 yuche.tsai
77 ** [ALPS00324337] [ALPS.JB][Hot-Spot] Driver update for Hot-Spot
78 ** Update driver code of ALPS.JB for hot-spot.
80 ** 07 19 2012 yuche.tsai
82 ** Code update for JB.
84 * 07 17 2012 yuche.tsai
86 * Compile no error before trial run.
88 * 07 05 2011 yuche.tsai
89 * [WCXRP00000821] [Volunteer Patch][WiFi Direct][Driver] WiFi Direct Connection Speed Issue
90 * Fix the compile flag of enhancement.
92 * 07 05 2011 yuche.tsai
93 * [WCXRP00000808] [Volunteer Patch][MT6620][Driver/FW] Device discoverability issue fix
94 * Change device discoverability methodology. From driver SCAN to FW lock channel.
96 * 07 05 2011 yuche.tsai
97 * [WCXRP00000821] [Volunteer Patch][WiFi Direct][Driver] WiFi Direct Connection Speed Issue
98 * Add wifi direct connection enhancement method I, II & VI.
100 * 07 05 2011 yuche.tsai
101 * [WCXRP00000833] [Volunteer Patch][WiFi Direct][Driver] Service Discovery Frame RX Indicate Issue
102 * Fix Service Discovery Race Condition Issue.
105 * [WCXRP00000798] [MT6620 Wi-Fi][Firmware] Follow-ups for WAPI frequency offset workaround in firmware SCN module
106 * change parameter name from PeerAddr to BSSID
108 * 06 21 2011 yuche.tsai
109 * [WCXRP00000799] [Volunteer Patch][MT6620][Driver] Connection Indication Twice Issue.
110 * Fix an issue of accepting connection of GO.
112 * 06 21 2011 yuche.tsai
113 * [WCXRP00000775] [Volunteer Patch][MT6620][Driver] Dynamic enable SD capability
114 * Drop GAS frame when SD is not enabled.
116 * 06 20 2011 yuche.tsai
120 * 06 20 2011 yuche.tsai
121 * [WCXRP00000799] [Volunteer Patch][MT6620][Driver] Connection Indication Twice Issue.
122 * Fix connection indication twice issue.
125 * [WCXRP00000798] [MT6620 Wi-Fi][Firmware] Follow-ups for WAPI frequency offset workaround in firmware SCN module
126 * 1. specify target's BSSID when requesting channel privilege.
127 * 2. pass BSSID information to firmware domain
129 * 06 20 2011 yuche.tsai
130 * [WCXRP00000795] [Volunteer Patch][MT6620][Driver] GO can not connect second device issue
131 * Solve P2P GO can not formation with second device issue.
133 * 06 14 2011 yuche.tsai
135 * Change disconnect feature.
137 * 06 10 2011 yuche.tsai
138 * [WCXRP00000775] [Volunteer Patch][MT6620][Driver] Dynamic enable SD capability[WCXRP00000776] [Need Patch][MT6620][Driver] MT6620 response probe request of P2P device with P2P IE under Hot Spot mode.
139 * 1. Dynamic enable SD capability after P2P supplicant ready.
140 * 2. Avoid response probe respone with p2p IE when under hot spot mode.
142 * 06 07 2011 yuche.tsai
143 * [WCXRP00000763] [Volunteer Patch][MT6620][Driver] RX Service Discovery Frame under AP mode Issue
144 * Fix RX SD request under AP mode issue.
147 * [WCXRP00000681] [MT5931][Firmware] HIF code size reduction
148 * eliminate unused parameters for SAA-FSM
150 * 05 26 2011 yuche.tsai
151 * [WCXRP00000745] Support accepting connection after one Group Connection Lost.
153 After Group Formation & lost connection, if MT6620 behave as:
155 1. GO: It would keep under GO state until been dissolved by supplicant.
157 At this time, other P2P device can use join method to join this group.
160 2. GC: It would keep on searching target GO or target device until been dissolved by supplicant.
162 At this time, it would ignore other P2P device formation request.
167 Modification: Make driver to accept GO NEGO REQ at this time, to let user decide to accept new connection or not.
169 * [Volunteer Patch][MT6620][Driver]
170 * Driver would indicate connection request, if password ID is not ready but connection request is issued.
172 * 05 18 2011 yuche.tsai
173 * [WCXRP00000728] [Volunteer Patch][MT6620][Driver] Service Discovery Request TX issue.
174 * A solution for both connection request & IO control.
176 * 05 16 2011 yuche.tsai
177 * [WCXRP00000728] [Volunteer Patch][MT6620][Driver] Service Discovery Request TX issue.
178 * Fix SD request can not send out issue.
180 * 05 09 2011 terry.wu
181 * [WCXRP00000711] [MT6620 Wi-Fi][Driver] Set Initial value of StaType in StaRec for Hotspot Client
182 * Set initial value of StaType in StaRec for hotspot client.
184 * 05 04 2011 yuche.tsai
185 * [WCXRP00000697] [Volunteer Patch][MT6620][Driver]
186 * Bug fix for p2p descriptor is NULL if BSS descriptor is found first.
188 * 05 04 2011 yuche.tsai
190 * Support partial persistent group function.
192 * 05 02 2011 yuche.tsai
193 * [WCXRP00000693] [Volunteer Patch][MT6620][Driver] Clear Formation Flag after TX lifetime timeout.
194 * Clear formation flag after formation timeout.
196 * 04 20 2011 yuche.tsai
197 * [WCXRP00000668] [Volunteer Patch][MT6620][Driver] Possible race condition when add scan & query scan result at the same time.
198 * Fix side effect while starting ATGO.
200 * 04 20 2011 yuche.tsai
202 * Fix ASSERT issue in FW, side effect of last change.
204 * 04 19 2011 yuche.tsai
205 * [WCXRP00000668] [Volunteer Patch][MT6620][Driver] Possible race condition when add scan & query scan result at the same time.
206 * Workaround for multiple device connection, before invitation ready.
208 * 04 19 2011 yuche.tsai
209 * [WCXRP00000665] [Wifi Direct][MT6620 E4] When use Ralink's dongle to establish wifi direct connection with PBC. But 6573 always not pop accept option to establish connection.
210 * Support connection indication when GO NEGO REQ doesn't have configure method, instead it has PasswordID.
212 * 04 18 2011 yuche.tsai
216 * 04 14 2011 yuche.tsai
217 * [WCXRP00000646] [Volunteer Patch][MT6620][FW/Driver] Sigma Test Modification for some test case.
218 * Fix a connection issue.
220 * 04 14 2011 yuche.tsai
221 * [WCXRP00000646] [Volunteer Patch][MT6620][FW/Driver] Sigma Test Modification for some test case.
222 * Fix the channel issue of AP mode.
224 * 04 14 2011 yuche.tsai
225 * [WCXRP00000646] [Volunteer Patch][MT6620][FW/Driver] Sigma Test Modification for some test case.
226 * Connection flow refine for Sigma test.
228 * 04 09 2011 yuche.tsai
229 * [WCXRP00000624] [Volunteer Patch][MT6620][Driver] Add device discoverability support for GO.
230 * Fix Device discoverability related issue.
232 * 04 09 2011 yuche.tsai
233 * [WCXRP00000624] [Volunteer Patch][MT6620][Driver] Add device discoverability support for GO.
234 * Fix bug for Device Discoverability.
236 * 04 08 2011 yuche.tsai
237 * [WCXRP00000624] [Volunteer Patch][MT6620][Driver] Add device discoverability support for GO.
240 * 04 08 2011 yuche.tsai
241 * [WCXRP00000624] [Volunteer Patch][MT6620][Driver] Add device discoverability support for GO.
242 * Add device discoverability support.
244 * 03 28 2011 yuche.tsai
246 * Fix a possible issue for retry join when media status connected.
248 * 03 25 2011 yuche.tsai
250 * Improve some error handleing.
252 * 03 24 2011 yuche.tsai
254 * Assign AID before change STA_REC state to state 3.
256 * 03 23 2011 yuche.tsai
258 * Fix Response Rate Issue when TX Auth Rsp Frame under P2P Mode.
260 * 03 23 2011 yuche.tsai
262 * Fix issue of connection to one GC.
264 * 03 23 2011 yuche.tsai
266 * Fix ASSERT issue when starting Hot-spot.
268 * 03 22 2011 yuche.tsai
270 * When Target Information is not available, change to passive mode.
272 * 03 22 2011 yuche.tsai
274 * Fix one connection issue while using Keypad to connect a GO.
276 * 03 22 2011 yuche.tsai
278 * 1. Fix two issues that may cause kernel panic.
280 * 03 22 2011 yuche.tsai
282 * Fix GC connect to other device issue.
284 * 03 22 2011 yuche.tsai
286 * 1.Shorten the LISTEN interval.
287 * 2. Fix IF address issue when we are GO
288 * 3. Fix LISTEN channel issue.
290 * 03 22 2011 yuche.tsai
292 * Modify formation policy setting.
294 * 03 21 2011 yuche.tsai
296 * Solve Listen State doesn't response probe response issue.
298 * 03 21 2011 yuche.tsai
300 * Change P2P Connection Request Flow.
302 * 03 19 2011 yuche.tsai
303 * [WCXRP00000584] [Volunteer Patch][MT6620][Driver] Add beacon timeout support for WiFi Direct.
304 * Add beacon timeout support.
306 * 03 19 2011 yuche.tsai
307 * [WCXRP00000583] [Volunteer Patch][MT6620][Driver] P2P connection of the third peer issue
308 * Indicate the correct Group SSID when join on Group.
310 * 03 19 2011 yuche.tsai
311 * [WCXRP00000583] [Volunteer Patch][MT6620][Driver] P2P connection of the third peer issue
312 * Support the third P2P device to join GO/GC group.
314 * 03 19 2011 yuche.tsai
315 * [WCXRP00000581] [Volunteer Patch][MT6620][Driver] P2P IE in Assoc Req Issue
316 * Append P2P IE in Assoc Req, so that GC can be discovered in probe response of GO.
318 * 03 18 2011 yuche.tsai
319 * [WCXRP00000578] [Volunteer Patch][MT6620][Driver] Separate Connection Request from general IOCTL
320 * Separate connection request from general IOCTL.
322 * 03 18 2011 yuche.tsai
323 * [WCXRP00000574] [Volunteer Patch][MT6620][Driver] Modify P2P FSM Connection Flow
324 * Modify connection flow after Group Formation Complete, or device connect to a GO.
325 * Instead of request channel & connect directly, we use scan to allocate channel bandwidth & connect after RX BCN.
327 * 03 17 2011 yuche.tsai
329 * When AIS is connect to an AP, Hot Spot would be enabled under fixed same channel.
331 * 03 17 2011 yuche.tsai
333 * Solve the Group Info IE in Probe Response incorrect issue.
335 * 03 17 2011 yuche.tsai
337 * Release Channel after Join Complete.
340 * [WCXRP00000530] [MT6620 Wi-Fi] [Driver] skip doing p2pRunEventAAAComplete after send assoc response Tx Done
341 * enable the protected while at P2P start GO, and skip some security check .
343 * 03 15 2011 yuche.tsai
344 * [WCXRP00000560] [Volunteer Patch][MT6620][Driver] P2P Connection from UI using KEY/DISPLAY issue
345 * Fix local configure method issue.
347 * 03 15 2011 yuche.tsai
348 * [WCXRP00000560] [Volunteer Patch][MT6620][Driver] P2P Connection from UI using KEY/DISPLAY issue
349 * Fix some configure method issue.
351 * 03 14 2011 yuche.tsai
355 * 03 14 2011 yuche.tsai
357 * Fix password ID issue.
359 * 03 10 2011 yuche.tsai
363 * 03 08 2011 yuche.tsai
364 * [WCXRP00000480] [Volunteer Patch][MT6620][Driver] WCS IE format issue[WCXRP00000509] [Volunteer Patch][MT6620][Driver] Kernal panic when remove p2p module.
367 * 03 07 2011 yuche.tsai
368 * [WCXRP00000502] [Volunteer Patch][MT6620][Driver] Fix group ID issue when doing Group Formation.
372 * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code
373 * rename the define to anti_pviracy.
376 * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code
377 * add the code to get the check rsponse and indicate to app.
380 * [WCXRP00000510] [MT6620 Wi-Fi] [Driver] Fixed the CTIA enter test mode issue
381 * fixed the p2p action frame type check for device request indication.
383 * 03 02 2011 yuche.tsai
384 * [WCXRP00000245] 1. Invitation Request/Response.
385 2. Provision Discovery Request/Response
387 * Fix Service Discovery RX packet buffer pointer.
389 * 03 01 2011 yuche.tsai
390 * [WCXRP00000501] [Volunteer Patch][MT6620][Driver] No common channel issue when doing GO formation
391 * Update channel issue when doing GO formation..
393 * 03 01 2011 yuche.tsai
394 * [WCXRP00000245] 1. Invitation Request/Response.
395 2. Provision Discovery Request/Response
397 * Update Service Discovery Related wlanoid function.
399 * 02 21 2011 yuche.tsai
400 * [WCXRP00000481] [Volunteer Patch][MT6620][FW] Scan hang under concurrent case.
401 * Fix all BE issue of WSC or P2P IE.
404 * [WCXRP00000471] [MT6620 Wi-Fi][Driver] Add P2P Provison discovery append Config Method attribute at WSC IE
405 * fixed the wsc config method mapping to driver used config method issue.
407 * 02 18 2011 yuche.tsai
408 * [WCXRP00000479] [Volunteer Patch][MT6620][Driver] Probe Response of P2P using 11b rate.
409 * Update basic rate to FW, after P2P is initialed.
411 * 02 18 2011 yuche.tsai
412 * [WCXRP00000478] [Volunteer Patch][MT6620][Driver] Probe request frame during search phase do not contain P2P wildcard SSID.
413 * Use P2P Wildcard SSID when scan type of P2P_WILDCARD_SSID is set.
415 * 02 18 2011 yuche.tsai
416 * [WCXRP00000480] [Volunteer Patch][MT6620][Driver] WCS IE format issue
417 * Fix WSC IE BE format issue.
420 * [WCXRP00000471] [MT6620 Wi-Fi][Driver] Add P2P Provison discovery append Config Method attribute at WSC IE
421 * append the WSC IE config method attribute at provision discovery request.
424 * [WCXRP00000448] [MT6620 Wi-Fi][Driver] Fixed WSC IE not send out at probe request
425 * fixed the probe request send out without WSC IE issue (at P2P).
427 * 02 16 2011 yuche.tsai
428 * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode.
429 * If two station connected to the Hot-Spot and one disconnect, FW would get into an infinite loop
431 * 02 15 2011 yuche.tsai
432 * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode.
433 * Fix re-connection issue after RX deauthentication.
435 * 02 15 2011 yuche.tsai
436 * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode.
437 * Fix conneciton issue after disconnect with AP.
439 * 02 12 2011 yuche.tsai
440 * [WCXRP00000441] [Volunteer Patch][MT6620][Driver] BoW can not create desired station type when Hot Spot is enabled.
441 * P2P Create Station Type according to Target BSS capability.
443 * 02 10 2011 yuche.tsai
444 * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode.
445 * Support Disassoc & Deauthentication for Hot-Spot.
447 * 02 09 2011 yuche.tsai
448 * [WCXRP00000245] 1. Invitation Request/Response.
449 2. Provision Discovery Request/Response
451 * Add Service Discovery Indication Related code.
453 * 02 09 2011 yuche.tsai
454 * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode.
455 * Add Support for MLME deauthentication for Hot-Spot.
457 * 02 09 2011 yuche.tsai
458 * [WCXRP00000429] [Volunteer Patch][MT6620][Driver] Hot Spot Client Limit Issue
459 * Fix Client Limit Issue.
461 * 02 08 2011 yuche.tsai
462 * [WCXRP00000419] [Volunteer Patch][MT6620/MT5931][Driver] Provide function of disconnect to target station for AAA module.
463 * Disconnect every station client when disolve on P2P group.
465 * 02 08 2011 yuche.tsai
466 * [WCXRP00000245] 1. Invitation Request/Response.
467 2. Provision Discovery Request/Response
469 * 1. Fix Service Disocvery Logical issue.
470 * 2. Fix a NULL pointer access violation issue when sending deauthentication packet to a class error station.
472 * 02 08 2011 yuche.tsai
473 * [WCXRP00000419] [Volunteer Patch][MT6620/MT5931][Driver] Provide function of disconnect to target station for AAA module.
474 * Workaround of disable P2P network.
476 * 02 08 2011 yuche.tsai
477 * [WCXRP00000421] [Volunteer Patch][MT6620][Driver] Fix incorrect SSID length Issue
478 * 1. Fixed SSID wrong length issue.
479 * 2. Under Hot Spot configuration, there won't be any P2P IE.
480 * 3. Under Hot Spot configuration, P2P FSM won't get into LISTEN state first.
482 * 01 27 2011 yuche.tsai
483 * [WCXRP00000399] [Volunteer Patch][MT6620/MT5931][Driver] Fix scan side effect after P2P module separate.
484 * Modify Start GO flow.
486 * 01 27 2011 yuche.tsai
487 * [WCXRP00000399] [Volunteer Patch][MT6620/MT5931][Driver] Fix scan side effect after P2P module separate.
488 * Fix desire phy type set issue.
490 * 01 27 2011 yuche.tsai
491 * [WCXRP00000399] [Volunteer Patch][MT6620/MT5931][Driver] Fix scan side effect after P2P module separate.
492 * Add desire phy type set phase I.
494 * 01 26 2011 yuche.tsai
495 * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record.
496 * Fix P2P Disconnect Issue.
498 * 01 26 2011 yuche.tsai
499 * [WCXRP00000245] 1. Invitation Request/Response.
500 2. Provision Discovery Request/Response
502 * Add Service Discovery Function.
504 * 01 26 2011 cm.chang
505 * [WCXRP00000395] [MT6620 Wi-Fi][Driver][FW] Search STA_REC with additional net type index argument
508 * 01 25 2011 yuche.tsai
509 * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record.
510 * Fix compile error when DBG is disabled.
512 * 01 25 2011 yuche.tsai
513 * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record.
514 * Change Station Type Definition.
516 * 01 19 2011 yuche.tsai
517 * [WCXRP00000353] [Volunteer Patch][MT6620][Driver] Desired Non-HT Rate Set update when STA record is created under AP Mode.
518 * Add P2P QoS Support.
520 * 01 19 2011 george.huang
521 * [WCXRP00000355] [MT6620 Wi-Fi] Set WMM-PS related setting with qualifying AP capability
522 * Null NOA attribute setting when no related parameters.
524 * 01 14 2011 yuche.tsai
525 * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue
526 * Modify AAA flow according to CM's comment.
528 * 01 13 2011 yuche.tsai
529 * [WCXRP00000353] [Volunteer Patch][MT6620][Driver] Desired Non-HT Rate Set update when STA record is created under AP Mode.
530 * Resolve Channel ZERO issue. (Uninitialized default channel)
532 * 01 13 2011 yuche.tsai
533 * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue
534 * Update P2P State Debug Message.
536 * 01 12 2011 yuche.tsai
537 * [WCXRP00000353] [Volunteer Patch][MT6620][Driver] Desired Non-HT Rate Set update when STA record is created under AP Mode.
538 * Fix bug when allocating message buffer.
540 * 01 12 2011 yuche.tsai
541 * [WCXRP00000353] [Volunteer Patch][MT6620][Driver] Desired Non-HT Rate Set update when STA record is created under AP Mode.
542 * Update Phy Type Set. When legacy client is connected, it can use 11b rate,
543 * but if the P2P device is connected, 11b rate is not allowed.
545 * 01 12 2011 yuche.tsai
546 * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue
547 * 1. Modify Channel Acquire Time of AP mode from 5s to 1s.
548 * 2. Call cnmP2pIsPermit() before active P2P network.
549 * 3. Add channel selection support for AP mode.
551 * 01 12 2011 yuche.tsai
552 * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue
553 * Fix Bug of reference to NULL pointer.
555 * 01 12 2011 yuche.tsai
556 * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue
557 * Modify some behavior of AP mode.
559 * 01 12 2011 yuche.tsai
560 * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue
561 * Fix bug of wrong pointer check.
563 * 01 12 2011 yuche.tsai
564 * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue
567 * 01 11 2011 yuche.tsai
568 * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue
569 * Add station record into client list before change it state from STATE_2 to STATE_3.
571 * 01 05 2011 yuche.tsai
572 * [WCXRP00000345] [MT6620][Volunteer Patch] P2P may issue a SSID specified scan request, but the SSID length is still invalid.
573 * Specify SSID Type when issue a scan request.
576 * [WCXRP00000338] [MT6620 Wi-Fi][Driver] Separate kalMemAlloc into kmalloc and vmalloc implementations to ease physically continous memory demands
579 * 01 05 2011 george.huang
580 * [WCXRP00000343] [MT6620 Wi-Fi] Add TSF reset path for concurrent operation
581 * modify NOA update path for preventing assertion false alarm.
584 * [WCXRP00000338] [MT6620 Wi-Fi][Driver] Separate kalMemAlloc into kmalloc and vmalloc implementations to ease physically continous memory demands
585 * separate kalMemAlloc() into virtually-continous and physically-continous type to ease slab system pressure
588 * [WCXRP00000326] [MT6620][Wi-Fi][Driver] check in the binary format gl_sec.o.new instead of use change type!!!
589 * let the p2p ap mode acept a legacy device join.
591 * 12 22 2010 yuche.tsai
592 * [WCXRP00000245] 1. Invitation Request/Response.
593 2. Provision Discovery Request/Response
597 * 12 15 2010 yuche.tsai
598 * [WCXRP00000245] 1. Invitation Request/Response.
599 2. Provision Discovery Request/Response
601 * Refine Connection Flow.
603 * 12 08 2010 yuche.tsai
604 * [WCXRP00000245] [MT6620][Driver] Invitation & Provision Discovery Feature Check-in
605 * [WCXRP000000245][MT6620][Driver] Invitation Request Feature Add
607 * 12 08 2010 yuche.tsai
608 * [WCXRP00000244] [MT6620][Driver] Add station record type for each client when in AP mode.
609 * Change STA Type under AP mode. We would tell if client is a P2P device or a legacy client by checking the P2P IE in assoc req frame.
611 * 12 07 2010 cm.chang
612 * [WCXRP00000239] MT6620 Wi-Fi][Driver][FW] Merge concurrent branch back to maintrunk
613 * The order of invoking nicUpdateBss() and rlm functions
615 * 12 02 2010 yuche.tsai
617 * Update P2P Connection Policy for Invitation.
619 * 12 02 2010 yuche.tsai
621 * Update P2P Connection Policy for Invitation & Provision Discovery.
623 * 11 30 2010 yuche.tsai
625 * Invitation & Provision Discovery Indication.
627 * 11 30 2010 yuche.tsai
629 * Update Configure Method indication & selection for Provision Discovery & GO_NEGO_REQ
631 * 11 30 2010 yuche.tsai
633 * Update RCIP value when RX assoc request frame.
635 * 11 29 2010 yuche.tsai
637 * Update P2P related function for INVITATION & PROVISION DISCOVERY.
639 * 11 26 2010 george.huang
640 * [WCXRP00000152] [MT6620 Wi-Fi] AP mode power saving function
641 * Update P2P PS for NOA function.
643 * 11 25 2010 yuche.tsai
645 * Update Code for Invitation Related Function.
648 * [WCXRP00000164] [MT6620 Wi-Fi][Driver] Support the p2p random SSID[WCXRP00000179] [MT6620 Wi-Fi][FW] Set the Tx lowest rate at wlan table for normal operation
649 * fixed some ASSERT check.
652 * [WCXRP00000164] [MT6620 Wi-Fi][Driver] Support the p2p random SSID
653 * fixed the p2p role code error.
656 * [WCXRP00000164] [MT6620 Wi-Fi][Driver] Support the p2p random SSID
657 * adding the p2p random ssid support.
660 * [WCXRP00000124] [MT6620 Wi-Fi] [Driver] Support the dissolve P2P Group
661 * fixed the ASSERT check error
664 * [WCXRP00000124] [MT6620 Wi-Fi] [Driver] Support the dissolve P2P Group
665 * Add the code to support disconnect p2p group
668 * [WCXRP00000085] [MT6620 Wif-Fi] [Driver] update the modified p2p state machine[WCXRP00000102] [MT6620 Wi-Fi] [FW] Add a compiling flag and code for support Direct GO at Android
669 * fixed the compiling error.
672 * [WCXRP00000102] [MT6620 Wi-Fi] [FW] Add a compiling flag and code for support Direct GO at Android
673 * adding a code to support Direct GO with a compiling flag .
676 * [WCXRP00000087] [MT6620 Wi-Fi][Driver] Cannot connect to 5GHz AP, driver will cause FW assert.
677 * correct erroneous logic: specifying eBand with incompatible eSco
680 * [WCXRP00000085] [MT6620 Wif-Fi] [Driver] update the modified p2p state machine
681 * fixed the compiling error.
684 * [WCXRP00000085] [MT6620 Wif-Fi] [Driver] update the modified p2p state machine
685 * update the frog's new p2p state machine.
689 * fixed the compiling error at WinXP.
691 * 09 07 2010 yuche.tsai
693 * Reset Common IE Buffer of P2P INFO when scan request is issued.
694 * If an action frame other than public action frame is received, return direcly.
698 * adding the code for beacon/probe req/ probe rsp wsc ie at p2p.
702 * let the p2p can set the privacy bit at beacon and rsn ie at assoc req at key handshake state.
704 * 09 03 2010 kevin.huang
706 * Refine #include sequence and solve recursive/nested #include issue
708 * 08 26 2010 yuche.tsai
710 * Add P2P Connection Abort Event Message handler.
712 * 08 24 2010 cm.chang
714 * Support RLM initail channel of Ad-hoc, P2P and BOW
716 * 08 23 2010 yuche.tsai
718 * 1. Fix Interface Address from GO Nego Req/Rsp is not correct.
719 * 2. Fix GO mode does not change media state after station connected.
720 * 3. Fix STA don't response probe request when there is a connection request.
722 * 08 20 2010 cm.chang
724 * Migrate RLM code to host from FW
726 * 08 20 2010 kevin.huang
728 * Modify AAA Module for changing STA STATE 3 at p2p/bowRunEventAAAComplete()
730 * 08 20 2010 yuche.tsai
732 * Add Glue Layer indication.
734 * 08 17 2010 yuche.tsai
736 * Fix compile warning under Linux.
738 * 08 17 2010 yuche.tsai
740 * Fix some P2P FSM bug.
742 * 08 16 2010 yuche.tsai
744 * Add random Interface Address Generation support.
746 * 08 16 2010 yuche.tsai
748 * Fix some P2P FSM bug.
750 * 08 16 2010 yuche.tsai
752 * Update P2P FSM code for GO Nego.
754 * 08 16 2010 kevin.huang
756 * Refine AAA functions
758 * 08 12 2010 kevin.huang
760 * Refine bssProcessProbeRequest() and bssSendBeaconProbeResponse()
762 * 08 12 2010 yuche.tsai
764 * Join complete indication.
766 * 08 11 2010 yuche.tsai
768 * Add two boolean in connection request.
769 * Based on these two boolean value, P2P FSM should
770 * decide to do invitation or group formation or start a GO directly.
772 * 08 11 2010 yuche.tsai
774 * Update P2P FSM, currently P2P Device Discovery is verified.
776 * 08 05 2010 yuche.tsai
778 * Update P2P FSM for group formation.
780 * 08 03 2010 george.huang
782 * handle event for updating NOA parameters indicated from FW
786 * limit build always needs spin-lock declaration.
788 * 08 02 2010 yuche.tsai
790 * P2P Group Negotiation Code Check in.
792 * 07 26 2010 yuche.tsai
794 * Add P2P FSM code check in.
796 * 07 21 2010 yuche.tsai
798 * Add P2P Scan & Scan Result Parsing & Saving.
800 * 07 19 2010 yuche.tsai
804 * 07 09 2010 george.huang
806 * [WPD00001556] Migrate PM variables from FW to driver: for composing QoS Info
810 * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
812 * 06 21 2010 yuche.tsai
813 * [WPD00003839][MT6620 5931][P2P] Feature migration
814 * Fix compile error while enable WIFI_DIRECT support.
816 * 06 21 2010 yuche.tsai
817 * [WPD00003839][MT6620 5931][P2P] Feature migration
818 * Update P2P Function call.
820 * 06 17 2010 yuche.tsai
821 * [WPD00003839][MT6620 5931][P2P] Feature migration
822 * First draft for migration P2P FSM from FW to Driver.
824 * 04 19 2010 kevin.huang
825 * [BORA00000714][WIFISYS][New Feature]Beacon Timeout Support
826 * Add Beacon Timeout Support and will send Null frame to diagnose connection
828 * 03 18 2010 kevin.huang
829 * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support
830 * Rename CFG flag for P2P
832 * 02 26 2010 kevin.huang
833 * [BORA00000603][WIFISYS] [New Feature] AAA Module Support
834 * Add code to test P2P GO
836 * 02 23 2010 kevin.huang
837 * [BORA00000603][WIFISYS] [New Feature] AAA Module Support
838 * Add Wi-Fi Direct SSID and P2P GO Test Mode
840 * 02 05 2010 kevin.huang
841 * [BORA00000603][WIFISYS] [New Feature] AAA Module Support
842 * Modify code due to BAND_24G define was changed
844 * 02 05 2010 kevin.huang
845 * [BORA00000603][WIFISYS] [New Feature] AAA Module Support
846 * Revise data structure to share the same BSS_INFO_T for avoiding coding error
848 * 02 04 2010 kevin.huang
849 * [BORA00000603][WIFISYS] [New Feature] AAA Module Support
850 * Add AAA Module Support, Revise Net Type to Net Type Index for array lookup
853 /*******************************************************************************
854 * C O M P I L E R F L A G S
855 ********************************************************************************
858 /*******************************************************************************
859 * E X T E R N A L R E F E R E N C E S
860 ********************************************************************************
864 #if CFG_ENABLE_WIFI_DIRECT
866 /*******************************************************************************
868 ********************************************************************************
871 /*******************************************************************************
873 ********************************************************************************
876 /*******************************************************************************
877 * P U B L I C D A T A
878 ********************************************************************************
881 /*******************************************************************************
882 * P R I V A T E D A T A
883 ********************************************************************************
886 /*lint -save -e64 Type mismatch */
887 static PUINT_8 apucDebugP2pState[P2P_STATE_NUM] = {
888 (PUINT_8)DISP_STRING("P2P_STATE_IDLE"),
889 (PUINT_8)DISP_STRING("P2P_STATE_SCAN"),
890 (PUINT_8)DISP_STRING("P2P_STATE_AP_CHANNEL_DETECT"),
891 (PUINT_8)DISP_STRING("P2P_STATE_REQING_CHANNEL"),
892 (PUINT_8)DISP_STRING("P2P_STATE_CHNL_ON_HAND"),
893 (PUINT_8)DISP_STRING("P2P_STATE_GC_JOIN")
899 /*******************************************************************************
901 ********************************************************************************
904 /*******************************************************************************
905 * F U N C T I O N D E C L A R A T I O N S
906 ********************************************************************************
909 /*******************************************************************************
911 ********************************************************************************
914 /* p2pStateXXX : Processing P2P FSM related action.
915 * p2pFSMXXX : Control P2P FSM flow.
916 * p2pFuncXXX : Function for doing one thing.
920 IN P_ADAPTER_T prAdapter
924 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
925 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
928 ASSERT_BREAK(prAdapter != NULL);
930 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
931 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
933 ASSERT_BREAK(prP2pFsmInfo != NULL);
935 LINK_INITIALIZE(&(prP2pFsmInfo->rMsgEventQueue));
937 prP2pFsmInfo->eCurrentState = prP2pFsmInfo->ePreviousState = P2P_STATE_IDLE;
938 prP2pFsmInfo->prTargetBss = NULL;
940 cnmTimerInitTimer(prAdapter,
941 &(prP2pFsmInfo->rP2pFsmTimeoutTimer),
942 (PFN_MGMT_TIMEOUT_FUNC)p2pFsmRunEventFsmTimeout,
943 (UINT_32)prP2pFsmInfo);
945 //4 <2> Initiate BSS_INFO_T - common part
946 BSS_INFO_INIT(prAdapter, NETWORK_TYPE_P2P_INDEX);
949 //4 <2.1> Initiate BSS_INFO_T - Setup HW ID
950 prP2pBssInfo->ucConfigAdHocAPMode = AP_MODE_11G_P2P;
951 prP2pBssInfo->ucHwDefaultFixedRateCode = RATE_OFDM_6M;
954 prP2pBssInfo->ucNonHTBasicPhyType = (UINT_8)
955 rNonHTApModeAttributes[prP2pBssInfo->ucConfigAdHocAPMode].ePhyTypeIndex;
956 prP2pBssInfo->u2BSSBasicRateSet =
957 rNonHTApModeAttributes[prP2pBssInfo->ucConfigAdHocAPMode].u2BSSBasicRateSet;
959 prP2pBssInfo->u2OperationalRateSet =
960 rNonHTPhyAttributes[prP2pBssInfo->ucNonHTBasicPhyType].u2SupportedRateSet;
962 rateGetDataRatesFromRateSet(prP2pBssInfo->u2OperationalRateSet,
963 prP2pBssInfo->u2BSSBasicRateSet,
964 prP2pBssInfo->aucAllSupportedRates,
965 &prP2pBssInfo->ucAllSupportedRatesLen);
967 prP2pBssInfo->prBeacon = cnmMgtPktAlloc(prAdapter,
968 OFFSET_OF(WLAN_BEACON_FRAME_T, aucInfoElem[0]) + MAX_IE_LENGTH);
970 if (prP2pBssInfo->prBeacon) {
971 prP2pBssInfo->prBeacon->eSrc = TX_PACKET_MGMT;
972 prP2pBssInfo->prBeacon->ucStaRecIndex = 0xFF; /* NULL STA_REC */
973 prP2pBssInfo->prBeacon->ucNetworkType = NETWORK_TYPE_P2P_INDEX;
980 prP2pBssInfo->eCurrentOPMode = OP_MODE_NUM;
982 prP2pBssInfo->rPmProfSetupInfo.ucBmpDeliveryAC = PM_UAPSD_ALL;
983 prP2pBssInfo->rPmProfSetupInfo.ucBmpTriggerAC = PM_UAPSD_ALL;
984 prP2pBssInfo->rPmProfSetupInfo.ucUapsdSp = WMM_MAX_SP_LENGTH_2;
985 prP2pBssInfo->ucPrimaryChannel = P2P_DEFAULT_LISTEN_CHANNEL;
986 prP2pBssInfo->eBand = BAND_2G4;
987 prP2pBssInfo->eBssSCO = CHNL_EXT_SCN;
989 if (prAdapter->rWifiVar.fgSupportQoS) {
990 prP2pBssInfo->fgIsQBSS = TRUE;
993 prP2pBssInfo->fgIsQBSS = FALSE;
996 SET_NET_PWR_STATE_IDLE(prAdapter, NETWORK_TYPE_P2P_INDEX);
998 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
1009 /*----------------------------------------------------------------------------*/
1011 * @brief The function is used to uninitialize the value in P2P_FSM_INFO_T for
1018 /*----------------------------------------------------------------------------*/
1021 IN P_ADAPTER_T prAdapter
1024 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1025 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
1028 ASSERT_BREAK(prAdapter != NULL);
1030 DEBUGFUNC("p2pFsmUninit()");
1031 DBGLOG(P2P, INFO, ("->p2pFsmUninit()\n"));
1033 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1034 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
1036 p2pFuncSwitchOPMode(prAdapter, prP2pBssInfo, OP_MODE_P2P_DEVICE, TRUE);
1038 p2pFsmRunEventAbort(prAdapter, prP2pFsmInfo);
1040 p2pStateAbort_IDLE(prAdapter, prP2pFsmInfo, P2P_STATE_NUM);
1042 UNSET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX);
1044 wlanAcquirePowerControl(prAdapter);
1046 /* Release all pending CMD queue. */
1047 DBGLOG(P2P, TRACE, ("p2pFsmUninit: wlanProcessCommandQueue, num of element:%d\n", prAdapter->prGlueInfo->rCmdQueue.u4NumElem));
1048 wlanProcessCommandQueue(prAdapter, &prAdapter->prGlueInfo->rCmdQueue);
1050 wlanReleasePowerControl(prAdapter);
1052 /* Release pending mgmt frame,
1053 * mgmt frame may be pending by CMD without resource.
1055 kalClearMgmtFramesByNetType(prAdapter->prGlueInfo, NETWORK_TYPE_P2P_INDEX);
1057 /* Clear PendingCmdQue*/
1058 wlanReleasePendingCMDbyNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX);
1060 if (prP2pBssInfo->prBeacon) {
1061 cnmMgtPktFree(prAdapter, prP2pBssInfo->prBeacon);
1062 prP2pBssInfo->prBeacon = NULL;
1069 } /* end of p2pFsmUninit() */
1072 p2pFsmStateTransition (
1073 IN P_ADAPTER_T prAdapter,
1074 IN P_P2P_FSM_INFO_T prP2pFsmInfo,
1075 IN ENUM_P2P_STATE_T eNextState
1078 BOOLEAN fgIsTransOut = (BOOLEAN)FALSE;
1079 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
1080 P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo = (P_P2P_SPECIFIC_BSS_INFO_T)NULL;
1083 ASSERT_BREAK((prAdapter != NULL) && (prP2pFsmInfo != NULL));
1085 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
1086 prP2pSpecificBssInfo = prAdapter->rWifiVar.prP2pSpecificBssInfo;
1088 if (!IS_BSS_ACTIVE(prP2pBssInfo)) {
1089 if (!cnmP2PIsPermitted(prAdapter)) {
1093 SET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX);
1094 nicActivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX);
1097 fgIsTransOut = fgIsTransOut?FALSE:TRUE;
1099 if (!fgIsTransOut) {
1100 DBGLOG(P2P, STATE, ("TRANSITION: [%s] -> [%s]\n",
1101 apucDebugP2pState[prP2pFsmInfo->eCurrentState],
1102 apucDebugP2pState[eNextState]));
1104 /* Transition into current state. */
1105 prP2pFsmInfo->ePreviousState = prP2pFsmInfo->eCurrentState;
1106 prP2pFsmInfo->eCurrentState = eNextState;
1110 switch (prP2pFsmInfo->eCurrentState) {
1111 case P2P_STATE_IDLE:
1114 p2pStateAbort_IDLE(prAdapter,
1119 fgIsTransOut = p2pStateInit_IDLE(prAdapter,
1126 case P2P_STATE_SCAN:
1129 // Scan done / scan canceled.
1130 p2pStateAbort_SCAN(prAdapter, prP2pFsmInfo, eNextState);
1133 // Initial scan request.
1134 p2pStateInit_SCAN(prAdapter, prP2pFsmInfo);
1138 case P2P_STATE_AP_CHANNEL_DETECT:
1141 // Get sparse channel result.
1142 p2pStateAbort_AP_CHANNEL_DETECT(prAdapter,
1144 prP2pSpecificBssInfo,
1149 // Initial passive scan request.
1150 p2pStateInit_AP_CHANNEL_DETECT(prAdapter, prP2pFsmInfo);
1154 case P2P_STATE_REQING_CHANNEL:
1157 // Channel on hand / Channel canceled.
1158 p2pStateAbort_REQING_CHANNEL(prAdapter, prP2pFsmInfo, eNextState);
1161 // Initial channel request.
1162 p2pFuncAcquireCh(prAdapter, &(prP2pFsmInfo->rChnlReqInfo));
1166 case P2P_STATE_CHNL_ON_HAND:
1168 p2pStateAbort_CHNL_ON_HAND(prAdapter, prP2pFsmInfo, prP2pBssInfo, eNextState);
1171 // Initial channel ready.
1172 // Send channel ready event.
1173 // Start a FSM timer.
1174 p2pStateInit_CHNL_ON_HAND(prAdapter, prP2pBssInfo, prP2pFsmInfo);
1178 case P2P_STATE_GC_JOIN:
1181 // Join complete / join canceled.
1182 p2pStateAbort_GC_JOIN(prAdapter,
1184 &(prP2pFsmInfo->rJoinInfo),
1188 ASSERT(prP2pFsmInfo->prTargetBss != NULL);
1190 // Send request to SAA module.
1191 p2pStateInit_GC_JOIN(prAdapter,
1194 &(prP2pFsmInfo->rJoinInfo),
1195 prP2pFsmInfo->prTargetBss);
1203 } while (fgIsTransOut);
1205 } /* p2pFsmStateTransition */
1209 p2pFsmRunEventSwitchOPMode (
1210 IN P_ADAPTER_T prAdapter,
1211 IN P_MSG_HDR_T prMsgHdr
1214 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
1215 P_MSG_P2P_SWITCH_OP_MODE_T prSwitchOpMode = (P_MSG_P2P_SWITCH_OP_MODE_T)prMsgHdr;
1216 P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = (P_P2P_CONNECTION_SETTINGS_T)NULL;
1219 ASSERT_BREAK((prAdapter != NULL) && (prSwitchOpMode != NULL));
1221 DBGLOG(P2P, TRACE, ("p2pFsmRunEventSwitchOPMode\n"));
1223 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
1224 prP2pConnSettings = prAdapter->rWifiVar.prP2PConnSettings;
1226 if (prSwitchOpMode->eOpMode >= OP_MODE_NUM) {
1231 /* P2P Device / GC. */
1232 p2pFuncSwitchOPMode(prAdapter,
1234 prSwitchOpMode->eOpMode,
1240 cnmMemFree(prAdapter, prMsgHdr);
1244 } /* p2pFsmRunEventSwitchOPMode */
1247 /*----------------------------------------------------------------------------*/
1249 * \brief This function is used to handle scan done event during Device Discovery.
1251 * \param[in] prAdapter Pointer of ADAPTER_T
1255 /*----------------------------------------------------------------------------*/
1257 p2pFsmRunEventScanDone (
1258 IN P_ADAPTER_T prAdapter,
1259 IN P_MSG_HDR_T prMsgHdr
1262 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1263 P_P2P_SCAN_REQ_INFO_T prScanReqInfo = (P_P2P_SCAN_REQ_INFO_T)NULL;
1264 P_MSG_SCN_SCAN_DONE prScanDoneMsg = (P_MSG_SCN_SCAN_DONE)NULL;
1265 ENUM_P2P_STATE_T eNextState = P2P_STATE_NUM;
1268 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1271 /* This scan done event is either for "SCAN" phase or "SEARCH" state or "LISTEN" state.
1272 * The scan done for SCAN phase & SEARCH state doesn't imply Device
1275 DBGLOG(P2P, TRACE, ("P2P Scan Done Event\n"));
1277 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1279 if (prP2pFsmInfo == NULL) {
1284 prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo);
1285 prScanDoneMsg = (P_MSG_SCN_SCAN_DONE)prMsgHdr;
1287 if (prScanDoneMsg->ucSeqNum != prScanReqInfo->ucSeqNumOfScnMsg) {
1288 /* Scan Done message sequence number mismatch.
1289 * Ignore this event. (P2P FSM issue two scan events.)
1291 /* The scan request has been cancelled.
1292 * Ignore this message. It is possible.
1294 DBGLOG(P2P, TRACE, ("P2P Scan Don SeqNum:%d <-> P2P Fsm SCAN Msg:%d\n",
1295 prScanDoneMsg->ucSeqNum,
1296 prScanReqInfo->ucSeqNumOfScnMsg));
1302 switch (prP2pFsmInfo->eCurrentState) {
1303 case P2P_STATE_SCAN:
1305 P_P2P_CONNECTION_REQ_INFO_T prConnReqInfo = &(prP2pFsmInfo->rConnReqInfo);
1307 prScanReqInfo->fgIsAbort = FALSE;
1309 if (prConnReqInfo->fgIsConnRequest) {
1311 if ((prP2pFsmInfo->prTargetBss = p2pFuncKeepOnConnection(prAdapter,
1312 &prP2pFsmInfo->rConnReqInfo,
1313 &prP2pFsmInfo->rChnlReqInfo,
1314 &prP2pFsmInfo->rScanReqInfo)) == NULL) {
1315 eNextState = P2P_STATE_SCAN;
1318 eNextState = P2P_STATE_REQING_CHANNEL;
1323 eNextState = P2P_STATE_IDLE;
1328 case P2P_STATE_AP_CHANNEL_DETECT:
1329 eNextState = P2P_STATE_REQING_CHANNEL;
1332 /* Unexpected channel scan done event without being chanceled. */
1337 prScanReqInfo->fgIsScanRequest = FALSE;
1339 p2pFsmStateTransition(prAdapter,
1346 cnmMemFree(prAdapter, prMsgHdr);
1350 } /* p2pFsmRunEventScanDone */
1354 /*----------------------------------------------------------------------------*/
1356 * \brief This function is call when channel is granted by CNM module from FW.
1358 * \param[in] prAdapter Pointer of ADAPTER_T
1362 /*----------------------------------------------------------------------------*/
1364 p2pFsmRunEventChGrant (
1365 IN P_ADAPTER_T prAdapter,
1366 IN P_MSG_HDR_T prMsgHdr
1369 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1370 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = (P_P2P_CHNL_REQ_INFO_T)NULL;
1371 P_MSG_CH_GRANT_T prMsgChGrant = (P_MSG_CH_GRANT_T)NULL;
1372 UINT_8 ucTokenID = 0;
1375 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1377 DBGLOG(P2P, TRACE, ("P2P Run Event Channel Grant\n"));
1379 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1381 if (prP2pFsmInfo == NULL) {
1385 prMsgChGrant = (P_MSG_CH_GRANT_T)prMsgHdr;
1386 ucTokenID = prMsgChGrant->ucTokenID;
1387 prP2pFsmInfo->u4GrantInterval = prMsgChGrant->u4GrantInterval;
1389 prChnlReqInfo = &(prP2pFsmInfo->rChnlReqInfo);
1391 if (ucTokenID == prChnlReqInfo->ucSeqNumOfChReq) {
1392 ENUM_P2P_STATE_T eNextState = P2P_STATE_NUM;
1394 switch (prP2pFsmInfo->eCurrentState) {
1395 case P2P_STATE_REQING_CHANNEL:
1396 switch (prChnlReqInfo->eChannelReqType) {
1397 case CHANNEL_REQ_TYPE_REMAIN_ON_CHANNEL:
1398 eNextState = P2P_STATE_CHNL_ON_HAND;
1400 case CHANNEL_REQ_TYPE_GC_JOIN_REQ:
1401 eNextState = P2P_STATE_GC_JOIN;
1403 case CHANNEL_REQ_TYPE_GO_START_BSS:
1404 eNextState = P2P_STATE_IDLE;
1410 p2pFsmStateTransition(prAdapter,
1415 /* Channel is granted under unexpected state.
1416 * Driver should cancel channel privileagea before leaving the states.
1424 /* Channel requsted, but released. */
1425 ASSERT(!prChnlReqInfo->fgIsChannelRequested);
1430 cnmMemFree(prAdapter, prMsgHdr);
1435 } /* p2pFsmRunEventChGrant */
1439 p2pFsmRunEventChannelRequest (
1440 IN P_ADAPTER_T prAdapter,
1441 IN P_MSG_HDR_T prMsgHdr
1444 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = (P_P2P_CHNL_REQ_INFO_T)NULL;
1445 P_MSG_P2P_CHNL_REQUEST_T prP2pChnlReqMsg = (P_MSG_P2P_CHNL_REQUEST_T)NULL;
1446 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1447 ENUM_P2P_STATE_T eNextState = P2P_STATE_NUM;
1450 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1452 prP2pChnlReqMsg = (P_MSG_P2P_CHNL_REQUEST_T)prMsgHdr;
1453 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1455 if (prP2pFsmInfo == NULL) {
1459 prChnlReqInfo = &(prP2pFsmInfo->rChnlReqInfo);
1461 DBGLOG(P2P, TRACE, ("p2pFsmRunEventChannelRequest\n"));
1463 /* Special case of time renewing for same frequency. */
1464 if ((prP2pFsmInfo->eCurrentState == P2P_STATE_CHNL_ON_HAND) &&
1465 (prChnlReqInfo->ucReqChnlNum == prP2pChnlReqMsg->rChannelInfo.ucChannelNum) &&
1466 (prChnlReqInfo->eBand == prP2pChnlReqMsg->rChannelInfo.eBand) &&
1467 (prChnlReqInfo->eChnlSco == prP2pChnlReqMsg->eChnlSco)) {
1469 ASSERT(prChnlReqInfo->fgIsChannelRequested == TRUE);
1470 ASSERT(prChnlReqInfo->eChannelReqType == CHANNEL_REQ_TYPE_REMAIN_ON_CHANNEL);
1472 prChnlReqInfo->u8Cookie = prP2pChnlReqMsg->u8Cookie;
1473 prChnlReqInfo->u4MaxInterval = prP2pChnlReqMsg->u4Duration;
1475 /* Re-enter the state. */
1476 eNextState = P2P_STATE_CHNL_ON_HAND;
1480 // Make sure the state is in IDLE state.
1481 p2pFsmRunEventAbort(prAdapter, prP2pFsmInfo);
1483 prChnlReqInfo->u8Cookie = prP2pChnlReqMsg->u8Cookie; /* Cookie can only be assign after abort.(for indication) */
1484 prChnlReqInfo->ucReqChnlNum = prP2pChnlReqMsg->rChannelInfo.ucChannelNum;
1485 prChnlReqInfo->eBand = prP2pChnlReqMsg->rChannelInfo.eBand;
1486 prChnlReqInfo->eChnlSco = prP2pChnlReqMsg->eChnlSco;
1487 prChnlReqInfo->u4MaxInterval = prP2pChnlReqMsg->u4Duration;
1488 prChnlReqInfo->eChannelReqType = CHANNEL_REQ_TYPE_REMAIN_ON_CHANNEL;
1490 eNextState = P2P_STATE_REQING_CHANNEL;
1493 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, eNextState);
1499 cnmMemFree(prAdapter, prMsgHdr);
1503 } /* p2pFsmRunEventChannelRequest */
1507 p2pFsmRunEventChannelAbort (
1508 IN P_ADAPTER_T prAdapter,
1509 IN P_MSG_HDR_T prMsgHdr
1512 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1513 P_MSG_P2P_CHNL_ABORT_T prChnlAbortMsg = (P_MSG_P2P_CHNL_ABORT_T)NULL;
1514 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = (P_P2P_CHNL_REQ_INFO_T)NULL;
1517 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1519 prChnlAbortMsg = (P_MSG_P2P_CHNL_ABORT_T)prMsgHdr;
1520 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1522 if (prP2pFsmInfo == NULL) {
1526 prChnlReqInfo = &prP2pFsmInfo->rChnlReqInfo;
1528 DBGLOG(P2P, TRACE, ("p2pFsmRunEventChannelAbort\n"));
1530 if ((prChnlAbortMsg->u8Cookie == prChnlReqInfo->u8Cookie) &&
1531 (prChnlReqInfo->fgIsChannelRequested)) {
1533 ASSERT((prP2pFsmInfo->eCurrentState == P2P_STATE_REQING_CHANNEL ||
1534 (prP2pFsmInfo->eCurrentState == P2P_STATE_CHNL_ON_HAND)));
1536 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
1542 cnmMemFree(prAdapter, prMsgHdr);
1546 } /* p2pFsmRunEventChannelAbort */
1551 p2pFsmRunEventScanRequest (
1552 IN P_ADAPTER_T prAdapter,
1553 IN P_MSG_HDR_T prMsgHdr
1557 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1558 P_MSG_P2P_SCAN_REQUEST_T prP2pScanReqMsg = (P_MSG_P2P_SCAN_REQUEST_T)NULL;
1559 P_P2P_SCAN_REQ_INFO_T prScanReqInfo = (P_P2P_SCAN_REQ_INFO_T)NULL;
1560 UINT_32 u4ChnlListSize = 0;
1563 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1565 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1567 if (prP2pFsmInfo == NULL) {
1571 prP2pScanReqMsg = (P_MSG_P2P_SCAN_REQUEST_T)prMsgHdr;
1572 prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo);
1574 DBGLOG(P2P, TRACE, ("p2pFsmRunEventScanRequest\n"));
1576 // Make sure the state is in IDLE state.
1577 p2pFsmRunEventAbort(prAdapter, prP2pFsmInfo);
1579 ASSERT(prScanReqInfo->fgIsScanRequest == FALSE);
1581 prScanReqInfo->fgIsAbort = TRUE;
1582 prScanReqInfo->eScanType = SCAN_TYPE_ACTIVE_SCAN;
1583 prScanReqInfo->eChannelSet = SCAN_CHANNEL_SPECIFIED;
1586 prScanReqInfo->ucNumChannelList = prP2pScanReqMsg->u4NumChannel;
1587 DBGLOG(P2P, TRACE, ("Scan Request Channel List Number: %d\n", prScanReqInfo->ucNumChannelList));
1588 if (prScanReqInfo->ucNumChannelList > MAXIMUM_OPERATION_CHANNEL_LIST) {
1589 DBGLOG(P2P, TRACE, ("Channel List Number Overloaded: %d, change to: %d\n",
1590 prScanReqInfo->ucNumChannelList,
1591 MAXIMUM_OPERATION_CHANNEL_LIST));
1592 prScanReqInfo->ucNumChannelList = MAXIMUM_OPERATION_CHANNEL_LIST;
1595 u4ChnlListSize = sizeof(RF_CHANNEL_INFO_T) * prScanReqInfo->ucNumChannelList;
1596 kalMemCopy(prScanReqInfo->arScanChannelList, prP2pScanReqMsg->arChannelListInfo, u4ChnlListSize);
1598 // TODO: I only take the first SSID. Multiple SSID may be needed in the future.
1600 if (prP2pScanReqMsg->i4SsidNum >= 1) {
1602 kalMemCopy(&(prScanReqInfo->rSsidStruct),
1603 prP2pScanReqMsg->prSSID,
1604 sizeof(P2P_SSID_STRUCT_T));
1607 prScanReqInfo->rSsidStruct.ucSsidLen = 0;
1611 kalMemCopy(prScanReqInfo->aucIEBuf,
1612 prP2pScanReqMsg->pucIEBuf,
1613 prP2pScanReqMsg->u4IELen);
1615 prScanReqInfo->u4BufLength = prP2pScanReqMsg->u4IELen;
1617 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_SCAN);
1624 cnmMemFree(prAdapter, prMsgHdr);
1628 } /* p2pFsmRunEventScanRequest */
1632 p2pFsmRunEventScanAbort (
1633 IN P_ADAPTER_T prAdapter,
1634 IN P_MSG_HDR_T prMsgHdr
1638 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1641 ASSERT_BREAK(prAdapter != NULL);
1643 DBGLOG(P2P, TRACE, ("p2pFsmRunEventScanAbort\n"));
1645 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1647 if (prP2pFsmInfo->eCurrentState == P2P_STATE_SCAN) {
1648 P_P2P_SCAN_REQ_INFO_T prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo);
1650 prScanReqInfo->fgIsAbort = TRUE;
1652 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
1658 cnmMemFree(prAdapter, prMsgHdr);
1662 } /* p2pFsmRunEventScanAbort */
1669 p2pFsmRunEventAbort (
1670 IN P_ADAPTER_T prAdapter,
1671 IN P_P2P_FSM_INFO_T prP2pFsmInfo
1674 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
1676 ASSERT_BREAK((prAdapter != NULL) && (prP2pFsmInfo != NULL));
1678 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
1680 DBGLOG(P2P, TRACE, ("p2pFsmRunEventAbort\n"));
1682 if (prP2pFsmInfo->eCurrentState != P2P_STATE_IDLE) {
1684 if (prP2pFsmInfo->eCurrentState == P2P_STATE_SCAN) {
1686 P_P2P_SCAN_REQ_INFO_T prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo);
1688 prScanReqInfo->fgIsAbort = TRUE;
1690 else if (prP2pFsmInfo->eCurrentState == P2P_STATE_REQING_CHANNEL) {
1694 prP2pBssInfo->eIntendOPMode = OP_MODE_NUM;
1697 // For other state, is there any special action that should be take before leaving?
1699 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
1702 /* P2P State IDLE. */
1703 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = &(prP2pFsmInfo->rChnlReqInfo);
1705 if (prChnlReqInfo->fgIsChannelRequested) {
1706 p2pFuncReleaseCh(prAdapter, prChnlReqInfo);
1709 cnmTimerStopTimer(prAdapter, &(prP2pFsmInfo->rP2pFsmTimeoutTimer));
1716 } /* p2pFsmRunEventAbort */
1720 /*----------------------------------------------------------------------------*/
1722 * \brief This function is used to handle FSM Timeout.
1724 * \param[in] prAdapter Pointer of ADAPTER_T
1728 /*----------------------------------------------------------------------------*/
1730 p2pFsmRunEventFsmTimeout (
1731 IN P_ADAPTER_T prAdapter,
1735 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)u4Param;
1738 ASSERT_BREAK((prAdapter != NULL) && (prP2pFsmInfo != NULL));
1740 DBGLOG(P2P, TRACE, ("P2P FSM Timeout Event\n"));
1742 switch (prP2pFsmInfo->eCurrentState) {
1743 case P2P_STATE_IDLE:
1745 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = &prP2pFsmInfo->rChnlReqInfo;
1746 if (prChnlReqInfo->fgIsChannelRequested) {
1747 p2pFuncReleaseCh(prAdapter, prChnlReqInfo);
1749 else if (IS_NET_PWR_STATE_IDLE(prAdapter, NETWORK_TYPE_P2P_INDEX)) {
1750 UNSET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX);
1751 nicDeactivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX);
1757 // case P2P_STATE_SCAN:
1759 // case P2P_STATE_AP_CHANNEL_DETECT:
1761 // case P2P_STATE_REQING_CHANNEL:
1763 case P2P_STATE_CHNL_ON_HAND:
1765 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
1768 // case P2P_STATE_GC_JOIN:
1777 } /* p2pFsmRunEventFsmTimeout */
1780 p2pFsmRunEventMgmtFrameTx (
1781 IN P_ADAPTER_T prAdapter,
1782 IN P_MSG_HDR_T prMsgHdr
1785 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1786 P_MSG_P2P_MGMT_TX_REQUEST_T prMgmtTxMsg = (P_MSG_P2P_MGMT_TX_REQUEST_T)NULL;
1789 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1791 DBGLOG(P2P, TRACE, ("p2pFsmRunEventMgmtFrameTx\n"));
1793 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1795 if (prP2pFsmInfo == NULL) {
1799 prMgmtTxMsg = (P_MSG_P2P_MGMT_TX_REQUEST_T)prMsgHdr;
1801 p2pFuncTxMgmtFrame(prAdapter,
1802 &prP2pFsmInfo->rMgmtTxInfo,
1803 prMgmtTxMsg->prMgmtMsduInfo,
1804 prMgmtTxMsg->u8Cookie);
1811 cnmMemFree(prAdapter, prMsgHdr);
1816 } /* p2pFsmRunEventMgmtTx */
1820 p2pFsmRunEventStartAP (
1821 IN P_ADAPTER_T prAdapter,
1822 IN P_MSG_HDR_T prMsgHdr
1825 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1826 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
1827 P_MSG_P2P_START_AP_T prP2pStartAPMsg = (P_MSG_P2P_START_AP_T)NULL;
1828 P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo = (P_P2P_SPECIFIC_BSS_INFO_T)NULL;
1831 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1833 DBGLOG(P2P, TRACE, ("p2pFsmRunEventStartAP\n"));
1835 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1837 if (prP2pFsmInfo == NULL) {
1841 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
1842 prP2pStartAPMsg = (P_MSG_P2P_START_AP_T)prMsgHdr;
1843 prP2pSpecificBssInfo = prAdapter->rWifiVar.prP2pSpecificBssInfo;
1846 if (prP2pStartAPMsg->u4BcnInterval) {
1847 DBGLOG(P2P, TRACE, ("Beacon interval updated to :%ld \n", prP2pStartAPMsg->u4BcnInterval));
1848 prP2pBssInfo->u2BeaconInterval = (UINT_16)prP2pStartAPMsg->u4BcnInterval;
1850 else if (prP2pBssInfo->u2BeaconInterval == 0) {
1851 prP2pBssInfo->u2BeaconInterval = DOT11_BEACON_PERIOD_DEFAULT;
1854 if (prP2pStartAPMsg->u4DtimPeriod) {
1855 DBGLOG(P2P, TRACE, ("DTIM interval updated to :%ld \n", prP2pStartAPMsg->u4DtimPeriod));
1856 prP2pBssInfo->ucDTIMPeriod = (UINT_8)prP2pStartAPMsg->u4DtimPeriod;
1858 else if (prP2pBssInfo->ucDTIMPeriod == 0) {
1859 prP2pBssInfo->ucDTIMPeriod = DOT11_DTIM_PERIOD_DEFAULT;
1862 if (prP2pStartAPMsg->u2SsidLen != 0) {
1863 kalMemCopy(prP2pBssInfo->aucSSID, prP2pStartAPMsg->aucSsid, prP2pStartAPMsg->u2SsidLen);
1864 kalMemCopy(prP2pSpecificBssInfo->aucGroupSsid, prP2pStartAPMsg->aucSsid, prP2pStartAPMsg->u2SsidLen);
1865 prP2pBssInfo->ucSSIDLen = prP2pSpecificBssInfo->u2GroupSsidLen = prP2pStartAPMsg->u2SsidLen;
1869 prP2pBssInfo->eHiddenSsidType = prP2pStartAPMsg->ucHiddenSsidType;
1873 /* Privacy & inactive timeout. */
1875 if ((prP2pBssInfo->eCurrentOPMode != OP_MODE_ACCESS_POINT) ||
1876 (prP2pBssInfo->eIntendOPMode != OP_MODE_NUM)) {
1877 UINT_8 ucPreferedChnl = 0;
1878 ENUM_BAND_T eBand = BAND_NULL;
1879 ENUM_CHNL_EXT_T eSco = CHNL_EXT_SCN;
1880 ENUM_P2P_STATE_T eNextState = P2P_STATE_SCAN;
1881 P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = prAdapter->rWifiVar.prP2PConnSettings;
1884 if(prP2pFsmInfo->eCurrentState != P2P_STATE_SCAN &&
1885 prP2pFsmInfo->eCurrentState != P2P_STATE_IDLE) {
1886 // Make sure the state is in IDLE state.
1887 p2pFsmRunEventAbort(prAdapter, prP2pFsmInfo);
1890 // 20120118: Moved to p2pFuncSwitchOPMode().
1891 //SET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX);
1893 /* Leave IDLE state. */
1894 SET_NET_PWR_STATE_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX);
1896 // sync with firmware
1897 //DBGLOG(P2P, INFO, ("Activate P2P Network. \n"));
1898 //nicActivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX);
1901 /* Key to trigger P2P FSM to allocate channel for AP mode. */
1902 prP2pBssInfo->eIntendOPMode = OP_MODE_ACCESS_POINT;
1904 /* Sparse Channel to decide which channel to use. */
1905 if ((cnmPreferredChannel(prAdapter,
1908 &eSco) == FALSE) && (prP2pConnSettings->ucOperatingChnl == 0)) {
1909 // Sparse Channel Detection using passive mode.
1910 eNextState = P2P_STATE_AP_CHANNEL_DETECT;
1913 P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo = prAdapter->rWifiVar.prP2pSpecificBssInfo;
1914 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = &prP2pFsmInfo->rChnlReqInfo;
1918 /* 2012-01-27: frog - Channel set from upper layer is the first priority. */
1919 /* Becuase the channel & beacon is decided by p2p_supplicant. */
1920 if (prP2pConnSettings->ucOperatingChnl != 0) {
1921 prP2pSpecificBssInfo->ucPreferredChannel = prP2pConnSettings->ucOperatingChnl;
1922 prP2pSpecificBssInfo->eRfBand = prP2pConnSettings->eBand;
1926 ASSERT(ucPreferedChnl != 0);
1927 prP2pSpecificBssInfo->ucPreferredChannel = ucPreferedChnl;
1928 prP2pSpecificBssInfo->eRfBand = eBand;
1931 if (ucPreferedChnl) {
1932 prP2pSpecificBssInfo->ucPreferredChannel = ucPreferedChnl;
1933 prP2pSpecificBssInfo->eRfBand = eBand;
1936 ASSERT(prP2pConnSettings->ucOperatingChnl != 0);
1937 prP2pSpecificBssInfo->ucPreferredChannel = prP2pConnSettings->ucOperatingChnl;
1938 prP2pSpecificBssInfo->eRfBand = prP2pConnSettings->eBand;
1942 prChnlReqInfo->ucReqChnlNum = prP2pSpecificBssInfo->ucPreferredChannel;
1943 prChnlReqInfo->eBand = prP2pSpecificBssInfo->eRfBand;
1944 prChnlReqInfo->eChannelReqType = CHANNEL_REQ_TYPE_GO_START_BSS;
1947 /* If channel is specified, use active scan to shorten the scan time. */
1948 p2pFsmStateTransition(prAdapter,
1949 prAdapter->rWifiVar.prP2pFsmInfo,
1960 cnmMemFree(prAdapter, prMsgHdr);
1964 } /* p2pFsmRunEventStartAP */
1967 p2pFsmRunEventNetDeviceRegister (
1968 IN P_ADAPTER_T prAdapter,
1969 IN P_MSG_HDR_T prMsgHdr
1972 P_MSG_P2P_NETDEV_REGISTER_T prNetDevRegisterMsg = (P_MSG_P2P_NETDEV_REGISTER_T)NULL;
1977 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1979 DBGLOG(P2P, TRACE, ("p2pFsmRunEventNetDeviceRegister\n"));
1981 prNetDevRegisterMsg = (P_MSG_P2P_NETDEV_REGISTER_T)prMsgHdr;
1983 if (prNetDevRegisterMsg->fgIsEnable) {
1984 p2pSetMode((prNetDevRegisterMsg->ucMode == 1)?TRUE:FALSE);
1986 if (p2pLaunch(prAdapter->prGlueInfo)) {
1987 ASSERT(prAdapter->fgIsP2PRegistered);
1992 if (prAdapter->fgIsP2PRegistered) {
1993 p2pRemove(prAdapter->prGlueInfo);
2000 cnmMemFree(prAdapter, prMsgHdr);
2004 } /* p2pFsmRunEventNetDeviceRegister */
2008 p2pFsmRunEventUpdateMgmtFrame (
2009 IN P_ADAPTER_T prAdapter,
2010 IN P_MSG_HDR_T prMsgHdr
2013 P_MSG_P2P_MGMT_FRAME_UPDATE_T prP2pMgmtFrameUpdateMsg = (P_MSG_P2P_MGMT_FRAME_UPDATE_T)NULL;
2014 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2017 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
2019 DBGLOG(P2P, TRACE, ("p2pFsmRunEventUpdateMgmtFrame\n"));
2021 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2023 if (prP2pFsmInfo == NULL) {
2027 prP2pMgmtFrameUpdateMsg = (P_MSG_P2P_MGMT_FRAME_UPDATE_T)prMsgHdr;
2029 switch (prP2pMgmtFrameUpdateMsg->eBufferType) {
2030 case ENUM_FRAME_TYPE_EXTRA_IE_BEACON:
2032 case ENUM_FRAME_TYPE_EXTRA_IE_ASSOC_RSP:
2034 case ENUM_FRAME_TYPE_EXTRA_IE_PROBE_RSP:
2036 case ENUM_FRAME_TYPE_PROBE_RSP_TEMPLATE:
2038 case ENUM_FRAME_TYPE_BEACON_TEMPLATE:
2047 cnmMemFree(prAdapter, prMsgHdr);
2051 } /* p2pFsmRunEventUpdateMgmtFrame */
2055 p2pFsmRunEventBeaconUpdate (
2056 IN P_ADAPTER_T prAdapter,
2057 IN P_MSG_HDR_T prMsgHdr
2060 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2061 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2062 P_MSG_P2P_BEACON_UPDATE_T prBcnUpdateMsg = (P_MSG_P2P_BEACON_UPDATE_T)NULL;
2065 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
2067 DBGLOG(P2P, TRACE, ("p2pFsmRunEventBeaconUpdate\n"));
2069 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2071 if (prP2pFsmInfo == NULL) {
2075 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2076 prBcnUpdateMsg = (P_MSG_P2P_BEACON_UPDATE_T)prMsgHdr;
2079 p2pFuncBeaconUpdate(prAdapter,
2081 &prP2pFsmInfo->rBcnContentInfo,
2082 prBcnUpdateMsg->pucBcnHdr,
2083 prBcnUpdateMsg->u4BcnHdrLen,
2084 prBcnUpdateMsg->pucBcnBody,
2085 prBcnUpdateMsg->u4BcnBodyLen);
2087 if ((prP2pBssInfo->eCurrentOPMode == OP_MODE_ACCESS_POINT) &&
2088 (prP2pBssInfo->eIntendOPMode == OP_MODE_NUM)) {
2089 /* AP is created, Beacon Update. */
2090 //nicPmIndicateBssAbort(prAdapter, NETWORK_TYPE_P2P_INDEX);
2092 bssUpdateBeaconContent(prAdapter, NETWORK_TYPE_P2P_INDEX);
2094 //nicPmIndicateBssCreated(prAdapter, NETWORK_TYPE_P2P_INDEX);
2103 cnmMemFree(prAdapter, prMsgHdr);
2106 } /* p2pFsmRunEventBeaconUpdate */
2110 p2pFsmRunEventStopAP (
2111 IN P_ADAPTER_T prAdapter,
2112 IN P_MSG_HDR_T prMsgHdr
2115 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2118 ASSERT_BREAK((prAdapter != NULL));
2120 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2122 DBGLOG(P2P, TRACE, ("p2pFsmRunEventStopAP\n"));
2124 if ((prP2pBssInfo->eCurrentOPMode == OP_MODE_ACCESS_POINT)
2125 && (prP2pBssInfo->eIntendOPMode == OP_MODE_NUM)) {
2126 /* AP is created, Beacon Update. */
2128 p2pFuncDissolve(prAdapter, prP2pBssInfo, TRUE, REASON_CODE_DEAUTH_LEAVING_BSS);
2130 DBGLOG(P2P, TRACE, ("Stop Beaconing\n"));
2131 nicPmIndicateBssAbort(prAdapter, NETWORK_TYPE_P2P_INDEX);
2133 /* Reset RLM related field of BSSINFO. */
2134 rlmBssAborted(prAdapter, prP2pBssInfo);
2139 // 20120118: Moved to p2pFuncSwitchOPMode().
2140 //UNSET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX);
2142 /* Enter IDLE state. */
2143 SET_NET_PWR_STATE_IDLE(prAdapter, NETWORK_TYPE_P2P_INDEX);
2145 DBGLOG(P2P, INFO, ("Re activate P2P Network. \n"));
2146 nicDeactivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX);
2148 nicActivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX);
2150 p2pFsmRunEventAbort(prAdapter, prAdapter->rWifiVar.prP2pFsmInfo);
2151 // p2pFsmStateTransition(prAdapter, prAdapter->rWifiVar.prP2pFsmInfo, P2P_STATE_IDLE);
2156 cnmMemFree(prAdapter, prMsgHdr);
2159 } /* p2pFsmRunEventStopAP */
2162 p2pFsmRunEventConnectionRequest (
2163 IN P_ADAPTER_T prAdapter,
2164 IN P_MSG_HDR_T prMsgHdr
2167 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2168 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2169 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = (P_P2P_CHNL_REQ_INFO_T)NULL;
2170 P_MSG_P2P_CONNECTION_REQUEST_T prConnReqMsg = (P_MSG_P2P_CONNECTION_REQUEST_T)NULL;
2171 P_P2P_CONNECTION_REQ_INFO_T prConnReqInfo = (P_P2P_CONNECTION_REQ_INFO_T)NULL;
2174 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
2176 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2177 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2179 if (prP2pFsmInfo == NULL) {
2183 prConnReqMsg = (P_MSG_P2P_CONNECTION_REQUEST_T)prMsgHdr;
2185 prConnReqInfo = &(prP2pFsmInfo->rConnReqInfo);
2186 prChnlReqInfo = &(prP2pFsmInfo->rChnlReqInfo);
2188 DBGLOG(P2P, TRACE, ("p2pFsmRunEventConnectionRequest\n"));
2190 if (prP2pBssInfo->eCurrentOPMode != OP_MODE_INFRASTRUCTURE) {
2194 SET_NET_PWR_STATE_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX);
2197 // Make sure the state is in IDLE state.
2198 p2pFsmRunEventAbort(prAdapter, prP2pFsmInfo);
2200 // Update connection request information.
2201 prConnReqInfo->fgIsConnRequest = TRUE;
2202 COPY_MAC_ADDR(prConnReqInfo->aucBssid, prConnReqMsg->aucBssid);
2203 kalMemCopy(&(prConnReqInfo->rSsidStruct), &(prConnReqMsg->rSsid), sizeof(P2P_SSID_STRUCT_T));
2204 kalMemCopy(prConnReqInfo->aucIEBuf, prConnReqMsg->aucIEBuf, prConnReqMsg->u4IELen);
2205 prConnReqInfo->u4BufLength = prConnReqMsg->u4IELen;
2207 /* Find BSS Descriptor first. */
2208 prP2pFsmInfo->prTargetBss = scanP2pSearchDesc(prAdapter,
2212 if (prP2pFsmInfo->prTargetBss == NULL) {
2213 /* Update scan parameter... to scan target device. */
2214 P_P2P_SCAN_REQ_INFO_T prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo);
2216 prScanReqInfo->ucNumChannelList = 1;
2217 prScanReqInfo->eScanType = SCAN_TYPE_ACTIVE_SCAN;
2218 prScanReqInfo->eChannelSet = SCAN_CHANNEL_SPECIFIED;
2219 prScanReqInfo->arScanChannelList[0].ucChannelNum = prConnReqMsg->rChannelInfo.ucChannelNum;
2220 kalMemCopy(&(prScanReqInfo->rSsidStruct), &(prConnReqMsg->rSsid), sizeof(P2P_SSID_STRUCT_T));
2221 prScanReqInfo->u4BufLength = 0; /* Prevent other P2P ID in IE. */
2222 prScanReqInfo->fgIsAbort = TRUE;
2224 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_SCAN);
2227 prChnlReqInfo->u8Cookie = 0;
2228 prChnlReqInfo->ucReqChnlNum = prConnReqMsg->rChannelInfo.ucChannelNum;
2229 prChnlReqInfo->eBand = prConnReqMsg->rChannelInfo.eBand;
2230 prChnlReqInfo->eChnlSco = prConnReqMsg->eChnlSco;
2231 prChnlReqInfo->u4MaxInterval = AIS_JOIN_CH_REQUEST_INTERVAL;
2232 prChnlReqInfo->eChannelReqType = CHANNEL_REQ_TYPE_GC_JOIN_REQ;
2234 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_REQING_CHANNEL);
2241 cnmMemFree(prAdapter, prMsgHdr);
2246 } /* p2pFsmRunEventConnectionRequest */
2248 /*----------------------------------------------------------------------------*/
2250 * \brief This function is used to handle Connection Request from Supplicant.
2252 * \param[in] prAdapter Pointer of ADAPTER_T
2256 /*----------------------------------------------------------------------------*/
2258 p2pFsmRunEventConnectionAbort (
2259 IN P_ADAPTER_T prAdapter,
2260 IN P_MSG_HDR_T prMsgHdr
2263 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2264 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2265 P_MSG_P2P_CONNECTION_ABORT_T prDisconnMsg = (P_MSG_P2P_CONNECTION_ABORT_T)NULL;
2266 //P_STA_RECORD_T prTargetStaRec = (P_STA_RECORD_T)NULL;
2270 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
2272 DBGLOG(P2P, TRACE, ("p2pFsmRunEventConnectionAbort: Connection Abort.\n"));
2274 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2276 if (prP2pFsmInfo == NULL) {
2280 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2282 prDisconnMsg = (P_MSG_P2P_CONNECTION_ABORT_T)prMsgHdr;
2284 switch (prP2pBssInfo->eCurrentOPMode) {
2285 case OP_MODE_INFRASTRUCTURE:
2287 UINT_8 aucBCBSSID[] = BC_BSSID;
2289 if (!prP2pBssInfo->prStaRecOfAP) {
2290 DBGLOG(P2P, TRACE, ("GO's StaRec is NULL\n"));
2293 if (UNEQUAL_MAC_ADDR(prP2pBssInfo->prStaRecOfAP->aucMacAddr, prDisconnMsg->aucTargetID) &&
2294 UNEQUAL_MAC_ADDR(prDisconnMsg->aucTargetID, aucBCBSSID)) {
2295 DBGLOG(P2P, TRACE, ("Unequal MAC ADDR ["MACSTR":"MACSTR"]\n",
2296 MAC2STR(prP2pBssInfo->prStaRecOfAP->aucMacAddr),
2297 MAC2STR(prDisconnMsg->aucTargetID)));
2302 kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo, NULL, NULL, 0, 0);
2304 /* Stop rejoin timer if it is started. */
2307 p2pFuncDisconnect(prAdapter, prP2pBssInfo->prStaRecOfAP, prDisconnMsg->fgSendDeauth, prDisconnMsg->u2ReasonCode);
2309 //prTargetStaRec = prP2pBssInfo->prStaRecOfAP;
2311 /* Fix possible KE when RX Beacon & call nicPmIndicateBssConnected(). hit prStaRecOfAP == NULL. */
2312 p2pChangeMediaState(prAdapter, PARAM_MEDIA_STATE_DISCONNECTED);
2314 prP2pBssInfo->prStaRecOfAP = NULL;
2316 SET_NET_PWR_STATE_IDLE(prAdapter, NETWORK_TYPE_P2P_INDEX);
2318 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
2322 case OP_MODE_ACCESS_POINT:
2324 P_LINK_T prStaRecOfClientList = &prP2pBssInfo->rStaRecOfClientList;
2325 /* Search specific client device, and disconnect. */
2326 /* 1. Send deauthentication frame. */
2327 /* 2. Indication: Device disconnect. */
2328 P_LINK_ENTRY_T prLinkEntry = (P_LINK_ENTRY_T)NULL;
2329 P_STA_RECORD_T prCurrStaRec = (P_STA_RECORD_T)NULL;
2331 DBGLOG(P2P, TRACE, ("Disconnecting with Target ID: "MACSTR"\n", MAC2STR(prDisconnMsg->aucTargetID)));
2333 LINK_FOR_EACH(prLinkEntry, prStaRecOfClientList) {
2334 prCurrStaRec = LINK_ENTRY(prLinkEntry, STA_RECORD_T, rLinkEntry);
2336 ASSERT(prCurrStaRec);
2338 if (EQUAL_MAC_ADDR(prCurrStaRec->aucMacAddr, prDisconnMsg->aucTargetID)) {
2340 DBGLOG(P2P, TRACE, ("Disconnecting: "MACSTR"\n", MAC2STR(prCurrStaRec->aucMacAddr)));
2342 /* Remove STA from client list. */
2343 LINK_REMOVE_KNOWN_ENTRY(prStaRecOfClientList, &prCurrStaRec->rLinkEntry);
2345 /* Glue layer indication. */
2346 //kalP2PGOStationUpdate(prAdapter->prGlueInfo, prCurrStaRec, FALSE);
2348 /* Send deauth & do indication. */
2349 p2pFuncDisconnect(prAdapter, prCurrStaRec, prDisconnMsg->fgSendDeauth, prDisconnMsg->u2ReasonCode);
2351 //prTargetStaRec = prCurrStaRec;
2359 case OP_MODE_P2P_DEVICE:
2367 //20120830 moved into p2pFuncDisconnect()
2368 //if ((!prDisconnMsg->fgSendDeauth) && (prTargetStaRec)) {
2369 // cnmStaRecFree(prAdapter, prTargetStaRec, TRUE);
2374 cnmMemFree(prAdapter, prMsgHdr);
2378 } /* p2pFsmRunEventConnectionAbort */
2382 p2pFsmRunEventDissolve (
2383 IN P_ADAPTER_T prAdapter,
2384 IN P_MSG_HDR_T prMsgHdr
2390 DBGLOG(P2P, TRACE, ("p2pFsmRunEventDissolve\n"));
2393 cnmMemFree(prAdapter, prMsgHdr);
2399 p2pFsmRunEventDeauthTxDone (
2400 IN P_ADAPTER_T prAdapter,
2401 IN P_MSDU_INFO_T prMsduInfo,
2402 IN ENUM_TX_RESULT_CODE_T rTxDoneStatus
2406 P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL;
2407 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2408 ENUM_PARAM_MEDIA_STATE_T eOriMediaStatus;
2412 ASSERT_BREAK((prAdapter != NULL) &&
2413 (prMsduInfo != NULL));
2415 DBGLOG(P2P, TRACE, ("Deauth TX Done\n"));
2417 prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex);
2419 if (prStaRec == NULL) {
2420 DBGLOG(P2P, TRACE, ("Station Record NULL, Index:%d\n", prMsduInfo->ucStaRecIndex));
2424 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2425 eOriMediaStatus = prP2pBssInfo->eConnectionState;
2427 /* Change station state. */
2428 cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_1);
2430 /* Reset Station Record Status. */
2431 p2pFuncResetStaRecStatus(prAdapter, prStaRec);
2434 cnmStaRecFree(prAdapter, prStaRec, TRUE);
2436 if ((prP2pBssInfo->eCurrentOPMode != OP_MODE_ACCESS_POINT) ||
2437 (prP2pBssInfo->rStaRecOfClientList.u4NumElem == 0)) {
2438 DBGLOG(P2P, TRACE, ("No More Client, Media Status DISCONNECTED\n"));
2439 p2pChangeMediaState(prAdapter, PARAM_MEDIA_STATE_DISCONNECTED);
2442 if (eOriMediaStatus != prP2pBssInfo->eConnectionState) {
2443 /* Update Disconnected state to FW. */
2444 nicUpdateBss(prAdapter, NETWORK_TYPE_P2P_INDEX);
2450 return WLAN_STATUS_SUCCESS;
2451 } /* p2pFsmRunEventDeauthTxDone */
2455 p2pFsmRunEventMgmtFrameTxDone (
2456 IN P_ADAPTER_T prAdapter,
2457 IN P_MSDU_INFO_T prMsduInfo,
2458 IN ENUM_TX_RESULT_CODE_T rTxDoneStatus
2461 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2462 P_P2P_MGMT_TX_REQ_INFO_T prMgmtTxReqInfo = (P_P2P_MGMT_TX_REQ_INFO_T)NULL;
2463 BOOLEAN fgIsSuccess = FALSE;
2466 ASSERT_BREAK((prAdapter != NULL) && (prMsduInfo != NULL));
2468 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2469 prMgmtTxReqInfo = &(prP2pFsmInfo->rMgmtTxInfo);
2471 if (rTxDoneStatus != TX_RESULT_SUCCESS) {
2472 DBGLOG(P2P, TRACE, ("Mgmt Frame TX Fail, Status:%d.\n", rTxDoneStatus));
2476 DBGLOG(P2P, TRACE, ("Mgmt Frame TX Done.\n"));
2480 if (prMgmtTxReqInfo->prMgmtTxMsdu == prMsduInfo) {
2481 kalP2PIndicateMgmtTxStatus(prAdapter->prGlueInfo,
2482 prMgmtTxReqInfo->u8Cookie,
2484 prMsduInfo->prPacket,
2485 (UINT_32)prMsduInfo->u2FrameLength);
2487 prMgmtTxReqInfo->prMgmtTxMsdu = NULL;
2492 return WLAN_STATUS_SUCCESS;
2494 } /* p2pFsmRunEventMgmtFrameTxDone */
2497 /*----------------------------------------------------------------------------*/
2499 * \brief This function is called when JOIN complete message event is received from SAA.
2501 * \param[in] prAdapter Pointer of ADAPTER_T
2505 /*----------------------------------------------------------------------------*/
2507 p2pFsmRunEventJoinComplete (
2508 IN P_ADAPTER_T prAdapter,
2509 IN P_MSG_HDR_T prMsgHdr
2512 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2513 P_P2P_JOIN_INFO_T prJoinInfo = (P_P2P_JOIN_INFO_T)NULL;
2514 P_MSG_JOIN_COMP_T prJoinCompMsg = (P_MSG_JOIN_COMP_T)NULL;
2515 P_SW_RFB_T prAssocRspSwRfb = (P_SW_RFB_T)NULL;
2516 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2519 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
2521 DBGLOG(P2P, TRACE, ("P2P Join Complete\n"));
2523 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2525 if (prP2pFsmInfo == NULL) {
2530 prJoinInfo = &(prP2pFsmInfo->rJoinInfo);
2531 prJoinCompMsg = (P_MSG_JOIN_COMP_T)prMsgHdr;
2532 prAssocRspSwRfb = prJoinCompMsg->prSwRfb;
2533 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2535 if (prP2pBssInfo->eCurrentOPMode == OP_MODE_INFRASTRUCTURE) {
2536 P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL;
2538 prStaRec = prJoinCompMsg->prStaRec;
2541 if (prJoinCompMsg->ucSeqNum == prJoinInfo->ucSeqNumOfReqMsg) {
2542 ASSERT(prStaRec == prJoinInfo->prTargetStaRec);
2543 prJoinInfo->fgIsJoinComplete = TRUE;
2545 if (prJoinCompMsg->rJoinStatus == WLAN_STATUS_SUCCESS) {
2547 //4 <1.1> Change FW's Media State immediately.
2548 p2pChangeMediaState(prAdapter, PARAM_MEDIA_STATE_CONNECTED);
2550 //4 <1.2> Deactivate previous AP's STA_RECORD_T in Driver if have.
2551 if ((prP2pBssInfo->prStaRecOfAP) &&
2552 (prP2pBssInfo->prStaRecOfAP != prStaRec)) {
2553 cnmStaRecChangeState(prAdapter, prP2pBssInfo->prStaRecOfAP, STA_STATE_1);
2555 cnmStaRecFree(prAdapter, prP2pBssInfo->prStaRecOfAP, TRUE);
2557 prP2pBssInfo->prStaRecOfAP = NULL;
2560 //4 <1.3> Update BSS_INFO_T
2561 p2pFuncUpdateBssInfoForJOIN(prAdapter, prP2pFsmInfo->prTargetBss, prStaRec, prAssocRspSwRfb);
2563 //4 <1.4> Activate current AP's STA_RECORD_T in Driver.
2564 cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_3);
2566 #if CFG_SUPPORT_P2P_RSSI_QUERY
2567 //<1.5> Update RSSI if necessary
2568 nicUpdateRSSI(prAdapter, NETWORK_TYPE_P2P_INDEX, (INT_8)(RCPI_TO_dBm(prStaRec->ucRCPI)), 0);
2571 //4 <1.6> Indicate Connected Event to Host immediately.
2572 /* Require BSSID, Association ID, Beacon Interval.. from AIS_BSS_INFO_T */
2573 //p2pIndicationOfMediaStateToHost(prAdapter, PARAM_MEDIA_STATE_CONNECTED, prStaRec->aucMacAddr);
2574 kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo,
2575 &prP2pFsmInfo->rConnReqInfo,
2576 prJoinInfo->aucIEBuf,
2577 prJoinInfo->u4BufLength,
2578 prStaRec->u2StatusCode);
2583 //4 <2.1> Redo JOIN process with other Auth Type if possible
2584 if (p2pFuncRetryJOIN(prAdapter, prStaRec, prJoinInfo) == FALSE) {
2585 P_BSS_DESC_T prBssDesc;
2587 /* Increase Failure Count */
2588 prStaRec->ucJoinFailureCount++;
2590 prBssDesc = prP2pFsmInfo->prTargetBss;
2593 ASSERT(prBssDesc->fgIsConnecting);
2595 prBssDesc->fgIsConnecting = FALSE;
2597 kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo,
2598 &prP2pFsmInfo->rConnReqInfo,
2599 prJoinInfo->aucIEBuf,
2600 prJoinInfo->u4BufLength,
2601 prStaRec->u2StatusCode);
2609 if (prAssocRspSwRfb) {
2610 nicRxReturnRFB(prAdapter, prAssocRspSwRfb);
2613 if (prP2pFsmInfo->eCurrentState == P2P_STATE_GC_JOIN) {
2614 /* Return to IDLE state. */
2615 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
2621 cnmMemFree(prAdapter, prMsgHdr);
2626 } /* p2pFsmRunEventJoinComplete */
2631 p2pFsmRunEventMgmtFrameRegister (
2632 IN P_ADAPTER_T prAdapter,
2633 IN P_MSG_HDR_T prMsgHdr
2636 P_MSG_P2P_MGMT_FRAME_REGISTER_T prMgmtFrameRegister = (P_MSG_P2P_MGMT_FRAME_REGISTER_T)NULL;
2637 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2640 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
2642 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2644 if (prP2pFsmInfo == NULL) {
2648 prMgmtFrameRegister = (P_MSG_P2P_MGMT_FRAME_REGISTER_T)prMsgHdr;
2650 p2pFuncMgmtFrameRegister(prAdapter,
2651 prMgmtFrameRegister->u2FrameType,
2652 prMgmtFrameRegister->fgIsRegister,
2653 &prP2pFsmInfo->u4P2pPacketFilter);
2659 cnmMemFree(prAdapter, prMsgHdr);
2664 } /* p2pFsmRunEventMgmtFrameRegister */
2670 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2671 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2672 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2673 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2674 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2675 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2676 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2677 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2678 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2679 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2680 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2681 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2682 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2683 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2692 /*----------------------------------------------------------------------------*/
2694 * \brief This function is call when RX deauthentication frame from the AIR.
2695 * If we are under STA mode, we would go back to P2P Device.
2696 * If we are under AP mode, we would stay in AP mode until disconnect event from HOST.
2698 * \param[in] prAdapter Pointer of ADAPTER_T
2702 /*----------------------------------------------------------------------------*/
2704 p2pFsmRunEventRxDeauthentication (
2705 IN P_ADAPTER_T prAdapter,
2706 IN P_STA_RECORD_T prStaRec,
2707 IN P_SW_RFB_T prSwRfb
2710 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2711 UINT_16 u2ReasonCode = 0;
2714 ASSERT_BREAK((prAdapter != NULL) && (prSwRfb != NULL));
2716 if (prStaRec == NULL) {
2717 prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx);
2725 prP2pBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX];
2727 if (prStaRec->ucStaState == STA_STATE_1) {
2731 DBGLOG(P2P, TRACE, ("RX Deauth\n"));
2733 switch (prP2pBssInfo->eCurrentOPMode) {
2734 case OP_MODE_INFRASTRUCTURE:
2735 if (authProcessRxDeauthFrame(prSwRfb,
2736 prStaRec->aucMacAddr,
2737 &u2ReasonCode) == WLAN_STATUS_SUCCESS) {
2738 P_WLAN_DEAUTH_FRAME_T prDeauthFrame = (P_WLAN_DEAUTH_FRAME_T)prSwRfb->pvHeader;
2739 UINT_16 u2IELength = 0;
2741 if (prP2pBssInfo->prStaRecOfAP != prStaRec) {
2746 prStaRec->u2ReasonCode = u2ReasonCode;
2747 u2IELength = prSwRfb->u2PacketLen - (WLAN_MAC_HEADER_LEN + REASON_CODE_FIELD_LEN);
2749 ASSERT(prP2pBssInfo->prStaRecOfAP == prStaRec);
2751 /* Indicate disconnect to Host. */
2752 kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo,
2754 prDeauthFrame->aucInfoElem,
2758 prP2pBssInfo->prStaRecOfAP = NULL;
2760 p2pFuncDisconnect(prAdapter, prStaRec, FALSE, u2ReasonCode);
2763 case OP_MODE_ACCESS_POINT:
2764 /* Delete client from client list. */
2765 if (authProcessRxDeauthFrame(prSwRfb,
2766 prP2pBssInfo->aucBSSID,
2767 &u2ReasonCode) == WLAN_STATUS_SUCCESS) {
2768 P_LINK_T prStaRecOfClientList = (P_LINK_T)NULL;
2769 P_LINK_ENTRY_T prLinkEntry = (P_LINK_ENTRY_T)NULL;
2770 P_STA_RECORD_T prCurrStaRec = (P_STA_RECORD_T)NULL;
2772 prStaRecOfClientList = &prP2pBssInfo->rStaRecOfClientList;
2774 LINK_FOR_EACH(prLinkEntry, prStaRecOfClientList) {
2775 prCurrStaRec = LINK_ENTRY(prLinkEntry, STA_RECORD_T, rLinkEntry);
2777 ASSERT(prCurrStaRec);
2779 if (EQUAL_MAC_ADDR(prCurrStaRec->aucMacAddr, prStaRec->aucMacAddr)) {
2781 /* Remove STA from client list. */
2782 LINK_REMOVE_KNOWN_ENTRY(prStaRecOfClientList, &prCurrStaRec->rLinkEntry);
2784 /* Indicate to Host. */
2785 //kalP2PGOStationUpdate(prAdapter->prGlueInfo, prStaRec, FALSE);
2787 /* Indicate disconnect to Host. */
2788 p2pFuncDisconnect(prAdapter, prStaRec, FALSE, u2ReasonCode);
2795 case OP_MODE_P2P_DEVICE:
2797 /* Findout why someone sent deauthentication frame to us. */
2802 DBGLOG(P2P, TRACE, ("Deauth Reason:%d\n", u2ReasonCode));
2807 } /* p2pFsmRunEventRxDeauthentication */
2809 /*----------------------------------------------------------------------------*/
2811 * \brief This function is call when RX deauthentication frame from the AIR.
2812 * If we are under STA mode, we would go back to P2P Device.
2813 * If we are under AP mode, we would stay in AP mode until disconnect event from HOST.
2815 * \param[in] prAdapter Pointer of ADAPTER_T
2819 /*----------------------------------------------------------------------------*/
2821 p2pFsmRunEventRxDisassociation (
2822 IN P_ADAPTER_T prAdapter,
2823 IN P_STA_RECORD_T prStaRec,
2824 IN P_SW_RFB_T prSwRfb
2827 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2828 UINT_16 u2ReasonCode = 0;
2831 ASSERT_BREAK((prAdapter != NULL) && (prSwRfb != NULL));
2833 if (prStaRec == NULL) {
2834 prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx);
2838 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2840 if (prStaRec->ucStaState == STA_STATE_1) {
2845 DBGLOG(P2P, TRACE, ("RX Disassoc\n"));
2847 switch (prP2pBssInfo->eCurrentOPMode) {
2848 case OP_MODE_INFRASTRUCTURE:
2849 if (assocProcessRxDisassocFrame(prAdapter,
2851 prStaRec->aucMacAddr,
2852 &prStaRec->u2ReasonCode) == WLAN_STATUS_SUCCESS) {
2853 P_WLAN_DISASSOC_FRAME_T prDisassocFrame = (P_WLAN_DISASSOC_FRAME_T)prSwRfb->pvHeader;
2854 UINT_16 u2IELength = 0;
2856 ASSERT(prP2pBssInfo->prStaRecOfAP == prStaRec);
2858 if (prP2pBssInfo->prStaRecOfAP != prStaRec) {
2863 u2IELength = prSwRfb->u2PacketLen - (WLAN_MAC_HEADER_LEN + REASON_CODE_FIELD_LEN);
2865 /* Indicate disconnect to Host. */
2866 kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo,
2868 prDisassocFrame->aucInfoElem,
2870 prStaRec->u2ReasonCode);
2872 prP2pBssInfo->prStaRecOfAP = NULL;
2874 p2pFuncDisconnect(prAdapter, prStaRec, FALSE, prStaRec->u2ReasonCode);
2878 case OP_MODE_ACCESS_POINT:
2879 /* Delete client from client list. */
2880 if (assocProcessRxDisassocFrame(prAdapter,
2882 prP2pBssInfo->aucBSSID,
2883 &u2ReasonCode) == WLAN_STATUS_SUCCESS) {
2884 P_LINK_T prStaRecOfClientList = (P_LINK_T)NULL;
2885 P_LINK_ENTRY_T prLinkEntry = (P_LINK_ENTRY_T)NULL;
2886 P_STA_RECORD_T prCurrStaRec = (P_STA_RECORD_T)NULL;
2888 prStaRecOfClientList = &prP2pBssInfo->rStaRecOfClientList;
2890 LINK_FOR_EACH(prLinkEntry, prStaRecOfClientList) {
2891 prCurrStaRec = LINK_ENTRY(prLinkEntry, STA_RECORD_T, rLinkEntry);
2893 ASSERT(prCurrStaRec);
2895 if (EQUAL_MAC_ADDR(prCurrStaRec->aucMacAddr, prStaRec->aucMacAddr)) {
2897 /* Remove STA from client list. */
2898 LINK_REMOVE_KNOWN_ENTRY(prStaRecOfClientList, &prCurrStaRec->rLinkEntry);
2900 /* Indicate to Host. */
2901 //kalP2PGOStationUpdate(prAdapter->prGlueInfo, prStaRec, FALSE);
2903 /* Indicate disconnect to Host. */
2904 p2pFuncDisconnect(prAdapter, prStaRec, FALSE, u2ReasonCode);
2911 case OP_MODE_P2P_DEVICE:
2921 } /* p2pFsmRunEventRxDisassociation */
2927 /*----------------------------------------------------------------------------*/
2929 * \brief This function is called when a probe request frame is received.
2931 * \param[in] prAdapter Pointer of ADAPTER_T
2933 * \return boolean value if probe response frame is accepted & need cancel scan request.
2935 /*----------------------------------------------------------------------------*/
2937 p2pFsmRunEventRxProbeResponseFrame (
2938 IN P_ADAPTER_T prAdapter,
2939 IN P_SW_RFB_T prSwRfb,
2940 IN P_BSS_DESC_T prBssDesc
2943 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2944 P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = (P_P2P_CONNECTION_SETTINGS_T)NULL;
2945 P_WLAN_MAC_MGMT_HEADER_T prMgtHdr = (P_WLAN_MAC_MGMT_HEADER_T)NULL;
2946 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2949 ASSERT_BREAK((prAdapter != NULL) && (prSwRfb != NULL) && (prBssDesc != NULL));
2951 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2952 prP2pConnSettings = prAdapter->rWifiVar.prP2PConnSettings;
2953 prP2pBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX];
2955 /* There is a connection request. */
2956 prMgtHdr = (P_WLAN_MAC_MGMT_HEADER_T)prSwRfb->pvHeader;
2961 } /* p2pFsmRunEventRxProbeResponseFrame */
2969 p2pFsmRunEventBeaconTimeout (
2970 IN P_ADAPTER_T prAdapter
2973 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2974 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2977 ASSERT_BREAK(prAdapter != NULL);
2979 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2980 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2982 DBGLOG(P2P, TRACE, ("p2pFsmRunEventBeaconTimeout: Beacon Timeout\n"));
2984 /* Only client mode would have beacon lost event. */
2985 ASSERT(prP2pBssInfo->eCurrentOPMode == OP_MODE_INFRASTRUCTURE);
2987 if (prP2pBssInfo->eConnectionState == PARAM_MEDIA_STATE_CONNECTED) {
2988 /* Indicate disconnect to Host. */
2989 kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo,
2993 REASON_CODE_DISASSOC_INACTIVITY);
2995 if (prP2pBssInfo->prStaRecOfAP != NULL) {
2996 P_STA_RECORD_T prStaRec = prP2pBssInfo->prStaRecOfAP;
2998 prP2pBssInfo->prStaRecOfAP = NULL;
3000 p2pFuncDisconnect(prAdapter, prStaRec, FALSE, REASON_CODE_DISASSOC_LEAVING_BSS);
3002 //20120830 moved into p2pFuncDisconnect()
3003 //cnmStaRecFree(prAdapter, prP2pBssInfo->prStaRecOfAP, TRUE);
3011 } /* p2pFsmRunEventBeaconTimeout */
3022 /*----------------------------------------------------------------------------*/
3024 * @brief This function is used to generate P2P IE for Beacon frame.
3026 * @param[in] prMsduInfo Pointer to the composed MSDU_INFO_T.
3030 /*----------------------------------------------------------------------------*/
3032 p2pGenerateP2P_IEForAssocReq (
3033 IN P_ADAPTER_T prAdapter,
3034 IN P_MSDU_INFO_T prMsduInfo
3037 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
3038 P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL;
3041 ASSERT_BREAK((prAdapter != NULL) && (prMsduInfo != NULL));
3043 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
3045 prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex);
3047 if (IS_STA_P2P_TYPE(prStaRec)) {
3055 } /* end of p2pGenerateP2P_IEForAssocReq() */
3060 /*----------------------------------------------------------------------------*/
3062 * @brief This function is used to generate P2P IE for Probe Request frame.
3064 * @param[in] prMsduInfo Pointer to the composed MSDU_INFO_T.
3068 /*----------------------------------------------------------------------------*/
3070 p2pGenerateP2P_IEForProbeReq (
3071 IN P_ADAPTER_T prAdapter,
3072 IN PUINT_16 pu2Offset,
3074 IN UINT_16 u2BufSize
3084 } /* end of p2pGenerateP2P_IEForProbReq() */
3089 /*----------------------------------------------------------------------------*/
3091 * @brief This function is used to calculate P2P IE length for Beacon frame.
3093 * @param[in] eNetTypeIndex Specify which network
3094 * @param[in] prStaRec Pointer to the STA_RECORD_T
3096 * @return The length of P2P IE added
3098 /*----------------------------------------------------------------------------*/
3100 p2pCalculateP2P_IELenForProbeReq (
3101 IN P_ADAPTER_T prAdapter,
3102 IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex,
3103 IN P_STA_RECORD_T prStaRec
3107 if (eNetTypeIndex != NETWORK_TYPE_P2P_INDEX) {
3115 } /* end of p2pCalculateP2P_IELenForProbeReq() */
3121 /*----------------------------------------------------------------------------*/
3123 * @brief This function will indiate the Event of Tx Fail of AAA Module.
3125 * @param[in] prAdapter Pointer to the Adapter structure.
3126 * @param[in] prStaRec Pointer to the STA_RECORD_T
3130 /*----------------------------------------------------------------------------*/
3132 p2pRunEventAAATxFail (
3133 IN P_ADAPTER_T prAdapter,
3134 IN P_STA_RECORD_T prStaRec
3137 P_BSS_INFO_T prBssInfo;
3143 prBssInfo = &(prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex]);
3145 bssRemoveStaRecFromClientList(prAdapter, prBssInfo, prStaRec);
3147 p2pFuncDisconnect(prAdapter, prStaRec, FALSE, REASON_CODE_UNSPECIFIED);
3150 //20120830 moved into p2puUncDisconnect.
3151 //cnmStaRecFree(prAdapter, prStaRec, TRUE);
3154 } /* p2pRunEventAAATxFail */
3157 /*----------------------------------------------------------------------------*/
3159 * @brief This function will indiate the Event of Successful Completion of AAA Module.
3161 * @param[in] prAdapter Pointer to the Adapter structure.
3162 * @param[in] prStaRec Pointer to the STA_RECORD_T
3166 /*----------------------------------------------------------------------------*/
3168 p2pRunEventAAAComplete (
3169 IN P_ADAPTER_T prAdapter,
3170 IN P_STA_RECORD_T prStaRec
3173 WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS;
3174 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
3175 ENUM_PARAM_MEDIA_STATE_T eOriMediaState;
3178 ASSERT_BREAK((prAdapter != NULL) && (prStaRec != NULL));
3180 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
3182 eOriMediaState = prP2pBssInfo->eConnectionState;
3184 bssRemoveStaRecFromClientList(prAdapter, prP2pBssInfo, prStaRec);
3186 if (prP2pBssInfo->rStaRecOfClientList.u4NumElem >= P2P_MAXIMUM_CLIENT_COUNT ||
3187 kalP2PMaxClients(prAdapter->prGlueInfo, prP2pBssInfo->rStaRecOfClientList.u4NumElem)) {
3188 rStatus = WLAN_STATUS_RESOURCES;
3192 bssAddStaRecToClientList(prAdapter, prP2pBssInfo, prStaRec);
3194 prStaRec->u2AssocId = bssAssignAssocID(prStaRec);
3196 cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_3);
3198 p2pChangeMediaState(prAdapter, PARAM_MEDIA_STATE_CONNECTED);
3200 /* Update Connected state to FW. */
3201 if (eOriMediaState != prP2pBssInfo->eConnectionState) {
3202 nicUpdateBss(prAdapter, NETWORK_TYPE_P2P_INDEX);
3208 } /* p2pRunEventAAAComplete */
3211 /*----------------------------------------------------------------------------*/
3213 * @brief This function will indiate the Event of Successful Completion of AAA Module.
3215 * @param[in] prAdapter Pointer to the Adapter structure.
3216 * @param[in] prStaRec Pointer to the STA_RECORD_T
3220 /*----------------------------------------------------------------------------*/
3222 p2pRunEventAAASuccess (
3223 IN P_ADAPTER_T prAdapter,
3224 IN P_STA_RECORD_T prStaRec
3227 WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS;
3230 ASSERT_BREAK((prAdapter != NULL) && (prStaRec != NULL));
3232 /* Glue layer indication. */
3233 kalP2PGOStationUpdate(prAdapter->prGlueInfo, prStaRec, TRUE);
3238 } /* p2pRunEventAAASuccess */
3242 /*----------------------------------------------------------------------------*/
3250 /*----------------------------------------------------------------------------*/
3252 p2pRxPublicActionFrame (
3253 IN P_ADAPTER_T prAdapter,
3254 IN P_SW_RFB_T prSwRfb
3257 WLAN_STATUS rWlanStatus = WLAN_STATUS_SUCCESS;
3258 P_P2P_PUBLIC_ACTION_FRAME_T prPublicActionFrame = (P_P2P_PUBLIC_ACTION_FRAME_T)NULL;
3259 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
3266 prPublicActionFrame = (P_P2P_PUBLIC_ACTION_FRAME_T)prSwRfb->pvHeader;
3267 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
3269 DBGLOG(P2P, TRACE, ("RX Public Action Frame Token:%d.\n", prPublicActionFrame->ucDialogToken));
3271 if (prPublicActionFrame->ucCategory != CATEGORY_PUBLIC_ACTION) {
3275 switch (prPublicActionFrame->ucAction) {
3276 case ACTION_PUBLIC_WIFI_DIRECT:
3278 case ACTION_GAS_INITIAL_REQUEST:
3279 case ACTION_GAS_INITIAL_RESPONSE:
3280 case ACTION_GAS_COMEBACK_REQUEST:
3281 case ACTION_GAS_COMEBACK_RESPONSE:
3288 } /* p2pRxPublicActionFrame */
3294 IN P_ADAPTER_T prAdapter,
3295 IN P_SW_RFB_T prSwRfb
3298 WLAN_STATUS rWlanStatus = WLAN_STATUS_SUCCESS;
3299 P_P2P_ACTION_FRAME_T prP2pActionFrame = (P_P2P_ACTION_FRAME_T)NULL;
3300 UINT_8 aucOui[3] = VENDOR_OUI_WFA_SPECIFIC;
3303 ASSERT_BREAK((prAdapter != NULL) && (prSwRfb != NULL));
3305 prP2pActionFrame = (P_P2P_ACTION_FRAME_T)prSwRfb->pvHeader;
3307 if (prP2pActionFrame->ucCategory != CATEGORY_VENDOR_SPECIFIC_ACTION) {
3308 DBGLOG(P2P, TRACE, ("RX Action Frame but not vendor specific.\n"));
3313 if ((prP2pActionFrame->ucOuiType != VENDOR_OUI_TYPE_P2P) ||
3314 (prP2pActionFrame->aucOui[0] != aucOui[0]) ||
3315 (prP2pActionFrame->aucOui[1] != aucOui[1]) ||
3316 (prP2pActionFrame->aucOui[2] != aucOui[2])) {
3317 DBGLOG(P2P, TRACE, ("RX Vendor Specific Action Frame but not P2P Type or not WFA OUI.\n"));
3324 } /* p2pRxActionFrame */
3328 p2pProcessEvent_UpdateNOAParam (
3329 IN P_ADAPTER_T prAdapter,
3330 UINT_8 ucNetTypeIndex,
3331 P_EVENT_UPDATE_NOA_PARAMS_T prEventUpdateNoaParam
3334 P_BSS_INFO_T prBssInfo = (P_BSS_INFO_T)NULL;
3335 P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo;
3337 BOOLEAN fgNoaAttrExisted = FALSE;
3339 prBssInfo = &(prAdapter->rWifiVar.arBssInfo[ucNetTypeIndex]);
3340 prP2pSpecificBssInfo = prAdapter->rWifiVar.prP2pSpecificBssInfo;
3342 prP2pSpecificBssInfo->fgEnableOppPS = prEventUpdateNoaParam->fgEnableOppPS;
3343 prP2pSpecificBssInfo->u2CTWindow = prEventUpdateNoaParam->u2CTWindow;
3344 prP2pSpecificBssInfo->ucNoAIndex = prEventUpdateNoaParam->ucNoAIndex;
3345 prP2pSpecificBssInfo->ucNoATimingCount = prEventUpdateNoaParam->ucNoATimingCount;
3347 fgNoaAttrExisted |= prP2pSpecificBssInfo->fgEnableOppPS;
3350 ASSERT(prP2pSpecificBssInfo->ucNoATimingCount <= P2P_MAXIMUM_NOA_COUNT);
3352 for (i = 0; i < prP2pSpecificBssInfo->ucNoATimingCount; i++) {
3354 prP2pSpecificBssInfo->arNoATiming[i].fgIsInUse =
3355 prEventUpdateNoaParam->arEventNoaTiming[i].fgIsInUse;
3357 prP2pSpecificBssInfo->arNoATiming[i].ucCount =
3358 prEventUpdateNoaParam->arEventNoaTiming[i].ucCount;
3360 prP2pSpecificBssInfo->arNoATiming[i].u4Duration =
3361 prEventUpdateNoaParam->arEventNoaTiming[i].u4Duration;
3363 prP2pSpecificBssInfo->arNoATiming[i].u4Interval =
3364 prEventUpdateNoaParam->arEventNoaTiming[i].u4Interval;
3366 prP2pSpecificBssInfo->arNoATiming[i].u4StartTime =
3367 prEventUpdateNoaParam->arEventNoaTiming[i].u4StartTime;
3369 fgNoaAttrExisted |= prP2pSpecificBssInfo->arNoATiming[i].fgIsInUse;
3372 prP2pSpecificBssInfo->fgIsNoaAttrExisted = fgNoaAttrExisted;
3374 // update beacon content by the change
3375 bssUpdateBeaconContent(prAdapter, ucNetTypeIndex);
3378 #endif /* CFG_ENABLE_WIFI_DIRECT */