Commit | Line | Data |
---|---|---|
6fa3eb70 S |
1 | /* |
2 | ** $Id: //Department/DaVinci/TRUNK/WiFi_P2P_Driver/mgmt/p2p_fsm.c#61 $ | |
3 | */ | |
4 | ||
5 | /*! \file "p2p_fsm.c" | |
6 | \brief This file defines the FSM for P2P Module. | |
7 | ||
8 | This file defines the FSM for P2P Module. | |
9 | */ | |
10 | ||
11 | ||
12 | ||
13 | /* | |
14 | ** $Log: p2p_fsm.c $ | |
15 | ** | |
16 | ** 12 20 2012 yuche.tsai | |
17 | ** [ALPS00410124] [Rose][Free Test][KE][rlmUpdateParamsForAP]The device reboot automaticly and then "Fatal/Kernel" pops up during use data service.(Once) | |
18 | ** Fix possible NULL station record cause KE under AP mode. | |
19 | ** May due to variable uninitial. | |
20 | ** Review: http://mtksap20:8080/go?page=NewReview&reviewid=49970 | |
21 | ** | |
22 | ** 09 12 2012 wcpadmin | |
23 | ** [ALPS00276400] Remove MTK copyright and legal header on GPL/LGPL related packages | |
24 | ** . | |
25 | ** | |
26 | ** 08 31 2012 yuche.tsai | |
27 | ** [ALPS00349585] [6577JB][WiFi direct][KE]Establish p2p connection while both device have connected to AP previously,one device reboots automatically with KE | |
28 | ** Fix possible KE when concurrent & disconnect. | |
29 | ** | |
30 | ** 08 21 2012 yuche.tsai | |
31 | ** NULL | |
32 | ** fix disconnect indication. | |
33 | ** | |
34 | ** 08 16 2012 yuche.tsai | |
35 | ** NULL | |
36 | ** Fix compile warning. | |
37 | ** | |
38 | ** 08 14 2012 yuche.tsai | |
39 | ** NULL | |
40 | ** Fix p2p bug find on ALPS.JB trunk. | |
41 | ** | |
42 | ** 07 27 2012 yuche.tsai | |
43 | ** [ALPS00324337] [ALPS.JB][Hot-Spot] Driver update for Hot-Spot | |
44 | ** Update for driver unload KE issue. | |
45 | ** | |
46 | ** 07 26 2012 yuche.tsai | |
47 | ** [ALPS00324337] [ALPS.JB][Hot-Spot] Driver update for Hot-Spot | |
48 | ** Update driver code of ALPS.JB for hot-spot. | |
49 | ** | |
50 | ** 07 19 2012 yuche.tsai | |
51 | ** NULL | |
52 | ** Code update for JB. | |
53 | * | |
54 | * 07 17 2012 yuche.tsai | |
55 | * NULL | |
56 | * Compile no error before trial run. | |
57 | * | |
58 | * 07 05 2011 yuche.tsai | |
59 | * [WCXRP00000821] [Volunteer Patch][WiFi Direct][Driver] WiFi Direct Connection Speed Issue | |
60 | * Fix the compile flag of enhancement. | |
61 | * | |
62 | * 07 05 2011 yuche.tsai | |
63 | * [WCXRP00000808] [Volunteer Patch][MT6620][Driver/FW] Device discoverability issue fix | |
64 | * Change device discoverability methodology. From driver SCAN to FW lock channel. | |
65 | * | |
66 | * 07 05 2011 yuche.tsai | |
67 | * [WCXRP00000821] [Volunteer Patch][WiFi Direct][Driver] WiFi Direct Connection Speed Issue | |
68 | * Add wifi direct connection enhancement method I, II & VI. | |
69 | * | |
70 | * 07 05 2011 yuche.tsai | |
71 | * [WCXRP00000833] [Volunteer Patch][WiFi Direct][Driver] Service Discovery Frame RX Indicate Issue | |
72 | * Fix Service Discovery Race Condition Issue. | |
73 | * | |
74 | * 06 23 2011 cp.wu | |
75 | * [WCXRP00000798] [MT6620 Wi-Fi][Firmware] Follow-ups for WAPI frequency offset workaround in firmware SCN module | |
76 | * change parameter name from PeerAddr to BSSID | |
77 | * | |
78 | * 06 21 2011 yuche.tsai | |
79 | * [WCXRP00000799] [Volunteer Patch][MT6620][Driver] Connection Indication Twice Issue. | |
80 | * Fix an issue of accepting connection of GO. | |
81 | * | |
82 | * 06 21 2011 yuche.tsai | |
83 | * [WCXRP00000775] [Volunteer Patch][MT6620][Driver] Dynamic enable SD capability | |
84 | * Drop GAS frame when SD is not enabled. | |
85 | * | |
86 | * 06 20 2011 yuche.tsai | |
87 | * NULL | |
88 | * Fix compile error. | |
89 | * | |
90 | * 06 20 2011 yuche.tsai | |
91 | * [WCXRP00000799] [Volunteer Patch][MT6620][Driver] Connection Indication Twice Issue. | |
92 | * Fix connection indication twice issue. | |
93 | * | |
94 | * 06 20 2011 cp.wu | |
95 | * [WCXRP00000798] [MT6620 Wi-Fi][Firmware] Follow-ups for WAPI frequency offset workaround in firmware SCN module | |
96 | * 1. specify target's BSSID when requesting channel privilege. | |
97 | * 2. pass BSSID information to firmware domain | |
98 | * | |
99 | * 06 20 2011 yuche.tsai | |
100 | * [WCXRP00000795] [Volunteer Patch][MT6620][Driver] GO can not connect second device issue | |
101 | * Solve P2P GO can not formation with second device issue. | |
102 | * | |
103 | * 06 14 2011 yuche.tsai | |
104 | * NULL | |
105 | * Change disconnect feature. | |
106 | * | |
107 | * 06 10 2011 yuche.tsai | |
108 | * [WCXRP00000775] [Volunteer Patch][MT6620][Driver] Dynamic enable SD capability[WCXRP00000776] [Need Patch][MT6620][Driver] MT6620 response probe request of P2P device with P2P IE under Hot Spot mode. | |
109 | * 1. Dynamic enable SD capability after P2P supplicant ready. | |
110 | * 2. Avoid response probe respone with p2p IE when under hot spot mode. | |
111 | * | |
112 | * 06 07 2011 yuche.tsai | |
113 | * [WCXRP00000763] [Volunteer Patch][MT6620][Driver] RX Service Discovery Frame under AP mode Issue | |
114 | * Fix RX SD request under AP mode issue. | |
115 | * | |
116 | * 06 02 2011 cp.wu | |
117 | * [WCXRP00000681] [MT5931][Firmware] HIF code size reduction | |
118 | * eliminate unused parameters for SAA-FSM | |
119 | * | |
120 | * 05 26 2011 yuche.tsai | |
121 | * [WCXRP00000745] Support accepting connection after one Group Connection Lost. | |
122 | ||
123 | After Group Formation & lost connection, if MT6620 behave as: | |
124 | ||
125 | 1. GO: It would keep under GO state until been dissolved by supplicant. | |
126 | ||
127 | At this time, other P2P device can use join method to join this group. | |
128 | ||
129 | ||
130 | 2. GC: It would keep on searching target GO or target device until been dissolved by supplicant. | |
131 | ||
132 | At this time, it would ignore other P2P device formation request. | |
133 | ||
134 | ||
135 | -- | |
136 | ||
137 | Modification: Make driver to accept GO NEGO REQ at this time, to let user decide to accept new connection or not. | |
138 | ||
139 | * [Volunteer Patch][MT6620][Driver] | |
140 | * Driver would indicate connection request, if password ID is not ready but connection request is issued. | |
141 | * | |
142 | * 05 18 2011 yuche.tsai | |
143 | * [WCXRP00000728] [Volunteer Patch][MT6620][Driver] Service Discovery Request TX issue. | |
144 | * A solution for both connection request & IO control. | |
145 | * | |
146 | * 05 16 2011 yuche.tsai | |
147 | * [WCXRP00000728] [Volunteer Patch][MT6620][Driver] Service Discovery Request TX issue. | |
148 | * Fix SD request can not send out issue. | |
149 | * | |
150 | * 05 09 2011 terry.wu | |
151 | * [WCXRP00000711] [MT6620 Wi-Fi][Driver] Set Initial value of StaType in StaRec for Hotspot Client | |
152 | * Set initial value of StaType in StaRec for hotspot client. | |
153 | * | |
154 | * 05 04 2011 yuche.tsai | |
155 | * [WCXRP00000697] [Volunteer Patch][MT6620][Driver] | |
156 | * Bug fix for p2p descriptor is NULL if BSS descriptor is found first. | |
157 | * | |
158 | * 05 04 2011 yuche.tsai | |
159 | * NULL | |
160 | * Support partial persistent group function. | |
161 | * | |
162 | * 05 02 2011 yuche.tsai | |
163 | * [WCXRP00000693] [Volunteer Patch][MT6620][Driver] Clear Formation Flag after TX lifetime timeout. | |
164 | * Clear formation flag after formation timeout. | |
165 | * | |
166 | * 04 20 2011 yuche.tsai | |
167 | * [WCXRP00000668] [Volunteer Patch][MT6620][Driver] Possible race condition when add scan & query scan result at the same time. | |
168 | * Fix side effect while starting ATGO. | |
169 | * | |
170 | * 04 20 2011 yuche.tsai | |
171 | * NULL | |
172 | * Fix ASSERT issue in FW, side effect of last change. | |
173 | * | |
174 | * 04 19 2011 yuche.tsai | |
175 | * [WCXRP00000668] [Volunteer Patch][MT6620][Driver] Possible race condition when add scan & query scan result at the same time. | |
176 | * Workaround for multiple device connection, before invitation ready. | |
177 | * | |
178 | * 04 19 2011 yuche.tsai | |
179 | * [WCXRP00000665] [Wifi Direct][MT6620 E4] When use Ralink's dongle to establish wifi direct connection with PBC. But 6573 always not pop accept option to establish connection. | |
180 | * Support connection indication when GO NEGO REQ doesn't have configure method, instead it has PasswordID. | |
181 | * | |
182 | * 04 18 2011 yuche.tsai | |
183 | * NULL | |
184 | * Fix error. | |
185 | * | |
186 | * 04 14 2011 yuche.tsai | |
187 | * [WCXRP00000646] [Volunteer Patch][MT6620][FW/Driver] Sigma Test Modification for some test case. | |
188 | * Fix a connection issue. | |
189 | * | |
190 | * 04 14 2011 yuche.tsai | |
191 | * [WCXRP00000646] [Volunteer Patch][MT6620][FW/Driver] Sigma Test Modification for some test case. | |
192 | * Fix the channel issue of AP mode. | |
193 | * | |
194 | * 04 14 2011 yuche.tsai | |
195 | * [WCXRP00000646] [Volunteer Patch][MT6620][FW/Driver] Sigma Test Modification for some test case. | |
196 | * Connection flow refine for Sigma test. | |
197 | * | |
198 | * 04 09 2011 yuche.tsai | |
199 | * [WCXRP00000624] [Volunteer Patch][MT6620][Driver] Add device discoverability support for GO. | |
200 | * Fix Device discoverability related issue. | |
201 | * | |
202 | * 04 09 2011 yuche.tsai | |
203 | * [WCXRP00000624] [Volunteer Patch][MT6620][Driver] Add device discoverability support for GO. | |
204 | * Fix bug for Device Discoverability. | |
205 | * | |
206 | * 04 08 2011 yuche.tsai | |
207 | * [WCXRP00000624] [Volunteer Patch][MT6620][Driver] Add device discoverability support for GO. | |
208 | * Fix compile error. | |
209 | * | |
210 | * 04 08 2011 yuche.tsai | |
211 | * [WCXRP00000624] [Volunteer Patch][MT6620][Driver] Add device discoverability support for GO. | |
212 | * Add device discoverability support. | |
213 | * | |
214 | * 03 28 2011 yuche.tsai | |
215 | * NULL | |
216 | * Fix a possible issue for retry join when media status connected. | |
217 | * | |
218 | * 03 25 2011 yuche.tsai | |
219 | * NULL | |
220 | * Improve some error handleing. | |
221 | * | |
222 | * 03 24 2011 yuche.tsai | |
223 | * NULL | |
224 | * Assign AID before change STA_REC state to state 3. | |
225 | * | |
226 | * 03 23 2011 yuche.tsai | |
227 | * NULL | |
228 | * Fix Response Rate Issue when TX Auth Rsp Frame under P2P Mode. | |
229 | * | |
230 | * 03 23 2011 yuche.tsai | |
231 | * NULL | |
232 | * Fix issue of connection to one GC. | |
233 | * | |
234 | * 03 23 2011 yuche.tsai | |
235 | * NULL | |
236 | * Fix ASSERT issue when starting Hot-spot. | |
237 | * | |
238 | * 03 22 2011 yuche.tsai | |
239 | * NULL | |
240 | * When Target Information is not available, change to passive mode. | |
241 | * | |
242 | * 03 22 2011 yuche.tsai | |
243 | * NULL | |
244 | * Fix one connection issue while using Keypad to connect a GO. | |
245 | * | |
246 | * 03 22 2011 yuche.tsai | |
247 | * NULL | |
248 | * 1. Fix two issues that may cause kernel panic. | |
249 | * | |
250 | * 03 22 2011 yuche.tsai | |
251 | * NULL | |
252 | * Fix GC connect to other device issue. | |
253 | * | |
254 | * 03 22 2011 yuche.tsai | |
255 | * NULL | |
256 | * 1.Shorten the LISTEN interval. | |
257 | * 2. Fix IF address issue when we are GO | |
258 | * 3. Fix LISTEN channel issue. | |
259 | * | |
260 | * 03 22 2011 yuche.tsai | |
261 | * NULL | |
262 | * Modify formation policy setting. | |
263 | * | |
264 | * 03 21 2011 yuche.tsai | |
265 | * NULL | |
266 | * Solve Listen State doesn't response probe response issue. | |
267 | * | |
268 | * 03 21 2011 yuche.tsai | |
269 | * NULL | |
270 | * Change P2P Connection Request Flow. | |
271 | * | |
272 | * 03 19 2011 yuche.tsai | |
273 | * [WCXRP00000584] [Volunteer Patch][MT6620][Driver] Add beacon timeout support for WiFi Direct. | |
274 | * Add beacon timeout support. | |
275 | * | |
276 | * 03 19 2011 yuche.tsai | |
277 | * [WCXRP00000583] [Volunteer Patch][MT6620][Driver] P2P connection of the third peer issue | |
278 | * Indicate the correct Group SSID when join on Group. | |
279 | * | |
280 | * 03 19 2011 yuche.tsai | |
281 | * [WCXRP00000583] [Volunteer Patch][MT6620][Driver] P2P connection of the third peer issue | |
282 | * Support the third P2P device to join GO/GC group. | |
283 | * | |
284 | * 03 19 2011 yuche.tsai | |
285 | * [WCXRP00000581] [Volunteer Patch][MT6620][Driver] P2P IE in Assoc Req Issue | |
286 | * Append P2P IE in Assoc Req, so that GC can be discovered in probe response of GO. | |
287 | * | |
288 | * 03 18 2011 yuche.tsai | |
289 | * [WCXRP00000578] [Volunteer Patch][MT6620][Driver] Separate Connection Request from general IOCTL | |
290 | * Separate connection request from general IOCTL. | |
291 | * | |
292 | * 03 18 2011 yuche.tsai | |
293 | * [WCXRP00000574] [Volunteer Patch][MT6620][Driver] Modify P2P FSM Connection Flow | |
294 | * Modify connection flow after Group Formation Complete, or device connect to a GO. | |
295 | * Instead of request channel & connect directly, we use scan to allocate channel bandwidth & connect after RX BCN. | |
296 | * | |
297 | * 03 17 2011 yuche.tsai | |
298 | * NULL | |
299 | * When AIS is connect to an AP, Hot Spot would be enabled under fixed same channel. | |
300 | * | |
301 | * 03 17 2011 yuche.tsai | |
302 | * NULL | |
303 | * Solve the Group Info IE in Probe Response incorrect issue. | |
304 | * | |
305 | * 03 17 2011 yuche.tsai | |
306 | * NULL | |
307 | * Release Channel after Join Complete. | |
308 | * | |
309 | * 03 16 2011 wh.su | |
310 | * [WCXRP00000530] [MT6620 Wi-Fi] [Driver] skip doing p2pRunEventAAAComplete after send assoc response Tx Done | |
311 | * enable the protected while at P2P start GO, and skip some security check . | |
312 | * | |
313 | * 03 15 2011 yuche.tsai | |
314 | * [WCXRP00000560] [Volunteer Patch][MT6620][Driver] P2P Connection from UI using KEY/DISPLAY issue | |
315 | * Fix local configure method issue. | |
316 | * | |
317 | * 03 15 2011 yuche.tsai | |
318 | * [WCXRP00000560] [Volunteer Patch][MT6620][Driver] P2P Connection from UI using KEY/DISPLAY issue | |
319 | * Fix some configure method issue. | |
320 | * | |
321 | * 03 14 2011 yuche.tsai | |
322 | * NULL | |
323 | * . | |
324 | * | |
325 | * 03 14 2011 yuche.tsai | |
326 | * NULL | |
327 | * Fix password ID issue. | |
328 | * | |
329 | * 03 10 2011 yuche.tsai | |
330 | * NULL | |
331 | * Add P2P API. | |
332 | * | |
333 | * 03 08 2011 yuche.tsai | |
334 | * [WCXRP00000480] [Volunteer Patch][MT6620][Driver] WCS IE format issue[WCXRP00000509] [Volunteer Patch][MT6620][Driver] Kernal panic when remove p2p module. | |
335 | * . | |
336 | * | |
337 | * 03 07 2011 yuche.tsai | |
338 | * [WCXRP00000502] [Volunteer Patch][MT6620][Driver] Fix group ID issue when doing Group Formation. | |
339 | * . | |
340 | * | |
341 | * 03 07 2011 wh.su | |
342 | * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code | |
343 | * rename the define to anti_pviracy. | |
344 | * | |
345 | * 03 05 2011 wh.su | |
346 | * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code | |
347 | * add the code to get the check rsponse and indicate to app. | |
348 | * | |
349 | * 03 04 2011 wh.su | |
350 | * [WCXRP00000510] [MT6620 Wi-Fi] [Driver] Fixed the CTIA enter test mode issue | |
351 | * fixed the p2p action frame type check for device request indication. | |
352 | * | |
353 | * 03 02 2011 yuche.tsai | |
354 | * [WCXRP00000245] 1. Invitation Request/Response. | |
355 | 2. Provision Discovery Request/Response | |
356 | ||
357 | * Fix Service Discovery RX packet buffer pointer. | |
358 | * | |
359 | * 03 01 2011 yuche.tsai | |
360 | * [WCXRP00000501] [Volunteer Patch][MT6620][Driver] No common channel issue when doing GO formation | |
361 | * Update channel issue when doing GO formation.. | |
362 | * | |
363 | * 03 01 2011 yuche.tsai | |
364 | * [WCXRP00000245] 1. Invitation Request/Response. | |
365 | 2. Provision Discovery Request/Response | |
366 | ||
367 | * Update Service Discovery Related wlanoid function. | |
368 | * | |
369 | * 02 21 2011 yuche.tsai | |
370 | * [WCXRP00000481] [Volunteer Patch][MT6620][FW] Scan hang under concurrent case. | |
371 | * Fix all BE issue of WSC or P2P IE. | |
372 | * | |
373 | * 02 18 2011 wh.su | |
374 | * [WCXRP00000471] [MT6620 Wi-Fi][Driver] Add P2P Provison discovery append Config Method attribute at WSC IE | |
375 | * fixed the wsc config method mapping to driver used config method issue. | |
376 | * | |
377 | * 02 18 2011 yuche.tsai | |
378 | * [WCXRP00000479] [Volunteer Patch][MT6620][Driver] Probe Response of P2P using 11b rate. | |
379 | * Update basic rate to FW, after P2P is initialed. | |
380 | * | |
381 | * 02 18 2011 yuche.tsai | |
382 | * [WCXRP00000478] [Volunteer Patch][MT6620][Driver] Probe request frame during search phase do not contain P2P wildcard SSID. | |
383 | * Use P2P Wildcard SSID when scan type of P2P_WILDCARD_SSID is set. | |
384 | * | |
385 | * 02 18 2011 yuche.tsai | |
386 | * [WCXRP00000480] [Volunteer Patch][MT6620][Driver] WCS IE format issue | |
387 | * Fix WSC IE BE format issue. | |
388 | * | |
389 | * 02 17 2011 wh.su | |
390 | * [WCXRP00000471] [MT6620 Wi-Fi][Driver] Add P2P Provison discovery append Config Method attribute at WSC IE | |
391 | * append the WSC IE config method attribute at provision discovery request. | |
392 | * | |
393 | * 02 16 2011 wh.su | |
394 | * [WCXRP00000448] [MT6620 Wi-Fi][Driver] Fixed WSC IE not send out at probe request | |
395 | * fixed the probe request send out without WSC IE issue (at P2P). | |
396 | * | |
397 | * 02 16 2011 yuche.tsai | |
398 | * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode. | |
399 | * If two station connected to the Hot-Spot and one disconnect, FW would get into an infinite loop | |
400 | * | |
401 | * 02 15 2011 yuche.tsai | |
402 | * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode. | |
403 | * Fix re-connection issue after RX deauthentication. | |
404 | * | |
405 | * 02 15 2011 yuche.tsai | |
406 | * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode. | |
407 | * Fix conneciton issue after disconnect with AP. | |
408 | * | |
409 | * 02 12 2011 yuche.tsai | |
410 | * [WCXRP00000441] [Volunteer Patch][MT6620][Driver] BoW can not create desired station type when Hot Spot is enabled. | |
411 | * P2P Create Station Type according to Target BSS capability. | |
412 | * | |
413 | * 02 10 2011 yuche.tsai | |
414 | * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode. | |
415 | * Support Disassoc & Deauthentication for Hot-Spot. | |
416 | * | |
417 | * 02 09 2011 yuche.tsai | |
418 | * [WCXRP00000245] 1. Invitation Request/Response. | |
419 | 2. Provision Discovery Request/Response | |
420 | ||
421 | * Add Service Discovery Indication Related code. | |
422 | * | |
423 | * 02 09 2011 yuche.tsai | |
424 | * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode. | |
425 | * Add Support for MLME deauthentication for Hot-Spot. | |
426 | * | |
427 | * 02 09 2011 yuche.tsai | |
428 | * [WCXRP00000429] [Volunteer Patch][MT6620][Driver] Hot Spot Client Limit Issue | |
429 | * Fix Client Limit Issue. | |
430 | * | |
431 | * 02 08 2011 yuche.tsai | |
432 | * [WCXRP00000419] [Volunteer Patch][MT6620/MT5931][Driver] Provide function of disconnect to target station for AAA module. | |
433 | * Disconnect every station client when disolve on P2P group. | |
434 | * | |
435 | * 02 08 2011 yuche.tsai | |
436 | * [WCXRP00000245] 1. Invitation Request/Response. | |
437 | 2. Provision Discovery Request/Response | |
438 | ||
439 | * 1. Fix Service Disocvery Logical issue. | |
440 | * 2. Fix a NULL pointer access violation issue when sending deauthentication packet to a class error station. | |
441 | * | |
442 | * 02 08 2011 yuche.tsai | |
443 | * [WCXRP00000419] [Volunteer Patch][MT6620/MT5931][Driver] Provide function of disconnect to target station for AAA module. | |
444 | * Workaround of disable P2P network. | |
445 | * | |
446 | * 02 08 2011 yuche.tsai | |
447 | * [WCXRP00000421] [Volunteer Patch][MT6620][Driver] Fix incorrect SSID length Issue | |
448 | * 1. Fixed SSID wrong length issue. | |
449 | * 2. Under Hot Spot configuration, there won't be any P2P IE. | |
450 | * 3. Under Hot Spot configuration, P2P FSM won't get into LISTEN state first. | |
451 | * | |
452 | * 01 27 2011 yuche.tsai | |
453 | * [WCXRP00000399] [Volunteer Patch][MT6620/MT5931][Driver] Fix scan side effect after P2P module separate. | |
454 | * Modify Start GO flow. | |
455 | * | |
456 | * 01 27 2011 yuche.tsai | |
457 | * [WCXRP00000399] [Volunteer Patch][MT6620/MT5931][Driver] Fix scan side effect after P2P module separate. | |
458 | * Fix desire phy type set issue. | |
459 | * | |
460 | * 01 27 2011 yuche.tsai | |
461 | * [WCXRP00000399] [Volunteer Patch][MT6620/MT5931][Driver] Fix scan side effect after P2P module separate. | |
462 | * Add desire phy type set phase I. | |
463 | * | |
464 | * 01 26 2011 yuche.tsai | |
465 | * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record. | |
466 | * Fix P2P Disconnect Issue. | |
467 | * | |
468 | * 01 26 2011 yuche.tsai | |
469 | * [WCXRP00000245] 1. Invitation Request/Response. | |
470 | 2. Provision Discovery Request/Response | |
471 | ||
472 | * Add Service Discovery Function. | |
473 | * | |
474 | * 01 26 2011 cm.chang | |
475 | * [WCXRP00000395] [MT6620 Wi-Fi][Driver][FW] Search STA_REC with additional net type index argument | |
476 | * . | |
477 | * | |
478 | * 01 25 2011 yuche.tsai | |
479 | * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record. | |
480 | * Fix compile error when DBG is disabled. | |
481 | * | |
482 | * 01 25 2011 yuche.tsai | |
483 | * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record. | |
484 | * Change Station Type Definition. | |
485 | * | |
486 | * 01 19 2011 yuche.tsai | |
487 | * [WCXRP00000353] [Volunteer Patch][MT6620][Driver] Desired Non-HT Rate Set update when STA record is created under AP Mode. | |
488 | * Add P2P QoS Support. | |
489 | * | |
490 | * 01 19 2011 george.huang | |
491 | * [WCXRP00000355] [MT6620 Wi-Fi] Set WMM-PS related setting with qualifying AP capability | |
492 | * Null NOA attribute setting when no related parameters. | |
493 | * | |
494 | * 01 14 2011 yuche.tsai | |
495 | * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue | |
496 | * Modify AAA flow according to CM's comment. | |
497 | * | |
498 | * 01 13 2011 yuche.tsai | |
499 | * [WCXRP00000353] [Volunteer Patch][MT6620][Driver] Desired Non-HT Rate Set update when STA record is created under AP Mode. | |
500 | * Resolve Channel ZERO issue. (Uninitialized default channel) | |
501 | * | |
502 | * 01 13 2011 yuche.tsai | |
503 | * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue | |
504 | * Update P2P State Debug Message. | |
505 | * | |
506 | * 01 12 2011 yuche.tsai | |
507 | * [WCXRP00000353] [Volunteer Patch][MT6620][Driver] Desired Non-HT Rate Set update when STA record is created under AP Mode. | |
508 | * Fix bug when allocating message buffer. | |
509 | * | |
510 | * 01 12 2011 yuche.tsai | |
511 | * [WCXRP00000353] [Volunteer Patch][MT6620][Driver] Desired Non-HT Rate Set update when STA record is created under AP Mode. | |
512 | * Update Phy Type Set. When legacy client is connected, it can use 11b rate, | |
513 | * but if the P2P device is connected, 11b rate is not allowed. | |
514 | * | |
515 | * 01 12 2011 yuche.tsai | |
516 | * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue | |
517 | * 1. Modify Channel Acquire Time of AP mode from 5s to 1s. | |
518 | * 2. Call cnmP2pIsPermit() before active P2P network. | |
519 | * 3. Add channel selection support for AP mode. | |
520 | * | |
521 | * 01 12 2011 yuche.tsai | |
522 | * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue | |
523 | * Fix Bug of reference to NULL pointer. | |
524 | * | |
525 | * 01 12 2011 yuche.tsai | |
526 | * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue | |
527 | * Modify some behavior of AP mode. | |
528 | * | |
529 | * 01 12 2011 yuche.tsai | |
530 | * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue | |
531 | * Fix bug of wrong pointer check. | |
532 | * | |
533 | * 01 12 2011 yuche.tsai | |
534 | * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue | |
535 | * Fix Compile Error. | |
536 | * | |
537 | * 01 11 2011 yuche.tsai | |
538 | * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue | |
539 | * Add station record into client list before change it state from STATE_2 to STATE_3. | |
540 | * | |
541 | * 01 05 2011 yuche.tsai | |
542 | * [WCXRP00000345] [MT6620][Volunteer Patch] P2P may issue a SSID specified scan request, but the SSID length is still invalid. | |
543 | * Specify SSID Type when issue a scan request. | |
544 | * | |
545 | * 01 05 2011 cp.wu | |
546 | * [WCXRP00000338] [MT6620 Wi-Fi][Driver] Separate kalMemAlloc into kmalloc and vmalloc implementations to ease physically continous memory demands | |
547 | * correct typo | |
548 | * | |
549 | * 01 05 2011 george.huang | |
550 | * [WCXRP00000343] [MT6620 Wi-Fi] Add TSF reset path for concurrent operation | |
551 | * modify NOA update path for preventing assertion false alarm. | |
552 | * | |
553 | * 01 04 2011 cp.wu | |
554 | * [WCXRP00000338] [MT6620 Wi-Fi][Driver] Separate kalMemAlloc into kmalloc and vmalloc implementations to ease physically continous memory demands | |
555 | * separate kalMemAlloc() into virtually-continous and physically-continous type to ease slab system pressure | |
556 | * | |
557 | * 01 03 2011 wh.su | |
558 | * [WCXRP00000326] [MT6620][Wi-Fi][Driver] check in the binary format gl_sec.o.new instead of use change type!!! | |
559 | * let the p2p ap mode acept a legacy device join. | |
560 | * | |
561 | * 12 22 2010 yuche.tsai | |
562 | * [WCXRP00000245] 1. Invitation Request/Response. | |
563 | 2. Provision Discovery Request/Response | |
564 | ||
565 | * Fix Compile Error. | |
566 | * | |
567 | * 12 15 2010 yuche.tsai | |
568 | * [WCXRP00000245] 1. Invitation Request/Response. | |
569 | 2. Provision Discovery Request/Response | |
570 | ||
571 | * Refine Connection Flow. | |
572 | * | |
573 | * 12 08 2010 yuche.tsai | |
574 | * [WCXRP00000245] [MT6620][Driver] Invitation & Provision Discovery Feature Check-in | |
575 | * [WCXRP000000245][MT6620][Driver] Invitation Request Feature Add | |
576 | * | |
577 | * 12 08 2010 yuche.tsai | |
578 | * [WCXRP00000244] [MT6620][Driver] Add station record type for each client when in AP mode. | |
579 | * Change STA Type under AP mode. We would tell if client is a P2P device or a legacy client by checking the P2P IE in assoc req frame. | |
580 | * | |
581 | * 12 07 2010 cm.chang | |
582 | * [WCXRP00000239] MT6620 Wi-Fi][Driver][FW] Merge concurrent branch back to maintrunk | |
583 | * The order of invoking nicUpdateBss() and rlm functions | |
584 | * | |
585 | * 12 02 2010 yuche.tsai | |
586 | * NULL | |
587 | * Update P2P Connection Policy for Invitation. | |
588 | * | |
589 | * 12 02 2010 yuche.tsai | |
590 | * NULL | |
591 | * Update P2P Connection Policy for Invitation & Provision Discovery. | |
592 | * | |
593 | * 11 30 2010 yuche.tsai | |
594 | * NULL | |
595 | * Invitation & Provision Discovery Indication. | |
596 | * | |
597 | * 11 30 2010 yuche.tsai | |
598 | * NULL | |
599 | * Update Configure Method indication & selection for Provision Discovery & GO_NEGO_REQ | |
600 | * | |
601 | * 11 30 2010 yuche.tsai | |
602 | * NULL | |
603 | * Update RCIP value when RX assoc request frame. | |
604 | * | |
605 | * 11 29 2010 yuche.tsai | |
606 | * NULL | |
607 | * Update P2P related function for INVITATION & PROVISION DISCOVERY. | |
608 | * | |
609 | * 11 26 2010 george.huang | |
610 | * [WCXRP00000152] [MT6620 Wi-Fi] AP mode power saving function | |
611 | * Update P2P PS for NOA function. | |
612 | * | |
613 | * 11 25 2010 yuche.tsai | |
614 | * NULL | |
615 | * Update Code for Invitation Related Function. | |
616 | * | |
617 | * 11 17 2010 wh.su | |
618 | * [WCXRP00000164] [MT6620 Wi-Fi][Driver] Support the p2p random SSID[WCXRP00000179] [MT6620 Wi-Fi][FW] Set the Tx lowest rate at wlan table for normal operation | |
619 | * fixed some ASSERT check. | |
620 | * | |
621 | * 11 05 2010 wh.su | |
622 | * [WCXRP00000164] [MT6620 Wi-Fi][Driver] Support the p2p random SSID | |
623 | * fixed the p2p role code error. | |
624 | * | |
625 | * 11 04 2010 wh.su | |
626 | * [WCXRP00000164] [MT6620 Wi-Fi][Driver] Support the p2p random SSID | |
627 | * adding the p2p random ssid support. | |
628 | * | |
629 | * 10 20 2010 wh.su | |
630 | * [WCXRP00000124] [MT6620 Wi-Fi] [Driver] Support the dissolve P2P Group | |
631 | * fixed the ASSERT check error | |
632 | * | |
633 | * 10 20 2010 wh.su | |
634 | * [WCXRP00000124] [MT6620 Wi-Fi] [Driver] Support the dissolve P2P Group | |
635 | * Add the code to support disconnect p2p group | |
636 | * | |
637 | * 10 19 2010 wh.su | |
638 | * [WCXRP00000085] [MT6620 Wif-Fi] [Driver] update the modified p2p state machine[WCXRP00000102] [MT6620 Wi-Fi] [FW] Add a compiling flag and code for support Direct GO at Android | |
639 | * fixed the compiling error. | |
640 | * | |
641 | * 10 14 2010 wh.su | |
642 | * [WCXRP00000102] [MT6620 Wi-Fi] [FW] Add a compiling flag and code for support Direct GO at Android | |
643 | * adding a code to support Direct GO with a compiling flag . | |
644 | * | |
645 | * 10 08 2010 cp.wu | |
646 | * [WCXRP00000087] [MT6620 Wi-Fi][Driver] Cannot connect to 5GHz AP, driver will cause FW assert. | |
647 | * correct erroneous logic: specifying eBand with incompatible eSco | |
648 | * | |
649 | * 10 08 2010 wh.su | |
650 | * [WCXRP00000085] [MT6620 Wif-Fi] [Driver] update the modified p2p state machine | |
651 | * fixed the compiling error. | |
652 | * | |
653 | * 10 08 2010 wh.su | |
654 | * [WCXRP00000085] [MT6620 Wif-Fi] [Driver] update the modified p2p state machine | |
655 | * update the frog's new p2p state machine. | |
656 | * | |
657 | * 09 10 2010 wh.su | |
658 | * NULL | |
659 | * fixed the compiling error at WinXP. | |
660 | * | |
661 | * 09 07 2010 yuche.tsai | |
662 | * NULL | |
663 | * Reset Common IE Buffer of P2P INFO when scan request is issued. | |
664 | * If an action frame other than public action frame is received, return direcly. | |
665 | * | |
666 | * 09 07 2010 wh.su | |
667 | * NULL | |
668 | * adding the code for beacon/probe req/ probe rsp wsc ie at p2p. | |
669 | * | |
670 | * 09 06 2010 wh.su | |
671 | * NULL | |
672 | * let the p2p can set the privacy bit at beacon and rsn ie at assoc req at key handshake state. | |
673 | * | |
674 | * 09 03 2010 kevin.huang | |
675 | * NULL | |
676 | * Refine #include sequence and solve recursive/nested #include issue | |
677 | * | |
678 | * 08 26 2010 yuche.tsai | |
679 | * NULL | |
680 | * Add P2P Connection Abort Event Message handler. | |
681 | * | |
682 | * 08 24 2010 cm.chang | |
683 | * NULL | |
684 | * Support RLM initail channel of Ad-hoc, P2P and BOW | |
685 | * | |
686 | * 08 23 2010 yuche.tsai | |
687 | * NULL | |
688 | * 1. Fix Interface Address from GO Nego Req/Rsp is not correct. | |
689 | * 2. Fix GO mode does not change media state after station connected. | |
690 | * 3. Fix STA don't response probe request when there is a connection request. | |
691 | * | |
692 | * 08 20 2010 cm.chang | |
693 | * NULL | |
694 | * Migrate RLM code to host from FW | |
695 | * | |
696 | * 08 20 2010 kevin.huang | |
697 | * NULL | |
698 | * Modify AAA Module for changing STA STATE 3 at p2p/bowRunEventAAAComplete() | |
699 | * | |
700 | * 08 20 2010 yuche.tsai | |
701 | * NULL | |
702 | * Add Glue Layer indication. | |
703 | * | |
704 | * 08 17 2010 yuche.tsai | |
705 | * NULL | |
706 | * Fix compile warning under Linux. | |
707 | * | |
708 | * 08 17 2010 yuche.tsai | |
709 | * NULL | |
710 | * Fix some P2P FSM bug. | |
711 | * | |
712 | * 08 16 2010 yuche.tsai | |
713 | * NULL | |
714 | * Add random Interface Address Generation support. | |
715 | * | |
716 | * 08 16 2010 yuche.tsai | |
717 | * NULL | |
718 | * Fix some P2P FSM bug. | |
719 | * | |
720 | * 08 16 2010 yuche.tsai | |
721 | * NULL | |
722 | * Update P2P FSM code for GO Nego. | |
723 | * | |
724 | * 08 16 2010 kevin.huang | |
725 | * NULL | |
726 | * Refine AAA functions | |
727 | * | |
728 | * 08 12 2010 kevin.huang | |
729 | * NULL | |
730 | * Refine bssProcessProbeRequest() and bssSendBeaconProbeResponse() | |
731 | * | |
732 | * 08 12 2010 yuche.tsai | |
733 | * NULL | |
734 | * Join complete indication. | |
735 | * | |
736 | * 08 11 2010 yuche.tsai | |
737 | * NULL | |
738 | * Add two boolean in connection request. | |
739 | * Based on these two boolean value, P2P FSM should | |
740 | * decide to do invitation or group formation or start a GO directly. | |
741 | * | |
742 | * 08 11 2010 yuche.tsai | |
743 | * NULL | |
744 | * Update P2P FSM, currently P2P Device Discovery is verified. | |
745 | * | |
746 | * 08 05 2010 yuche.tsai | |
747 | * NULL | |
748 | * Update P2P FSM for group formation. | |
749 | * | |
750 | * 08 03 2010 george.huang | |
751 | * NULL | |
752 | * handle event for updating NOA parameters indicated from FW | |
753 | * | |
754 | * 08 03 2010 cp.wu | |
755 | * NULL | |
756 | * limit build always needs spin-lock declaration. | |
757 | * | |
758 | * 08 02 2010 yuche.tsai | |
759 | * NULL | |
760 | * P2P Group Negotiation Code Check in. | |
761 | * | |
762 | * 07 26 2010 yuche.tsai | |
763 | * | |
764 | * Add P2P FSM code check in. | |
765 | * | |
766 | * 07 21 2010 yuche.tsai | |
767 | * | |
768 | * Add P2P Scan & Scan Result Parsing & Saving. | |
769 | * | |
770 | * 07 19 2010 yuche.tsai | |
771 | * | |
772 | * Update P2P FSM. | |
773 | * | |
774 | * 07 09 2010 george.huang | |
775 | * | |
776 | * [WPD00001556] Migrate PM variables from FW to driver: for composing QoS Info | |
777 | * | |
778 | * 07 08 2010 cp.wu | |
779 | * | |
780 | * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. | |
781 | * | |
782 | * 06 21 2010 yuche.tsai | |
783 | * [WPD00003839][MT6620 5931][P2P] Feature migration | |
784 | * Fix compile error while enable WIFI_DIRECT support. | |
785 | * | |
786 | * 06 21 2010 yuche.tsai | |
787 | * [WPD00003839][MT6620 5931][P2P] Feature migration | |
788 | * Update P2P Function call. | |
789 | * | |
790 | * 06 17 2010 yuche.tsai | |
791 | * [WPD00003839][MT6620 5931][P2P] Feature migration | |
792 | * First draft for migration P2P FSM from FW to Driver. | |
793 | * | |
794 | * 04 19 2010 kevin.huang | |
795 | * [BORA00000714][WIFISYS][New Feature]Beacon Timeout Support | |
796 | * Add Beacon Timeout Support and will send Null frame to diagnose connection | |
797 | * | |
798 | * 03 18 2010 kevin.huang | |
799 | * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support | |
800 | * Rename CFG flag for P2P | |
801 | * | |
802 | * 02 26 2010 kevin.huang | |
803 | * [BORA00000603][WIFISYS] [New Feature] AAA Module Support | |
804 | * Add code to test P2P GO | |
805 | * | |
806 | * 02 23 2010 kevin.huang | |
807 | * [BORA00000603][WIFISYS] [New Feature] AAA Module Support | |
808 | * Add Wi-Fi Direct SSID and P2P GO Test Mode | |
809 | * | |
810 | * 02 05 2010 kevin.huang | |
811 | * [BORA00000603][WIFISYS] [New Feature] AAA Module Support | |
812 | * Modify code due to BAND_24G define was changed | |
813 | * | |
814 | * 02 05 2010 kevin.huang | |
815 | * [BORA00000603][WIFISYS] [New Feature] AAA Module Support | |
816 | * Revise data structure to share the same BSS_INFO_T for avoiding coding error | |
817 | * | |
818 | * 02 04 2010 kevin.huang | |
819 | * [BORA00000603][WIFISYS] [New Feature] AAA Module Support | |
820 | * Add AAA Module Support, Revise Net Type to Net Type Index for array lookup | |
821 | */ | |
822 | ||
823 | /******************************************************************************* | |
824 | * C O M P I L E R F L A G S | |
825 | ******************************************************************************** | |
826 | */ | |
827 | ||
828 | /******************************************************************************* | |
829 | * E X T E R N A L R E F E R E N C E S | |
830 | ******************************************************************************** | |
831 | */ | |
832 | #include "precomp.h" | |
833 | ||
834 | #if CFG_ENABLE_WIFI_DIRECT | |
835 | ||
836 | /******************************************************************************* | |
837 | * C O N S T A N T S | |
838 | ******************************************************************************** | |
839 | */ | |
840 | ||
841 | /******************************************************************************* | |
842 | * D A T A T Y P E S | |
843 | ******************************************************************************** | |
844 | */ | |
845 | ||
846 | /******************************************************************************* | |
847 | * P U B L I C D A T A | |
848 | ******************************************************************************** | |
849 | */ | |
850 | ||
851 | /******************************************************************************* | |
852 | * P R I V A T E D A T A | |
853 | ******************************************************************************** | |
854 | */ | |
855 | #if DBG | |
856 | /*lint -save -e64 Type mismatch */ | |
857 | static PUINT_8 apucDebugP2pState[P2P_STATE_NUM] = { | |
858 | (PUINT_8)DISP_STRING("P2P_STATE_IDLE"), | |
859 | (PUINT_8)DISP_STRING("P2P_STATE_SCAN"), | |
860 | (PUINT_8)DISP_STRING("P2P_STATE_AP_CHANNEL_DETECT"), | |
861 | (PUINT_8)DISP_STRING("P2P_STATE_REQING_CHANNEL"), | |
862 | (PUINT_8)DISP_STRING("P2P_STATE_CHNL_ON_HAND"), | |
863 | (PUINT_8)DISP_STRING("P2P_STATE_GC_JOIN") | |
864 | }; | |
865 | /*lint -restore */ | |
866 | #else | |
867 | static UINT_8 apucDebugP2pState[P2P_STATE_NUM] = { | |
868 | P2P_STATE_IDLE, | |
869 | P2P_STATE_SCAN, | |
870 | P2P_STATE_AP_CHANNEL_DETECT, | |
871 | P2P_STATE_REQING_CHANNEL, | |
872 | P2P_STATE_CHNL_ON_HAND, | |
873 | P2P_STATE_GC_JOIN | |
874 | }; | |
875 | ||
876 | #endif /* DBG */ | |
877 | ||
878 | ||
879 | /******************************************************************************* | |
880 | * M A C R O S | |
881 | ******************************************************************************** | |
882 | */ | |
883 | ||
884 | /******************************************************************************* | |
885 | * F U N C T I O N D E C L A R A T I O N S | |
886 | ******************************************************************************** | |
887 | */ | |
888 | ||
889 | /******************************************************************************* | |
890 | * F U N C T I O N S | |
891 | ******************************************************************************** | |
892 | */ | |
893 | ||
894 | /* p2pStateXXX : Processing P2P FSM related action. | |
895 | * p2pFSMXXX : Control P2P FSM flow. | |
896 | * p2pFuncXXX : Function for doing one thing. | |
897 | */ | |
898 | VOID | |
899 | p2pFsmInit ( | |
900 | IN P_ADAPTER_T prAdapter | |
901 | ) | |
902 | { | |
903 | ||
904 | P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; | |
905 | P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; | |
906 | ||
907 | do { | |
908 | ASSERT_BREAK(prAdapter != NULL); | |
909 | ||
910 | prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; | |
911 | prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); | |
912 | ||
913 | ASSERT_BREAK(prP2pFsmInfo != NULL); | |
914 | ||
915 | LINK_INITIALIZE(&(prP2pFsmInfo->rMsgEventQueue)); | |
916 | LINK_INITIALIZE(&(prP2pBssInfo->rStaRecOfClientList)); | |
917 | ||
918 | ||
919 | prP2pFsmInfo->eCurrentState = prP2pFsmInfo->ePreviousState = P2P_STATE_IDLE; | |
920 | prP2pFsmInfo->prTargetBss = NULL; | |
921 | prP2pFsmInfo->fgIsWPSMode = 0; | |
922 | ||
923 | cnmTimerInitTimer(prAdapter, | |
924 | &(prAdapter->rP2pFsmTimeoutTimer), | |
925 | (PFN_MGMT_TIMEOUT_FUNC)p2pFsmRunEventFsmTimeout, | |
926 | (ULONG)prP2pFsmInfo); | |
927 | ||
928 | //4 <2> Initiate BSS_INFO_T - common part | |
929 | BSS_INFO_INIT(prAdapter, NETWORK_TYPE_P2P_INDEX); | |
930 | ||
931 | ||
932 | //4 <2.1> Initiate BSS_INFO_T - Setup HW ID | |
933 | prP2pBssInfo->ucConfigAdHocAPMode = AP_MODE_11G_P2P; | |
934 | prP2pBssInfo->ucHwDefaultFixedRateCode = RATE_OFDM_6M; | |
935 | ||
936 | ||
937 | prP2pBssInfo->ucNonHTBasicPhyType = (UINT_8) | |
938 | rNonHTApModeAttributes[prP2pBssInfo->ucConfigAdHocAPMode].ePhyTypeIndex; | |
939 | prP2pBssInfo->u2BSSBasicRateSet = | |
940 | rNonHTApModeAttributes[prP2pBssInfo->ucConfigAdHocAPMode].u2BSSBasicRateSet; | |
941 | ||
942 | prP2pBssInfo->u2OperationalRateSet = | |
943 | rNonHTPhyAttributes[prP2pBssInfo->ucNonHTBasicPhyType].u2SupportedRateSet; | |
944 | ||
945 | rateGetDataRatesFromRateSet(prP2pBssInfo->u2OperationalRateSet, | |
946 | prP2pBssInfo->u2BSSBasicRateSet, | |
947 | prP2pBssInfo->aucAllSupportedRates, | |
948 | &prP2pBssInfo->ucAllSupportedRatesLen); | |
949 | ||
950 | prP2pBssInfo->prBeacon = cnmMgtPktAlloc(prAdapter, | |
951 | OFFSET_OF(WLAN_BEACON_FRAME_T, aucInfoElem[0]) + MAX_IE_LENGTH); | |
952 | ||
953 | if (prP2pBssInfo->prBeacon) { | |
954 | prP2pBssInfo->prBeacon->eSrc = TX_PACKET_MGMT; | |
955 | prP2pBssInfo->prBeacon->ucStaRecIndex = 0xFF; /* NULL STA_REC */ | |
956 | prP2pBssInfo->prBeacon->ucNetworkType = NETWORK_TYPE_P2P_INDEX; | |
957 | } | |
958 | else { | |
959 | /* Out of memory. */ | |
960 | ASSERT(FALSE); | |
961 | } | |
962 | ||
963 | prP2pBssInfo->eCurrentOPMode = OP_MODE_NUM; | |
964 | ||
965 | prP2pBssInfo->rPmProfSetupInfo.ucBmpDeliveryAC = PM_UAPSD_ALL; | |
966 | prP2pBssInfo->rPmProfSetupInfo.ucBmpTriggerAC = PM_UAPSD_ALL; | |
967 | prP2pBssInfo->rPmProfSetupInfo.ucUapsdSp = WMM_MAX_SP_LENGTH_2; | |
968 | prP2pBssInfo->ucPrimaryChannel = P2P_DEFAULT_LISTEN_CHANNEL; | |
969 | prP2pBssInfo->eBand = BAND_2G4; | |
970 | prP2pBssInfo->eBssSCO = CHNL_EXT_SCN; | |
971 | ||
972 | if (prAdapter->rWifiVar.fgSupportQoS) { | |
973 | prP2pBssInfo->fgIsQBSS = TRUE; | |
974 | } | |
975 | else { | |
976 | prP2pBssInfo->fgIsQBSS = FALSE; | |
977 | } | |
978 | ||
979 | SET_NET_PWR_STATE_IDLE(prAdapter, NETWORK_TYPE_P2P_INDEX); | |
980 | ||
981 | p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE); | |
982 | ||
983 | } while (FALSE); | |
984 | ||
985 | return; | |
986 | } /* p2pFsmInit */ | |
987 | ||
988 | ||
989 | ||
990 | ||
991 | ||
992 | /*----------------------------------------------------------------------------*/ | |
993 | /*! | |
994 | * @brief The function is used to uninitialize the value in P2P_FSM_INFO_T for | |
995 | * P2P FSM operation | |
996 | * | |
997 | * @param (none) | |
998 | * | |
999 | * @return (none) | |
1000 | */ | |
1001 | /*----------------------------------------------------------------------------*/ | |
1002 | VOID | |
1003 | p2pFsmUninit ( | |
1004 | IN P_ADAPTER_T prAdapter | |
1005 | ) | |
1006 | { | |
1007 | P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; | |
1008 | P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; | |
1009 | ||
1010 | do { | |
1011 | ASSERT_BREAK(prAdapter != NULL); | |
1012 | ||
1013 | DEBUGFUNC("p2pFsmUninit()"); | |
1014 | DBGLOG(P2P, INFO, ("->p2pFsmUninit()\n")); | |
1015 | ||
1016 | prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; | |
1017 | prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); | |
1018 | ||
1019 | p2pFuncSwitchOPMode(prAdapter, prP2pBssInfo, OP_MODE_P2P_DEVICE, TRUE); | |
1020 | ||
1021 | p2pFsmRunEventAbort(prAdapter, prP2pFsmInfo); | |
1022 | ||
1023 | p2pStateAbort_IDLE(prAdapter, prP2pFsmInfo, P2P_STATE_NUM); | |
1024 | ||
1025 | UNSET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX); | |
1026 | ||
1027 | wlanAcquirePowerControl(prAdapter); | |
1028 | ||
1029 | /* Release all pending CMD queue. */ | |
1030 | DBGLOG(P2P, TRACE, ("p2pFsmUninit: wlanProcessCommandQueue, num of element:%d\n", | |
1031 | (UINT_32)prAdapter->prGlueInfo->rCmdQueue.u4NumElem)); | |
1032 | wlanProcessCommandQueue(prAdapter, &prAdapter->prGlueInfo->rCmdQueue); | |
1033 | ||
1034 | wlanReleasePowerControl(prAdapter); | |
1035 | ||
1036 | /* Release pending mgmt frame, | |
1037 | * mgmt frame may be pending by CMD without resource. | |
1038 | */ | |
1039 | kalClearMgmtFramesByNetType(prAdapter->prGlueInfo, NETWORK_TYPE_P2P_INDEX); | |
1040 | ||
1041 | /* Clear PendingCmdQue*/ | |
1042 | wlanReleasePendingCMDbyNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX); | |
1043 | ||
1044 | if (prP2pBssInfo->prBeacon) { | |
1045 | cnmMgtPktFree(prAdapter, prP2pBssInfo->prBeacon); | |
1046 | prP2pBssInfo->prBeacon = NULL; | |
1047 | } | |
1048 | ||
1049 | } while (FALSE); | |
1050 | ||
1051 | return; | |
1052 | ||
1053 | } /* end of p2pFsmUninit() */ | |
1054 | ||
1055 | VOID | |
1056 | p2pFsmStateTransition ( | |
1057 | IN P_ADAPTER_T prAdapter, | |
1058 | IN P_P2P_FSM_INFO_T prP2pFsmInfo, | |
1059 | IN ENUM_P2P_STATE_T eNextState | |
1060 | ) | |
1061 | { | |
1062 | BOOLEAN fgIsTransOut = (BOOLEAN)FALSE; | |
1063 | P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; | |
1064 | P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo = (P_P2P_SPECIFIC_BSS_INFO_T)NULL; | |
1065 | ||
1066 | do { | |
1067 | ASSERT_BREAK((prAdapter != NULL) && (prP2pFsmInfo != NULL)); | |
1068 | ||
1069 | prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); | |
1070 | prP2pSpecificBssInfo = prAdapter->rWifiVar.prP2pSpecificBssInfo; | |
1071 | ||
1072 | if (!IS_BSS_ACTIVE(prP2pBssInfo)) { | |
1073 | if (!cnmP2PIsPermitted(prAdapter)) { | |
1074 | return; | |
1075 | } | |
1076 | ||
1077 | SET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX); | |
1078 | nicActivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX); | |
1079 | } | |
1080 | ||
1081 | fgIsTransOut = fgIsTransOut?FALSE:TRUE; | |
1082 | ||
1083 | if (!fgIsTransOut) { | |
1084 | #if DBG | |
1085 | DBGLOG(P2P, STATE, ("TRANSITION: [%s] -> [%s]\n", | |
1086 | apucDebugP2pState[prP2pFsmInfo->eCurrentState], | |
1087 | apucDebugP2pState[eNextState])); | |
1088 | #else | |
1089 | DBGLOG(P2P, STATE, ("[%d] TRANSITION: [%d] -> [%d]\n", | |
1090 | DBG_P2P_IDX, apucDebugP2pState[prP2pFsmInfo->eCurrentState], | |
1091 | apucDebugP2pState[eNextState])); | |
1092 | #endif | |
1093 | ||
1094 | /* Transition into current state. */ | |
1095 | prP2pFsmInfo->ePreviousState = prP2pFsmInfo->eCurrentState; | |
1096 | prP2pFsmInfo->eCurrentState = eNextState; | |
1097 | } | |
1098 | ||
1099 | ||
1100 | switch (prP2pFsmInfo->eCurrentState) { | |
1101 | case P2P_STATE_IDLE: | |
1102 | if (fgIsTransOut) { | |
1103 | ||
1104 | p2pStateAbort_IDLE(prAdapter, | |
1105 | prP2pFsmInfo, | |
1106 | eNextState); | |
1107 | } | |
1108 | else { | |
1109 | fgIsTransOut = p2pStateInit_IDLE(prAdapter, | |
1110 | prP2pFsmInfo, | |
1111 | prP2pBssInfo, | |
1112 | &eNextState); | |
1113 | } | |
1114 | ||
1115 | break; | |
1116 | case P2P_STATE_SCAN: | |
1117 | if (fgIsTransOut) { | |
1118 | ||
1119 | // Scan done / scan canceled. | |
1120 | p2pStateAbort_SCAN(prAdapter, prP2pFsmInfo, eNextState); | |
1121 | } | |
1122 | else { | |
1123 | // Initial scan request. | |
1124 | p2pStateInit_SCAN(prAdapter, prP2pFsmInfo); | |
1125 | } | |
1126 | ||
1127 | break; | |
1128 | case P2P_STATE_AP_CHANNEL_DETECT: | |
1129 | if (fgIsTransOut) { | |
1130 | // Scan done | |
1131 | // Get sparse channel result. | |
1132 | p2pStateAbort_AP_CHANNEL_DETECT(prAdapter, | |
1133 | prP2pFsmInfo, | |
1134 | prP2pSpecificBssInfo, | |
1135 | eNextState); | |
1136 | } | |
1137 | ||
1138 | else { | |
1139 | // Initial passive scan request. | |
1140 | p2pStateInit_AP_CHANNEL_DETECT(prAdapter, prP2pFsmInfo); | |
1141 | } | |
1142 | ||
1143 | break; | |
1144 | case P2P_STATE_REQING_CHANNEL: | |
1145 | if (fgIsTransOut) { | |
1146 | ||
1147 | // Channel on hand / Channel canceled. | |
1148 | p2pStateAbort_REQING_CHANNEL(prAdapter, prP2pFsmInfo, eNextState); | |
1149 | } | |
1150 | else { | |
1151 | // Initial channel request. | |
1152 | p2pFuncAcquireCh(prAdapter, &(prP2pFsmInfo->rChnlReqInfo)); | |
1153 | } | |
1154 | ||
1155 | break; | |
1156 | case P2P_STATE_CHNL_ON_HAND: | |
1157 | if (fgIsTransOut) { | |
1158 | p2pStateAbort_CHNL_ON_HAND(prAdapter, prP2pFsmInfo, prP2pBssInfo, eNextState); | |
1159 | } | |
1160 | else { | |
1161 | // Initial channel ready. | |
1162 | // Send channel ready event. | |
1163 | // Start a FSM timer. | |
1164 | p2pStateInit_CHNL_ON_HAND(prAdapter, prP2pBssInfo, prP2pFsmInfo); | |
1165 | } | |
1166 | ||
1167 | break; | |
1168 | case P2P_STATE_GC_JOIN: | |
1169 | if (fgIsTransOut) { | |
1170 | ||
1171 | // Join complete / join canceled. | |
1172 | p2pStateAbort_GC_JOIN(prAdapter, | |
1173 | prP2pFsmInfo, | |
1174 | &(prP2pFsmInfo->rJoinInfo), | |
1175 | eNextState); | |
1176 | } | |
1177 | else { | |
1178 | ASSERT(prP2pFsmInfo->prTargetBss != NULL); | |
1179 | ||
1180 | // Send request to SAA module. | |
1181 | p2pStateInit_GC_JOIN(prAdapter, | |
1182 | prP2pFsmInfo, | |
1183 | prP2pBssInfo, | |
1184 | &(prP2pFsmInfo->rJoinInfo), | |
1185 | prP2pFsmInfo->prTargetBss); | |
1186 | } | |
1187 | ||
1188 | break; | |
1189 | default: | |
1190 | break; | |
1191 | } | |
1192 | ||
1193 | } while (fgIsTransOut); | |
1194 | ||
1195 | } /* p2pFsmStateTransition */ | |
1196 | ||
1197 | ||
1198 | VOID | |
1199 | p2pFsmRunEventSwitchOPMode ( | |
1200 | IN P_ADAPTER_T prAdapter, | |
1201 | IN P_MSG_HDR_T prMsgHdr | |
1202 | ) | |
1203 | { | |
1204 | P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; | |
1205 | P_MSG_P2P_SWITCH_OP_MODE_T prSwitchOpMode = (P_MSG_P2P_SWITCH_OP_MODE_T)prMsgHdr; | |
1206 | P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = (P_P2P_CONNECTION_SETTINGS_T)NULL; | |
1207 | ||
1208 | do { | |
1209 | ASSERT_BREAK((prAdapter != NULL) && (prSwitchOpMode != NULL)); | |
1210 | ||
1211 | DBGLOG(P2P, TRACE, ("p2pFsmRunEventSwitchOPMode\n")); | |
1212 | ||
1213 | prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); | |
1214 | prP2pConnSettings = prAdapter->rWifiVar.prP2PConnSettings; | |
1215 | ||
1216 | if (prSwitchOpMode->eOpMode >= OP_MODE_NUM) { | |
1217 | ASSERT(FALSE); | |
1218 | break; | |
1219 | } | |
1220 | ||
1221 | /* P2P Device / GC. */ | |
1222 | p2pFuncSwitchOPMode(prAdapter, | |
1223 | prP2pBssInfo, | |
1224 | prSwitchOpMode->eOpMode, | |
1225 | TRUE); | |
1226 | ||
1227 | } while (FALSE); | |
1228 | ||
1229 | if (prMsgHdr) { | |
1230 | cnmMemFree(prAdapter, prMsgHdr); | |
1231 | } | |
1232 | ||
1233 | ||
1234 | } /* p2pFsmRunEventSwitchOPMode */ | |
1235 | ||
1236 | ||
1237 | /*----------------------------------------------------------------------------*/ | |
1238 | /*! | |
1239 | * \brief This function is used to handle scan done event during Device Discovery. | |
1240 | * | |
1241 | * \param[in] prAdapter Pointer of ADAPTER_T | |
1242 | * | |
1243 | * \return none | |
1244 | */ | |
1245 | /*----------------------------------------------------------------------------*/ | |
1246 | VOID | |
1247 | p2pFsmRunEventScanDone ( | |
1248 | IN P_ADAPTER_T prAdapter, | |
1249 | IN P_MSG_HDR_T prMsgHdr | |
1250 | ) | |
1251 | { | |
1252 | P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; | |
1253 | P_P2P_SCAN_REQ_INFO_T prScanReqInfo = (P_P2P_SCAN_REQ_INFO_T)NULL; | |
1254 | P_MSG_SCN_SCAN_DONE prScanDoneMsg = (P_MSG_SCN_SCAN_DONE)NULL; | |
1255 | ENUM_P2P_STATE_T eNextState = P2P_STATE_NUM; | |
1256 | ||
1257 | do { | |
1258 | ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL)); | |
1259 | ||
1260 | ||
1261 | /* This scan done event is either for "SCAN" phase or "SEARCH" state or "LISTEN" state. | |
1262 | * The scan done for SCAN phase & SEARCH state doesn't imply Device | |
1263 | * Discovery over. | |
1264 | */ | |
1265 | DBGLOG(P2P, TRACE, ("P2P Scan Done Event\n")); | |
1266 | ||
1267 | prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; | |
1268 | ||
1269 | if (prP2pFsmInfo == NULL) { | |
1270 | break; | |
1271 | } | |
1272 | ||
1273 | ||
1274 | prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo); | |
1275 | prScanDoneMsg = (P_MSG_SCN_SCAN_DONE)prMsgHdr; | |
1276 | ||
1277 | if (prScanDoneMsg->ucSeqNum != prScanReqInfo->ucSeqNumOfScnMsg) { | |
1278 | /* Scan Done message sequence number mismatch. | |
1279 | * Ignore this event. (P2P FSM issue two scan events.) | |
1280 | */ | |
1281 | /* The scan request has been cancelled. | |
1282 | * Ignore this message. It is possible. | |
1283 | */ | |
1284 | DBGLOG(P2P, TRACE, ("P2P Scan Don SeqNum:%d <-> P2P Fsm SCAN Msg:%d\n", | |
1285 | prScanDoneMsg->ucSeqNum, | |
1286 | prScanReqInfo->ucSeqNumOfScnMsg)); | |
1287 | ||
1288 | break; | |
1289 | } | |
1290 | ||
1291 | ||
1292 | switch (prP2pFsmInfo->eCurrentState) { | |
1293 | case P2P_STATE_SCAN: | |
1294 | { | |
1295 | P_P2P_CONNECTION_REQ_INFO_T prConnReqInfo = &(prP2pFsmInfo->rConnReqInfo); | |
1296 | ||
1297 | prScanReqInfo->fgIsAbort = FALSE; | |
1298 | ||
1299 | if (prConnReqInfo->fgIsConnRequest) { | |
1300 | ||
1301 | if ((prP2pFsmInfo->prTargetBss = p2pFuncKeepOnConnection(prAdapter, | |
1302 | &prP2pFsmInfo->rConnReqInfo, | |
1303 | &prP2pFsmInfo->rChnlReqInfo, | |
1304 | &prP2pFsmInfo->rScanReqInfo)) == NULL) { | |
1305 | eNextState = P2P_STATE_SCAN; | |
1306 | } | |
1307 | else { | |
1308 | eNextState = P2P_STATE_REQING_CHANNEL; | |
1309 | } | |
1310 | ||
1311 | } | |
1312 | else { | |
1313 | eNextState = P2P_STATE_IDLE; | |
1314 | } | |
1315 | ||
1316 | } | |
1317 | break; | |
1318 | case P2P_STATE_AP_CHANNEL_DETECT: | |
1319 | eNextState = P2P_STATE_REQING_CHANNEL; | |
1320 | break; | |
1321 | default: | |
1322 | /* Unexpected channel scan done event without being chanceled. */ | |
1323 | ASSERT(FALSE); | |
1324 | break; | |
1325 | } | |
1326 | ||
1327 | prScanReqInfo->fgIsScanRequest = FALSE; | |
1328 | ||
1329 | p2pFsmStateTransition(prAdapter, | |
1330 | prP2pFsmInfo, | |
1331 | eNextState); | |
1332 | ||
1333 | } while (FALSE); | |
1334 | ||
1335 | if (prMsgHdr) { | |
1336 | cnmMemFree(prAdapter, prMsgHdr); | |
1337 | } | |
1338 | ||
1339 | return; | |
1340 | } /* p2pFsmRunEventScanDone */ | |
1341 | ||
1342 | ||
1343 | ||
1344 | /*----------------------------------------------------------------------------*/ | |
1345 | /*! | |
1346 | * \brief This function is call when channel is granted by CNM module from FW. | |
1347 | * | |
1348 | * \param[in] prAdapter Pointer of ADAPTER_T | |
1349 | * | |
1350 | * \return none | |
1351 | */ | |
1352 | /*----------------------------------------------------------------------------*/ | |
1353 | VOID | |
1354 | p2pFsmRunEventChGrant ( | |
1355 | IN P_ADAPTER_T prAdapter, | |
1356 | IN P_MSG_HDR_T prMsgHdr | |
1357 | ) | |
1358 | { | |
1359 | P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; | |
1360 | P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = (P_P2P_CHNL_REQ_INFO_T)NULL; | |
1361 | P_MSG_CH_GRANT_T prMsgChGrant = (P_MSG_CH_GRANT_T)NULL; | |
1362 | UINT_8 ucTokenID = 0; | |
1363 | ||
1364 | do { | |
1365 | ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL)); | |
1366 | ||
1367 | DBGLOG(P2P, TRACE, ("P2P Run Event Channel Grant\n")); | |
1368 | ||
1369 | prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; | |
1370 | ||
1371 | if (prP2pFsmInfo == NULL) { | |
1372 | break; | |
1373 | } | |
1374 | ||
1375 | prMsgChGrant = (P_MSG_CH_GRANT_T)prMsgHdr; | |
1376 | ucTokenID = prMsgChGrant->ucTokenID; | |
1377 | prP2pFsmInfo->u4GrantInterval = prMsgChGrant->u4GrantInterval; | |
1378 | ||
1379 | prChnlReqInfo = &(prP2pFsmInfo->rChnlReqInfo); | |
1380 | ||
1381 | if (ucTokenID == prChnlReqInfo->ucSeqNumOfChReq) { | |
1382 | ENUM_P2P_STATE_T eNextState = P2P_STATE_NUM; | |
1383 | ||
1384 | switch (prP2pFsmInfo->eCurrentState) { | |
1385 | case P2P_STATE_REQING_CHANNEL: | |
1386 | switch (prChnlReqInfo->eChannelReqType) { | |
1387 | case CHANNEL_REQ_TYPE_REMAIN_ON_CHANNEL: | |
1388 | eNextState = P2P_STATE_CHNL_ON_HAND; | |
1389 | break; | |
1390 | case CHANNEL_REQ_TYPE_GC_JOIN_REQ: | |
1391 | eNextState = P2P_STATE_GC_JOIN; | |
1392 | break; | |
1393 | case CHANNEL_REQ_TYPE_GO_START_BSS: | |
1394 | eNextState = P2P_STATE_IDLE; | |
1395 | break; | |
1396 | default: | |
1397 | break; | |
1398 | } | |
1399 | ||
1400 | p2pFsmStateTransition(prAdapter, | |
1401 | prP2pFsmInfo, | |
1402 | eNextState); | |
1403 | break; | |
1404 | default: | |
1405 | /* Channel is granted under unexpected state. | |
1406 | * Driver should cancel channel privileagea before leaving the states. | |
1407 | */ | |
1408 | ASSERT(FALSE); | |
1409 | break; | |
1410 | } | |
1411 | ||
1412 | } | |
1413 | else { | |
1414 | /* Channel requsted, but released. */ | |
1415 | //ASSERT(!prChnlReqInfo->fgIsChannelRequested); | |
1416 | DBGLOG(P2P, TRACE, ("Channel requsted, but released\n")); | |
1417 | } | |
1418 | } while (FALSE); | |
1419 | ||
1420 | if (prMsgHdr) { | |
1421 | cnmMemFree(prAdapter, prMsgHdr); | |
1422 | } | |
1423 | ||
1424 | return; | |
1425 | ||
1426 | } /* p2pFsmRunEventChGrant */ | |
1427 | ||
1428 | ||
1429 | VOID | |
1430 | p2pFsmRunEventChannelRequest ( | |
1431 | IN P_ADAPTER_T prAdapter, | |
1432 | IN P_MSG_HDR_T prMsgHdr | |
1433 | ) | |
1434 | { | |
1435 | P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = (P_P2P_CHNL_REQ_INFO_T)NULL; | |
1436 | P_MSG_P2P_CHNL_REQUEST_T prP2pChnlReqMsg = (P_MSG_P2P_CHNL_REQUEST_T)NULL; | |
1437 | P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; | |
1438 | ENUM_P2P_STATE_T eNextState = P2P_STATE_NUM; | |
1439 | ||
1440 | do { | |
1441 | ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL)); | |
1442 | ||
1443 | prP2pChnlReqMsg = (P_MSG_P2P_CHNL_REQUEST_T)prMsgHdr; | |
1444 | prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; | |
1445 | ||
1446 | if (prP2pFsmInfo == NULL) { | |
1447 | break; | |
1448 | } | |
1449 | ||
1450 | prChnlReqInfo = &(prP2pFsmInfo->rChnlReqInfo); | |
1451 | ||
1452 | DBGLOG(P2P, TRACE, ("p2pFsmRunEventChannelRequest\n")); | |
1453 | ||
1454 | /* Special case of time renewing for same frequency. */ | |
1455 | if ((prP2pFsmInfo->eCurrentState == P2P_STATE_CHNL_ON_HAND) && | |
1456 | (prChnlReqInfo->ucReqChnlNum == prP2pChnlReqMsg->rChannelInfo.ucChannelNum) && | |
1457 | (prChnlReqInfo->eBand == prP2pChnlReqMsg->rChannelInfo.eBand) && | |
1458 | (prChnlReqInfo->eChnlSco == prP2pChnlReqMsg->eChnlSco)) { | |
1459 | ||
1460 | ASSERT(prChnlReqInfo->fgIsChannelRequested == TRUE); | |
1461 | ASSERT(prChnlReqInfo->eChannelReqType == CHANNEL_REQ_TYPE_REMAIN_ON_CHANNEL); | |
1462 | ||
1463 | prChnlReqInfo->u8Cookie = prP2pChnlReqMsg->u8Cookie; | |
1464 | prChnlReqInfo->u4MaxInterval = prP2pChnlReqMsg->u4Duration; | |
1465 | ||
1466 | /* Re-enter the state. */ | |
1467 | eNextState = P2P_STATE_CHNL_ON_HAND; | |
1468 | } | |
1469 | else { | |
1470 | ||
1471 | // Make sure the state is in IDLE state. | |
1472 | p2pFsmRunEventAbort(prAdapter, prP2pFsmInfo); | |
1473 | ||
1474 | prChnlReqInfo->u8Cookie = prP2pChnlReqMsg->u8Cookie; /* Cookie can only be assign after abort.(for indication) */ | |
1475 | prChnlReqInfo->ucReqChnlNum = prP2pChnlReqMsg->rChannelInfo.ucChannelNum; | |
1476 | prChnlReqInfo->eBand = prP2pChnlReqMsg->rChannelInfo.eBand; | |
1477 | prChnlReqInfo->eChnlSco = prP2pChnlReqMsg->eChnlSco; | |
1478 | prChnlReqInfo->u4MaxInterval = prP2pChnlReqMsg->u4Duration; | |
1479 | prChnlReqInfo->eChannelReqType = CHANNEL_REQ_TYPE_REMAIN_ON_CHANNEL; | |
1480 | ||
1481 | eNextState = P2P_STATE_REQING_CHANNEL; | |
1482 | } | |
1483 | ||
1484 | p2pFsmStateTransition(prAdapter, prP2pFsmInfo, eNextState); | |
1485 | ||
1486 | } while (FALSE); | |
1487 | ||
1488 | ||
1489 | if (prMsgHdr) { | |
1490 | cnmMemFree(prAdapter, prMsgHdr); | |
1491 | } | |
1492 | ||
1493 | return; | |
1494 | } /* p2pFsmRunEventChannelRequest */ | |
1495 | ||
1496 | ||
1497 | VOID | |
1498 | p2pFsmRunEventChannelAbort ( | |
1499 | IN P_ADAPTER_T prAdapter, | |
1500 | IN P_MSG_HDR_T prMsgHdr | |
1501 | ) | |
1502 | { | |
1503 | P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; | |
1504 | P_MSG_P2P_CHNL_ABORT_T prChnlAbortMsg = (P_MSG_P2P_CHNL_ABORT_T)NULL; | |
1505 | P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = (P_P2P_CHNL_REQ_INFO_T)NULL; | |
1506 | ||
1507 | do { | |
1508 | ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL)); | |
1509 | ||
1510 | prChnlAbortMsg = (P_MSG_P2P_CHNL_ABORT_T)prMsgHdr; | |
1511 | prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; | |
1512 | ||
1513 | if (prP2pFsmInfo == NULL) { | |
1514 | break; | |
1515 | } | |
1516 | ||
1517 | prChnlReqInfo = &prP2pFsmInfo->rChnlReqInfo; | |
1518 | ||
1519 | DBGLOG(P2P, TRACE, ("p2pFsmRunEventChannelAbort\n")); | |
1520 | ||
1521 | if ((prChnlAbortMsg->u8Cookie == prChnlReqInfo->u8Cookie) && | |
1522 | (prChnlReqInfo->fgIsChannelRequested)) { | |
1523 | ||
1524 | ASSERT((prP2pFsmInfo->eCurrentState == P2P_STATE_REQING_CHANNEL || | |
1525 | (prP2pFsmInfo->eCurrentState == P2P_STATE_CHNL_ON_HAND))); | |
1526 | ||
1527 | p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE); | |
1528 | } | |
1529 | ||
1530 | } while (FALSE); | |
1531 | ||
1532 | if (prMsgHdr) { | |
1533 | cnmMemFree(prAdapter, prMsgHdr); | |
1534 | } | |
1535 | ||
1536 | return; | |
1537 | } /* p2pFsmRunEventChannelAbort */ | |
1538 | ||
1539 | ||
1540 | ||
1541 | VOID | |
1542 | p2pFsmRunEventScanRequest ( | |
1543 | IN P_ADAPTER_T prAdapter, | |
1544 | IN P_MSG_HDR_T prMsgHdr | |
1545 | ) | |
1546 | { | |
1547 | ||
1548 | P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; | |
1549 | P_MSG_P2P_SCAN_REQUEST_T prP2pScanReqMsg = (P_MSG_P2P_SCAN_REQUEST_T)NULL; | |
1550 | P_P2P_SCAN_REQ_INFO_T prScanReqInfo = (P_P2P_SCAN_REQ_INFO_T)NULL; | |
1551 | UINT_32 u4ChnlListSize = 0; | |
1552 | ||
1553 | do { | |
1554 | ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL)); | |
1555 | ||
1556 | prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; | |
1557 | ||
1558 | if (prP2pFsmInfo == NULL) { | |
1559 | break; | |
1560 | } | |
1561 | ||
1562 | prP2pScanReqMsg = (P_MSG_P2P_SCAN_REQUEST_T)prMsgHdr; | |
1563 | prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo); | |
1564 | ||
1565 | DBGLOG(P2P, TRACE, ("p2pFsmRunEventScanRequest\n")); | |
1566 | ||
1567 | // Make sure the state is in IDLE state. | |
1568 | p2pFsmRunEventAbort(prAdapter, prP2pFsmInfo); | |
1569 | ||
1570 | ASSERT(prScanReqInfo->fgIsScanRequest == FALSE); | |
1571 | ||
1572 | prScanReqInfo->fgIsAbort = TRUE; | |
1573 | prScanReqInfo->eScanType = SCAN_TYPE_ACTIVE_SCAN; | |
1574 | prScanReqInfo->eChannelSet = SCAN_CHANNEL_SPECIFIED; | |
1575 | ||
1576 | // Channel List | |
1577 | prScanReqInfo->ucNumChannelList = prP2pScanReqMsg->u4NumChannel; | |
1578 | DBGLOG(P2P, TRACE, ("Scan Request Channel List Number: %d\n", prScanReqInfo->ucNumChannelList)); | |
1579 | if (prScanReqInfo->ucNumChannelList > MAXIMUM_OPERATION_CHANNEL_LIST) { | |
1580 | DBGLOG(P2P, TRACE, ("Channel List Number Overloaded: %d, change to: %d\n", | |
1581 | prScanReqInfo->ucNumChannelList, | |
1582 | MAXIMUM_OPERATION_CHANNEL_LIST)); | |
1583 | prScanReqInfo->ucNumChannelList = MAXIMUM_OPERATION_CHANNEL_LIST; | |
1584 | } | |
1585 | ||
1586 | u4ChnlListSize = sizeof(RF_CHANNEL_INFO_T) * prScanReqInfo->ucNumChannelList; | |
1587 | kalMemCopy(prScanReqInfo->arScanChannelList, prP2pScanReqMsg->arChannelListInfo, u4ChnlListSize); | |
1588 | ||
1589 | // TODO: I only take the first SSID. Multiple SSID may be needed in the future. | |
1590 | // SSID | |
1591 | if (prP2pScanReqMsg->i4SsidNum >= 1) { | |
1592 | ||
1593 | kalMemCopy(&(prScanReqInfo->rSsidStruct), | |
1594 | prP2pScanReqMsg->prSSID, | |
1595 | sizeof(P2P_SSID_STRUCT_T)); | |
1596 | } | |
1597 | else { | |
1598 | prScanReqInfo->rSsidStruct.ucSsidLen = 0; | |
1599 | } | |
1600 | ||
1601 | // IE Buffer | |
1602 | kalMemCopy(prScanReqInfo->aucIEBuf, | |
1603 | prP2pScanReqMsg->pucIEBuf, | |
1604 | prP2pScanReqMsg->u4IELen); | |
1605 | ||
1606 | prScanReqInfo->u4BufLength = prP2pScanReqMsg->u4IELen; | |
1607 | ||
1608 | p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_SCAN); | |
1609 | ||
1610 | ||
1611 | ||
1612 | } while (FALSE); | |
1613 | ||
1614 | if (prMsgHdr) { | |
1615 | cnmMemFree(prAdapter, prMsgHdr); | |
1616 | } | |
1617 | ||
1618 | ||
1619 | } /* p2pFsmRunEventScanRequest */ | |
1620 | ||
1621 | ||
1622 | VOID | |
1623 | p2pFsmRunEventScanAbort ( | |
1624 | IN P_ADAPTER_T prAdapter, | |
1625 | IN P_MSG_HDR_T prMsgHdr | |
1626 | ) | |
1627 | { | |
1628 | ||
1629 | P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; | |
1630 | ||
1631 | do { | |
1632 | ASSERT_BREAK(prAdapter != NULL); | |
1633 | ||
1634 | DBGLOG(P2P, TRACE, ("p2pFsmRunEventScanAbort\n")); | |
1635 | ||
1636 | prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; | |
1637 | ||
1638 | if (prP2pFsmInfo->eCurrentState == P2P_STATE_SCAN) { | |
1639 | P_P2P_SCAN_REQ_INFO_T prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo); | |
1640 | ||
1641 | prScanReqInfo->fgIsAbort = TRUE; | |
1642 | ||
1643 | p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE); | |
1644 | } | |
1645 | ||
1646 | } while (FALSE); | |
1647 | ||
1648 | if (prMsgHdr) { | |
1649 | cnmMemFree(prAdapter, prMsgHdr); | |
1650 | } | |
1651 | ||
1652 | return; | |
1653 | } /* p2pFsmRunEventScanAbort */ | |
1654 | ||
1655 | ||
1656 | ||
1657 | ||
1658 | ||
1659 | VOID | |
1660 | p2pFsmRunEventAbort ( | |
1661 | IN P_ADAPTER_T prAdapter, | |
1662 | IN P_P2P_FSM_INFO_T prP2pFsmInfo | |
1663 | ) | |
1664 | { | |
1665 | P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; | |
1666 | do { | |
1667 | ASSERT_BREAK((prAdapter != NULL) && (prP2pFsmInfo != NULL)); | |
1668 | ||
1669 | prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); | |
1670 | ||
1671 | DBGLOG(P2P, TRACE, ("p2pFsmRunEventAbort\n")); | |
1672 | ||
1673 | if (prP2pFsmInfo->eCurrentState != P2P_STATE_IDLE) { | |
1674 | ||
1675 | if (prP2pFsmInfo->eCurrentState == P2P_STATE_SCAN) { | |
1676 | ||
1677 | P_P2P_SCAN_REQ_INFO_T prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo); | |
1678 | ||
1679 | prScanReqInfo->fgIsAbort = TRUE; | |
1680 | } | |
1681 | else if (prP2pFsmInfo->eCurrentState == P2P_STATE_REQING_CHANNEL) { | |
1682 | /* 2012/08/06: frog | |
1683 | * Prevent Start GO. | |
1684 | */ | |
1685 | prP2pBssInfo->eIntendOPMode = OP_MODE_NUM; | |
1686 | } | |
1687 | ||
1688 | // For other state, is there any special action that should be take before leaving? | |
1689 | ||
1690 | p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE); | |
1691 | } | |
1692 | else { | |
1693 | /* P2P State IDLE. */ | |
1694 | P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = &(prP2pFsmInfo->rChnlReqInfo); | |
1695 | ||
1696 | if (prChnlReqInfo->fgIsChannelRequested) { | |
1697 | p2pFuncReleaseCh(prAdapter, prChnlReqInfo); | |
1698 | } | |
1699 | ||
1700 | cnmTimerStopTimer(prAdapter, &(prAdapter->rP2pFsmTimeoutTimer)); | |
1701 | } | |
1702 | ||
1703 | ||
1704 | } while (FALSE); | |
1705 | ||
1706 | return; | |
1707 | } /* p2pFsmRunEventAbort */ | |
1708 | ||
1709 | ||
1710 | ||
1711 | /*----------------------------------------------------------------------------*/ | |
1712 | /*! | |
1713 | * \brief This function is used to handle FSM Timeout. | |
1714 | * | |
1715 | * \param[in] prAdapter Pointer of ADAPTER_T | |
1716 | * | |
1717 | * \return none | |
1718 | */ | |
1719 | /*----------------------------------------------------------------------------*/ | |
1720 | VOID | |
1721 | p2pFsmRunEventFsmTimeout ( | |
1722 | IN P_ADAPTER_T prAdapter, | |
1723 | IN ULONG ulParam | |
1724 | ) | |
1725 | { | |
1726 | P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)ulParam; | |
1727 | ||
1728 | do { | |
1729 | ASSERT_BREAK((prAdapter != NULL) && (prP2pFsmInfo != NULL)); | |
1730 | ||
1731 | DBGLOG(P2P, TRACE, ("P2P FSM Timeout Event\n")); | |
1732 | ||
1733 | switch (prP2pFsmInfo->eCurrentState) { | |
1734 | case P2P_STATE_IDLE: | |
1735 | { | |
1736 | P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = &prP2pFsmInfo->rChnlReqInfo; | |
1737 | if (prChnlReqInfo->fgIsChannelRequested) { | |
1738 | p2pFuncReleaseCh(prAdapter, prChnlReqInfo); | |
1739 | } | |
1740 | else if (IS_NET_PWR_STATE_IDLE(prAdapter, NETWORK_TYPE_P2P_INDEX)) { | |
1741 | UNSET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX); | |
1742 | nicDeactivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX); | |
1743 | } | |
1744 | ||
1745 | } | |
1746 | break; | |
1747 | ||
1748 | // case P2P_STATE_SCAN: | |
1749 | // break; | |
1750 | // case P2P_STATE_AP_CHANNEL_DETECT: | |
1751 | // break; | |
1752 | // case P2P_STATE_REQING_CHANNEL: | |
1753 | // break; | |
1754 | case P2P_STATE_CHNL_ON_HAND: | |
1755 | { | |
1756 | p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE); | |
1757 | } | |
1758 | break; | |
1759 | // case P2P_STATE_GC_JOIN: | |
1760 | // break; | |
1761 | default: | |
1762 | break; | |
1763 | } | |
1764 | ||
1765 | } while (FALSE); | |
1766 | ||
1767 | return; | |
1768 | } /* p2pFsmRunEventFsmTimeout */ | |
1769 | ||
1770 | VOID | |
1771 | p2pFsmRunEventMgmtFrameTx ( | |
1772 | IN P_ADAPTER_T prAdapter, | |
1773 | IN P_MSG_HDR_T prMsgHdr | |
1774 | ) | |
1775 | { | |
1776 | P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; | |
1777 | P_MSG_P2P_MGMT_TX_REQUEST_T prMgmtTxMsg = (P_MSG_P2P_MGMT_TX_REQUEST_T)NULL; | |
1778 | ||
1779 | do { | |
1780 | ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL)); | |
1781 | ||
1782 | DBGLOG(P2P, TRACE, ("p2pFsmRunEventMgmtFrameTx\n")); | |
1783 | ||
1784 | prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; | |
1785 | ||
1786 | if (prP2pFsmInfo == NULL) { | |
1787 | break; | |
1788 | } | |
1789 | ||
1790 | prMgmtTxMsg = (P_MSG_P2P_MGMT_TX_REQUEST_T)prMsgHdr; | |
1791 | ||
1792 | p2pFuncTxMgmtFrame(prAdapter, | |
1793 | &prP2pFsmInfo->rMgmtTxInfo, | |
1794 | prMgmtTxMsg->prMgmtMsduInfo, | |
1795 | prMgmtTxMsg->u8Cookie); | |
1796 | ||
1797 | ||
1798 | ||
1799 | } while (FALSE); | |
1800 | ||
1801 | if (prMsgHdr) { | |
1802 | cnmMemFree(prAdapter, prMsgHdr); | |
1803 | } | |
1804 | ||
1805 | return; | |
1806 | ||
1807 | } /* p2pFsmRunEventMgmtTx */ | |
1808 | ||
1809 | ||
1810 | VOID | |
1811 | p2pFsmRunEventStartAP ( | |
1812 | IN P_ADAPTER_T prAdapter, | |
1813 | IN P_MSG_HDR_T prMsgHdr | |
1814 | ) | |
1815 | { | |
1816 | P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; | |
1817 | P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; | |
1818 | P_MSG_P2P_START_AP_T prP2pStartAPMsg = (P_MSG_P2P_START_AP_T)NULL; | |
1819 | P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo = (P_P2P_SPECIFIC_BSS_INFO_T)NULL; | |
1820 | ||
1821 | do { | |
1822 | ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL)); | |
1823 | ||
1824 | DBGLOG(P2P, TRACE, ("p2pFsmRunEventStartAP\n")); | |
1825 | ||
1826 | prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; | |
1827 | ||
1828 | if (prP2pFsmInfo == NULL) { | |
1829 | break; | |
1830 | } | |
1831 | ||
1832 | prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); | |
1833 | prP2pStartAPMsg = (P_MSG_P2P_START_AP_T)prMsgHdr; | |
1834 | prP2pSpecificBssInfo = prAdapter->rWifiVar.prP2pSpecificBssInfo; | |
1835 | ||
1836 | ||
1837 | if (prP2pStartAPMsg->u4BcnInterval) { | |
1838 | DBGLOG(P2P, TRACE, ("Beacon interval updated to :%u \n", prP2pStartAPMsg->u4BcnInterval)); | |
1839 | prP2pBssInfo->u2BeaconInterval = (UINT_16)prP2pStartAPMsg->u4BcnInterval; | |
1840 | } | |
1841 | else if (prP2pBssInfo->u2BeaconInterval == 0) { | |
1842 | prP2pBssInfo->u2BeaconInterval = DOT11_BEACON_PERIOD_DEFAULT; | |
1843 | } | |
1844 | ||
1845 | if (prP2pStartAPMsg->u4DtimPeriod) { | |
1846 | DBGLOG(P2P, TRACE, ("DTIM interval updated to :%u \n", prP2pStartAPMsg->u4DtimPeriod)); | |
1847 | prP2pBssInfo->ucDTIMPeriod = (UINT_8)prP2pStartAPMsg->u4DtimPeriod; | |
1848 | } | |
1849 | else if (prP2pBssInfo->ucDTIMPeriod == 0) { | |
1850 | prP2pBssInfo->ucDTIMPeriod = DOT11_DTIM_PERIOD_DEFAULT; | |
1851 | } | |
1852 | ||
1853 | if (prP2pStartAPMsg->u2SsidLen != 0) { | |
1854 | kalMemCopy(prP2pBssInfo->aucSSID, prP2pStartAPMsg->aucSsid, prP2pStartAPMsg->u2SsidLen); | |
1855 | kalMemCopy(prP2pSpecificBssInfo->aucGroupSsid, prP2pStartAPMsg->aucSsid, prP2pStartAPMsg->u2SsidLen); | |
1856 | prP2pBssInfo->ucSSIDLen = prP2pSpecificBssInfo->u2GroupSsidLen = prP2pStartAPMsg->u2SsidLen; | |
1857 | } | |
1858 | ||
1859 | ||
1860 | prP2pBssInfo->eHiddenSsidType = prP2pStartAPMsg->ucHiddenSsidType; | |
1861 | ||
1862 | ||
1863 | // TODO: JB | |
1864 | /* Privacy & inactive timeout. */ | |
1865 | ||
1866 | if ((prP2pBssInfo->eCurrentOPMode != OP_MODE_ACCESS_POINT) || | |
1867 | (prP2pBssInfo->eIntendOPMode != OP_MODE_NUM)) { | |
1868 | UINT_8 ucPreferedChnl = 0; | |
1869 | ENUM_BAND_T eBand = BAND_NULL; | |
1870 | ENUM_CHNL_EXT_T eSco = CHNL_EXT_SCN; | |
1871 | ENUM_P2P_STATE_T eNextState = P2P_STATE_SCAN; | |
1872 | P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = prAdapter->rWifiVar.prP2PConnSettings; | |
1873 | ||
1874 | ||
1875 | if(prP2pFsmInfo->eCurrentState != P2P_STATE_SCAN && | |
1876 | prP2pFsmInfo->eCurrentState != P2P_STATE_IDLE) { | |
1877 | // Make sure the state is in IDLE state. | |
1878 | p2pFsmRunEventAbort(prAdapter, prP2pFsmInfo); | |
1879 | } | |
1880 | prAdapter->rWifiVar.prP2pFsmInfo->rScanReqInfo.fgIsGOInitialDone=0; | |
1881 | DBGLOG(P2P, INFO, ("NFC:p2pFsmRunEventStartAP,fgIsGOInitialDone[%d]\n",prAdapter->rWifiVar.prP2pFsmInfo->rScanReqInfo.fgIsGOInitialDone)); | |
1882 | ||
1883 | // 20120118: Moved to p2pFuncSwitchOPMode(). | |
1884 | //SET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX); | |
1885 | ||
1886 | /* Leave IDLE state. */ | |
1887 | SET_NET_PWR_STATE_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX); | |
1888 | ||
1889 | // sync with firmware | |
1890 | //DBGLOG(P2P, INFO, ("Activate P2P Network. \n")); | |
1891 | //nicActivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX); | |
1892 | ||
1893 | ||
1894 | /* Key to trigger P2P FSM to allocate channel for AP mode. */ | |
1895 | prP2pBssInfo->eIntendOPMode = OP_MODE_ACCESS_POINT; | |
1896 | ||
1897 | /* Sparse Channel to decide which channel to use. */ | |
1898 | if ((cnmPreferredChannel(prAdapter, | |
1899 | &eBand, | |
1900 | &ucPreferedChnl, | |
1901 | &eSco) == FALSE) && (prP2pConnSettings->ucOperatingChnl == 0)) { | |
1902 | // Sparse Channel Detection using passive mode. | |
1903 | eNextState = P2P_STATE_AP_CHANNEL_DETECT; | |
1904 | } | |
1905 | else { | |
1906 | P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo = prAdapter->rWifiVar.prP2pSpecificBssInfo; | |
1907 | P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = &prP2pFsmInfo->rChnlReqInfo; | |
1908 | ||
1909 | ||
1910 | #if 1 | |
1911 | /* 2012-01-27: frog - Channel set from upper layer is the first priority. */ | |
1912 | /* Becuase the channel & beacon is decided by p2p_supplicant. */ | |
1913 | if (prP2pConnSettings->ucOperatingChnl != 0) { | |
1914 | prP2pSpecificBssInfo->ucPreferredChannel = prP2pConnSettings->ucOperatingChnl; | |
1915 | prP2pSpecificBssInfo->eRfBand = prP2pConnSettings->eBand; | |
1916 | } | |
1917 | ||
1918 | else { | |
1919 | ASSERT(ucPreferedChnl != 0); | |
1920 | prP2pSpecificBssInfo->ucPreferredChannel = ucPreferedChnl; | |
1921 | prP2pSpecificBssInfo->eRfBand = eBand; | |
1922 | } | |
1923 | #else | |
1924 | if (ucPreferedChnl) { | |
1925 | prP2pSpecificBssInfo->ucPreferredChannel = ucPreferedChnl; | |
1926 | prP2pSpecificBssInfo->eRfBand = eBand; | |
1927 | } | |
1928 | else { | |
1929 | ASSERT(prP2pConnSettings->ucOperatingChnl != 0); | |
1930 | prP2pSpecificBssInfo->ucPreferredChannel = prP2pConnSettings->ucOperatingChnl; | |
1931 | prP2pSpecificBssInfo->eRfBand = prP2pConnSettings->eBand; | |
1932 | } | |
1933 | ||
1934 | #endif | |
1935 | prChnlReqInfo->ucReqChnlNum = prP2pSpecificBssInfo->ucPreferredChannel; | |
1936 | prChnlReqInfo->eBand = prP2pSpecificBssInfo->eRfBand; | |
1937 | prChnlReqInfo->eChannelReqType = CHANNEL_REQ_TYPE_GO_START_BSS; | |
1938 | ||
1939 | DBGLOG(P2P, INFO,("p2pFsmRunEventStartAP GO Scan \n")); | |
1940 | } | |
1941 | ||
1942 | /* If channel is specified, use active scan to shorten the scan time. */ | |
1943 | p2pFsmStateTransition(prAdapter, | |
1944 | prAdapter->rWifiVar.prP2pFsmInfo, | |
1945 | eNextState); | |
1946 | } | |
1947 | ||
1948 | ||
1949 | ||
1950 | } while (FALSE); | |
1951 | ||
1952 | ||
1953 | ||
1954 | if (prMsgHdr) { | |
1955 | cnmMemFree(prAdapter, prMsgHdr); | |
1956 | } | |
1957 | ||
1958 | return; | |
1959 | } /* p2pFsmRunEventStartAP */ | |
1960 | ||
1961 | VOID | |
1962 | p2pFsmRunEventNetDeviceRegister ( | |
1963 | IN P_ADAPTER_T prAdapter, | |
1964 | IN P_MSG_HDR_T prMsgHdr | |
1965 | ) | |
1966 | { | |
1967 | P_MSG_P2P_NETDEV_REGISTER_T prNetDevRegisterMsg = (P_MSG_P2P_NETDEV_REGISTER_T)NULL; | |
1968 | ||
1969 | ||
1970 | do { | |
1971 | ||
1972 | ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL)); | |
1973 | ||
1974 | DBGLOG(P2P, TRACE, ("p2pFsmRunEventNetDeviceRegister\n")); | |
1975 | ||
1976 | prNetDevRegisterMsg = (P_MSG_P2P_NETDEV_REGISTER_T)prMsgHdr; | |
1977 | ||
1978 | if (prNetDevRegisterMsg->fgIsEnable) { | |
1979 | p2pSetMode((prNetDevRegisterMsg->ucMode == 1)?TRUE:FALSE); | |
1980 | ||
1981 | if (p2pLaunch(prAdapter->prGlueInfo)) { | |
1982 | ASSERT(prAdapter->fgIsP2PRegistered); | |
1983 | } | |
1984 | ||
1985 | } | |
1986 | else { | |
1987 | if (prAdapter->fgIsP2PRegistered) { | |
1988 | p2pRemove(prAdapter->prGlueInfo); | |
1989 | } | |
1990 | ||
1991 | } | |
1992 | } while (FALSE); | |
1993 | ||
1994 | if (prMsgHdr) { | |
1995 | cnmMemFree(prAdapter, prMsgHdr); | |
1996 | } | |
1997 | ||
1998 | return; | |
1999 | } /* p2pFsmRunEventNetDeviceRegister */ | |
2000 | ||
2001 | ||
2002 | VOID | |
2003 | p2pFsmRunEventUpdateMgmtFrame ( | |
2004 | IN P_ADAPTER_T prAdapter, | |
2005 | IN P_MSG_HDR_T prMsgHdr | |
2006 | ) | |
2007 | { | |
2008 | P_MSG_P2P_MGMT_FRAME_UPDATE_T prP2pMgmtFrameUpdateMsg = (P_MSG_P2P_MGMT_FRAME_UPDATE_T)NULL; | |
2009 | P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; | |
2010 | ||
2011 | do { | |
2012 | ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL)); | |
2013 | ||
2014 | DBGLOG(P2P, TRACE, ("p2pFsmRunEventUpdateMgmtFrame\n")); | |
2015 | ||
2016 | prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; | |
2017 | ||
2018 | if (prP2pFsmInfo == NULL) { | |
2019 | break; | |
2020 | } | |
2021 | ||
2022 | prP2pMgmtFrameUpdateMsg = (P_MSG_P2P_MGMT_FRAME_UPDATE_T)prMsgHdr; | |
2023 | ||
2024 | switch (prP2pMgmtFrameUpdateMsg->eBufferType) { | |
2025 | case ENUM_FRAME_TYPE_EXTRA_IE_BEACON: | |
2026 | break; | |
2027 | case ENUM_FRAME_TYPE_EXTRA_IE_ASSOC_RSP: | |
2028 | break; | |
2029 | case ENUM_FRAME_TYPE_EXTRA_IE_PROBE_RSP: | |
2030 | break; | |
2031 | case ENUM_FRAME_TYPE_PROBE_RSP_TEMPLATE: | |
2032 | break; | |
2033 | case ENUM_FRAME_TYPE_BEACON_TEMPLATE: | |
2034 | break; | |
2035 | default: | |
2036 | break; | |
2037 | } | |
2038 | ||
2039 | } while (FALSE); | |
2040 | ||
2041 | if (prMsgHdr) { | |
2042 | cnmMemFree(prAdapter, prMsgHdr); | |
2043 | } | |
2044 | ||
2045 | return; | |
2046 | } /* p2pFsmRunEventUpdateMgmtFrame */ | |
2047 | ||
2048 | ||
2049 | VOID | |
2050 | p2pFsmRunEventBeaconUpdate ( | |
2051 | IN P_ADAPTER_T prAdapter, | |
2052 | IN P_MSG_HDR_T prMsgHdr | |
2053 | ) | |
2054 | { | |
2055 | P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; | |
2056 | P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; | |
2057 | P_MSG_P2P_BEACON_UPDATE_T prBcnUpdateMsg = (P_MSG_P2P_BEACON_UPDATE_T)NULL; | |
2058 | ||
2059 | do { | |
2060 | ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL)); | |
2061 | ||
2062 | DBGLOG(P2P, TRACE, ("p2pFsmRunEventBeaconUpdate\n")); | |
2063 | ||
2064 | printk("p2pFsmRunEventBeaconUpdate\n"); | |
2065 | ||
2066 | prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; | |
2067 | ||
2068 | if (prP2pFsmInfo == NULL) { | |
2069 | break; | |
2070 | } | |
2071 | ||
2072 | prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); | |
2073 | prBcnUpdateMsg = (P_MSG_P2P_BEACON_UPDATE_T)prMsgHdr; | |
2074 | ||
2075 | ||
2076 | p2pFuncBeaconUpdate(prAdapter, | |
2077 | prP2pBssInfo, | |
2078 | &prP2pFsmInfo->rBcnContentInfo, | |
2079 | prBcnUpdateMsg->pucBcnHdr, | |
2080 | prBcnUpdateMsg->u4BcnHdrLen, | |
2081 | prBcnUpdateMsg->pucBcnBody, | |
2082 | prBcnUpdateMsg->u4BcnBodyLen); | |
2083 | ||
2084 | if ((prP2pBssInfo->eCurrentOPMode == OP_MODE_ACCESS_POINT) && | |
2085 | (prP2pBssInfo->eIntendOPMode == OP_MODE_NUM)) { | |
2086 | /* AP is created, Beacon Update. */ | |
2087 | //nicPmIndicateBssAbort(prAdapter, NETWORK_TYPE_P2P_INDEX); | |
2088 | ||
2089 | bssUpdateBeaconContent(prAdapter, NETWORK_TYPE_P2P_INDEX); | |
2090 | ||
2091 | //nicPmIndicateBssCreated(prAdapter, NETWORK_TYPE_P2P_INDEX); | |
2092 | } | |
2093 | ||
2094 | ||
2095 | ||
2096 | } while (FALSE); | |
2097 | ||
2098 | ||
2099 | if (prMsgHdr) { | |
2100 | cnmMemFree(prAdapter, prMsgHdr); | |
2101 | } | |
2102 | ||
2103 | } /* p2pFsmRunEventBeaconUpdate */ | |
2104 | ||
2105 | ||
2106 | VOID | |
2107 | p2pFsmRunEventStopAP ( | |
2108 | IN P_ADAPTER_T prAdapter, | |
2109 | IN P_MSG_HDR_T prMsgHdr | |
2110 | ) | |
2111 | { | |
2112 | P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; | |
2113 | ||
2114 | do { | |
2115 | ASSERT_BREAK((prAdapter != NULL)); | |
2116 | ||
2117 | prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); | |
2118 | ||
2119 | DBGLOG(P2P, TRACE, ("p2pFsmRunEventStopAP\n")); | |
2120 | ||
2121 | if ((prP2pBssInfo->eCurrentOPMode == OP_MODE_ACCESS_POINT) | |
2122 | && (prP2pBssInfo->eIntendOPMode == OP_MODE_NUM)) { | |
2123 | /* AP is created, Beacon Update. */ | |
2124 | ||
2125 | p2pFuncDissolve(prAdapter, prP2pBssInfo, TRUE, REASON_CODE_DEAUTH_LEAVING_BSS); | |
2126 | ||
2127 | DBGLOG(P2P, TRACE, ("Stop Beaconing\n")); | |
2128 | nicPmIndicateBssAbort(prAdapter, NETWORK_TYPE_P2P_INDEX); | |
2129 | ||
2130 | /* Reset RLM related field of BSSINFO. */ | |
2131 | rlmBssAborted(prAdapter, prP2pBssInfo); | |
2132 | } | |
2133 | ||
2134 | ||
2135 | ||
2136 | // 20120118: Moved to p2pFuncSwitchOPMode(). | |
2137 | //UNSET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX); | |
2138 | ||
2139 | /* Enter IDLE state. */ | |
2140 | SET_NET_PWR_STATE_IDLE(prAdapter, NETWORK_TYPE_P2P_INDEX); | |
2141 | ||
2142 | DBGLOG(P2P, INFO, ("Re activate P2P Network. \n")); | |
2143 | nicDeactivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX); | |
2144 | ||
2145 | nicActivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX); | |
2146 | ||
2147 | #if CFG_SUPPORT_WFD | |
2148 | p2pFsmRunEventWfdSettingUpdate(prAdapter, NULL); | |
2149 | #endif | |
2150 | ||
2151 | //p2pFsmRunEventAbort(prAdapter, prAdapter->rWifiVar.prP2pFsmInfo); | |
2152 | p2pFsmStateTransition(prAdapter, prAdapter->rWifiVar.prP2pFsmInfo, P2P_STATE_IDLE); | |
2153 | ||
2154 | } while (FALSE); | |
2155 | ||
2156 | if (prMsgHdr) { | |
2157 | cnmMemFree(prAdapter, prMsgHdr); | |
2158 | } | |
2159 | ||
2160 | } /* p2pFsmRunEventStopAP */ | |
2161 | ||
2162 | VOID | |
2163 | p2pFsmRunEventConnectionRequest ( | |
2164 | IN P_ADAPTER_T prAdapter, | |
2165 | IN P_MSG_HDR_T prMsgHdr | |
2166 | ) | |
2167 | { | |
2168 | P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; | |
2169 | P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; | |
2170 | P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = (P_P2P_CHNL_REQ_INFO_T)NULL; | |
2171 | P_MSG_P2P_CONNECTION_REQUEST_T prConnReqMsg = (P_MSG_P2P_CONNECTION_REQUEST_T)NULL; | |
2172 | P_P2P_CONNECTION_REQ_INFO_T prConnReqInfo = (P_P2P_CONNECTION_REQ_INFO_T)NULL; | |
2173 | ||
2174 | do { | |
2175 | ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL)); | |
2176 | ||
2177 | prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); | |
2178 | prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; | |
2179 | ||
2180 | if (prP2pFsmInfo == NULL) { | |
2181 | break; | |
2182 | } | |
2183 | ||
2184 | prConnReqMsg = (P_MSG_P2P_CONNECTION_REQUEST_T)prMsgHdr; | |
2185 | ||
2186 | prConnReqInfo = &(prP2pFsmInfo->rConnReqInfo); | |
2187 | prChnlReqInfo = &(prP2pFsmInfo->rChnlReqInfo); | |
2188 | ||
2189 | DBGLOG(P2P, INFO, ("p2pFsmRunEventConnectionRequest\n")); | |
2190 | ||
2191 | if (prP2pBssInfo->eCurrentOPMode != OP_MODE_INFRASTRUCTURE) { | |
2192 | break; | |
2193 | } | |
2194 | ||
2195 | SET_NET_PWR_STATE_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX); | |
2196 | ||
2197 | ||
2198 | // Make sure the state is in IDLE state. | |
2199 | p2pFsmRunEventAbort(prAdapter, prP2pFsmInfo); | |
2200 | ||
2201 | // Update connection request information. | |
2202 | prConnReqInfo->fgIsConnRequest = TRUE; | |
2203 | COPY_MAC_ADDR(prConnReqInfo->aucBssid, prConnReqMsg->aucBssid); | |
2204 | kalMemCopy(&(prConnReqInfo->rSsidStruct), &(prConnReqMsg->rSsid), sizeof(P2P_SSID_STRUCT_T)); | |
2205 | kalMemCopy(prConnReqInfo->aucIEBuf, prConnReqMsg->aucIEBuf, prConnReqMsg->u4IELen); | |
2206 | prConnReqInfo->u4BufLength = prConnReqMsg->u4IELen; | |
2207 | ||
2208 | /* Find BSS Descriptor first. */ | |
2209 | prP2pFsmInfo->prTargetBss = scanP2pSearchDesc(prAdapter, | |
2210 | prP2pBssInfo, | |
2211 | prConnReqInfo); | |
2212 | ||
2213 | if (prP2pFsmInfo->prTargetBss == NULL) { | |
2214 | /* Update scan parameter... to scan target device. */ | |
2215 | P_P2P_SCAN_REQ_INFO_T prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo); | |
2216 | DBGLOG(P2P, INFO, ("p2pFsmRunEventConnectionRequest,Trigger New Scan\n")); | |
2217 | ||
2218 | prScanReqInfo->ucNumChannelList = 1; | |
2219 | prScanReqInfo->eScanType = SCAN_TYPE_ACTIVE_SCAN; | |
2220 | prScanReqInfo->eChannelSet = SCAN_CHANNEL_SPECIFIED; | |
2221 | prScanReqInfo->arScanChannelList[0].ucChannelNum = prConnReqMsg->rChannelInfo.ucChannelNum; | |
2222 | kalMemCopy(&(prScanReqInfo->rSsidStruct), &(prConnReqMsg->rSsid), sizeof(P2P_SSID_STRUCT_T)); | |
2223 | prScanReqInfo->u4BufLength = 0; /* Prevent other P2P ID in IE. */ | |
2224 | prScanReqInfo->fgIsAbort = TRUE; | |
2225 | ||
2226 | p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_SCAN); | |
2227 | } | |
2228 | else { | |
2229 | prChnlReqInfo->u8Cookie = 0; | |
2230 | prChnlReqInfo->ucReqChnlNum = prConnReqMsg->rChannelInfo.ucChannelNum; | |
2231 | prChnlReqInfo->eBand = prConnReqMsg->rChannelInfo.eBand; | |
2232 | prChnlReqInfo->eChnlSco = prConnReqMsg->eChnlSco; | |
2233 | prChnlReqInfo->u4MaxInterval = AIS_JOIN_CH_REQUEST_INTERVAL; | |
2234 | prChnlReqInfo->eChannelReqType = CHANNEL_REQ_TYPE_GC_JOIN_REQ; | |
2235 | DBGLOG(P2P, INFO, ("p2pFsmRunEventConnectionRequest, Report the Connecting BSS Again.\n")); | |
2236 | p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_REQING_CHANNEL); | |
2237 | } | |
2238 | ||
2239 | ||
2240 | } while (FALSE); | |
2241 | ||
2242 | if (prMsgHdr) { | |
2243 | cnmMemFree(prAdapter, prMsgHdr); | |
2244 | } | |
2245 | ||
2246 | return; | |
2247 | ||
2248 | } /* p2pFsmRunEventConnectionRequest */ | |
2249 | ||
2250 | /*----------------------------------------------------------------------------*/ | |
2251 | /*! | |
2252 | * \brief This function is used to handle Connection Request from Supplicant. | |
2253 | * | |
2254 | * \param[in] prAdapter Pointer of ADAPTER_T | |
2255 | * | |
2256 | * \return none | |
2257 | */ | |
2258 | /*----------------------------------------------------------------------------*/ | |
2259 | VOID | |
2260 | p2pFsmRunEventConnectionAbort ( | |
2261 | IN P_ADAPTER_T prAdapter, | |
2262 | IN P_MSG_HDR_T prMsgHdr | |
2263 | ) | |
2264 | { | |
2265 | P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; | |
2266 | P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; | |
2267 | P_MSG_P2P_CONNECTION_ABORT_T prDisconnMsg = (P_MSG_P2P_CONNECTION_ABORT_T)NULL; | |
2268 | //P_STA_RECORD_T prTargetStaRec = (P_STA_RECORD_T)NULL; | |
2269 | ||
2270 | do { | |
2271 | ||
2272 | ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL)); | |
2273 | ||
2274 | DBGLOG(P2P, TRACE, ("p2pFsmRunEventConnectionAbort: Connection Abort.\n")); | |
2275 | ||
2276 | prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; | |
2277 | ||
2278 | if (prP2pFsmInfo == NULL) { | |
2279 | break; | |
2280 | } | |
2281 | ||
2282 | prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); | |
2283 | ||
2284 | prDisconnMsg = (P_MSG_P2P_CONNECTION_ABORT_T)prMsgHdr; | |
2285 | ||
2286 | switch (prP2pBssInfo->eCurrentOPMode) { | |
2287 | case OP_MODE_INFRASTRUCTURE: | |
2288 | { | |
2289 | UINT_8 aucBCBSSID[] = BC_BSSID; | |
2290 | ||
2291 | if (!prP2pBssInfo->prStaRecOfAP) { | |
2292 | DBGLOG(P2P, TRACE, ("GO's StaRec is NULL\n")); | |
2293 | break; | |
2294 | } | |
2295 | if (UNEQUAL_MAC_ADDR(prP2pBssInfo->prStaRecOfAP->aucMacAddr, prDisconnMsg->aucTargetID) && | |
2296 | UNEQUAL_MAC_ADDR(prDisconnMsg->aucTargetID, aucBCBSSID)) { | |
2297 | DBGLOG(P2P, TRACE, ("Unequal MAC ADDR ["MACSTR":"MACSTR"]\n", | |
2298 | MAC2STR(prP2pBssInfo->prStaRecOfAP->aucMacAddr), | |
2299 | MAC2STR(prDisconnMsg->aucTargetID))); | |
2300 | break; | |
2301 | } | |
2302 | ||
2303 | ||
2304 | kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo, NULL, NULL, 0, 0); | |
2305 | ||
2306 | /* Stop rejoin timer if it is started. */ | |
2307 | // TODO: If it has. | |
2308 | ||
2309 | p2pFuncDisconnect(prAdapter, prP2pBssInfo->prStaRecOfAP, prDisconnMsg->fgSendDeauth, prDisconnMsg->u2ReasonCode); | |
2310 | ||
2311 | //prTargetStaRec = prP2pBssInfo->prStaRecOfAP; | |
2312 | ||
2313 | /* Fix possible KE when RX Beacon & call nicPmIndicateBssConnected(). hit prStaRecOfAP == NULL. */ | |
2314 | p2pChangeMediaState(prAdapter, PARAM_MEDIA_STATE_DISCONNECTED); | |
2315 | ||
2316 | prP2pBssInfo->prStaRecOfAP = NULL; | |
2317 | ||
2318 | SET_NET_PWR_STATE_IDLE(prAdapter, NETWORK_TYPE_P2P_INDEX); | |
2319 | ||
2320 | p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE); | |
2321 | ||
2322 | } | |
2323 | break; | |
2324 | case OP_MODE_ACCESS_POINT: | |
2325 | { | |
2326 | P_LINK_T prStaRecOfClientList = &prP2pBssInfo->rStaRecOfClientList; | |
2327 | /* Search specific client device, and disconnect. */ | |
2328 | /* 1. Send deauthentication frame. */ | |
2329 | /* 2. Indication: Device disconnect. */ | |
2330 | P_LINK_ENTRY_T prLinkEntry = (P_LINK_ENTRY_T)NULL; | |
2331 | P_STA_RECORD_T prCurrStaRec = (P_STA_RECORD_T)NULL; | |
2332 | ||
2333 | DBGLOG(P2P, TRACE, ("Disconnecting with Target ID: "MACSTR"\n", MAC2STR(prDisconnMsg->aucTargetID))); | |
2334 | ||
2335 | LINK_FOR_EACH(prLinkEntry, prStaRecOfClientList) { | |
2336 | prCurrStaRec = LINK_ENTRY(prLinkEntry, STA_RECORD_T, rLinkEntry); | |
2337 | ||
2338 | ASSERT(prCurrStaRec); | |
2339 | ||
2340 | if (EQUAL_MAC_ADDR(prCurrStaRec->aucMacAddr, prDisconnMsg->aucTargetID)) { | |
2341 | ||
2342 | DBGLOG(P2P, TRACE, ("Disconnecting: "MACSTR"\n", MAC2STR(prCurrStaRec->aucMacAddr))); | |
2343 | ||
2344 | /* Remove STA from client list. */ | |
2345 | LINK_REMOVE_KNOWN_ENTRY(prStaRecOfClientList, &prCurrStaRec->rLinkEntry); | |
2346 | ||
2347 | /* Glue layer indication. */ | |
2348 | //kalP2PGOStationUpdate(prAdapter->prGlueInfo, prCurrStaRec, FALSE); | |
2349 | ||
2350 | /* Send deauth & do indication. */ | |
2351 | p2pFuncDisconnect(prAdapter, prCurrStaRec, prDisconnMsg->fgSendDeauth, prDisconnMsg->u2ReasonCode); | |
2352 | ||
2353 | //prTargetStaRec = prCurrStaRec; | |
2354 | ||
2355 | break; | |
2356 | } | |
2357 | } | |
2358 | ||
2359 | } | |
2360 | break; | |
2361 | case OP_MODE_P2P_DEVICE: | |
2362 | default: | |
2363 | ASSERT(FALSE); | |
2364 | break; | |
2365 | } | |
2366 | ||
2367 | } while (FALSE); | |
2368 | ||
2369 | //20120830 moved into p2pFuncDisconnect() | |
2370 | //if ((!prDisconnMsg->fgSendDeauth) && (prTargetStaRec)) { | |
2371 | // cnmStaRecFree(prAdapter, prTargetStaRec, TRUE); | |
2372 | //} | |
2373 | ||
2374 | ||
2375 | if (prMsgHdr) { | |
2376 | cnmMemFree(prAdapter, prMsgHdr); | |
2377 | } | |
2378 | ||
2379 | return; | |
2380 | } /* p2pFsmRunEventConnectionAbort */ | |
2381 | ||
2382 | ||
2383 | VOID | |
2384 | p2pFsmRunEventDissolve ( | |
2385 | IN P_ADAPTER_T prAdapter, | |
2386 | IN P_MSG_HDR_T prMsgHdr | |
2387 | ) | |
2388 | { | |
2389 | ||
2390 | // TODO: | |
2391 | ||
2392 | DBGLOG(P2P, TRACE, ("p2pFsmRunEventDissolve\n")); | |
2393 | ||
2394 | if (prMsgHdr) { | |
2395 | cnmMemFree(prAdapter, prMsgHdr); | |
2396 | } | |
2397 | ||
2398 | return; | |
2399 | } | |
2400 | WLAN_STATUS | |
2401 | p2pFsmRunEventDeauthTxDone ( | |
2402 | IN P_ADAPTER_T prAdapter, | |
2403 | IN P_MSDU_INFO_T prMsduInfo, | |
2404 | IN ENUM_TX_RESULT_CODE_T rTxDoneStatus | |
2405 | ) | |
2406 | { | |
2407 | ||
2408 | P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL; | |
2409 | P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; | |
2410 | ENUM_PARAM_MEDIA_STATE_T eOriMediaStatus; | |
2411 | ||
2412 | do { | |
2413 | ||
2414 | ASSERT_BREAK((prAdapter != NULL) && | |
2415 | (prMsduInfo != NULL)); | |
2416 | ||
2417 | DBGLOG(P2P, TRACE, ("Deauth TX Done\n")); | |
2418 | ||
2419 | prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex); | |
2420 | ||
2421 | if (prStaRec == NULL) { | |
2422 | DBGLOG(P2P, TRACE, ("Station Record NULL, Index:%d\n", prMsduInfo->ucStaRecIndex)); | |
2423 | break; | |
2424 | } | |
2425 | ||
2426 | prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); | |
2427 | eOriMediaStatus = prP2pBssInfo->eConnectionState; | |
2428 | ||
2429 | ||
2430 | bssRemoveStaRecFromClientList(prAdapter, prP2pBssInfo, prStaRec); | |
2431 | ||
2432 | /**/ | |
2433 | cnmStaRecFree(prAdapter, prStaRec, TRUE); | |
2434 | ||
2435 | if ((prP2pBssInfo->eCurrentOPMode != OP_MODE_ACCESS_POINT) || | |
2436 | (prP2pBssInfo->rStaRecOfClientList.u4NumElem == 0)) { | |
2437 | DBGLOG(P2P, TRACE, ("No More Client, Media Status DISCONNECTED\n")); | |
2438 | p2pChangeMediaState(prAdapter, PARAM_MEDIA_STATE_DISCONNECTED); | |
2439 | } | |
2440 | ||
2441 | /* Because the eConnectionState is changed before Deauth TxDone. Dont Check eConnectionState */ | |
2442 | //if (eOriMediaStatus != prP2pBssInfo->eConnectionState) { | |
2443 | /* Update Disconnected state to FW. */ | |
2444 | nicUpdateBss(prAdapter, NETWORK_TYPE_P2P_INDEX); | |
2445 | //} | |
2446 | ||
2447 | ||
2448 | } while (FALSE); | |
2449 | ||
2450 | return WLAN_STATUS_SUCCESS; | |
2451 | } /* p2pFsmRunEventDeauthTxDone */ | |
2452 | ||
2453 | ||
2454 | WLAN_STATUS | |
2455 | p2pFsmRunEventMgmtFrameTxDone ( | |
2456 | IN P_ADAPTER_T prAdapter, | |
2457 | IN P_MSDU_INFO_T prMsduInfo, | |
2458 | IN ENUM_TX_RESULT_CODE_T rTxDoneStatus | |
2459 | ) | |
2460 | { | |
2461 | P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; | |
2462 | P_P2P_MGMT_TX_REQ_INFO_T prMgmtTxReqInfo = (P_P2P_MGMT_TX_REQ_INFO_T)NULL; | |
2463 | BOOLEAN fgIsSuccess = FALSE; | |
2464 | ||
2465 | do { | |
2466 | ASSERT_BREAK((prAdapter != NULL) && (prMsduInfo != NULL)); | |
2467 | ||
2468 | prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; | |
2469 | prMgmtTxReqInfo = &(prP2pFsmInfo->rMgmtTxInfo); | |
2470 | ||
2471 | if (rTxDoneStatus != TX_RESULT_SUCCESS) { | |
2472 | DBGLOG(P2P, TRACE, ("Mgmt Frame TX Fail, Status:%d.\n", rTxDoneStatus)); | |
2473 | } | |
2474 | else { | |
2475 | fgIsSuccess = TRUE; | |
2476 | DBGLOG(P2P, TRACE, ("Mgmt Frame TX Done.\n")); | |
2477 | } | |
2478 | ||
2479 | ||
2480 | if (prMgmtTxReqInfo->prMgmtTxMsdu == prMsduInfo) { | |
2481 | kalP2PIndicateMgmtTxStatus(prAdapter->prGlueInfo, | |
2482 | prMgmtTxReqInfo->u8Cookie, | |
2483 | fgIsSuccess, | |
2484 | prMsduInfo->prPacket, | |
2485 | (UINT_32)prMsduInfo->u2FrameLength); | |
2486 | ||
2487 | prMgmtTxReqInfo->prMgmtTxMsdu = NULL; | |
2488 | } | |
2489 | ||
2490 | } while (FALSE); | |
2491 | ||
2492 | return WLAN_STATUS_SUCCESS; | |
2493 | ||
2494 | } /* p2pFsmRunEventMgmtFrameTxDone */ | |
2495 | ||
2496 | ||
2497 | /*----------------------------------------------------------------------------*/ | |
2498 | /*! | |
2499 | * \brief This function is called when JOIN complete message event is received from SAA. | |
2500 | * | |
2501 | * \param[in] prAdapter Pointer of ADAPTER_T | |
2502 | * | |
2503 | * \return none | |
2504 | */ | |
2505 | /*----------------------------------------------------------------------------*/ | |
2506 | VOID | |
2507 | p2pFsmRunEventJoinComplete ( | |
2508 | IN P_ADAPTER_T prAdapter, | |
2509 | IN P_MSG_HDR_T prMsgHdr | |
2510 | ) | |
2511 | { | |
2512 | P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; | |
2513 | P_P2P_JOIN_INFO_T prJoinInfo = (P_P2P_JOIN_INFO_T)NULL; | |
2514 | P_MSG_JOIN_COMP_T prJoinCompMsg = (P_MSG_JOIN_COMP_T)NULL; | |
2515 | P_SW_RFB_T prAssocRspSwRfb = (P_SW_RFB_T)NULL; | |
2516 | P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; | |
2517 | ||
2518 | do { | |
2519 | ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL)); | |
2520 | ||
2521 | DBGLOG(P2P, TRACE, ("P2P Join Complete\n")); | |
2522 | ||
2523 | prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; | |
2524 | ||
2525 | if (prP2pFsmInfo == NULL) { | |
2526 | break; | |
2527 | } | |
2528 | ||
2529 | ||
2530 | prJoinInfo = &(prP2pFsmInfo->rJoinInfo); | |
2531 | prJoinCompMsg = (P_MSG_JOIN_COMP_T)prMsgHdr; | |
2532 | prAssocRspSwRfb = prJoinCompMsg->prSwRfb; | |
2533 | prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); | |
2534 | ||
2535 | if (prP2pBssInfo->eCurrentOPMode == OP_MODE_INFRASTRUCTURE) { | |
2536 | P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL; | |
2537 | ||
2538 | prStaRec = prJoinCompMsg->prStaRec; | |
2539 | ||
2540 | /* Check SEQ NUM */ | |
2541 | if (prJoinCompMsg->ucSeqNum == prJoinInfo->ucSeqNumOfReqMsg) { | |
2542 | ASSERT(prStaRec == prJoinInfo->prTargetStaRec); | |
2543 | prJoinInfo->fgIsJoinComplete = TRUE; | |
2544 | ||
2545 | if (prJoinCompMsg->rJoinStatus == WLAN_STATUS_SUCCESS) { | |
2546 | ||
2547 | //4 <1.1> Change FW's Media State immediately. | |
2548 | p2pChangeMediaState(prAdapter, PARAM_MEDIA_STATE_CONNECTED); | |
2549 | ||
2550 | //4 <1.2> Deactivate previous AP's STA_RECORD_T in Driver if have. | |
2551 | if ((prP2pBssInfo->prStaRecOfAP) && | |
2552 | (prP2pBssInfo->prStaRecOfAP != prStaRec)) { | |
2553 | cnmStaRecChangeState(prAdapter, prP2pBssInfo->prStaRecOfAP, STA_STATE_1); | |
2554 | ||
2555 | cnmStaRecFree(prAdapter, prP2pBssInfo->prStaRecOfAP, TRUE); | |
2556 | ||
2557 | prP2pBssInfo->prStaRecOfAP = NULL; | |
2558 | } | |
2559 | ||
2560 | //4 <1.3> Update BSS_INFO_T | |
2561 | p2pFuncUpdateBssInfoForJOIN(prAdapter, prP2pFsmInfo->prTargetBss, prStaRec, prAssocRspSwRfb); | |
2562 | ||
2563 | //4 <1.4> Activate current AP's STA_RECORD_T in Driver. | |
2564 | cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_3); | |
2565 | DBGLOG(P2P, INFO, ("P2P GC Join Success\n")); | |
2566 | ||
2567 | #if CFG_SUPPORT_P2P_RSSI_QUERY | |
2568 | //<1.5> Update RSSI if necessary | |
2569 | nicUpdateRSSI(prAdapter, NETWORK_TYPE_P2P_INDEX, (INT_8)(RCPI_TO_dBm(prStaRec->ucRCPI)), 0); | |
2570 | #endif | |
2571 | ||
2572 | //4 <1.6> Indicate Connected Event to Host immediately. | |
2573 | /* Require BSSID, Association ID, Beacon Interval.. from AIS_BSS_INFO_T */ | |
2574 | //p2pIndicationOfMediaStateToHost(prAdapter, PARAM_MEDIA_STATE_CONNECTED, prStaRec->aucMacAddr); | |
2575 | if(prP2pFsmInfo->prTargetBss) | |
2576 | scanReportBss2Cfg80211(prAdapter,OP_MODE_P2P_DEVICE,prP2pFsmInfo->prTargetBss); | |
2577 | kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo, | |
2578 | &prP2pFsmInfo->rConnReqInfo, | |
2579 | prJoinInfo->aucIEBuf, | |
2580 | prJoinInfo->u4BufLength, | |
2581 | prStaRec->u2StatusCode); | |
2582 | /* ALPS01912628 */ | |
2583 | /* Driver will not CMD_ID_INDICATE_PM_BSS_CONNECT to firmware due to not RX beacon | |
2584 | * firmware will report beacon timeout with TYPE=2 to driver ; here just stop the beacon timeout | |
2585 | * TYPE=2 timer. Driver will update the DTIMPeriod late if RX beacon | |
2586 | */ | |
2587 | if (!prP2pBssInfo->fgIsIndicatedPMBssConn) { | |
2588 | if (prP2pBssInfo->ucDTIMPeriod == 0) | |
2589 | if (prP2pFsmInfo->prTargetBss) | |
2590 | /* get DTIMPeriod of targetBss, driver will update later if RX beacon */ | |
2591 | prP2pBssInfo->ucDTIMPeriod = prP2pFsmInfo->prTargetBss->ucDTIMPeriod; | |
2592 | else | |
2593 | prP2pBssInfo->ucDTIMPeriod = 1; /* assign 1, driver will update later if RX beacon */ | |
2594 | nicPmIndicateBssConnected(prAdapter, NETWORK_TYPE_P2P_INDEX); | |
2595 | DBGLOG(P2P, INFO, ("P2P: GC join success, indicate BSS connect, DTIMPeriod %d from: %s\n", | |
2596 | prP2pBssInfo->ucDTIMPeriod, prP2pFsmInfo->prTargetBss? "TargetBss":"Pickup")); | |
2597 | prP2pBssInfo->fgIsIndicatedPMBssConn = TRUE; | |
2598 | prP2pBssInfo->ucDTIMPeriod = 0; /* give driver a chance to update later if RX beacon */ | |
2599 | } | |
2600 | } | |
2601 | else { | |
2602 | /* Join Fail*/ | |
2603 | //4 <2.1> Redo JOIN process with other Auth Type if possible | |
2604 | if (p2pFuncRetryJOIN(prAdapter, prStaRec, prJoinInfo) == FALSE) { | |
2605 | P_BSS_DESC_T prBssDesc; | |
2606 | ||
2607 | /* Increase Failure Count */ | |
2608 | prStaRec->ucJoinFailureCount++; | |
2609 | ||
2610 | prBssDesc = prP2pFsmInfo->prTargetBss; | |
2611 | ||
2612 | ASSERT(prBssDesc); | |
2613 | ASSERT(prBssDesc->fgIsConnecting); | |
2614 | ||
2615 | prBssDesc->fgIsConnecting = FALSE; | |
2616 | ||
2617 | if( prStaRec->ucJoinFailureCount >=3) { | |
2618 | ||
2619 | kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo, | |
2620 | &prP2pFsmInfo->rConnReqInfo, | |
2621 | prJoinInfo->aucIEBuf, | |
2622 | prJoinInfo->u4BufLength, | |
2623 | prStaRec->u2StatusCode); | |
2624 | } | |
2625 | else { | |
2626 | /* Sometime the GO is not ready to response auth. Connect it again*/ | |
2627 | prP2pFsmInfo->prTargetBss = NULL; | |
2628 | } | |
2629 | DBGLOG(P2P, INFO, ("P2P GC Join Failed\n")); | |
2630 | ||
2631 | ||
2632 | } | |
2633 | ||
2634 | } | |
2635 | } | |
2636 | } | |
2637 | ||
2638 | if (prAssocRspSwRfb) { | |
2639 | nicRxReturnRFB(prAdapter, prAssocRspSwRfb); | |
2640 | } | |
2641 | ||
2642 | if (prP2pFsmInfo->eCurrentState == P2P_STATE_GC_JOIN) { | |
2643 | ||
2644 | if(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX].eConnectionState == PARAM_MEDIA_STATE_CONNECTED) { | |
2645 | /* Return to IDLE state. */ | |
2646 | p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE); | |
2647 | } | |
2648 | else { | |
2649 | //p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE); | |
2650 | /* one more scan */ | |
2651 | p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_SCAN); | |
2652 | } | |
2653 | } | |
2654 | ||
2655 | } while (FALSE); | |
2656 | ||
2657 | if (prMsgHdr) { | |
2658 | cnmMemFree(prAdapter, prMsgHdr); | |
2659 | } | |
2660 | ||
2661 | return; | |
2662 | ||
2663 | } /* p2pFsmRunEventJoinComplete */ | |
2664 | ||
2665 | ||
2666 | ||
2667 | VOID | |
2668 | p2pFsmRunEventMgmtFrameRegister ( | |
2669 | IN P_ADAPTER_T prAdapter, | |
2670 | IN P_MSG_HDR_T prMsgHdr | |
2671 | ) | |
2672 | { | |
2673 | P_MSG_P2P_MGMT_FRAME_REGISTER_T prMgmtFrameRegister = (P_MSG_P2P_MGMT_FRAME_REGISTER_T)NULL; | |
2674 | P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; | |
2675 | ||
2676 | do { | |
2677 | ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL)); | |
2678 | ||
2679 | prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; | |
2680 | ||
2681 | if (prP2pFsmInfo == NULL) { | |
2682 | break; | |
2683 | } | |
2684 | ||
2685 | prMgmtFrameRegister = (P_MSG_P2P_MGMT_FRAME_REGISTER_T)prMsgHdr; | |
2686 | ||
2687 | p2pFuncMgmtFrameRegister(prAdapter, | |
2688 | prMgmtFrameRegister->u2FrameType, | |
2689 | prMgmtFrameRegister->fgIsRegister, | |
2690 | &prP2pFsmInfo->u4P2pPacketFilter); | |
2691 | ||
2692 | ||
2693 | } while (FALSE); | |
2694 | ||
2695 | if (prMsgHdr) { | |
2696 | cnmMemFree(prAdapter, prMsgHdr); | |
2697 | } | |
2698 | ||
2699 | return; | |
2700 | ||
2701 | } /* p2pFsmRunEventMgmtFrameRegister */ | |
2702 | ||
2703 | ||
2704 | ||
2705 | ||
2706 | #if 0 | |
2707 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
2708 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
2709 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
2710 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
2711 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
2712 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
2713 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
2714 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
2715 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
2716 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
2717 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
2718 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
2719 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
2720 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
2721 | #endif | |
2722 | ||
2723 | ||
2724 | ||
2725 | ||
2726 | ||
2727 | ||
2728 | ||
2729 | /*----------------------------------------------------------------------------*/ | |
2730 | /*! | |
2731 | * \brief This function is call when RX deauthentication frame from the AIR. | |
2732 | * If we are under STA mode, we would go back to P2P Device. | |
2733 | * If we are under AP mode, we would stay in AP mode until disconnect event from HOST. | |
2734 | * | |
2735 | * \param[in] prAdapter Pointer of ADAPTER_T | |
2736 | * | |
2737 | * \return none | |
2738 | */ | |
2739 | /*----------------------------------------------------------------------------*/ | |
2740 | VOID | |
2741 | p2pFsmRunEventRxDeauthentication ( | |
2742 | IN P_ADAPTER_T prAdapter, | |
2743 | IN P_STA_RECORD_T prStaRec, | |
2744 | IN P_SW_RFB_T prSwRfb | |
2745 | ) | |
2746 | { | |
2747 | ||
2748 | P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; | |
2749 | P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; | |
2750 | UINT_16 u2ReasonCode = 0; | |
2751 | ||
2752 | do { | |
2753 | ASSERT_BREAK((prAdapter != NULL) && (prSwRfb != NULL)); | |
2754 | ||
2755 | if (prStaRec == NULL) { | |
2756 | prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx); | |
2757 | } | |
2758 | prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; | |
2759 | ||
2760 | if (prP2pFsmInfo == NULL) { | |
2761 | break; | |
2762 | } | |
2763 | ||
2764 | if (!prStaRec) { | |
2765 | break; | |
2766 | } | |
2767 | ||
2768 | ||
2769 | prP2pBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]; | |
2770 | ||
2771 | if (prStaRec->ucStaState == STA_STATE_1) { | |
2772 | break; | |
2773 | } | |
2774 | ||
2775 | DBGLOG(P2P, TRACE, ("RX Deauth\n")); | |
2776 | ||
2777 | switch (prP2pBssInfo->eCurrentOPMode) { | |
2778 | case OP_MODE_INFRASTRUCTURE: | |
2779 | if (authProcessRxDeauthFrame(prSwRfb, | |
2780 | prStaRec->aucMacAddr, | |
2781 | &u2ReasonCode) == WLAN_STATUS_SUCCESS) { | |
2782 | P_WLAN_DEAUTH_FRAME_T prDeauthFrame = (P_WLAN_DEAUTH_FRAME_T)prSwRfb->pvHeader; | |
2783 | UINT_16 u2IELength = 0; | |
2784 | ||
2785 | if (prP2pBssInfo->prStaRecOfAP != prStaRec) { | |
2786 | break; | |
2787 | } | |
2788 | ||
2789 | ||
2790 | prStaRec->u2ReasonCode = u2ReasonCode; | |
2791 | u2IELength = prSwRfb->u2PacketLen - (WLAN_MAC_HEADER_LEN + REASON_CODE_FIELD_LEN); | |
2792 | ||
2793 | ASSERT(prP2pBssInfo->prStaRecOfAP == prStaRec); | |
2794 | ||
2795 | /* Indicate disconnect to Host. */ | |
2796 | kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo, | |
2797 | NULL, | |
2798 | prDeauthFrame->aucInfoElem, | |
2799 | u2IELength, | |
2800 | u2ReasonCode); | |
2801 | ||
2802 | prP2pBssInfo->prStaRecOfAP = NULL; | |
2803 | ||
2804 | p2pFuncDisconnect(prAdapter, prStaRec, FALSE, u2ReasonCode); | |
2805 | p2pChangeMediaState(prAdapter, PARAM_MEDIA_STATE_DISCONNECTED); | |
2806 | ||
2807 | SET_NET_PWR_STATE_IDLE(prAdapter, NETWORK_TYPE_P2P_INDEX); | |
2808 | ||
2809 | p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE); | |
2810 | } | |
2811 | break; | |
2812 | case OP_MODE_ACCESS_POINT: | |
2813 | /* Delete client from client list. */ | |
2814 | if (authProcessRxDeauthFrame(prSwRfb, | |
2815 | prP2pBssInfo->aucBSSID, | |
2816 | &u2ReasonCode) == WLAN_STATUS_SUCCESS) { | |
2817 | P_LINK_T prStaRecOfClientList = (P_LINK_T)NULL; | |
2818 | P_LINK_ENTRY_T prLinkEntry = (P_LINK_ENTRY_T)NULL; | |
2819 | P_STA_RECORD_T prCurrStaRec = (P_STA_RECORD_T)NULL; | |
2820 | ||
2821 | prStaRecOfClientList = &prP2pBssInfo->rStaRecOfClientList; | |
2822 | ||
2823 | LINK_FOR_EACH(prLinkEntry, prStaRecOfClientList) { | |
2824 | prCurrStaRec = LINK_ENTRY(prLinkEntry, STA_RECORD_T, rLinkEntry); | |
2825 | ||
2826 | ASSERT(prCurrStaRec); | |
2827 | ||
2828 | if (EQUAL_MAC_ADDR(prCurrStaRec->aucMacAddr, prStaRec->aucMacAddr)) { | |
2829 | ||
2830 | /* Remove STA from client list. */ | |
2831 | LINK_REMOVE_KNOWN_ENTRY(prStaRecOfClientList, &prCurrStaRec->rLinkEntry); | |
2832 | ||
2833 | /* Indicate to Host. */ | |
2834 | //kalP2PGOStationUpdate(prAdapter->prGlueInfo, prStaRec, FALSE); | |
2835 | ||
2836 | /* Indicate disconnect to Host. */ | |
2837 | p2pFuncDisconnect(prAdapter, prStaRec, FALSE, u2ReasonCode); | |
2838 | ||
2839 | break; | |
2840 | } | |
2841 | } | |
2842 | } | |
2843 | break; | |
2844 | case OP_MODE_P2P_DEVICE: | |
2845 | default: | |
2846 | /* Findout why someone sent deauthentication frame to us. */ | |
2847 | ASSERT(FALSE); | |
2848 | break; | |
2849 | } | |
2850 | ||
2851 | DBGLOG(P2P, TRACE, ("Deauth Reason:%d\n", u2ReasonCode)); | |
2852 | ||
2853 | } while (FALSE); | |
2854 | ||
2855 | return; | |
2856 | } /* p2pFsmRunEventRxDeauthentication */ | |
2857 | ||
2858 | /*----------------------------------------------------------------------------*/ | |
2859 | /*! | |
2860 | * \brief This function is call when RX deauthentication frame from the AIR. | |
2861 | * If we are under STA mode, we would go back to P2P Device. | |
2862 | * If we are under AP mode, we would stay in AP mode until disconnect event from HOST. | |
2863 | * | |
2864 | * \param[in] prAdapter Pointer of ADAPTER_T | |
2865 | * | |
2866 | * \return none | |
2867 | */ | |
2868 | /*----------------------------------------------------------------------------*/ | |
2869 | VOID | |
2870 | p2pFsmRunEventRxDisassociation ( | |
2871 | IN P_ADAPTER_T prAdapter, | |
2872 | IN P_STA_RECORD_T prStaRec, | |
2873 | IN P_SW_RFB_T prSwRfb | |
2874 | ) | |
2875 | { | |
2876 | P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; | |
2877 | P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; | |
2878 | UINT_16 u2ReasonCode = 0; | |
2879 | ||
2880 | do { | |
2881 | ASSERT_BREAK((prAdapter != NULL) && (prSwRfb != NULL)); | |
2882 | prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; | |
2883 | ||
2884 | if (prP2pFsmInfo == NULL) { | |
2885 | break; | |
2886 | } | |
2887 | ||
2888 | if (prStaRec == NULL) { | |
2889 | prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx); | |
2890 | } | |
2891 | ||
2892 | ||
2893 | prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); | |
2894 | ||
2895 | if (prStaRec->ucStaState == STA_STATE_1) { | |
2896 | ||
2897 | break; | |
2898 | } | |
2899 | ||
2900 | DBGLOG(P2P, TRACE, ("RX Disassoc\n")); | |
2901 | ||
2902 | switch (prP2pBssInfo->eCurrentOPMode) { | |
2903 | case OP_MODE_INFRASTRUCTURE: | |
2904 | if (assocProcessRxDisassocFrame(prAdapter, | |
2905 | prSwRfb, | |
2906 | prStaRec->aucMacAddr, | |
2907 | &prStaRec->u2ReasonCode) == WLAN_STATUS_SUCCESS) { | |
2908 | P_WLAN_DISASSOC_FRAME_T prDisassocFrame = (P_WLAN_DISASSOC_FRAME_T)prSwRfb->pvHeader; | |
2909 | UINT_16 u2IELength = 0; | |
2910 | ||
2911 | ASSERT(prP2pBssInfo->prStaRecOfAP == prStaRec); | |
2912 | ||
2913 | if (prP2pBssInfo->prStaRecOfAP != prStaRec) { | |
2914 | break; | |
2915 | } | |
2916 | ||
2917 | ||
2918 | u2IELength = prSwRfb->u2PacketLen - (WLAN_MAC_HEADER_LEN + REASON_CODE_FIELD_LEN); | |
2919 | ||
2920 | /* Indicate disconnect to Host. */ | |
2921 | kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo, | |
2922 | NULL, | |
2923 | prDisassocFrame->aucInfoElem, | |
2924 | u2IELength, | |
2925 | prStaRec->u2ReasonCode); | |
2926 | ||
2927 | prP2pBssInfo->prStaRecOfAP = NULL; | |
2928 | ||
2929 | p2pFuncDisconnect(prAdapter, prStaRec, FALSE, prStaRec->u2ReasonCode); | |
2930 | p2pChangeMediaState(prAdapter, PARAM_MEDIA_STATE_DISCONNECTED); | |
2931 | SET_NET_PWR_STATE_IDLE(prAdapter, NETWORK_TYPE_P2P_INDEX); | |
2932 | p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE); | |
2933 | ||
2934 | } | |
2935 | break; | |
2936 | case OP_MODE_ACCESS_POINT: | |
2937 | /* Delete client from client list. */ | |
2938 | if (assocProcessRxDisassocFrame(prAdapter, | |
2939 | prSwRfb, | |
2940 | prP2pBssInfo->aucBSSID, | |
2941 | &u2ReasonCode) == WLAN_STATUS_SUCCESS) { | |
2942 | P_LINK_T prStaRecOfClientList = (P_LINK_T)NULL; | |
2943 | P_LINK_ENTRY_T prLinkEntry = (P_LINK_ENTRY_T)NULL; | |
2944 | P_STA_RECORD_T prCurrStaRec = (P_STA_RECORD_T)NULL; | |
2945 | ||
2946 | prStaRecOfClientList = &prP2pBssInfo->rStaRecOfClientList; | |
2947 | ||
2948 | LINK_FOR_EACH(prLinkEntry, prStaRecOfClientList) { | |
2949 | prCurrStaRec = LINK_ENTRY(prLinkEntry, STA_RECORD_T, rLinkEntry); | |
2950 | ||
2951 | ASSERT(prCurrStaRec); | |
2952 | ||
2953 | if (EQUAL_MAC_ADDR(prCurrStaRec->aucMacAddr, prStaRec->aucMacAddr)) { | |
2954 | ||
2955 | /* Remove STA from client list. */ | |
2956 | LINK_REMOVE_KNOWN_ENTRY(prStaRecOfClientList, &prCurrStaRec->rLinkEntry); | |
2957 | ||
2958 | /* Indicate to Host. */ | |
2959 | //kalP2PGOStationUpdate(prAdapter->prGlueInfo, prStaRec, FALSE); | |
2960 | ||
2961 | /* Indicate disconnect to Host. */ | |
2962 | p2pFuncDisconnect(prAdapter, prStaRec, FALSE, u2ReasonCode); | |
2963 | ||
2964 | break; | |
2965 | } | |
2966 | } | |
2967 | } | |
2968 | break; | |
2969 | case OP_MODE_P2P_DEVICE: | |
2970 | default: | |
2971 | ASSERT(FALSE); | |
2972 | break; | |
2973 | } | |
2974 | ||
2975 | ||
2976 | } while (FALSE); | |
2977 | ||
2978 | return; | |
2979 | } /* p2pFsmRunEventRxDisassociation */ | |
2980 | ||
2981 | ||
2982 | ||
2983 | ||
2984 | ||
2985 | /*----------------------------------------------------------------------------*/ | |
2986 | /*! | |
2987 | * \brief This function is called when a probe request frame is received. | |
2988 | * | |
2989 | * \param[in] prAdapter Pointer of ADAPTER_T | |
2990 | * | |
2991 | * \return boolean value if probe response frame is accepted & need cancel scan request. | |
2992 | */ | |
2993 | /*----------------------------------------------------------------------------*/ | |
2994 | VOID | |
2995 | p2pFsmRunEventRxProbeResponseFrame ( | |
2996 | IN P_ADAPTER_T prAdapter, | |
2997 | IN P_SW_RFB_T prSwRfb, | |
2998 | IN P_BSS_DESC_T prBssDesc | |
2999 | ) | |
3000 | { | |
3001 | P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; | |
3002 | P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = (P_P2P_CONNECTION_SETTINGS_T)NULL; | |
3003 | P_WLAN_MAC_MGMT_HEADER_T prMgtHdr = (P_WLAN_MAC_MGMT_HEADER_T)NULL; | |
3004 | P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; | |
3005 | ||
3006 | do { | |
3007 | ASSERT_BREAK((prAdapter != NULL) && (prSwRfb != NULL) && (prBssDesc != NULL)); | |
3008 | ||
3009 | prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; | |
3010 | prP2pConnSettings = prAdapter->rWifiVar.prP2PConnSettings; | |
3011 | prP2pBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]; | |
3012 | ||
3013 | /* There is a connection request. */ | |
3014 | prMgtHdr = (P_WLAN_MAC_MGMT_HEADER_T)prSwRfb->pvHeader; | |
3015 | ||
3016 | } while (FALSE); | |
3017 | ||
3018 | return; | |
3019 | } /* p2pFsmRunEventRxProbeResponseFrame */ | |
3020 | ||
3021 | ||
3022 | ||
3023 | ||
3024 | ||
3025 | ||
3026 | VOID | |
3027 | p2pFsmRunEventBeaconTimeout ( | |
3028 | IN P_ADAPTER_T prAdapter | |
3029 | ) | |
3030 | { | |
3031 | P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; | |
3032 | P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; | |
3033 | ||
3034 | do { | |
3035 | ASSERT_BREAK(prAdapter != NULL); | |
3036 | ||
3037 | prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; | |
3038 | prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); | |
3039 | ||
3040 | DBGLOG(P2P, TRACE, ("p2pFsmRunEventBeaconTimeout: Beacon Timeout\n")); | |
3041 | ||
3042 | /* Only client mode would have beacon lost event. */ | |
3043 | ASSERT(prP2pBssInfo->eCurrentOPMode == OP_MODE_INFRASTRUCTURE); | |
3044 | ||
3045 | if (prP2pBssInfo->eConnectionState == PARAM_MEDIA_STATE_CONNECTED) { | |
3046 | /* Indicate disconnect to Host. */ | |
3047 | kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo, | |
3048 | NULL, | |
3049 | NULL, | |
3050 | 0, | |
3051 | REASON_CODE_DISASSOC_INACTIVITY); | |
3052 | ||
3053 | if (prP2pBssInfo->prStaRecOfAP != NULL) { | |
3054 | P_STA_RECORD_T prStaRec = prP2pBssInfo->prStaRecOfAP; | |
3055 | ||
3056 | prP2pBssInfo->prStaRecOfAP = NULL; | |
3057 | ||
3058 | p2pFuncDisconnect(prAdapter, prStaRec, FALSE, REASON_CODE_DISASSOC_LEAVING_BSS); | |
3059 | ||
3060 | //20120830 moved into p2pFuncDisconnect() | |
3061 | //cnmStaRecFree(prAdapter, prP2pBssInfo->prStaRecOfAP, TRUE); | |
3062 | p2pChangeMediaState(prAdapter, PARAM_MEDIA_STATE_DISCONNECTED); | |
3063 | SET_NET_PWR_STATE_IDLE(prAdapter, NETWORK_TYPE_P2P_INDEX); | |
3064 | p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE); | |
3065 | ||
3066 | ||
3067 | } | |
3068 | } | |
3069 | } while (FALSE); | |
3070 | ||
3071 | return; | |
3072 | } /* p2pFsmRunEventBeaconTimeout */ | |
3073 | ||
3074 | ||
3075 | ||
3076 | ||
3077 | #if CFG_SUPPORT_WFD | |
3078 | VOID | |
3079 | p2pFsmRunEventWfdSettingUpdate ( | |
3080 | IN P_ADAPTER_T prAdapter, | |
3081 | IN P_MSG_HDR_T prMsgHdr | |
3082 | ) | |
3083 | { | |
3084 | P_WFD_CFG_SETTINGS_T prWfdCfgSettings = (P_WFD_CFG_SETTINGS_T)NULL; | |
3085 | P_MSG_WFD_CONFIG_SETTINGS_CHANGED_T prMsgWfdCfgSettings = (P_MSG_WFD_CONFIG_SETTINGS_CHANGED_T)NULL; | |
3086 | WLAN_STATUS rStatus; | |
3087 | ||
3088 | ||
3089 | DBGLOG(P2P, INFO,("p2pFsmRunEventWfdSettingUpdate\n")); | |
3090 | ||
3091 | do { | |
3092 | ASSERT_BREAK((prAdapter != NULL)); | |
3093 | ||
3094 | if (prMsgHdr != NULL) { | |
3095 | prMsgWfdCfgSettings = (P_MSG_WFD_CONFIG_SETTINGS_CHANGED_T)prMsgHdr; | |
3096 | prWfdCfgSettings = prMsgWfdCfgSettings->prWfdCfgSettings; | |
3097 | } | |
3098 | else { | |
3099 | prWfdCfgSettings = &prAdapter->rWifiVar.prP2pFsmInfo->rWfdConfigureSettings; | |
3100 | } | |
3101 | ||
3102 | DBGLOG(P2P, INFO,("WFD Enalbe %x info %x state %x flag %x adv %x\n", | |
3103 | prWfdCfgSettings->ucWfdEnable, | |
3104 | prWfdCfgSettings->u2WfdDevInfo, | |
3105 | (UINT_32)prWfdCfgSettings->u4WfdState, | |
3106 | (UINT_32)prWfdCfgSettings->u4WfdFlag, | |
3107 | (UINT_32)prWfdCfgSettings->u4WfdAdvancedFlag)); | |
3108 | ||
3109 | rStatus = wlanSendSetQueryCmd ( | |
3110 | prAdapter, /* prAdapter */ | |
3111 | CMD_ID_SET_WFD_CTRL, /* ucCID */ | |
3112 | TRUE, /* fgSetQuery */ | |
3113 | FALSE, /* fgNeedResp */ | |
3114 | FALSE, /* fgIsOid */ | |
3115 | NULL, | |
3116 | NULL, /* pfCmdTimeoutHandler */ | |
3117 | sizeof(WFD_CFG_SETTINGS_T), /* u4SetQueryInfoLen */ | |
3118 | (PUINT_8)prWfdCfgSettings, /* pucInfoBuffer */ | |
3119 | NULL, /* pvSetQueryBuffer */ | |
3120 | 0 /* u4SetQueryBufferLen */ | |
3121 | ); | |
3122 | ||
3123 | } while (FALSE); | |
3124 | ||
3125 | return; | |
3126 | ||
3127 | } | |
3128 | /* p2pFsmRunEventWfdSettingUpdate */ | |
3129 | ||
3130 | #endif | |
3131 | ||
3132 | ||
3133 | ||
3134 | ||
3135 | ||
3136 | ||
3137 | ||
3138 | ||
3139 | /*----------------------------------------------------------------------------*/ | |
3140 | /*! | |
3141 | * @brief This function is used to generate P2P IE for Beacon frame. | |
3142 | * | |
3143 | * @param[in] prMsduInfo Pointer to the composed MSDU_INFO_T. | |
3144 | * | |
3145 | * @return none | |
3146 | */ | |
3147 | /*----------------------------------------------------------------------------*/ | |
3148 | VOID | |
3149 | p2pGenerateP2P_IEForAssocReq ( | |
3150 | IN P_ADAPTER_T prAdapter, | |
3151 | IN P_MSDU_INFO_T prMsduInfo | |
3152 | ) | |
3153 | { | |
3154 | P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; | |
3155 | P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL; | |
3156 | ||
3157 | do { | |
3158 | ASSERT_BREAK((prAdapter != NULL) && (prMsduInfo != NULL)); | |
3159 | ||
3160 | prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; | |
3161 | ||
3162 | prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex); | |
3163 | ||
3164 | if (IS_STA_P2P_TYPE(prStaRec)) { | |
3165 | // TODO: | |
3166 | } | |
3167 | ||
3168 | } while (FALSE); | |
3169 | ||
3170 | return; | |
3171 | ||
3172 | } /* end of p2pGenerateP2P_IEForAssocReq() */ | |
3173 | ||
3174 | ||
3175 | ||
3176 | ||
3177 | /*----------------------------------------------------------------------------*/ | |
3178 | /*! | |
3179 | * @brief This function is used to generate P2P IE for Probe Request frame. | |
3180 | * | |
3181 | * @param[in] prMsduInfo Pointer to the composed MSDU_INFO_T. | |
3182 | * | |
3183 | * @return none | |
3184 | */ | |
3185 | /*----------------------------------------------------------------------------*/ | |
3186 | VOID | |
3187 | p2pGenerateP2P_IEForProbeReq ( | |
3188 | IN P_ADAPTER_T prAdapter, | |
3189 | IN PUINT_16 pu2Offset, | |
3190 | IN PUINT_8 pucBuf, | |
3191 | IN UINT_16 u2BufSize | |
3192 | ) | |
3193 | { | |
3194 | ASSERT(prAdapter); | |
3195 | ASSERT(pucBuf); | |
3196 | ||
3197 | // TODO: | |
3198 | ||
3199 | return; | |
3200 | ||
3201 | } /* end of p2pGenerateP2P_IEForProbReq() */ | |
3202 | ||
3203 | ||
3204 | ||
3205 | ||
3206 | /*----------------------------------------------------------------------------*/ | |
3207 | /*! | |
3208 | * @brief This function is used to calculate P2P IE length for Beacon frame. | |
3209 | * | |
3210 | * @param[in] eNetTypeIndex Specify which network | |
3211 | * @param[in] prStaRec Pointer to the STA_RECORD_T | |
3212 | * | |
3213 | * @return The length of P2P IE added | |
3214 | */ | |
3215 | /*----------------------------------------------------------------------------*/ | |
3216 | UINT_32 | |
3217 | p2pCalculateP2P_IELenForProbeReq ( | |
3218 | IN P_ADAPTER_T prAdapter, | |
3219 | IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex, | |
3220 | IN P_STA_RECORD_T prStaRec | |
3221 | ) | |
3222 | { | |
3223 | ||
3224 | if (eNetTypeIndex != NETWORK_TYPE_P2P_INDEX) { | |
3225 | return 0; | |
3226 | } | |
3227 | ||
3228 | // TODO: | |
3229 | ||
3230 | return 0; | |
3231 | ||
3232 | } /* end of p2pCalculateP2P_IELenForProbeReq() */ | |
3233 | ||
3234 | ||
3235 | ||
3236 | ||
3237 | ||
3238 | /*----------------------------------------------------------------------------*/ | |
3239 | /*! | |
3240 | * @brief This function will indiate the Event of Tx Fail of AAA Module. | |
3241 | * | |
3242 | * @param[in] prAdapter Pointer to the Adapter structure. | |
3243 | * @param[in] prStaRec Pointer to the STA_RECORD_T | |
3244 | * | |
3245 | * @return (none) | |
3246 | */ | |
3247 | /*----------------------------------------------------------------------------*/ | |
3248 | VOID | |
3249 | p2pRunEventAAATxFail ( | |
3250 | IN P_ADAPTER_T prAdapter, | |
3251 | IN P_STA_RECORD_T prStaRec | |
3252 | ) | |
3253 | { | |
3254 | P_BSS_INFO_T prBssInfo; | |
3255 | ||
3256 | ||
3257 | ASSERT(prAdapter); | |
3258 | ASSERT(prStaRec); | |
3259 | ||
3260 | prBssInfo = &(prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex]); | |
3261 | ||
3262 | bssRemoveStaRecFromClientList(prAdapter, prBssInfo, prStaRec); | |
3263 | ||
3264 | p2pFuncDisconnect(prAdapter, prStaRec, FALSE, REASON_CODE_UNSPECIFIED); | |
3265 | ||
3266 | ||
3267 | //20120830 moved into p2puUncDisconnect. | |
3268 | //cnmStaRecFree(prAdapter, prStaRec, TRUE); | |
3269 | ||
3270 | return; | |
3271 | } /* p2pRunEventAAATxFail */ | |
3272 | ||
3273 | ||
3274 | /*----------------------------------------------------------------------------*/ | |
3275 | /*! | |
3276 | * @brief This function will indiate the Event of Successful Completion of AAA Module. | |
3277 | * | |
3278 | * @param[in] prAdapter Pointer to the Adapter structure. | |
3279 | * @param[in] prStaRec Pointer to the STA_RECORD_T | |
3280 | * | |
3281 | * @return (none) | |
3282 | */ | |
3283 | /*----------------------------------------------------------------------------*/ | |
3284 | WLAN_STATUS | |
3285 | p2pRunEventAAAComplete ( | |
3286 | IN P_ADAPTER_T prAdapter, | |
3287 | IN P_STA_RECORD_T prStaRec | |
3288 | ) | |
3289 | { | |
3290 | WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; | |
3291 | P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; | |
3292 | ENUM_PARAM_MEDIA_STATE_T eOriMediaState; | |
3293 | ||
3294 | do { | |
3295 | ASSERT_BREAK((prAdapter != NULL) && (prStaRec != NULL)); | |
3296 | ||
3297 | prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); | |
3298 | ||
3299 | eOriMediaState = prP2pBssInfo->eConnectionState; | |
3300 | ||
3301 | if(prStaRec != NULL){ | |
3302 | ||
3303 | bssRemoveStaRecFromClientList(prAdapter, prP2pBssInfo, prStaRec); | |
3304 | ||
3305 | } | |
3306 | else{ | |
3307 | ||
3308 | break; | |
3309 | ||
3310 | } | |
3311 | ||
3312 | if (prP2pBssInfo->rStaRecOfClientList.u4NumElem > P2P_MAXIMUM_CLIENT_COUNT || | |
3313 | kalP2PMaxClients(prAdapter->prGlueInfo, prP2pBssInfo->rStaRecOfClientList.u4NumElem)) { | |
3314 | rStatus = WLAN_STATUS_RESOURCES; | |
3315 | break; | |
3316 | } | |
3317 | ||
3318 | bssAddStaRecToClientList(prAdapter, prP2pBssInfo, prStaRec); | |
3319 | ||
3320 | prStaRec->u2AssocId = bssAssignAssocID(prStaRec); | |
3321 | ||
3322 | if (prP2pBssInfo->rStaRecOfClientList.u4NumElem > P2P_MAXIMUM_CLIENT_COUNT || | |
3323 | kalP2PMaxClients(prAdapter->prGlueInfo, prP2pBssInfo->rStaRecOfClientList.u4NumElem)) { | |
3324 | rStatus = WLAN_STATUS_RESOURCES; | |
3325 | break; | |
3326 | } | |
3327 | DBGLOG(P2P, INFO, ("P2P GO Join Complete\n")); | |
3328 | ||
3329 | cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_3); | |
3330 | ||
3331 | p2pChangeMediaState(prAdapter, PARAM_MEDIA_STATE_CONNECTED); | |
3332 | ||
3333 | /* Update Connected state to FW. */ | |
3334 | if (eOriMediaState != prP2pBssInfo->eConnectionState) { | |
3335 | nicUpdateBss(prAdapter, NETWORK_TYPE_P2P_INDEX); | |
3336 | } | |
3337 | ||
3338 | } while (FALSE); | |
3339 | ||
3340 | return rStatus; | |
3341 | } /* p2pRunEventAAAComplete */ | |
3342 | ||
3343 | ||
3344 | /*----------------------------------------------------------------------------*/ | |
3345 | /*! | |
3346 | * @brief This function will indiate the Event of Successful Completion of AAA Module. | |
3347 | * | |
3348 | * @param[in] prAdapter Pointer to the Adapter structure. | |
3349 | * @param[in] prStaRec Pointer to the STA_RECORD_T | |
3350 | * | |
3351 | * @return (none) | |
3352 | */ | |
3353 | /*----------------------------------------------------------------------------*/ | |
3354 | WLAN_STATUS | |
3355 | p2pRunEventAAASuccess ( | |
3356 | IN P_ADAPTER_T prAdapter, | |
3357 | IN P_STA_RECORD_T prStaRec | |
3358 | ) | |
3359 | { | |
3360 | WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; | |
3361 | ||
3362 | do { | |
3363 | ASSERT_BREAK((prAdapter != NULL) && (prStaRec != NULL)); | |
3364 | ||
3365 | /* Glue layer indication. */ | |
3366 | kalP2PGOStationUpdate(prAdapter->prGlueInfo, prStaRec, TRUE); | |
3367 | ||
3368 | } while (FALSE); | |
3369 | ||
3370 | return rStatus; | |
3371 | } /* p2pRunEventAAASuccess */ | |
3372 | ||
3373 | ||
3374 | ||
3375 | /*----------------------------------------------------------------------------*/ | |
3376 | /*! | |
3377 | * \brief | |
3378 | * | |
3379 | * \param[in] | |
3380 | * | |
3381 | * \return none | |
3382 | */ | |
3383 | /*----------------------------------------------------------------------------*/ | |
3384 | WLAN_STATUS | |
3385 | p2pRxPublicActionFrame ( | |
3386 | IN P_ADAPTER_T prAdapter, | |
3387 | IN P_SW_RFB_T prSwRfb | |
3388 | ) | |
3389 | { | |
3390 | WLAN_STATUS rWlanStatus = WLAN_STATUS_SUCCESS; | |
3391 | P_P2P_PUBLIC_ACTION_FRAME_T prPublicActionFrame = (P_P2P_PUBLIC_ACTION_FRAME_T)NULL; | |
3392 | P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; | |
3393 | ||
3394 | ASSERT(prSwRfb); | |
3395 | ASSERT(prAdapter); | |
3396 | ||
3397 | ||
3398 | ||
3399 | prPublicActionFrame = (P_P2P_PUBLIC_ACTION_FRAME_T)prSwRfb->pvHeader; | |
3400 | prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; | |
3401 | ||
3402 | DBGLOG(P2P, TRACE, ("RX Public Action Frame Token:%d.\n", prPublicActionFrame->ucDialogToken)); | |
3403 | ||
3404 | if (prPublicActionFrame->ucCategory != CATEGORY_PUBLIC_ACTION) { | |
3405 | return rWlanStatus; | |
3406 | } | |
3407 | ||
3408 | switch (prPublicActionFrame->ucAction) { | |
3409 | case ACTION_PUBLIC_WIFI_DIRECT: | |
3410 | break; | |
3411 | case ACTION_GAS_INITIAL_REQUEST: | |
3412 | case ACTION_GAS_INITIAL_RESPONSE: | |
3413 | case ACTION_GAS_COMEBACK_REQUEST: | |
3414 | case ACTION_GAS_COMEBACK_RESPONSE: | |
3415 | break; | |
3416 | default: | |
3417 | break; | |
3418 | } | |
3419 | ||
3420 | return rWlanStatus; | |
3421 | } /* p2pRxPublicActionFrame */ | |
3422 | ||
3423 | ||
3424 | ||
3425 | WLAN_STATUS | |
3426 | p2pRxActionFrame ( | |
3427 | IN P_ADAPTER_T prAdapter, | |
3428 | IN P_SW_RFB_T prSwRfb | |
3429 | ) | |
3430 | { | |
3431 | WLAN_STATUS rWlanStatus = WLAN_STATUS_SUCCESS; | |
3432 | P_P2P_ACTION_FRAME_T prP2pActionFrame = (P_P2P_ACTION_FRAME_T)NULL; | |
3433 | UINT_8 aucOui[3] = VENDOR_OUI_WFA_SPECIFIC; | |
3434 | ||
3435 | do { | |
3436 | ASSERT_BREAK((prAdapter != NULL) && (prSwRfb != NULL)); | |
3437 | ||
3438 | prP2pActionFrame = (P_P2P_ACTION_FRAME_T)prSwRfb->pvHeader; | |
3439 | ||
3440 | if (prP2pActionFrame->ucCategory != CATEGORY_VENDOR_SPECIFIC_ACTION) { | |
3441 | DBGLOG(P2P, TRACE, ("RX Action Frame but not vendor specific.\n")); | |
3442 | break; | |
3443 | } | |
3444 | ||
3445 | ||
3446 | if ((prP2pActionFrame->ucOuiType != VENDOR_OUI_TYPE_P2P) || | |
3447 | (prP2pActionFrame->aucOui[0] != aucOui[0]) || | |
3448 | (prP2pActionFrame->aucOui[1] != aucOui[1]) || | |
3449 | (prP2pActionFrame->aucOui[2] != aucOui[2])) { | |
3450 | DBGLOG(P2P, TRACE, ("RX Vendor Specific Action Frame but not P2P Type or not WFA OUI.\n")); | |
3451 | break; | |
3452 | } | |
3453 | ||
3454 | } while (FALSE); | |
3455 | ||
3456 | return rWlanStatus; | |
3457 | } /* p2pRxActionFrame */ | |
3458 | ||
3459 | ||
3460 | VOID | |
3461 | p2pProcessEvent_UpdateNOAParam ( | |
3462 | IN P_ADAPTER_T prAdapter, | |
3463 | UINT_8 ucNetTypeIndex, | |
3464 | P_EVENT_UPDATE_NOA_PARAMS_T prEventUpdateNoaParam | |
3465 | ) | |
3466 | { | |
3467 | P_BSS_INFO_T prBssInfo = (P_BSS_INFO_T)NULL; | |
3468 | P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo; | |
3469 | UINT_32 i; | |
3470 | BOOLEAN fgNoaAttrExisted = FALSE; | |
3471 | ||
3472 | prBssInfo = &(prAdapter->rWifiVar.arBssInfo[ucNetTypeIndex]); | |
3473 | prP2pSpecificBssInfo = prAdapter->rWifiVar.prP2pSpecificBssInfo; | |
3474 | ||
3475 | prP2pSpecificBssInfo->fgEnableOppPS = prEventUpdateNoaParam->fgEnableOppPS; | |
3476 | prP2pSpecificBssInfo->u2CTWindow = prEventUpdateNoaParam->u2CTWindow; | |
3477 | prP2pSpecificBssInfo->ucNoAIndex = prEventUpdateNoaParam->ucNoAIndex; | |
3478 | prP2pSpecificBssInfo->ucNoATimingCount = prEventUpdateNoaParam->ucNoATimingCount; | |
3479 | ||
3480 | fgNoaAttrExisted |= prP2pSpecificBssInfo->fgEnableOppPS; | |
3481 | ||
3482 | DBGLOG(P2P, INFO, ("Update NoA Count=%d.\n",prEventUpdateNoaParam->ucNoATimingCount)); | |
3483 | ||
3484 | ASSERT(prP2pSpecificBssInfo->ucNoATimingCount <= P2P_MAXIMUM_NOA_COUNT); | |
3485 | ||
3486 | for (i = 0; i < prP2pSpecificBssInfo->ucNoATimingCount; i++) { | |
3487 | // in used | |
3488 | prP2pSpecificBssInfo->arNoATiming[i].fgIsInUse = | |
3489 | prEventUpdateNoaParam->arEventNoaTiming[i].fgIsInUse; | |
3490 | // count | |
3491 | prP2pSpecificBssInfo->arNoATiming[i].ucCount = | |
3492 | prEventUpdateNoaParam->arEventNoaTiming[i].ucCount; | |
3493 | // duration | |
3494 | prP2pSpecificBssInfo->arNoATiming[i].u4Duration = | |
3495 | prEventUpdateNoaParam->arEventNoaTiming[i].u4Duration; | |
3496 | // interval | |
3497 | prP2pSpecificBssInfo->arNoATiming[i].u4Interval = | |
3498 | prEventUpdateNoaParam->arEventNoaTiming[i].u4Interval; | |
3499 | // start time | |
3500 | prP2pSpecificBssInfo->arNoATiming[i].u4StartTime = | |
3501 | prEventUpdateNoaParam->arEventNoaTiming[i].u4StartTime; | |
3502 | ||
3503 | fgNoaAttrExisted |= prP2pSpecificBssInfo->arNoATiming[i].fgIsInUse; | |
3504 | } | |
3505 | ||
3506 | prP2pSpecificBssInfo->fgIsNoaAttrExisted = fgNoaAttrExisted; | |
3507 | ||
3508 | // update beacon content by the change | |
3509 | bssUpdateBeaconContent(prAdapter, ucNetTypeIndex); | |
3510 | } | |
3511 | ||
3512 | #endif /* CFG_ENABLE_WIFI_DIRECT */ | |
3513 |