2 ** $Id: //Department/DaVinci/BRANCHES/WIFI_P2P_DRIVER_V2_2/mgmt/p2p_fsm.c#24 $
6 \brief This file defines the FSM for P2P Module.
8 This file defines the FSM for P2P Module.
11 /*******************************************************************************
12 * Copyright (c) 2010 MediaTek Inc.
14 * All rights reserved. Copying, compilation, modification, distribution
15 * or any other use whatsoever of this material is strictly prohibited
16 * except in accordance with a Software License Agreement with
18 ********************************************************************************
21 /*******************************************************************************
24 * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND
25 * AGREES THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK
26 * SOFTWARE") RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE
27 * PROVIDED TO BUYER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY
28 * DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT
29 * LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
30 * PARTICULAR PURPOSE OR NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE
31 * ANY WARRANTY WHATSOEVER WITH RESPECT TO THE SOFTWARE OF ANY THIRD PARTY
32 * WHICH MAY BE USED BY, INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK
33 * SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY
34 * WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE
35 * FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S SPECIFICATION OR TO
36 * CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
38 * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
39 * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL
40 * BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT
41 * ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY
42 * BUYER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
44 * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
45 * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT
46 * OF LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING
47 * THEREOF AND RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN
48 * FRANCISCO, CA, UNDER THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE
50 ********************************************************************************
56 * 02 24 2012 yuche.tsai
57 * [ALPS00240756] [WiFi direct]After accept PBC request,DVT pops Kernel Defect.Powering off DVT causes DVT reboots automatcially and pops up KE(once)
58 * Fix GO dissolving issue to avoid FW assert.
60 * 02 22 2012 yuche.tsai
61 * [ALPS00240483] [Wifi P2P]Run Sigma tool of A69. Always run fail on 5.1.2. No get correct connection from Realtek.
62 * Fix assoc response without P2P IE issue for Sigma test.
64 * 02 21 2012 yuche.tsai
65 * [ALPS00240187] [WiFi direct]When turn on WiFi Direct,phone reboots automatically and KE(KERNEL-PANIC) pos up
66 * Add driver pointer check to avoid KE in wifi direct driver.
68 * 02 15 2012 yuche.tsai
69 * [ALPS00118350] [ALPS.ICS][WiFi Direct] Dirver update for wifi direct connection
70 * Fix P2P response rate issue under P2P device mode.
72 * 02 09 2012 yuche.tsai
73 * [ALPS00233018] [klocwork 9.1] in p2p_fsm.c, line 1633
76 * 02 09 2012 yuche.tsai
77 * [ALPS00233018] [klocwork 9.1] in p2p_fsm.c, line 1633
80 * 02 08 2012 yuche.tsai
81 * [ALPS00118350] [ALPS.ICS][WiFi Direct] Dirver update for wifi direct connection
82 * Try to fix clockwork warning.
84 * 02 06 2012 yuche.tsai
85 * [ALPS00118350] [ALPS.ICS][WiFi Direct] Dirver update for wifi direct connection
86 * Small bug fix for CNM memory usage, scan SSID search issue, P2P network deactivate issue.
88 * 02 02 2012 yuche.tsai
92 * 01 31 2012 yuche.tsai
94 * Fix compile error & del beacon scenario.
96 * 01 27 2012 yuche.tsai
98 * Update for GC connection .
100 * 01 26 2012 yuche.tsai
102 * Fix compile warning.
104 * 01 20 2012 yuche.tsai
106 * Update for RX probe request.
108 * 01 19 2012 yuche.tsai
110 * Update WiFi Direct RX probe request issue.
112 * 01 19 2012 yuche.tsai
114 * Fix scan p2p IE issue.
116 * 01 18 2012 yuche.tsai
118 * Bug fix for memory allocation.
120 * 01 18 2012 yuche.tsai
122 * Fix bug of BSS info indication.
124 * 01 18 2012 yuche.tsai
126 * Add get station info API.
127 * TX deauth before start beacon.
129 * 01 17 2012 yuche.tsai
131 * Update mgmt frame filter setting.
132 * Please also update FW 2.1
134 * 01 16 2012 yuche.tsai
136 * Update Driver for wifi driect gc join IE update issue.
138 * 01 16 2012 yuche.tsai
142 * 01 16 2012 yuche.tsai
144 * Update P2P driver code for GC Join.
146 * 01 15 2012 yuche.tsai
148 * ICS P2P Driver Update.
150 * 01 15 2012 yuche.tsai
154 * 01 13 2012 yuche.tsai
156 * Update WiFi tethering driver for ICS.
158 * 01 13 2012 yuche.tsai
160 * WiFi Direct Driver Update for ICS.
162 * 01 13 2012 yuche.tsai
164 * WiFi Hot Spot Tethering for ICS ALPHA testing version.
166 * 07 05 2011 yuche.tsai
167 * [WCXRP00000821] [Volunteer Patch][WiFi Direct][Driver] WiFi Direct Connection Speed Issue
168 * Fix the compile flag of enhancement.
170 * 07 05 2011 yuche.tsai
171 * [WCXRP00000821] [Volunteer Patch][WiFi Direct][Driver] WiFi Direct Connection Speed Issue
172 * Refine compile flag.
174 * 07 05 2011 yuche.tsai
175 * [WCXRP00000821] [Volunteer Patch][WiFi Direct][Driver] WiFi Direct Connection Speed Issue
176 * Add WiFi Direct Connection Enhancement.
178 * 07 05 2011 yuche.tsai
179 * [WCXRP00000833] [Volunteer Patch][WiFi Direct][Driver] Service Discovery Frame RX Indicate Issue
180 * Solve Service Discovery Response Race Condition issue.
182 * 06 28 2011 yuche.tsai
183 * [WCXRP00000820] [Volunteer Patch][MT6620][WiFi Direct][Driver] GO can not connect to the third device issue
184 * Fix GO can not activly connect to the third P2P device issue.
187 * [WCXRP00000798] [MT6620 Wi-Fi][Firmware] Follow-ups for WAPI frequency offset workaround in firmware SCN module
188 * follow-ups for frequency-shifted WAPI AP support
190 * 06 22 2011 yuche.tsai
191 * [WCXRP00000808] [Volunteer Patch][MT6620][Driver/FW] Device discoverability issue fix
192 * Fix some device discoverability issue.
194 * 06 21 2011 yuche.tsai
195 * [WCXRP00000799] [Volunteer Patch][MT6620][Driver] Connection Indication Twice Issue.
196 * Fix some issue of accepting connection of GO.
198 * 06 21 2011 yuche.tsai
199 * [WCXRP00000775] [Volunteer Patch][MT6620][Driver] Dynamic enable SD capability
200 * Drop GAS frame when SD is not enabled.
202 * 06 20 2011 yuche.tsai
203 * [WCXRP00000799] [Volunteer Patch][MT6620][Driver] Connection Indication Twice Issue.
204 * Fix connection indication twice issue.
206 * 06 20 2011 yuche.tsai
207 * [WCXRP00000796] [Volunteer Patch][MT6620][Driver] Add BC deauth frame TX feature.
208 * Add feature to send BC deauth frame when under AP/GO mode.
210 * 06 20 2011 yuche.tsai
211 * [WCXRP00000795] [Volunteer Patch][MT6620][Driver] GO can not connect second device issue
212 * Solve GO can not formation with second device issue.
214 * 06 14 2011 yuche.tsai
216 * Add compile flag to disable persistent group support.
218 * 06 10 2011 yuche.tsai
219 * [WCXRP00000776] [Need Patch][MT6620][Driver] MT6620 response probe request of P2P device with P2P IE under Hot Spot mode.
220 * Driver should not reponse probe request of P2P device under Hot Spot mode.
222 * 06 10 2011 yuche.tsai
223 * [WCXRP00000775] [Volunteer Patch][MT6620][Driver] Dynamic enable SD capability
224 * Support Dynamic enable SD capability.
226 * 06 07 2011 yuche.tsai
227 * [WCXRP00000763] [Volunteer Patch][MT6620][Driver] RX Service Discovery Frame under AP mode Issue
228 * Fix RX SD request under AP mode issue.
231 * [WCXRP00000681] [MT5931][Firmware] HIF code size reduction
232 * eliminate unused parameters for SAA-FSM
234 * 05 26 2011 yuche.tsai
235 * [WCXRP00000745] Support accepting connection after one Group Connection Lost.
237 After Group Formation & lost connection, if MT6620 behave as:
239 1. GO: It would keep under GO state until been dissolved by supplicant.
241 At this time, other P2P device can use join method to join this group.
244 2. GC: It would keep on searching target GO or target device until been dissolved by supplicant.
246 At this time, it would ignore other P2P device formation request.
251 Modification: Make driver to accept GO NEGO REQ at this time, to let user decide to accept new connection or not.
253 * [Volunteer Patch][MT6620][Driver]
254 * Accept other p2p device connection if the original one is lost.
256 * 05 18 2011 yuche.tsai
258 * Fix compile error. A new feature would not be included in v2.0 p2p driver
260 * 05 18 2011 yuche.tsai
261 * [WCXRP00000728] [Volunteer Patch][MT6620][Driver] Service Discovery Request TX issue.
262 * A solution for both connection request & iocontrol request.
264 * 05 17 2011 yuche.tsai
265 * [WCXRP00000728] [Volunteer Patch][MT6620][Driver] Service Discovery Request TX issue.
266 * The solution has some issue, still working.
268 * 05 16 2011 yuche.tsai
269 * [WCXRP00000728] [Volunteer Patch][MT6620][Driver] Service Discovery Request TX issue.
270 * Fix SD Request can not TX issue.
272 * 05 09 2011 terry.wu
273 * [WCXRP00000711] [MT6620 Wi-Fi][Driver] Set Initial value of StaType in StaRec for Hotspot Client
274 * Set initial value of StaType in StaRec for hotspot client.
276 * 05 04 2011 yuche.tsai
277 * [WCXRP00000697] [Volunteer Patch][MT6620][Driver]
278 * Bug fix for BSS descriptor is found first before p2p descriptor.
280 * 05 04 2011 yuche.tsai
281 * [WCXRP00000696] [Volunteer Patch][MT6620][Driver] Infinite loop issue when RX invitation response.
282 * Add an end condition in while loop of invitation response frame checking function.
284 * 05 02 2011 yuche.tsai
285 * [WCXRP00000693] [Volunteer Patch][MT6620][Driver] Clear Formation Flag after TX lifetime timeout.
286 * Clear flag after Tx lifetime timeout of GO NEGO frame.
288 * 04 20 2011 yuche.tsai
289 * [WCXRP00000668] [Volunteer Patch][MT6620][Driver] Possible race condition when add scan & query scan result at the same time.
290 * Fix side effect while starting ATGO.
292 * 04 20 2011 yuche.tsai
294 * Fix ASSERT issue in FW, side effect of last change.
296 * 04 19 2011 yuche.tsai
298 * Workaround for multiple device connection, before invitation ready.
300 * 04 19 2011 yuche.tsai
301 * [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.
302 * Support connection indication when GO NEGO REQ only has Password ID instead of Configure method.
304 * 04 18 2011 yuche.tsai
308 * 04 14 2011 yuche.tsai
309 * [WCXRP00000646] [Volunteer Patch][MT6620][FW/Driver] Sigma Test Modification for some test case.
310 * Fix a connection issue.
312 * 04 14 2011 yuche.tsai
313 * [WCXRP00000646] [Volunteer Patch][MT6620][FW/Driver] Sigma Test Modification for some test case.
314 * Fix the channel issue of AP mode..
316 * 04 14 2011 yuche.tsai
317 * [WCXRP00000646] [Volunteer Patch][MT6620][FW/Driver] Sigma Test Modification for some test case.
318 * Refine P2P connection flow for Sigma Test..
320 * 04 10 2011 yuche.tsai
321 * [WCXRP00000624] [Volunteer Patch][MT6620][Driver] Add device discoverability support for GO.
322 * Add device discoverability support. (Phase I)
324 * 03 28 2011 yuche.tsai
325 * [WCXRP00000584] [Volunteer Patch][MT6620][Driver] Add beacon timeout support for WiFi Direct.
326 * Fix a possible issue for retry join when media status connected.
328 * 03 25 2011 yuche.tsai
330 * Improve some error handleing.
332 * 03 24 2011 yuche.tsai
334 * Assign AID before sync station state to FW.
336 * 03 23 2011 yuche.tsai
338 * Fix Response Rate Issue when TX Auth Rsp Frame under P2P Mode..
340 * 03 23 2011 yuche.tsai
341 * [WCXRP00000584] [Volunteer Patch][MT6620][Driver] Add beacon timeout support for WiFi Direct.
342 * Fix issue of connection to one GC..
344 * 03 23 2011 yuche.tsai
346 * Fix ASSERT issue under Hot-Spot mode.
348 * 03 22 2011 yuche.tsai
350 * When Target Information is not available, change to passive mode..
352 * 03 22 2011 yuche.tsai
354 * Fix one connection issue while using Keypad to connect GO.
356 * 03 22 2011 yuche.tsai
358 * Fix two issues that may cause kernel panic.
360 * 03 22 2011 yuche.tsai
362 * Fix GC connect to other device issue.
364 * 03 22 2011 yuche.tsai
366 * 1. Fix formation policy issue.
367 * 2. Fix LISTEN channel issue.
368 * 3. Fix Target IF address in-correct issue when being GO.
370 * 03 21 2011 yuche.tsai
372 * Connection Flow Modification.
374 * 03 19 2011 terry.wu
375 * [WCXRP00000577] [MT6620 Wi-Fi][Driver][FW] Create V2.0 branch for firmware and driver
376 * create V2.0 p2p driver release based on label "MT6620_WIFI_P2P_DRIVER_V2_0_2100_0319_2011" from main trunk.
378 * 03 19 2011 yuche.tsai
379 * [WCXRP00000584] [Volunteer Patch][MT6620][Driver] Add beacon timeout support for WiFi Direct.
380 * Add beacon timeout support.
382 * 03 19 2011 yuche.tsai
383 * [WCXRP00000583] [Volunteer Patch][MT6620][Driver] P2P connection of the third peer issue
384 * Indicate the correct Group SSID when join on Group.
386 * 03 19 2011 yuche.tsai
387 * [WCXRP00000583] [Volunteer Patch][MT6620][Driver] P2P connection of the third peer issue
388 * Support the third P2P device to join GO/GC group.
390 * 03 19 2011 yuche.tsai
391 * [WCXRP00000581] [Volunteer Patch][MT6620][Driver] P2P IE in Assoc Req Issue
392 * Append P2P IE in Assoc Req, so that GC can be discovered in probe response of GO.
394 * 03 18 2011 yuche.tsai
395 * [WCXRP00000578] [Volunteer Patch][MT6620][Driver] Separate Connection Request from general IOCTL
396 * Separate connection request from general IOCTL.
398 * 03 18 2011 yuche.tsai
399 * [WCXRP00000574] [Volunteer Patch][MT6620][Driver] Modify P2P FSM Connection Flow
400 * Modify connection flow after Group Formation Complete, or device connect to a GO.
401 * Instead of request channel & connect directly, we use scan to allocate channel bandwidth & connect after RX BCN.
403 * 03 17 2011 yuche.tsai
405 * When AIS is connect to an AP, Hot Spot would be enabled under fixed same channel.
407 * 03 17 2011 yuche.tsai
409 * Solve the Group Info IE in Probe Response incorrect issue.
411 * 03 17 2011 yuche.tsai
413 * Release Channel after Join Complete.
416 * [WCXRP00000530] [MT6620 Wi-Fi] [Driver] skip doing p2pRunEventAAAComplete after send assoc response Tx Done
417 * enable the protected while at P2P start GO, and skip some security check .
419 * 03 15 2011 yuche.tsai
420 * [WCXRP00000560] [Volunteer Patch][MT6620][Driver] P2P Connection from UI using KEY/DISPLAY issue
421 * Fix local configure method issue.
423 * 03 15 2011 yuche.tsai
424 * [WCXRP00000560] [Volunteer Patch][MT6620][Driver] P2P Connection from UI using KEY/DISPLAY issue
425 * Fix some configure method issue.
427 * 03 14 2011 yuche.tsai
431 * 03 14 2011 yuche.tsai
433 * Fix password ID issue.
435 * 03 10 2011 yuche.tsai
439 * 03 08 2011 yuche.tsai
440 * [WCXRP00000480] [Volunteer Patch][MT6620][Driver] WCS IE format issue[WCXRP00000509] [Volunteer Patch][MT6620][Driver] Kernal panic when remove p2p module.
443 * 03 07 2011 yuche.tsai
444 * [WCXRP00000502] [Volunteer Patch][MT6620][Driver] Fix group ID issue when doing Group Formation.
448 * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code
449 * rename the define to anti_pviracy.
452 * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code
453 * add the code to get the check rsponse and indicate to app.
456 * [WCXRP00000510] [MT6620 Wi-Fi] [Driver] Fixed the CTIA enter test mode issue
457 * fixed the p2p action frame type check for device request indication.
459 * 03 02 2011 yuche.tsai
460 * [WCXRP00000245] 1. Invitation Request/Response.
461 2. Provision Discovery Request/Response
463 * Fix Service Discovery RX packet buffer pointer.
465 * 03 01 2011 yuche.tsai
466 * [WCXRP00000501] [Volunteer Patch][MT6620][Driver] No common channel issue when doing GO formation
467 * Update channel issue when doing GO formation..
469 * 03 01 2011 yuche.tsai
470 * [WCXRP00000245] 1. Invitation Request/Response.
471 2. Provision Discovery Request/Response
473 * Update Service Discovery Related wlanoid function.
475 * 02 21 2011 yuche.tsai
476 * [WCXRP00000481] [Volunteer Patch][MT6620][FW] Scan hang under concurrent case.
477 * Fix all BE issue of WSC or P2P IE.
480 * [WCXRP00000471] [MT6620 Wi-Fi][Driver] Add P2P Provison discovery append Config Method attribute at WSC IE
481 * fixed the wsc config method mapping to driver used config method issue.
483 * 02 18 2011 yuche.tsai
484 * [WCXRP00000479] [Volunteer Patch][MT6620][Driver] Probe Response of P2P using 11b rate.
485 * Update basic rate to FW, after P2P is initialed.
487 * 02 18 2011 yuche.tsai
488 * [WCXRP00000478] [Volunteer Patch][MT6620][Driver] Probe request frame during search phase do not contain P2P wildcard SSID.
489 * Use P2P Wildcard SSID when scan type of P2P_WILDCARD_SSID is set.
491 * 02 18 2011 yuche.tsai
492 * [WCXRP00000480] [Volunteer Patch][MT6620][Driver] WCS IE format issue
493 * Fix WSC IE BE format issue.
496 * [WCXRP00000471] [MT6620 Wi-Fi][Driver] Add P2P Provison discovery append Config Method attribute at WSC IE
497 * append the WSC IE config method attribute at provision discovery request.
500 * [WCXRP00000448] [MT6620 Wi-Fi][Driver] Fixed WSC IE not send out at probe request
501 * fixed the probe request send out without WSC IE issue (at P2P).
503 * 02 16 2011 yuche.tsai
504 * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode.
505 * If two station connected to the Hot-Spot and one disconnect, FW would get into an infinite loop
507 * 02 15 2011 yuche.tsai
508 * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode.
509 * Fix re-connection issue after RX deauthentication.
511 * 02 15 2011 yuche.tsai
512 * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode.
513 * Fix conneciton issue after disconnect with AP.
515 * 02 12 2011 yuche.tsai
516 * [WCXRP00000441] [Volunteer Patch][MT6620][Driver] BoW can not create desired station type when Hot Spot is enabled.
517 * P2P Create Station Type according to Target BSS capability.
519 * 02 10 2011 yuche.tsai
520 * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode.
521 * Support Disassoc & Deauthentication for Hot-Spot.
523 * 02 09 2011 yuche.tsai
524 * [WCXRP00000245] 1. Invitation Request/Response.
525 2. Provision Discovery Request/Response
527 * Add Service Discovery Indication Related code.
529 * 02 09 2011 yuche.tsai
530 * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode.
531 * Add Support for MLME deauthentication for Hot-Spot.
533 * 02 09 2011 yuche.tsai
534 * [WCXRP00000429] [Volunteer Patch][MT6620][Driver] Hot Spot Client Limit Issue
535 * Fix Client Limit Issue.
537 * 02 08 2011 yuche.tsai
538 * [WCXRP00000419] [Volunteer Patch][MT6620/MT5931][Driver] Provide function of disconnect to target station for AAA module.
539 * Disconnect every station client when disolve on P2P group.
541 * 02 08 2011 yuche.tsai
542 * [WCXRP00000245] 1. Invitation Request/Response.
543 2. Provision Discovery Request/Response
545 * 1. Fix Service Disocvery Logical issue.
546 * 2. Fix a NULL pointer access violation issue when sending deauthentication packet to a class error station.
548 * 02 08 2011 yuche.tsai
549 * [WCXRP00000419] [Volunteer Patch][MT6620/MT5931][Driver] Provide function of disconnect to target station for AAA module.
550 * Workaround of disable P2P network.
552 * 02 08 2011 yuche.tsai
553 * [WCXRP00000421] [Volunteer Patch][MT6620][Driver] Fix incorrect SSID length Issue
554 * 1. Fixed SSID wrong length issue.
555 * 2. Under Hot Spot configuration, there won't be any P2P IE.
556 * 3. Under Hot Spot configuration, P2P FSM won't get into LISTEN state first.
558 * 01 27 2011 yuche.tsai
559 * [WCXRP00000399] [Volunteer Patch][MT6620/MT5931][Driver] Fix scan side effect after P2P module separate.
560 * Modify Start GO flow.
562 * 01 27 2011 yuche.tsai
563 * [WCXRP00000399] [Volunteer Patch][MT6620/MT5931][Driver] Fix scan side effect after P2P module separate.
564 * Fix desire phy type set issue.
566 * 01 27 2011 yuche.tsai
567 * [WCXRP00000399] [Volunteer Patch][MT6620/MT5931][Driver] Fix scan side effect after P2P module separate.
568 * Add desire phy type set phase I.
570 * 01 26 2011 yuche.tsai
571 * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record.
572 * Fix P2P Disconnect Issue.
574 * 01 26 2011 yuche.tsai
575 * [WCXRP00000245] 1. Invitation Request/Response.
576 2. Provision Discovery Request/Response
578 * Add Service Discovery Function.
580 * 01 26 2011 cm.chang
581 * [WCXRP00000395] [MT6620 Wi-Fi][Driver][FW] Search STA_REC with additional net type index argument
584 * 01 25 2011 yuche.tsai
585 * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record.
586 * Fix compile error when DBG is disabled.
588 * 01 25 2011 yuche.tsai
589 * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record.
590 * Change Station Type Definition.
592 * 01 19 2011 yuche.tsai
593 * [WCXRP00000353] [Volunteer Patch][MT6620][Driver] Desired Non-HT Rate Set update when STA record is created under AP Mode.
594 * Add P2P QoS Support.
596 * 01 19 2011 george.huang
597 * [WCXRP00000355] [MT6620 Wi-Fi] Set WMM-PS related setting with qualifying AP capability
598 * Null NOA attribute setting when no related parameters.
600 * 01 14 2011 yuche.tsai
601 * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue
602 * Modify AAA flow according to CM's comment.
604 * 01 13 2011 yuche.tsai
605 * [WCXRP00000353] [Volunteer Patch][MT6620][Driver] Desired Non-HT Rate Set update when STA record is created under AP Mode.
606 * Resolve Channel ZERO issue. (Uninitialized default channel)
608 * 01 13 2011 yuche.tsai
609 * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue
610 * Update P2P State Debug Message.
612 * 01 12 2011 yuche.tsai
613 * [WCXRP00000353] [Volunteer Patch][MT6620][Driver] Desired Non-HT Rate Set update when STA record is created under AP Mode.
614 * Fix bug when allocating message buffer.
616 * 01 12 2011 yuche.tsai
617 * [WCXRP00000353] [Volunteer Patch][MT6620][Driver] Desired Non-HT Rate Set update when STA record is created under AP Mode.
618 * Update Phy Type Set. When legacy client is connected, it can use 11b rate,
619 * but if the P2P device is connected, 11b rate is not allowed.
621 * 01 12 2011 yuche.tsai
622 * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue
623 * 1. Modify Channel Acquire Time of AP mode from 5s to 1s.
624 * 2. Call cnmP2pIsPermit() before active P2P network.
625 * 3. Add channel selection support for AP mode.
627 * 01 12 2011 yuche.tsai
628 * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue
629 * Fix Bug of reference to NULL pointer.
631 * 01 12 2011 yuche.tsai
632 * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue
633 * Modify some behavior of AP mode.
635 * 01 12 2011 yuche.tsai
636 * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue
637 * Fix bug of wrong pointer check.
639 * 01 12 2011 yuche.tsai
640 * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue
643 * 01 11 2011 yuche.tsai
644 * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue
645 * Add station record into client list before change it state from STATE_2 to STATE_3.
647 * 01 05 2011 yuche.tsai
648 * [WCXRP00000345] [MT6620][Volunteer Patch] P2P may issue a SSID specified scan request, but the SSID length is still invalid.
649 * Specify SSID Type when issue a scan request.
652 * [WCXRP00000338] [MT6620 Wi-Fi][Driver] Separate kalMemAlloc into kmalloc and vmalloc implementations to ease physically continous memory demands
655 * 01 05 2011 george.huang
656 * [WCXRP00000343] [MT6620 Wi-Fi] Add TSF reset path for concurrent operation
657 * modify NOA update path for preventing assertion false alarm.
660 * [WCXRP00000338] [MT6620 Wi-Fi][Driver] Separate kalMemAlloc into kmalloc and vmalloc implementations to ease physically continous memory demands
661 * separate kalMemAlloc() into virtually-continous and physically-continous type to ease slab system pressure
664 * [WCXRP00000326] [MT6620][Wi-Fi][Driver] check in the binary format gl_sec.o.new instead of use change type!!!
665 * let the p2p ap mode acept a legacy device join.
667 * 12 22 2010 yuche.tsai
668 * [WCXRP00000245] 1. Invitation Request/Response.
669 2. Provision Discovery Request/Response
673 * 12 15 2010 yuche.tsai
674 * [WCXRP00000245] 1. Invitation Request/Response.
675 2. Provision Discovery Request/Response
677 * Refine Connection Flow.
679 * 12 08 2010 yuche.tsai
680 * [WCXRP00000245] [MT6620][Driver] Invitation & Provision Discovery Feature Check-in
681 * [WCXRP000000245][MT6620][Driver] Invitation Request Feature Add
683 * 12 08 2010 yuche.tsai
684 * [WCXRP00000244] [MT6620][Driver] Add station record type for each client when in AP mode.
685 * 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.
687 * 12 07 2010 cm.chang
688 * [WCXRP00000239] MT6620 Wi-Fi][Driver][FW] Merge concurrent branch back to maintrunk
689 * The order of invoking nicUpdateBss() and rlm functions
691 * 12 02 2010 yuche.tsai
693 * Update P2P Connection Policy for Invitation.
695 * 12 02 2010 yuche.tsai
697 * Update P2P Connection Policy for Invitation & Provision Discovery.
699 * 11 30 2010 yuche.tsai
701 * Invitation & Provision Discovery Indication.
703 * 11 30 2010 yuche.tsai
705 * Update Configure Method indication & selection for Provision Discovery & GO_NEGO_REQ
707 * 11 30 2010 yuche.tsai
709 * Update RCIP value when RX assoc request frame.
711 * 11 29 2010 yuche.tsai
713 * Update P2P related function for INVITATION & PROVISION DISCOVERY.
715 * 11 26 2010 george.huang
716 * [WCXRP00000152] [MT6620 Wi-Fi] AP mode power saving function
717 * Update P2P PS for NOA function.
719 * 11 25 2010 yuche.tsai
721 * Update Code for Invitation Related Function.
724 * [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
725 * fixed some ASSERT check.
728 * [WCXRP00000164] [MT6620 Wi-Fi][Driver] Support the p2p random SSID
729 * fixed the p2p role code error.
732 * [WCXRP00000164] [MT6620 Wi-Fi][Driver] Support the p2p random SSID
733 * adding the p2p random ssid support.
736 * [WCXRP00000124] [MT6620 Wi-Fi] [Driver] Support the dissolve P2P Group
737 * fixed the ASSERT check error
740 * [WCXRP00000124] [MT6620 Wi-Fi] [Driver] Support the dissolve P2P Group
741 * Add the code to support disconnect p2p group
744 * [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
745 * fixed the compiling error.
748 * [WCXRP00000102] [MT6620 Wi-Fi] [FW] Add a compiling flag and code for support Direct GO at Android
749 * adding a code to support Direct GO with a compiling flag .
752 * [WCXRP00000087] [MT6620 Wi-Fi][Driver] Cannot connect to 5GHz AP, driver will cause FW assert.
753 * correct erroneous logic: specifying eBand with incompatible eSco
756 * [WCXRP00000085] [MT6620 Wif-Fi] [Driver] update the modified p2p state machine
757 * fixed the compiling error.
760 * [WCXRP00000085] [MT6620 Wif-Fi] [Driver] update the modified p2p state machine
761 * update the frog's new p2p state machine.
765 * fixed the compiling error at WinXP.
767 * 09 07 2010 yuche.tsai
769 * Reset Common IE Buffer of P2P INFO when scan request is issued.
770 * If an action frame other than public action frame is received, return direcly.
774 * adding the code for beacon/probe req/ probe rsp wsc ie at p2p.
778 * let the p2p can set the privacy bit at beacon and rsn ie at assoc req at key handshake state.
780 * 09 03 2010 kevin.huang
782 * Refine #include sequence and solve recursive/nested #include issue
784 * 08 26 2010 yuche.tsai
786 * Add P2P Connection Abort Event Message handler.
788 * 08 24 2010 cm.chang
790 * Support RLM initail channel of Ad-hoc, P2P and BOW
792 * 08 23 2010 yuche.tsai
794 * 1. Fix Interface Address from GO Nego Req/Rsp is not correct.
795 * 2. Fix GO mode does not change media state after station connected.
796 * 3. Fix STA don't response probe request when there is a connection request.
798 * 08 20 2010 cm.chang
800 * Migrate RLM code to host from FW
802 * 08 20 2010 kevin.huang
804 * Modify AAA Module for changing STA STATE 3 at p2p/bowRunEventAAAComplete()
806 * 08 20 2010 yuche.tsai
808 * Add Glue Layer indication.
810 * 08 17 2010 yuche.tsai
812 * Fix compile warning under Linux.
814 * 08 17 2010 yuche.tsai
816 * Fix some P2P FSM bug.
818 * 08 16 2010 yuche.tsai
820 * Add random Interface Address Generation support.
822 * 08 16 2010 yuche.tsai
824 * Fix some P2P FSM bug.
826 * 08 16 2010 yuche.tsai
828 * Update P2P FSM code for GO Nego.
830 * 08 16 2010 kevin.huang
832 * Refine AAA functions
834 * 08 12 2010 kevin.huang
836 * Refine bssProcessProbeRequest() and bssSendBeaconProbeResponse()
838 * 08 12 2010 yuche.tsai
840 * Join complete indication.
842 * 08 11 2010 yuche.tsai
844 * Add two boolean in connection request.
845 * Based on these two boolean value, P2P FSM should
846 * decide to do invitation or group formation or start a GO directly.
848 * 08 11 2010 yuche.tsai
850 * Update P2P FSM, currently P2P Device Discovery is verified.
852 * 08 05 2010 yuche.tsai
854 * Update P2P FSM for group formation.
856 * 08 03 2010 george.huang
858 * handle event for updating NOA parameters indicated from FW
862 * limit build always needs spin-lock declaration.
864 * 08 02 2010 yuche.tsai
866 * P2P Group Negotiation Code Check in.
868 * 07 26 2010 yuche.tsai
870 * Add P2P FSM code check in.
872 * 07 21 2010 yuche.tsai
874 * Add P2P Scan & Scan Result Parsing & Saving.
876 * 07 19 2010 yuche.tsai
880 * 07 09 2010 george.huang
882 * [WPD00001556] Migrate PM variables from FW to driver: for composing QoS Info
886 * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
888 * 06 21 2010 yuche.tsai
889 * [WPD00003839][MT6620 5931][P2P] Feature migration
890 * Fix compile error while enable WIFI_DIRECT support.
892 * 06 21 2010 yuche.tsai
893 * [WPD00003839][MT6620 5931][P2P] Feature migration
894 * Update P2P Function call.
896 * 06 17 2010 yuche.tsai
897 * [WPD00003839][MT6620 5931][P2P] Feature migration
898 * First draft for migration P2P FSM from FW to Driver.
900 * 04 19 2010 kevin.huang
901 * [BORA00000714][WIFISYS][New Feature]Beacon Timeout Support
902 * Add Beacon Timeout Support and will send Null frame to diagnose connection
904 * 03 18 2010 kevin.huang
905 * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support
906 * Rename CFG flag for P2P
908 * 02 26 2010 kevin.huang
909 * [BORA00000603][WIFISYS] [New Feature] AAA Module Support
910 * Add code to test P2P GO
912 * 02 23 2010 kevin.huang
913 * [BORA00000603][WIFISYS] [New Feature] AAA Module Support
914 * Add Wi-Fi Direct SSID and P2P GO Test Mode
916 * 02 05 2010 kevin.huang
917 * [BORA00000603][WIFISYS] [New Feature] AAA Module Support
918 * Modify code due to BAND_24G define was changed
920 * 02 05 2010 kevin.huang
921 * [BORA00000603][WIFISYS] [New Feature] AAA Module Support
922 * Revise data structure to share the same BSS_INFO_T for avoiding coding error
924 * 02 04 2010 kevin.huang
925 * [BORA00000603][WIFISYS] [New Feature] AAA Module Support
926 * Add AAA Module Support, Revise Net Type to Net Type Index for array lookup
929 /*******************************************************************************
930 * C O M P I L E R F L A G S
931 ********************************************************************************
934 /*******************************************************************************
935 * E X T E R N A L R E F E R E N C E S
936 ********************************************************************************
938 #include "p2p_precomp.h"
940 #if CFG_ENABLE_WIFI_DIRECT
942 /*******************************************************************************
944 ********************************************************************************
947 /*******************************************************************************
949 ********************************************************************************
952 /*******************************************************************************
953 * P U B L I C D A T A
954 ********************************************************************************
957 /*******************************************************************************
958 * P R I V A T E D A T A
959 ********************************************************************************
962 /*lint -save -e64 Type mismatch */
963 static PUINT_8 apucDebugP2pState[P2P_STATE_NUM] = {
964 (PUINT_8)DISP_STRING("P2P_STATE_IDLE"),
965 (PUINT_8)DISP_STRING("P2P_STATE_SCAN"),
966 (PUINT_8)DISP_STRING("P2P_STATE_AP_CHANNEL_DETECT"),
967 (PUINT_8)DISP_STRING("P2P_STATE_REQING_CHANNEL"),
968 (PUINT_8)DISP_STRING("P2P_STATE_CHNL_ON_HAND"),
969 (PUINT_8)DISP_STRING("P2P_STATE_GC_JOIN")
975 /*******************************************************************************
977 ********************************************************************************
980 /*******************************************************************************
981 * F U N C T I O N D E C L A R A T I O N S
982 ********************************************************************************
985 /*******************************************************************************
987 ********************************************************************************
990 /* p2pStateXXX : Processing P2P FSM related action.
991 * p2pFSMXXX : Control P2P FSM flow.
992 * p2pFuncXXX : Function for doing one thing.
996 IN P_ADAPTER_T prAdapter
1000 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1001 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
1004 ASSERT_BREAK(prAdapter != NULL);
1006 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1007 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
1009 ASSERT_BREAK(prP2pFsmInfo != NULL);
1011 LINK_INITIALIZE(&(prP2pFsmInfo->rMsgEventQueue));
1013 prP2pFsmInfo->eCurrentState = prP2pFsmInfo->ePreviousState = P2P_STATE_IDLE;
1014 prP2pFsmInfo->prTargetBss = NULL;
1016 cnmTimerInitTimer(prAdapter,
1017 &(prP2pFsmInfo->rP2pFsmTimeoutTimer),
1018 (PFN_MGMT_TIMEOUT_FUNC)p2pFsmRunEventFsmTimeout,
1019 (UINT_32)prP2pFsmInfo);
1021 //4 <2> Initiate BSS_INFO_T - common part
1022 BSS_INFO_INIT(prAdapter, NETWORK_TYPE_P2P_INDEX);
1025 //4 <2.1> Initiate BSS_INFO_T - Setup HW ID
1026 prP2pBssInfo->ucConfigAdHocAPMode = AP_MODE_11G_P2P;
1027 prP2pBssInfo->ucHwDefaultFixedRateCode = RATE_OFDM_6M;
1030 prP2pBssInfo->ucNonHTBasicPhyType = (UINT_8)
1031 rNonHTApModeAttributes[prP2pBssInfo->ucConfigAdHocAPMode].ePhyTypeIndex;
1032 prP2pBssInfo->u2BSSBasicRateSet =
1033 rNonHTApModeAttributes[prP2pBssInfo->ucConfigAdHocAPMode].u2BSSBasicRateSet;
1035 prP2pBssInfo->u2OperationalRateSet =
1036 rNonHTPhyAttributes[prP2pBssInfo->ucNonHTBasicPhyType].u2SupportedRateSet;
1038 rateGetDataRatesFromRateSet(prP2pBssInfo->u2OperationalRateSet,
1039 prP2pBssInfo->u2BSSBasicRateSet,
1040 prP2pBssInfo->aucAllSupportedRates,
1041 &prP2pBssInfo->ucAllSupportedRatesLen);
1043 prP2pBssInfo->prBeacon = cnmMgtPktAlloc(prAdapter,
1044 OFFSET_OF(WLAN_BEACON_FRAME_T, aucInfoElem[0]) + MAX_IE_LENGTH);
1046 if (prP2pBssInfo->prBeacon) {
1047 prP2pBssInfo->prBeacon->eSrc = TX_PACKET_MGMT;
1048 prP2pBssInfo->prBeacon->ucStaRecIndex = 0xFF; /* NULL STA_REC */
1049 prP2pBssInfo->prBeacon->ucNetworkType = NETWORK_TYPE_P2P_INDEX;
1052 /* Out of memory. */
1056 prP2pBssInfo->eCurrentOPMode = OP_MODE_NUM;
1058 prP2pBssInfo->rPmProfSetupInfo.ucBmpDeliveryAC = PM_UAPSD_ALL;
1059 prP2pBssInfo->rPmProfSetupInfo.ucBmpTriggerAC = PM_UAPSD_ALL;
1060 prP2pBssInfo->rPmProfSetupInfo.ucUapsdSp = WMM_MAX_SP_LENGTH_2;
1061 prP2pBssInfo->ucPrimaryChannel = P2P_DEFAULT_LISTEN_CHANNEL;
1062 prP2pBssInfo->eBand = BAND_2G4;
1063 prP2pBssInfo->eBssSCO = CHNL_EXT_SCN;
1065 if (prAdapter->rWifiVar.fgSupportQoS) {
1066 prP2pBssInfo->fgIsQBSS = TRUE;
1069 prP2pBssInfo->fgIsQBSS = FALSE;
1082 /*----------------------------------------------------------------------------*/
1084 * @brief The function is used to uninitialize the value in P2P_FSM_INFO_T for
1091 /*----------------------------------------------------------------------------*/
1094 IN P_ADAPTER_T prAdapter
1097 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1098 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
1101 ASSERT_BREAK(prAdapter != NULL);
1103 DEBUGFUNC("p2pFsmUninit()");
1104 DBGLOG(P2P, INFO, ("->p2pFsmUninit()\n"));
1106 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1107 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
1109 p2pFsmRunEventAbort(prAdapter, prP2pFsmInfo);
1111 p2pFuncSwitchOPMode(prAdapter, prP2pBssInfo, OP_MODE_P2P_DEVICE, TRUE);
1113 UNSET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX);
1115 wlanAcquirePowerControl(prAdapter);
1117 /* Release all pending CMD queue. */
1118 wlanProcessCommandQueue(prAdapter, &prAdapter->prGlueInfo->rCmdQueue);
1120 wlanReleasePowerControl(prAdapter);
1122 /* Clear PendingCmdQue*/
1123 wlanReleasePendingCMDbyNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX);
1125 if (prP2pBssInfo->prBeacon) {
1126 nicTxReturnMsduInfo(prAdapter, prP2pBssInfo->prBeacon);
1127 prP2pBssInfo->prBeacon = NULL;
1134 } /* end of p2pFsmUninit() */
1137 p2pFsmStateTransition (
1138 IN P_ADAPTER_T prAdapter,
1139 IN P_P2P_FSM_INFO_T prP2pFsmInfo,
1140 IN ENUM_P2P_STATE_T eNextState
1143 BOOLEAN fgIsTransOut = (BOOLEAN)FALSE;
1144 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
1145 P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo = (P_P2P_SPECIFIC_BSS_INFO_T)NULL;
1148 ASSERT_BREAK((prAdapter != NULL) && (prP2pFsmInfo != NULL));
1149 DBGLOG(P2P, STATE, ("p2pFsmStateTransition \n"));
1150 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
1151 prP2pSpecificBssInfo = prAdapter->rWifiVar.prP2pSpecificBssInfo;
1153 if (!IS_BSS_ACTIVE(prP2pBssInfo)) {
1154 SET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX);
1157 fgIsTransOut = fgIsTransOut?FALSE:TRUE;
1159 if (!fgIsTransOut) {
1161 DBGLOG(P2P, STATE, ("TRANSITION: [%s] -> [%s]\n",
1162 apucDebugP2pState[prP2pFsmInfo->eCurrentState],
1163 apucDebugP2pState[eNextState]));
1165 /* Transition into current state. */
1166 prP2pFsmInfo->ePreviousState = prP2pFsmInfo->eCurrentState;
1167 prP2pFsmInfo->eCurrentState = eNextState;
1171 switch (prP2pFsmInfo->eCurrentState) {
1172 case P2P_STATE_IDLE:
1175 p2pStateAbort_IDLE(prAdapter,
1180 fgIsTransOut = p2pStateInit_IDLE(prAdapter,
1187 case P2P_STATE_SCAN:
1190 // Scan done / scan canceled.
1191 p2pStateAbort_SCAN(prAdapter, prP2pFsmInfo, eNextState);
1194 // Initial scan request.
1195 p2pStateInit_SCAN(prAdapter, prP2pFsmInfo);
1199 case P2P_STATE_AP_CHANNEL_DETECT:
1202 // Get sparse channel result.
1203 p2pStateAbort_AP_CHANNEL_DETECT(prAdapter,
1205 prP2pSpecificBssInfo,
1210 // Initial passive scan request.
1211 p2pStateInit_AP_CHANNEL_DETECT(prAdapter, prP2pFsmInfo);
1215 case P2P_STATE_REQING_CHANNEL:
1218 // Channel on hand / Channel canceled.
1219 p2pStateAbort_REQING_CHANNEL(prAdapter, prP2pFsmInfo, eNextState);
1222 // Initial channel request.
1223 p2pFuncAcquireCh(prAdapter, &(prP2pFsmInfo->rChnlReqInfo));
1227 case P2P_STATE_CHNL_ON_HAND:
1230 p2pStateAbort_CHNL_ON_HAND(prAdapter, prP2pFsmInfo, eNextState);
1233 // Initial channel ready.
1234 // Send channel ready event.
1235 // Start a FSM timer.
1236 p2pStateInit_CHNL_ON_HAND(prAdapter, prP2pFsmInfo);
1240 case P2P_STATE_GC_JOIN:
1243 // Join complete / join canceled.
1244 p2pStateAbort_GC_JOIN(prAdapter,
1246 &(prP2pFsmInfo->rJoinInfo),
1250 ASSERT(prP2pFsmInfo->prTargetBss != NULL);
1252 // Send request to SAA module.
1253 p2pStateInit_GC_JOIN(prAdapter,
1256 &(prP2pFsmInfo->rJoinInfo),
1257 prP2pFsmInfo->prTargetBss);
1265 } while (fgIsTransOut);
1267 } /* p2pFsmStateTransition */
1271 p2pFsmRunEventSwitchOPMode (
1272 IN P_ADAPTER_T prAdapter,
1273 IN P_MSG_HDR_T prMsgHdr
1276 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
1277 P_MSG_P2P_SWITCH_OP_MODE_T prSwitchOpMode = (P_MSG_P2P_SWITCH_OP_MODE_T)prMsgHdr;
1278 P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = (P_P2P_CONNECTION_SETTINGS_T)NULL;
1281 ASSERT_BREAK((prAdapter != NULL) && (prSwitchOpMode != NULL));
1283 DBGLOG(P2P, TRACE, ("p2pFsmRunEventSwitchOPMode\n"));
1285 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
1286 prP2pConnSettings = prAdapter->rWifiVar.prP2PConnSettings;
1288 if (prSwitchOpMode->eOpMode >= OP_MODE_NUM) {
1293 /* P2P Device / GC. */
1294 p2pFuncSwitchOPMode(prAdapter,
1296 prSwitchOpMode->eOpMode,
1302 cnmMemFree(prAdapter, prMsgHdr);
1306 } /* p2pFsmRunEventSwitchOPMode */
1309 /*----------------------------------------------------------------------------*/
1311 * \brief This function is used to handle scan done event during Device Discovery.
1313 * \param[in] prAdapter Pointer of ADAPTER_T
1317 /*----------------------------------------------------------------------------*/
1319 p2pFsmRunEventScanDone (
1320 IN P_ADAPTER_T prAdapter,
1321 IN P_MSG_HDR_T prMsgHdr
1324 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1325 P_P2P_SCAN_REQ_INFO_T prScanReqInfo = (P_P2P_SCAN_REQ_INFO_T)NULL;
1326 P_MSG_SCN_SCAN_DONE prScanDoneMsg = (P_MSG_SCN_SCAN_DONE)NULL;
1327 ENUM_P2P_STATE_T eNextState = P2P_STATE_NUM;
1330 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1333 /* This scan done event is either for "SCAN" phase or "SEARCH" state or "LISTEN" state.
1334 * The scan done for SCAN phase & SEARCH state doesn't imply Device
1337 DBGLOG(P2P, TRACE, ("P2P Scan Done Event\n"));
1339 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1340 prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo);
1341 prScanDoneMsg = (P_MSG_SCN_SCAN_DONE)prMsgHdr;
1343 if (prScanDoneMsg->ucSeqNum != prScanReqInfo->ucSeqNumOfScnMsg) {
1344 /* Scan Done message sequence number mismatch.
1345 * Ignore this event. (P2P FSM issue two scan events.)
1347 /* The scan request has been cancelled.
1348 * Ignore this message. It is possible.
1350 DBGLOG(P2P, TRACE, ("P2P Scan Don SeqNum:%d <-> P2P Fsm SCAN Msg:%d\n",
1351 prScanDoneMsg->ucSeqNum,
1352 prScanReqInfo->ucSeqNumOfScnMsg));
1358 switch (prP2pFsmInfo->eCurrentState) {
1359 case P2P_STATE_SCAN:
1361 P_P2P_CONNECTION_REQ_INFO_T prConnReqInfo = &(prP2pFsmInfo->rConnReqInfo);
1363 prScanReqInfo->fgIsAbort = FALSE;
1365 if (prConnReqInfo->fgIsConnRequest) {
1367 if ((prP2pFsmInfo->prTargetBss = p2pFuncKeepOnConnection(prAdapter,
1368 &prP2pFsmInfo->rConnReqInfo,
1369 &prP2pFsmInfo->rChnlReqInfo,
1370 &prP2pFsmInfo->rScanReqInfo)) == NULL) {
1371 eNextState = P2P_STATE_SCAN;
1374 eNextState = P2P_STATE_REQING_CHANNEL;
1379 eNextState = P2P_STATE_IDLE;
1384 case P2P_STATE_AP_CHANNEL_DETECT:
1385 eNextState = P2P_STATE_REQING_CHANNEL;
1388 /* Unexpected channel scan done event without being chanceled. */
1393 prScanReqInfo->fgIsScanRequest = FALSE;
1395 p2pFsmStateTransition(prAdapter,
1402 cnmMemFree(prAdapter, prMsgHdr);
1406 } /* p2pFsmRunEventScanDone */
1410 /*----------------------------------------------------------------------------*/
1412 * \brief This function is call when channel is granted by CNM module from FW.
1414 * \param[in] prAdapter Pointer of ADAPTER_T
1418 /*----------------------------------------------------------------------------*/
1420 p2pFsmRunEventChGrant (
1421 IN P_ADAPTER_T prAdapter,
1422 IN P_MSG_HDR_T prMsgHdr
1425 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1426 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = (P_P2P_CHNL_REQ_INFO_T)NULL;
1427 P_MSG_CH_GRANT_T prMsgChGrant = (P_MSG_CH_GRANT_T)NULL;
1428 UINT_8 ucTokenID = 0;
1431 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1433 DBGLOG(P2P, TRACE, ("P2P Run Event Channel Grant\n"));
1435 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1436 prMsgChGrant = (P_MSG_CH_GRANT_T)prMsgHdr;
1437 ucTokenID = prMsgChGrant->ucTokenID;
1438 prP2pFsmInfo->u4GrantInterval = prMsgChGrant->u4GrantInterval;
1440 prChnlReqInfo = &(prP2pFsmInfo->rChnlReqInfo);
1442 if (ucTokenID == prChnlReqInfo->ucSeqNumOfChReq) {
1443 ENUM_P2P_STATE_T eNextState = P2P_STATE_NUM;
1445 switch (prP2pFsmInfo->eCurrentState) {
1446 case P2P_STATE_REQING_CHANNEL:
1447 switch (prChnlReqInfo->eChannelReqType) {
1448 case CHANNEL_REQ_TYPE_REMAIN_ON_CHANNEL:
1449 eNextState = P2P_STATE_CHNL_ON_HAND;
1451 case CHANNEL_REQ_TYPE_GC_JOIN_REQ:
1452 eNextState = P2P_STATE_GC_JOIN;
1454 case CHANNEL_REQ_TYPE_GO_START_BSS:
1455 eNextState = P2P_STATE_IDLE;
1461 p2pFsmStateTransition(prAdapter,
1466 /* Channel is granted under unexpected state.
1467 * Driver should cancel channel privileagea before leaving the states.
1475 /* Channel requsted, but released. */
1476 ASSERT(!prChnlReqInfo->fgIsChannelRequested);
1481 cnmMemFree(prAdapter, prMsgHdr);
1486 } /* p2pFsmRunEventChGrant */
1490 p2pFsmRunEventChannelRequest (
1491 IN P_ADAPTER_T prAdapter,
1492 IN P_MSG_HDR_T prMsgHdr
1495 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = (P_P2P_CHNL_REQ_INFO_T)NULL;
1496 P_MSG_P2P_CHNL_REQUEST_T prP2pChnlReqMsg = (P_MSG_P2P_CHNL_REQUEST_T)NULL;
1497 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1498 ENUM_P2P_STATE_T eNextState = P2P_STATE_NUM;
1501 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1503 prP2pChnlReqMsg = (P_MSG_P2P_CHNL_REQUEST_T)prMsgHdr;
1504 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1505 prChnlReqInfo = &(prP2pFsmInfo->rChnlReqInfo);
1507 DBGLOG(P2P, TRACE, ("p2pFsmRunEventChannelRequest\n"));
1509 /* Special case of time renewing for same frequency. */
1510 if ((prP2pFsmInfo->eCurrentState == P2P_STATE_CHNL_ON_HAND) &&
1511 (prChnlReqInfo->ucReqChnlNum == prP2pChnlReqMsg->rChannelInfo.ucChannelNum) &&
1512 (prChnlReqInfo->eBand == prP2pChnlReqMsg->rChannelInfo.eBand) &&
1513 (prChnlReqInfo->eChnlSco == prP2pChnlReqMsg->eChnlSco)) {
1515 ASSERT(prChnlReqInfo->fgIsChannelRequested == TRUE);
1516 ASSERT(prChnlReqInfo->eChannelReqType == CHANNEL_REQ_TYPE_REMAIN_ON_CHANNEL);
1518 prChnlReqInfo->u8Cookie = prP2pChnlReqMsg->u8Cookie;
1519 prChnlReqInfo->u4MaxInterval = prP2pChnlReqMsg->u4Duration;
1521 /* Re-enter the state. */
1522 eNextState = P2P_STATE_CHNL_ON_HAND;
1526 // Make sure the state is in IDLE state.
1527 p2pFsmRunEventAbort(prAdapter, prP2pFsmInfo);
1529 prChnlReqInfo->u8Cookie = prP2pChnlReqMsg->u8Cookie; /* Cookie can only be assign after abort.(for indication) */
1530 prChnlReqInfo->ucReqChnlNum = prP2pChnlReqMsg->rChannelInfo.ucChannelNum;
1531 prChnlReqInfo->eBand = prP2pChnlReqMsg->rChannelInfo.eBand;
1532 prChnlReqInfo->eChnlSco = prP2pChnlReqMsg->eChnlSco;
1533 prChnlReqInfo->u4MaxInterval = prP2pChnlReqMsg->u4Duration;
1534 prChnlReqInfo->eChannelReqType = CHANNEL_REQ_TYPE_REMAIN_ON_CHANNEL;
1536 eNextState = P2P_STATE_REQING_CHANNEL;
1540 prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX].ucPrimaryChannel = prP2pChnlReqMsg->rChannelInfo.ucChannelNum;
1541 prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX].eBand = prP2pChnlReqMsg->rChannelInfo.eBand;
1545 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, eNextState);
1551 cnmMemFree(prAdapter, prMsgHdr);
1555 } /* p2pFsmRunEventChannelRequest */
1559 p2pFsmRunEventChannelAbort (
1560 IN P_ADAPTER_T prAdapter,
1561 IN P_MSG_HDR_T prMsgHdr
1564 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1565 P_MSG_P2P_CHNL_ABORT_T prChnlAbortMsg = (P_MSG_P2P_CHNL_ABORT_T)NULL;
1566 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = (P_P2P_CHNL_REQ_INFO_T)NULL;
1569 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1571 prChnlAbortMsg = (P_MSG_P2P_CHNL_ABORT_T)prMsgHdr;
1572 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1573 prChnlReqInfo = &prP2pFsmInfo->rChnlReqInfo;
1575 DBGLOG(P2P, TRACE, ("p2pFsmRunEventChannelAbort\n"));
1577 if ((prChnlAbortMsg->u8Cookie == prChnlReqInfo->u8Cookie) &&
1578 (prChnlReqInfo->fgIsChannelRequested)) {
1580 DBGLOG(P2P, TRACE, ("prP2pFsmInfo->eCurrentState:%d \n",
1581 prP2pFsmInfo->eCurrentState));
1583 ASSERT((prP2pFsmInfo->eCurrentState == P2P_STATE_REQING_CHANNEL ||
1584 (prP2pFsmInfo->eCurrentState == P2P_STATE_CHNL_ON_HAND)));
1586 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
1592 cnmMemFree(prAdapter, prMsgHdr);
1596 } /* p2pFsmRunEventChannelAbort */
1601 p2pFsmRunEventScanRequest (
1602 IN P_ADAPTER_T prAdapter,
1603 IN P_MSG_HDR_T prMsgHdr
1607 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1608 P_MSG_P2P_SCAN_REQUEST_T prP2pScanReqMsg = (P_MSG_P2P_SCAN_REQUEST_T)NULL;
1609 P_P2P_SCAN_REQ_INFO_T prScanReqInfo = (P_P2P_SCAN_REQ_INFO_T)NULL;
1610 UINT_32 u4ChnlListSize = 0;
1613 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1615 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1616 prP2pScanReqMsg = (P_MSG_P2P_SCAN_REQUEST_T)prMsgHdr;
1617 prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo);
1619 DBGLOG(P2P, TRACE, ("p2pFsmRunEventScanRequest\n"));
1621 // Make sure the state is in IDLE state.
1622 p2pFsmRunEventAbort(prAdapter, prP2pFsmInfo);
1624 ASSERT(prScanReqInfo->fgIsScanRequest == FALSE);
1626 prScanReqInfo->fgIsAbort = TRUE;
1627 prScanReqInfo->eScanType = SCAN_TYPE_ACTIVE_SCAN;
1628 prScanReqInfo->eChannelSet = SCAN_CHANNEL_SPECIFIED;
1631 prScanReqInfo->ucNumChannelList = prP2pScanReqMsg->u4NumChannel;
1632 DBGLOG(P2P, TRACE, ("Scan Request Channel List Number: %d\n", prScanReqInfo->ucNumChannelList));
1633 if (prScanReqInfo->ucNumChannelList > MAXIMUM_OPERATION_CHANNEL_LIST) {
1634 DBGLOG(P2P, TRACE, ("Channel List Number Overloaded: %d, change to: %d\n",
1635 prScanReqInfo->ucNumChannelList,
1636 MAXIMUM_OPERATION_CHANNEL_LIST));
1637 prScanReqInfo->ucNumChannelList = MAXIMUM_OPERATION_CHANNEL_LIST;
1640 u4ChnlListSize = sizeof(RF_CHANNEL_INFO_T) * prScanReqInfo->ucNumChannelList;
1641 kalMemCopy(prScanReqInfo->arScanChannelList, prP2pScanReqMsg->arChannelListInfo, u4ChnlListSize);
1643 // TODO: I only take the first SSID. Multiple SSID may be needed in the future.
1645 if (prP2pScanReqMsg->i4SsidNum >= 1) {
1647 kalMemCopy(&(prScanReqInfo->rSsidStruct),
1648 prP2pScanReqMsg->prSSID,
1649 sizeof(P2P_SSID_STRUCT_T));
1652 prScanReqInfo->rSsidStruct.ucSsidLen = 0;
1656 kalMemCopy(prScanReqInfo->aucIEBuf,
1657 prP2pScanReqMsg->pucIEBuf,
1658 prP2pScanReqMsg->u4IELen);
1660 prScanReqInfo->u4BufLength = prP2pScanReqMsg->u4IELen;
1662 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_SCAN);
1669 cnmMemFree(prAdapter, prMsgHdr);
1673 } /* p2pFsmRunEventScanRequest */
1677 p2pFsmRunEventScanAbort (
1678 IN P_ADAPTER_T prAdapter,
1679 IN P_MSG_HDR_T prMsgHdr
1683 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1686 ASSERT_BREAK(prAdapter != NULL);
1688 DBGLOG(P2P, TRACE, ("p2pFsmRunEventScanAbort\n"));
1690 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1692 if (prP2pFsmInfo->eCurrentState == P2P_STATE_SCAN) {
1693 P_P2P_SCAN_REQ_INFO_T prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo);
1695 prScanReqInfo->fgIsAbort = TRUE;
1697 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
1703 cnmMemFree(prAdapter, prMsgHdr);
1707 } /* p2pFsmRunEventScanAbort */
1714 p2pFsmRunEventAbort (
1715 IN P_ADAPTER_T prAdapter,
1716 IN P_P2P_FSM_INFO_T prP2pFsmInfo
1720 ASSERT_BREAK((prAdapter != NULL) && (prP2pFsmInfo != NULL));
1722 DBGLOG(P2P, TRACE, ("p2pFsmRunEventAbort\n"));
1724 if (prP2pFsmInfo->eCurrentState != P2P_STATE_IDLE) {
1726 if (prP2pFsmInfo->eCurrentState == P2P_STATE_SCAN) {
1728 P_P2P_SCAN_REQ_INFO_T prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo);
1730 prScanReqInfo->fgIsAbort = TRUE;
1732 // For other state, is there any special action that should be take before leaving?
1734 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
1737 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = &(prP2pFsmInfo->rChnlReqInfo);
1739 if (prChnlReqInfo->fgIsChannelRequested) {
1740 cnmTimerStopTimer(prAdapter, &(prP2pFsmInfo->rP2pFsmTimeoutTimer));
1748 } /* p2pFsmRunEventAbort */
1752 /*----------------------------------------------------------------------------*/
1754 * \brief This function is used to handle FSM Timeout.
1756 * \param[in] prAdapter Pointer of ADAPTER_T
1760 /*----------------------------------------------------------------------------*/
1762 p2pFsmRunEventFsmTimeout (
1763 IN P_ADAPTER_T prAdapter,
1767 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)u4Param;
1770 ASSERT_BREAK((prAdapter != NULL) && (prP2pFsmInfo != NULL));
1772 DBGLOG(P2P, TRACE, ("P2P FSM Timeout Event\n"));
1774 switch (prP2pFsmInfo->eCurrentState) {
1775 case P2P_STATE_IDLE:
1777 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = &prP2pFsmInfo->rChnlReqInfo;
1778 if (prChnlReqInfo->fgIsChannelRequested) {
1779 p2pFuncReleaseCh(prAdapter, prChnlReqInfo);
1784 // case P2P_STATE_SCAN:
1786 // case P2P_STATE_AP_CHANNEL_DETECT:
1788 // case P2P_STATE_REQING_CHANNEL:
1790 case P2P_STATE_CHNL_ON_HAND:
1792 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
1795 // case P2P_STATE_GC_JOIN:
1804 } /* p2pFsmRunEventFsmTimeout */
1807 p2pFsmRunEventMgmtFrameTx (
1808 IN P_ADAPTER_T prAdapter,
1809 IN P_MSG_HDR_T prMsgHdr
1812 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1813 P_MSG_P2P_MGMT_TX_REQUEST_T prMgmtTxMsg = (P_MSG_P2P_MGMT_TX_REQUEST_T)NULL;
1816 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1818 DBGLOG(P2P, TRACE, ("p2pFsmRunEventMgmtFrameTx\n"));
1820 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1821 prMgmtTxMsg = (P_MSG_P2P_MGMT_TX_REQUEST_T)prMsgHdr;
1823 p2pFuncTxMgmtFrame(prAdapter,
1824 &prP2pFsmInfo->rMgmtTxInfo,
1825 prMgmtTxMsg->prMgmtMsduInfo,
1826 prMgmtTxMsg->u8Cookie);
1833 cnmMemFree(prAdapter, prMsgHdr);
1839 /* p2pFsmRunEventMgmtTx */
1843 p2pFsmRunEventBeaconUpdate (
1844 IN P_ADAPTER_T prAdapter,
1845 IN P_MSG_HDR_T prMsgHdr
1848 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
1849 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
1850 P_MSG_P2P_BEACON_UPDATE_T prBcnUpdateMsg = (P_MSG_P2P_BEACON_UPDATE_T)NULL;
1853 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
1855 DBGLOG(P2P, TRACE, ("p2pFsmRunEventBeaconUpdate\n"));
1857 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
1858 DBGLOG(P2P, TRACE, ("p2pFsmRunEventBeaconUpdate 0001\n"));
1859 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
1860 DBGLOG(P2P, TRACE, ("p2pFsmRunEventBeaconUpdate 0002\n"));
1861 prBcnUpdateMsg = (P_MSG_P2P_BEACON_UPDATE_T)prMsgHdr;
1862 DBGLOG(P2P, TRACE, ("p2pFsmRunEventBeaconUpdate 0003\n"));
1863 if (prBcnUpdateMsg->u4BcnInterval) {
1864 DBGLOG(P2P, TRACE, ("Beacon interval updated to :%ld \n", prBcnUpdateMsg->u4BcnInterval));
1865 prP2pBssInfo->u2BeaconInterval = (UINT_16)prBcnUpdateMsg->u4BcnInterval;
1867 else if (prP2pBssInfo->u2BeaconInterval == 0) {
1868 prP2pBssInfo->u2BeaconInterval = DOT11_BEACON_PERIOD_DEFAULT;
1870 if (prBcnUpdateMsg->u4DtimPeriod) {
1871 DBGLOG(P2P, TRACE, ("DTIM interval updated to :%ld \n", prBcnUpdateMsg->u4DtimPeriod));
1872 prP2pBssInfo->ucDTIMPeriod = (UINT_8)prBcnUpdateMsg->u4DtimPeriod;
1874 else if (prP2pBssInfo->ucDTIMPeriod == 0) {
1875 prP2pBssInfo->ucDTIMPeriod = DOT11_DTIM_PERIOD_DEFAULT;
1877 DBGLOG(P2P, TRACE, ("p2pFsmRunEventBeaconUpdate 0004\n"));
1878 p2pFuncBeaconUpdate(prAdapter,
1880 &prP2pFsmInfo->rBcnContentInfo,
1881 prBcnUpdateMsg->pucBcnHdr,
1882 prBcnUpdateMsg->u4BcnHdrLen,
1883 prBcnUpdateMsg->pucBcnBody,
1884 prBcnUpdateMsg->u4BcnBodyLen);
1885 DBGLOG(P2P, TRACE, ("p2pFsmRunEventBeaconUpdate 0005\n"));
1887 if ((prP2pBssInfo->eCurrentOPMode == OP_MODE_ACCESS_POINT) &&
1888 (prP2pBssInfo->eIntendOPMode == OP_MODE_NUM)) {
1889 /* AP is created, Beacon Update. */
1890 nicPmIndicateBssAbort(prAdapter, NETWORK_TYPE_P2P_INDEX);
1892 nicPmIndicateBssCreated(prAdapter, NETWORK_TYPE_P2P_INDEX);
1893 DBGLOG(P2P, TRACE, ("AP is created, Beacon Update\n"));
1896 UINT_8 ucPreferedChnl = 0;
1897 ENUM_BAND_T eBand = BAND_NULL;
1898 ENUM_CHNL_EXT_T eSco = CHNL_EXT_SCN;
1899 ENUM_P2P_STATE_T eNextState = P2P_STATE_SCAN;
1900 P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = prAdapter->rWifiVar.prP2PConnSettings;
1903 if(prP2pFsmInfo->eCurrentState != P2P_STATE_SCAN &&
1904 prP2pFsmInfo->eCurrentState != P2P_STATE_IDLE) {
1905 // Make sure the state is in IDLE state.
1906 p2pFsmRunEventAbort(prAdapter, prP2pFsmInfo);
1909 // 20120118: Moved to p2pFuncSwitchOPMode().
1910 //SET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX);
1912 /* Leave IDLE state. */
1913 SET_NET_PWR_STATE_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX);
1915 // sync with firmware
1916 //DBGLOG(P2P, INFO, ("Activate P2P Network. \n"));
1917 //nicActivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX);
1920 /* Key to trigger P2P FSM to allocate channel for AP mode. */
1921 prP2pBssInfo->eIntendOPMode = OP_MODE_ACCESS_POINT;
1923 /* Sparse Channel to decide which channel to use. */
1924 if ((cnmPreferredChannel(prAdapter,
1927 &eSco) == FALSE) && (prP2pConnSettings->ucOperatingChnl == 0)) {
1928 // Sparse Channel Detection using passive mode.
1929 eNextState = P2P_STATE_AP_CHANNEL_DETECT;
1932 P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo = prAdapter->rWifiVar.prP2pSpecificBssInfo;
1933 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = &prP2pFsmInfo->rChnlReqInfo;
1937 /* 2012-01-27: frog - Channel set from upper layer is the first priority. */
1938 /* Becuase the channel & beacon is decided by p2p_supplicant. */
1939 if (prP2pConnSettings->ucOperatingChnl != 0) {
1940 prP2pSpecificBssInfo->ucPreferredChannel = prP2pConnSettings->ucOperatingChnl;
1941 prP2pSpecificBssInfo->eRfBand = prP2pConnSettings->eBand;
1944 ASSERT(ucPreferedChnl != 0);
1945 prP2pSpecificBssInfo->ucPreferredChannel = ucPreferedChnl;
1946 prP2pSpecificBssInfo->eRfBand = eBand;
1949 if (ucPreferedChnl) {
1950 prP2pSpecificBssInfo->ucPreferredChannel = ucPreferedChnl;
1951 prP2pSpecificBssInfo->eRfBand = eBand;
1954 ASSERT(prP2pConnSettings->ucOperatingChnl != 0);
1955 prP2pSpecificBssInfo->ucPreferredChannel = prP2pConnSettings->ucOperatingChnl;
1956 prP2pSpecificBssInfo->eRfBand = prP2pConnSettings->eBand;
1960 prChnlReqInfo->ucReqChnlNum = prP2pSpecificBssInfo->ucPreferredChannel;
1961 prChnlReqInfo->eBand = prP2pSpecificBssInfo->eRfBand;
1962 prChnlReqInfo->eChannelReqType = CHANNEL_REQ_TYPE_GO_START_BSS;
1964 /* If channel is specified, use active scan to shorten the scan time. */
1965 p2pFsmStateTransition(prAdapter,
1966 prAdapter->rWifiVar.prP2pFsmInfo,
1975 cnmMemFree(prAdapter, prMsgHdr);
1978 } /* p2pFsmRunEventBeaconUpdate */
1982 p2pFsmRunEventBeaconAbort (
1983 IN P_ADAPTER_T prAdapter,
1984 IN P_MSG_HDR_T prMsgHdr
1987 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
1990 ASSERT_BREAK((prAdapter != NULL));
1992 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
1994 DBGLOG(P2P, TRACE, ("p2pFsmRunEventBeaconAbort\n"));
1996 if ((prP2pBssInfo->eCurrentOPMode == OP_MODE_ACCESS_POINT)) {
1997 /* AP is created, Beacon Update. */
1998 DBGLOG(P2P, TRACE, ("Stop Beaconing\n"));
1999 nicPmIndicateBssAbort(prAdapter, NETWORK_TYPE_P2P_INDEX);
2001 /* Reset RLM related field of BSSINFO. */
2002 rlmBssAborted(prAdapter, prP2pBssInfo);
2005 // 20120118: Moved to p2pFuncSwitchOPMode().
2006 //UNSET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX);
2008 /* Enter IDLE state. */
2009 SET_NET_PWR_STATE_IDLE(prAdapter, NETWORK_TYPE_P2P_INDEX);
2011 DBGLOG(P2P, INFO, ("Re activate P2P Network. \n"));
2012 nicDeactivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX);
2014 nicActivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX);
2019 cnmMemFree(prAdapter, prMsgHdr);
2022 } /* p2pFsmRunEventBeaconAbort */
2025 p2pFsmRunEventConnectionRequest (
2026 IN P_ADAPTER_T prAdapter,
2027 IN P_MSG_HDR_T prMsgHdr
2030 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2031 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2032 P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = (P_P2P_CHNL_REQ_INFO_T)NULL;
2033 P_MSG_P2P_CONNECTION_REQUEST_T prConnReqMsg = (P_MSG_P2P_CONNECTION_REQUEST_T)NULL;
2034 P_P2P_CONNECTION_REQ_INFO_T prConnReqInfo = (P_P2P_CONNECTION_REQ_INFO_T)NULL;
2037 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
2039 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2040 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2041 prConnReqMsg = (P_MSG_P2P_CONNECTION_REQUEST_T)prMsgHdr;
2043 prConnReqInfo = &(prP2pFsmInfo->rConnReqInfo);
2044 prChnlReqInfo = &(prP2pFsmInfo->rChnlReqInfo);
2046 DBGLOG(P2P, TRACE, ("p2pFsmRunEventConnectionRequest\n"));
2048 if (prP2pBssInfo->eCurrentOPMode != OP_MODE_INFRASTRUCTURE) {
2051 // Make sure the state is in IDLE state.
2052 p2pFsmRunEventAbort(prAdapter, prP2pFsmInfo);
2054 // Update connection request information.
2055 prConnReqInfo->fgIsConnRequest = TRUE;
2056 COPY_MAC_ADDR(prConnReqInfo->aucBssid, prConnReqMsg->aucBssid);
2057 kalMemCopy(&(prConnReqInfo->rSsidStruct), &(prConnReqMsg->rSsid), sizeof(P2P_SSID_STRUCT_T));
2058 kalMemCopy(prConnReqInfo->aucIEBuf, prConnReqMsg->aucIEBuf, prConnReqMsg->u4IELen);
2059 prConnReqInfo->u4BufLength = prConnReqMsg->u4IELen;
2061 /* Find BSS Descriptor first. */
2062 prP2pFsmInfo->prTargetBss = scanP2pSearchDesc(prAdapter,
2066 if (prP2pFsmInfo->prTargetBss == NULL) {
2067 /* Update scan parameter... to scan target device. */
2068 P_P2P_SCAN_REQ_INFO_T prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo);
2070 prScanReqInfo->ucNumChannelList = 1;
2071 prScanReqInfo->eScanType = SCAN_TYPE_ACTIVE_SCAN;
2072 prScanReqInfo->eChannelSet = SCAN_CHANNEL_SPECIFIED;
2073 prScanReqInfo->arScanChannelList[0].ucChannelNum = prConnReqMsg->rChannelInfo.ucChannelNum;
2074 kalMemCopy(&(prScanReqInfo->rSsidStruct), &(prConnReqMsg->rSsid), sizeof(P2P_SSID_STRUCT_T));
2075 prScanReqInfo->u4BufLength = 0; /* Prevent other P2P ID in IE. */
2076 prScanReqInfo->fgIsAbort = TRUE;
2078 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_SCAN);
2081 prChnlReqInfo->u8Cookie = 0;
2082 prChnlReqInfo->ucReqChnlNum = prConnReqMsg->rChannelInfo.ucChannelNum;
2083 prChnlReqInfo->eBand = prConnReqMsg->rChannelInfo.eBand;
2084 prChnlReqInfo->eChnlSco = prConnReqMsg->eChnlSco;
2085 prChnlReqInfo->u4MaxInterval = AIS_JOIN_CH_REQUEST_INTERVAL;
2086 prChnlReqInfo->eChannelReqType = CHANNEL_REQ_TYPE_GC_JOIN_REQ;
2088 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_REQING_CHANNEL);
2095 cnmMemFree(prAdapter, prMsgHdr);
2100 } /* p2pFsmRunEventConnectionRequest */
2102 /*----------------------------------------------------------------------------*/
2104 * \brief This function is used to handle Connection Request from Supplicant.
2106 * \param[in] prAdapter Pointer of ADAPTER_T
2110 /*----------------------------------------------------------------------------*/
2112 p2pFsmRunEventConnectionAbort (
2113 IN P_ADAPTER_T prAdapter,
2114 IN P_MSG_HDR_T prMsgHdr
2117 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2118 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2119 P_MSG_P2P_CONNECTION_ABORT_T prDisconnMsg = (P_MSG_P2P_CONNECTION_ABORT_T)NULL;
2123 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
2125 DBGLOG(P2P, TRACE, ("p2pFsmRunEventConnectionAbort: Connection Abort.\n"));
2127 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2128 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2130 prDisconnMsg = (P_MSG_P2P_CONNECTION_ABORT_T)prMsgHdr;
2132 switch (prP2pBssInfo->eCurrentOPMode) {
2133 case OP_MODE_INFRASTRUCTURE:
2135 UINT_8 aucBCBSSID[] = BC_BSSID;
2137 kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo, NULL, NULL, 0, 0);
2139 if (!prP2pBssInfo->prStaRecOfAP) {
2140 DBGLOG(P2P, TRACE, ("GO's StaRec is NULL\n"));
2143 if (UNEQUAL_MAC_ADDR(prP2pBssInfo->prStaRecOfAP->aucMacAddr, prDisconnMsg->aucTargetID) &&
2144 UNEQUAL_MAC_ADDR(prDisconnMsg->aucTargetID, aucBCBSSID)) {
2145 DBGLOG(P2P, TRACE, ("Unequal MAC ADDR ["MACSTR":"MACSTR"]\n",
2146 MAC2STR(prP2pBssInfo->prStaRecOfAP->aucMacAddr),
2147 MAC2STR(prDisconnMsg->aucTargetID)));
2151 /* Stop rejoin timer if it is started. */
2154 p2pFuncDisconnect(prAdapter, prP2pBssInfo->prStaRecOfAP, prDisconnMsg->fgSendDeauth, prDisconnMsg->u2ReasonCode);
2158 case OP_MODE_ACCESS_POINT:
2160 P_LINK_T prStaRecOfClientList = &prP2pBssInfo->rStaRecOfClientList;
2161 /* Search specific client device, and disconnect. */
2162 /* 1. Send deauthentication frame. */
2163 /* 2. Indication: Device disconnect. */
2164 P_LINK_ENTRY_T prLinkEntry = (P_LINK_ENTRY_T)NULL;
2165 P_STA_RECORD_T prCurrStaRec = (P_STA_RECORD_T)NULL;
2167 DBGLOG(P2P, TRACE, ("Disconnecting with Target ID: "MACSTR"\n", MAC2STR(prDisconnMsg->aucTargetID)));
2169 LINK_FOR_EACH(prLinkEntry, prStaRecOfClientList) {
2170 prCurrStaRec = LINK_ENTRY(prLinkEntry, STA_RECORD_T, rLinkEntry);
2172 ASSERT(prCurrStaRec);
2174 if (EQUAL_MAC_ADDR(prCurrStaRec->aucMacAddr, prDisconnMsg->aucTargetID)) {
2176 DBGLOG(P2P, TRACE, ("Disconnecting: "MACSTR"\n", MAC2STR(prCurrStaRec->aucMacAddr)));
2178 /* Remove STA from client list. */
2179 LINK_REMOVE_KNOWN_ENTRY(prStaRecOfClientList, &prCurrStaRec->rLinkEntry);
2181 /* Glue layer indication. */
2182 kalP2PGOStationUpdate(prAdapter->prGlueInfo, prCurrStaRec, FALSE);
2184 /* Send deauth & do indication. */
2185 p2pFuncDisconnect(prAdapter, prCurrStaRec, prDisconnMsg->fgSendDeauth, prDisconnMsg->u2ReasonCode);
2193 case OP_MODE_P2P_DEVICE:
2202 cnmMemFree(prAdapter, prMsgHdr);
2206 } /* p2pFsmRunEventConnectionAbort */
2210 p2pFsmRunEventDissolve (
2211 IN P_ADAPTER_T prAdapter,
2212 IN P_MSG_HDR_T prMsgHdr
2218 DBGLOG(P2P, TRACE, ("p2pFsmRunEventDissolve\n"));
2221 cnmMemFree(prAdapter, prMsgHdr);
2227 p2pFsmRunEventDeauthTxDone (
2228 IN P_ADAPTER_T prAdapter,
2229 IN P_MSDU_INFO_T prMsduInfo,
2230 IN ENUM_TX_RESULT_CODE_T rTxDoneStatus
2234 P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL;
2235 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2236 ENUM_PARAM_MEDIA_STATE_T eOriMediaStatus;
2240 ASSERT_BREAK((prAdapter != NULL) &&
2241 (prMsduInfo != NULL));
2243 DBGLOG(P2P, TRACE, ("Deauth TX Done\n"));
2245 prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex);
2247 if (prStaRec == NULL) {
2248 DBGLOG(P2P, TRACE, ("Station Record NULL, Index:%d\n", prMsduInfo->ucStaRecIndex));
2252 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2253 eOriMediaStatus = prP2pBssInfo->eConnectionState;
2255 /* Change station state. */
2256 cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_1);
2258 /* Reset Station Record Status. */
2259 p2pFuncResetStaRecStatus(prAdapter, prStaRec);
2261 if ((prP2pBssInfo->eCurrentOPMode != OP_MODE_ACCESS_POINT) ||
2262 (prP2pBssInfo->rStaRecOfClientList.u4NumElem == 0)) {
2263 DBGLOG(P2P, TRACE, ("No More Client, Media Status DISCONNECTED\n"));
2264 p2pChangeMediaState(prAdapter, PARAM_MEDIA_STATE_DISCONNECTED);
2267 if (eOriMediaStatus != prP2pBssInfo->eConnectionState) {
2268 /* Update Disconnected state to FW. */
2269 nicUpdateBss(prAdapter, NETWORK_TYPE_P2P_INDEX);
2275 return WLAN_STATUS_SUCCESS;
2276 } /* p2pFsmRunEventDeauthTxDone */
2280 p2pFsmRunEventMgmtFrameTxDone (
2281 IN P_ADAPTER_T prAdapter,
2282 IN P_MSDU_INFO_T prMsduInfo,
2283 IN ENUM_TX_RESULT_CODE_T rTxDoneStatus
2286 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2287 P_P2P_MGMT_TX_REQ_INFO_T prMgmtTxReqInfo = (P_P2P_MGMT_TX_REQ_INFO_T)NULL;
2288 BOOLEAN fgIsSuccess = FALSE;
2291 ASSERT_BREAK((prAdapter != NULL) && (prMsduInfo != NULL));
2293 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2294 prMgmtTxReqInfo = &(prP2pFsmInfo->rMgmtTxInfo);
2296 if (rTxDoneStatus != TX_RESULT_SUCCESS) {
2297 DBGLOG(P2P, TRACE, ("Mgmt Frame TX Fail, Status:%d.\n", rTxDoneStatus));
2301 DBGLOG(P2P, TRACE, ("Mgmt Frame TX Done.\n"));
2305 if (prMgmtTxReqInfo->prMgmtTxMsdu == prMsduInfo) {
2306 kalP2PIndicateMgmtTxStatus(prAdapter->prGlueInfo,
2307 prMgmtTxReqInfo->u8Cookie,
2309 prMsduInfo->prPacket,
2310 (UINT_32)prMsduInfo->u2FrameLength);
2312 prMgmtTxReqInfo->prMgmtTxMsdu = NULL;
2317 return WLAN_STATUS_SUCCESS;
2319 } /* p2pFsmRunEventMgmtFrameTxDone */
2322 /*----------------------------------------------------------------------------*/
2324 * \brief This function is called when JOIN complete message event is received from SAA.
2326 * \param[in] prAdapter Pointer of ADAPTER_T
2330 /*----------------------------------------------------------------------------*/
2332 p2pFsmRunEventJoinComplete (
2333 IN P_ADAPTER_T prAdapter,
2334 IN P_MSG_HDR_T prMsgHdr
2337 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2338 P_P2P_JOIN_INFO_T prJoinInfo = (P_P2P_JOIN_INFO_T)NULL;
2339 P_MSG_JOIN_COMP_T prJoinCompMsg = (P_MSG_JOIN_COMP_T)NULL;
2340 P_SW_RFB_T prAssocRspSwRfb = (P_SW_RFB_T)NULL;
2341 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2344 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
2346 DBGLOG(P2P, TRACE, ("P2P Join Complete\n"));
2348 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2349 prJoinInfo = &(prP2pFsmInfo->rJoinInfo);
2350 prJoinCompMsg = (P_MSG_JOIN_COMP_T)prMsgHdr;
2351 prAssocRspSwRfb = prJoinCompMsg->prSwRfb;
2352 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2354 if (prP2pBssInfo->eCurrentOPMode == OP_MODE_INFRASTRUCTURE) {
2355 P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL;
2357 prStaRec = prJoinCompMsg->prStaRec;
2360 if (prJoinCompMsg->ucSeqNum == prJoinInfo->ucSeqNumOfReqMsg) {
2361 ASSERT(prStaRec == prJoinInfo->prTargetStaRec);
2362 prJoinInfo->fgIsJoinComplete = TRUE;
2364 if (prJoinCompMsg->rJoinStatus == WLAN_STATUS_SUCCESS) {
2366 //4 <1.1> Change FW's Media State immediately.
2367 p2pChangeMediaState(prAdapter, PARAM_MEDIA_STATE_CONNECTED);
2369 //4 <1.2> Deactivate previous AP's STA_RECORD_T in Driver if have.
2370 if ((prP2pBssInfo->prStaRecOfAP) &&
2371 (prP2pBssInfo->prStaRecOfAP != prStaRec)) {
2372 cnmStaRecChangeState(prAdapter, prP2pBssInfo->prStaRecOfAP, STA_STATE_1);
2375 //4 <1.3> Update BSS_INFO_T
2376 p2pFuncUpdateBssInfoForJOIN(prAdapter, prP2pFsmInfo->prTargetBss, prStaRec, prAssocRspSwRfb);
2378 //4 <1.4> Activate current AP's STA_RECORD_T in Driver.
2379 cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_3);
2381 #if CFG_SUPPORT_P2P_RSSI_QUERY
2382 //<1.5> Update RSSI if necessary
2383 nicUpdateRSSI(prAdapter, NETWORK_TYPE_P2P_INDEX, (INT_8)(RCPI_TO_dBm(prStaRec->ucRCPI)), 0);
2386 //4 <1.6> Indicate Connected Event to Host immediately.
2387 /* Require BSSID, Association ID, Beacon Interval.. from AIS_BSS_INFO_T */
2388 //p2pIndicationOfMediaStateToHost(prAdapter, PARAM_MEDIA_STATE_CONNECTED, prStaRec->aucMacAddr);
2389 kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo,
2390 &prP2pFsmInfo->rConnReqInfo,
2391 prJoinInfo->aucIEBuf,
2392 prJoinInfo->u4BufLength,
2393 prStaRec->u2StatusCode);
2398 //4 <2.1> Redo JOIN process with other Auth Type if possible
2399 if (p2pFuncRetryJOIN(prAdapter, prStaRec, prJoinInfo) == FALSE) {
2400 P_BSS_DESC_T prBssDesc;
2402 /* Increase Failure Count */
2403 prStaRec->ucJoinFailureCount++;
2405 prBssDesc = prP2pFsmInfo->prTargetBss;
2408 ASSERT(prBssDesc->fgIsConnecting);
2410 prBssDesc->fgIsConnecting = FALSE;
2412 kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo,
2413 &prP2pFsmInfo->rConnReqInfo,
2414 prJoinInfo->aucIEBuf,
2415 prJoinInfo->u4BufLength,
2416 prStaRec->u2StatusCode);
2424 if (prAssocRspSwRfb) {
2425 nicRxReturnRFB(prAdapter, prAssocRspSwRfb);
2428 if (prP2pFsmInfo->eCurrentState == P2P_STATE_GC_JOIN) {
2429 /* Return to IDLE state. */
2430 p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE);
2436 cnmMemFree(prAdapter, prMsgHdr);
2441 } /* p2pFsmRunEventJoinComplete */
2446 p2pFsmRunEventMgmtFrameRegister (
2447 IN P_ADAPTER_T prAdapter,
2448 IN P_MSG_HDR_T prMsgHdr
2451 P_MSG_P2P_MGMT_FRAME_REGISTER_T prMgmtFrameRegister = (P_MSG_P2P_MGMT_FRAME_REGISTER_T)NULL;
2452 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2455 ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
2457 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2459 prMgmtFrameRegister = (P_MSG_P2P_MGMT_FRAME_REGISTER_T)prMsgHdr;
2461 p2pFuncMgmtFrameRegister(prAdapter,
2462 prMgmtFrameRegister->u2FrameType,
2463 prMgmtFrameRegister->fgIsRegister,
2464 &prP2pFsmInfo->u4P2pPacketFilter);
2470 cnmMemFree(prAdapter, prMsgHdr);
2474 } /* p2pFsmRunEventMgmtFrameRegister */
2480 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2481 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2482 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2483 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2484 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2485 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2486 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2487 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2488 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2489 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2490 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2491 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2492 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2493 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2502 /*----------------------------------------------------------------------------*/
2504 * \brief This function is call when RX deauthentication frame from the AIR.
2505 * If we are under STA mode, we would go back to P2P Device.
2506 * If we are under AP mode, we would stay in AP mode until disconnect event from HOST.
2508 * \param[in] prAdapter Pointer of ADAPTER_T
2512 /*----------------------------------------------------------------------------*/
2514 p2pFsmRunEventRxDeauthentication (
2515 IN P_ADAPTER_T prAdapter,
2516 IN P_STA_RECORD_T prStaRec,
2517 IN P_SW_RFB_T prSwRfb
2520 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2521 UINT_16 u2ReasonCode = 0;
2524 ASSERT_BREAK((prAdapter != NULL) && (prSwRfb != NULL));
2526 if (prStaRec == NULL) {
2527 prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx);
2531 prP2pBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX];
2533 if (prStaRec->ucStaState == STA_STATE_1) {
2537 DBGLOG(P2P, TRACE, ("RX Deauth\n"));
2539 switch (prP2pBssInfo->eCurrentOPMode) {
2540 case OP_MODE_INFRASTRUCTURE:
2541 if (authProcessRxDeauthFrame(prSwRfb,
2542 prStaRec->aucMacAddr,
2543 &u2ReasonCode) == WLAN_STATUS_SUCCESS) {
2544 P_WLAN_DEAUTH_FRAME_T prDeauthFrame = (P_WLAN_DEAUTH_FRAME_T)prSwRfb->pvHeader;
2545 UINT_16 u2IELength = 0;
2547 prStaRec->u2ReasonCode = u2ReasonCode;
2548 u2IELength = prSwRfb->u2PacketLen - (WLAN_MAC_HEADER_LEN + REASON_CODE_FIELD_LEN);
2550 ASSERT(prP2pBssInfo->prStaRecOfAP == prStaRec);
2552 /* Indicate disconnect to Host. */
2553 kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo,
2555 prDeauthFrame->aucInfoElem,
2559 p2pFuncDisconnect(prAdapter, prStaRec, FALSE, u2ReasonCode);
2562 case OP_MODE_ACCESS_POINT:
2563 /* Delete client from client list. */
2564 if (authProcessRxDeauthFrame(prSwRfb,
2565 prP2pBssInfo->aucBSSID,
2566 &u2ReasonCode) == WLAN_STATUS_SUCCESS) {
2567 P_LINK_T prStaRecOfClientList = (P_LINK_T)NULL;
2568 P_LINK_ENTRY_T prLinkEntry = (P_LINK_ENTRY_T)NULL;
2569 P_STA_RECORD_T prCurrStaRec = (P_STA_RECORD_T)NULL;
2571 prStaRecOfClientList = &prP2pBssInfo->rStaRecOfClientList;
2573 LINK_FOR_EACH(prLinkEntry, prStaRecOfClientList) {
2574 prCurrStaRec = LINK_ENTRY(prLinkEntry, STA_RECORD_T, rLinkEntry);
2576 ASSERT(prCurrStaRec);
2578 if (EQUAL_MAC_ADDR(prCurrStaRec->aucMacAddr, prStaRec->aucMacAddr)) {
2580 /* Remove STA from client list. */
2581 LINK_REMOVE_KNOWN_ENTRY(prStaRecOfClientList, &prCurrStaRec->rLinkEntry);
2583 /* Indicate to Host. */
2584 kalP2PGOStationUpdate(prAdapter->prGlueInfo, prStaRec, FALSE);
2586 /* Indicate disconnect to Host. */
2587 p2pFuncDisconnect(prAdapter, prStaRec, FALSE, u2ReasonCode);
2594 case OP_MODE_P2P_DEVICE:
2596 /* Findout why someone sent deauthentication frame to us. */
2601 DBGLOG(P2P, TRACE, ("Deauth Reason:%d\n", u2ReasonCode));
2607 } /* p2pFsmRunEventRxDeauthentication */
2609 /*----------------------------------------------------------------------------*/
2611 * \brief This function is call when RX deauthentication frame from the AIR.
2612 * If we are under STA mode, we would go back to P2P Device.
2613 * If we are under AP mode, we would stay in AP mode until disconnect event from HOST.
2615 * \param[in] prAdapter Pointer of ADAPTER_T
2619 /*----------------------------------------------------------------------------*/
2621 p2pFsmRunEventRxDisassociation (
2622 IN P_ADAPTER_T prAdapter,
2623 IN P_STA_RECORD_T prStaRec,
2624 IN P_SW_RFB_T prSwRfb
2627 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2628 UINT_16 u2ReasonCode = 0;
2631 ASSERT_BREAK((prAdapter != NULL) && (prSwRfb != NULL));
2633 if (prStaRec == NULL) {
2634 prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx);
2638 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2640 if (prStaRec->ucStaState == STA_STATE_1) {
2645 DBGLOG(P2P, TRACE, ("RX Disassoc\n"));
2647 switch (prP2pBssInfo->eCurrentOPMode) {
2648 case OP_MODE_INFRASTRUCTURE:
2649 if (assocProcessRxDisassocFrame(prAdapter,
2651 prStaRec->aucMacAddr,
2652 &prStaRec->u2ReasonCode) == WLAN_STATUS_SUCCESS) {
2653 P_WLAN_DISASSOC_FRAME_T prDisassocFrame = (P_WLAN_DISASSOC_FRAME_T)prSwRfb->pvHeader;
2654 UINT_16 u2IELength = 0;
2656 ASSERT(prP2pBssInfo->prStaRecOfAP == prStaRec);
2658 u2IELength = prSwRfb->u2PacketLen - (WLAN_MAC_HEADER_LEN + REASON_CODE_FIELD_LEN);
2660 /* Indicate disconnect to Host. */
2661 kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo,
2663 prDisassocFrame->aucInfoElem,
2665 prStaRec->u2ReasonCode);
2668 case OP_MODE_ACCESS_POINT:
2669 /* Delete client from client list. */
2670 if (assocProcessRxDisassocFrame(prAdapter,
2672 prP2pBssInfo->aucBSSID,
2673 &u2ReasonCode) == WLAN_STATUS_SUCCESS) {
2674 P_LINK_T prStaRecOfClientList = (P_LINK_T)NULL;
2675 P_LINK_ENTRY_T prLinkEntry = (P_LINK_ENTRY_T)NULL;
2676 P_STA_RECORD_T prCurrStaRec = (P_STA_RECORD_T)NULL;
2678 prStaRecOfClientList = &prP2pBssInfo->rStaRecOfClientList;
2680 LINK_FOR_EACH(prLinkEntry, prStaRecOfClientList) {
2681 prCurrStaRec = LINK_ENTRY(prLinkEntry, STA_RECORD_T, rLinkEntry);
2683 ASSERT(prCurrStaRec);
2685 if (EQUAL_MAC_ADDR(prCurrStaRec->aucMacAddr, prStaRec->aucMacAddr)) {
2687 /* Remove STA from client list. */
2688 LINK_REMOVE_KNOWN_ENTRY(prStaRecOfClientList, &prCurrStaRec->rLinkEntry);
2690 /* Indicate to Host. */
2691 kalP2PGOStationUpdate(prAdapter->prGlueInfo, prStaRec, FALSE);
2693 /* Indicate disconnect to Host. */
2694 p2pFuncDisconnect(prAdapter, prStaRec, FALSE, u2ReasonCode);
2701 case OP_MODE_P2P_DEVICE:
2711 } /* p2pFsmRunEventRxDisassociation */
2717 /*----------------------------------------------------------------------------*/
2719 * \brief This function is called when a probe request frame is received.
2721 * \param[in] prAdapter Pointer of ADAPTER_T
2723 * \return boolean value if probe response frame is accepted & need cancel scan request.
2725 /*----------------------------------------------------------------------------*/
2727 p2pFsmRunEventRxProbeResponseFrame (
2728 IN P_ADAPTER_T prAdapter,
2729 IN P_SW_RFB_T prSwRfb,
2730 IN P_BSS_DESC_T prBssDesc
2733 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2734 P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = (P_P2P_CONNECTION_SETTINGS_T)NULL;
2735 P_WLAN_MAC_MGMT_HEADER_T prMgtHdr = (P_WLAN_MAC_MGMT_HEADER_T)NULL;
2736 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2739 ASSERT_BREAK((prAdapter != NULL) && (prSwRfb != NULL) && (prBssDesc != NULL));
2741 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2742 prP2pConnSettings = prAdapter->rWifiVar.prP2PConnSettings;
2743 prP2pBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX];
2745 /* There is a connection request. */
2746 prMgtHdr = (P_WLAN_MAC_MGMT_HEADER_T)prSwRfb->pvHeader;
2751 } /* p2pFsmRunEventRxProbeResponseFrame */
2759 p2pFsmRunEventBeaconTimeout (
2760 IN P_ADAPTER_T prAdapter
2763 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2764 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2767 ASSERT_BREAK(prAdapter != NULL);
2769 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2770 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2772 DBGLOG(P2P, TRACE, ("p2pFsmRunEventBeaconTimeout: Beacon Timeout\n"));
2774 /* Only client mode would have beacon lost event. */
2775 ASSERT(prP2pBssInfo->eCurrentOPMode == OP_MODE_INFRASTRUCTURE);
2777 if (prP2pBssInfo->eConnectionState == PARAM_MEDIA_STATE_CONNECTED) {
2778 /* Indicate disconnect to Host. */
2779 kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo,
2783 REASON_CODE_DISASSOC_INACTIVITY);
2785 if (prP2pBssInfo->prStaRecOfAP != NULL) {
2786 p2pFuncDisconnect(prAdapter, prP2pBssInfo->prStaRecOfAP, FALSE, REASON_CODE_DISASSOC_INACTIVITY);
2792 } /* p2pFsmRunEventBeaconTimeout */
2803 /*----------------------------------------------------------------------------*/
2805 * @brief This function is used to generate P2P IE for Beacon frame.
2807 * @param[in] prMsduInfo Pointer to the composed MSDU_INFO_T.
2811 /*----------------------------------------------------------------------------*/
2813 p2pGenerateP2P_IEForAssocReq (
2814 IN P_ADAPTER_T prAdapter,
2815 IN P_MSDU_INFO_T prMsduInfo
2818 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
2819 P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL;
2822 ASSERT_BREAK((prAdapter != NULL) && (prMsduInfo != NULL));
2824 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
2826 prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex);
2828 if (IS_STA_P2P_TYPE(prStaRec)) {
2836 } /* end of p2pGenerateP2P_IEForAssocReq() */
2841 /*----------------------------------------------------------------------------*/
2843 * @brief This function is used to generate P2P IE for Probe Request frame.
2845 * @param[in] prMsduInfo Pointer to the composed MSDU_INFO_T.
2849 /*----------------------------------------------------------------------------*/
2851 p2pGenerateP2P_IEForProbeReq (
2852 IN P_ADAPTER_T prAdapter,
2853 IN PUINT_16 pu2Offset,
2855 IN UINT_16 u2BufSize
2865 } /* end of p2pGenerateP2P_IEForProbReq() */
2870 /*----------------------------------------------------------------------------*/
2872 * @brief This function is used to calculate P2P IE length for Beacon frame.
2874 * @param[in] eNetTypeIndex Specify which network
2875 * @param[in] prStaRec Pointer to the STA_RECORD_T
2877 * @return The length of P2P IE added
2879 /*----------------------------------------------------------------------------*/
2881 p2pCalculateP2P_IELenForProbeReq (
2882 IN P_ADAPTER_T prAdapter,
2883 IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex,
2884 IN P_STA_RECORD_T prStaRec
2888 if (eNetTypeIndex != NETWORK_TYPE_P2P_INDEX) {
2896 } /* end of p2pCalculateP2P_IELenForProbeReq() */
2902 /*----------------------------------------------------------------------------*/
2904 * @brief This function will indiate the Event of Tx Fail of AAA Module.
2906 * @param[in] prAdapter Pointer to the Adapter structure.
2907 * @param[in] prStaRec Pointer to the STA_RECORD_T
2911 /*----------------------------------------------------------------------------*/
2913 p2pRunEventAAATxFail (
2914 IN P_ADAPTER_T prAdapter,
2915 IN P_STA_RECORD_T prStaRec
2918 P_BSS_INFO_T prBssInfo;
2924 prBssInfo = &(prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex]);
2926 p2pFuncDisconnect(prAdapter, prStaRec, FALSE, REASON_CODE_UNSPECIFIED);
2928 bssRemoveStaRecFromClientList(prAdapter, prBssInfo, prStaRec);
2931 } /* p2pRunEventAAATxFail */
2934 /*----------------------------------------------------------------------------*/
2936 * @brief This function will indiate the Event of Successful Completion of AAA Module.
2938 * @param[in] prAdapter Pointer to the Adapter structure.
2939 * @param[in] prStaRec Pointer to the STA_RECORD_T
2943 /*----------------------------------------------------------------------------*/
2945 p2pRunEventAAAComplete (
2946 IN P_ADAPTER_T prAdapter,
2947 IN P_STA_RECORD_T prStaRec
2950 WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS;
2951 P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL;
2952 ENUM_PARAM_MEDIA_STATE_T eOriMediaState;
2955 ASSERT_BREAK((prAdapter != NULL) && (prStaRec != NULL));
2957 prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]);
2959 eOriMediaState = prP2pBssInfo->eConnectionState;
2961 bssRemoveStaRecFromClientList(prAdapter, prP2pBssInfo, prStaRec);
2963 if (prP2pBssInfo->rStaRecOfClientList.u4NumElem >= P2P_MAXIMUM_CLIENT_COUNT) {
2964 rStatus = WLAN_STATUS_RESOURCES;
2968 bssAddStaRecToClientList(prAdapter, prP2pBssInfo, prStaRec);
2970 prStaRec->u2AssocId = bssAssignAssocID(prStaRec);
2972 cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_3);
2974 p2pChangeMediaState(prAdapter, PARAM_MEDIA_STATE_CONNECTED);
2976 /* Update Connected state to FW. */
2977 if (eOriMediaState != prP2pBssInfo->eConnectionState) {
2978 nicUpdateBss(prAdapter, NETWORK_TYPE_P2P_INDEX);
2984 } /* p2pRunEventAAAComplete */
2987 /*----------------------------------------------------------------------------*/
2989 * @brief This function will indiate the Event of Successful Completion of AAA Module.
2991 * @param[in] prAdapter Pointer to the Adapter structure.
2992 * @param[in] prStaRec Pointer to the STA_RECORD_T
2996 /*----------------------------------------------------------------------------*/
2998 p2pRunEventAAASuccess (
2999 IN P_ADAPTER_T prAdapter,
3000 IN P_STA_RECORD_T prStaRec
3003 WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS;
3006 ASSERT_BREAK((prAdapter != NULL) && (prStaRec != NULL));
3008 /* Glue layer indication. */
3009 kalP2PGOStationUpdate(prAdapter->prGlueInfo, prStaRec, TRUE);
3014 } /* p2pRunEventAAASuccess */
3018 /*----------------------------------------------------------------------------*/
3026 /*----------------------------------------------------------------------------*/
3028 p2pRxPublicActionFrame (
3029 IN P_ADAPTER_T prAdapter,
3030 IN P_SW_RFB_T prSwRfb
3033 WLAN_STATUS rWlanStatus = WLAN_STATUS_SUCCESS;
3034 P_P2P_PUBLIC_ACTION_FRAME_T prPublicActionFrame = (P_P2P_PUBLIC_ACTION_FRAME_T)NULL;
3035 P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL;
3042 prPublicActionFrame = (P_P2P_PUBLIC_ACTION_FRAME_T)prSwRfb->pvHeader;
3043 prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
3045 DBGLOG(P2P, TRACE, ("RX Public Action Frame Token:%d.\n", prPublicActionFrame->ucDialogToken));
3047 if (prPublicActionFrame->ucCategory != CATEGORY_PUBLIC_ACTION) {
3051 switch (prPublicActionFrame->ucAction) {
3052 case ACTION_PUBLIC_WIFI_DIRECT:
3054 case ACTION_GAS_INITIAL_REQUEST:
3055 case ACTION_GAS_INITIAL_RESPONSE:
3056 case ACTION_GAS_COMEBACK_REQUEST:
3057 case ACTION_GAS_COMEBACK_RESPONSE:
3064 } /* p2pRxPublicActionFrame */
3070 IN P_ADAPTER_T prAdapter,
3071 IN P_SW_RFB_T prSwRfb
3074 WLAN_STATUS rWlanStatus = WLAN_STATUS_SUCCESS;
3075 P_P2P_ACTION_FRAME_T prP2pActionFrame = (P_P2P_ACTION_FRAME_T)NULL;
3076 UINT_8 aucOui[3] = VENDOR_OUI_WFA_SPECIFIC;
3079 ASSERT_BREAK((prAdapter != NULL) && (prSwRfb != NULL));
3081 prP2pActionFrame = (P_P2P_ACTION_FRAME_T)prSwRfb->pvHeader;
3083 if (prP2pActionFrame->ucCategory != CATEGORY_VENDOR_SPECIFIC_ACTION) {
3084 DBGLOG(P2P, TRACE, ("RX Action Frame but not vendor specific.\n"));
3089 if ((prP2pActionFrame->ucOuiType != VENDOR_OUI_TYPE_P2P) ||
3090 (prP2pActionFrame->aucOui[0] != aucOui[0]) ||
3091 (prP2pActionFrame->aucOui[1] != aucOui[1]) ||
3092 (prP2pActionFrame->aucOui[2] != aucOui[2])) {
3093 DBGLOG(P2P, TRACE, ("RX Vendor Specific Action Frame but not P2P Type or not WFA OUI.\n"));
3100 } /* p2pRxActionFrame */
3104 p2pProcessEvent_UpdateNOAParam (
3105 IN P_ADAPTER_T prAdapter,
3106 UINT_8 ucNetTypeIndex,
3107 P_EVENT_UPDATE_NOA_PARAMS_T prEventUpdateNoaParam
3110 P_BSS_INFO_T prBssInfo = (P_BSS_INFO_T)NULL;
3111 P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo;
3113 BOOLEAN fgNoaAttrExisted = FALSE;
3115 prBssInfo = &(prAdapter->rWifiVar.arBssInfo[ucNetTypeIndex]);
3116 prP2pSpecificBssInfo = prAdapter->rWifiVar.prP2pSpecificBssInfo;
3118 prP2pSpecificBssInfo->fgEnableOppPS = prEventUpdateNoaParam->fgEnableOppPS;
3119 prP2pSpecificBssInfo->u2CTWindow = prEventUpdateNoaParam->u2CTWindow;
3120 prP2pSpecificBssInfo->ucNoAIndex = prEventUpdateNoaParam->ucNoAIndex;
3121 prP2pSpecificBssInfo->ucNoATimingCount = prEventUpdateNoaParam->ucNoATimingCount;
3123 fgNoaAttrExisted |= prP2pSpecificBssInfo->fgEnableOppPS;
3126 ASSERT(prP2pSpecificBssInfo->ucNoATimingCount <= P2P_MAXIMUM_NOA_COUNT);
3128 for (i = 0; i < prP2pSpecificBssInfo->ucNoATimingCount; i++) {
3130 prP2pSpecificBssInfo->arNoATiming[i].fgIsInUse =
3131 prEventUpdateNoaParam->arEventNoaTiming[i].fgIsInUse;
3133 prP2pSpecificBssInfo->arNoATiming[i].ucCount =
3134 prEventUpdateNoaParam->arEventNoaTiming[i].ucCount;
3136 prP2pSpecificBssInfo->arNoATiming[i].u4Duration =
3137 prEventUpdateNoaParam->arEventNoaTiming[i].u4Duration;
3139 prP2pSpecificBssInfo->arNoATiming[i].u4Interval =
3140 prEventUpdateNoaParam->arEventNoaTiming[i].u4Interval;
3142 prP2pSpecificBssInfo->arNoATiming[i].u4StartTime =
3143 prEventUpdateNoaParam->arEventNoaTiming[i].u4StartTime;
3145 fgNoaAttrExisted |= prP2pSpecificBssInfo->arNoATiming[i].fgIsInUse;
3148 prP2pSpecificBssInfo->fgIsNoaAttrExisted = fgNoaAttrExisted;
3150 // update beacon content by the change
3151 bssUpdateBeaconContent(prAdapter, ucNetTypeIndex);
3154 #endif /* CFG_ENABLE_WIFI_DIRECT */