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.
16 ** 12 20 2012 yuche.tsai
17 ** [ALPS00410124] [Rose][Free Test][KE][rlmUpdateParamsForAP]The device reboot automaticly and then "Fatal/Kernel" pops up during use data service.(Once)
18 ** Fix possible NULL station record cause KE under AP mode.
19 ** May due to variable uninitial.
20 ** Review: http://mtksap20:8080/go?page=NewReview&reviewid=49970
22 ** 09 12 2012 wcpadmin
23 ** [ALPS00276400] Remove MTK copyright and legal header on GPL/LGPL related packages
26 ** 08 31 2012 yuche.tsai
27 ** [ALPS00349585] [6577JB][WiFi direct][KE]Establish p2p connection while both device have connected to AP previously,one device reboots automatically with KE
28 ** Fix possible KE when concurrent & disconnect.
30 ** 08 21 2012 yuche.tsai
32 ** fix disconnect indication.
34 ** 08 16 2012 yuche.tsai
36 ** Fix compile warning.
38 ** 08 14 2012 yuche.tsai
40 ** Fix p2p bug find on ALPS.JB trunk.
42 ** 07 27 2012 yuche.tsai
43 ** [ALPS00324337] [ALPS.JB][Hot-Spot] Driver update for Hot-Spot
44 ** Update for driver unload KE issue.
46 ** 07 26 2012 yuche.tsai
47 ** [ALPS00324337] [ALPS.JB][Hot-Spot] Driver update for Hot-Spot
48 ** Update driver code of ALPS.JB for hot-spot.
50 ** 07 19 2012 yuche.tsai
52 ** Code update for JB.
54 * 07 17 2012 yuche.tsai
56 * Compile no error before trial run.
58 * 07 05 2011 yuche.tsai
59 * [WCXRP00000821] [Volunteer Patch][WiFi Direct][Driver] WiFi Direct Connection Speed Issue
60 * Fix the compile flag of enhancement.
62 * 07 05 2011 yuche.tsai
63 * [WCXRP00000808] [Volunteer Patch][MT6620][Driver/FW] Device discoverability issue fix
64 * Change device discoverability methodology. From driver SCAN to FW lock channel.
66 * 07 05 2011 yuche.tsai
67 * [WCXRP00000821] [Volunteer Patch][WiFi Direct][Driver] WiFi Direct Connection Speed Issue
68 * Add wifi direct connection enhancement method I, II & VI.
70 * 07 05 2011 yuche.tsai
71 * [WCXRP00000833] [Volunteer Patch][WiFi Direct][Driver] Service Discovery Frame RX Indicate Issue
72 * Fix Service Discovery Race Condition Issue.
75 * [WCXRP00000798] [MT6620 Wi-Fi][Firmware] Follow-ups for WAPI frequency offset workaround in firmware SCN module
76 * change parameter name from PeerAddr to BSSID
78 * 06 21 2011 yuche.tsai
79 * [WCXRP00000799] [Volunteer Patch][MT6620][Driver] Connection Indication Twice Issue.
80 * Fix an issue of accepting connection of GO.
82 * 06 21 2011 yuche.tsai
83 * [WCXRP00000775] [Volunteer Patch][MT6620][Driver] Dynamic enable SD capability
84 * Drop GAS frame when SD is not enabled.
86 * 06 20 2011 yuche.tsai
90 * 06 20 2011 yuche.tsai
91 * [WCXRP00000799] [Volunteer Patch][MT6620][Driver] Connection Indication Twice Issue.
92 * Fix connection indication twice issue.
95 * [WCXRP00000798] [MT6620 Wi-Fi][Firmware] Follow-ups for WAPI frequency offset workaround in firmware SCN module
96 * 1. specify target's BSSID when requesting channel privilege.
97 * 2. pass BSSID information to firmware domain
99 * 06 20 2011 yuche.tsai
100 * [WCXRP00000795] [Volunteer Patch][MT6620][Driver] GO can not connect second device issue
101 * Solve P2P GO can not formation with second device issue.
103 * 06 14 2011 yuche.tsai
105 * Change disconnect feature.
107 * 06 10 2011 yuche.tsai
108 * [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.
109 * 1. Dynamic enable SD capability after P2P supplicant ready.
110 * 2. Avoid response probe respone with p2p IE when under hot spot mode.
112 * 06 07 2011 yuche.tsai
113 * [WCXRP00000763] [Volunteer Patch][MT6620][Driver] RX Service Discovery Frame under AP mode Issue
114 * Fix RX SD request under AP mode issue.
117 * [WCXRP00000681] [MT5931][Firmware] HIF code size reduction
118 * eliminate unused parameters for SAA-FSM
120 * 05 26 2011 yuche.tsai
121 * [WCXRP00000745] Support accepting connection after one Group Connection Lost.
123 After Group Formation & lost connection, if MT6620 behave as:
125 1. GO: It would keep under GO state until been dissolved by supplicant.
127 At this time, other P2P device can use join method to join this group.
130 2. GC: It would keep on searching target GO or target device until been dissolved by supplicant.
132 At this time, it would ignore other P2P device formation request.
137 Modification: Make driver to accept GO NEGO REQ at this time, to let user decide to accept new connection or not.
139 * [Volunteer Patch][MT6620][Driver]
140 * Driver would indicate connection request, if password ID is not ready but connection request is issued.
142 * 05 18 2011 yuche.tsai
143 * [WCXRP00000728] [Volunteer Patch][MT6620][Driver] Service Discovery Request TX issue.
144 * A solution for both connection request & IO control.
146 * 05 16 2011 yuche.tsai
147 * [WCXRP00000728] [Volunteer Patch][MT6620][Driver] Service Discovery Request TX issue.
148 * Fix SD request can not send out issue.
150 * 05 09 2011 terry.wu
151 * [WCXRP00000711] [MT6620 Wi-Fi][Driver] Set Initial value of StaType in StaRec for Hotspot Client
152 * Set initial value of StaType in StaRec for hotspot client.
154 * 05 04 2011 yuche.tsai
155 * [WCXRP00000697] [Volunteer Patch][MT6620][Driver]
156 * Bug fix for p2p descriptor is NULL if BSS descriptor is found first.
158 * 05 04 2011 yuche.tsai
160 * Support partial persistent group function.
162 * 05 02 2011 yuche.tsai
163 * [WCXRP00000693] [Volunteer Patch][MT6620][Driver] Clear Formation Flag after TX lifetime timeout.
164 * Clear formation flag after formation timeout.
166 * 04 20 2011 yuche.tsai
167 * [WCXRP00000668] [Volunteer Patch][MT6620][Driver] Possible race condition when add scan & query scan result at the same time.
168 * Fix side effect while starting ATGO.
170 * 04 20 2011 yuche.tsai
172 * Fix ASSERT issue in FW, side effect of last change.
174 * 04 19 2011 yuche.tsai
175 * [WCXRP00000668] [Volunteer Patch][MT6620][Driver] Possible race condition when add scan & query scan result at the same time.
176 * Workaround for multiple device connection, before invitation ready.
178 * 04 19 2011 yuche.tsai
179 * [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.
180 * Support connection indication when GO NEGO REQ doesn't have configure method, instead it has PasswordID.
182 * 04 18 2011 yuche.tsai
186 * 04 14 2011 yuche.tsai
187 * [WCXRP00000646] [Volunteer Patch][MT6620][FW/Driver] Sigma Test Modification for some test case.
188 * Fix a connection issue.
190 * 04 14 2011 yuche.tsai
191 * [WCXRP00000646] [Volunteer Patch][MT6620][FW/Driver] Sigma Test Modification for some test case.
192 * Fix the channel issue of AP mode.
194 * 04 14 2011 yuche.tsai
195 * [WCXRP00000646] [Volunteer Patch][MT6620][FW/Driver] Sigma Test Modification for some test case.
196 * Connection flow refine for Sigma test.
198 * 04 09 2011 yuche.tsai
199 * [WCXRP00000624] [Volunteer Patch][MT6620][Driver] Add device discoverability support for GO.
200 * Fix Device discoverability related issue.
202 * 04 09 2011 yuche.tsai
203 * [WCXRP00000624] [Volunteer Patch][MT6620][Driver] Add device discoverability support for GO.
204 * Fix bug for Device Discoverability.
206 * 04 08 2011 yuche.tsai
207 * [WCXRP00000624] [Volunteer Patch][MT6620][Driver] Add device discoverability support for GO.
210 * 04 08 2011 yuche.tsai
211 * [WCXRP00000624] [Volunteer Patch][MT6620][Driver] Add device discoverability support for GO.
212 * Add device discoverability support.
214 * 03 28 2011 yuche.tsai
216 * Fix a possible issue for retry join when media status connected.
218 * 03 25 2011 yuche.tsai
220 * Improve some error handleing.
222 * 03 24 2011 yuche.tsai
224 * Assign AID before change STA_REC state to state 3.
226 * 03 23 2011 yuche.tsai
228 * Fix Response Rate Issue when TX Auth Rsp Frame under P2P Mode.
230 * 03 23 2011 yuche.tsai
232 * Fix issue of connection to one GC.
234 * 03 23 2011 yuche.tsai
236 * Fix ASSERT issue when starting Hot-spot.
238 * 03 22 2011 yuche.tsai
240 * When Target Information is not available, change to passive mode.
242 * 03 22 2011 yuche.tsai
244 * Fix one connection issue while using Keypad to connect a GO.
246 * 03 22 2011 yuche.tsai
248 * 1. Fix two issues that may cause kernel panic.
250 * 03 22 2011 yuche.tsai
252 * Fix GC connect to other device issue.
254 * 03 22 2011 yuche.tsai
256 * 1.Shorten the LISTEN interval.
257 * 2. Fix IF address issue when we are GO
258 * 3. Fix LISTEN channel issue.
260 * 03 22 2011 yuche.tsai
262 * Modify formation policy setting.
264 * 03 21 2011 yuche.tsai
266 * Solve Listen State doesn't response probe response issue.
268 * 03 21 2011 yuche.tsai
270 * Change P2P Connection Request Flow.
272 * 03 19 2011 yuche.tsai
273 * [WCXRP00000584] [Volunteer Patch][MT6620][Driver] Add beacon timeout support for WiFi Direct.
274 * Add beacon timeout support.
276 * 03 19 2011 yuche.tsai
277 * [WCXRP00000583] [Volunteer Patch][MT6620][Driver] P2P connection of the third peer issue
278 * Indicate the correct Group SSID when join on Group.
280 * 03 19 2011 yuche.tsai
281 * [WCXRP00000583] [Volunteer Patch][MT6620][Driver] P2P connection of the third peer issue
282 * Support the third P2P device to join GO/GC group.
284 * 03 19 2011 yuche.tsai
285 * [WCXRP00000581] [Volunteer Patch][MT6620][Driver] P2P IE in Assoc Req Issue
286 * Append P2P IE in Assoc Req, so that GC can be discovered in probe response of GO.
288 * 03 18 2011 yuche.tsai
289 * [WCXRP00000578] [Volunteer Patch][MT6620][Driver] Separate Connection Request from general IOCTL
290 * Separate connection request from general IOCTL.
292 * 03 18 2011 yuche.tsai
293 * [WCXRP00000574] [Volunteer Patch][MT6620][Driver] Modify P2P FSM Connection Flow
294 * Modify connection flow after Group Formation Complete, or device connect to a GO.
295 * Instead of request channel & connect directly, we use scan to allocate channel bandwidth & connect after RX BCN.
297 * 03 17 2011 yuche.tsai
299 * When AIS is connect to an AP, Hot Spot would be enabled under fixed same channel.
301 * 03 17 2011 yuche.tsai
303 * Solve the Group Info IE in Probe Response incorrect issue.
305 * 03 17 2011 yuche.tsai
307 * Release Channel after Join Complete.
310 * [WCXRP00000530] [MT6620 Wi-Fi] [Driver] skip doing p2pRunEventAAAComplete after send assoc response Tx Done
311 * enable the protected while at P2P start GO, and skip some security check .
313 * 03 15 2011 yuche.tsai
314 * [WCXRP00000560] [Volunteer Patch][MT6620][Driver] P2P Connection from UI using KEY/DISPLAY issue
315 * Fix local configure method issue.
317 * 03 15 2011 yuche.tsai
318 * [WCXRP00000560] [Volunteer Patch][MT6620][Driver] P2P Connection from UI using KEY/DISPLAY issue
319 * Fix some configure method issue.
321 * 03 14 2011 yuche.tsai
325 * 03 14 2011 yuche.tsai
327 * Fix password ID issue.
329 * 03 10 2011 yuche.tsai
333 * 03 08 2011 yuche.tsai
334 * [WCXRP00000480] [Volunteer Patch][MT6620][Driver] WCS IE format issue[WCXRP00000509] [Volunteer Patch][MT6620][Driver] Kernal panic when remove p2p module.
337 * 03 07 2011 yuche.tsai
338 * [WCXRP00000502] [Volunteer Patch][MT6620][Driver] Fix group ID issue when doing Group Formation.
342 * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code
343 * rename the define to anti_pviracy.
346 * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code
347 * add the code to get the check rsponse and indicate to app.
350 * [WCXRP00000510] [MT6620 Wi-Fi] [Driver] Fixed the CTIA enter test mode issue
351 * fixed the p2p action frame type check for device request indication.
353 * 03 02 2011 yuche.tsai
354 * [WCXRP00000245] 1. Invitation Request/Response.
355 2. Provision Discovery Request/Response
357 * Fix Service Discovery RX packet buffer pointer.
359 * 03 01 2011 yuche.tsai
360 * [WCXRP00000501] [Volunteer Patch][MT6620][Driver] No common channel issue when doing GO formation
361 * Update channel issue when doing GO formation..
363 * 03 01 2011 yuche.tsai
364 * [WCXRP00000245] 1. Invitation Request/Response.
365 2. Provision Discovery Request/Response
367 * Update Service Discovery Related wlanoid function.
369 * 02 21 2011 yuche.tsai
370 * [WCXRP00000481] [Volunteer Patch][MT6620][FW] Scan hang under concurrent case.
371 * Fix all BE issue of WSC or P2P IE.
374 * [WCXRP00000471] [MT6620 Wi-Fi][Driver] Add P2P Provison discovery append Config Method attribute at WSC IE
375 * fixed the wsc config method mapping to driver used config method issue.
377 * 02 18 2011 yuche.tsai
378 * [WCXRP00000479] [Volunteer Patch][MT6620][Driver] Probe Response of P2P using 11b rate.
379 * Update basic rate to FW, after P2P is initialed.
381 * 02 18 2011 yuche.tsai
382 * [WCXRP00000478] [Volunteer Patch][MT6620][Driver] Probe request frame during search phase do not contain P2P wildcard SSID.
383 * Use P2P Wildcard SSID when scan type of P2P_WILDCARD_SSID is set.
385 * 02 18 2011 yuche.tsai
386 * [WCXRP00000480] [Volunteer Patch][MT6620][Driver] WCS IE format issue
387 * Fix WSC IE BE format issue.
390 * [WCXRP00000471] [MT6620 Wi-Fi][Driver] Add P2P Provison discovery append Config Method attribute at WSC IE
391 * append the WSC IE config method attribute at provision discovery request.
394 * [WCXRP00000448] [MT6620 Wi-Fi][Driver] Fixed WSC IE not send out at probe request
395 * fixed the probe request send out without WSC IE issue (at P2P).
397 * 02 16 2011 yuche.tsai
398 * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode.
399 * If two station connected to the Hot-Spot and one disconnect, FW would get into an infinite loop
401 * 02 15 2011 yuche.tsai
402 * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode.
403 * Fix re-connection issue after RX deauthentication.
405 * 02 15 2011 yuche.tsai
406 * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode.
407 * Fix conneciton issue after disconnect with AP.
409 * 02 12 2011 yuche.tsai
410 * [WCXRP00000441] [Volunteer Patch][MT6620][Driver] BoW can not create desired station type when Hot Spot is enabled.
411 * P2P Create Station Type according to Target BSS capability.
413 * 02 10 2011 yuche.tsai
414 * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode.
415 * Support Disassoc & Deauthentication for Hot-Spot.
417 * 02 09 2011 yuche.tsai
418 * [WCXRP00000245] 1. Invitation Request/Response.
419 2. Provision Discovery Request/Response
421 * Add Service Discovery Indication Related code.
423 * 02 09 2011 yuche.tsai
424 * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode.
425 * Add Support for MLME deauthentication for Hot-Spot.
427 * 02 09 2011 yuche.tsai
428 * [WCXRP00000429] [Volunteer Patch][MT6620][Driver] Hot Spot Client Limit Issue
429 * Fix Client Limit Issue.
431 * 02 08 2011 yuche.tsai
432 * [WCXRP00000419] [Volunteer Patch][MT6620/MT5931][Driver] Provide function of disconnect to target station for AAA module.
433 * Disconnect every station client when disolve on P2P group.
435 * 02 08 2011 yuche.tsai
436 * [WCXRP00000245] 1. Invitation Request/Response.
437 2. Provision Discovery Request/Response
439 * 1. Fix Service Disocvery Logical issue.
440 * 2. Fix a NULL pointer access violation issue when sending deauthentication packet to a class error station.
442 * 02 08 2011 yuche.tsai
443 * [WCXRP00000419] [Volunteer Patch][MT6620/MT5931][Driver] Provide function of disconnect to target station for AAA module.
444 * Workaround of disable P2P network.
446 * 02 08 2011 yuche.tsai
447 * [WCXRP00000421] [Volunteer Patch][MT6620][Driver] Fix incorrect SSID length Issue
448 * 1. Fixed SSID wrong length issue.
449 * 2. Under Hot Spot configuration, there won't be any P2P IE.
450 * 3. Under Hot Spot configuration, P2P FSM won't get into LISTEN state first.
452 * 01 27 2011 yuche.tsai
453 * [WCXRP00000399] [Volunteer Patch][MT6620/MT5931][Driver] Fix scan side effect after P2P module separate.
454 * Modify Start GO flow.
456 * 01 27 2011 yuche.tsai
457 * [WCXRP00000399] [Volunteer Patch][MT6620/MT5931][Driver] Fix scan side effect after P2P module separate.
458 * Fix desire phy type set issue.
460 * 01 27 2011 yuche.tsai
461 * [WCXRP00000399] [Volunteer Patch][MT6620/MT5931][Driver] Fix scan side effect after P2P module separate.
462 * Add desire phy type set phase I.
464 * 01 26 2011 yuche.tsai
465 * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record.
466 * Fix P2P Disconnect Issue.
468 * 01 26 2011 yuche.tsai
469 * [WCXRP00000245] 1. Invitation Request/Response.
470 2. Provision Discovery Request/Response
472 * Add Service Discovery Function.
474 * 01 26 2011 cm.chang
475 * [WCXRP00000395] [MT6620 Wi-Fi][Driver][FW] Search STA_REC with additional net type index argument
478 * 01 25 2011 yuche.tsai
479 * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record.
480 * Fix compile error when DBG is disabled.
482 * 01 25 2011 yuche.tsai
483 * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record.
484 * Change Station Type Definition.
486 * 01 19 2011 yuche.tsai
487 * [WCXRP00000353] [Volunteer Patch][MT6620][Driver] Desired Non-HT Rate Set update when STA record is created under AP Mode.
488 * Add P2P QoS Support.
490 * 01 19 2011 george.huang
491 * [WCXRP00000355] [MT6620 Wi-Fi] Set WMM-PS related setting with qualifying AP capability
492 * Null NOA attribute setting when no related parameters.
494 * 01 14 2011 yuche.tsai
495 * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue
496 * Modify AAA flow according to CM's comment.
498 * 01 13 2011 yuche.tsai
499 * [WCXRP00000353] [Volunteer Patch][MT6620][Driver] Desired Non-HT Rate Set update when STA record is created under AP Mode.
500 * Resolve Channel ZERO issue. (Uninitialized default channel)
502 * 01 13 2011 yuche.tsai
503 * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue
504 * Update P2P State Debug Message.
506 * 01 12 2011 yuche.tsai
507 * [WCXRP00000353] [Volunteer Patch][MT6620][Driver] Desired Non-HT Rate Set update when STA record is created under AP Mode.
508 * Fix bug when allocating message buffer.
510 * 01 12 2011 yuche.tsai
511 * [WCXRP00000353] [Volunteer Patch][MT6620][Driver] Desired Non-HT Rate Set update when STA record is created under AP Mode.
512 * Update Phy Type Set. When legacy client is connected, it can use 11b rate,
513 * but if the P2P device is connected, 11b rate is not allowed.
515 * 01 12 2011 yuche.tsai
516 * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue
517 * 1. Modify Channel Acquire Time of AP mode from 5s to 1s.
518 * 2. Call cnmP2pIsPermit() before active P2P network.
519 * 3. Add channel selection support for AP mode.
521 * 01 12 2011 yuche.tsai
522 * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue
523 * Fix Bug of reference to NULL pointer.
525 * 01 12 2011 yuche.tsai
526 * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue
527 * Modify some behavior of AP mode.
529 * 01 12 2011 yuche.tsai
530 * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue
531 * Fix bug of wrong pointer check.
533 * 01 12 2011 yuche.tsai
534 * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue
537 * 01 11 2011 yuche.tsai
538 * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue
539 * Add station record into client list before change it state from STATE_2 to STATE_3.
541 * 01 05 2011 yuche.tsai
542 * [WCXRP00000345] [MT6620][Volunteer Patch] P2P may issue a SSID specified scan request, but the SSID length is still invalid.
543 * Specify SSID Type when issue a scan request.
546 * [WCXRP00000338] [MT6620 Wi-Fi][Driver] Separate kalMemAlloc into kmalloc and vmalloc implementations to ease physically continous memory demands
549 * 01 05 2011 george.huang
550 * [WCXRP00000343] [MT6620 Wi-Fi] Add TSF reset path for concurrent operation
551 * modify NOA update path for preventing assertion false alarm.
554 * [WCXRP00000338] [MT6620 Wi-Fi][Driver] Separate kalMemAlloc into kmalloc and vmalloc implementations to ease physically continous memory demands
555 * separate kalMemAlloc() into virtually-continous and physically-continous type to ease slab system pressure
558 * [WCXRP00000326] [MT6620][Wi-Fi][Driver] check in the binary format gl_sec.o.new instead of use change type!!!
559 * let the p2p ap mode acept a legacy device join.
561 * 12 22 2010 yuche.tsai
562 * [WCXRP00000245] 1. Invitation Request/Response.
563 2. Provision Discovery Request/Response
567 * 12 15 2010 yuche.tsai
568 * [WCXRP00000245] 1. Invitation Request/Response.
569 2. Provision Discovery Request/Response
571 * Refine Connection Flow.
573 * 12 08 2010 yuche.tsai
574 * [WCXRP00000245] [MT6620][Driver] Invitation & Provision Discovery Feature Check-in
575 * [WCXRP000000245][MT6620][Driver] Invitation Request Feature Add
577 * 12 08 2010 yuche.tsai
578 * [WCXRP00000244] [MT6620][Driver] Add station record type for each client when in AP mode.
579 * 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.
581 * 12 07 2010 cm.chang
582 * [WCXRP00000239] MT6620 Wi-Fi][Driver][FW] Merge concurrent branch back to maintrunk
583 * The order of invoking nicUpdateBss() and rlm functions
585 * 12 02 2010 yuche.tsai
587 * Update P2P Connection Policy for Invitation.
589 * 12 02 2010 yuche.tsai
591 * Update P2P Connection Policy for Invitation & Provision Discovery.
593 * 11 30 2010 yuche.tsai
595 * Invitation & Provision Discovery Indication.
597 * 11 30 2010 yuche.tsai
599 * Update Configure Method indication & selection for Provision Discovery & GO_NEGO_REQ
601 * 11 30 2010 yuche.tsai
603 * Update RCIP value when RX assoc request frame.
605 * 11 29 2010 yuche.tsai
607 * Update P2P related function for INVITATION & PROVISION DISCOVERY.
609 * 11 26 2010 george.huang
610 * [WCXRP00000152] [MT6620 Wi-Fi] AP mode power saving function
611 * Update P2P PS for NOA function.
613 * 11 25 2010 yuche.tsai
615 * Update Code for Invitation Related Function.
618 * [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
619 * fixed some ASSERT check.
622 * [WCXRP00000164] [MT6620 Wi-Fi][Driver] Support the p2p random SSID
623 * fixed the p2p role code error.
626 * [WCXRP00000164] [MT6620 Wi-Fi][Driver] Support the p2p random SSID
627 * adding the p2p random ssid support.
630 * [WCXRP00000124] [MT6620 Wi-Fi] [Driver] Support the dissolve P2P Group
631 * fixed the ASSERT check error
634 * [WCXRP00000124] [MT6620 Wi-Fi] [Driver] Support the dissolve P2P Group
635 * Add the code to support disconnect p2p group
638 * [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
639 * fixed the compiling error.
642 * [WCXRP00000102] [MT6620 Wi-Fi] [FW] Add a compiling flag and code for support Direct GO at Android
643 * adding a code to support Direct GO with a compiling flag .
646 * [WCXRP00000087] [MT6620 Wi-Fi][Driver] Cannot connect to 5GHz AP, driver will cause FW assert.
647 * correct erroneous logic: specifying eBand with incompatible eSco
650 * [WCXRP00000085] [MT6620 Wif-Fi] [Driver] update the modified p2p state machine
651 * fixed the compiling error.
654 * [WCXRP00000085] [MT6620 Wif-Fi] [Driver] update the modified p2p state machine
655 * update the frog's new p2p state machine.
659 * fixed the compiling error at WinXP.
661 * 09 07 2010 yuche.tsai
663 * Reset Common IE Buffer of P2P INFO when scan request is issued.
664 * If an action frame other than public action frame is received, return direcly.
668 * adding the code for beacon/probe req/ probe rsp wsc ie at p2p.
672 * let the p2p can set the privacy bit at beacon and rsn ie at assoc req at key handshake state.
674 * 09 03 2010 kevin.huang
676 * Refine #include sequence and solve recursive/nested #include issue
678 * 08 26 2010 yuche.tsai
680 * Add P2P Connection Abort Event Message handler.
682 * 08 24 2010 cm.chang
684 * Support RLM initail channel of Ad-hoc, P2P and BOW
686 * 08 23 2010 yuche.tsai
688 * 1. Fix Interface Address from GO Nego Req/Rsp is not correct.
689 * 2. Fix GO mode does not change media state after station connected.
690 * 3. Fix STA don't response probe request when there is a connection request.
692 * 08 20 2010 cm.chang
694 * Migrate RLM code to host from FW
696 * 08 20 2010 kevin.huang
698 * Modify AAA Module for changing STA STATE 3 at p2p/bowRunEventAAAComplete()
700 * 08 20 2010 yuche.tsai
702 * Add Glue Layer indication.
704 * 08 17 2010 yuche.tsai
706 * Fix compile warning under Linux.
708 * 08 17 2010 yuche.tsai
710 * Fix some P2P FSM bug.
712 * 08 16 2010 yuche.tsai
714 * Add random Interface Address Generation support.
716 * 08 16 2010 yuche.tsai
718 * Fix some P2P FSM bug.
720 * 08 16 2010 yuche.tsai
722 * Update P2P FSM code for GO Nego.
724 * 08 16 2010 kevin.huang
726 * Refine AAA functions
728 * 08 12 2010 kevin.huang
730 * Refine bssProcessProbeRequest() and bssSendBeaconProbeResponse()
732 * 08 12 2010 yuche.tsai
734 * Join complete indication.
736 * 08 11 2010 yuche.tsai
738 * Add two boolean in connection request.
739 * Based on these two boolean value, P2P FSM should
740 * decide to do invitation or group formation or start a GO directly.
742 * 08 11 2010 yuche.tsai
744 * Update P2P FSM, currently P2P Device Discovery is verified.
746 * 08 05 2010 yuche.tsai
748 * Update P2P FSM for group formation.
750 * 08 03 2010 george.huang
752 * handle event for updating NOA parameters indicated from FW
756 * limit build always needs spin-lock declaration.
758 * 08 02 2010 yuche.tsai
760 * P2P Group Negotiation Code Check in.
762 * 07 26 2010 yuche.tsai
764 * Add P2P FSM code check in.
766 * 07 21 2010 yuche.tsai
768 * Add P2P Scan & Scan Result Parsing & Saving.
770 * 07 19 2010 yuche.tsai
774 * 07 09 2010 george.huang
776 * [WPD00001556] Migrate PM variables from FW to driver: for composing QoS Info
780 * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
782 * 06 21 2010 yuche.tsai
783 * [WPD00003839][MT6620 5931][P2P] Feature migration
784 * Fix compile error while enable WIFI_DIRECT support.
786 * 06 21 2010 yuche.tsai
787 * [WPD00003839][MT6620 5931][P2P] Feature migration
788 * Update P2P Function call.
790 * 06 17 2010 yuche.tsai
791 * [WPD00003839][MT6620 5931][P2P] Feature migration
792 * First draft for migration P2P FSM from FW to Driver.
794 * 04 19 2010 kevin.huang
795 * [BORA00000714][WIFISYS][New Feature]Beacon Timeout Support
796 * Add Beacon Timeout Support and will send Null frame to diagnose connection
798 * 03 18 2010 kevin.huang
799 * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support
800 * Rename CFG flag for P2P
802 * 02 26 2010 kevin.huang
803 * [BORA00000603][WIFISYS] [New Feature] AAA Module Support
804 * Add code to test P2P GO
806 * 02 23 2010 kevin.huang
807 * [BORA00000603][WIFISYS] [New Feature] AAA Module Support
808 * Add Wi-Fi Direct SSID and P2P GO Test Mode
810 * 02 05 2010 kevin.huang
811 * [BORA00000603][WIFISYS] [New Feature] AAA Module Support
812 * Modify code due to BAND_24G define was changed
814 * 02 05 2010 kevin.huang
815 * [BORA00000603][WIFISYS] [New Feature] AAA Module Support
816 * Revise data structure to share the same BSS_INFO_T for avoiding coding error
818 * 02 04 2010 kevin.huang
819 * [BORA00000603][WIFISYS] [New Feature] AAA Module Support
820 * Add AAA Module Support, Revise Net Type to Net Type Index for array lookup
823 /*******************************************************************************
824 * C O M P I L E R F L A G S
825 ********************************************************************************
828 /*******************************************************************************
829 * E X T E R N A L R E F E R E N C E S
830 ********************************************************************************
834 #if CFG_ENABLE_WIFI_DIRECT
836 /*******************************************************************************
838 ********************************************************************************
841 /*******************************************************************************
843 ********************************************************************************
846 /*******************************************************************************
847 * P U B L I C D A T A
848 ********************************************************************************
851 /*******************************************************************************
852 * P R I V A T E D A T A
853 ********************************************************************************
856 /*lint -save -e64 Type mismatch */
857 static PUINT_8 apucDebugP2pState[P2P_STATE_NUM] = {
858 (PUINT_8)DISP_STRING("P2P_STATE_IDLE"),
859 (PUINT_8)DISP_STRING("P2P_STATE_SCAN"),
860 (PUINT_8)DISP_STRING("P2P_STATE_AP_CHANNEL_DETECT"),
861 (PUINT_8)DISP_STRING("P2P_STATE_REQING_CHANNEL"),
862 (PUINT_8)DISP_STRING("P2P_STATE_CHNL_ON_HAND"),
863 (PUINT_8)DISP_STRING("P2P_STATE_GC_JOIN")
869 /*******************************************************************************
871 ********************************************************************************
874 /*******************************************************************************
875 * F U N C T I O N D E C L A R A T I O N S
876 ********************************************************************************
879 /*******************************************************************************
881 ********************************************************************************
884 /* p2pStateXXX : Processing P2P FSM related action.
885 * p2pFSMXXX : Control P2P FSM flow.
886 * p2pFuncXXX : Function for doing one thing.
890 IN P_ADAPTER_T prAdapter
894 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
895 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
898 ASSERT_BREAK(prAdapter != NULL);
900 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
901 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
903 ASSERT_BREAK(prP2pFsmInfo != NULL);
905 LINK_INITIALIZE(&(prP2pFsmInfo->rMsgEventQueue));
906 LINK_INITIALIZE(&(prP2pBssInfo->rStaRecOfClientList));
909 prP2pFsmInfo->eCurrentState = prP2pFsmInfo->ePreviousState = P2P_STATE_IDLE;
910 prP2pFsmInfo->prTargetBss = NULL;
911 prP2pFsmInfo->fgIsWPSMode = 0;
913 cnmTimerInitTimer(prAdapter,
914 &(prP2pFsmInfo->rP2pFsmTimeoutTimer),
915 (PFN_MGMT_TIMEOUT_FUNC)p2pFsmRunEventFsmTimeout,
916 (UINT_32)prP2pFsmInfo);
918 //4 <2> Initiate BSS_INFO_T - common part
919 BSS_INFO_INIT(prAdapter, NETWORK_TYPE_P2P_INDEX);
922 //4 <2.1> Initiate BSS_INFO_T - Setup HW ID
923 prP2pBssInfo->ucConfigAdHocAPMode = AP_MODE_11G_P2P;
924 prP2pBssInfo->ucHwDefaultFixedRateCode = RATE_OFDM_6M;
927 prP2pBssInfo->ucNonHTBasicPhyType = (UINT_8)
928 rNonHTApModeAttributes[prP2pBssInfo->ucConfigAdHocAPMode].ePhyTypeIndex;
929 prP2pBssInfo->u2BSSBasicRateSet =
930 rNonHTApModeAttributes[prP2pBssInfo->ucConfigAdHocAPMode].u2BSSBasicRateSet;
932 prP2pBssInfo->u2OperationalRateSet =
933 rNonHTPhyAttributes[prP2pBssInfo->ucNonHTBasicPhyType].u2SupportedRateSet;
935 rateGetDataRatesFromRateSet(prP2pBssInfo->u2OperationalRateSet,
936 prP2pBssInfo->u2BSSBasicRateSet,
937 prP2pBssInfo->aucAllSupportedRates,
938 &prP2pBssInfo->ucAllSupportedRatesLen);
940 prP2pBssInfo->prBeacon = cnmMgtPktAlloc(prAdapter,
941 OFFSET_OF(WLAN_BEACON_FRAME_T, aucInfoElem[0]) + MAX_IE_LENGTH);
943 if (prP2pBssInfo->prBeacon) {
944 prP2pBssInfo->prBeacon->eSrc = TX_PACKET_MGMT;
945 prP2pBssInfo->prBeacon->ucStaRecIndex = 0xFF; /* NULL STA_REC */
946 prP2pBssInfo->prBeacon->ucNetworkType = NETWORK_TYPE_P2P_INDEX;
953 prP2pBssInfo->eCurrentOPMode = OP_MODE_NUM;
955 prP2pBssInfo->rPmProfSetupInfo.ucBmpDeliveryAC = PM_UAPSD_ALL;
956 prP2pBssInfo->rPmProfSetupInfo.ucBmpTriggerAC = PM_UAPSD_ALL;
957 prP2pBssInfo->rPmProfSetupInfo.ucUapsdSp = WMM_MAX_SP_LENGTH_2;
958 prP2pBssInfo->ucPrimaryChannel = P2P_DEFAULT_LISTEN_CHANNEL;
959 prP2pBssInfo->eBand = BAND_2G4;
960 prP2pBssInfo->eBssSCO = CHNL_EXT_SCN;
962 if (prAdapter->rWifiVar.fgSupportQoS) {
963 prP2pBssInfo->fgIsQBSS = TRUE;
966 prP2pBssInfo->fgIsQBSS = FALSE;
969 SET_NET_PWR_STATE_IDLE(prAdapter, NETWORK_TYPE_P2P_INDEX);
971 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
982 /*----------------------------------------------------------------------------*/
984 * @brief The function is used to uninitialize the value in P2P_FSM_INFO_T for
991 /*----------------------------------------------------------------------------*/
994 IN P_ADAPTER_T prAdapter
997 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
998 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
1001 ASSERT_BREAK(prAdapter != NULL);
1003 DEBUGFUNC("p2pFsmUninit()");
1004 DBGLOG(P2P, INFO, ("->p2pFsmUninit()\n"));
1006 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1007 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
1009 p2pFuncSwitchOPMode(prAdapter, prP2pBssInfo, OP_MODE_P2P_DEVICE, TRUE);
1011 p2pFsmRunEventAbort(prAdapter, prP2pFsmInfo);
1013 p2pStateAbort_IDLE(prAdapter, prP2pFsmInfo, P2P_STATE_NUM);
1015 UNSET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX);
1017 wlanAcquirePowerControl(prAdapter);
1019 /* Release all pending CMD queue. */
1020 DBGLOG(P2P, TRACE, ("p2pFsmUninit: wlanProcessCommandQueue, num of element:%d\n", prAdapter->prGlueInfo->rCmdQueue.u4NumElem));
1021 wlanProcessCommandQueue(prAdapter, &prAdapter->prGlueInfo->rCmdQueue);
1023 wlanReleasePowerControl(prAdapter);
1025 /* Release pending mgmt frame,
1026 * mgmt frame may be pending by CMD without resource.
1028 kalClearMgmtFramesByNetType(prAdapter->prGlueInfo, NETWORK_TYPE_P2P_INDEX);
1030 /* Clear PendingCmdQue*/
1031 wlanReleasePendingCMDbyNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX);
1033 if (prP2pBssInfo->prBeacon) {
1034 cnmMgtPktFree(prAdapter, prP2pBssInfo->prBeacon);
1035 prP2pBssInfo->prBeacon = NULL;
1042 } /* end of p2pFsmUninit() */
1045 p2pFsmStateTransition (
1046 IN P_ADAPTER_T prAdapter,
1047 IN P_P2P_FSM_INFO_T prP2pFsmInfo,
1048 IN ENUM_P2P_STATE_T eNextState
1051 BOOLEAN fgIsTransOut = (BOOLEAN)FALSE;
1052 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
1053 P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo = (P_P2P_SPECIFIC_BSS_INFO_T)NULL;
1056 ASSERT_BREAK((prAdapter != NULL) && (prP2pFsmInfo != NULL));
1058 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
1059 prP2pSpecificBssInfo = prAdapter->rWifiVar.prP2pSpecificBssInfo;
1061 if (!IS_BSS_ACTIVE(prP2pBssInfo)) {
1062 if (!cnmP2PIsPermitted(prAdapter)) {
1066 SET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX);
1067 nicActivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX);
1070 fgIsTransOut = fgIsTransOut?FALSE:TRUE;
1072 if (!fgIsTransOut) {
1073 DBGLOG(P2P, STATE, ("TRANSITION: [%s] -> [%s]\n",
1074 apucDebugP2pState[prP2pFsmInfo->eCurrentState],
1075 apucDebugP2pState[eNextState]));
1077 /* Transition into current state. */
1078 prP2pFsmInfo->ePreviousState = prP2pFsmInfo->eCurrentState;
1079 prP2pFsmInfo->eCurrentState = eNextState;
1083 switch (prP2pFsmInfo->eCurrentState) {
1084 case P2P_STATE_IDLE:
1087 p2pStateAbort_IDLE(prAdapter,
1092 fgIsTransOut = p2pStateInit_IDLE(prAdapter,
1099 case P2P_STATE_SCAN:
1102 // Scan done / scan canceled.
1103 p2pStateAbort_SCAN(prAdapter, prP2pFsmInfo, eNextState);
1106 // Initial scan request.
1107 p2pStateInit_SCAN(prAdapter, prP2pFsmInfo);
1111 case P2P_STATE_AP_CHANNEL_DETECT:
1114 // Get sparse channel result.
1115 p2pStateAbort_AP_CHANNEL_DETECT(prAdapter,
1117 prP2pSpecificBssInfo,
1122 // Initial passive scan request.
1123 p2pStateInit_AP_CHANNEL_DETECT(prAdapter, prP2pFsmInfo);
1127 case P2P_STATE_REQING_CHANNEL:
1130 // Channel on hand / Channel canceled.
1131 p2pStateAbort_REQING_CHANNEL(prAdapter, prP2pFsmInfo, eNextState);
1134 // Initial channel request.
1135 p2pFuncAcquireCh(prAdapter, &(prP2pFsmInfo->rChnlReqInfo));
1139 case P2P_STATE_CHNL_ON_HAND:
1141 p2pStateAbort_CHNL_ON_HAND(prAdapter, prP2pFsmInfo, prP2pBssInfo, eNextState);
1144 // Initial channel ready.
1145 // Send channel ready event.
1146 // Start a FSM timer.
1147 p2pStateInit_CHNL_ON_HAND(prAdapter, prP2pBssInfo, prP2pFsmInfo);
1151 case P2P_STATE_GC_JOIN:
1154 // Join complete / join canceled.
1155 p2pStateAbort_GC_JOIN(prAdapter,
1157 &(prP2pFsmInfo->rJoinInfo),
1161 ASSERT(prP2pFsmInfo->prTargetBss != NULL);
1163 // Send request to SAA module.
1164 p2pStateInit_GC_JOIN(prAdapter,
1167 &(prP2pFsmInfo->rJoinInfo),
1168 prP2pFsmInfo->prTargetBss);
1176 } while (fgIsTransOut);
1178 } /* p2pFsmStateTransition */
1182 p2pFsmRunEventSwitchOPMode (
1183 IN P_ADAPTER_T prAdapter,
1184 IN P_MSG_HDR_T prMsgHdr
1187 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
1188 P_MSG_P2P_SWITCH_OP_MODE_T prSwitchOpMode = (P_MSG_P2P_SWITCH_OP_MODE_T)prMsgHdr;
1189 P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = (P_P2P_CONNECTION_SETTINGS_T)NULL;
1192 ASSERT_BREAK((prAdapter != NULL) && (prSwitchOpMode != NULL));
1194 DBGLOG(P2P, TRACE, ("p2pFsmRunEventSwitchOPMode\n"));
1196 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
1197 prP2pConnSettings = prAdapter->rWifiVar.prP2PConnSettings;
1199 if (prSwitchOpMode->eOpMode >= OP_MODE_NUM) {
1204 /* P2P Device / GC. */
1205 p2pFuncSwitchOPMode(prAdapter,
1207 prSwitchOpMode->eOpMode,
1213 cnmMemFree(prAdapter, prMsgHdr);
1217 } /* p2pFsmRunEventSwitchOPMode */
1220 /*----------------------------------------------------------------------------*/
1222 * \brief This function is used to handle scan done event during Device Discovery.
1224 * \param[in] prAdapter Pointer of ADAPTER_T
1228 /*----------------------------------------------------------------------------*/
1230 p2pFsmRunEventScanDone (
1231 IN P_ADAPTER_T prAdapter,
1232 IN P_MSG_HDR_T prMsgHdr
1235 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1236 P_P2P_SCAN_REQ_INFO_T prScanReqInfo = (P_P2P_SCAN_REQ_INFO_T)NULL;
1237 P_MSG_SCN_SCAN_DONE prScanDoneMsg = (P_MSG_SCN_SCAN_DONE)NULL;
1238 ENUM_P2P_STATE_T eNextState = P2P_STATE_NUM;
1241 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1244 /* This scan done event is either for "SCAN" phase or "SEARCH" state or "LISTEN" state.
1245 * The scan done for SCAN phase & SEARCH state doesn't imply Device
1248 DBGLOG(P2P, TRACE, ("P2P Scan Done Event\n"));
1250 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1252 if (prP2pFsmInfo == NULL) {
1257 prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo);
1258 prScanDoneMsg = (P_MSG_SCN_SCAN_DONE)prMsgHdr;
1260 if (prScanDoneMsg->ucSeqNum != prScanReqInfo->ucSeqNumOfScnMsg) {
1261 /* Scan Done message sequence number mismatch.
1262 * Ignore this event. (P2P FSM issue two scan events.)
1264 /* The scan request has been cancelled.
1265 * Ignore this message. It is possible.
1267 DBGLOG(P2P, TRACE, ("P2P Scan Don SeqNum:%d <-> P2P Fsm SCAN Msg:%d\n",
1268 prScanDoneMsg->ucSeqNum,
1269 prScanReqInfo->ucSeqNumOfScnMsg));
1275 switch (prP2pFsmInfo->eCurrentState) {
1276 case P2P_STATE_SCAN:
1278 P_P2P_CONNECTION_REQ_INFO_T prConnReqInfo = &(prP2pFsmInfo->rConnReqInfo);
1280 prScanReqInfo->fgIsAbort = FALSE;
1282 if (prConnReqInfo->fgIsConnRequest) {
1284 if ((prP2pFsmInfo->prTargetBss = p2pFuncKeepOnConnection(prAdapter,
1285 &prP2pFsmInfo->rConnReqInfo,
1286 &prP2pFsmInfo->rChnlReqInfo,
1287 &prP2pFsmInfo->rScanReqInfo)) == NULL) {
1288 eNextState = P2P_STATE_SCAN;
1291 eNextState = P2P_STATE_REQING_CHANNEL;
1296 eNextState = P2P_STATE_IDLE;
1301 case P2P_STATE_AP_CHANNEL_DETECT:
1302 eNextState = P2P_STATE_REQING_CHANNEL;
1305 /* Unexpected channel scan done event without being chanceled. */
1310 prScanReqInfo->fgIsScanRequest = FALSE;
1312 p2pFsmStateTransition(prAdapter,
1319 cnmMemFree(prAdapter, prMsgHdr);
1323 } /* p2pFsmRunEventScanDone */
1327 /*----------------------------------------------------------------------------*/
1329 * \brief This function is call when channel is granted by CNM module from FW.
1331 * \param[in] prAdapter Pointer of ADAPTER_T
1335 /*----------------------------------------------------------------------------*/
1337 p2pFsmRunEventChGrant (
1338 IN P_ADAPTER_T prAdapter,
1339 IN P_MSG_HDR_T prMsgHdr
1342 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1343 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = (P_P2P_CHNL_REQ_INFO_T)NULL;
1344 P_MSG_CH_GRANT_T prMsgChGrant = (P_MSG_CH_GRANT_T)NULL;
1345 UINT_8 ucTokenID = 0;
1348 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1350 DBGLOG(P2P, TRACE, ("P2P Run Event Channel Grant\n"));
1352 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1354 if (prP2pFsmInfo == NULL) {
1358 prMsgChGrant = (P_MSG_CH_GRANT_T)prMsgHdr;
1359 ucTokenID = prMsgChGrant->ucTokenID;
1360 prP2pFsmInfo->u4GrantInterval = prMsgChGrant->u4GrantInterval;
1362 prChnlReqInfo = &(prP2pFsmInfo->rChnlReqInfo);
1364 if (ucTokenID == prChnlReqInfo->ucSeqNumOfChReq) {
1365 ENUM_P2P_STATE_T eNextState = P2P_STATE_NUM;
1367 switch (prP2pFsmInfo->eCurrentState) {
1368 case P2P_STATE_REQING_CHANNEL:
1369 switch (prChnlReqInfo->eChannelReqType) {
1370 case CHANNEL_REQ_TYPE_REMAIN_ON_CHANNEL:
1371 eNextState = P2P_STATE_CHNL_ON_HAND;
1373 case CHANNEL_REQ_TYPE_GC_JOIN_REQ:
1374 eNextState = P2P_STATE_GC_JOIN;
1376 case CHANNEL_REQ_TYPE_GO_START_BSS:
1377 eNextState = P2P_STATE_IDLE;
1383 p2pFsmStateTransition(prAdapter,
1388 /* Channel is granted under unexpected state.
1389 * Driver should cancel channel privileagea before leaving the states.
1397 /* Channel requsted, but released. */
1398 //ASSERT(!prChnlReqInfo->fgIsChannelRequested);
1399 DBGLOG(P2P, TRACE, ("Channel requsted, but released\n"));
1404 cnmMemFree(prAdapter, prMsgHdr);
1409 } /* p2pFsmRunEventChGrant */
1413 p2pFsmRunEventChannelRequest (
1414 IN P_ADAPTER_T prAdapter,
1415 IN P_MSG_HDR_T prMsgHdr
1418 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = (P_P2P_CHNL_REQ_INFO_T)NULL;
1419 P_MSG_P2P_CHNL_REQUEST_T prP2pChnlReqMsg = (P_MSG_P2P_CHNL_REQUEST_T)NULL;
1420 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1421 ENUM_P2P_STATE_T eNextState = P2P_STATE_NUM;
1424 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1426 prP2pChnlReqMsg = (P_MSG_P2P_CHNL_REQUEST_T)prMsgHdr;
1427 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1429 if (prP2pFsmInfo == NULL) {
1433 prChnlReqInfo = &(prP2pFsmInfo->rChnlReqInfo);
1435 DBGLOG(P2P, TRACE, ("p2pFsmRunEventChannelRequest\n"));
1437 /* Special case of time renewing for same frequency. */
1438 if ((prP2pFsmInfo->eCurrentState == P2P_STATE_CHNL_ON_HAND) &&
1439 (prChnlReqInfo->ucReqChnlNum == prP2pChnlReqMsg->rChannelInfo.ucChannelNum) &&
1440 (prChnlReqInfo->eBand == prP2pChnlReqMsg->rChannelInfo.eBand) &&
1441 (prChnlReqInfo->eChnlSco == prP2pChnlReqMsg->eChnlSco)) {
1443 ASSERT(prChnlReqInfo->fgIsChannelRequested == TRUE);
1444 ASSERT(prChnlReqInfo->eChannelReqType == CHANNEL_REQ_TYPE_REMAIN_ON_CHANNEL);
1446 prChnlReqInfo->u8Cookie = prP2pChnlReqMsg->u8Cookie;
1447 prChnlReqInfo->u4MaxInterval = prP2pChnlReqMsg->u4Duration;
1449 /* Re-enter the state. */
1450 eNextState = P2P_STATE_CHNL_ON_HAND;
1454 // Make sure the state is in IDLE state.
1455 p2pFsmRunEventAbort(prAdapter, prP2pFsmInfo);
1457 prChnlReqInfo->u8Cookie = prP2pChnlReqMsg->u8Cookie; /* Cookie can only be assign after abort.(for indication) */
1458 prChnlReqInfo->ucReqChnlNum = prP2pChnlReqMsg->rChannelInfo.ucChannelNum;
1459 prChnlReqInfo->eBand = prP2pChnlReqMsg->rChannelInfo.eBand;
1460 prChnlReqInfo->eChnlSco = prP2pChnlReqMsg->eChnlSco;
1461 prChnlReqInfo->u4MaxInterval = prP2pChnlReqMsg->u4Duration;
1462 prChnlReqInfo->eChannelReqType = CHANNEL_REQ_TYPE_REMAIN_ON_CHANNEL;
1464 eNextState = P2P_STATE_REQING_CHANNEL;
1467 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, eNextState);
1473 cnmMemFree(prAdapter, prMsgHdr);
1477 } /* p2pFsmRunEventChannelRequest */
1481 p2pFsmRunEventChannelAbort (
1482 IN P_ADAPTER_T prAdapter,
1483 IN P_MSG_HDR_T prMsgHdr
1486 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1487 P_MSG_P2P_CHNL_ABORT_T prChnlAbortMsg = (P_MSG_P2P_CHNL_ABORT_T)NULL;
1488 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = (P_P2P_CHNL_REQ_INFO_T)NULL;
1491 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1493 prChnlAbortMsg = (P_MSG_P2P_CHNL_ABORT_T)prMsgHdr;
1494 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1496 if (prP2pFsmInfo == NULL) {
1500 prChnlReqInfo = &prP2pFsmInfo->rChnlReqInfo;
1502 DBGLOG(P2P, TRACE, ("p2pFsmRunEventChannelAbort\n"));
1504 if ((prChnlAbortMsg->u8Cookie == prChnlReqInfo->u8Cookie) &&
1505 (prChnlReqInfo->fgIsChannelRequested)) {
1507 ASSERT((prP2pFsmInfo->eCurrentState == P2P_STATE_REQING_CHANNEL ||
1508 (prP2pFsmInfo->eCurrentState == P2P_STATE_CHNL_ON_HAND)));
1510 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
1516 cnmMemFree(prAdapter, prMsgHdr);
1520 } /* p2pFsmRunEventChannelAbort */
1525 p2pFsmRunEventScanRequest (
1526 IN P_ADAPTER_T prAdapter,
1527 IN P_MSG_HDR_T prMsgHdr
1531 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1532 P_MSG_P2P_SCAN_REQUEST_T prP2pScanReqMsg = (P_MSG_P2P_SCAN_REQUEST_T)NULL;
1533 P_P2P_SCAN_REQ_INFO_T prScanReqInfo = (P_P2P_SCAN_REQ_INFO_T)NULL;
1534 UINT_32 u4ChnlListSize = 0;
1537 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1539 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1541 if (prP2pFsmInfo == NULL) {
1545 prP2pScanReqMsg = (P_MSG_P2P_SCAN_REQUEST_T)prMsgHdr;
1546 prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo);
1548 DBGLOG(P2P, TRACE, ("p2pFsmRunEventScanRequest\n"));
1550 // Make sure the state is in IDLE state.
1551 p2pFsmRunEventAbort(prAdapter, prP2pFsmInfo);
1553 ASSERT(prScanReqInfo->fgIsScanRequest == FALSE);
1555 prScanReqInfo->fgIsAbort = TRUE;
1556 prScanReqInfo->eScanType = SCAN_TYPE_ACTIVE_SCAN;
1557 prScanReqInfo->eChannelSet = SCAN_CHANNEL_SPECIFIED;
1560 prScanReqInfo->ucNumChannelList = prP2pScanReqMsg->u4NumChannel;
1561 DBGLOG(P2P, TRACE, ("Scan Request Channel List Number: %d\n", prScanReqInfo->ucNumChannelList));
1562 if (prScanReqInfo->ucNumChannelList > MAXIMUM_OPERATION_CHANNEL_LIST) {
1563 DBGLOG(P2P, TRACE, ("Channel List Number Overloaded: %d, change to: %d\n",
1564 prScanReqInfo->ucNumChannelList,
1565 MAXIMUM_OPERATION_CHANNEL_LIST));
1566 prScanReqInfo->ucNumChannelList = MAXIMUM_OPERATION_CHANNEL_LIST;
1569 u4ChnlListSize = sizeof(RF_CHANNEL_INFO_T) * prScanReqInfo->ucNumChannelList;
1570 kalMemCopy(prScanReqInfo->arScanChannelList, prP2pScanReqMsg->arChannelListInfo, u4ChnlListSize);
1572 // TODO: I only take the first SSID. Multiple SSID may be needed in the future.
1574 if (prP2pScanReqMsg->i4SsidNum >= 1) {
1576 kalMemCopy(&(prScanReqInfo->rSsidStruct),
1577 prP2pScanReqMsg->prSSID,
1578 sizeof(P2P_SSID_STRUCT_T));
1581 prScanReqInfo->rSsidStruct.ucSsidLen = 0;
1585 kalMemCopy(prScanReqInfo->aucIEBuf,
1586 prP2pScanReqMsg->pucIEBuf,
1587 prP2pScanReqMsg->u4IELen);
1589 prScanReqInfo->u4BufLength = prP2pScanReqMsg->u4IELen;
1591 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_SCAN);
1598 cnmMemFree(prAdapter, prMsgHdr);
1602 } /* p2pFsmRunEventScanRequest */
1606 p2pFsmRunEventScanAbort (
1607 IN P_ADAPTER_T prAdapter,
1608 IN P_MSG_HDR_T prMsgHdr
1612 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1615 ASSERT_BREAK(prAdapter != NULL);
1617 DBGLOG(P2P, TRACE, ("p2pFsmRunEventScanAbort\n"));
1619 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1621 if (prP2pFsmInfo->eCurrentState == P2P_STATE_SCAN) {
1622 P_P2P_SCAN_REQ_INFO_T prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo);
1624 prScanReqInfo->fgIsAbort = TRUE;
1626 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
1632 cnmMemFree(prAdapter, prMsgHdr);
1636 } /* p2pFsmRunEventScanAbort */
1643 p2pFsmRunEventAbort (
1644 IN P_ADAPTER_T prAdapter,
1645 IN P_P2P_FSM_INFO_T prP2pFsmInfo
1648 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
1650 ASSERT_BREAK((prAdapter != NULL) && (prP2pFsmInfo != NULL));
1652 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
1654 DBGLOG(P2P, TRACE, ("p2pFsmRunEventAbort\n"));
1656 if (prP2pFsmInfo->eCurrentState != P2P_STATE_IDLE) {
1658 if (prP2pFsmInfo->eCurrentState == P2P_STATE_SCAN) {
1660 P_P2P_SCAN_REQ_INFO_T prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo);
1662 prScanReqInfo->fgIsAbort = TRUE;
1664 else if (prP2pFsmInfo->eCurrentState == P2P_STATE_REQING_CHANNEL) {
1668 prP2pBssInfo->eIntendOPMode = OP_MODE_NUM;
1671 // For other state, is there any special action that should be take before leaving?
1673 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
1676 /* P2P State IDLE. */
1677 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = &(prP2pFsmInfo->rChnlReqInfo);
1679 if (prChnlReqInfo->fgIsChannelRequested) {
1680 p2pFuncReleaseCh(prAdapter, prChnlReqInfo);
1683 cnmTimerStopTimer(prAdapter, &(prP2pFsmInfo->rP2pFsmTimeoutTimer));
1690 } /* p2pFsmRunEventAbort */
1694 /*----------------------------------------------------------------------------*/
1696 * \brief This function is used to handle FSM Timeout.
1698 * \param[in] prAdapter Pointer of ADAPTER_T
1702 /*----------------------------------------------------------------------------*/
1704 p2pFsmRunEventFsmTimeout (
1705 IN P_ADAPTER_T prAdapter,
1709 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)u4Param;
1712 ASSERT_BREAK((prAdapter != NULL) && (prP2pFsmInfo != NULL));
1714 DBGLOG(P2P, TRACE, ("P2P FSM Timeout Event\n"));
1716 switch (prP2pFsmInfo->eCurrentState) {
1717 case P2P_STATE_IDLE:
1719 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = &prP2pFsmInfo->rChnlReqInfo;
1720 if (prChnlReqInfo->fgIsChannelRequested) {
1721 p2pFuncReleaseCh(prAdapter, prChnlReqInfo);
1723 else if (IS_NET_PWR_STATE_IDLE(prAdapter, NETWORK_TYPE_P2P_INDEX)) {
1724 UNSET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX);
1725 nicDeactivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX);
1731 // case P2P_STATE_SCAN:
1733 // case P2P_STATE_AP_CHANNEL_DETECT:
1735 // case P2P_STATE_REQING_CHANNEL:
1737 case P2P_STATE_CHNL_ON_HAND:
1739 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
1742 // case P2P_STATE_GC_JOIN:
1751 } /* p2pFsmRunEventFsmTimeout */
1754 p2pFsmRunEventMgmtFrameTx (
1755 IN P_ADAPTER_T prAdapter,
1756 IN P_MSG_HDR_T prMsgHdr
1759 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1760 P_MSG_P2P_MGMT_TX_REQUEST_T prMgmtTxMsg = (P_MSG_P2P_MGMT_TX_REQUEST_T)NULL;
1763 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1765 DBGLOG(P2P, TRACE, ("p2pFsmRunEventMgmtFrameTx\n"));
1767 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1769 if (prP2pFsmInfo == NULL) {
1773 prMgmtTxMsg = (P_MSG_P2P_MGMT_TX_REQUEST_T)prMsgHdr;
1775 p2pFuncTxMgmtFrame(prAdapter,
1776 &prP2pFsmInfo->rMgmtTxInfo,
1777 prMgmtTxMsg->prMgmtMsduInfo,
1778 prMgmtTxMsg->u8Cookie);
1785 cnmMemFree(prAdapter, prMsgHdr);
1790 } /* p2pFsmRunEventMgmtTx */
1794 p2pFsmRunEventStartAP (
1795 IN P_ADAPTER_T prAdapter,
1796 IN P_MSG_HDR_T prMsgHdr
1799 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1800 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
1801 P_MSG_P2P_START_AP_T prP2pStartAPMsg = (P_MSG_P2P_START_AP_T)NULL;
1802 P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo = (P_P2P_SPECIFIC_BSS_INFO_T)NULL;
1805 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1807 DBGLOG(P2P, TRACE, ("p2pFsmRunEventStartAP\n"));
1809 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1811 if (prP2pFsmInfo == NULL) {
1815 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
1816 prP2pStartAPMsg = (P_MSG_P2P_START_AP_T)prMsgHdr;
1817 prP2pSpecificBssInfo = prAdapter->rWifiVar.prP2pSpecificBssInfo;
1820 if (prP2pStartAPMsg->u4BcnInterval) {
1821 DBGLOG(P2P, TRACE, ("Beacon interval updated to :%ld \n", prP2pStartAPMsg->u4BcnInterval));
1822 prP2pBssInfo->u2BeaconInterval = (UINT_16)prP2pStartAPMsg->u4BcnInterval;
1824 else if (prP2pBssInfo->u2BeaconInterval == 0) {
1825 prP2pBssInfo->u2BeaconInterval = DOT11_BEACON_PERIOD_DEFAULT;
1828 if (prP2pStartAPMsg->u4DtimPeriod) {
1829 DBGLOG(P2P, TRACE, ("DTIM interval updated to :%ld \n", prP2pStartAPMsg->u4DtimPeriod));
1830 prP2pBssInfo->ucDTIMPeriod = (UINT_8)prP2pStartAPMsg->u4DtimPeriod;
1832 else if (prP2pBssInfo->ucDTIMPeriod == 0) {
1833 prP2pBssInfo->ucDTIMPeriod = DOT11_DTIM_PERIOD_DEFAULT;
1836 if (prP2pStartAPMsg->u2SsidLen != 0) {
1837 kalMemCopy(prP2pBssInfo->aucSSID, prP2pStartAPMsg->aucSsid, prP2pStartAPMsg->u2SsidLen);
1838 kalMemCopy(prP2pSpecificBssInfo->aucGroupSsid, prP2pStartAPMsg->aucSsid, prP2pStartAPMsg->u2SsidLen);
1839 prP2pBssInfo->ucSSIDLen = prP2pSpecificBssInfo->u2GroupSsidLen = prP2pStartAPMsg->u2SsidLen;
1843 prP2pBssInfo->eHiddenSsidType = prP2pStartAPMsg->ucHiddenSsidType;
1847 /* Privacy & inactive timeout. */
1849 if ((prP2pBssInfo->eCurrentOPMode != OP_MODE_ACCESS_POINT) ||
1850 (prP2pBssInfo->eIntendOPMode != OP_MODE_NUM)) {
1851 UINT_8 ucPreferedChnl = 0;
1852 ENUM_BAND_T eBand = BAND_NULL;
1853 ENUM_CHNL_EXT_T eSco = CHNL_EXT_SCN;
1854 ENUM_P2P_STATE_T eNextState = P2P_STATE_SCAN;
1855 P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = prAdapter->rWifiVar.prP2PConnSettings;
1858 if(prP2pFsmInfo->eCurrentState != P2P_STATE_SCAN &&
1859 prP2pFsmInfo->eCurrentState != P2P_STATE_IDLE) {
1860 // Make sure the state is in IDLE state.
1861 p2pFsmRunEventAbort(prAdapter, prP2pFsmInfo);
1864 // 20120118: Moved to p2pFuncSwitchOPMode().
1865 //SET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX);
1867 /* Leave IDLE state. */
1868 SET_NET_PWR_STATE_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX);
1870 // sync with firmware
1871 //DBGLOG(P2P, INFO, ("Activate P2P Network. \n"));
1872 //nicActivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX);
1875 /* Key to trigger P2P FSM to allocate channel for AP mode. */
1876 prP2pBssInfo->eIntendOPMode = OP_MODE_ACCESS_POINT;
1878 /* Sparse Channel to decide which channel to use. */
1879 if ((cnmPreferredChannel(prAdapter,
1882 &eSco) == FALSE) && (prP2pConnSettings->ucOperatingChnl == 0)) {
1883 // Sparse Channel Detection using passive mode.
1884 eNextState = P2P_STATE_AP_CHANNEL_DETECT;
1887 P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo = prAdapter->rWifiVar.prP2pSpecificBssInfo;
1888 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = &prP2pFsmInfo->rChnlReqInfo;
1892 /* 2012-01-27: frog - Channel set from upper layer is the first priority. */
1893 /* Becuase the channel & beacon is decided by p2p_supplicant. */
1894 if (prP2pConnSettings->ucOperatingChnl != 0) {
1895 prP2pSpecificBssInfo->ucPreferredChannel = prP2pConnSettings->ucOperatingChnl;
1896 prP2pSpecificBssInfo->eRfBand = prP2pConnSettings->eBand;
1900 ASSERT(ucPreferedChnl != 0);
1901 prP2pSpecificBssInfo->ucPreferredChannel = ucPreferedChnl;
1902 prP2pSpecificBssInfo->eRfBand = eBand;
1905 if (ucPreferedChnl) {
1906 prP2pSpecificBssInfo->ucPreferredChannel = ucPreferedChnl;
1907 prP2pSpecificBssInfo->eRfBand = eBand;
1910 ASSERT(prP2pConnSettings->ucOperatingChnl != 0);
1911 prP2pSpecificBssInfo->ucPreferredChannel = prP2pConnSettings->ucOperatingChnl;
1912 prP2pSpecificBssInfo->eRfBand = prP2pConnSettings->eBand;
1916 prChnlReqInfo->ucReqChnlNum = prP2pSpecificBssInfo->ucPreferredChannel;
1917 prChnlReqInfo->eBand = prP2pSpecificBssInfo->eRfBand;
1918 prChnlReqInfo->eChannelReqType = CHANNEL_REQ_TYPE_GO_START_BSS;
1921 /* If channel is specified, use active scan to shorten the scan time. */
1922 p2pFsmStateTransition(prAdapter,
1923 prAdapter->rWifiVar.prP2pFsmInfo,
1934 cnmMemFree(prAdapter, prMsgHdr);
1938 } /* p2pFsmRunEventStartAP */
1941 p2pFsmRunEventNetDeviceRegister (
1942 IN P_ADAPTER_T prAdapter,
1943 IN P_MSG_HDR_T prMsgHdr
1946 P_MSG_P2P_NETDEV_REGISTER_T prNetDevRegisterMsg = (P_MSG_P2P_NETDEV_REGISTER_T)NULL;
1951 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1953 DBGLOG(P2P, TRACE, ("p2pFsmRunEventNetDeviceRegister\n"));
1955 prNetDevRegisterMsg = (P_MSG_P2P_NETDEV_REGISTER_T)prMsgHdr;
1957 if (prNetDevRegisterMsg->fgIsEnable) {
1958 p2pSetMode((prNetDevRegisterMsg->ucMode == 1)?TRUE:FALSE);
1960 if (p2pLaunch(prAdapter->prGlueInfo)) {
1961 ASSERT(prAdapter->fgIsP2PRegistered);
1966 if (prAdapter->fgIsP2PRegistered) {
1967 p2pRemove(prAdapter->prGlueInfo);
1974 cnmMemFree(prAdapter, prMsgHdr);
1978 } /* p2pFsmRunEventNetDeviceRegister */
1982 p2pFsmRunEventUpdateMgmtFrame (
1983 IN P_ADAPTER_T prAdapter,
1984 IN P_MSG_HDR_T prMsgHdr
1987 P_MSG_P2P_MGMT_FRAME_UPDATE_T prP2pMgmtFrameUpdateMsg = (P_MSG_P2P_MGMT_FRAME_UPDATE_T)NULL;
1988 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1991 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1993 DBGLOG(P2P, TRACE, ("p2pFsmRunEventUpdateMgmtFrame\n"));
1995 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1997 if (prP2pFsmInfo == NULL) {
2001 prP2pMgmtFrameUpdateMsg = (P_MSG_P2P_MGMT_FRAME_UPDATE_T)prMsgHdr;
2003 switch (prP2pMgmtFrameUpdateMsg->eBufferType) {
2004 case ENUM_FRAME_TYPE_EXTRA_IE_BEACON:
2006 case ENUM_FRAME_TYPE_EXTRA_IE_ASSOC_RSP:
2008 case ENUM_FRAME_TYPE_EXTRA_IE_PROBE_RSP:
2010 case ENUM_FRAME_TYPE_PROBE_RSP_TEMPLATE:
2012 case ENUM_FRAME_TYPE_BEACON_TEMPLATE:
2021 cnmMemFree(prAdapter, prMsgHdr);
2025 } /* p2pFsmRunEventUpdateMgmtFrame */
2029 p2pFsmRunEventBeaconUpdate (
2030 IN P_ADAPTER_T prAdapter,
2031 IN P_MSG_HDR_T prMsgHdr
2034 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2035 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2036 P_MSG_P2P_BEACON_UPDATE_T prBcnUpdateMsg = (P_MSG_P2P_BEACON_UPDATE_T)NULL;
2039 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
2041 DBGLOG(P2P, TRACE, ("p2pFsmRunEventBeaconUpdate\n"));
2043 printk("p2pFsmRunEventBeaconUpdate\n");
2045 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2047 if (prP2pFsmInfo == NULL) {
2051 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2052 prBcnUpdateMsg = (P_MSG_P2P_BEACON_UPDATE_T)prMsgHdr;
2055 p2pFuncBeaconUpdate(prAdapter,
2057 &prP2pFsmInfo->rBcnContentInfo,
2058 prBcnUpdateMsg->pucBcnHdr,
2059 prBcnUpdateMsg->u4BcnHdrLen,
2060 prBcnUpdateMsg->pucBcnBody,
2061 prBcnUpdateMsg->u4BcnBodyLen);
2063 if ((prP2pBssInfo->eCurrentOPMode == OP_MODE_ACCESS_POINT) &&
2064 (prP2pBssInfo->eIntendOPMode == OP_MODE_NUM)) {
2065 /* AP is created, Beacon Update. */
2066 //nicPmIndicateBssAbort(prAdapter, NETWORK_TYPE_P2P_INDEX);
2068 bssUpdateBeaconContent(prAdapter, NETWORK_TYPE_P2P_INDEX);
2070 //nicPmIndicateBssCreated(prAdapter, NETWORK_TYPE_P2P_INDEX);
2079 cnmMemFree(prAdapter, prMsgHdr);
2082 } /* p2pFsmRunEventBeaconUpdate */
2086 p2pFsmRunEventStopAP (
2087 IN P_ADAPTER_T prAdapter,
2088 IN P_MSG_HDR_T prMsgHdr
2091 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2094 ASSERT_BREAK((prAdapter != NULL));
2096 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2098 DBGLOG(P2P, TRACE, ("p2pFsmRunEventStopAP\n"));
2100 if ((prP2pBssInfo->eCurrentOPMode == OP_MODE_ACCESS_POINT)
2101 && (prP2pBssInfo->eIntendOPMode == OP_MODE_NUM)) {
2102 /* AP is created, Beacon Update. */
2104 p2pFuncDissolve(prAdapter, prP2pBssInfo, TRUE, REASON_CODE_DEAUTH_LEAVING_BSS);
2106 DBGLOG(P2P, TRACE, ("Stop Beaconing\n"));
2107 nicPmIndicateBssAbort(prAdapter, NETWORK_TYPE_P2P_INDEX);
2109 /* Reset RLM related field of BSSINFO. */
2110 rlmBssAborted(prAdapter, prP2pBssInfo);
2115 // 20120118: Moved to p2pFuncSwitchOPMode().
2116 //UNSET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX);
2118 /* Enter IDLE state. */
2119 SET_NET_PWR_STATE_IDLE(prAdapter, NETWORK_TYPE_P2P_INDEX);
2121 DBGLOG(P2P, INFO, ("Re activate P2P Network. \n"));
2122 nicDeactivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX);
2124 nicActivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX);
2127 p2pFsmRunEventWfdSettingUpdate(prAdapter, NULL);
2130 p2pFsmRunEventAbort(prAdapter, prAdapter->rWifiVar.prP2pFsmInfo);
2131 // p2pFsmStateTransition(prAdapter, prAdapter->rWifiVar.prP2pFsmInfo, P2P_STATE_IDLE);
2136 cnmMemFree(prAdapter, prMsgHdr);
2139 } /* p2pFsmRunEventStopAP */
2142 p2pFsmRunEventConnectionRequest (
2143 IN P_ADAPTER_T prAdapter,
2144 IN P_MSG_HDR_T prMsgHdr
2147 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2148 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2149 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = (P_P2P_CHNL_REQ_INFO_T)NULL;
2150 P_MSG_P2P_CONNECTION_REQUEST_T prConnReqMsg = (P_MSG_P2P_CONNECTION_REQUEST_T)NULL;
2151 P_P2P_CONNECTION_REQ_INFO_T prConnReqInfo = (P_P2P_CONNECTION_REQ_INFO_T)NULL;
2154 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
2156 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2157 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2159 if (prP2pFsmInfo == NULL) {
2163 prConnReqMsg = (P_MSG_P2P_CONNECTION_REQUEST_T)prMsgHdr;
2165 prConnReqInfo = &(prP2pFsmInfo->rConnReqInfo);
2166 prChnlReqInfo = &(prP2pFsmInfo->rChnlReqInfo);
2168 DBGLOG(P2P, TRACE, ("p2pFsmRunEventConnectionRequest\n"));
2170 if (prP2pBssInfo->eCurrentOPMode != OP_MODE_INFRASTRUCTURE) {
2174 SET_NET_PWR_STATE_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX);
2177 // Make sure the state is in IDLE state.
2178 p2pFsmRunEventAbort(prAdapter, prP2pFsmInfo);
2180 // Update connection request information.
2181 prConnReqInfo->fgIsConnRequest = TRUE;
2182 COPY_MAC_ADDR(prConnReqInfo->aucBssid, prConnReqMsg->aucBssid);
2183 kalMemCopy(&(prConnReqInfo->rSsidStruct), &(prConnReqMsg->rSsid), sizeof(P2P_SSID_STRUCT_T));
2184 kalMemCopy(prConnReqInfo->aucIEBuf, prConnReqMsg->aucIEBuf, prConnReqMsg->u4IELen);
2185 prConnReqInfo->u4BufLength = prConnReqMsg->u4IELen;
2187 /* Find BSS Descriptor first. */
2188 prP2pFsmInfo->prTargetBss = scanP2pSearchDesc(prAdapter,
2192 if (prP2pFsmInfo->prTargetBss == NULL) {
2193 /* Update scan parameter... to scan target device. */
2194 P_P2P_SCAN_REQ_INFO_T prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo);
2196 prScanReqInfo->ucNumChannelList = 1;
2197 prScanReqInfo->eScanType = SCAN_TYPE_ACTIVE_SCAN;
2198 prScanReqInfo->eChannelSet = SCAN_CHANNEL_SPECIFIED;
2199 prScanReqInfo->arScanChannelList[0].ucChannelNum = prConnReqMsg->rChannelInfo.ucChannelNum;
2200 kalMemCopy(&(prScanReqInfo->rSsidStruct), &(prConnReqMsg->rSsid), sizeof(P2P_SSID_STRUCT_T));
2201 prScanReqInfo->u4BufLength = 0; /* Prevent other P2P ID in IE. */
2202 prScanReqInfo->fgIsAbort = TRUE;
2204 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_SCAN);
2207 prChnlReqInfo->u8Cookie = 0;
2208 prChnlReqInfo->ucReqChnlNum = prConnReqMsg->rChannelInfo.ucChannelNum;
2209 prChnlReqInfo->eBand = prConnReqMsg->rChannelInfo.eBand;
2210 prChnlReqInfo->eChnlSco = prConnReqMsg->eChnlSco;
2211 prChnlReqInfo->u4MaxInterval = AIS_JOIN_CH_REQUEST_INTERVAL;
2212 prChnlReqInfo->eChannelReqType = CHANNEL_REQ_TYPE_GC_JOIN_REQ;
2214 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_REQING_CHANNEL);
2221 cnmMemFree(prAdapter, prMsgHdr);
2226 } /* p2pFsmRunEventConnectionRequest */
2228 /*----------------------------------------------------------------------------*/
2230 * \brief This function is used to handle Connection Request from Supplicant.
2232 * \param[in] prAdapter Pointer of ADAPTER_T
2236 /*----------------------------------------------------------------------------*/
2238 p2pFsmRunEventConnectionAbort (
2239 IN P_ADAPTER_T prAdapter,
2240 IN P_MSG_HDR_T prMsgHdr
2243 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2244 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2245 P_MSG_P2P_CONNECTION_ABORT_T prDisconnMsg = (P_MSG_P2P_CONNECTION_ABORT_T)NULL;
2246 //P_STA_RECORD_T prTargetStaRec = (P_STA_RECORD_T)NULL;
2250 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
2252 DBGLOG(P2P, TRACE, ("p2pFsmRunEventConnectionAbort: Connection Abort.\n"));
2254 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2256 if (prP2pFsmInfo == NULL) {
2260 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2262 prDisconnMsg = (P_MSG_P2P_CONNECTION_ABORT_T)prMsgHdr;
2264 switch (prP2pBssInfo->eCurrentOPMode) {
2265 case OP_MODE_INFRASTRUCTURE:
2267 UINT_8 aucBCBSSID[] = BC_BSSID;
2269 if (!prP2pBssInfo->prStaRecOfAP) {
2270 DBGLOG(P2P, TRACE, ("GO's StaRec is NULL\n"));
2273 if (UNEQUAL_MAC_ADDR(prP2pBssInfo->prStaRecOfAP->aucMacAddr, prDisconnMsg->aucTargetID) &&
2274 UNEQUAL_MAC_ADDR(prDisconnMsg->aucTargetID, aucBCBSSID)) {
2275 DBGLOG(P2P, TRACE, ("Unequal MAC ADDR ["MACSTR":"MACSTR"]\n",
2276 MAC2STR(prP2pBssInfo->prStaRecOfAP->aucMacAddr),
2277 MAC2STR(prDisconnMsg->aucTargetID)));
2282 kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo, NULL, NULL, 0, 0);
2284 /* Stop rejoin timer if it is started. */
2287 p2pFuncDisconnect(prAdapter, prP2pBssInfo->prStaRecOfAP, prDisconnMsg->fgSendDeauth, prDisconnMsg->u2ReasonCode);
2289 //prTargetStaRec = prP2pBssInfo->prStaRecOfAP;
2291 /* Fix possible KE when RX Beacon & call nicPmIndicateBssConnected(). hit prStaRecOfAP == NULL. */
2292 p2pChangeMediaState(prAdapter, PARAM_MEDIA_STATE_DISCONNECTED);
2294 prP2pBssInfo->prStaRecOfAP = NULL;
2296 SET_NET_PWR_STATE_IDLE(prAdapter, NETWORK_TYPE_P2P_INDEX);
2298 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
2302 case OP_MODE_ACCESS_POINT:
2304 P_LINK_T prStaRecOfClientList = &prP2pBssInfo->rStaRecOfClientList;
2305 /* Search specific client device, and disconnect. */
2306 /* 1. Send deauthentication frame. */
2307 /* 2. Indication: Device disconnect. */
2308 P_LINK_ENTRY_T prLinkEntry = (P_LINK_ENTRY_T)NULL;
2309 P_STA_RECORD_T prCurrStaRec = (P_STA_RECORD_T)NULL;
2311 DBGLOG(P2P, TRACE, ("Disconnecting with Target ID: "MACSTR"\n", MAC2STR(prDisconnMsg->aucTargetID)));
2313 LINK_FOR_EACH(prLinkEntry, prStaRecOfClientList) {
2314 prCurrStaRec = LINK_ENTRY(prLinkEntry, STA_RECORD_T, rLinkEntry);
2316 ASSERT(prCurrStaRec);
2318 if (EQUAL_MAC_ADDR(prCurrStaRec->aucMacAddr, prDisconnMsg->aucTargetID)) {
2320 DBGLOG(P2P, TRACE, ("Disconnecting: "MACSTR"\n", MAC2STR(prCurrStaRec->aucMacAddr)));
2322 /* Remove STA from client list. */
2323 LINK_REMOVE_KNOWN_ENTRY(prStaRecOfClientList, &prCurrStaRec->rLinkEntry);
2325 /* Glue layer indication. */
2326 //kalP2PGOStationUpdate(prAdapter->prGlueInfo, prCurrStaRec, FALSE);
2328 /* Send deauth & do indication. */
2329 p2pFuncDisconnect(prAdapter, prCurrStaRec, prDisconnMsg->fgSendDeauth, prDisconnMsg->u2ReasonCode);
2331 //prTargetStaRec = prCurrStaRec;
2339 case OP_MODE_P2P_DEVICE:
2347 //20120830 moved into p2pFuncDisconnect()
2348 //if ((!prDisconnMsg->fgSendDeauth) && (prTargetStaRec)) {
2349 // cnmStaRecFree(prAdapter, prTargetStaRec, TRUE);
2354 cnmMemFree(prAdapter, prMsgHdr);
2358 } /* p2pFsmRunEventConnectionAbort */
2362 p2pFsmRunEventDissolve (
2363 IN P_ADAPTER_T prAdapter,
2364 IN P_MSG_HDR_T prMsgHdr
2370 DBGLOG(P2P, TRACE, ("p2pFsmRunEventDissolve\n"));
2373 cnmMemFree(prAdapter, prMsgHdr);
2379 p2pFsmRunEventDeauthTxDone (
2380 IN P_ADAPTER_T prAdapter,
2381 IN P_MSDU_INFO_T prMsduInfo,
2382 IN ENUM_TX_RESULT_CODE_T rTxDoneStatus
2386 P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL;
2387 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2388 ENUM_PARAM_MEDIA_STATE_T eOriMediaStatus;
2392 ASSERT_BREAK((prAdapter != NULL) &&
2393 (prMsduInfo != NULL));
2395 DBGLOG(P2P, TRACE, ("Deauth TX Done\n"));
2397 prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex);
2399 if (prStaRec == NULL) {
2400 DBGLOG(P2P, TRACE, ("Station Record NULL, Index:%d\n", prMsduInfo->ucStaRecIndex));
2404 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2405 eOriMediaStatus = prP2pBssInfo->eConnectionState;
2408 bssRemoveStaRecFromClientList(prAdapter, prP2pBssInfo, prStaRec);
2411 cnmStaRecFree(prAdapter, prStaRec, TRUE);
2413 if ((prP2pBssInfo->eCurrentOPMode != OP_MODE_ACCESS_POINT) ||
2414 (prP2pBssInfo->rStaRecOfClientList.u4NumElem == 0)) {
2415 DBGLOG(P2P, TRACE, ("No More Client, Media Status DISCONNECTED\n"));
2416 p2pChangeMediaState(prAdapter, PARAM_MEDIA_STATE_DISCONNECTED);
2419 /* Because the eConnectionState is changed before Deauth TxDone. Dont Check eConnectionState */
2420 //if (eOriMediaStatus != prP2pBssInfo->eConnectionState) {
2421 /* Update Disconnected state to FW. */
2422 nicUpdateBss(prAdapter, NETWORK_TYPE_P2P_INDEX);
2428 return WLAN_STATUS_SUCCESS;
2429 } /* p2pFsmRunEventDeauthTxDone */
2433 p2pFsmRunEventMgmtFrameTxDone (
2434 IN P_ADAPTER_T prAdapter,
2435 IN P_MSDU_INFO_T prMsduInfo,
2436 IN ENUM_TX_RESULT_CODE_T rTxDoneStatus
2439 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2440 P_P2P_MGMT_TX_REQ_INFO_T prMgmtTxReqInfo = (P_P2P_MGMT_TX_REQ_INFO_T)NULL;
2441 BOOLEAN fgIsSuccess = FALSE;
2444 ASSERT_BREAK((prAdapter != NULL) && (prMsduInfo != NULL));
2446 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2447 prMgmtTxReqInfo = &(prP2pFsmInfo->rMgmtTxInfo);
2449 if (rTxDoneStatus != TX_RESULT_SUCCESS) {
2450 DBGLOG(P2P, TRACE, ("Mgmt Frame TX Fail, Status:%d.\n", rTxDoneStatus));
2454 DBGLOG(P2P, TRACE, ("Mgmt Frame TX Done.\n"));
2458 if (prMgmtTxReqInfo->prMgmtTxMsdu == prMsduInfo) {
2459 kalP2PIndicateMgmtTxStatus(prAdapter->prGlueInfo,
2460 prMgmtTxReqInfo->u8Cookie,
2462 prMsduInfo->prPacket,
2463 (UINT_32)prMsduInfo->u2FrameLength);
2465 prMgmtTxReqInfo->prMgmtTxMsdu = NULL;
2470 return WLAN_STATUS_SUCCESS;
2472 } /* p2pFsmRunEventMgmtFrameTxDone */
2475 /*----------------------------------------------------------------------------*/
2477 * \brief This function is called when JOIN complete message event is received from SAA.
2479 * \param[in] prAdapter Pointer of ADAPTER_T
2483 /*----------------------------------------------------------------------------*/
2485 p2pFsmRunEventJoinComplete (
2486 IN P_ADAPTER_T prAdapter,
2487 IN P_MSG_HDR_T prMsgHdr
2490 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2491 P_P2P_JOIN_INFO_T prJoinInfo = (P_P2P_JOIN_INFO_T)NULL;
2492 P_MSG_JOIN_COMP_T prJoinCompMsg = (P_MSG_JOIN_COMP_T)NULL;
2493 P_SW_RFB_T prAssocRspSwRfb = (P_SW_RFB_T)NULL;
2494 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2497 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
2499 DBGLOG(P2P, TRACE, ("P2P Join Complete\n"));
2501 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2503 if (prP2pFsmInfo == NULL) {
2508 prJoinInfo = &(prP2pFsmInfo->rJoinInfo);
2509 prJoinCompMsg = (P_MSG_JOIN_COMP_T)prMsgHdr;
2510 prAssocRspSwRfb = prJoinCompMsg->prSwRfb;
2511 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2513 if (prP2pBssInfo->eCurrentOPMode == OP_MODE_INFRASTRUCTURE) {
2514 P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL;
2516 prStaRec = prJoinCompMsg->prStaRec;
2519 if (prJoinCompMsg->ucSeqNum == prJoinInfo->ucSeqNumOfReqMsg) {
2520 ASSERT(prStaRec == prJoinInfo->prTargetStaRec);
2521 prJoinInfo->fgIsJoinComplete = TRUE;
2523 if (prJoinCompMsg->rJoinStatus == WLAN_STATUS_SUCCESS) {
2525 //4 <1.1> Change FW's Media State immediately.
2526 p2pChangeMediaState(prAdapter, PARAM_MEDIA_STATE_CONNECTED);
2528 //4 <1.2> Deactivate previous AP's STA_RECORD_T in Driver if have.
2529 if ((prP2pBssInfo->prStaRecOfAP) &&
2530 (prP2pBssInfo->prStaRecOfAP != prStaRec)) {
2531 cnmStaRecChangeState(prAdapter, prP2pBssInfo->prStaRecOfAP, STA_STATE_1);
2533 cnmStaRecFree(prAdapter, prP2pBssInfo->prStaRecOfAP, TRUE);
2535 prP2pBssInfo->prStaRecOfAP = NULL;
2538 //4 <1.3> Update BSS_INFO_T
2539 p2pFuncUpdateBssInfoForJOIN(prAdapter, prP2pFsmInfo->prTargetBss, prStaRec, prAssocRspSwRfb);
2541 //4 <1.4> Activate current AP's STA_RECORD_T in Driver.
2542 cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_3);
2544 #if CFG_SUPPORT_P2P_RSSI_QUERY
2545 //<1.5> Update RSSI if necessary
2546 nicUpdateRSSI(prAdapter, NETWORK_TYPE_P2P_INDEX, (INT_8)(RCPI_TO_dBm(prStaRec->ucRCPI)), 0);
2549 //4 <1.6> Indicate Connected Event to Host immediately.
2550 /* Require BSSID, Association ID, Beacon Interval.. from AIS_BSS_INFO_T */
2551 //p2pIndicationOfMediaStateToHost(prAdapter, PARAM_MEDIA_STATE_CONNECTED, prStaRec->aucMacAddr);
2552 kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo,
2553 &prP2pFsmInfo->rConnReqInfo,
2554 prJoinInfo->aucIEBuf,
2555 prJoinInfo->u4BufLength,
2556 prStaRec->u2StatusCode);
2561 //4 <2.1> Redo JOIN process with other Auth Type if possible
2562 if (p2pFuncRetryJOIN(prAdapter, prStaRec, prJoinInfo) == FALSE) {
2563 P_BSS_DESC_T prBssDesc;
2565 /* Increase Failure Count */
2566 prStaRec->ucJoinFailureCount++;
2568 prBssDesc = prP2pFsmInfo->prTargetBss;
2571 ASSERT(prBssDesc->fgIsConnecting);
2573 prBssDesc->fgIsConnecting = FALSE;
2575 if( prStaRec->ucJoinFailureCount >=3) {
2577 kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo,
2578 &prP2pFsmInfo->rConnReqInfo,
2579 prJoinInfo->aucIEBuf,
2580 prJoinInfo->u4BufLength,
2581 prStaRec->u2StatusCode);
2584 /* Sometime the GO is not ready to response auth. Connect it again*/
2585 prP2pFsmInfo->prTargetBss = NULL;
2595 if (prAssocRspSwRfb) {
2596 nicRxReturnRFB(prAdapter, prAssocRspSwRfb);
2599 if (prP2pFsmInfo->eCurrentState == P2P_STATE_GC_JOIN) {
2601 if(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX].eConnectionState == PARAM_MEDIA_STATE_CONNECTED) {
2602 /* Return to IDLE state. */
2603 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
2606 //p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
2608 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_SCAN);
2615 cnmMemFree(prAdapter, prMsgHdr);
2620 } /* p2pFsmRunEventJoinComplete */
2625 p2pFsmRunEventMgmtFrameRegister (
2626 IN P_ADAPTER_T prAdapter,
2627 IN P_MSG_HDR_T prMsgHdr
2630 P_MSG_P2P_MGMT_FRAME_REGISTER_T prMgmtFrameRegister = (P_MSG_P2P_MGMT_FRAME_REGISTER_T)NULL;
2631 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2634 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
2636 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2638 if (prP2pFsmInfo == NULL) {
2642 prMgmtFrameRegister = (P_MSG_P2P_MGMT_FRAME_REGISTER_T)prMsgHdr;
2644 p2pFuncMgmtFrameRegister(prAdapter,
2645 prMgmtFrameRegister->u2FrameType,
2646 prMgmtFrameRegister->fgIsRegister,
2647 &prP2pFsmInfo->u4P2pPacketFilter);
2653 cnmMemFree(prAdapter, prMsgHdr);
2658 } /* p2pFsmRunEventMgmtFrameRegister */
2664 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2665 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2666 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2667 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2668 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2669 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2670 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2671 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2672 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2673 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2674 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2675 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2676 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2677 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2686 /*----------------------------------------------------------------------------*/
2688 * \brief This function is call when RX deauthentication frame from the AIR.
2689 * If we are under STA mode, we would go back to P2P Device.
2690 * If we are under AP mode, we would stay in AP mode until disconnect event from HOST.
2692 * \param[in] prAdapter Pointer of ADAPTER_T
2696 /*----------------------------------------------------------------------------*/
2698 p2pFsmRunEventRxDeauthentication (
2699 IN P_ADAPTER_T prAdapter,
2700 IN P_STA_RECORD_T prStaRec,
2701 IN P_SW_RFB_T prSwRfb
2704 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2705 UINT_16 u2ReasonCode = 0;
2708 ASSERT_BREAK((prAdapter != NULL) && (prSwRfb != NULL));
2710 if (prStaRec == NULL) {
2711 prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx);
2719 prP2pBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX];
2721 if (prStaRec->ucStaState == STA_STATE_1) {
2725 DBGLOG(P2P, TRACE, ("RX Deauth\n"));
2727 switch (prP2pBssInfo->eCurrentOPMode) {
2728 case OP_MODE_INFRASTRUCTURE:
2729 if (authProcessRxDeauthFrame(prSwRfb,
2730 prStaRec->aucMacAddr,
2731 &u2ReasonCode) == WLAN_STATUS_SUCCESS) {
2732 P_WLAN_DEAUTH_FRAME_T prDeauthFrame = (P_WLAN_DEAUTH_FRAME_T)prSwRfb->pvHeader;
2733 UINT_16 u2IELength = 0;
2735 if (prP2pBssInfo->prStaRecOfAP != prStaRec) {
2740 prStaRec->u2ReasonCode = u2ReasonCode;
2741 u2IELength = prSwRfb->u2PacketLen - (WLAN_MAC_HEADER_LEN + REASON_CODE_FIELD_LEN);
2743 ASSERT(prP2pBssInfo->prStaRecOfAP == prStaRec);
2745 /* Indicate disconnect to Host. */
2746 kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo,
2748 prDeauthFrame->aucInfoElem,
2752 prP2pBssInfo->prStaRecOfAP = NULL;
2754 p2pFuncDisconnect(prAdapter, prStaRec, FALSE, u2ReasonCode);
2757 case OP_MODE_ACCESS_POINT:
2758 /* Delete client from client list. */
2759 if (authProcessRxDeauthFrame(prSwRfb,
2760 prP2pBssInfo->aucBSSID,
2761 &u2ReasonCode) == WLAN_STATUS_SUCCESS) {
2762 P_LINK_T prStaRecOfClientList = (P_LINK_T)NULL;
2763 P_LINK_ENTRY_T prLinkEntry = (P_LINK_ENTRY_T)NULL;
2764 P_STA_RECORD_T prCurrStaRec = (P_STA_RECORD_T)NULL;
2766 prStaRecOfClientList = &prP2pBssInfo->rStaRecOfClientList;
2768 LINK_FOR_EACH(prLinkEntry, prStaRecOfClientList) {
2769 prCurrStaRec = LINK_ENTRY(prLinkEntry, STA_RECORD_T, rLinkEntry);
2771 ASSERT(prCurrStaRec);
2773 if (EQUAL_MAC_ADDR(prCurrStaRec->aucMacAddr, prStaRec->aucMacAddr)) {
2775 /* Remove STA from client list. */
2776 LINK_REMOVE_KNOWN_ENTRY(prStaRecOfClientList, &prCurrStaRec->rLinkEntry);
2778 /* Indicate to Host. */
2779 //kalP2PGOStationUpdate(prAdapter->prGlueInfo, prStaRec, FALSE);
2781 /* Indicate disconnect to Host. */
2782 p2pFuncDisconnect(prAdapter, prStaRec, FALSE, u2ReasonCode);
2789 case OP_MODE_P2P_DEVICE:
2791 /* Findout why someone sent deauthentication frame to us. */
2796 DBGLOG(P2P, TRACE, ("Deauth Reason:%d\n", u2ReasonCode));
2801 } /* p2pFsmRunEventRxDeauthentication */
2803 /*----------------------------------------------------------------------------*/
2805 * \brief This function is call when RX deauthentication frame from the AIR.
2806 * If we are under STA mode, we would go back to P2P Device.
2807 * If we are under AP mode, we would stay in AP mode until disconnect event from HOST.
2809 * \param[in] prAdapter Pointer of ADAPTER_T
2813 /*----------------------------------------------------------------------------*/
2815 p2pFsmRunEventRxDisassociation (
2816 IN P_ADAPTER_T prAdapter,
2817 IN P_STA_RECORD_T prStaRec,
2818 IN P_SW_RFB_T prSwRfb
2821 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2822 UINT_16 u2ReasonCode = 0;
2825 ASSERT_BREAK((prAdapter != NULL) && (prSwRfb != NULL));
2827 if (prStaRec == NULL) {
2828 prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx);
2832 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2834 if (prStaRec->ucStaState == STA_STATE_1) {
2839 DBGLOG(P2P, TRACE, ("RX Disassoc\n"));
2841 switch (prP2pBssInfo->eCurrentOPMode) {
2842 case OP_MODE_INFRASTRUCTURE:
2843 if (assocProcessRxDisassocFrame(prAdapter,
2845 prStaRec->aucMacAddr,
2846 &prStaRec->u2ReasonCode) == WLAN_STATUS_SUCCESS) {
2847 P_WLAN_DISASSOC_FRAME_T prDisassocFrame = (P_WLAN_DISASSOC_FRAME_T)prSwRfb->pvHeader;
2848 UINT_16 u2IELength = 0;
2850 ASSERT(prP2pBssInfo->prStaRecOfAP == prStaRec);
2852 if (prP2pBssInfo->prStaRecOfAP != prStaRec) {
2857 u2IELength = prSwRfb->u2PacketLen - (WLAN_MAC_HEADER_LEN + REASON_CODE_FIELD_LEN);
2859 /* Indicate disconnect to Host. */
2860 kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo,
2862 prDisassocFrame->aucInfoElem,
2864 prStaRec->u2ReasonCode);
2866 prP2pBssInfo->prStaRecOfAP = NULL;
2868 p2pFuncDisconnect(prAdapter, prStaRec, FALSE, prStaRec->u2ReasonCode);
2872 case OP_MODE_ACCESS_POINT:
2873 /* Delete client from client list. */
2874 if (assocProcessRxDisassocFrame(prAdapter,
2876 prP2pBssInfo->aucBSSID,
2877 &u2ReasonCode) == WLAN_STATUS_SUCCESS) {
2878 P_LINK_T prStaRecOfClientList = (P_LINK_T)NULL;
2879 P_LINK_ENTRY_T prLinkEntry = (P_LINK_ENTRY_T)NULL;
2880 P_STA_RECORD_T prCurrStaRec = (P_STA_RECORD_T)NULL;
2882 prStaRecOfClientList = &prP2pBssInfo->rStaRecOfClientList;
2884 LINK_FOR_EACH(prLinkEntry, prStaRecOfClientList) {
2885 prCurrStaRec = LINK_ENTRY(prLinkEntry, STA_RECORD_T, rLinkEntry);
2887 ASSERT(prCurrStaRec);
2889 if (EQUAL_MAC_ADDR(prCurrStaRec->aucMacAddr, prStaRec->aucMacAddr)) {
2891 /* Remove STA from client list. */
2892 LINK_REMOVE_KNOWN_ENTRY(prStaRecOfClientList, &prCurrStaRec->rLinkEntry);
2894 /* Indicate to Host. */
2895 //kalP2PGOStationUpdate(prAdapter->prGlueInfo, prStaRec, FALSE);
2897 /* Indicate disconnect to Host. */
2898 p2pFuncDisconnect(prAdapter, prStaRec, FALSE, u2ReasonCode);
2905 case OP_MODE_P2P_DEVICE:
2915 } /* p2pFsmRunEventRxDisassociation */
2921 /*----------------------------------------------------------------------------*/
2923 * \brief This function is called when a probe request frame is received.
2925 * \param[in] prAdapter Pointer of ADAPTER_T
2927 * \return boolean value if probe response frame is accepted & need cancel scan request.
2929 /*----------------------------------------------------------------------------*/
2931 p2pFsmRunEventRxProbeResponseFrame (
2932 IN P_ADAPTER_T prAdapter,
2933 IN P_SW_RFB_T prSwRfb,
2934 IN P_BSS_DESC_T prBssDesc
2937 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2938 P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = (P_P2P_CONNECTION_SETTINGS_T)NULL;
2939 P_WLAN_MAC_MGMT_HEADER_T prMgtHdr = (P_WLAN_MAC_MGMT_HEADER_T)NULL;
2940 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2943 ASSERT_BREAK((prAdapter != NULL) && (prSwRfb != NULL) && (prBssDesc != NULL));
2945 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2946 prP2pConnSettings = prAdapter->rWifiVar.prP2PConnSettings;
2947 prP2pBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX];
2949 /* There is a connection request. */
2950 prMgtHdr = (P_WLAN_MAC_MGMT_HEADER_T)prSwRfb->pvHeader;
2955 } /* p2pFsmRunEventRxProbeResponseFrame */
2963 p2pFsmRunEventBeaconTimeout (
2964 IN P_ADAPTER_T prAdapter
2967 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2968 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2971 ASSERT_BREAK(prAdapter != NULL);
2973 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2974 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2976 DBGLOG(P2P, TRACE, ("p2pFsmRunEventBeaconTimeout: Beacon Timeout\n"));
2978 /* Only client mode would have beacon lost event. */
2979 ASSERT(prP2pBssInfo->eCurrentOPMode == OP_MODE_INFRASTRUCTURE);
2981 if (prP2pBssInfo->eConnectionState == PARAM_MEDIA_STATE_CONNECTED) {
2982 /* Indicate disconnect to Host. */
2983 kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo,
2987 REASON_CODE_DISASSOC_INACTIVITY);
2989 if (prP2pBssInfo->prStaRecOfAP != NULL) {
2990 P_STA_RECORD_T prStaRec = prP2pBssInfo->prStaRecOfAP;
2992 prP2pBssInfo->prStaRecOfAP = NULL;
2994 p2pFuncDisconnect(prAdapter, prStaRec, FALSE, REASON_CODE_DISASSOC_LEAVING_BSS);
2996 //20120830 moved into p2pFuncDisconnect()
2997 //cnmStaRecFree(prAdapter, prP2pBssInfo->prStaRecOfAP, TRUE);
3005 } /* p2pFsmRunEventBeaconTimeout */
3012 p2pFsmRunEventWfdSettingUpdate (
3013 IN P_ADAPTER_T prAdapter,
3014 IN P_MSG_HDR_T prMsgHdr
3017 P_WFD_CFG_SETTINGS_T prWfdCfgSettings = (P_WFD_CFG_SETTINGS_T)NULL;
3018 P_MSG_WFD_CONFIG_SETTINGS_CHANGED_T prMsgWfdCfgSettings = (P_MSG_WFD_CONFIG_SETTINGS_CHANGED_T)NULL;
3019 WLAN_STATUS rStatus;
3022 DBGLOG(P2P, INFO,("p2pFsmRunEventWfdSettingUpdate\n"));
3025 ASSERT_BREAK((prAdapter != NULL));
3027 if (prMsgHdr != NULL) {
3028 prMsgWfdCfgSettings = (P_MSG_WFD_CONFIG_SETTINGS_CHANGED_T)prMsgHdr;
3029 prWfdCfgSettings = prMsgWfdCfgSettings->prWfdCfgSettings;
3032 prWfdCfgSettings = &prAdapter->rWifiVar.prP2pFsmInfo->rWfdConfigureSettings;
3035 DBGLOG(P2P, INFO,("WFD Enalbe %x info %x state %x flag %x adv %x\n",
3036 prWfdCfgSettings->ucWfdEnable,
3037 prWfdCfgSettings->u2WfdDevInfo,
3038 prWfdCfgSettings->u4WfdState,
3039 prWfdCfgSettings->u4WfdFlag,
3040 prWfdCfgSettings->u4WfdAdvancedFlag));
3042 rStatus = wlanSendSetQueryCmd (
3043 prAdapter, /* prAdapter */
3044 CMD_ID_SET_WFD_CTRL, /* ucCID */
3045 TRUE, /* fgSetQuery */
3046 FALSE, /* fgNeedResp */
3047 FALSE, /* fgIsOid */
3049 NULL, /* pfCmdTimeoutHandler */
3050 sizeof(WFD_CFG_SETTINGS_T), /* u4SetQueryInfoLen */
3051 (PUINT_8)prWfdCfgSettings, /* pucInfoBuffer */
3052 NULL, /* pvSetQueryBuffer */
3053 0 /* u4SetQueryBufferLen */
3061 /* p2pFsmRunEventWfdSettingUpdate */
3072 /*----------------------------------------------------------------------------*/
3074 * @brief This function is used to generate P2P IE for Beacon frame.
3076 * @param[in] prMsduInfo Pointer to the composed MSDU_INFO_T.
3080 /*----------------------------------------------------------------------------*/
3082 p2pGenerateP2P_IEForAssocReq (
3083 IN P_ADAPTER_T prAdapter,
3084 IN P_MSDU_INFO_T prMsduInfo
3087 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
3088 P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL;
3091 ASSERT_BREAK((prAdapter != NULL) && (prMsduInfo != NULL));
3093 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
3095 prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex);
3097 if (IS_STA_P2P_TYPE(prStaRec)) {
3105 } /* end of p2pGenerateP2P_IEForAssocReq() */
3110 /*----------------------------------------------------------------------------*/
3112 * @brief This function is used to generate P2P IE for Probe Request frame.
3114 * @param[in] prMsduInfo Pointer to the composed MSDU_INFO_T.
3118 /*----------------------------------------------------------------------------*/
3120 p2pGenerateP2P_IEForProbeReq (
3121 IN P_ADAPTER_T prAdapter,
3122 IN PUINT_16 pu2Offset,
3124 IN UINT_16 u2BufSize
3134 } /* end of p2pGenerateP2P_IEForProbReq() */
3139 /*----------------------------------------------------------------------------*/
3141 * @brief This function is used to calculate P2P IE length for Beacon frame.
3143 * @param[in] eNetTypeIndex Specify which network
3144 * @param[in] prStaRec Pointer to the STA_RECORD_T
3146 * @return The length of P2P IE added
3148 /*----------------------------------------------------------------------------*/
3150 p2pCalculateP2P_IELenForProbeReq (
3151 IN P_ADAPTER_T prAdapter,
3152 IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex,
3153 IN P_STA_RECORD_T prStaRec
3157 if (eNetTypeIndex != NETWORK_TYPE_P2P_INDEX) {
3165 } /* end of p2pCalculateP2P_IELenForProbeReq() */
3171 /*----------------------------------------------------------------------------*/
3173 * @brief This function will indiate the Event of Tx Fail of AAA Module.
3175 * @param[in] prAdapter Pointer to the Adapter structure.
3176 * @param[in] prStaRec Pointer to the STA_RECORD_T
3180 /*----------------------------------------------------------------------------*/
3182 p2pRunEventAAATxFail (
3183 IN P_ADAPTER_T prAdapter,
3184 IN P_STA_RECORD_T prStaRec
3187 P_BSS_INFO_T prBssInfo;
3193 prBssInfo = &(prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex]);
3195 bssRemoveStaRecFromClientList(prAdapter, prBssInfo, prStaRec);
3197 p2pFuncDisconnect(prAdapter, prStaRec, FALSE, REASON_CODE_UNSPECIFIED);
3200 //20120830 moved into p2puUncDisconnect.
3201 //cnmStaRecFree(prAdapter, prStaRec, TRUE);
3204 } /* p2pRunEventAAATxFail */
3207 /*----------------------------------------------------------------------------*/
3209 * @brief This function will indiate the Event of Successful Completion of AAA Module.
3211 * @param[in] prAdapter Pointer to the Adapter structure.
3212 * @param[in] prStaRec Pointer to the STA_RECORD_T
3216 /*----------------------------------------------------------------------------*/
3218 p2pRunEventAAAComplete (
3219 IN P_ADAPTER_T prAdapter,
3220 IN P_STA_RECORD_T prStaRec
3223 WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS;
3224 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
3225 ENUM_PARAM_MEDIA_STATE_T eOriMediaState;
3228 ASSERT_BREAK((prAdapter != NULL) && (prStaRec != NULL));
3230 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
3232 eOriMediaState = prP2pBssInfo->eConnectionState;
3234 if(prStaRec != NULL){
3236 bssRemoveStaRecFromClientList(prAdapter, prP2pBssInfo, prStaRec);
3245 if (prP2pBssInfo->rStaRecOfClientList.u4NumElem > P2P_MAXIMUM_CLIENT_COUNT ||
3246 kalP2PMaxClients(prAdapter->prGlueInfo, prP2pBssInfo->rStaRecOfClientList.u4NumElem)) {
3247 rStatus = WLAN_STATUS_RESOURCES;
3251 bssAddStaRecToClientList(prAdapter, prP2pBssInfo, prStaRec);
3253 prStaRec->u2AssocId = bssAssignAssocID(prStaRec);
3255 if (prP2pBssInfo->rStaRecOfClientList.u4NumElem > P2P_MAXIMUM_CLIENT_COUNT ||
3256 kalP2PMaxClients(prAdapter->prGlueInfo, prP2pBssInfo->rStaRecOfClientList.u4NumElem)) {
3257 rStatus = WLAN_STATUS_RESOURCES;
3261 cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_3);
3263 p2pChangeMediaState(prAdapter, PARAM_MEDIA_STATE_CONNECTED);
3265 /* Update Connected state to FW. */
3266 if (eOriMediaState != prP2pBssInfo->eConnectionState) {
3267 nicUpdateBss(prAdapter, NETWORK_TYPE_P2P_INDEX);
3273 } /* p2pRunEventAAAComplete */
3276 /*----------------------------------------------------------------------------*/
3278 * @brief This function will indiate the Event of Successful Completion of AAA Module.
3280 * @param[in] prAdapter Pointer to the Adapter structure.
3281 * @param[in] prStaRec Pointer to the STA_RECORD_T
3285 /*----------------------------------------------------------------------------*/
3287 p2pRunEventAAASuccess (
3288 IN P_ADAPTER_T prAdapter,
3289 IN P_STA_RECORD_T prStaRec
3292 WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS;
3295 ASSERT_BREAK((prAdapter != NULL) && (prStaRec != NULL));
3297 /* Glue layer indication. */
3298 kalP2PGOStationUpdate(prAdapter->prGlueInfo, prStaRec, TRUE);
3303 } /* p2pRunEventAAASuccess */
3307 /*----------------------------------------------------------------------------*/
3315 /*----------------------------------------------------------------------------*/
3317 p2pRxPublicActionFrame (
3318 IN P_ADAPTER_T prAdapter,
3319 IN P_SW_RFB_T prSwRfb
3322 WLAN_STATUS rWlanStatus = WLAN_STATUS_SUCCESS;
3323 P_P2P_PUBLIC_ACTION_FRAME_T prPublicActionFrame = (P_P2P_PUBLIC_ACTION_FRAME_T)NULL;
3324 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
3331 prPublicActionFrame = (P_P2P_PUBLIC_ACTION_FRAME_T)prSwRfb->pvHeader;
3332 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
3334 DBGLOG(P2P, TRACE, ("RX Public Action Frame Token:%d.\n", prPublicActionFrame->ucDialogToken));
3336 if (prPublicActionFrame->ucCategory != CATEGORY_PUBLIC_ACTION) {
3340 switch (prPublicActionFrame->ucAction) {
3341 case ACTION_PUBLIC_WIFI_DIRECT:
3343 case ACTION_GAS_INITIAL_REQUEST:
3344 case ACTION_GAS_INITIAL_RESPONSE:
3345 case ACTION_GAS_COMEBACK_REQUEST:
3346 case ACTION_GAS_COMEBACK_RESPONSE:
3353 } /* p2pRxPublicActionFrame */
3359 IN P_ADAPTER_T prAdapter,
3360 IN P_SW_RFB_T prSwRfb
3363 WLAN_STATUS rWlanStatus = WLAN_STATUS_SUCCESS;
3364 P_P2P_ACTION_FRAME_T prP2pActionFrame = (P_P2P_ACTION_FRAME_T)NULL;
3365 UINT_8 aucOui[3] = VENDOR_OUI_WFA_SPECIFIC;
3368 ASSERT_BREAK((prAdapter != NULL) && (prSwRfb != NULL));
3370 prP2pActionFrame = (P_P2P_ACTION_FRAME_T)prSwRfb->pvHeader;
3372 if (prP2pActionFrame->ucCategory != CATEGORY_VENDOR_SPECIFIC_ACTION) {
3373 DBGLOG(P2P, TRACE, ("RX Action Frame but not vendor specific.\n"));
3378 if ((prP2pActionFrame->ucOuiType != VENDOR_OUI_TYPE_P2P) ||
3379 (prP2pActionFrame->aucOui[0] != aucOui[0]) ||
3380 (prP2pActionFrame->aucOui[1] != aucOui[1]) ||
3381 (prP2pActionFrame->aucOui[2] != aucOui[2])) {
3382 DBGLOG(P2P, TRACE, ("RX Vendor Specific Action Frame but not P2P Type or not WFA OUI.\n"));
3389 } /* p2pRxActionFrame */
3393 p2pProcessEvent_UpdateNOAParam (
3394 IN P_ADAPTER_T prAdapter,
3395 UINT_8 ucNetTypeIndex,
3396 P_EVENT_UPDATE_NOA_PARAMS_T prEventUpdateNoaParam
3399 P_BSS_INFO_T prBssInfo = (P_BSS_INFO_T)NULL;
3400 P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo;
3402 BOOLEAN fgNoaAttrExisted = FALSE;
3404 prBssInfo = &(prAdapter->rWifiVar.arBssInfo[ucNetTypeIndex]);
3405 prP2pSpecificBssInfo = prAdapter->rWifiVar.prP2pSpecificBssInfo;
3407 prP2pSpecificBssInfo->fgEnableOppPS = prEventUpdateNoaParam->fgEnableOppPS;
3408 prP2pSpecificBssInfo->u2CTWindow = prEventUpdateNoaParam->u2CTWindow;
3409 prP2pSpecificBssInfo->ucNoAIndex = prEventUpdateNoaParam->ucNoAIndex;
3410 prP2pSpecificBssInfo->ucNoATimingCount = prEventUpdateNoaParam->ucNoATimingCount;
3412 fgNoaAttrExisted |= prP2pSpecificBssInfo->fgEnableOppPS;
3415 ASSERT(prP2pSpecificBssInfo->ucNoATimingCount <= P2P_MAXIMUM_NOA_COUNT);
3417 for (i = 0; i < prP2pSpecificBssInfo->ucNoATimingCount; i++) {
3419 prP2pSpecificBssInfo->arNoATiming[i].fgIsInUse =
3420 prEventUpdateNoaParam->arEventNoaTiming[i].fgIsInUse;
3422 prP2pSpecificBssInfo->arNoATiming[i].ucCount =
3423 prEventUpdateNoaParam->arEventNoaTiming[i].ucCount;
3425 prP2pSpecificBssInfo->arNoATiming[i].u4Duration =
3426 prEventUpdateNoaParam->arEventNoaTiming[i].u4Duration;
3428 prP2pSpecificBssInfo->arNoATiming[i].u4Interval =
3429 prEventUpdateNoaParam->arEventNoaTiming[i].u4Interval;
3431 prP2pSpecificBssInfo->arNoATiming[i].u4StartTime =
3432 prEventUpdateNoaParam->arEventNoaTiming[i].u4StartTime;
3434 fgNoaAttrExisted |= prP2pSpecificBssInfo->arNoATiming[i].fgIsInUse;
3437 prP2pSpecificBssInfo->fgIsNoaAttrExisted = fgNoaAttrExisted;
3439 // update beacon content by the change
3440 bssUpdateBeaconContent(prAdapter, ucNetTypeIndex);
3443 #endif /* CFG_ENABLE_WIFI_DIRECT */