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 ** 07 29 2013 yuche.tsai
17 ** [ALPS00818788] [PreRC1][Mobile HotSpot]DUT should support hidden SSID broadcast for Mobile HotSpot
18 ** Support hidden SSID for MT6630.
19 ** FW Label: 20130729_ALPS_WIFI_FW_MT6620_V1_12
21 ** 12 20 2012 yuche.tsai
22 ** [ALPS00410124] [Rose][Free Test][KE][rlmUpdateParamsForAP]The device reboot automaticly and then "Fatal/Kernel" pops up during use data service.(Once)
23 ** Fix possible NULL station record cause KE under AP mode.
24 ** May due to variable uninitial.
25 ** Review: http://mtksap20:8080/go?page=NewReview&reviewid=49970
27 ** 09 12 2012 wcpadmin
28 ** [ALPS00276400] Remove MTK copyright and legal header on GPL/LGPL related packages
31 ** 08 31 2012 yuche.tsai
32 ** [ALPS00349585] [6577JB][WiFi direct][KE]Establish p2p connection while both device have connected to AP previously,one device reboots automatically with KE
33 ** Fix possible KE when concurrent & disconnect.
35 ** 08 21 2012 yuche.tsai
37 ** fix disconnect indication.
39 ** 08 16 2012 yuche.tsai
41 ** Fix compile warning.
43 ** 08 14 2012 yuche.tsai
45 ** Fix p2p bug find on ALPS.JB trunk.
47 ** 07 27 2012 yuche.tsai
48 ** [ALPS00324337] [ALPS.JB][Hot-Spot] Driver update for Hot-Spot
49 ** Update for driver unload KE issue.
51 ** 07 26 2012 yuche.tsai
52 ** [ALPS00324337] [ALPS.JB][Hot-Spot] Driver update for Hot-Spot
53 ** Update driver code of ALPS.JB for hot-spot.
55 ** 07 19 2012 yuche.tsai
57 ** Code update for JB.
59 * 07 17 2012 yuche.tsai
61 * Compile no error before trial run.
63 * 07 05 2011 yuche.tsai
64 * [WCXRP00000821] [Volunteer Patch][WiFi Direct][Driver] WiFi Direct Connection Speed Issue
65 * Fix the compile flag of enhancement.
67 * 07 05 2011 yuche.tsai
68 * [WCXRP00000808] [Volunteer Patch][MT6620][Driver/FW] Device discoverability issue fix
69 * Change device discoverability methodology. From driver SCAN to FW lock channel.
71 * 07 05 2011 yuche.tsai
72 * [WCXRP00000821] [Volunteer Patch][WiFi Direct][Driver] WiFi Direct Connection Speed Issue
73 * Add wifi direct connection enhancement method I, II & VI.
75 * 07 05 2011 yuche.tsai
76 * [WCXRP00000833] [Volunteer Patch][WiFi Direct][Driver] Service Discovery Frame RX Indicate Issue
77 * Fix Service Discovery Race Condition Issue.
80 * [WCXRP00000798] [MT6620 Wi-Fi][Firmware] Follow-ups for WAPI frequency offset workaround in firmware SCN module
81 * change parameter name from PeerAddr to BSSID
83 * 06 21 2011 yuche.tsai
84 * [WCXRP00000799] [Volunteer Patch][MT6620][Driver] Connection Indication Twice Issue.
85 * Fix an issue of accepting connection of GO.
87 * 06 21 2011 yuche.tsai
88 * [WCXRP00000775] [Volunteer Patch][MT6620][Driver] Dynamic enable SD capability
89 * Drop GAS frame when SD is not enabled.
91 * 06 20 2011 yuche.tsai
95 * 06 20 2011 yuche.tsai
96 * [WCXRP00000799] [Volunteer Patch][MT6620][Driver] Connection Indication Twice Issue.
97 * Fix connection indication twice issue.
100 * [WCXRP00000798] [MT6620 Wi-Fi][Firmware] Follow-ups for WAPI frequency offset workaround in firmware SCN module
101 * 1. specify target's BSSID when requesting channel privilege.
102 * 2. pass BSSID information to firmware domain
104 * 06 20 2011 yuche.tsai
105 * [WCXRP00000795] [Volunteer Patch][MT6620][Driver] GO can not connect second device issue
106 * Solve P2P GO can not formation with second device issue.
108 * 06 14 2011 yuche.tsai
110 * Change disconnect feature.
112 * 06 10 2011 yuche.tsai
113 * [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.
114 * 1. Dynamic enable SD capability after P2P supplicant ready.
115 * 2. Avoid response probe respone with p2p IE when under hot spot mode.
117 * 06 07 2011 yuche.tsai
118 * [WCXRP00000763] [Volunteer Patch][MT6620][Driver] RX Service Discovery Frame under AP mode Issue
119 * Fix RX SD request under AP mode issue.
122 * [WCXRP00000681] [MT5931][Firmware] HIF code size reduction
123 * eliminate unused parameters for SAA-FSM
125 * 05 26 2011 yuche.tsai
126 * [WCXRP00000745] Support accepting connection after one Group Connection Lost.
128 After Group Formation & lost connection, if MT6620 behave as:
130 1. GO: It would keep under GO state until been dissolved by supplicant.
132 At this time, other P2P device can use join method to join this group.
135 2. GC: It would keep on searching target GO or target device until been dissolved by supplicant.
137 At this time, it would ignore other P2P device formation request.
142 Modification: Make driver to accept GO NEGO REQ at this time, to let user decide to accept new connection or not.
144 * [Volunteer Patch][MT6620][Driver]
145 * Driver would indicate connection request, if password ID is not ready but connection request is issued.
147 * 05 18 2011 yuche.tsai
148 * [WCXRP00000728] [Volunteer Patch][MT6620][Driver] Service Discovery Request TX issue.
149 * A solution for both connection request & IO control.
151 * 05 16 2011 yuche.tsai
152 * [WCXRP00000728] [Volunteer Patch][MT6620][Driver] Service Discovery Request TX issue.
153 * Fix SD request can not send out issue.
155 * 05 09 2011 terry.wu
156 * [WCXRP00000711] [MT6620 Wi-Fi][Driver] Set Initial value of StaType in StaRec for Hotspot Client
157 * Set initial value of StaType in StaRec for hotspot client.
159 * 05 04 2011 yuche.tsai
160 * [WCXRP00000697] [Volunteer Patch][MT6620][Driver]
161 * Bug fix for p2p descriptor is NULL if BSS descriptor is found first.
163 * 05 04 2011 yuche.tsai
165 * Support partial persistent group function.
167 * 05 02 2011 yuche.tsai
168 * [WCXRP00000693] [Volunteer Patch][MT6620][Driver] Clear Formation Flag after TX lifetime timeout.
169 * Clear formation flag after formation timeout.
171 * 04 20 2011 yuche.tsai
172 * [WCXRP00000668] [Volunteer Patch][MT6620][Driver] Possible race condition when add scan & query scan result at the same time.
173 * Fix side effect while starting ATGO.
175 * 04 20 2011 yuche.tsai
177 * Fix ASSERT issue in FW, side effect of last change.
179 * 04 19 2011 yuche.tsai
180 * [WCXRP00000668] [Volunteer Patch][MT6620][Driver] Possible race condition when add scan & query scan result at the same time.
181 * Workaround for multiple device connection, before invitation ready.
183 * 04 19 2011 yuche.tsai
184 * [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.
185 * Support connection indication when GO NEGO REQ doesn't have configure method, instead it has PasswordID.
187 * 04 18 2011 yuche.tsai
191 * 04 14 2011 yuche.tsai
192 * [WCXRP00000646] [Volunteer Patch][MT6620][FW/Driver] Sigma Test Modification for some test case.
193 * Fix a connection issue.
195 * 04 14 2011 yuche.tsai
196 * [WCXRP00000646] [Volunteer Patch][MT6620][FW/Driver] Sigma Test Modification for some test case.
197 * Fix the channel issue of AP mode.
199 * 04 14 2011 yuche.tsai
200 * [WCXRP00000646] [Volunteer Patch][MT6620][FW/Driver] Sigma Test Modification for some test case.
201 * Connection flow refine for Sigma test.
203 * 04 09 2011 yuche.tsai
204 * [WCXRP00000624] [Volunteer Patch][MT6620][Driver] Add device discoverability support for GO.
205 * Fix Device discoverability related issue.
207 * 04 09 2011 yuche.tsai
208 * [WCXRP00000624] [Volunteer Patch][MT6620][Driver] Add device discoverability support for GO.
209 * Fix bug for Device Discoverability.
211 * 04 08 2011 yuche.tsai
212 * [WCXRP00000624] [Volunteer Patch][MT6620][Driver] Add device discoverability support for GO.
215 * 04 08 2011 yuche.tsai
216 * [WCXRP00000624] [Volunteer Patch][MT6620][Driver] Add device discoverability support for GO.
217 * Add device discoverability support.
219 * 03 28 2011 yuche.tsai
221 * Fix a possible issue for retry join when media status connected.
223 * 03 25 2011 yuche.tsai
225 * Improve some error handleing.
227 * 03 24 2011 yuche.tsai
229 * Assign AID before change STA_REC state to state 3.
231 * 03 23 2011 yuche.tsai
233 * Fix Response Rate Issue when TX Auth Rsp Frame under P2P Mode.
235 * 03 23 2011 yuche.tsai
237 * Fix issue of connection to one GC.
239 * 03 23 2011 yuche.tsai
241 * Fix ASSERT issue when starting Hot-spot.
243 * 03 22 2011 yuche.tsai
245 * When Target Information is not available, change to passive mode.
247 * 03 22 2011 yuche.tsai
249 * Fix one connection issue while using Keypad to connect a GO.
251 * 03 22 2011 yuche.tsai
253 * 1. Fix two issues that may cause kernel panic.
255 * 03 22 2011 yuche.tsai
257 * Fix GC connect to other device issue.
259 * 03 22 2011 yuche.tsai
261 * 1.Shorten the LISTEN interval.
262 * 2. Fix IF address issue when we are GO
263 * 3. Fix LISTEN channel issue.
265 * 03 22 2011 yuche.tsai
267 * Modify formation policy setting.
269 * 03 21 2011 yuche.tsai
271 * Solve Listen State doesn't response probe response issue.
273 * 03 21 2011 yuche.tsai
275 * Change P2P Connection Request Flow.
277 * 03 19 2011 yuche.tsai
278 * [WCXRP00000584] [Volunteer Patch][MT6620][Driver] Add beacon timeout support for WiFi Direct.
279 * Add beacon timeout support.
281 * 03 19 2011 yuche.tsai
282 * [WCXRP00000583] [Volunteer Patch][MT6620][Driver] P2P connection of the third peer issue
283 * Indicate the correct Group SSID when join on Group.
285 * 03 19 2011 yuche.tsai
286 * [WCXRP00000583] [Volunteer Patch][MT6620][Driver] P2P connection of the third peer issue
287 * Support the third P2P device to join GO/GC group.
289 * 03 19 2011 yuche.tsai
290 * [WCXRP00000581] [Volunteer Patch][MT6620][Driver] P2P IE in Assoc Req Issue
291 * Append P2P IE in Assoc Req, so that GC can be discovered in probe response of GO.
293 * 03 18 2011 yuche.tsai
294 * [WCXRP00000578] [Volunteer Patch][MT6620][Driver] Separate Connection Request from general IOCTL
295 * Separate connection request from general IOCTL.
297 * 03 18 2011 yuche.tsai
298 * [WCXRP00000574] [Volunteer Patch][MT6620][Driver] Modify P2P FSM Connection Flow
299 * Modify connection flow after Group Formation Complete, or device connect to a GO.
300 * Instead of request channel & connect directly, we use scan to allocate channel bandwidth & connect after RX BCN.
302 * 03 17 2011 yuche.tsai
304 * When AIS is connect to an AP, Hot Spot would be enabled under fixed same channel.
306 * 03 17 2011 yuche.tsai
308 * Solve the Group Info IE in Probe Response incorrect issue.
310 * 03 17 2011 yuche.tsai
312 * Release Channel after Join Complete.
315 * [WCXRP00000530] [MT6620 Wi-Fi] [Driver] skip doing p2pRunEventAAAComplete after send assoc response Tx Done
316 * enable the protected while at P2P start GO, and skip some security check .
318 * 03 15 2011 yuche.tsai
319 * [WCXRP00000560] [Volunteer Patch][MT6620][Driver] P2P Connection from UI using KEY/DISPLAY issue
320 * Fix local configure method issue.
322 * 03 15 2011 yuche.tsai
323 * [WCXRP00000560] [Volunteer Patch][MT6620][Driver] P2P Connection from UI using KEY/DISPLAY issue
324 * Fix some configure method issue.
326 * 03 14 2011 yuche.tsai
330 * 03 14 2011 yuche.tsai
332 * Fix password ID issue.
334 * 03 10 2011 yuche.tsai
338 * 03 08 2011 yuche.tsai
339 * [WCXRP00000480] [Volunteer Patch][MT6620][Driver] WCS IE format issue[WCXRP00000509] [Volunteer Patch][MT6620][Driver] Kernal panic when remove p2p module.
342 * 03 07 2011 yuche.tsai
343 * [WCXRP00000502] [Volunteer Patch][MT6620][Driver] Fix group ID issue when doing Group Formation.
347 * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code
348 * rename the define to anti_pviracy.
351 * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code
352 * add the code to get the check rsponse and indicate to app.
355 * [WCXRP00000510] [MT6620 Wi-Fi] [Driver] Fixed the CTIA enter test mode issue
356 * fixed the p2p action frame type check for device request indication.
358 * 03 02 2011 yuche.tsai
359 * [WCXRP00000245] 1. Invitation Request/Response.
360 2. Provision Discovery Request/Response
362 * Fix Service Discovery RX packet buffer pointer.
364 * 03 01 2011 yuche.tsai
365 * [WCXRP00000501] [Volunteer Patch][MT6620][Driver] No common channel issue when doing GO formation
366 * Update channel issue when doing GO formation..
368 * 03 01 2011 yuche.tsai
369 * [WCXRP00000245] 1. Invitation Request/Response.
370 2. Provision Discovery Request/Response
372 * Update Service Discovery Related wlanoid function.
374 * 02 21 2011 yuche.tsai
375 * [WCXRP00000481] [Volunteer Patch][MT6620][FW] Scan hang under concurrent case.
376 * Fix all BE issue of WSC or P2P IE.
379 * [WCXRP00000471] [MT6620 Wi-Fi][Driver] Add P2P Provison discovery append Config Method attribute at WSC IE
380 * fixed the wsc config method mapping to driver used config method issue.
382 * 02 18 2011 yuche.tsai
383 * [WCXRP00000479] [Volunteer Patch][MT6620][Driver] Probe Response of P2P using 11b rate.
384 * Update basic rate to FW, after P2P is initialed.
386 * 02 18 2011 yuche.tsai
387 * [WCXRP00000478] [Volunteer Patch][MT6620][Driver] Probe request frame during search phase do not contain P2P wildcard SSID.
388 * Use P2P Wildcard SSID when scan type of P2P_WILDCARD_SSID is set.
390 * 02 18 2011 yuche.tsai
391 * [WCXRP00000480] [Volunteer Patch][MT6620][Driver] WCS IE format issue
392 * Fix WSC IE BE format issue.
395 * [WCXRP00000471] [MT6620 Wi-Fi][Driver] Add P2P Provison discovery append Config Method attribute at WSC IE
396 * append the WSC IE config method attribute at provision discovery request.
399 * [WCXRP00000448] [MT6620 Wi-Fi][Driver] Fixed WSC IE not send out at probe request
400 * fixed the probe request send out without WSC IE issue (at P2P).
402 * 02 16 2011 yuche.tsai
403 * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode.
404 * If two station connected to the Hot-Spot and one disconnect, FW would get into an infinite loop
406 * 02 15 2011 yuche.tsai
407 * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode.
408 * Fix re-connection issue after RX deauthentication.
410 * 02 15 2011 yuche.tsai
411 * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode.
412 * Fix conneciton issue after disconnect with AP.
414 * 02 12 2011 yuche.tsai
415 * [WCXRP00000441] [Volunteer Patch][MT6620][Driver] BoW can not create desired station type when Hot Spot is enabled.
416 * P2P Create Station Type according to Target BSS capability.
418 * 02 10 2011 yuche.tsai
419 * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode.
420 * Support Disassoc & Deauthentication for Hot-Spot.
422 * 02 09 2011 yuche.tsai
423 * [WCXRP00000245] 1. Invitation Request/Response.
424 2. Provision Discovery Request/Response
426 * Add Service Discovery Indication Related code.
428 * 02 09 2011 yuche.tsai
429 * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode.
430 * Add Support for MLME deauthentication for Hot-Spot.
432 * 02 09 2011 yuche.tsai
433 * [WCXRP00000429] [Volunteer Patch][MT6620][Driver] Hot Spot Client Limit Issue
434 * Fix Client Limit Issue.
436 * 02 08 2011 yuche.tsai
437 * [WCXRP00000419] [Volunteer Patch][MT6620/MT5931][Driver] Provide function of disconnect to target station for AAA module.
438 * Disconnect every station client when disolve on P2P group.
440 * 02 08 2011 yuche.tsai
441 * [WCXRP00000245] 1. Invitation Request/Response.
442 2. Provision Discovery Request/Response
444 * 1. Fix Service Disocvery Logical issue.
445 * 2. Fix a NULL pointer access violation issue when sending deauthentication packet to a class error station.
447 * 02 08 2011 yuche.tsai
448 * [WCXRP00000419] [Volunteer Patch][MT6620/MT5931][Driver] Provide function of disconnect to target station for AAA module.
449 * Workaround of disable P2P network.
451 * 02 08 2011 yuche.tsai
452 * [WCXRP00000421] [Volunteer Patch][MT6620][Driver] Fix incorrect SSID length Issue
453 * 1. Fixed SSID wrong length issue.
454 * 2. Under Hot Spot configuration, there won't be any P2P IE.
455 * 3. Under Hot Spot configuration, P2P FSM won't get into LISTEN state first.
457 * 01 27 2011 yuche.tsai
458 * [WCXRP00000399] [Volunteer Patch][MT6620/MT5931][Driver] Fix scan side effect after P2P module separate.
459 * Modify Start GO flow.
461 * 01 27 2011 yuche.tsai
462 * [WCXRP00000399] [Volunteer Patch][MT6620/MT5931][Driver] Fix scan side effect after P2P module separate.
463 * Fix desire phy type set issue.
465 * 01 27 2011 yuche.tsai
466 * [WCXRP00000399] [Volunteer Patch][MT6620/MT5931][Driver] Fix scan side effect after P2P module separate.
467 * Add desire phy type set phase I.
469 * 01 26 2011 yuche.tsai
470 * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record.
471 * Fix P2P Disconnect Issue.
473 * 01 26 2011 yuche.tsai
474 * [WCXRP00000245] 1. Invitation Request/Response.
475 2. Provision Discovery Request/Response
477 * Add Service Discovery Function.
479 * 01 26 2011 cm.chang
480 * [WCXRP00000395] [MT6620 Wi-Fi][Driver][FW] Search STA_REC with additional net type index argument
483 * 01 25 2011 yuche.tsai
484 * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record.
485 * Fix compile error when DBG is disabled.
487 * 01 25 2011 yuche.tsai
488 * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record.
489 * Change Station Type Definition.
491 * 01 19 2011 yuche.tsai
492 * [WCXRP00000353] [Volunteer Patch][MT6620][Driver] Desired Non-HT Rate Set update when STA record is created under AP Mode.
493 * Add P2P QoS Support.
495 * 01 19 2011 george.huang
496 * [WCXRP00000355] [MT6620 Wi-Fi] Set WMM-PS related setting with qualifying AP capability
497 * Null NOA attribute setting when no related parameters.
499 * 01 14 2011 yuche.tsai
500 * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue
501 * Modify AAA flow according to CM's comment.
503 * 01 13 2011 yuche.tsai
504 * [WCXRP00000353] [Volunteer Patch][MT6620][Driver] Desired Non-HT Rate Set update when STA record is created under AP Mode.
505 * Resolve Channel ZERO issue. (Uninitialized default channel)
507 * 01 13 2011 yuche.tsai
508 * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue
509 * Update P2P State Debug Message.
511 * 01 12 2011 yuche.tsai
512 * [WCXRP00000353] [Volunteer Patch][MT6620][Driver] Desired Non-HT Rate Set update when STA record is created under AP Mode.
513 * Fix bug when allocating message buffer.
515 * 01 12 2011 yuche.tsai
516 * [WCXRP00000353] [Volunteer Patch][MT6620][Driver] Desired Non-HT Rate Set update when STA record is created under AP Mode.
517 * Update Phy Type Set. When legacy client is connected, it can use 11b rate,
518 * but if the P2P device is connected, 11b rate is not allowed.
520 * 01 12 2011 yuche.tsai
521 * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue
522 * 1. Modify Channel Acquire Time of AP mode from 5s to 1s.
523 * 2. Call cnmP2pIsPermit() before active P2P network.
524 * 3. Add channel selection support for AP mode.
526 * 01 12 2011 yuche.tsai
527 * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue
528 * Fix Bug of reference to NULL pointer.
530 * 01 12 2011 yuche.tsai
531 * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue
532 * Modify some behavior of AP mode.
534 * 01 12 2011 yuche.tsai
535 * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue
536 * Fix bug of wrong pointer check.
538 * 01 12 2011 yuche.tsai
539 * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue
542 * 01 11 2011 yuche.tsai
543 * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue
544 * Add station record into client list before change it state from STATE_2 to STATE_3.
546 * 01 05 2011 yuche.tsai
547 * [WCXRP00000345] [MT6620][Volunteer Patch] P2P may issue a SSID specified scan request, but the SSID length is still invalid.
548 * Specify SSID Type when issue a scan request.
551 * [WCXRP00000338] [MT6620 Wi-Fi][Driver] Separate kalMemAlloc into kmalloc and vmalloc implementations to ease physically continous memory demands
554 * 01 05 2011 george.huang
555 * [WCXRP00000343] [MT6620 Wi-Fi] Add TSF reset path for concurrent operation
556 * modify NOA update path for preventing assertion false alarm.
559 * [WCXRP00000338] [MT6620 Wi-Fi][Driver] Separate kalMemAlloc into kmalloc and vmalloc implementations to ease physically continous memory demands
560 * separate kalMemAlloc() into virtually-continous and physically-continous type to ease slab system pressure
563 * [WCXRP00000326] [MT6620][Wi-Fi][Driver] check in the binary format gl_sec.o.new instead of use change type!!!
564 * let the p2p ap mode acept a legacy device join.
566 * 12 22 2010 yuche.tsai
567 * [WCXRP00000245] 1. Invitation Request/Response.
568 2. Provision Discovery Request/Response
572 * 12 15 2010 yuche.tsai
573 * [WCXRP00000245] 1. Invitation Request/Response.
574 2. Provision Discovery Request/Response
576 * Refine Connection Flow.
578 * 12 08 2010 yuche.tsai
579 * [WCXRP00000245] [MT6620][Driver] Invitation & Provision Discovery Feature Check-in
580 * [WCXRP000000245][MT6620][Driver] Invitation Request Feature Add
582 * 12 08 2010 yuche.tsai
583 * [WCXRP00000244] [MT6620][Driver] Add station record type for each client when in AP mode.
584 * 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.
586 * 12 07 2010 cm.chang
587 * [WCXRP00000239] MT6620 Wi-Fi][Driver][FW] Merge concurrent branch back to maintrunk
588 * The order of invoking nicUpdateBss() and rlm functions
590 * 12 02 2010 yuche.tsai
592 * Update P2P Connection Policy for Invitation.
594 * 12 02 2010 yuche.tsai
596 * Update P2P Connection Policy for Invitation & Provision Discovery.
598 * 11 30 2010 yuche.tsai
600 * Invitation & Provision Discovery Indication.
602 * 11 30 2010 yuche.tsai
604 * Update Configure Method indication & selection for Provision Discovery & GO_NEGO_REQ
606 * 11 30 2010 yuche.tsai
608 * Update RCIP value when RX assoc request frame.
610 * 11 29 2010 yuche.tsai
612 * Update P2P related function for INVITATION & PROVISION DISCOVERY.
614 * 11 26 2010 george.huang
615 * [WCXRP00000152] [MT6620 Wi-Fi] AP mode power saving function
616 * Update P2P PS for NOA function.
618 * 11 25 2010 yuche.tsai
620 * Update Code for Invitation Related Function.
623 * [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
624 * fixed some ASSERT check.
627 * [WCXRP00000164] [MT6620 Wi-Fi][Driver] Support the p2p random SSID
628 * fixed the p2p role code error.
631 * [WCXRP00000164] [MT6620 Wi-Fi][Driver] Support the p2p random SSID
632 * adding the p2p random ssid support.
635 * [WCXRP00000124] [MT6620 Wi-Fi] [Driver] Support the dissolve P2P Group
636 * fixed the ASSERT check error
639 * [WCXRP00000124] [MT6620 Wi-Fi] [Driver] Support the dissolve P2P Group
640 * Add the code to support disconnect p2p group
643 * [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
644 * fixed the compiling error.
647 * [WCXRP00000102] [MT6620 Wi-Fi] [FW] Add a compiling flag and code for support Direct GO at Android
648 * adding a code to support Direct GO with a compiling flag .
651 * [WCXRP00000087] [MT6620 Wi-Fi][Driver] Cannot connect to 5GHz AP, driver will cause FW assert.
652 * correct erroneous logic: specifying eBand with incompatible eSco
655 * [WCXRP00000085] [MT6620 Wif-Fi] [Driver] update the modified p2p state machine
656 * fixed the compiling error.
659 * [WCXRP00000085] [MT6620 Wif-Fi] [Driver] update the modified p2p state machine
660 * update the frog's new p2p state machine.
664 * fixed the compiling error at WinXP.
666 * 09 07 2010 yuche.tsai
668 * Reset Common IE Buffer of P2P INFO when scan request is issued.
669 * If an action frame other than public action frame is received, return direcly.
673 * adding the code for beacon/probe req/ probe rsp wsc ie at p2p.
677 * let the p2p can set the privacy bit at beacon and rsn ie at assoc req at key handshake state.
679 * 09 03 2010 kevin.huang
681 * Refine #include sequence and solve recursive/nested #include issue
683 * 08 26 2010 yuche.tsai
685 * Add P2P Connection Abort Event Message handler.
687 * 08 24 2010 cm.chang
689 * Support RLM initail channel of Ad-hoc, P2P and BOW
691 * 08 23 2010 yuche.tsai
693 * 1. Fix Interface Address from GO Nego Req/Rsp is not correct.
694 * 2. Fix GO mode does not change media state after station connected.
695 * 3. Fix STA don't response probe request when there is a connection request.
697 * 08 20 2010 cm.chang
699 * Migrate RLM code to host from FW
701 * 08 20 2010 kevin.huang
703 * Modify AAA Module for changing STA STATE 3 at p2p/bowRunEventAAAComplete()
705 * 08 20 2010 yuche.tsai
707 * Add Glue Layer indication.
709 * 08 17 2010 yuche.tsai
711 * Fix compile warning under Linux.
713 * 08 17 2010 yuche.tsai
715 * Fix some P2P FSM bug.
717 * 08 16 2010 yuche.tsai
719 * Add random Interface Address Generation support.
721 * 08 16 2010 yuche.tsai
723 * Fix some P2P FSM bug.
725 * 08 16 2010 yuche.tsai
727 * Update P2P FSM code for GO Nego.
729 * 08 16 2010 kevin.huang
731 * Refine AAA functions
733 * 08 12 2010 kevin.huang
735 * Refine bssProcessProbeRequest() and bssSendBeaconProbeResponse()
737 * 08 12 2010 yuche.tsai
739 * Join complete indication.
741 * 08 11 2010 yuche.tsai
743 * Add two boolean in connection request.
744 * Based on these two boolean value, P2P FSM should
745 * decide to do invitation or group formation or start a GO directly.
747 * 08 11 2010 yuche.tsai
749 * Update P2P FSM, currently P2P Device Discovery is verified.
751 * 08 05 2010 yuche.tsai
753 * Update P2P FSM for group formation.
755 * 08 03 2010 george.huang
757 * handle event for updating NOA parameters indicated from FW
761 * limit build always needs spin-lock declaration.
763 * 08 02 2010 yuche.tsai
765 * P2P Group Negotiation Code Check in.
767 * 07 26 2010 yuche.tsai
769 * Add P2P FSM code check in.
771 * 07 21 2010 yuche.tsai
773 * Add P2P Scan & Scan Result Parsing & Saving.
775 * 07 19 2010 yuche.tsai
779 * 07 09 2010 george.huang
781 * [WPD00001556] Migrate PM variables from FW to driver: for composing QoS Info
785 * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
787 * 06 21 2010 yuche.tsai
788 * [WPD00003839][MT6620 5931][P2P] Feature migration
789 * Fix compile error while enable WIFI_DIRECT support.
791 * 06 21 2010 yuche.tsai
792 * [WPD00003839][MT6620 5931][P2P] Feature migration
793 * Update P2P Function call.
795 * 06 17 2010 yuche.tsai
796 * [WPD00003839][MT6620 5931][P2P] Feature migration
797 * First draft for migration P2P FSM from FW to Driver.
799 * 04 19 2010 kevin.huang
800 * [BORA00000714][WIFISYS][New Feature]Beacon Timeout Support
801 * Add Beacon Timeout Support and will send Null frame to diagnose connection
803 * 03 18 2010 kevin.huang
804 * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support
805 * Rename CFG flag for P2P
807 * 02 26 2010 kevin.huang
808 * [BORA00000603][WIFISYS] [New Feature] AAA Module Support
809 * Add code to test P2P GO
811 * 02 23 2010 kevin.huang
812 * [BORA00000603][WIFISYS] [New Feature] AAA Module Support
813 * Add Wi-Fi Direct SSID and P2P GO Test Mode
815 * 02 05 2010 kevin.huang
816 * [BORA00000603][WIFISYS] [New Feature] AAA Module Support
817 * Modify code due to BAND_24G define was changed
819 * 02 05 2010 kevin.huang
820 * [BORA00000603][WIFISYS] [New Feature] AAA Module Support
821 * Revise data structure to share the same BSS_INFO_T for avoiding coding error
823 * 02 04 2010 kevin.huang
824 * [BORA00000603][WIFISYS] [New Feature] AAA Module Support
825 * Add AAA Module Support, Revise Net Type to Net Type Index for array lookup
828 /*******************************************************************************
829 * C O M P I L E R F L A G S
830 ********************************************************************************
833 /*******************************************************************************
834 * E X T E R N A L R E F E R E N C E S
835 ********************************************************************************
839 #if CFG_ENABLE_WIFI_DIRECT
841 /*******************************************************************************
843 ********************************************************************************
846 /*******************************************************************************
848 ********************************************************************************
851 /*******************************************************************************
852 * P U B L I C D A T A
853 ********************************************************************************
856 /*******************************************************************************
857 * P R I V A T E D A T A
858 ********************************************************************************
861 /*lint -save -e64 Type mismatch */
862 static PUINT_8 apucDebugP2pState[P2P_STATE_NUM] = {
863 (PUINT_8)DISP_STRING("P2P_STATE_IDLE"),
864 (PUINT_8)DISP_STRING("P2P_STATE_SCAN"),
865 (PUINT_8)DISP_STRING("P2P_STATE_AP_CHANNEL_DETECT"),
866 (PUINT_8)DISP_STRING("P2P_STATE_REQING_CHANNEL"),
867 (PUINT_8)DISP_STRING("P2P_STATE_CHNL_ON_HAND"),
868 (PUINT_8)DISP_STRING("P2P_STATE_GC_JOIN")
874 /*******************************************************************************
876 ********************************************************************************
879 /*******************************************************************************
880 * F U N C T I O N D E C L A R A T I O N S
881 ********************************************************************************
884 /*******************************************************************************
886 ********************************************************************************
889 /* p2pStateXXX : Processing P2P FSM related action.
890 * p2pFSMXXX : Control P2P FSM flow.
891 * p2pFuncXXX : Function for doing one thing.
895 IN P_ADAPTER_T prAdapter
899 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
900 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
903 ASSERT_BREAK(prAdapter != NULL);
905 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
906 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
908 ASSERT_BREAK(prP2pFsmInfo != NULL);
910 LINK_INITIALIZE(&(prP2pFsmInfo->rMsgEventQueue));
911 LINK_INITIALIZE(&(prP2pBssInfo->rStaRecOfClientList));
914 prP2pFsmInfo->eCurrentState = prP2pFsmInfo->ePreviousState = P2P_STATE_IDLE;
915 prP2pFsmInfo->prTargetBss = NULL;
916 prP2pFsmInfo->fgIsWPSMode = 0;
918 cnmTimerInitTimer(prAdapter,
919 &(prP2pFsmInfo->rP2pFsmTimeoutTimer),
920 (PFN_MGMT_TIMEOUT_FUNC)p2pFsmRunEventFsmTimeout,
921 (UINT_32)prP2pFsmInfo);
923 //4 <2> Initiate BSS_INFO_T - common part
924 BSS_INFO_INIT(prAdapter, NETWORK_TYPE_P2P_INDEX);
927 //4 <2.1> Initiate BSS_INFO_T - Setup HW ID
928 prP2pBssInfo->ucConfigAdHocAPMode = AP_MODE_11G_P2P;
929 prP2pBssInfo->ucHwDefaultFixedRateCode = RATE_OFDM_6M;
932 prP2pBssInfo->ucNonHTBasicPhyType = (UINT_8)
933 rNonHTApModeAttributes[prP2pBssInfo->ucConfigAdHocAPMode].ePhyTypeIndex;
934 prP2pBssInfo->u2BSSBasicRateSet =
935 rNonHTApModeAttributes[prP2pBssInfo->ucConfigAdHocAPMode].u2BSSBasicRateSet;
937 prP2pBssInfo->u2OperationalRateSet =
938 rNonHTPhyAttributes[prP2pBssInfo->ucNonHTBasicPhyType].u2SupportedRateSet;
940 rateGetDataRatesFromRateSet(prP2pBssInfo->u2OperationalRateSet,
941 prP2pBssInfo->u2BSSBasicRateSet,
942 prP2pBssInfo->aucAllSupportedRates,
943 &prP2pBssInfo->ucAllSupportedRatesLen);
945 prP2pBssInfo->prBeacon = cnmMgtPktAlloc(prAdapter,
946 OFFSET_OF(WLAN_BEACON_FRAME_T, aucInfoElem[0]) + MAX_IE_LENGTH);
948 if (prP2pBssInfo->prBeacon) {
949 prP2pBssInfo->prBeacon->eSrc = TX_PACKET_MGMT;
950 prP2pBssInfo->prBeacon->ucStaRecIndex = 0xFF; /* NULL STA_REC */
951 prP2pBssInfo->prBeacon->ucNetworkType = NETWORK_TYPE_P2P_INDEX;
958 prP2pBssInfo->eCurrentOPMode = OP_MODE_NUM;
960 prP2pBssInfo->rPmProfSetupInfo.ucBmpDeliveryAC = PM_UAPSD_ALL;
961 prP2pBssInfo->rPmProfSetupInfo.ucBmpTriggerAC = PM_UAPSD_ALL;
962 prP2pBssInfo->rPmProfSetupInfo.ucUapsdSp = WMM_MAX_SP_LENGTH_2;
963 prP2pBssInfo->ucPrimaryChannel = P2P_DEFAULT_LISTEN_CHANNEL;
964 prP2pBssInfo->eBand = BAND_2G4;
965 prP2pBssInfo->eBssSCO = CHNL_EXT_SCN;
967 if (prAdapter->rWifiVar.fgSupportQoS) {
968 prP2pBssInfo->fgIsQBSS = TRUE;
971 prP2pBssInfo->fgIsQBSS = FALSE;
974 SET_NET_PWR_STATE_IDLE(prAdapter, NETWORK_TYPE_P2P_INDEX);
976 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
987 /*----------------------------------------------------------------------------*/
989 * @brief The function is used to uninitialize the value in P2P_FSM_INFO_T for
996 /*----------------------------------------------------------------------------*/
999 IN P_ADAPTER_T prAdapter
1002 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1003 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
1006 ASSERT_BREAK(prAdapter != NULL);
1008 DEBUGFUNC("p2pFsmUninit()");
1009 DBGLOG(P2P, INFO, ("->p2pFsmUninit()\n"));
1011 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1012 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
1014 p2pFuncSwitchOPMode(prAdapter, prP2pBssInfo, OP_MODE_P2P_DEVICE, TRUE);
1016 p2pFsmRunEventAbort(prAdapter, prP2pFsmInfo);
1018 p2pStateAbort_IDLE(prAdapter, prP2pFsmInfo, P2P_STATE_NUM);
1020 UNSET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX);
1022 wlanAcquirePowerControl(prAdapter);
1024 /* Release all pending CMD queue. */
1025 DBGLOG(P2P, TRACE, ("p2pFsmUninit: wlanProcessCommandQueue, num of element:%d\n", prAdapter->prGlueInfo->rCmdQueue.u4NumElem));
1026 wlanProcessCommandQueue(prAdapter, &prAdapter->prGlueInfo->rCmdQueue);
1028 wlanReleasePowerControl(prAdapter);
1030 /* Release pending mgmt frame,
1031 * mgmt frame may be pending by CMD without resource.
1033 kalClearMgmtFramesByNetType(prAdapter->prGlueInfo, NETWORK_TYPE_P2P_INDEX);
1035 /* Clear PendingCmdQue*/
1036 wlanReleasePendingCMDbyNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX);
1038 if (prP2pBssInfo->prBeacon) {
1039 cnmMgtPktFree(prAdapter, prP2pBssInfo->prBeacon);
1040 prP2pBssInfo->prBeacon = NULL;
1047 } /* end of p2pFsmUninit() */
1050 p2pFsmStateTransition (
1051 IN P_ADAPTER_T prAdapter,
1052 IN P_P2P_FSM_INFO_T prP2pFsmInfo,
1053 IN ENUM_P2P_STATE_T eNextState
1056 BOOLEAN fgIsTransOut = (BOOLEAN)FALSE;
1057 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
1058 P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo = (P_P2P_SPECIFIC_BSS_INFO_T)NULL;
1061 ASSERT_BREAK((prAdapter != NULL) && (prP2pFsmInfo != NULL));
1063 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
1064 prP2pSpecificBssInfo = prAdapter->rWifiVar.prP2pSpecificBssInfo;
1066 if (!IS_BSS_ACTIVE(prP2pBssInfo)) {
1067 if (!cnmP2PIsPermitted(prAdapter)) {
1071 SET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX);
1072 nicActivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX);
1075 fgIsTransOut = fgIsTransOut?FALSE:TRUE;
1077 if (!fgIsTransOut) {
1078 DBGLOG(P2P, STATE, ("TRANSITION: [%s] -> [%s]\n",
1079 apucDebugP2pState[prP2pFsmInfo->eCurrentState],
1080 apucDebugP2pState[eNextState]));
1082 /* Transition into current state. */
1083 prP2pFsmInfo->ePreviousState = prP2pFsmInfo->eCurrentState;
1084 prP2pFsmInfo->eCurrentState = eNextState;
1088 switch (prP2pFsmInfo->eCurrentState) {
1089 case P2P_STATE_IDLE:
1092 p2pStateAbort_IDLE(prAdapter,
1097 fgIsTransOut = p2pStateInit_IDLE(prAdapter,
1104 case P2P_STATE_SCAN:
1107 // Scan done / scan canceled.
1108 p2pStateAbort_SCAN(prAdapter, prP2pFsmInfo, eNextState);
1111 // Initial scan request.
1112 p2pStateInit_SCAN(prAdapter, prP2pFsmInfo);
1116 case P2P_STATE_AP_CHANNEL_DETECT:
1119 // Get sparse channel result.
1120 p2pStateAbort_AP_CHANNEL_DETECT(prAdapter,
1122 prP2pSpecificBssInfo,
1127 // Initial passive scan request.
1128 p2pStateInit_AP_CHANNEL_DETECT(prAdapter, prP2pFsmInfo);
1132 case P2P_STATE_REQING_CHANNEL:
1135 // Channel on hand / Channel canceled.
1136 p2pStateAbort_REQING_CHANNEL(prAdapter, prP2pFsmInfo, eNextState);
1139 // Initial channel request.
1140 p2pFuncAcquireCh(prAdapter, &(prP2pFsmInfo->rChnlReqInfo));
1144 case P2P_STATE_CHNL_ON_HAND:
1146 p2pStateAbort_CHNL_ON_HAND(prAdapter, prP2pFsmInfo, prP2pBssInfo, eNextState);
1149 // Initial channel ready.
1150 // Send channel ready event.
1151 // Start a FSM timer.
1152 p2pStateInit_CHNL_ON_HAND(prAdapter, prP2pBssInfo, prP2pFsmInfo);
1156 case P2P_STATE_GC_JOIN:
1159 // Join complete / join canceled.
1160 p2pStateAbort_GC_JOIN(prAdapter,
1162 &(prP2pFsmInfo->rJoinInfo),
1166 ASSERT(prP2pFsmInfo->prTargetBss != NULL);
1168 // Send request to SAA module.
1169 p2pStateInit_GC_JOIN(prAdapter,
1172 &(prP2pFsmInfo->rJoinInfo),
1173 prP2pFsmInfo->prTargetBss);
1181 } while (fgIsTransOut);
1183 } /* p2pFsmStateTransition */
1187 p2pFsmRunEventSwitchOPMode (
1188 IN P_ADAPTER_T prAdapter,
1189 IN P_MSG_HDR_T prMsgHdr
1192 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
1193 P_MSG_P2P_SWITCH_OP_MODE_T prSwitchOpMode = (P_MSG_P2P_SWITCH_OP_MODE_T)prMsgHdr;
1194 P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = (P_P2P_CONNECTION_SETTINGS_T)NULL;
1197 ASSERT_BREAK((prAdapter != NULL) && (prSwitchOpMode != NULL));
1199 DBGLOG(P2P, TRACE, ("p2pFsmRunEventSwitchOPMode\n"));
1201 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
1202 prP2pConnSettings = prAdapter->rWifiVar.prP2PConnSettings;
1204 if (prSwitchOpMode->eOpMode >= OP_MODE_NUM) {
1209 /* P2P Device / GC. */
1210 p2pFuncSwitchOPMode(prAdapter,
1212 prSwitchOpMode->eOpMode,
1218 cnmMemFree(prAdapter, prMsgHdr);
1222 } /* p2pFsmRunEventSwitchOPMode */
1225 /*----------------------------------------------------------------------------*/
1227 * \brief This function is used to handle scan done event during Device Discovery.
1229 * \param[in] prAdapter Pointer of ADAPTER_T
1233 /*----------------------------------------------------------------------------*/
1235 p2pFsmRunEventScanDone (
1236 IN P_ADAPTER_T prAdapter,
1237 IN P_MSG_HDR_T prMsgHdr
1240 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1241 P_P2P_SCAN_REQ_INFO_T prScanReqInfo = (P_P2P_SCAN_REQ_INFO_T)NULL;
1242 P_MSG_SCN_SCAN_DONE prScanDoneMsg = (P_MSG_SCN_SCAN_DONE)NULL;
1243 ENUM_P2P_STATE_T eNextState = P2P_STATE_NUM;
1246 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1249 /* This scan done event is either for "SCAN" phase or "SEARCH" state or "LISTEN" state.
1250 * The scan done for SCAN phase & SEARCH state doesn't imply Device
1253 DBGLOG(P2P, TRACE, ("P2P Scan Done Event\n"));
1255 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1257 if (prP2pFsmInfo == NULL) {
1262 prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo);
1263 prScanDoneMsg = (P_MSG_SCN_SCAN_DONE)prMsgHdr;
1265 if (prScanDoneMsg->ucSeqNum != prScanReqInfo->ucSeqNumOfScnMsg) {
1266 /* Scan Done message sequence number mismatch.
1267 * Ignore this event. (P2P FSM issue two scan events.)
1269 /* The scan request has been cancelled.
1270 * Ignore this message. It is possible.
1272 DBGLOG(P2P, TRACE, ("P2P Scan Don SeqNum:%d <-> P2P Fsm SCAN Msg:%d\n",
1273 prScanDoneMsg->ucSeqNum,
1274 prScanReqInfo->ucSeqNumOfScnMsg));
1280 switch (prP2pFsmInfo->eCurrentState) {
1281 case P2P_STATE_SCAN:
1283 P_P2P_CONNECTION_REQ_INFO_T prConnReqInfo = &(prP2pFsmInfo->rConnReqInfo);
1285 prScanReqInfo->fgIsAbort = FALSE;
1287 if (prConnReqInfo->fgIsConnRequest) {
1289 if ((prP2pFsmInfo->prTargetBss = p2pFuncKeepOnConnection(prAdapter,
1290 &prP2pFsmInfo->rConnReqInfo,
1291 &prP2pFsmInfo->rChnlReqInfo,
1292 &prP2pFsmInfo->rScanReqInfo)) == NULL) {
1293 eNextState = P2P_STATE_SCAN;
1296 eNextState = P2P_STATE_REQING_CHANNEL;
1301 eNextState = P2P_STATE_IDLE;
1306 case P2P_STATE_AP_CHANNEL_DETECT:
1307 eNextState = P2P_STATE_REQING_CHANNEL;
1310 /* Unexpected channel scan done event without being chanceled. */
1315 prScanReqInfo->fgIsScanRequest = FALSE;
1317 p2pFsmStateTransition(prAdapter,
1324 cnmMemFree(prAdapter, prMsgHdr);
1328 } /* p2pFsmRunEventScanDone */
1332 /*----------------------------------------------------------------------------*/
1334 * \brief This function is call when channel is granted by CNM module from FW.
1336 * \param[in] prAdapter Pointer of ADAPTER_T
1340 /*----------------------------------------------------------------------------*/
1342 p2pFsmRunEventChGrant (
1343 IN P_ADAPTER_T prAdapter,
1344 IN P_MSG_HDR_T prMsgHdr
1347 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1348 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = (P_P2P_CHNL_REQ_INFO_T)NULL;
1349 P_MSG_CH_GRANT_T prMsgChGrant = (P_MSG_CH_GRANT_T)NULL;
1350 UINT_8 ucTokenID = 0;
1353 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1355 DBGLOG(P2P, TRACE, ("P2P Run Event Channel Grant\n"));
1357 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1359 if (prP2pFsmInfo == NULL) {
1363 prMsgChGrant = (P_MSG_CH_GRANT_T)prMsgHdr;
1364 ucTokenID = prMsgChGrant->ucTokenID;
1365 prP2pFsmInfo->u4GrantInterval = prMsgChGrant->u4GrantInterval;
1368 prChnlReqInfo = &(prP2pFsmInfo->rChnlReqInfo);
1370 if (ucTokenID == prChnlReqInfo->ucSeqNumOfChReq) {
1371 ENUM_P2P_STATE_T eNextState = P2P_STATE_NUM;
1373 switch (prP2pFsmInfo->eCurrentState) {
1374 case P2P_STATE_REQING_CHANNEL:
1375 switch (prChnlReqInfo->eChannelReqType) {
1376 case CHANNEL_REQ_TYPE_REMAIN_ON_CHANNEL:
1377 eNextState = P2P_STATE_CHNL_ON_HAND;
1379 case CHANNEL_REQ_TYPE_GC_JOIN_REQ:
1380 eNextState = P2P_STATE_GC_JOIN;
1382 case CHANNEL_REQ_TYPE_GO_START_BSS:
1383 eNextState = P2P_STATE_IDLE;
1389 p2pFsmStateTransition(prAdapter,
1394 /* Channel is granted under unexpected state.
1395 * Driver should cancel channel privileagea before leaving the states.
1403 /* Channel requsted, but released. */
1404 //ASSERT(!prChnlReqInfo->fgIsChannelRequested);
1405 DBGLOG(P2P, TRACE, ("Channel requsted, but released\n"));
1410 cnmMemFree(prAdapter, prMsgHdr);
1415 } /* p2pFsmRunEventChGrant */
1419 p2pFsmRunEventChannelRequest (
1420 IN P_ADAPTER_T prAdapter,
1421 IN P_MSG_HDR_T prMsgHdr
1424 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = (P_P2P_CHNL_REQ_INFO_T)NULL;
1425 P_MSG_P2P_CHNL_REQUEST_T prP2pChnlReqMsg = (P_MSG_P2P_CHNL_REQUEST_T)NULL;
1426 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1427 ENUM_P2P_STATE_T eNextState = P2P_STATE_NUM;
1430 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1432 prP2pChnlReqMsg = (P_MSG_P2P_CHNL_REQUEST_T)prMsgHdr;
1433 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1435 if (prP2pFsmInfo == NULL) {
1439 prChnlReqInfo = &(prP2pFsmInfo->rChnlReqInfo);
1441 DBGLOG(P2P, TRACE, ("p2pFsmRunEventChannelRequest\n"));
1443 /* Special case of time renewing for same frequency. */
1444 if ((prP2pFsmInfo->eCurrentState == P2P_STATE_CHNL_ON_HAND) &&
1445 (prChnlReqInfo->ucReqChnlNum == prP2pChnlReqMsg->rChannelInfo.ucChannelNum) &&
1446 (prChnlReqInfo->eBand == prP2pChnlReqMsg->rChannelInfo.eBand) &&
1447 (prChnlReqInfo->eChnlSco == prP2pChnlReqMsg->eChnlSco)) {
1449 ASSERT(prChnlReqInfo->fgIsChannelRequested == TRUE);
1450 ASSERT(prChnlReqInfo->eChannelReqType == CHANNEL_REQ_TYPE_REMAIN_ON_CHANNEL);
1452 prChnlReqInfo->u8Cookie = prP2pChnlReqMsg->u8Cookie;
1453 prChnlReqInfo->u4MaxInterval = prP2pChnlReqMsg->u4Duration;
1454 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
1455 prChnlReqInfo->fgNeedIndSupp = prP2pChnlReqMsg->fgNeedIndSupp;
1458 /* Re-enter the state. */
1459 eNextState = P2P_STATE_CHNL_ON_HAND;
1463 // Make sure the state is in IDLE state.
1464 p2pFsmRunEventAbort(prAdapter, prP2pFsmInfo);
1466 prChnlReqInfo->u8Cookie = prP2pChnlReqMsg->u8Cookie; /* Cookie can only be assign after abort.(for indication) */
1467 prChnlReqInfo->ucReqChnlNum = prP2pChnlReqMsg->rChannelInfo.ucChannelNum;
1468 prChnlReqInfo->eBand = prP2pChnlReqMsg->rChannelInfo.eBand;
1469 prChnlReqInfo->eChnlSco = prP2pChnlReqMsg->eChnlSco;
1470 prChnlReqInfo->u4MaxInterval = prP2pChnlReqMsg->u4Duration;
1471 prChnlReqInfo->eChannelReqType = CHANNEL_REQ_TYPE_REMAIN_ON_CHANNEL;
1472 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
1473 prChnlReqInfo->fgNeedIndSupp = prP2pChnlReqMsg->fgNeedIndSupp;
1475 eNextState = P2P_STATE_REQING_CHANNEL;
1478 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, eNextState);
1484 cnmMemFree(prAdapter, prMsgHdr);
1488 } /* p2pFsmRunEventChannelRequest */
1492 p2pFsmRunEventChannelAbort (
1493 IN P_ADAPTER_T prAdapter,
1494 IN P_MSG_HDR_T prMsgHdr
1497 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1498 P_MSG_P2P_CHNL_ABORT_T prChnlAbortMsg = (P_MSG_P2P_CHNL_ABORT_T)NULL;
1499 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = (P_P2P_CHNL_REQ_INFO_T)NULL;
1502 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1504 prChnlAbortMsg = (P_MSG_P2P_CHNL_ABORT_T)prMsgHdr;
1505 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1507 if (prP2pFsmInfo == NULL) {
1511 prChnlReqInfo = &prP2pFsmInfo->rChnlReqInfo;
1513 DBGLOG(P2P, TRACE, ("p2pFsmRunEventChannelAbort\n"));
1515 if ((prChnlAbortMsg->u8Cookie == prChnlReqInfo->u8Cookie) &&
1516 (prChnlReqInfo->fgIsChannelRequested)) {
1518 ASSERT((prP2pFsmInfo->eCurrentState == P2P_STATE_REQING_CHANNEL ||
1519 (prP2pFsmInfo->eCurrentState == P2P_STATE_CHNL_ON_HAND)));
1521 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
1527 cnmMemFree(prAdapter, prMsgHdr);
1531 } /* p2pFsmRunEventChannelAbort */
1536 p2pFsmRunEventScanRequest (
1537 IN P_ADAPTER_T prAdapter,
1538 IN P_MSG_HDR_T prMsgHdr
1542 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1543 P_MSG_P2P_SCAN_REQUEST_T prP2pScanReqMsg = (P_MSG_P2P_SCAN_REQUEST_T)NULL;
1544 P_P2P_SCAN_REQ_INFO_T prScanReqInfo = (P_P2P_SCAN_REQ_INFO_T)NULL;
1545 UINT_32 u4ChnlListSize = 0;
1548 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1550 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1552 if (prP2pFsmInfo == NULL) {
1556 prP2pScanReqMsg = (P_MSG_P2P_SCAN_REQUEST_T)prMsgHdr;
1557 prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo);
1559 DBGLOG(P2P, TRACE, ("p2pFsmRunEventScanRequest\n"));
1561 // Make sure the state is in IDLE state.
1562 p2pFsmRunEventAbort(prAdapter, prP2pFsmInfo);
1564 ASSERT(prScanReqInfo->fgIsScanRequest == FALSE);
1566 prScanReqInfo->fgIsAbort = TRUE;
1567 prScanReqInfo->eScanType = SCAN_TYPE_ACTIVE_SCAN;
1568 prScanReqInfo->eChannelSet = SCAN_CHANNEL_SPECIFIED;
1571 prScanReqInfo->ucNumChannelList = prP2pScanReqMsg->u4NumChannel;
1572 DBGLOG(P2P, TRACE, ("Scan Request Channel List Number: %d\n", prScanReqInfo->ucNumChannelList));
1573 if (prScanReqInfo->ucNumChannelList > MAXIMUM_OPERATION_CHANNEL_LIST) {
1574 DBGLOG(P2P, TRACE, ("Channel List Number Overloaded: %d, change to: %d\n",
1575 prScanReqInfo->ucNumChannelList,
1576 MAXIMUM_OPERATION_CHANNEL_LIST));
1577 prScanReqInfo->ucNumChannelList = MAXIMUM_OPERATION_CHANNEL_LIST;
1580 u4ChnlListSize = sizeof(RF_CHANNEL_INFO_T) * prScanReqInfo->ucNumChannelList;
1581 kalMemCopy(prScanReqInfo->arScanChannelList, prP2pScanReqMsg->arChannelListInfo, u4ChnlListSize);
1583 // TODO: I only take the first SSID. Multiple SSID may be needed in the future.
1585 if (prP2pScanReqMsg->i4SsidNum >= 1) {
1587 kalMemCopy(&(prScanReqInfo->rSsidStruct),
1588 prP2pScanReqMsg->prSSID,
1589 sizeof(P2P_SSID_STRUCT_T));
1592 prScanReqInfo->rSsidStruct.ucSsidLen = 0;
1596 kalMemCopy(prScanReqInfo->aucIEBuf,
1597 prP2pScanReqMsg->pucIEBuf,
1598 prP2pScanReqMsg->u4IELen);
1600 prScanReqInfo->u4BufLength = prP2pScanReqMsg->u4IELen;
1602 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_SCAN);
1609 cnmMemFree(prAdapter, prMsgHdr);
1613 } /* p2pFsmRunEventScanRequest */
1617 p2pFsmRunEventScanAbort (
1618 IN P_ADAPTER_T prAdapter,
1619 IN P_MSG_HDR_T prMsgHdr
1623 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1626 ASSERT_BREAK(prAdapter != NULL);
1628 DBGLOG(P2P, TRACE, ("p2pFsmRunEventScanAbort\n"));
1630 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1632 if (prP2pFsmInfo->eCurrentState == P2P_STATE_SCAN) {
1633 P_P2P_SCAN_REQ_INFO_T prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo);
1635 prScanReqInfo->fgIsAbort = TRUE;
1637 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
1643 cnmMemFree(prAdapter, prMsgHdr);
1647 } /* p2pFsmRunEventScanAbort */
1654 p2pFsmRunEventAbort (
1655 IN P_ADAPTER_T prAdapter,
1656 IN P_P2P_FSM_INFO_T prP2pFsmInfo
1659 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
1661 ASSERT_BREAK((prAdapter != NULL) && (prP2pFsmInfo != NULL));
1663 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
1665 DBGLOG(P2P, TRACE, ("p2pFsmRunEventAbort\n"));
1667 if (prP2pFsmInfo->eCurrentState != P2P_STATE_IDLE) {
1669 if (prP2pFsmInfo->eCurrentState == P2P_STATE_SCAN) {
1671 P_P2P_SCAN_REQ_INFO_T prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo);
1673 prScanReqInfo->fgIsAbort = TRUE;
1675 else if (prP2pFsmInfo->eCurrentState == P2P_STATE_REQING_CHANNEL) {
1679 prP2pBssInfo->eIntendOPMode = OP_MODE_NUM;
1682 // For other state, is there any special action that should be take before leaving?
1684 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
1687 /* P2P State IDLE. */
1688 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = &(prP2pFsmInfo->rChnlReqInfo);
1690 if (prChnlReqInfo->fgIsChannelRequested) {
1691 p2pFuncReleaseCh(prAdapter, prChnlReqInfo);
1694 cnmTimerStopTimer(prAdapter, &(prP2pFsmInfo->rP2pFsmTimeoutTimer));
1701 } /* p2pFsmRunEventAbort */
1705 /*----------------------------------------------------------------------------*/
1707 * \brief This function is used to handle FSM Timeout.
1709 * \param[in] prAdapter Pointer of ADAPTER_T
1713 /*----------------------------------------------------------------------------*/
1715 p2pFsmRunEventFsmTimeout (
1716 IN P_ADAPTER_T prAdapter,
1720 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)u4Param;
1723 ASSERT_BREAK((prAdapter != NULL) && (prP2pFsmInfo != NULL));
1725 DBGLOG(P2P, TRACE, ("P2P FSM Timeout Event\n"));
1727 switch (prP2pFsmInfo->eCurrentState) {
1728 case P2P_STATE_IDLE:
1730 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = &prP2pFsmInfo->rChnlReqInfo;
1731 if (prChnlReqInfo->fgIsChannelRequested) {
1732 p2pFuncReleaseCh(prAdapter, prChnlReqInfo);
1734 else if (IS_NET_PWR_STATE_IDLE(prAdapter, NETWORK_TYPE_P2P_INDEX)) {
1735 UNSET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX);
1736 nicDeactivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX);
1742 // case P2P_STATE_SCAN:
1744 // case P2P_STATE_AP_CHANNEL_DETECT:
1746 // case P2P_STATE_REQING_CHANNEL:
1748 case P2P_STATE_CHNL_ON_HAND:
1750 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
1753 // case P2P_STATE_GC_JOIN:
1762 } /* p2pFsmRunEventFsmTimeout */
1765 p2pFsmRunEventMgmtFrameTx (
1766 IN P_ADAPTER_T prAdapter,
1767 IN P_MSG_HDR_T prMsgHdr
1770 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1771 P_MSG_P2P_MGMT_TX_REQUEST_T prMgmtTxMsg = (P_MSG_P2P_MGMT_TX_REQUEST_T)NULL;
1774 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1776 DBGLOG(P2P, TRACE, ("p2pFsmRunEventMgmtFrameTx\n"));
1778 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1780 if (prP2pFsmInfo == NULL) {
1784 prMgmtTxMsg = (P_MSG_P2P_MGMT_TX_REQUEST_T)prMsgHdr;
1786 p2pFuncTxMgmtFrame(prAdapter,
1787 &prP2pFsmInfo->rMgmtTxInfo,
1788 prMgmtTxMsg->prMgmtMsduInfo,
1789 prMgmtTxMsg->u8Cookie);
1796 cnmMemFree(prAdapter, prMsgHdr);
1801 } /* p2pFsmRunEventMgmtTx */
1805 p2pFsmRunEventStartAP (
1806 IN P_ADAPTER_T prAdapter,
1807 IN P_MSG_HDR_T prMsgHdr
1810 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1811 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
1812 P_MSG_P2P_START_AP_T prP2pStartAPMsg = (P_MSG_P2P_START_AP_T)NULL;
1813 P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo = (P_P2P_SPECIFIC_BSS_INFO_T)NULL;
1816 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1818 DBGLOG(P2P, TRACE, ("p2pFsmRunEventStartAP\n"));
1820 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1822 if (prP2pFsmInfo == NULL) {
1826 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
1827 prP2pStartAPMsg = (P_MSG_P2P_START_AP_T)prMsgHdr;
1828 prP2pSpecificBssInfo = prAdapter->rWifiVar.prP2pSpecificBssInfo;
1831 if (prP2pStartAPMsg->u4BcnInterval) {
1832 DBGLOG(P2P, TRACE, ("Beacon interval updated to :%ld \n", prP2pStartAPMsg->u4BcnInterval));
1833 prP2pBssInfo->u2BeaconInterval = (UINT_16)prP2pStartAPMsg->u4BcnInterval;
1835 else if (prP2pBssInfo->u2BeaconInterval == 0) {
1836 prP2pBssInfo->u2BeaconInterval = DOT11_BEACON_PERIOD_DEFAULT;
1839 if (prP2pStartAPMsg->u4DtimPeriod) {
1840 DBGLOG(P2P, TRACE, ("DTIM interval updated to :%ld \n", prP2pStartAPMsg->u4DtimPeriod));
1841 prP2pBssInfo->ucDTIMPeriod = (UINT_8)prP2pStartAPMsg->u4DtimPeriod;
1843 else if (prP2pBssInfo->ucDTIMPeriod == 0) {
1844 prP2pBssInfo->ucDTIMPeriod = DOT11_DTIM_PERIOD_DEFAULT;
1847 if (prP2pStartAPMsg->u2SsidLen != 0) {
1848 kalMemCopy(prP2pBssInfo->aucSSID, prP2pStartAPMsg->aucSsid, prP2pStartAPMsg->u2SsidLen);
1849 kalMemCopy(prP2pSpecificBssInfo->aucGroupSsid, prP2pStartAPMsg->aucSsid, prP2pStartAPMsg->u2SsidLen);
1850 prP2pBssInfo->ucSSIDLen = prP2pSpecificBssInfo->u2GroupSsidLen = prP2pStartAPMsg->u2SsidLen;
1854 prP2pBssInfo->eHiddenSsidType = prP2pStartAPMsg->ucHiddenSsidType;
1858 /* Privacy & inactive timeout. */
1860 if ((prP2pBssInfo->eCurrentOPMode != OP_MODE_ACCESS_POINT) ||
1861 (prP2pBssInfo->eIntendOPMode != OP_MODE_NUM)) {
1862 UINT_8 ucPreferedChnl = 0;
1863 ENUM_BAND_T eBand = BAND_NULL;
1864 ENUM_CHNL_EXT_T eSco = CHNL_EXT_SCN;
1865 ENUM_P2P_STATE_T eNextState = P2P_STATE_SCAN;
1866 P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = prAdapter->rWifiVar.prP2PConnSettings;
1869 if(prP2pFsmInfo->eCurrentState != P2P_STATE_SCAN &&
1870 prP2pFsmInfo->eCurrentState != P2P_STATE_IDLE) {
1871 // Make sure the state is in IDLE state.
1872 p2pFsmRunEventAbort(prAdapter, prP2pFsmInfo);
1875 // 20120118: Moved to p2pFuncSwitchOPMode().
1876 //SET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX);
1878 /* Leave IDLE state. */
1879 SET_NET_PWR_STATE_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX);
1881 // sync with firmware
1882 //DBGLOG(P2P, INFO, ("Activate P2P Network. \n"));
1883 //nicActivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX);
1886 /* Key to trigger P2P FSM to allocate channel for AP mode. */
1887 prP2pBssInfo->eIntendOPMode = OP_MODE_ACCESS_POINT;
1889 /* Sparse Channel to decide which channel to use. */
1890 if ((cnmPreferredChannel(prAdapter,
1893 &eSco) == FALSE) && (prP2pConnSettings->ucOperatingChnl == 0)) {
1894 // Sparse Channel Detection using passive mode.
1895 eNextState = P2P_STATE_AP_CHANNEL_DETECT;
1898 P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo = prAdapter->rWifiVar.prP2pSpecificBssInfo;
1899 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = &prP2pFsmInfo->rChnlReqInfo;
1903 /* 2012-01-27: frog - Channel set from upper layer is the first priority. */
1904 /* Becuase the channel & beacon is decided by p2p_supplicant. */
1905 if (prP2pConnSettings->ucOperatingChnl != 0) {
1906 prP2pSpecificBssInfo->ucPreferredChannel = prP2pConnSettings->ucOperatingChnl;
1907 prP2pSpecificBssInfo->eRfBand = prP2pConnSettings->eBand;
1911 ASSERT(ucPreferedChnl != 0);
1912 prP2pSpecificBssInfo->ucPreferredChannel = ucPreferedChnl;
1913 prP2pSpecificBssInfo->eRfBand = eBand;
1916 if (ucPreferedChnl) {
1917 prP2pSpecificBssInfo->ucPreferredChannel = ucPreferedChnl;
1918 prP2pSpecificBssInfo->eRfBand = eBand;
1921 ASSERT(prP2pConnSettings->ucOperatingChnl != 0);
1922 prP2pSpecificBssInfo->ucPreferredChannel = prP2pConnSettings->ucOperatingChnl;
1923 prP2pSpecificBssInfo->eRfBand = prP2pConnSettings->eBand;
1927 prChnlReqInfo->ucReqChnlNum = prP2pSpecificBssInfo->ucPreferredChannel;
1928 prChnlReqInfo->eBand = prP2pSpecificBssInfo->eRfBand;
1929 prChnlReqInfo->eChannelReqType = CHANNEL_REQ_TYPE_GO_START_BSS;
1932 /* If channel is specified, use active scan to shorten the scan time. */
1933 p2pFsmStateTransition(prAdapter,
1934 prAdapter->rWifiVar.prP2pFsmInfo,
1945 cnmMemFree(prAdapter, prMsgHdr);
1949 } /* p2pFsmRunEventStartAP */
1952 p2pFsmRunEventNetDeviceRegister (
1953 IN P_ADAPTER_T prAdapter,
1954 IN P_MSG_HDR_T prMsgHdr
1957 P_MSG_P2P_NETDEV_REGISTER_T prNetDevRegisterMsg = (P_MSG_P2P_NETDEV_REGISTER_T)NULL;
1962 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1964 DBGLOG(P2P, TRACE, ("p2pFsmRunEventNetDeviceRegister\n"));
1966 prNetDevRegisterMsg = (P_MSG_P2P_NETDEV_REGISTER_T)prMsgHdr;
1968 if (prNetDevRegisterMsg->fgIsEnable) {
1969 p2pSetMode((prNetDevRegisterMsg->ucMode == 1)?TRUE:FALSE);
1971 if (p2pLaunch(prAdapter->prGlueInfo)) {
1972 ASSERT(prAdapter->fgIsP2PRegistered);
1977 if (prAdapter->fgIsP2PRegistered) {
1978 p2pRemove(prAdapter->prGlueInfo);
1985 cnmMemFree(prAdapter, prMsgHdr);
1989 } /* p2pFsmRunEventNetDeviceRegister */
1993 p2pFsmRunEventUpdateMgmtFrame (
1994 IN P_ADAPTER_T prAdapter,
1995 IN P_MSG_HDR_T prMsgHdr
1998 P_MSG_P2P_MGMT_FRAME_UPDATE_T prP2pMgmtFrameUpdateMsg = (P_MSG_P2P_MGMT_FRAME_UPDATE_T)NULL;
1999 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2002 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
2004 DBGLOG(P2P, TRACE, ("p2pFsmRunEventUpdateMgmtFrame\n"));
2006 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2008 if (prP2pFsmInfo == NULL) {
2012 prP2pMgmtFrameUpdateMsg = (P_MSG_P2P_MGMT_FRAME_UPDATE_T)prMsgHdr;
2014 switch (prP2pMgmtFrameUpdateMsg->eBufferType) {
2015 case ENUM_FRAME_TYPE_EXTRA_IE_BEACON:
2017 case ENUM_FRAME_TYPE_EXTRA_IE_ASSOC_RSP:
2019 case ENUM_FRAME_TYPE_EXTRA_IE_PROBE_RSP:
2021 case ENUM_FRAME_TYPE_PROBE_RSP_TEMPLATE:
2023 case ENUM_FRAME_TYPE_BEACON_TEMPLATE:
2032 cnmMemFree(prAdapter, prMsgHdr);
2036 } /* p2pFsmRunEventUpdateMgmtFrame */
2040 p2pFsmRunEventBeaconUpdate (
2041 IN P_ADAPTER_T prAdapter,
2042 IN P_MSG_HDR_T prMsgHdr
2045 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2046 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2047 P_MSG_P2P_BEACON_UPDATE_T prBcnUpdateMsg = (P_MSG_P2P_BEACON_UPDATE_T)NULL;
2050 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
2052 DBGLOG(P2P, TRACE, ("p2pFsmRunEventBeaconUpdate\n"));
2055 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2057 if (prP2pFsmInfo == NULL) {
2061 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2062 prBcnUpdateMsg = (P_MSG_P2P_BEACON_UPDATE_T)prMsgHdr;
2065 p2pFuncBeaconUpdate(prAdapter,
2067 &prP2pFsmInfo->rBcnContentInfo,
2068 prBcnUpdateMsg->pucBcnHdr,
2069 prBcnUpdateMsg->u4BcnHdrLen,
2070 prBcnUpdateMsg->pucBcnBody,
2071 prBcnUpdateMsg->u4BcnBodyLen);
2073 if ((prP2pBssInfo->eCurrentOPMode == OP_MODE_ACCESS_POINT) &&
2074 (prP2pBssInfo->eIntendOPMode == OP_MODE_NUM)) {
2075 /* AP is created, Beacon Update. */
2076 //nicPmIndicateBssAbort(prAdapter, NETWORK_TYPE_P2P_INDEX);
2078 bssUpdateBeaconContent(prAdapter, NETWORK_TYPE_P2P_INDEX);
2080 //nicPmIndicateBssCreated(prAdapter, NETWORK_TYPE_P2P_INDEX);
2089 cnmMemFree(prAdapter, prMsgHdr);
2092 } /* p2pFsmRunEventBeaconUpdate */
2096 p2pFsmRunEventStopAP (
2097 IN P_ADAPTER_T prAdapter,
2098 IN P_MSG_HDR_T prMsgHdr
2101 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2104 ASSERT_BREAK((prAdapter != NULL));
2106 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2108 DBGLOG(P2P, TRACE, ("p2pFsmRunEventStopAP\n"));
2110 if ((prP2pBssInfo->eCurrentOPMode == OP_MODE_ACCESS_POINT)
2111 && (prP2pBssInfo->eIntendOPMode == OP_MODE_NUM)) {
2112 /* AP is created, Beacon Update. */
2114 p2pFuncDissolve(prAdapter, prP2pBssInfo, TRUE, REASON_CODE_DEAUTH_LEAVING_BSS);
2116 DBGLOG(P2P, TRACE, ("Stop Beaconing\n"));
2117 nicPmIndicateBssAbort(prAdapter, NETWORK_TYPE_P2P_INDEX);
2119 /* Reset RLM related field of BSSINFO. */
2120 rlmBssAborted(prAdapter, prP2pBssInfo);
2125 // 20120118: Moved to p2pFuncSwitchOPMode().
2126 //UNSET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX);
2128 /* Enter IDLE state. */
2129 SET_NET_PWR_STATE_IDLE(prAdapter, NETWORK_TYPE_P2P_INDEX);
2131 DBGLOG(P2P, INFO, ("Re activate P2P Network. \n"));
2132 nicDeactivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX);
2134 nicActivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX);
2137 p2pFsmRunEventWfdSettingUpdate(prAdapter, NULL);
2140 p2pFsmRunEventAbort(prAdapter, prAdapter->rWifiVar.prP2pFsmInfo);
2141 // p2pFsmStateTransition(prAdapter, prAdapter->rWifiVar.prP2pFsmInfo, P2P_STATE_IDLE);
2146 cnmMemFree(prAdapter, prMsgHdr);
2149 } /* p2pFsmRunEventStopAP */
2152 p2pFsmRunEventConnectionRequest (
2153 IN P_ADAPTER_T prAdapter,
2154 IN P_MSG_HDR_T prMsgHdr
2157 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2158 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2159 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = (P_P2P_CHNL_REQ_INFO_T)NULL;
2160 P_MSG_P2P_CONNECTION_REQUEST_T prConnReqMsg = (P_MSG_P2P_CONNECTION_REQUEST_T)NULL;
2161 P_P2P_CONNECTION_REQ_INFO_T prConnReqInfo = (P_P2P_CONNECTION_REQ_INFO_T)NULL;
2164 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
2166 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2167 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2169 if (prP2pFsmInfo == NULL) {
2173 prConnReqMsg = (P_MSG_P2P_CONNECTION_REQUEST_T)prMsgHdr;
2175 prConnReqInfo = &(prP2pFsmInfo->rConnReqInfo);
2176 prChnlReqInfo = &(prP2pFsmInfo->rChnlReqInfo);
2178 DBGLOG(P2P, TRACE, ("p2pFsmRunEventConnectionRequest\n"));
2180 if (prP2pBssInfo->eCurrentOPMode != OP_MODE_INFRASTRUCTURE) {
2184 SET_NET_PWR_STATE_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX);
2187 // Make sure the state is in IDLE state.
2188 p2pFsmRunEventAbort(prAdapter, prP2pFsmInfo);
2190 // Update connection request information.
2191 prConnReqInfo->fgIsConnRequest = TRUE;
2192 COPY_MAC_ADDR(prConnReqInfo->aucBssid, prConnReqMsg->aucBssid);
2193 kalMemCopy(&(prConnReqInfo->rSsidStruct), &(prConnReqMsg->rSsid), sizeof(P2P_SSID_STRUCT_T));
2194 kalMemCopy(prConnReqInfo->aucIEBuf, prConnReqMsg->aucIEBuf, prConnReqMsg->u4IELen);
2195 prConnReqInfo->u4BufLength = prConnReqMsg->u4IELen;
2197 /* Find BSS Descriptor first. */
2198 prP2pFsmInfo->prTargetBss = scanP2pSearchDesc(prAdapter,
2202 if (prP2pFsmInfo->prTargetBss == NULL) {
2203 /* Update scan parameter... to scan target device. */
2204 P_P2P_SCAN_REQ_INFO_T prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo);
2206 prScanReqInfo->ucNumChannelList = 1;
2207 prScanReqInfo->eScanType = SCAN_TYPE_ACTIVE_SCAN;
2208 prScanReqInfo->eChannelSet = SCAN_CHANNEL_SPECIFIED;
2209 prScanReqInfo->arScanChannelList[0].ucChannelNum = prConnReqMsg->rChannelInfo.ucChannelNum;
2210 kalMemCopy(&(prScanReqInfo->rSsidStruct), &(prConnReqMsg->rSsid), sizeof(P2P_SSID_STRUCT_T));
2211 prScanReqInfo->u4BufLength = 0; /* Prevent other P2P ID in IE. */
2212 prScanReqInfo->fgIsAbort = TRUE;
2214 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_SCAN);
2217 prChnlReqInfo->u8Cookie = 0;
2218 prChnlReqInfo->ucReqChnlNum = prConnReqMsg->rChannelInfo.ucChannelNum;
2219 prChnlReqInfo->eBand = prConnReqMsg->rChannelInfo.eBand;
2220 prChnlReqInfo->eChnlSco = prConnReqMsg->eChnlSco;
2221 prChnlReqInfo->u4MaxInterval = AIS_JOIN_CH_REQUEST_INTERVAL;
2222 prChnlReqInfo->eChannelReqType = CHANNEL_REQ_TYPE_GC_JOIN_REQ;
2224 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_REQING_CHANNEL);
2231 cnmMemFree(prAdapter, prMsgHdr);
2236 } /* p2pFsmRunEventConnectionRequest */
2238 /*----------------------------------------------------------------------------*/
2240 * \brief This function is used to handle Connection Request from Supplicant.
2242 * \param[in] prAdapter Pointer of ADAPTER_T
2246 /*----------------------------------------------------------------------------*/
2248 p2pFsmRunEventConnectionAbort (
2249 IN P_ADAPTER_T prAdapter,
2250 IN P_MSG_HDR_T prMsgHdr
2253 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2254 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2255 P_MSG_P2P_CONNECTION_ABORT_T prDisconnMsg = (P_MSG_P2P_CONNECTION_ABORT_T)NULL;
2256 //P_STA_RECORD_T prTargetStaRec = (P_STA_RECORD_T)NULL;
2260 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
2262 DBGLOG(P2P, STATE, ("p2pFsmRunEventConnectionAbort: Connection Abort.\n"));
2264 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2266 if (prP2pFsmInfo == NULL) {
2270 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2272 prDisconnMsg = (P_MSG_P2P_CONNECTION_ABORT_T)prMsgHdr;
2274 switch (prP2pBssInfo->eCurrentOPMode) {
2275 case OP_MODE_INFRASTRUCTURE:
2277 UINT_8 aucBCBSSID[] = BC_BSSID;
2279 if (!prP2pBssInfo->prStaRecOfAP) {
2280 DBGLOG(P2P, TRACE, ("GO's StaRec is NULL\n"));
2283 if (UNEQUAL_MAC_ADDR(prP2pBssInfo->prStaRecOfAP->aucMacAddr, prDisconnMsg->aucTargetID) &&
2284 UNEQUAL_MAC_ADDR(prDisconnMsg->aucTargetID, aucBCBSSID)) {
2285 DBGLOG(P2P, TRACE, ("Unequal MAC ADDR ["MACSTR":"MACSTR"]\n",
2286 MAC2STR(prP2pBssInfo->prStaRecOfAP->aucMacAddr),
2287 MAC2STR(prDisconnMsg->aucTargetID)));
2292 kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo, NULL, NULL, 0, 0);
2294 /* Stop rejoin timer if it is started. */
2297 p2pFuncDisconnect(prAdapter, prP2pBssInfo->prStaRecOfAP, prDisconnMsg->fgSendDeauth, prDisconnMsg->u2ReasonCode);
2299 //prTargetStaRec = prP2pBssInfo->prStaRecOfAP;
2301 /* Fix possible KE when RX Beacon & call nicPmIndicateBssConnected(). hit prStaRecOfAP == NULL. */
2302 p2pChangeMediaState(prAdapter, PARAM_MEDIA_STATE_DISCONNECTED);
2304 prP2pBssInfo->prStaRecOfAP = NULL;
2306 SET_NET_PWR_STATE_IDLE(prAdapter, NETWORK_TYPE_P2P_INDEX);
2308 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
2312 case OP_MODE_ACCESS_POINT:
2314 P_LINK_T prStaRecOfClientList = &prP2pBssInfo->rStaRecOfClientList;
2315 /* Search specific client device, and disconnect. */
2316 /* 1. Send deauthentication frame. */
2317 /* 2. Indication: Device disconnect. */
2318 P_LINK_ENTRY_T prLinkEntry = (P_LINK_ENTRY_T)NULL;
2319 P_STA_RECORD_T prCurrStaRec = (P_STA_RECORD_T)NULL;
2321 DBGLOG(P2P, TRACE, ("Disconnecting with Target ID: "MACSTR"\n", MAC2STR(prDisconnMsg->aucTargetID)));
2323 LINK_FOR_EACH(prLinkEntry, prStaRecOfClientList) {
2324 prCurrStaRec = LINK_ENTRY(prLinkEntry, STA_RECORD_T, rLinkEntry);
2326 ASSERT(prCurrStaRec);
2328 if (EQUAL_MAC_ADDR(prCurrStaRec->aucMacAddr, prDisconnMsg->aucTargetID)) {
2330 DBGLOG(P2P, TRACE, ("Disconnecting: "MACSTR"\n", MAC2STR(prCurrStaRec->aucMacAddr)));
2332 /* Remove STA from client list. */
2333 LINK_REMOVE_KNOWN_ENTRY(prStaRecOfClientList, &prCurrStaRec->rLinkEntry);
2335 /* Glue layer indication. */
2336 //kalP2PGOStationUpdate(prAdapter->prGlueInfo, prCurrStaRec, FALSE);
2338 /* Send deauth & do indication. */
2339 p2pFuncDisconnect(prAdapter, prCurrStaRec, prDisconnMsg->fgSendDeauth, prDisconnMsg->u2ReasonCode);
2341 //prTargetStaRec = prCurrStaRec;
2349 case OP_MODE_P2P_DEVICE:
2357 //20120830 moved into p2pFuncDisconnect()
2358 //if ((!prDisconnMsg->fgSendDeauth) && (prTargetStaRec)) {
2359 // cnmStaRecFree(prAdapter, prTargetStaRec, TRUE);
2364 cnmMemFree(prAdapter, prMsgHdr);
2368 } /* p2pFsmRunEventConnectionAbort */
2372 p2pFsmRunEventDissolve (
2373 IN P_ADAPTER_T prAdapter,
2374 IN P_MSG_HDR_T prMsgHdr
2380 DBGLOG(P2P, TRACE, ("p2pFsmRunEventDissolve\n"));
2383 cnmMemFree(prAdapter, prMsgHdr);
2389 p2pFsmRunEventDeauthTxDone (
2390 IN P_ADAPTER_T prAdapter,
2391 IN P_MSDU_INFO_T prMsduInfo,
2392 IN ENUM_TX_RESULT_CODE_T rTxDoneStatus
2396 P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL;
2397 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2398 ENUM_PARAM_MEDIA_STATE_T eOriMediaStatus;
2402 ASSERT_BREAK((prAdapter != NULL) &&
2403 (prMsduInfo != NULL));
2405 DBGLOG(P2P, TRACE, ("Deauth TX Done\n"));
2407 prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex);
2409 if (prStaRec == NULL) {
2410 DBGLOG(P2P, TRACE, ("Station Record NULL, Index:%d\n", prMsduInfo->ucStaRecIndex));
2414 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2415 eOriMediaStatus = prP2pBssInfo->eConnectionState;
2418 bssRemoveStaRecFromClientList(prAdapter, prP2pBssInfo, prStaRec);
2421 cnmStaRecFree(prAdapter, prStaRec, TRUE);
2423 if ((prP2pBssInfo->eCurrentOPMode != OP_MODE_ACCESS_POINT) ||
2424 (prP2pBssInfo->rStaRecOfClientList.u4NumElem == 0)) {
2425 DBGLOG(P2P, TRACE, ("No More Client, Media Status DISCONNECTED\n"));
2426 p2pChangeMediaState(prAdapter, PARAM_MEDIA_STATE_DISCONNECTED);
2429 /* Because the eConnectionState is changed before Deauth TxDone. Dont Check eConnectionState */
2430 //if (eOriMediaStatus != prP2pBssInfo->eConnectionState) {
2431 /* Update Disconnected state to FW. */
2432 nicUpdateBss(prAdapter, NETWORK_TYPE_P2P_INDEX);
2438 return WLAN_STATUS_SUCCESS;
2439 } /* p2pFsmRunEventDeauthTxDone */
2443 p2pFsmRunEventMgmtFrameTxDone (
2444 IN P_ADAPTER_T prAdapter,
2445 IN P_MSDU_INFO_T prMsduInfo,
2446 IN ENUM_TX_RESULT_CODE_T rTxDoneStatus
2449 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2450 P_P2P_MGMT_TX_REQ_INFO_T prMgmtTxReqInfo = (P_P2P_MGMT_TX_REQ_INFO_T)NULL;
2451 BOOLEAN fgIsSuccess = FALSE;
2454 ASSERT_BREAK((prAdapter != NULL) && (prMsduInfo != NULL));
2456 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2457 prMgmtTxReqInfo = &(prP2pFsmInfo->rMgmtTxInfo);
2459 if (rTxDoneStatus != TX_RESULT_SUCCESS) {
2460 DBGLOG(P2P, TRACE, ("Mgmt Frame TX Fail, Status:%d.\n", rTxDoneStatus));
2465 DBGLOG(P2P, TRACE, ("Mgmt Frame TX Done.\n"));
2469 if (prMgmtTxReqInfo->prMgmtTxMsdu == prMsduInfo) {
2471 kalP2PIndicateMgmtTxStatus(prAdapter->prGlueInfo,
2472 prMgmtTxReqInfo->u8Cookie,
2474 prMsduInfo->prPacket,
2475 (UINT_32)prMsduInfo->u2FrameLength);
2477 prMgmtTxReqInfo->prMgmtTxMsdu = NULL;
2482 return WLAN_STATUS_SUCCESS;
2484 } /* p2pFsmRunEventMgmtFrameTxDone */
2487 /*----------------------------------------------------------------------------*/
2489 * \brief This function is called when JOIN complete message event is received from SAA.
2491 * \param[in] prAdapter Pointer of ADAPTER_T
2495 /*----------------------------------------------------------------------------*/
2497 p2pFsmRunEventJoinComplete (
2498 IN P_ADAPTER_T prAdapter,
2499 IN P_MSG_HDR_T prMsgHdr
2502 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2503 P_P2P_JOIN_INFO_T prJoinInfo = (P_P2P_JOIN_INFO_T)NULL;
2504 P_MSG_JOIN_COMP_T prJoinCompMsg = (P_MSG_JOIN_COMP_T)NULL;
2505 P_SW_RFB_T prAssocRspSwRfb = (P_SW_RFB_T)NULL;
2506 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2509 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
2511 DBGLOG(P2P, TRACE, ("P2P Join Complete\n"));
2513 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2515 if (prP2pFsmInfo == NULL) {
2520 prJoinInfo = &(prP2pFsmInfo->rJoinInfo);
2521 prJoinCompMsg = (P_MSG_JOIN_COMP_T)prMsgHdr;
2522 prAssocRspSwRfb = prJoinCompMsg->prSwRfb;
2523 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2525 if (prP2pBssInfo->eCurrentOPMode == OP_MODE_INFRASTRUCTURE) {
2526 P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL;
2528 prStaRec = prJoinCompMsg->prStaRec;
2531 if (prJoinCompMsg->ucSeqNum == prJoinInfo->ucSeqNumOfReqMsg) {
2532 ASSERT(prStaRec == prJoinInfo->prTargetStaRec);
2533 prJoinInfo->fgIsJoinComplete = TRUE;
2535 if (prJoinCompMsg->rJoinStatus == WLAN_STATUS_SUCCESS) {
2537 //4 <1.1> Change FW's Media State immediately.
2538 p2pChangeMediaState(prAdapter, PARAM_MEDIA_STATE_CONNECTED);
2540 //4 <1.2> Deactivate previous AP's STA_RECORD_T in Driver if have.
2541 if ((prP2pBssInfo->prStaRecOfAP) &&
2542 (prP2pBssInfo->prStaRecOfAP != prStaRec)) {
2543 cnmStaRecChangeState(prAdapter, prP2pBssInfo->prStaRecOfAP, STA_STATE_1);
2545 cnmStaRecFree(prAdapter, prP2pBssInfo->prStaRecOfAP, TRUE);
2547 prP2pBssInfo->prStaRecOfAP = NULL;
2550 //4 <1.3> Update BSS_INFO_T
2551 p2pFuncUpdateBssInfoForJOIN(prAdapter, prP2pFsmInfo->prTargetBss, prStaRec, prAssocRspSwRfb);
2553 //4 <1.4> Activate current AP's STA_RECORD_T in Driver.
2554 cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_3);
2556 #if CFG_SUPPORT_P2P_RSSI_QUERY
2557 //<1.5> Update RSSI if necessary
2558 nicUpdateRSSI(prAdapter, NETWORK_TYPE_P2P_INDEX, (INT_8)(RCPI_TO_dBm(prStaRec->ucRCPI)), 0);
2561 //4 <1.6> Indicate Connected Event to Host immediately.
2562 /* Require BSSID, Association ID, Beacon Interval.. from AIS_BSS_INFO_T */
2563 //p2pIndicationOfMediaStateToHost(prAdapter, PARAM_MEDIA_STATE_CONNECTED, prStaRec->aucMacAddr);
2564 kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo,
2565 &prP2pFsmInfo->rConnReqInfo,
2566 prJoinInfo->aucIEBuf,
2567 prJoinInfo->u4BufLength,
2568 prStaRec->u2StatusCode);
2573 //4 <2.1> Redo JOIN process with other Auth Type if possible
2574 if (p2pFuncRetryJOIN(prAdapter, prStaRec, prJoinInfo) == FALSE) {
2575 P_BSS_DESC_T prBssDesc;
2577 /* Increase Failure Count */
2578 prStaRec->ucJoinFailureCount++;
2580 prBssDesc = prP2pFsmInfo->prTargetBss;
2583 ASSERT(prBssDesc->fgIsConnecting);
2585 prBssDesc->fgIsConnecting = FALSE;
2587 if( prStaRec->ucJoinFailureCount >=3) {
2589 kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo,
2590 &prP2pFsmInfo->rConnReqInfo,
2591 prJoinInfo->aucIEBuf,
2592 prJoinInfo->u4BufLength,
2593 prStaRec->u2StatusCode);
2596 /* Sometime the GO is not ready to response auth. Connect it again*/
2597 prP2pFsmInfo->prTargetBss = NULL;
2607 if (prAssocRspSwRfb) {
2608 nicRxReturnRFB(prAdapter, prAssocRspSwRfb);
2611 if (prP2pFsmInfo->eCurrentState == P2P_STATE_GC_JOIN) {
2613 if(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX].eConnectionState == PARAM_MEDIA_STATE_CONNECTED) {
2614 /* Return to IDLE state. */
2615 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
2618 //p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
2620 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_SCAN);
2627 cnmMemFree(prAdapter, prMsgHdr);
2632 } /* p2pFsmRunEventJoinComplete */
2637 p2pFsmRunEventMgmtFrameRegister (
2638 IN P_ADAPTER_T prAdapter,
2639 IN P_MSG_HDR_T prMsgHdr
2642 P_MSG_P2P_MGMT_FRAME_REGISTER_T prMgmtFrameRegister = (P_MSG_P2P_MGMT_FRAME_REGISTER_T)NULL;
2643 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2646 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
2648 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2650 if (prP2pFsmInfo == NULL) {
2654 prMgmtFrameRegister = (P_MSG_P2P_MGMT_FRAME_REGISTER_T)prMsgHdr;
2656 p2pFuncMgmtFrameRegister(prAdapter,
2657 prMgmtFrameRegister->u2FrameType,
2658 prMgmtFrameRegister->fgIsRegister,
2659 &prP2pFsmInfo->u4P2pPacketFilter);
2665 cnmMemFree(prAdapter, prMsgHdr);
2670 } /* p2pFsmRunEventMgmtFrameRegister */
2676 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2677 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2678 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2679 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2680 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2681 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2682 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2683 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2684 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2685 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2686 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2687 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2688 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2689 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2698 /*----------------------------------------------------------------------------*/
2700 * \brief This function is call when RX deauthentication frame from the AIR.
2701 * If we are under STA mode, we would go back to P2P Device.
2702 * If we are under AP mode, we would stay in AP mode until disconnect event from HOST.
2704 * \param[in] prAdapter Pointer of ADAPTER_T
2708 /*----------------------------------------------------------------------------*/
2710 p2pFsmRunEventRxDeauthentication (
2711 IN P_ADAPTER_T prAdapter,
2712 IN P_STA_RECORD_T prStaRec,
2713 IN P_SW_RFB_T prSwRfb
2716 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2717 UINT_16 u2ReasonCode = 0;
2720 ASSERT_BREAK((prAdapter != NULL) && (prSwRfb != NULL));
2722 if (prStaRec == NULL) {
2723 prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx);
2731 prP2pBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX];
2733 if (prStaRec->ucStaState == STA_STATE_1) {
2737 DBGLOG(P2P, TRACE, ("RX Deauth\n"));
2739 switch (prP2pBssInfo->eCurrentOPMode) {
2740 case OP_MODE_INFRASTRUCTURE:
2741 if (authProcessRxDeauthFrame(prSwRfb,
2742 prStaRec->aucMacAddr,
2743 &u2ReasonCode) == WLAN_STATUS_SUCCESS) {
2744 P_WLAN_DEAUTH_FRAME_T prDeauthFrame = (P_WLAN_DEAUTH_FRAME_T)prSwRfb->pvHeader;
2745 UINT_16 u2IELength = 0;
2747 if (prP2pBssInfo->prStaRecOfAP != prStaRec) {
2752 prStaRec->u2ReasonCode = u2ReasonCode;
2753 u2IELength = prSwRfb->u2PacketLen - (WLAN_MAC_HEADER_LEN + REASON_CODE_FIELD_LEN);
2755 ASSERT(prP2pBssInfo->prStaRecOfAP == prStaRec);
2757 /* Indicate disconnect to Host. */
2758 kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo,
2760 prDeauthFrame->aucInfoElem,
2764 prP2pBssInfo->prStaRecOfAP = NULL;
2766 p2pFuncDisconnect(prAdapter, prStaRec, FALSE, u2ReasonCode);
2769 case OP_MODE_ACCESS_POINT:
2770 /* Delete client from client list. */
2771 if (authProcessRxDeauthFrame(prSwRfb,
2772 prP2pBssInfo->aucBSSID,
2773 &u2ReasonCode) == WLAN_STATUS_SUCCESS) {
2774 P_LINK_T prStaRecOfClientList = (P_LINK_T)NULL;
2775 P_LINK_ENTRY_T prLinkEntry = (P_LINK_ENTRY_T)NULL;
2776 P_STA_RECORD_T prCurrStaRec = (P_STA_RECORD_T)NULL;
2778 prStaRecOfClientList = &prP2pBssInfo->rStaRecOfClientList;
2780 LINK_FOR_EACH(prLinkEntry, prStaRecOfClientList) {
2781 prCurrStaRec = LINK_ENTRY(prLinkEntry, STA_RECORD_T, rLinkEntry);
2783 ASSERT(prCurrStaRec);
2785 if (EQUAL_MAC_ADDR(prCurrStaRec->aucMacAddr, prStaRec->aucMacAddr)) {
2787 /* Remove STA from client list. */
2788 LINK_REMOVE_KNOWN_ENTRY(prStaRecOfClientList, &prCurrStaRec->rLinkEntry);
2790 /* Indicate to Host. */
2791 //kalP2PGOStationUpdate(prAdapter->prGlueInfo, prStaRec, FALSE);
2793 /* Indicate disconnect to Host. */
2794 p2pFuncDisconnect(prAdapter, prStaRec, FALSE, u2ReasonCode);
2801 case OP_MODE_P2P_DEVICE:
2803 /* Findout why someone sent deauthentication frame to us. */
2808 DBGLOG(P2P, TRACE, ("Deauth Reason:%d\n", u2ReasonCode));
2813 } /* p2pFsmRunEventRxDeauthentication */
2815 /*----------------------------------------------------------------------------*/
2817 * \brief This function is call when RX deauthentication frame from the AIR.
2818 * If we are under STA mode, we would go back to P2P Device.
2819 * If we are under AP mode, we would stay in AP mode until disconnect event from HOST.
2821 * \param[in] prAdapter Pointer of ADAPTER_T
2825 /*----------------------------------------------------------------------------*/
2827 p2pFsmRunEventRxDisassociation (
2828 IN P_ADAPTER_T prAdapter,
2829 IN P_STA_RECORD_T prStaRec,
2830 IN P_SW_RFB_T prSwRfb
2833 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2834 UINT_16 u2ReasonCode = 0;
2837 ASSERT_BREAK((prAdapter != NULL) && (prSwRfb != NULL));
2839 if (prStaRec == NULL) {
2840 prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx);
2844 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2846 if (prStaRec->ucStaState == STA_STATE_1) {
2851 DBGLOG(P2P, TRACE, ("RX Disassoc\n"));
2853 switch (prP2pBssInfo->eCurrentOPMode) {
2854 case OP_MODE_INFRASTRUCTURE:
2855 if (assocProcessRxDisassocFrame(prAdapter,
2857 prStaRec->aucMacAddr,
2858 &prStaRec->u2ReasonCode) == WLAN_STATUS_SUCCESS) {
2859 P_WLAN_DISASSOC_FRAME_T prDisassocFrame = (P_WLAN_DISASSOC_FRAME_T)prSwRfb->pvHeader;
2860 UINT_16 u2IELength = 0;
2862 ASSERT(prP2pBssInfo->prStaRecOfAP == prStaRec);
2864 if (prP2pBssInfo->prStaRecOfAP != prStaRec) {
2869 u2IELength = prSwRfb->u2PacketLen - (WLAN_MAC_HEADER_LEN + REASON_CODE_FIELD_LEN);
2871 /* Indicate disconnect to Host. */
2872 kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo,
2874 prDisassocFrame->aucInfoElem,
2876 prStaRec->u2ReasonCode);
2878 prP2pBssInfo->prStaRecOfAP = NULL;
2880 p2pFuncDisconnect(prAdapter, prStaRec, FALSE, prStaRec->u2ReasonCode);
2884 case OP_MODE_ACCESS_POINT:
2885 /* Delete client from client list. */
2886 if (assocProcessRxDisassocFrame(prAdapter,
2888 prP2pBssInfo->aucBSSID,
2889 &u2ReasonCode) == WLAN_STATUS_SUCCESS) {
2890 P_LINK_T prStaRecOfClientList = (P_LINK_T)NULL;
2891 P_LINK_ENTRY_T prLinkEntry = (P_LINK_ENTRY_T)NULL;
2892 P_STA_RECORD_T prCurrStaRec = (P_STA_RECORD_T)NULL;
2894 prStaRecOfClientList = &prP2pBssInfo->rStaRecOfClientList;
2896 LINK_FOR_EACH(prLinkEntry, prStaRecOfClientList) {
2897 prCurrStaRec = LINK_ENTRY(prLinkEntry, STA_RECORD_T, rLinkEntry);
2899 ASSERT(prCurrStaRec);
2901 if (EQUAL_MAC_ADDR(prCurrStaRec->aucMacAddr, prStaRec->aucMacAddr)) {
2903 /* Remove STA from client list. */
2904 LINK_REMOVE_KNOWN_ENTRY(prStaRecOfClientList, &prCurrStaRec->rLinkEntry);
2906 /* Indicate to Host. */
2907 //kalP2PGOStationUpdate(prAdapter->prGlueInfo, prStaRec, FALSE);
2909 /* Indicate disconnect to Host. */
2910 p2pFuncDisconnect(prAdapter, prStaRec, FALSE, u2ReasonCode);
2917 case OP_MODE_P2P_DEVICE:
2927 } /* p2pFsmRunEventRxDisassociation */
2933 /*----------------------------------------------------------------------------*/
2935 * \brief This function is called when a probe request frame is received.
2937 * \param[in] prAdapter Pointer of ADAPTER_T
2939 * \return boolean value if probe response frame is accepted & need cancel scan request.
2941 /*----------------------------------------------------------------------------*/
2943 p2pFsmRunEventRxProbeResponseFrame (
2944 IN P_ADAPTER_T prAdapter,
2945 IN P_SW_RFB_T prSwRfb,
2946 IN P_BSS_DESC_T prBssDesc
2949 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2950 P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = (P_P2P_CONNECTION_SETTINGS_T)NULL;
2951 P_WLAN_MAC_MGMT_HEADER_T prMgtHdr = (P_WLAN_MAC_MGMT_HEADER_T)NULL;
2952 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2955 ASSERT_BREAK((prAdapter != NULL) && (prSwRfb != NULL) && (prBssDesc != NULL));
2957 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2958 prP2pConnSettings = prAdapter->rWifiVar.prP2PConnSettings;
2959 prP2pBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX];
2961 /* There is a connection request. */
2962 prMgtHdr = (P_WLAN_MAC_MGMT_HEADER_T)prSwRfb->pvHeader;
2967 } /* p2pFsmRunEventRxProbeResponseFrame */
2975 p2pFsmRunEventBeaconTimeout (
2976 IN P_ADAPTER_T prAdapter
2979 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2980 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2983 ASSERT_BREAK(prAdapter != NULL);
2985 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2986 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2988 DBGLOG(P2P, TRACE, ("p2pFsmRunEventBeaconTimeout: Beacon Timeout\n"));
2990 /* Only client mode would have beacon lost event. */
2991 ASSERT(prP2pBssInfo->eCurrentOPMode == OP_MODE_INFRASTRUCTURE);
2993 if (prP2pBssInfo->eConnectionState == PARAM_MEDIA_STATE_CONNECTED) {
2994 /* Indicate disconnect to Host. */
2995 kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo,
2999 REASON_CODE_DISASSOC_INACTIVITY);
3001 if (prP2pBssInfo->prStaRecOfAP != NULL) {
3002 P_STA_RECORD_T prStaRec = prP2pBssInfo->prStaRecOfAP;
3004 prP2pBssInfo->prStaRecOfAP = NULL;
3006 p2pFuncDisconnect(prAdapter, prStaRec, FALSE, REASON_CODE_DISASSOC_LEAVING_BSS);
3008 //20120830 moved into p2pFuncDisconnect()
3009 //cnmStaRecFree(prAdapter, prP2pBssInfo->prStaRecOfAP, TRUE);
3017 } /* p2pFsmRunEventBeaconTimeout */
3024 p2pFsmRunEventWfdSettingUpdate (
3025 IN P_ADAPTER_T prAdapter,
3026 IN P_MSG_HDR_T prMsgHdr
3029 P_WFD_CFG_SETTINGS_T prWfdCfgSettings = (P_WFD_CFG_SETTINGS_T)NULL;
3030 P_MSG_WFD_CONFIG_SETTINGS_CHANGED_T prMsgWfdCfgSettings = (P_MSG_WFD_CONFIG_SETTINGS_CHANGED_T)NULL;
3031 WLAN_STATUS rStatus;
3034 DBGLOG(P2P, INFO,("p2pFsmRunEventWfdSettingUpdate\n"));
3037 ASSERT_BREAK((prAdapter != NULL));
3039 if (prMsgHdr != NULL) {
3040 prMsgWfdCfgSettings = (P_MSG_WFD_CONFIG_SETTINGS_CHANGED_T)prMsgHdr;
3041 prWfdCfgSettings = prMsgWfdCfgSettings->prWfdCfgSettings;
3044 prWfdCfgSettings = &prAdapter->rWifiVar.prP2pFsmInfo->rWfdConfigureSettings;
3047 DBGLOG(P2P, INFO,("WFD Enalbe %x info %x state %x flag %x adv %x\n",
3048 prWfdCfgSettings->ucWfdEnable,
3049 prWfdCfgSettings->u2WfdDevInfo,
3050 prWfdCfgSettings->u4WfdState,
3051 prWfdCfgSettings->u4WfdFlag,
3052 prWfdCfgSettings->u4WfdAdvancedFlag));
3054 rStatus = wlanSendSetQueryCmd (
3055 prAdapter, /* prAdapter */
3056 CMD_ID_SET_WFD_CTRL, /* ucCID */
3057 TRUE, /* fgSetQuery */
3058 FALSE, /* fgNeedResp */
3059 FALSE, /* fgIsOid */
3061 NULL, /* pfCmdTimeoutHandler */
3062 sizeof(WFD_CFG_SETTINGS_T), /* u4SetQueryInfoLen */
3063 (PUINT_8)prWfdCfgSettings, /* pucInfoBuffer */
3064 NULL, /* pvSetQueryBuffer */
3065 0 /* u4SetQueryBufferLen */
3073 /* p2pFsmRunEventWfdSettingUpdate */
3084 /*----------------------------------------------------------------------------*/
3086 * @brief This function is used to generate P2P IE for Beacon frame.
3088 * @param[in] prMsduInfo Pointer to the composed MSDU_INFO_T.
3092 /*----------------------------------------------------------------------------*/
3094 p2pGenerateP2P_IEForAssocReq (
3095 IN P_ADAPTER_T prAdapter,
3096 IN P_MSDU_INFO_T prMsduInfo
3099 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
3100 P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL;
3103 ASSERT_BREAK((prAdapter != NULL) && (prMsduInfo != NULL));
3105 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
3107 prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex);
3109 if (IS_STA_P2P_TYPE(prStaRec)) {
3117 } /* end of p2pGenerateP2P_IEForAssocReq() */
3122 /*----------------------------------------------------------------------------*/
3124 * @brief This function is used to generate P2P IE for Probe Request frame.
3126 * @param[in] prMsduInfo Pointer to the composed MSDU_INFO_T.
3130 /*----------------------------------------------------------------------------*/
3132 p2pGenerateP2P_IEForProbeReq (
3133 IN P_ADAPTER_T prAdapter,
3134 IN PUINT_16 pu2Offset,
3136 IN UINT_16 u2BufSize
3146 } /* end of p2pGenerateP2P_IEForProbReq() */
3151 /*----------------------------------------------------------------------------*/
3153 * @brief This function is used to calculate P2P IE length for Beacon frame.
3155 * @param[in] eNetTypeIndex Specify which network
3156 * @param[in] prStaRec Pointer to the STA_RECORD_T
3158 * @return The length of P2P IE added
3160 /*----------------------------------------------------------------------------*/
3162 p2pCalculateP2P_IELenForProbeReq (
3163 IN P_ADAPTER_T prAdapter,
3164 IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex,
3165 IN P_STA_RECORD_T prStaRec
3169 if (eNetTypeIndex != NETWORK_TYPE_P2P_INDEX) {
3177 } /* end of p2pCalculateP2P_IELenForProbeReq() */
3183 /*----------------------------------------------------------------------------*/
3185 * @brief This function will indiate the Event of Tx Fail of AAA Module.
3187 * @param[in] prAdapter Pointer to the Adapter structure.
3188 * @param[in] prStaRec Pointer to the STA_RECORD_T
3192 /*----------------------------------------------------------------------------*/
3194 p2pRunEventAAATxFail (
3195 IN P_ADAPTER_T prAdapter,
3196 IN P_STA_RECORD_T prStaRec
3199 P_BSS_INFO_T prBssInfo;
3205 prBssInfo = &(prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex]);
3207 bssRemoveStaRecFromClientList(prAdapter, prBssInfo, prStaRec);
3209 p2pFuncDisconnect(prAdapter, prStaRec, FALSE, REASON_CODE_UNSPECIFIED);
3212 //20120830 moved into p2puUncDisconnect.
3213 //cnmStaRecFree(prAdapter, prStaRec, TRUE);
3216 } /* p2pRunEventAAATxFail */
3219 /*----------------------------------------------------------------------------*/
3221 * @brief This function will indiate the Event of Successful Completion of AAA Module.
3223 * @param[in] prAdapter Pointer to the Adapter structure.
3224 * @param[in] prStaRec Pointer to the STA_RECORD_T
3228 /*----------------------------------------------------------------------------*/
3230 p2pRunEventAAAComplete (
3231 IN P_ADAPTER_T prAdapter,
3232 IN P_STA_RECORD_T prStaRec
3235 WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS;
3236 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
3237 ENUM_PARAM_MEDIA_STATE_T eOriMediaState;
3240 ASSERT_BREAK((prAdapter != NULL) && (prStaRec != NULL));
3242 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
3244 eOriMediaState = prP2pBssInfo->eConnectionState;
3246 if (prStaRec != NULL) {
3247 bssRemoveStaRecFromClientList(prAdapter, prP2pBssInfo, prStaRec);
3253 if (prP2pBssInfo->rStaRecOfClientList.u4NumElem >= P2P_MAXIMUM_CLIENT_COUNT ||
3254 kalP2PMaxClients(prAdapter->prGlueInfo, prP2pBssInfo->rStaRecOfClientList.u4NumElem)) {
3255 rStatus = WLAN_STATUS_RESOURCES;
3259 bssAddStaRecToClientList(prAdapter, prP2pBssInfo, prStaRec);
3261 prStaRec->u2AssocId = bssAssignAssocID(prStaRec);
3263 cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_3);
3265 p2pChangeMediaState(prAdapter, PARAM_MEDIA_STATE_CONNECTED);
3267 /* Update Connected state to FW. */
3268 if (eOriMediaState != prP2pBssInfo->eConnectionState) {
3269 nicUpdateBss(prAdapter, NETWORK_TYPE_P2P_INDEX);
3275 } /* p2pRunEventAAAComplete */
3278 /*----------------------------------------------------------------------------*/
3280 * @brief This function will indiate the Event of Successful Completion of AAA Module.
3282 * @param[in] prAdapter Pointer to the Adapter structure.
3283 * @param[in] prStaRec Pointer to the STA_RECORD_T
3287 /*----------------------------------------------------------------------------*/
3289 p2pRunEventAAASuccess (
3290 IN P_ADAPTER_T prAdapter,
3291 IN P_STA_RECORD_T prStaRec
3294 WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS;
3297 ASSERT_BREAK((prAdapter != NULL) && (prStaRec != NULL));
3299 /* Glue layer indication. */
3300 kalP2PGOStationUpdate(prAdapter->prGlueInfo, prStaRec, TRUE);
3305 } /* p2pRunEventAAASuccess */
3309 /*----------------------------------------------------------------------------*/
3317 /*----------------------------------------------------------------------------*/
3319 p2pRxPublicActionFrame (
3320 IN P_ADAPTER_T prAdapter,
3321 IN P_SW_RFB_T prSwRfb
3324 WLAN_STATUS rWlanStatus = WLAN_STATUS_SUCCESS;
3325 P_P2P_PUBLIC_ACTION_FRAME_T prPublicActionFrame = (P_P2P_PUBLIC_ACTION_FRAME_T)NULL;
3326 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
3333 prPublicActionFrame = (P_P2P_PUBLIC_ACTION_FRAME_T)prSwRfb->pvHeader;
3334 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
3336 DBGLOG(P2P, TRACE, ("RX Public Action Frame Token:%d.\n", prPublicActionFrame->ucDialogToken));
3338 if (prPublicActionFrame->ucCategory != CATEGORY_PUBLIC_ACTION) {
3342 switch (prPublicActionFrame->ucAction) {
3343 case ACTION_PUBLIC_WIFI_DIRECT:
3345 case ACTION_GAS_INITIAL_REQUEST:
3346 case ACTION_GAS_INITIAL_RESPONSE:
3347 case ACTION_GAS_COMEBACK_REQUEST:
3348 case ACTION_GAS_COMEBACK_RESPONSE:
3355 } /* p2pRxPublicActionFrame */
3361 IN P_ADAPTER_T prAdapter,
3362 IN P_SW_RFB_T prSwRfb
3365 WLAN_STATUS rWlanStatus = WLAN_STATUS_SUCCESS;
3366 P_P2P_ACTION_FRAME_T prP2pActionFrame = (P_P2P_ACTION_FRAME_T)NULL;
3367 UINT_8 aucOui[3] = VENDOR_OUI_WFA_SPECIFIC;
3370 ASSERT_BREAK((prAdapter != NULL) && (prSwRfb != NULL));
3372 prP2pActionFrame = (P_P2P_ACTION_FRAME_T)prSwRfb->pvHeader;
3374 if (prP2pActionFrame->ucCategory != CATEGORY_VENDOR_SPECIFIC_ACTION) {
3375 DBGLOG(P2P, TRACE, ("RX Action Frame but not vendor specific.\n"));
3380 if ((prP2pActionFrame->ucOuiType != VENDOR_OUI_TYPE_P2P) ||
3381 (prP2pActionFrame->aucOui[0] != aucOui[0]) ||
3382 (prP2pActionFrame->aucOui[1] != aucOui[1]) ||
3383 (prP2pActionFrame->aucOui[2] != aucOui[2])) {
3384 DBGLOG(P2P, TRACE, ("RX Vendor Specific Action Frame but not P2P Type or not WFA OUI.\n"));
3391 } /* p2pRxActionFrame */
3395 p2pProcessEvent_UpdateNOAParam (
3396 IN P_ADAPTER_T prAdapter,
3397 UINT_8 ucNetTypeIndex,
3398 P_EVENT_UPDATE_NOA_PARAMS_T prEventUpdateNoaParam
3401 P_BSS_INFO_T prBssInfo = (P_BSS_INFO_T)NULL;
3402 P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo;
3404 BOOLEAN fgNoaAttrExisted = FALSE;
3406 prBssInfo = &(prAdapter->rWifiVar.arBssInfo[ucNetTypeIndex]);
3407 prP2pSpecificBssInfo = prAdapter->rWifiVar.prP2pSpecificBssInfo;
3409 prP2pSpecificBssInfo->fgEnableOppPS = prEventUpdateNoaParam->fgEnableOppPS;
3410 prP2pSpecificBssInfo->u2CTWindow = prEventUpdateNoaParam->u2CTWindow;
3411 prP2pSpecificBssInfo->ucNoAIndex = prEventUpdateNoaParam->ucNoAIndex;
3412 prP2pSpecificBssInfo->ucNoATimingCount = prEventUpdateNoaParam->ucNoATimingCount;
3414 fgNoaAttrExisted |= prP2pSpecificBssInfo->fgEnableOppPS;
3417 ASSERT(prP2pSpecificBssInfo->ucNoATimingCount <= P2P_MAXIMUM_NOA_COUNT);
3419 for (i = 0; i < prP2pSpecificBssInfo->ucNoATimingCount; i++) {
3421 prP2pSpecificBssInfo->arNoATiming[i].fgIsInUse =
3422 prEventUpdateNoaParam->arEventNoaTiming[i].fgIsInUse;
3424 prP2pSpecificBssInfo->arNoATiming[i].ucCount =
3425 prEventUpdateNoaParam->arEventNoaTiming[i].ucCount;
3427 prP2pSpecificBssInfo->arNoATiming[i].u4Duration =
3428 prEventUpdateNoaParam->arEventNoaTiming[i].u4Duration;
3430 prP2pSpecificBssInfo->arNoATiming[i].u4Interval =
3431 prEventUpdateNoaParam->arEventNoaTiming[i].u4Interval;
3433 prP2pSpecificBssInfo->arNoATiming[i].u4StartTime =
3434 prEventUpdateNoaParam->arEventNoaTiming[i].u4StartTime;
3436 fgNoaAttrExisted |= prP2pSpecificBssInfo->arNoATiming[i].fgIsInUse;
3439 prP2pSpecificBssInfo->fgIsNoaAttrExisted = fgNoaAttrExisted;
3441 // update beacon content by the change
3442 bssUpdateBeaconContent(prAdapter, ucNetTypeIndex);
3445 #endif /* CFG_ENABLE_WIFI_DIRECT */