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;
912 cnmTimerInitTimer(prAdapter,
913 &(prP2pFsmInfo->rP2pFsmTimeoutTimer),
914 (PFN_MGMT_TIMEOUT_FUNC)p2pFsmRunEventFsmTimeout,
915 (UINT_32)prP2pFsmInfo);
917 //4 <2> Initiate BSS_INFO_T - common part
918 BSS_INFO_INIT(prAdapter, NETWORK_TYPE_P2P_INDEX);
921 //4 <2.1> Initiate BSS_INFO_T - Setup HW ID
922 prP2pBssInfo->ucConfigAdHocAPMode = AP_MODE_11G_P2P;
923 prP2pBssInfo->ucHwDefaultFixedRateCode = RATE_OFDM_6M;
926 prP2pBssInfo->ucNonHTBasicPhyType = (UINT_8)
927 rNonHTApModeAttributes[prP2pBssInfo->ucConfigAdHocAPMode].ePhyTypeIndex;
928 prP2pBssInfo->u2BSSBasicRateSet =
929 rNonHTApModeAttributes[prP2pBssInfo->ucConfigAdHocAPMode].u2BSSBasicRateSet;
931 prP2pBssInfo->u2OperationalRateSet =
932 rNonHTPhyAttributes[prP2pBssInfo->ucNonHTBasicPhyType].u2SupportedRateSet;
934 rateGetDataRatesFromRateSet(prP2pBssInfo->u2OperationalRateSet,
935 prP2pBssInfo->u2BSSBasicRateSet,
936 prP2pBssInfo->aucAllSupportedRates,
937 &prP2pBssInfo->ucAllSupportedRatesLen);
939 prP2pBssInfo->prBeacon = cnmMgtPktAlloc(prAdapter,
940 OFFSET_OF(WLAN_BEACON_FRAME_T, aucInfoElem[0]) + MAX_IE_LENGTH);
942 if (prP2pBssInfo->prBeacon) {
943 prP2pBssInfo->prBeacon->eSrc = TX_PACKET_MGMT;
944 prP2pBssInfo->prBeacon->ucStaRecIndex = 0xFF; /* NULL STA_REC */
945 prP2pBssInfo->prBeacon->ucNetworkType = NETWORK_TYPE_P2P_INDEX;
952 prP2pBssInfo->eCurrentOPMode = OP_MODE_NUM;
954 prP2pBssInfo->rPmProfSetupInfo.ucBmpDeliveryAC = PM_UAPSD_ALL;
955 prP2pBssInfo->rPmProfSetupInfo.ucBmpTriggerAC = PM_UAPSD_ALL;
956 prP2pBssInfo->rPmProfSetupInfo.ucUapsdSp = WMM_MAX_SP_LENGTH_2;
957 prP2pBssInfo->ucPrimaryChannel = P2P_DEFAULT_LISTEN_CHANNEL;
958 prP2pBssInfo->eBand = BAND_2G4;
959 prP2pBssInfo->eBssSCO = CHNL_EXT_SCN;
961 if (prAdapter->rWifiVar.fgSupportQoS) {
962 prP2pBssInfo->fgIsQBSS = TRUE;
965 prP2pBssInfo->fgIsQBSS = FALSE;
968 SET_NET_PWR_STATE_IDLE(prAdapter, NETWORK_TYPE_P2P_INDEX);
970 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
981 /*----------------------------------------------------------------------------*/
983 * @brief The function is used to uninitialize the value in P2P_FSM_INFO_T for
990 /*----------------------------------------------------------------------------*/
993 IN P_ADAPTER_T prAdapter
996 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
997 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
1000 ASSERT_BREAK(prAdapter != NULL);
1002 DEBUGFUNC("p2pFsmUninit()");
1003 DBGLOG(P2P, INFO, ("->p2pFsmUninit()\n"));
1005 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1006 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
1008 p2pFuncSwitchOPMode(prAdapter, prP2pBssInfo, OP_MODE_P2P_DEVICE, TRUE);
1010 p2pFsmRunEventAbort(prAdapter, prP2pFsmInfo);
1012 p2pStateAbort_IDLE(prAdapter, prP2pFsmInfo, P2P_STATE_NUM);
1014 UNSET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX);
1016 wlanAcquirePowerControl(prAdapter);
1018 /* Release all pending CMD queue. */
1019 DBGLOG(P2P, TRACE, ("p2pFsmUninit: wlanProcessCommandQueue, num of element:%d\n", prAdapter->prGlueInfo->rCmdQueue.u4NumElem));
1020 wlanProcessCommandQueue(prAdapter, &prAdapter->prGlueInfo->rCmdQueue);
1022 wlanReleasePowerControl(prAdapter);
1024 /* Release pending mgmt frame,
1025 * mgmt frame may be pending by CMD without resource.
1027 kalClearMgmtFramesByNetType(prAdapter->prGlueInfo, NETWORK_TYPE_P2P_INDEX);
1029 /* Clear PendingCmdQue*/
1030 wlanReleasePendingCMDbyNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX);
1032 if (prP2pBssInfo->prBeacon) {
1033 cnmMgtPktFree(prAdapter, prP2pBssInfo->prBeacon);
1034 prP2pBssInfo->prBeacon = NULL;
1041 } /* end of p2pFsmUninit() */
1044 p2pFsmStateTransition (
1045 IN P_ADAPTER_T prAdapter,
1046 IN P_P2P_FSM_INFO_T prP2pFsmInfo,
1047 IN ENUM_P2P_STATE_T eNextState
1050 BOOLEAN fgIsTransOut = (BOOLEAN)FALSE;
1051 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
1052 P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo = (P_P2P_SPECIFIC_BSS_INFO_T)NULL;
1055 ASSERT_BREAK((prAdapter != NULL) && (prP2pFsmInfo != NULL));
1057 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
1058 prP2pSpecificBssInfo = prAdapter->rWifiVar.prP2pSpecificBssInfo;
1060 if (!IS_BSS_ACTIVE(prP2pBssInfo)) {
1061 if (!cnmP2PIsPermitted(prAdapter)) {
1065 SET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX);
1066 nicActivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX);
1069 fgIsTransOut = fgIsTransOut?FALSE:TRUE;
1071 if (!fgIsTransOut) {
1072 DBGLOG(P2P, STATE, ("TRANSITION: [%s] -> [%s]\n",
1073 apucDebugP2pState[prP2pFsmInfo->eCurrentState],
1074 apucDebugP2pState[eNextState]));
1076 /* Transition into current state. */
1077 prP2pFsmInfo->ePreviousState = prP2pFsmInfo->eCurrentState;
1078 prP2pFsmInfo->eCurrentState = eNextState;
1082 switch (prP2pFsmInfo->eCurrentState) {
1083 case P2P_STATE_IDLE:
1086 p2pStateAbort_IDLE(prAdapter,
1091 fgIsTransOut = p2pStateInit_IDLE(prAdapter,
1098 case P2P_STATE_SCAN:
1101 // Scan done / scan canceled.
1102 p2pStateAbort_SCAN(prAdapter, prP2pFsmInfo, eNextState);
1105 // Initial scan request.
1106 p2pStateInit_SCAN(prAdapter, prP2pFsmInfo);
1110 case P2P_STATE_AP_CHANNEL_DETECT:
1113 // Get sparse channel result.
1114 p2pStateAbort_AP_CHANNEL_DETECT(prAdapter,
1116 prP2pSpecificBssInfo,
1121 // Initial passive scan request.
1122 p2pStateInit_AP_CHANNEL_DETECT(prAdapter, prP2pFsmInfo);
1126 case P2P_STATE_REQING_CHANNEL:
1129 // Channel on hand / Channel canceled.
1130 p2pStateAbort_REQING_CHANNEL(prAdapter, prP2pFsmInfo, eNextState);
1133 // Initial channel request.
1134 p2pFuncAcquireCh(prAdapter, &(prP2pFsmInfo->rChnlReqInfo));
1138 case P2P_STATE_CHNL_ON_HAND:
1140 p2pStateAbort_CHNL_ON_HAND(prAdapter, prP2pFsmInfo, prP2pBssInfo, eNextState);
1143 // Initial channel ready.
1144 // Send channel ready event.
1145 // Start a FSM timer.
1146 p2pStateInit_CHNL_ON_HAND(prAdapter, prP2pBssInfo, prP2pFsmInfo);
1150 case P2P_STATE_GC_JOIN:
1153 // Join complete / join canceled.
1154 p2pStateAbort_GC_JOIN(prAdapter,
1156 &(prP2pFsmInfo->rJoinInfo),
1160 ASSERT(prP2pFsmInfo->prTargetBss != NULL);
1162 // Send request to SAA module.
1163 p2pStateInit_GC_JOIN(prAdapter,
1166 &(prP2pFsmInfo->rJoinInfo),
1167 prP2pFsmInfo->prTargetBss);
1175 } while (fgIsTransOut);
1177 } /* p2pFsmStateTransition */
1181 p2pFsmRunEventSwitchOPMode (
1182 IN P_ADAPTER_T prAdapter,
1183 IN P_MSG_HDR_T prMsgHdr
1186 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
1187 P_MSG_P2P_SWITCH_OP_MODE_T prSwitchOpMode = (P_MSG_P2P_SWITCH_OP_MODE_T)prMsgHdr;
1188 P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = (P_P2P_CONNECTION_SETTINGS_T)NULL;
1191 ASSERT_BREAK((prAdapter != NULL) && (prSwitchOpMode != NULL));
1193 DBGLOG(P2P, TRACE, ("p2pFsmRunEventSwitchOPMode\n"));
1195 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
1196 prP2pConnSettings = prAdapter->rWifiVar.prP2PConnSettings;
1198 if (prSwitchOpMode->eOpMode >= OP_MODE_NUM) {
1203 /* P2P Device / GC. */
1204 p2pFuncSwitchOPMode(prAdapter,
1206 prSwitchOpMode->eOpMode,
1212 cnmMemFree(prAdapter, prMsgHdr);
1216 } /* p2pFsmRunEventSwitchOPMode */
1219 /*----------------------------------------------------------------------------*/
1221 * \brief This function is used to handle scan done event during Device Discovery.
1223 * \param[in] prAdapter Pointer of ADAPTER_T
1227 /*----------------------------------------------------------------------------*/
1229 p2pFsmRunEventScanDone (
1230 IN P_ADAPTER_T prAdapter,
1231 IN P_MSG_HDR_T prMsgHdr
1234 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1235 P_P2P_SCAN_REQ_INFO_T prScanReqInfo = (P_P2P_SCAN_REQ_INFO_T)NULL;
1236 P_MSG_SCN_SCAN_DONE prScanDoneMsg = (P_MSG_SCN_SCAN_DONE)NULL;
1237 ENUM_P2P_STATE_T eNextState = P2P_STATE_NUM;
1240 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1243 /* This scan done event is either for "SCAN" phase or "SEARCH" state or "LISTEN" state.
1244 * The scan done for SCAN phase & SEARCH state doesn't imply Device
1247 DBGLOG(P2P, TRACE, ("P2P Scan Done Event\n"));
1249 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1251 if (prP2pFsmInfo == NULL) {
1256 prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo);
1257 prScanDoneMsg = (P_MSG_SCN_SCAN_DONE)prMsgHdr;
1259 if (prScanDoneMsg->ucSeqNum != prScanReqInfo->ucSeqNumOfScnMsg) {
1260 /* Scan Done message sequence number mismatch.
1261 * Ignore this event. (P2P FSM issue two scan events.)
1263 /* The scan request has been cancelled.
1264 * Ignore this message. It is possible.
1266 DBGLOG(P2P, TRACE, ("P2P Scan Don SeqNum:%d <-> P2P Fsm SCAN Msg:%d\n",
1267 prScanDoneMsg->ucSeqNum,
1268 prScanReqInfo->ucSeqNumOfScnMsg));
1274 switch (prP2pFsmInfo->eCurrentState) {
1275 case P2P_STATE_SCAN:
1277 P_P2P_CONNECTION_REQ_INFO_T prConnReqInfo = &(prP2pFsmInfo->rConnReqInfo);
1279 prScanReqInfo->fgIsAbort = FALSE;
1281 if (prConnReqInfo->fgIsConnRequest) {
1283 if ((prP2pFsmInfo->prTargetBss = p2pFuncKeepOnConnection(prAdapter,
1284 &prP2pFsmInfo->rConnReqInfo,
1285 &prP2pFsmInfo->rChnlReqInfo,
1286 &prP2pFsmInfo->rScanReqInfo)) == NULL) {
1287 eNextState = P2P_STATE_SCAN;
1290 eNextState = P2P_STATE_REQING_CHANNEL;
1295 eNextState = P2P_STATE_IDLE;
1300 case P2P_STATE_AP_CHANNEL_DETECT:
1301 eNextState = P2P_STATE_REQING_CHANNEL;
1304 /* Unexpected channel scan done event without being chanceled. */
1309 prScanReqInfo->fgIsScanRequest = FALSE;
1311 p2pFsmStateTransition(prAdapter,
1318 cnmMemFree(prAdapter, prMsgHdr);
1322 } /* p2pFsmRunEventScanDone */
1326 /*----------------------------------------------------------------------------*/
1328 * \brief This function is call when channel is granted by CNM module from FW.
1330 * \param[in] prAdapter Pointer of ADAPTER_T
1334 /*----------------------------------------------------------------------------*/
1336 p2pFsmRunEventChGrant (
1337 IN P_ADAPTER_T prAdapter,
1338 IN P_MSG_HDR_T prMsgHdr
1341 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1342 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = (P_P2P_CHNL_REQ_INFO_T)NULL;
1343 P_MSG_CH_GRANT_T prMsgChGrant = (P_MSG_CH_GRANT_T)NULL;
1344 UINT_8 ucTokenID = 0;
1347 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1349 DBGLOG(P2P, TRACE, ("P2P Run Event Channel Grant\n"));
1351 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1353 if (prP2pFsmInfo == NULL) {
1357 prMsgChGrant = (P_MSG_CH_GRANT_T)prMsgHdr;
1358 ucTokenID = prMsgChGrant->ucTokenID;
1359 prP2pFsmInfo->u4GrantInterval = prMsgChGrant->u4GrantInterval;
1361 prChnlReqInfo = &(prP2pFsmInfo->rChnlReqInfo);
1363 if (ucTokenID == prChnlReqInfo->ucSeqNumOfChReq) {
1364 ENUM_P2P_STATE_T eNextState = P2P_STATE_NUM;
1366 switch (prP2pFsmInfo->eCurrentState) {
1367 case P2P_STATE_REQING_CHANNEL:
1368 switch (prChnlReqInfo->eChannelReqType) {
1369 case CHANNEL_REQ_TYPE_REMAIN_ON_CHANNEL:
1370 eNextState = P2P_STATE_CHNL_ON_HAND;
1372 case CHANNEL_REQ_TYPE_GC_JOIN_REQ:
1373 eNextState = P2P_STATE_GC_JOIN;
1375 case CHANNEL_REQ_TYPE_GO_START_BSS:
1376 eNextState = P2P_STATE_IDLE;
1382 p2pFsmStateTransition(prAdapter,
1387 /* Channel is granted under unexpected state.
1388 * Driver should cancel channel privileagea before leaving the states.
1396 /* Channel requsted, but released. */
1397 ASSERT(!prChnlReqInfo->fgIsChannelRequested);
1402 cnmMemFree(prAdapter, prMsgHdr);
1407 } /* p2pFsmRunEventChGrant */
1411 p2pFsmRunEventChannelRequest (
1412 IN P_ADAPTER_T prAdapter,
1413 IN P_MSG_HDR_T prMsgHdr
1416 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = (P_P2P_CHNL_REQ_INFO_T)NULL;
1417 P_MSG_P2P_CHNL_REQUEST_T prP2pChnlReqMsg = (P_MSG_P2P_CHNL_REQUEST_T)NULL;
1418 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1419 ENUM_P2P_STATE_T eNextState = P2P_STATE_NUM;
1422 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1424 prP2pChnlReqMsg = (P_MSG_P2P_CHNL_REQUEST_T)prMsgHdr;
1425 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1427 if (prP2pFsmInfo == NULL) {
1431 prChnlReqInfo = &(prP2pFsmInfo->rChnlReqInfo);
1433 DBGLOG(P2P, TRACE, ("p2pFsmRunEventChannelRequest\n"));
1435 /* Special case of time renewing for same frequency. */
1436 if ((prP2pFsmInfo->eCurrentState == P2P_STATE_CHNL_ON_HAND) &&
1437 (prChnlReqInfo->ucReqChnlNum == prP2pChnlReqMsg->rChannelInfo.ucChannelNum) &&
1438 (prChnlReqInfo->eBand == prP2pChnlReqMsg->rChannelInfo.eBand) &&
1439 (prChnlReqInfo->eChnlSco == prP2pChnlReqMsg->eChnlSco)) {
1441 ASSERT(prChnlReqInfo->fgIsChannelRequested == TRUE);
1442 ASSERT(prChnlReqInfo->eChannelReqType == CHANNEL_REQ_TYPE_REMAIN_ON_CHANNEL);
1444 prChnlReqInfo->u8Cookie = prP2pChnlReqMsg->u8Cookie;
1445 prChnlReqInfo->u4MaxInterval = prP2pChnlReqMsg->u4Duration;
1447 /* Re-enter the state. */
1448 eNextState = P2P_STATE_CHNL_ON_HAND;
1452 // Make sure the state is in IDLE state.
1453 p2pFsmRunEventAbort(prAdapter, prP2pFsmInfo);
1455 prChnlReqInfo->u8Cookie = prP2pChnlReqMsg->u8Cookie; /* Cookie can only be assign after abort.(for indication) */
1456 prChnlReqInfo->ucReqChnlNum = prP2pChnlReqMsg->rChannelInfo.ucChannelNum;
1457 prChnlReqInfo->eBand = prP2pChnlReqMsg->rChannelInfo.eBand;
1458 prChnlReqInfo->eChnlSco = prP2pChnlReqMsg->eChnlSco;
1459 prChnlReqInfo->u4MaxInterval = prP2pChnlReqMsg->u4Duration;
1460 prChnlReqInfo->eChannelReqType = CHANNEL_REQ_TYPE_REMAIN_ON_CHANNEL;
1462 eNextState = P2P_STATE_REQING_CHANNEL;
1465 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, eNextState);
1471 cnmMemFree(prAdapter, prMsgHdr);
1475 } /* p2pFsmRunEventChannelRequest */
1479 p2pFsmRunEventChannelAbort (
1480 IN P_ADAPTER_T prAdapter,
1481 IN P_MSG_HDR_T prMsgHdr
1484 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1485 P_MSG_P2P_CHNL_ABORT_T prChnlAbortMsg = (P_MSG_P2P_CHNL_ABORT_T)NULL;
1486 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = (P_P2P_CHNL_REQ_INFO_T)NULL;
1489 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1491 prChnlAbortMsg = (P_MSG_P2P_CHNL_ABORT_T)prMsgHdr;
1492 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1494 if (prP2pFsmInfo == NULL) {
1498 prChnlReqInfo = &prP2pFsmInfo->rChnlReqInfo;
1500 DBGLOG(P2P, TRACE, ("p2pFsmRunEventChannelAbort\n"));
1502 if ((prChnlAbortMsg->u8Cookie == prChnlReqInfo->u8Cookie) &&
1503 (prChnlReqInfo->fgIsChannelRequested)) {
1505 ASSERT((prP2pFsmInfo->eCurrentState == P2P_STATE_REQING_CHANNEL ||
1506 (prP2pFsmInfo->eCurrentState == P2P_STATE_CHNL_ON_HAND)));
1508 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
1514 cnmMemFree(prAdapter, prMsgHdr);
1518 } /* p2pFsmRunEventChannelAbort */
1523 p2pFsmRunEventScanRequest (
1524 IN P_ADAPTER_T prAdapter,
1525 IN P_MSG_HDR_T prMsgHdr
1529 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1530 P_MSG_P2P_SCAN_REQUEST_T prP2pScanReqMsg = (P_MSG_P2P_SCAN_REQUEST_T)NULL;
1531 P_P2P_SCAN_REQ_INFO_T prScanReqInfo = (P_P2P_SCAN_REQ_INFO_T)NULL;
1532 UINT_32 u4ChnlListSize = 0;
1535 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1537 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1539 if (prP2pFsmInfo == NULL) {
1543 prP2pScanReqMsg = (P_MSG_P2P_SCAN_REQUEST_T)prMsgHdr;
1544 prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo);
1546 DBGLOG(P2P, TRACE, ("p2pFsmRunEventScanRequest\n"));
1548 // Make sure the state is in IDLE state.
1549 p2pFsmRunEventAbort(prAdapter, prP2pFsmInfo);
1551 ASSERT(prScanReqInfo->fgIsScanRequest == FALSE);
1553 prScanReqInfo->fgIsAbort = TRUE;
1554 prScanReqInfo->eScanType = SCAN_TYPE_ACTIVE_SCAN;
1555 prScanReqInfo->eChannelSet = SCAN_CHANNEL_SPECIFIED;
1558 prScanReqInfo->ucNumChannelList = prP2pScanReqMsg->u4NumChannel;
1559 DBGLOG(P2P, TRACE, ("Scan Request Channel List Number: %d\n", prScanReqInfo->ucNumChannelList));
1560 if (prScanReqInfo->ucNumChannelList > MAXIMUM_OPERATION_CHANNEL_LIST) {
1561 DBGLOG(P2P, TRACE, ("Channel List Number Overloaded: %d, change to: %d\n",
1562 prScanReqInfo->ucNumChannelList,
1563 MAXIMUM_OPERATION_CHANNEL_LIST));
1564 prScanReqInfo->ucNumChannelList = MAXIMUM_OPERATION_CHANNEL_LIST;
1567 u4ChnlListSize = sizeof(RF_CHANNEL_INFO_T) * prScanReqInfo->ucNumChannelList;
1568 kalMemCopy(prScanReqInfo->arScanChannelList, prP2pScanReqMsg->arChannelListInfo, u4ChnlListSize);
1570 // TODO: I only take the first SSID. Multiple SSID may be needed in the future.
1572 if (prP2pScanReqMsg->i4SsidNum >= 1) {
1574 kalMemCopy(&(prScanReqInfo->rSsidStruct),
1575 prP2pScanReqMsg->prSSID,
1576 sizeof(P2P_SSID_STRUCT_T));
1579 prScanReqInfo->rSsidStruct.ucSsidLen = 0;
1583 kalMemCopy(prScanReqInfo->aucIEBuf,
1584 prP2pScanReqMsg->pucIEBuf,
1585 prP2pScanReqMsg->u4IELen);
1587 prScanReqInfo->u4BufLength = prP2pScanReqMsg->u4IELen;
1589 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_SCAN);
1596 cnmMemFree(prAdapter, prMsgHdr);
1600 } /* p2pFsmRunEventScanRequest */
1604 p2pFsmRunEventScanAbort (
1605 IN P_ADAPTER_T prAdapter,
1606 IN P_MSG_HDR_T prMsgHdr
1610 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1613 ASSERT_BREAK(prAdapter != NULL);
1615 DBGLOG(P2P, TRACE, ("p2pFsmRunEventScanAbort\n"));
1617 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1619 if (prP2pFsmInfo->eCurrentState == P2P_STATE_SCAN) {
1620 P_P2P_SCAN_REQ_INFO_T prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo);
1622 prScanReqInfo->fgIsAbort = TRUE;
1624 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
1630 cnmMemFree(prAdapter, prMsgHdr);
1634 } /* p2pFsmRunEventScanAbort */
1641 p2pFsmRunEventAbort (
1642 IN P_ADAPTER_T prAdapter,
1643 IN P_P2P_FSM_INFO_T prP2pFsmInfo
1646 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
1648 ASSERT_BREAK((prAdapter != NULL) && (prP2pFsmInfo != NULL));
1650 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
1652 DBGLOG(P2P, TRACE, ("p2pFsmRunEventAbort\n"));
1654 if (prP2pFsmInfo->eCurrentState != P2P_STATE_IDLE) {
1656 if (prP2pFsmInfo->eCurrentState == P2P_STATE_SCAN) {
1658 P_P2P_SCAN_REQ_INFO_T prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo);
1660 prScanReqInfo->fgIsAbort = TRUE;
1662 else if (prP2pFsmInfo->eCurrentState == P2P_STATE_REQING_CHANNEL) {
1666 prP2pBssInfo->eIntendOPMode = OP_MODE_NUM;
1669 // For other state, is there any special action that should be take before leaving?
1671 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
1674 /* P2P State IDLE. */
1675 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = &(prP2pFsmInfo->rChnlReqInfo);
1677 if (prChnlReqInfo->fgIsChannelRequested) {
1678 p2pFuncReleaseCh(prAdapter, prChnlReqInfo);
1681 cnmTimerStopTimer(prAdapter, &(prP2pFsmInfo->rP2pFsmTimeoutTimer));
1688 } /* p2pFsmRunEventAbort */
1692 /*----------------------------------------------------------------------------*/
1694 * \brief This function is used to handle FSM Timeout.
1696 * \param[in] prAdapter Pointer of ADAPTER_T
1700 /*----------------------------------------------------------------------------*/
1702 p2pFsmRunEventFsmTimeout (
1703 IN P_ADAPTER_T prAdapter,
1707 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)u4Param;
1710 ASSERT_BREAK((prAdapter != NULL) && (prP2pFsmInfo != NULL));
1712 DBGLOG(P2P, TRACE, ("P2P FSM Timeout Event\n"));
1714 switch (prP2pFsmInfo->eCurrentState) {
1715 case P2P_STATE_IDLE:
1717 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = &prP2pFsmInfo->rChnlReqInfo;
1718 if (prChnlReqInfo->fgIsChannelRequested) {
1719 p2pFuncReleaseCh(prAdapter, prChnlReqInfo);
1721 else if (IS_NET_PWR_STATE_IDLE(prAdapter, NETWORK_TYPE_P2P_INDEX)) {
1722 UNSET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX);
1723 nicDeactivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX);
1729 // case P2P_STATE_SCAN:
1731 // case P2P_STATE_AP_CHANNEL_DETECT:
1733 // case P2P_STATE_REQING_CHANNEL:
1735 case P2P_STATE_CHNL_ON_HAND:
1737 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
1740 // case P2P_STATE_GC_JOIN:
1749 } /* p2pFsmRunEventFsmTimeout */
1752 p2pFsmRunEventMgmtFrameTx (
1753 IN P_ADAPTER_T prAdapter,
1754 IN P_MSG_HDR_T prMsgHdr
1757 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1758 P_MSG_P2P_MGMT_TX_REQUEST_T prMgmtTxMsg = (P_MSG_P2P_MGMT_TX_REQUEST_T)NULL;
1761 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1763 DBGLOG(P2P, TRACE, ("p2pFsmRunEventMgmtFrameTx\n"));
1765 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1767 if (prP2pFsmInfo == NULL) {
1771 prMgmtTxMsg = (P_MSG_P2P_MGMT_TX_REQUEST_T)prMsgHdr;
1773 p2pFuncTxMgmtFrame(prAdapter,
1774 &prP2pFsmInfo->rMgmtTxInfo,
1775 prMgmtTxMsg->prMgmtMsduInfo,
1776 prMgmtTxMsg->u8Cookie);
1783 cnmMemFree(prAdapter, prMsgHdr);
1788 } /* p2pFsmRunEventMgmtTx */
1792 p2pFsmRunEventStartAP (
1793 IN P_ADAPTER_T prAdapter,
1794 IN P_MSG_HDR_T prMsgHdr
1797 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1798 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
1799 P_MSG_P2P_START_AP_T prP2pStartAPMsg = (P_MSG_P2P_START_AP_T)NULL;
1800 P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo = (P_P2P_SPECIFIC_BSS_INFO_T)NULL;
1803 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1805 DBGLOG(P2P, TRACE, ("p2pFsmRunEventStartAP\n"));
1807 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1809 if (prP2pFsmInfo == NULL) {
1813 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
1814 prP2pStartAPMsg = (P_MSG_P2P_START_AP_T)prMsgHdr;
1815 prP2pSpecificBssInfo = prAdapter->rWifiVar.prP2pSpecificBssInfo;
1818 if (prP2pStartAPMsg->u4BcnInterval) {
1819 DBGLOG(P2P, TRACE, ("Beacon interval updated to :%ld \n", prP2pStartAPMsg->u4BcnInterval));
1820 prP2pBssInfo->u2BeaconInterval = (UINT_16)prP2pStartAPMsg->u4BcnInterval;
1822 else if (prP2pBssInfo->u2BeaconInterval == 0) {
1823 prP2pBssInfo->u2BeaconInterval = DOT11_BEACON_PERIOD_DEFAULT;
1826 if (prP2pStartAPMsg->u4DtimPeriod) {
1827 DBGLOG(P2P, TRACE, ("DTIM interval updated to :%ld \n", prP2pStartAPMsg->u4DtimPeriod));
1828 prP2pBssInfo->ucDTIMPeriod = (UINT_8)prP2pStartAPMsg->u4DtimPeriod;
1830 else if (prP2pBssInfo->ucDTIMPeriod == 0) {
1831 prP2pBssInfo->ucDTIMPeriod = DOT11_DTIM_PERIOD_DEFAULT;
1834 if (prP2pStartAPMsg->u2SsidLen != 0) {
1835 kalMemCopy(prP2pBssInfo->aucSSID, prP2pStartAPMsg->aucSsid, prP2pStartAPMsg->u2SsidLen);
1836 kalMemCopy(prP2pSpecificBssInfo->aucGroupSsid, prP2pStartAPMsg->aucSsid, prP2pStartAPMsg->u2SsidLen);
1837 prP2pBssInfo->ucSSIDLen = prP2pSpecificBssInfo->u2GroupSsidLen = prP2pStartAPMsg->u2SsidLen;
1841 prP2pBssInfo->eHiddenSsidType = prP2pStartAPMsg->ucHiddenSsidType;
1845 /* Privacy & inactive timeout. */
1847 if ((prP2pBssInfo->eCurrentOPMode != OP_MODE_ACCESS_POINT) ||
1848 (prP2pBssInfo->eIntendOPMode != OP_MODE_NUM)) {
1849 UINT_8 ucPreferedChnl = 0;
1850 ENUM_BAND_T eBand = BAND_NULL;
1851 ENUM_CHNL_EXT_T eSco = CHNL_EXT_SCN;
1852 ENUM_P2P_STATE_T eNextState = P2P_STATE_SCAN;
1853 P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = prAdapter->rWifiVar.prP2PConnSettings;
1856 if(prP2pFsmInfo->eCurrentState != P2P_STATE_SCAN &&
1857 prP2pFsmInfo->eCurrentState != P2P_STATE_IDLE) {
1858 // Make sure the state is in IDLE state.
1859 p2pFsmRunEventAbort(prAdapter, prP2pFsmInfo);
1862 // 20120118: Moved to p2pFuncSwitchOPMode().
1863 //SET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX);
1865 /* Leave IDLE state. */
1866 SET_NET_PWR_STATE_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX);
1868 // sync with firmware
1869 //DBGLOG(P2P, INFO, ("Activate P2P Network. \n"));
1870 //nicActivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX);
1873 /* Key to trigger P2P FSM to allocate channel for AP mode. */
1874 prP2pBssInfo->eIntendOPMode = OP_MODE_ACCESS_POINT;
1876 /* Sparse Channel to decide which channel to use. */
1877 if ((cnmPreferredChannel(prAdapter,
1880 &eSco) == FALSE) && (prP2pConnSettings->ucOperatingChnl == 0)) {
1881 // Sparse Channel Detection using passive mode.
1882 eNextState = P2P_STATE_AP_CHANNEL_DETECT;
1885 P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo = prAdapter->rWifiVar.prP2pSpecificBssInfo;
1886 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = &prP2pFsmInfo->rChnlReqInfo;
1890 /* 2012-01-27: frog - Channel set from upper layer is the first priority. */
1891 /* Becuase the channel & beacon is decided by p2p_supplicant. */
1892 if (prP2pConnSettings->ucOperatingChnl != 0) {
1893 prP2pSpecificBssInfo->ucPreferredChannel = prP2pConnSettings->ucOperatingChnl;
1894 prP2pSpecificBssInfo->eRfBand = prP2pConnSettings->eBand;
1898 ASSERT(ucPreferedChnl != 0);
1899 prP2pSpecificBssInfo->ucPreferredChannel = ucPreferedChnl;
1900 prP2pSpecificBssInfo->eRfBand = eBand;
1903 if (ucPreferedChnl) {
1904 prP2pSpecificBssInfo->ucPreferredChannel = ucPreferedChnl;
1905 prP2pSpecificBssInfo->eRfBand = eBand;
1908 ASSERT(prP2pConnSettings->ucOperatingChnl != 0);
1909 prP2pSpecificBssInfo->ucPreferredChannel = prP2pConnSettings->ucOperatingChnl;
1910 prP2pSpecificBssInfo->eRfBand = prP2pConnSettings->eBand;
1914 prChnlReqInfo->ucReqChnlNum = prP2pSpecificBssInfo->ucPreferredChannel;
1915 prChnlReqInfo->eBand = prP2pSpecificBssInfo->eRfBand;
1916 prChnlReqInfo->eChannelReqType = CHANNEL_REQ_TYPE_GO_START_BSS;
1919 /* If channel is specified, use active scan to shorten the scan time. */
1920 p2pFsmStateTransition(prAdapter,
1921 prAdapter->rWifiVar.prP2pFsmInfo,
1932 cnmMemFree(prAdapter, prMsgHdr);
1936 } /* p2pFsmRunEventStartAP */
1939 p2pFsmRunEventNetDeviceRegister (
1940 IN P_ADAPTER_T prAdapter,
1941 IN P_MSG_HDR_T prMsgHdr
1944 P_MSG_P2P_NETDEV_REGISTER_T prNetDevRegisterMsg = (P_MSG_P2P_NETDEV_REGISTER_T)NULL;
1949 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1951 DBGLOG(P2P, TRACE, ("p2pFsmRunEventNetDeviceRegister\n"));
1953 prNetDevRegisterMsg = (P_MSG_P2P_NETDEV_REGISTER_T)prMsgHdr;
1955 if (prNetDevRegisterMsg->fgIsEnable) {
1956 p2pSetMode((prNetDevRegisterMsg->ucMode == 1)?TRUE:FALSE);
1958 if (p2pLaunch(prAdapter->prGlueInfo)) {
1959 ASSERT(prAdapter->fgIsP2PRegistered);
1964 if (prAdapter->fgIsP2PRegistered) {
1965 p2pRemove(prAdapter->prGlueInfo);
1972 cnmMemFree(prAdapter, prMsgHdr);
1976 } /* p2pFsmRunEventNetDeviceRegister */
1980 p2pFsmRunEventUpdateMgmtFrame (
1981 IN P_ADAPTER_T prAdapter,
1982 IN P_MSG_HDR_T prMsgHdr
1985 P_MSG_P2P_MGMT_FRAME_UPDATE_T prP2pMgmtFrameUpdateMsg = (P_MSG_P2P_MGMT_FRAME_UPDATE_T)NULL;
1986 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1989 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1991 DBGLOG(P2P, TRACE, ("p2pFsmRunEventUpdateMgmtFrame\n"));
1993 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1995 if (prP2pFsmInfo == NULL) {
1999 prP2pMgmtFrameUpdateMsg = (P_MSG_P2P_MGMT_FRAME_UPDATE_T)prMsgHdr;
2001 switch (prP2pMgmtFrameUpdateMsg->eBufferType) {
2002 case ENUM_FRAME_TYPE_EXTRA_IE_BEACON:
2004 case ENUM_FRAME_TYPE_EXTRA_IE_ASSOC_RSP:
2006 case ENUM_FRAME_TYPE_EXTRA_IE_PROBE_RSP:
2008 case ENUM_FRAME_TYPE_PROBE_RSP_TEMPLATE:
2010 case ENUM_FRAME_TYPE_BEACON_TEMPLATE:
2019 cnmMemFree(prAdapter, prMsgHdr);
2023 } /* p2pFsmRunEventUpdateMgmtFrame */
2027 p2pFsmRunEventBeaconUpdate (
2028 IN P_ADAPTER_T prAdapter,
2029 IN P_MSG_HDR_T prMsgHdr
2032 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2033 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2034 P_MSG_P2P_BEACON_UPDATE_T prBcnUpdateMsg = (P_MSG_P2P_BEACON_UPDATE_T)NULL;
2037 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
2039 DBGLOG(P2P, TRACE, ("p2pFsmRunEventBeaconUpdate\n"));
2041 printk("p2pFsmRunEventBeaconUpdate\n");
2043 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2045 if (prP2pFsmInfo == NULL) {
2049 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2050 prBcnUpdateMsg = (P_MSG_P2P_BEACON_UPDATE_T)prMsgHdr;
2053 p2pFuncBeaconUpdate(prAdapter,
2055 &prP2pFsmInfo->rBcnContentInfo,
2056 prBcnUpdateMsg->pucBcnHdr,
2057 prBcnUpdateMsg->u4BcnHdrLen,
2058 prBcnUpdateMsg->pucBcnBody,
2059 prBcnUpdateMsg->u4BcnBodyLen);
2061 if ((prP2pBssInfo->eCurrentOPMode == OP_MODE_ACCESS_POINT) &&
2062 (prP2pBssInfo->eIntendOPMode == OP_MODE_NUM)) {
2063 /* AP is created, Beacon Update. */
2064 //nicPmIndicateBssAbort(prAdapter, NETWORK_TYPE_P2P_INDEX);
2066 bssUpdateBeaconContent(prAdapter, NETWORK_TYPE_P2P_INDEX);
2068 //nicPmIndicateBssCreated(prAdapter, NETWORK_TYPE_P2P_INDEX);
2077 cnmMemFree(prAdapter, prMsgHdr);
2080 } /* p2pFsmRunEventBeaconUpdate */
2084 p2pFsmRunEventStopAP (
2085 IN P_ADAPTER_T prAdapter,
2086 IN P_MSG_HDR_T prMsgHdr
2089 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2092 ASSERT_BREAK((prAdapter != NULL));
2094 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2096 DBGLOG(P2P, TRACE, ("p2pFsmRunEventStopAP\n"));
2098 if ((prP2pBssInfo->eCurrentOPMode == OP_MODE_ACCESS_POINT)
2099 && (prP2pBssInfo->eIntendOPMode == OP_MODE_NUM)) {
2100 /* AP is created, Beacon Update. */
2102 p2pFuncDissolve(prAdapter, prP2pBssInfo, TRUE, REASON_CODE_DEAUTH_LEAVING_BSS);
2104 DBGLOG(P2P, TRACE, ("Stop Beaconing\n"));
2105 nicPmIndicateBssAbort(prAdapter, NETWORK_TYPE_P2P_INDEX);
2107 /* Reset RLM related field of BSSINFO. */
2108 rlmBssAborted(prAdapter, prP2pBssInfo);
2113 // 20120118: Moved to p2pFuncSwitchOPMode().
2114 //UNSET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX);
2116 /* Enter IDLE state. */
2117 SET_NET_PWR_STATE_IDLE(prAdapter, NETWORK_TYPE_P2P_INDEX);
2119 DBGLOG(P2P, INFO, ("Re activate P2P Network. \n"));
2120 nicDeactivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX);
2122 nicActivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX);
2125 p2pFsmRunEventWfdSettingUpdate(prAdapter, NULL);
2128 p2pFsmRunEventAbort(prAdapter, prAdapter->rWifiVar.prP2pFsmInfo);
2129 // p2pFsmStateTransition(prAdapter, prAdapter->rWifiVar.prP2pFsmInfo, P2P_STATE_IDLE);
2134 cnmMemFree(prAdapter, prMsgHdr);
2137 } /* p2pFsmRunEventStopAP */
2140 p2pFsmRunEventConnectionRequest (
2141 IN P_ADAPTER_T prAdapter,
2142 IN P_MSG_HDR_T prMsgHdr
2145 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2146 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2147 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = (P_P2P_CHNL_REQ_INFO_T)NULL;
2148 P_MSG_P2P_CONNECTION_REQUEST_T prConnReqMsg = (P_MSG_P2P_CONNECTION_REQUEST_T)NULL;
2149 P_P2P_CONNECTION_REQ_INFO_T prConnReqInfo = (P_P2P_CONNECTION_REQ_INFO_T)NULL;
2152 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
2154 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2155 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2157 if (prP2pFsmInfo == NULL) {
2161 prConnReqMsg = (P_MSG_P2P_CONNECTION_REQUEST_T)prMsgHdr;
2163 prConnReqInfo = &(prP2pFsmInfo->rConnReqInfo);
2164 prChnlReqInfo = &(prP2pFsmInfo->rChnlReqInfo);
2166 DBGLOG(P2P, TRACE, ("p2pFsmRunEventConnectionRequest\n"));
2168 if (prP2pBssInfo->eCurrentOPMode != OP_MODE_INFRASTRUCTURE) {
2172 SET_NET_PWR_STATE_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX);
2175 // Make sure the state is in IDLE state.
2176 p2pFsmRunEventAbort(prAdapter, prP2pFsmInfo);
2178 // Update connection request information.
2179 prConnReqInfo->fgIsConnRequest = TRUE;
2180 COPY_MAC_ADDR(prConnReqInfo->aucBssid, prConnReqMsg->aucBssid);
2181 kalMemCopy(&(prConnReqInfo->rSsidStruct), &(prConnReqMsg->rSsid), sizeof(P2P_SSID_STRUCT_T));
2182 kalMemCopy(prConnReqInfo->aucIEBuf, prConnReqMsg->aucIEBuf, prConnReqMsg->u4IELen);
2183 prConnReqInfo->u4BufLength = prConnReqMsg->u4IELen;
2185 /* Find BSS Descriptor first. */
2186 prP2pFsmInfo->prTargetBss = scanP2pSearchDesc(prAdapter,
2190 if (prP2pFsmInfo->prTargetBss == NULL) {
2191 /* Update scan parameter... to scan target device. */
2192 P_P2P_SCAN_REQ_INFO_T prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo);
2194 prScanReqInfo->ucNumChannelList = 1;
2195 prScanReqInfo->eScanType = SCAN_TYPE_ACTIVE_SCAN;
2196 prScanReqInfo->eChannelSet = SCAN_CHANNEL_SPECIFIED;
2197 prScanReqInfo->arScanChannelList[0].ucChannelNum = prConnReqMsg->rChannelInfo.ucChannelNum;
2198 kalMemCopy(&(prScanReqInfo->rSsidStruct), &(prConnReqMsg->rSsid), sizeof(P2P_SSID_STRUCT_T));
2199 prScanReqInfo->u4BufLength = 0; /* Prevent other P2P ID in IE. */
2200 prScanReqInfo->fgIsAbort = TRUE;
2202 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_SCAN);
2205 prChnlReqInfo->u8Cookie = 0;
2206 prChnlReqInfo->ucReqChnlNum = prConnReqMsg->rChannelInfo.ucChannelNum;
2207 prChnlReqInfo->eBand = prConnReqMsg->rChannelInfo.eBand;
2208 prChnlReqInfo->eChnlSco = prConnReqMsg->eChnlSco;
2209 prChnlReqInfo->u4MaxInterval = AIS_JOIN_CH_REQUEST_INTERVAL;
2210 prChnlReqInfo->eChannelReqType = CHANNEL_REQ_TYPE_GC_JOIN_REQ;
2212 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_REQING_CHANNEL);
2219 cnmMemFree(prAdapter, prMsgHdr);
2224 } /* p2pFsmRunEventConnectionRequest */
2226 /*----------------------------------------------------------------------------*/
2228 * \brief This function is used to handle Connection Request from Supplicant.
2230 * \param[in] prAdapter Pointer of ADAPTER_T
2234 /*----------------------------------------------------------------------------*/
2236 p2pFsmRunEventConnectionAbort (
2237 IN P_ADAPTER_T prAdapter,
2238 IN P_MSG_HDR_T prMsgHdr
2241 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2242 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2243 P_MSG_P2P_CONNECTION_ABORT_T prDisconnMsg = (P_MSG_P2P_CONNECTION_ABORT_T)NULL;
2244 //P_STA_RECORD_T prTargetStaRec = (P_STA_RECORD_T)NULL;
2248 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
2250 DBGLOG(P2P, TRACE, ("p2pFsmRunEventConnectionAbort: Connection Abort.\n"));
2252 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2254 if (prP2pFsmInfo == NULL) {
2258 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2260 prDisconnMsg = (P_MSG_P2P_CONNECTION_ABORT_T)prMsgHdr;
2262 switch (prP2pBssInfo->eCurrentOPMode) {
2263 case OP_MODE_INFRASTRUCTURE:
2265 UINT_8 aucBCBSSID[] = BC_BSSID;
2267 if (!prP2pBssInfo->prStaRecOfAP) {
2268 DBGLOG(P2P, TRACE, ("GO's StaRec is NULL\n"));
2271 if (UNEQUAL_MAC_ADDR(prP2pBssInfo->prStaRecOfAP->aucMacAddr, prDisconnMsg->aucTargetID) &&
2272 UNEQUAL_MAC_ADDR(prDisconnMsg->aucTargetID, aucBCBSSID)) {
2273 DBGLOG(P2P, TRACE, ("Unequal MAC ADDR ["MACSTR":"MACSTR"]\n",
2274 MAC2STR(prP2pBssInfo->prStaRecOfAP->aucMacAddr),
2275 MAC2STR(prDisconnMsg->aucTargetID)));
2280 kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo, NULL, NULL, 0, 0);
2282 /* Stop rejoin timer if it is started. */
2285 p2pFuncDisconnect(prAdapter, prP2pBssInfo->prStaRecOfAP, prDisconnMsg->fgSendDeauth, prDisconnMsg->u2ReasonCode);
2287 //prTargetStaRec = prP2pBssInfo->prStaRecOfAP;
2289 /* Fix possible KE when RX Beacon & call nicPmIndicateBssConnected(). hit prStaRecOfAP == NULL. */
2290 p2pChangeMediaState(prAdapter, PARAM_MEDIA_STATE_DISCONNECTED);
2292 prP2pBssInfo->prStaRecOfAP = NULL;
2294 SET_NET_PWR_STATE_IDLE(prAdapter, NETWORK_TYPE_P2P_INDEX);
2296 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
2300 case OP_MODE_ACCESS_POINT:
2302 P_LINK_T prStaRecOfClientList = &prP2pBssInfo->rStaRecOfClientList;
2303 /* Search specific client device, and disconnect. */
2304 /* 1. Send deauthentication frame. */
2305 /* 2. Indication: Device disconnect. */
2306 P_LINK_ENTRY_T prLinkEntry = (P_LINK_ENTRY_T)NULL;
2307 P_STA_RECORD_T prCurrStaRec = (P_STA_RECORD_T)NULL;
2309 DBGLOG(P2P, TRACE, ("Disconnecting with Target ID: "MACSTR"\n", MAC2STR(prDisconnMsg->aucTargetID)));
2311 LINK_FOR_EACH(prLinkEntry, prStaRecOfClientList) {
2312 prCurrStaRec = LINK_ENTRY(prLinkEntry, STA_RECORD_T, rLinkEntry);
2314 ASSERT(prCurrStaRec);
2316 if (EQUAL_MAC_ADDR(prCurrStaRec->aucMacAddr, prDisconnMsg->aucTargetID)) {
2318 DBGLOG(P2P, TRACE, ("Disconnecting: "MACSTR"\n", MAC2STR(prCurrStaRec->aucMacAddr)));
2320 /* Remove STA from client list. */
2321 LINK_REMOVE_KNOWN_ENTRY(prStaRecOfClientList, &prCurrStaRec->rLinkEntry);
2323 /* Glue layer indication. */
2324 //kalP2PGOStationUpdate(prAdapter->prGlueInfo, prCurrStaRec, FALSE);
2326 /* Send deauth & do indication. */
2327 p2pFuncDisconnect(prAdapter, prCurrStaRec, prDisconnMsg->fgSendDeauth, prDisconnMsg->u2ReasonCode);
2329 //prTargetStaRec = prCurrStaRec;
2337 case OP_MODE_P2P_DEVICE:
2345 //20120830 moved into p2pFuncDisconnect()
2346 //if ((!prDisconnMsg->fgSendDeauth) && (prTargetStaRec)) {
2347 // cnmStaRecFree(prAdapter, prTargetStaRec, TRUE);
2352 cnmMemFree(prAdapter, prMsgHdr);
2356 } /* p2pFsmRunEventConnectionAbort */
2360 p2pFsmRunEventDissolve (
2361 IN P_ADAPTER_T prAdapter,
2362 IN P_MSG_HDR_T prMsgHdr
2368 DBGLOG(P2P, TRACE, ("p2pFsmRunEventDissolve\n"));
2371 cnmMemFree(prAdapter, prMsgHdr);
2377 p2pFsmRunEventDeauthTxDone (
2378 IN P_ADAPTER_T prAdapter,
2379 IN P_MSDU_INFO_T prMsduInfo,
2380 IN ENUM_TX_RESULT_CODE_T rTxDoneStatus
2384 P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL;
2385 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2386 ENUM_PARAM_MEDIA_STATE_T eOriMediaStatus;
2390 ASSERT_BREAK((prAdapter != NULL) &&
2391 (prMsduInfo != NULL));
2393 DBGLOG(P2P, TRACE, ("Deauth TX Done\n"));
2395 prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex);
2397 if (prStaRec == NULL) {
2398 DBGLOG(P2P, TRACE, ("Station Record NULL, Index:%d\n", prMsduInfo->ucStaRecIndex));
2402 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2403 eOriMediaStatus = prP2pBssInfo->eConnectionState;
2405 /* Change station state. */
2406 cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_1);
2408 /* Reset Station Record Status. */
2409 p2pFuncResetStaRecStatus(prAdapter, prStaRec);
2412 cnmStaRecFree(prAdapter, prStaRec, TRUE);
2414 if ((prP2pBssInfo->eCurrentOPMode != OP_MODE_ACCESS_POINT) ||
2415 (prP2pBssInfo->rStaRecOfClientList.u4NumElem == 0)) {
2416 DBGLOG(P2P, TRACE, ("No More Client, Media Status DISCONNECTED\n"));
2417 p2pChangeMediaState(prAdapter, PARAM_MEDIA_STATE_DISCONNECTED);
2420 /* Because the eConnectionState is changed before Deauth TxDone. Dont Check eConnectionState */
2421 //if (eOriMediaStatus != prP2pBssInfo->eConnectionState) {
2422 /* Update Disconnected state to FW. */
2423 nicUpdateBss(prAdapter, NETWORK_TYPE_P2P_INDEX);
2429 return WLAN_STATUS_SUCCESS;
2430 } /* p2pFsmRunEventDeauthTxDone */
2434 p2pFsmRunEventMgmtFrameTxDone (
2435 IN P_ADAPTER_T prAdapter,
2436 IN P_MSDU_INFO_T prMsduInfo,
2437 IN ENUM_TX_RESULT_CODE_T rTxDoneStatus
2440 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2441 P_P2P_MGMT_TX_REQ_INFO_T prMgmtTxReqInfo = (P_P2P_MGMT_TX_REQ_INFO_T)NULL;
2442 BOOLEAN fgIsSuccess = FALSE;
2445 ASSERT_BREAK((prAdapter != NULL) && (prMsduInfo != NULL));
2447 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2448 prMgmtTxReqInfo = &(prP2pFsmInfo->rMgmtTxInfo);
2450 if (rTxDoneStatus != TX_RESULT_SUCCESS) {
2451 DBGLOG(P2P, TRACE, ("Mgmt Frame TX Fail, Status:%d.\n", rTxDoneStatus));
2455 DBGLOG(P2P, TRACE, ("Mgmt Frame TX Done.\n"));
2459 if (prMgmtTxReqInfo->prMgmtTxMsdu == prMsduInfo) {
2460 kalP2PIndicateMgmtTxStatus(prAdapter->prGlueInfo,
2461 prMgmtTxReqInfo->u8Cookie,
2463 prMsduInfo->prPacket,
2464 (UINT_32)prMsduInfo->u2FrameLength);
2466 prMgmtTxReqInfo->prMgmtTxMsdu = NULL;
2471 return WLAN_STATUS_SUCCESS;
2473 } /* p2pFsmRunEventMgmtFrameTxDone */
2476 /*----------------------------------------------------------------------------*/
2478 * \brief This function is called when JOIN complete message event is received from SAA.
2480 * \param[in] prAdapter Pointer of ADAPTER_T
2484 /*----------------------------------------------------------------------------*/
2486 p2pFsmRunEventJoinComplete (
2487 IN P_ADAPTER_T prAdapter,
2488 IN P_MSG_HDR_T prMsgHdr
2491 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2492 P_P2P_JOIN_INFO_T prJoinInfo = (P_P2P_JOIN_INFO_T)NULL;
2493 P_MSG_JOIN_COMP_T prJoinCompMsg = (P_MSG_JOIN_COMP_T)NULL;
2494 P_SW_RFB_T prAssocRspSwRfb = (P_SW_RFB_T)NULL;
2495 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2498 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
2500 DBGLOG(P2P, TRACE, ("P2P Join Complete\n"));
2502 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2504 if (prP2pFsmInfo == NULL) {
2509 prJoinInfo = &(prP2pFsmInfo->rJoinInfo);
2510 prJoinCompMsg = (P_MSG_JOIN_COMP_T)prMsgHdr;
2511 prAssocRspSwRfb = prJoinCompMsg->prSwRfb;
2512 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2514 if (prP2pBssInfo->eCurrentOPMode == OP_MODE_INFRASTRUCTURE) {
2515 P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL;
2517 prStaRec = prJoinCompMsg->prStaRec;
2520 if (prJoinCompMsg->ucSeqNum == prJoinInfo->ucSeqNumOfReqMsg) {
2521 ASSERT(prStaRec == prJoinInfo->prTargetStaRec);
2522 prJoinInfo->fgIsJoinComplete = TRUE;
2524 if (prJoinCompMsg->rJoinStatus == WLAN_STATUS_SUCCESS) {
2526 //4 <1.1> Change FW's Media State immediately.
2527 p2pChangeMediaState(prAdapter, PARAM_MEDIA_STATE_CONNECTED);
2529 //4 <1.2> Deactivate previous AP's STA_RECORD_T in Driver if have.
2530 if ((prP2pBssInfo->prStaRecOfAP) &&
2531 (prP2pBssInfo->prStaRecOfAP != prStaRec)) {
2532 cnmStaRecChangeState(prAdapter, prP2pBssInfo->prStaRecOfAP, STA_STATE_1);
2534 cnmStaRecFree(prAdapter, prP2pBssInfo->prStaRecOfAP, TRUE);
2536 prP2pBssInfo->prStaRecOfAP = NULL;
2539 //4 <1.3> Update BSS_INFO_T
2540 p2pFuncUpdateBssInfoForJOIN(prAdapter, prP2pFsmInfo->prTargetBss, prStaRec, prAssocRspSwRfb);
2542 //4 <1.4> Activate current AP's STA_RECORD_T in Driver.
2543 cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_3);
2545 #if CFG_SUPPORT_P2P_RSSI_QUERY
2546 //<1.5> Update RSSI if necessary
2547 nicUpdateRSSI(prAdapter, NETWORK_TYPE_P2P_INDEX, (INT_8)(RCPI_TO_dBm(prStaRec->ucRCPI)), 0);
2550 //4 <1.6> Indicate Connected Event to Host immediately.
2551 /* Require BSSID, Association ID, Beacon Interval.. from AIS_BSS_INFO_T */
2552 //p2pIndicationOfMediaStateToHost(prAdapter, PARAM_MEDIA_STATE_CONNECTED, prStaRec->aucMacAddr);
2553 kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo,
2554 &prP2pFsmInfo->rConnReqInfo,
2555 prJoinInfo->aucIEBuf,
2556 prJoinInfo->u4BufLength,
2557 prStaRec->u2StatusCode);
2562 //4 <2.1> Redo JOIN process with other Auth Type if possible
2563 if (p2pFuncRetryJOIN(prAdapter, prStaRec, prJoinInfo) == FALSE) {
2564 P_BSS_DESC_T prBssDesc;
2566 /* Increase Failure Count */
2567 prStaRec->ucJoinFailureCount++;
2569 prBssDesc = prP2pFsmInfo->prTargetBss;
2572 ASSERT(prBssDesc->fgIsConnecting);
2574 prBssDesc->fgIsConnecting = FALSE;
2576 if( prStaRec->ucJoinFailureCount >=3) {
2578 kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo,
2579 &prP2pFsmInfo->rConnReqInfo,
2580 prJoinInfo->aucIEBuf,
2581 prJoinInfo->u4BufLength,
2582 prStaRec->u2StatusCode);
2585 /* Sometime the GO is not ready to response auth. Connect it again*/
2586 prP2pFsmInfo->prTargetBss = NULL;
2596 if (prAssocRspSwRfb) {
2597 nicRxReturnRFB(prAdapter, prAssocRspSwRfb);
2600 if (prP2pFsmInfo->eCurrentState == P2P_STATE_GC_JOIN) {
2602 if(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX].eConnectionState == PARAM_MEDIA_STATE_CONNECTED) {
2603 /* Return to IDLE state. */
2604 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
2607 //p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
2609 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_SCAN);
2616 cnmMemFree(prAdapter, prMsgHdr);
2621 } /* p2pFsmRunEventJoinComplete */
2626 p2pFsmRunEventMgmtFrameRegister (
2627 IN P_ADAPTER_T prAdapter,
2628 IN P_MSG_HDR_T prMsgHdr
2631 P_MSG_P2P_MGMT_FRAME_REGISTER_T prMgmtFrameRegister = (P_MSG_P2P_MGMT_FRAME_REGISTER_T)NULL;
2632 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2635 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
2637 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2639 if (prP2pFsmInfo == NULL) {
2643 prMgmtFrameRegister = (P_MSG_P2P_MGMT_FRAME_REGISTER_T)prMsgHdr;
2645 p2pFuncMgmtFrameRegister(prAdapter,
2646 prMgmtFrameRegister->u2FrameType,
2647 prMgmtFrameRegister->fgIsRegister,
2648 &prP2pFsmInfo->u4P2pPacketFilter);
2654 cnmMemFree(prAdapter, prMsgHdr);
2659 } /* p2pFsmRunEventMgmtFrameRegister */
2665 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2666 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2667 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2668 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2669 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2670 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2671 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2672 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2673 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2674 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2675 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2676 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2677 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2678 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2687 /*----------------------------------------------------------------------------*/
2689 * \brief This function is call when RX deauthentication frame from the AIR.
2690 * If we are under STA mode, we would go back to P2P Device.
2691 * If we are under AP mode, we would stay in AP mode until disconnect event from HOST.
2693 * \param[in] prAdapter Pointer of ADAPTER_T
2697 /*----------------------------------------------------------------------------*/
2699 p2pFsmRunEventRxDeauthentication (
2700 IN P_ADAPTER_T prAdapter,
2701 IN P_STA_RECORD_T prStaRec,
2702 IN P_SW_RFB_T prSwRfb
2705 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2706 UINT_16 u2ReasonCode = 0;
2709 ASSERT_BREAK((prAdapter != NULL) && (prSwRfb != NULL));
2711 if (prStaRec == NULL) {
2712 prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx);
2720 prP2pBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX];
2722 if (prStaRec->ucStaState == STA_STATE_1) {
2726 DBGLOG(P2P, TRACE, ("RX Deauth\n"));
2728 switch (prP2pBssInfo->eCurrentOPMode) {
2729 case OP_MODE_INFRASTRUCTURE:
2730 if (authProcessRxDeauthFrame(prSwRfb,
2731 prStaRec->aucMacAddr,
2732 &u2ReasonCode) == WLAN_STATUS_SUCCESS) {
2733 P_WLAN_DEAUTH_FRAME_T prDeauthFrame = (P_WLAN_DEAUTH_FRAME_T)prSwRfb->pvHeader;
2734 UINT_16 u2IELength = 0;
2736 if (prP2pBssInfo->prStaRecOfAP != prStaRec) {
2741 prStaRec->u2ReasonCode = u2ReasonCode;
2742 u2IELength = prSwRfb->u2PacketLen - (WLAN_MAC_HEADER_LEN + REASON_CODE_FIELD_LEN);
2744 ASSERT(prP2pBssInfo->prStaRecOfAP == prStaRec);
2746 /* Indicate disconnect to Host. */
2747 kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo,
2749 prDeauthFrame->aucInfoElem,
2753 prP2pBssInfo->prStaRecOfAP = NULL;
2755 p2pFuncDisconnect(prAdapter, prStaRec, FALSE, u2ReasonCode);
2758 case OP_MODE_ACCESS_POINT:
2759 /* Delete client from client list. */
2760 if (authProcessRxDeauthFrame(prSwRfb,
2761 prP2pBssInfo->aucBSSID,
2762 &u2ReasonCode) == WLAN_STATUS_SUCCESS) {
2763 P_LINK_T prStaRecOfClientList = (P_LINK_T)NULL;
2764 P_LINK_ENTRY_T prLinkEntry = (P_LINK_ENTRY_T)NULL;
2765 P_STA_RECORD_T prCurrStaRec = (P_STA_RECORD_T)NULL;
2767 prStaRecOfClientList = &prP2pBssInfo->rStaRecOfClientList;
2769 LINK_FOR_EACH(prLinkEntry, prStaRecOfClientList) {
2770 prCurrStaRec = LINK_ENTRY(prLinkEntry, STA_RECORD_T, rLinkEntry);
2772 ASSERT(prCurrStaRec);
2774 if (EQUAL_MAC_ADDR(prCurrStaRec->aucMacAddr, prStaRec->aucMacAddr)) {
2776 /* Remove STA from client list. */
2777 LINK_REMOVE_KNOWN_ENTRY(prStaRecOfClientList, &prCurrStaRec->rLinkEntry);
2779 /* Indicate to Host. */
2780 //kalP2PGOStationUpdate(prAdapter->prGlueInfo, prStaRec, FALSE);
2782 /* Indicate disconnect to Host. */
2783 p2pFuncDisconnect(prAdapter, prStaRec, FALSE, u2ReasonCode);
2790 case OP_MODE_P2P_DEVICE:
2792 /* Findout why someone sent deauthentication frame to us. */
2797 DBGLOG(P2P, TRACE, ("Deauth Reason:%d\n", u2ReasonCode));
2802 } /* p2pFsmRunEventRxDeauthentication */
2804 /*----------------------------------------------------------------------------*/
2806 * \brief This function is call when RX deauthentication frame from the AIR.
2807 * If we are under STA mode, we would go back to P2P Device.
2808 * If we are under AP mode, we would stay in AP mode until disconnect event from HOST.
2810 * \param[in] prAdapter Pointer of ADAPTER_T
2814 /*----------------------------------------------------------------------------*/
2816 p2pFsmRunEventRxDisassociation (
2817 IN P_ADAPTER_T prAdapter,
2818 IN P_STA_RECORD_T prStaRec,
2819 IN P_SW_RFB_T prSwRfb
2822 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2823 UINT_16 u2ReasonCode = 0;
2826 ASSERT_BREAK((prAdapter != NULL) && (prSwRfb != NULL));
2828 if (prStaRec == NULL) {
2829 prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx);
2833 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2835 if (prStaRec->ucStaState == STA_STATE_1) {
2840 DBGLOG(P2P, TRACE, ("RX Disassoc\n"));
2842 switch (prP2pBssInfo->eCurrentOPMode) {
2843 case OP_MODE_INFRASTRUCTURE:
2844 if (assocProcessRxDisassocFrame(prAdapter,
2846 prStaRec->aucMacAddr,
2847 &prStaRec->u2ReasonCode) == WLAN_STATUS_SUCCESS) {
2848 P_WLAN_DISASSOC_FRAME_T prDisassocFrame = (P_WLAN_DISASSOC_FRAME_T)prSwRfb->pvHeader;
2849 UINT_16 u2IELength = 0;
2851 ASSERT(prP2pBssInfo->prStaRecOfAP == prStaRec);
2853 if (prP2pBssInfo->prStaRecOfAP != prStaRec) {
2858 u2IELength = prSwRfb->u2PacketLen - (WLAN_MAC_HEADER_LEN + REASON_CODE_FIELD_LEN);
2860 /* Indicate disconnect to Host. */
2861 kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo,
2863 prDisassocFrame->aucInfoElem,
2865 prStaRec->u2ReasonCode);
2867 prP2pBssInfo->prStaRecOfAP = NULL;
2869 p2pFuncDisconnect(prAdapter, prStaRec, FALSE, prStaRec->u2ReasonCode);
2873 case OP_MODE_ACCESS_POINT:
2874 /* Delete client from client list. */
2875 if (assocProcessRxDisassocFrame(prAdapter,
2877 prP2pBssInfo->aucBSSID,
2878 &u2ReasonCode) == WLAN_STATUS_SUCCESS) {
2879 P_LINK_T prStaRecOfClientList = (P_LINK_T)NULL;
2880 P_LINK_ENTRY_T prLinkEntry = (P_LINK_ENTRY_T)NULL;
2881 P_STA_RECORD_T prCurrStaRec = (P_STA_RECORD_T)NULL;
2883 prStaRecOfClientList = &prP2pBssInfo->rStaRecOfClientList;
2885 LINK_FOR_EACH(prLinkEntry, prStaRecOfClientList) {
2886 prCurrStaRec = LINK_ENTRY(prLinkEntry, STA_RECORD_T, rLinkEntry);
2888 ASSERT(prCurrStaRec);
2890 if (EQUAL_MAC_ADDR(prCurrStaRec->aucMacAddr, prStaRec->aucMacAddr)) {
2892 /* Remove STA from client list. */
2893 LINK_REMOVE_KNOWN_ENTRY(prStaRecOfClientList, &prCurrStaRec->rLinkEntry);
2895 /* Indicate to Host. */
2896 //kalP2PGOStationUpdate(prAdapter->prGlueInfo, prStaRec, FALSE);
2898 /* Indicate disconnect to Host. */
2899 p2pFuncDisconnect(prAdapter, prStaRec, FALSE, u2ReasonCode);
2906 case OP_MODE_P2P_DEVICE:
2916 } /* p2pFsmRunEventRxDisassociation */
2922 /*----------------------------------------------------------------------------*/
2924 * \brief This function is called when a probe request frame is received.
2926 * \param[in] prAdapter Pointer of ADAPTER_T
2928 * \return boolean value if probe response frame is accepted & need cancel scan request.
2930 /*----------------------------------------------------------------------------*/
2932 p2pFsmRunEventRxProbeResponseFrame (
2933 IN P_ADAPTER_T prAdapter,
2934 IN P_SW_RFB_T prSwRfb,
2935 IN P_BSS_DESC_T prBssDesc
2938 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2939 P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = (P_P2P_CONNECTION_SETTINGS_T)NULL;
2940 P_WLAN_MAC_MGMT_HEADER_T prMgtHdr = (P_WLAN_MAC_MGMT_HEADER_T)NULL;
2941 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2944 ASSERT_BREAK((prAdapter != NULL) && (prSwRfb != NULL) && (prBssDesc != NULL));
2946 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2947 prP2pConnSettings = prAdapter->rWifiVar.prP2PConnSettings;
2948 prP2pBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX];
2950 /* There is a connection request. */
2951 prMgtHdr = (P_WLAN_MAC_MGMT_HEADER_T)prSwRfb->pvHeader;
2956 } /* p2pFsmRunEventRxProbeResponseFrame */
2964 p2pFsmRunEventBeaconTimeout (
2965 IN P_ADAPTER_T prAdapter
2968 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2969 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2972 ASSERT_BREAK(prAdapter != NULL);
2974 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2975 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2977 DBGLOG(P2P, TRACE, ("p2pFsmRunEventBeaconTimeout: Beacon Timeout\n"));
2979 /* Only client mode would have beacon lost event. */
2980 ASSERT(prP2pBssInfo->eCurrentOPMode == OP_MODE_INFRASTRUCTURE);
2982 if (prP2pBssInfo->eConnectionState == PARAM_MEDIA_STATE_CONNECTED) {
2983 /* Indicate disconnect to Host. */
2984 kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo,
2988 REASON_CODE_DISASSOC_INACTIVITY);
2990 if (prP2pBssInfo->prStaRecOfAP != NULL) {
2991 P_STA_RECORD_T prStaRec = prP2pBssInfo->prStaRecOfAP;
2993 prP2pBssInfo->prStaRecOfAP = NULL;
2995 p2pFuncDisconnect(prAdapter, prStaRec, FALSE, REASON_CODE_DISASSOC_LEAVING_BSS);
2997 //20120830 moved into p2pFuncDisconnect()
2998 //cnmStaRecFree(prAdapter, prP2pBssInfo->prStaRecOfAP, TRUE);
3006 } /* p2pFsmRunEventBeaconTimeout */
3013 p2pFsmRunEventWfdSettingUpdate (
3014 IN P_ADAPTER_T prAdapter,
3015 IN P_MSG_HDR_T prMsgHdr
3018 P_WFD_CFG_SETTINGS_T prWfdCfgSettings = (P_WFD_CFG_SETTINGS_T)NULL;
3019 P_MSG_WFD_CONFIG_SETTINGS_CHANGED_T prMsgWfdCfgSettings = (P_MSG_WFD_CONFIG_SETTINGS_CHANGED_T)NULL;
3020 WLAN_STATUS rStatus;
3023 DBGLOG(P2P, INFO,("p2pFsmRunEventWfdSettingUpdate\n"));
3026 ASSERT_BREAK((prAdapter != NULL));
3028 if (prMsgHdr != NULL) {
3029 prMsgWfdCfgSettings = (P_MSG_WFD_CONFIG_SETTINGS_CHANGED_T)prMsgHdr;
3030 prWfdCfgSettings = prMsgWfdCfgSettings->prWfdCfgSettings;
3033 prWfdCfgSettings = &prAdapter->rWifiVar.prP2pFsmInfo->rWfdConfigureSettings;
3036 DBGLOG(P2P, INFO,("WFD Enalbe %x info %x state %x flag %x adv %x\n",
3037 prWfdCfgSettings->ucWfdEnable,
3038 prWfdCfgSettings->u2WfdDevInfo,
3039 prWfdCfgSettings->u4WfdState,
3040 prWfdCfgSettings->u4WfdFlag,
3041 prWfdCfgSettings->u4WfdAdvancedFlag));
3043 rStatus = wlanSendSetQueryCmd (
3044 prAdapter, /* prAdapter */
3045 CMD_ID_SET_WFD_CTRL, /* ucCID */
3046 TRUE, /* fgSetQuery */
3047 FALSE, /* fgNeedResp */
3048 FALSE, /* fgIsOid */
3050 NULL, /* pfCmdTimeoutHandler */
3051 sizeof(WFD_CFG_SETTINGS_T), /* u4SetQueryInfoLen */
3052 (PUINT_8)prWfdCfgSettings, /* pucInfoBuffer */
3053 NULL, /* pvSetQueryBuffer */
3054 0 /* u4SetQueryBufferLen */
3062 /* p2pFsmRunEventWfdSettingUpdate */
3073 /*----------------------------------------------------------------------------*/
3075 * @brief This function is used to generate P2P IE for Beacon frame.
3077 * @param[in] prMsduInfo Pointer to the composed MSDU_INFO_T.
3081 /*----------------------------------------------------------------------------*/
3083 p2pGenerateP2P_IEForAssocReq (
3084 IN P_ADAPTER_T prAdapter,
3085 IN P_MSDU_INFO_T prMsduInfo
3088 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
3089 P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL;
3092 ASSERT_BREAK((prAdapter != NULL) && (prMsduInfo != NULL));
3094 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
3096 prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex);
3098 if (IS_STA_P2P_TYPE(prStaRec)) {
3106 } /* end of p2pGenerateP2P_IEForAssocReq() */
3111 /*----------------------------------------------------------------------------*/
3113 * @brief This function is used to generate P2P IE for Probe Request frame.
3115 * @param[in] prMsduInfo Pointer to the composed MSDU_INFO_T.
3119 /*----------------------------------------------------------------------------*/
3121 p2pGenerateP2P_IEForProbeReq (
3122 IN P_ADAPTER_T prAdapter,
3123 IN PUINT_16 pu2Offset,
3125 IN UINT_16 u2BufSize
3135 } /* end of p2pGenerateP2P_IEForProbReq() */
3140 /*----------------------------------------------------------------------------*/
3142 * @brief This function is used to calculate P2P IE length for Beacon frame.
3144 * @param[in] eNetTypeIndex Specify which network
3145 * @param[in] prStaRec Pointer to the STA_RECORD_T
3147 * @return The length of P2P IE added
3149 /*----------------------------------------------------------------------------*/
3151 p2pCalculateP2P_IELenForProbeReq (
3152 IN P_ADAPTER_T prAdapter,
3153 IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex,
3154 IN P_STA_RECORD_T prStaRec
3158 if (eNetTypeIndex != NETWORK_TYPE_P2P_INDEX) {
3166 } /* end of p2pCalculateP2P_IELenForProbeReq() */
3172 /*----------------------------------------------------------------------------*/
3174 * @brief This function will indiate the Event of Tx Fail of AAA Module.
3176 * @param[in] prAdapter Pointer to the Adapter structure.
3177 * @param[in] prStaRec Pointer to the STA_RECORD_T
3181 /*----------------------------------------------------------------------------*/
3183 p2pRunEventAAATxFail (
3184 IN P_ADAPTER_T prAdapter,
3185 IN P_STA_RECORD_T prStaRec
3188 P_BSS_INFO_T prBssInfo;
3194 prBssInfo = &(prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex]);
3196 bssRemoveStaRecFromClientList(prAdapter, prBssInfo, prStaRec);
3198 p2pFuncDisconnect(prAdapter, prStaRec, FALSE, REASON_CODE_UNSPECIFIED);
3201 //20120830 moved into p2puUncDisconnect.
3202 //cnmStaRecFree(prAdapter, prStaRec, TRUE);
3205 } /* p2pRunEventAAATxFail */
3208 /*----------------------------------------------------------------------------*/
3210 * @brief This function will indiate the Event of Successful Completion of AAA Module.
3212 * @param[in] prAdapter Pointer to the Adapter structure.
3213 * @param[in] prStaRec Pointer to the STA_RECORD_T
3217 /*----------------------------------------------------------------------------*/
3219 p2pRunEventAAAComplete (
3220 IN P_ADAPTER_T prAdapter,
3221 IN P_STA_RECORD_T prStaRec
3224 WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS;
3225 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
3226 ENUM_PARAM_MEDIA_STATE_T eOriMediaState;
3229 ASSERT_BREAK((prAdapter != NULL) && (prStaRec != NULL));
3231 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
3233 eOriMediaState = prP2pBssInfo->eConnectionState;
3235 bssRemoveStaRecFromClientList(prAdapter, prP2pBssInfo, prStaRec);
3237 if (prP2pBssInfo->rStaRecOfClientList.u4NumElem > P2P_MAXIMUM_CLIENT_COUNT ||
3238 kalP2PMaxClients(prAdapter->prGlueInfo, prP2pBssInfo->rStaRecOfClientList.u4NumElem)) {
3239 rStatus = WLAN_STATUS_RESOURCES;
3243 bssAddStaRecToClientList(prAdapter, prP2pBssInfo, prStaRec);
3245 prStaRec->u2AssocId = bssAssignAssocID(prStaRec);
3247 if (prP2pBssInfo->rStaRecOfClientList.u4NumElem > P2P_MAXIMUM_CLIENT_COUNT ||
3248 kalP2PMaxClients(prAdapter->prGlueInfo, prP2pBssInfo->rStaRecOfClientList.u4NumElem)) {
3249 rStatus = WLAN_STATUS_RESOURCES;
3253 cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_3);
3255 p2pChangeMediaState(prAdapter, PARAM_MEDIA_STATE_CONNECTED);
3257 /* Update Connected state to FW. */
3258 if (eOriMediaState != prP2pBssInfo->eConnectionState) {
3259 nicUpdateBss(prAdapter, NETWORK_TYPE_P2P_INDEX);
3265 } /* p2pRunEventAAAComplete */
3268 /*----------------------------------------------------------------------------*/
3270 * @brief This function will indiate the Event of Successful Completion of AAA Module.
3272 * @param[in] prAdapter Pointer to the Adapter structure.
3273 * @param[in] prStaRec Pointer to the STA_RECORD_T
3277 /*----------------------------------------------------------------------------*/
3279 p2pRunEventAAASuccess (
3280 IN P_ADAPTER_T prAdapter,
3281 IN P_STA_RECORD_T prStaRec
3284 WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS;
3287 ASSERT_BREAK((prAdapter != NULL) && (prStaRec != NULL));
3289 /* Glue layer indication. */
3290 kalP2PGOStationUpdate(prAdapter->prGlueInfo, prStaRec, TRUE);
3295 } /* p2pRunEventAAASuccess */
3299 /*----------------------------------------------------------------------------*/
3307 /*----------------------------------------------------------------------------*/
3309 p2pRxPublicActionFrame (
3310 IN P_ADAPTER_T prAdapter,
3311 IN P_SW_RFB_T prSwRfb
3314 WLAN_STATUS rWlanStatus = WLAN_STATUS_SUCCESS;
3315 P_P2P_PUBLIC_ACTION_FRAME_T prPublicActionFrame = (P_P2P_PUBLIC_ACTION_FRAME_T)NULL;
3316 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
3323 prPublicActionFrame = (P_P2P_PUBLIC_ACTION_FRAME_T)prSwRfb->pvHeader;
3324 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
3326 DBGLOG(P2P, TRACE, ("RX Public Action Frame Token:%d.\n", prPublicActionFrame->ucDialogToken));
3328 if (prPublicActionFrame->ucCategory != CATEGORY_PUBLIC_ACTION) {
3332 switch (prPublicActionFrame->ucAction) {
3333 case ACTION_PUBLIC_WIFI_DIRECT:
3335 case ACTION_GAS_INITIAL_REQUEST:
3336 case ACTION_GAS_INITIAL_RESPONSE:
3337 case ACTION_GAS_COMEBACK_REQUEST:
3338 case ACTION_GAS_COMEBACK_RESPONSE:
3345 } /* p2pRxPublicActionFrame */
3351 IN P_ADAPTER_T prAdapter,
3352 IN P_SW_RFB_T prSwRfb
3355 WLAN_STATUS rWlanStatus = WLAN_STATUS_SUCCESS;
3356 P_P2P_ACTION_FRAME_T prP2pActionFrame = (P_P2P_ACTION_FRAME_T)NULL;
3357 UINT_8 aucOui[3] = VENDOR_OUI_WFA_SPECIFIC;
3360 ASSERT_BREAK((prAdapter != NULL) && (prSwRfb != NULL));
3362 prP2pActionFrame = (P_P2P_ACTION_FRAME_T)prSwRfb->pvHeader;
3364 if (prP2pActionFrame->ucCategory != CATEGORY_VENDOR_SPECIFIC_ACTION) {
3365 DBGLOG(P2P, TRACE, ("RX Action Frame but not vendor specific.\n"));
3370 if ((prP2pActionFrame->ucOuiType != VENDOR_OUI_TYPE_P2P) ||
3371 (prP2pActionFrame->aucOui[0] != aucOui[0]) ||
3372 (prP2pActionFrame->aucOui[1] != aucOui[1]) ||
3373 (prP2pActionFrame->aucOui[2] != aucOui[2])) {
3374 DBGLOG(P2P, TRACE, ("RX Vendor Specific Action Frame but not P2P Type or not WFA OUI.\n"));
3381 } /* p2pRxActionFrame */
3385 p2pProcessEvent_UpdateNOAParam (
3386 IN P_ADAPTER_T prAdapter,
3387 UINT_8 ucNetTypeIndex,
3388 P_EVENT_UPDATE_NOA_PARAMS_T prEventUpdateNoaParam
3391 P_BSS_INFO_T prBssInfo = (P_BSS_INFO_T)NULL;
3392 P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo;
3394 BOOLEAN fgNoaAttrExisted = FALSE;
3396 prBssInfo = &(prAdapter->rWifiVar.arBssInfo[ucNetTypeIndex]);
3397 prP2pSpecificBssInfo = prAdapter->rWifiVar.prP2pSpecificBssInfo;
3399 prP2pSpecificBssInfo->fgEnableOppPS = prEventUpdateNoaParam->fgEnableOppPS;
3400 prP2pSpecificBssInfo->u2CTWindow = prEventUpdateNoaParam->u2CTWindow;
3401 prP2pSpecificBssInfo->ucNoAIndex = prEventUpdateNoaParam->ucNoAIndex;
3402 prP2pSpecificBssInfo->ucNoATimingCount = prEventUpdateNoaParam->ucNoATimingCount;
3404 fgNoaAttrExisted |= prP2pSpecificBssInfo->fgEnableOppPS;
3407 ASSERT(prP2pSpecificBssInfo->ucNoATimingCount <= P2P_MAXIMUM_NOA_COUNT);
3409 for (i = 0; i < prP2pSpecificBssInfo->ucNoATimingCount; i++) {
3411 prP2pSpecificBssInfo->arNoATiming[i].fgIsInUse =
3412 prEventUpdateNoaParam->arEventNoaTiming[i].fgIsInUse;
3414 prP2pSpecificBssInfo->arNoATiming[i].ucCount =
3415 prEventUpdateNoaParam->arEventNoaTiming[i].ucCount;
3417 prP2pSpecificBssInfo->arNoATiming[i].u4Duration =
3418 prEventUpdateNoaParam->arEventNoaTiming[i].u4Duration;
3420 prP2pSpecificBssInfo->arNoATiming[i].u4Interval =
3421 prEventUpdateNoaParam->arEventNoaTiming[i].u4Interval;
3423 prP2pSpecificBssInfo->arNoATiming[i].u4StartTime =
3424 prEventUpdateNoaParam->arEventNoaTiming[i].u4StartTime;
3426 fgNoaAttrExisted |= prP2pSpecificBssInfo->arNoATiming[i].fgIsInUse;
3429 prP2pSpecificBssInfo->fgIsNoaAttrExisted = fgNoaAttrExisted;
3431 // update beacon content by the change
3432 bssUpdateBeaconContent(prAdapter, ucNetTypeIndex);
3435 #endif /* CFG_ENABLE_WIFI_DIRECT */