|
1 /* |
|
2 * Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Implementation of the UmacDot11PrepareForBssMode class |
|
15 * |
|
16 */ |
|
17 |
|
18 /* |
|
19 * %version: 31 % |
|
20 */ |
|
21 |
|
22 #include "config.h" |
|
23 #include "UmacDot11PrepareForBssMode.h" |
|
24 #include "UmacWsaWriteMib.h" |
|
25 #include "UmacWsaJoin.h" |
|
26 #include "umacconfiguretxqueueparams.h" |
|
27 #include "UmacContextImpl.h" |
|
28 #include "wha_mibDefaultvalues.h" |
|
29 |
|
30 |
|
31 #ifndef NDEBUG |
|
32 const TInt8 WlanDot11PrepareForBssMode::iName[] |
|
33 = "dot11-prepareforbssmode"; |
|
34 |
|
35 const TUint8 WlanDot11PrepareForBssMode::iStateName |
|
36 [ESTATEMAX][KMaxStateStringLength] = |
|
37 { |
|
38 {"EINIT"}, |
|
39 {"ESETSLEEPMODE"}, |
|
40 {"ESETDOT11SLOTTIME"}, |
|
41 {"ESETCTSTOSELF"}, |
|
42 {"ECONFTXQUEUE"}, |
|
43 {"ECONFTXQUEUEPARAMS"}, |
|
44 {"ESETTXRATEPOLICY"}, |
|
45 {"ESETHTCAPABILITIES"}, |
|
46 {"ESETHTBSSOPERATION"}, |
|
47 {"ERESETHTCAPABILITIES"}, |
|
48 {"EISSUEJOIN"}, |
|
49 {"ESETHTBLOCKACKCONF"}, |
|
50 {"ERESETHTBLOCKACKCONF"}, |
|
51 {"ECONTINUEDOT11TRAVERSE"} |
|
52 }; |
|
53 |
|
54 const TUint8 WlanDot11PrepareForBssMode::iEventName |
|
55 [EEVENTMAX][KMaxEventStringLength] = |
|
56 { |
|
57 {"ESTATEENTRY"}, |
|
58 {"ETXCOMPLETE"}, |
|
59 {"EABORT"} |
|
60 }; |
|
61 #endif |
|
62 |
|
63 // ============================ MEMBER FUNCTIONS =============================== |
|
64 |
|
65 |
|
66 // ----------------------------------------------------------------------------- |
|
67 // |
|
68 // ----------------------------------------------------------------------------- |
|
69 // |
|
70 #ifndef NDEBUG |
|
71 const TInt8* WlanDot11PrepareForBssMode::GetStateName( |
|
72 TUint8& aLength ) const |
|
73 { |
|
74 aLength = sizeof( iName ); |
|
75 return iName; |
|
76 } |
|
77 #endif |
|
78 |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 // ----------------------------------------------------------------------------- |
|
82 // |
|
83 void WlanDot11PrepareForBssMode::Entry( |
|
84 WlanContextImpl& aCtxImpl ) |
|
85 { |
|
86 if ( aCtxImpl.WsaCmdActive() ) |
|
87 { |
|
88 // sanity checking code |
|
89 OsAssert( (TUint8*)("UMAC * panic"), |
|
90 (TUint8*)(WLAN_FILE), __LINE__ ); |
|
91 } |
|
92 |
|
93 // don't want to do event dispatching here as we want |
|
94 // to run this dot11 state critter in non pre-emptive mode |
|
95 |
|
96 if ( iState != EINIT ) |
|
97 { |
|
98 // this is NOT the start of the the FSM actions |
|
99 // note that we send the ETXCOMPLETE event as the states |
|
100 // that wait for it are the only ones that can be interrupted |
|
101 // as they are asynchronous operations by nature |
|
102 // and wait for corresponding WHA completion method |
|
103 Fsm( aCtxImpl, ETXCOMPLETE ); |
|
104 } |
|
105 else |
|
106 { |
|
107 // this is the start of the the FSM actions |
|
108 Fsm( aCtxImpl, ESTATEENTRY ); |
|
109 } |
|
110 } |
|
111 |
|
112 // ----------------------------------------------------------------------------- |
|
113 // |
|
114 // ----------------------------------------------------------------------------- |
|
115 // |
|
116 void WlanDot11PrepareForBssMode::Exit( |
|
117 WlanContextImpl& /*aCtxImpl*/ ) |
|
118 { |
|
119 OsTracePrint( KUmacProtocolState, (TUint8*) |
|
120 ("UMAC: WlanDot11PrepareForBssMode::Exit()") ); |
|
121 |
|
122 // only thing we shall do is to reset our FSM for the next round... |
|
123 iState = EINIT; |
|
124 } |
|
125 |
|
126 // ----------------------------------------------------------------------------- |
|
127 // |
|
128 // ----------------------------------------------------------------------------- |
|
129 // |
|
130 void WlanDot11PrepareForBssMode::OnWhaCommandResponse( |
|
131 WlanContextImpl& /*aCtxImpl*/, |
|
132 WHA::TCommandId aCommandId, |
|
133 WHA::TStatus aStatus, |
|
134 const WHA::UCommandResponseParams& /*aCommandResponseParams*/, |
|
135 TUint32 aAct ) |
|
136 { |
|
137 if ( aAct ) |
|
138 { |
|
139 // should not happen as we a runnng in non-pre-emptive mode |
|
140 // regarding oid commands |
|
141 OsTracePrint( KErrorLevel, (TUint8*)("UMAC: aAct: %d"), aAct ); |
|
142 OsAssert( (TUint8*)("UMAC: panic"),(TUint8*)(WLAN_FILE), __LINE__ ); |
|
143 } |
|
144 |
|
145 // this is a response to a command that was generated |
|
146 // by this dot11 state object layer |
|
147 |
|
148 // we are only interested of join command response |
|
149 // as it is the oly one we trigger from here that |
|
150 // has a meaningfull return value |
|
151 if ( aCommandId == WHA::EJoinResponse ) |
|
152 { |
|
153 if ( aStatus == WHA::KFailed ) |
|
154 { |
|
155 OsTracePrint( KWarningLevel, |
|
156 (TUint8*)("UMAC: WlanDot11PrepareForBssMode: join failed")); |
|
157 // make a note of the failure and act |
|
158 // accordingly when we |
|
159 // soon again enter this state |
|
160 iJoinFailed = ETrue; |
|
161 } |
|
162 else |
|
163 { |
|
164 OsTracePrint( KInfoLevel, |
|
165 (TUint8*)("UMAC: WlanDot11PrepareForBssMode: join success")); |
|
166 } |
|
167 } |
|
168 else // --- aCommandId == WHA::EJoinResponse --- |
|
169 { |
|
170 // no action here |
|
171 } |
|
172 } |
|
173 |
|
174 // ----------------------------------------------------------------------------- |
|
175 // |
|
176 // ----------------------------------------------------------------------------- |
|
177 // |
|
178 void WlanDot11PrepareForBssMode::ChangeInternalState( |
|
179 WlanContextImpl& aCtxImpl, |
|
180 TState aNewState ) |
|
181 { |
|
182 iState = aNewState; |
|
183 Fsm( aCtxImpl, ESTATEENTRY ); |
|
184 } |
|
185 |
|
186 // ----------------------------------------------------------------------------- |
|
187 // |
|
188 // ----------------------------------------------------------------------------- |
|
189 // |
|
190 void WlanDot11PrepareForBssMode::Fsm( |
|
191 WlanContextImpl& aCtxImpl, |
|
192 TEvent aEvent ) |
|
193 { |
|
194 OsTracePrint( KUmacDetails, |
|
195 (TUint8*)("UMAC: WlanDot11PrepareForBssMode::Fsm(): FSM EVENT") ); |
|
196 #ifndef NDEBUG |
|
197 OsTracePrint( |
|
198 KUmacDetails, |
|
199 (TUint8*)("UMAC: WlanDot11PrepareForBssMode::Fsm(): event:")); |
|
200 OsTracePrint( KUmacDetails, iEventName[aEvent] ); |
|
201 OsTracePrint( |
|
202 KUmacDetails, |
|
203 (TUint8*)("UMAC: WlanDot11PrepareForBssMode::Fsm(): state:")); |
|
204 OsTracePrint( KUmacDetails, iStateName[iState] ); |
|
205 #endif |
|
206 |
|
207 switch ( aEvent ) |
|
208 { |
|
209 case ESTATEENTRY: |
|
210 OnStateEntryEvent( aCtxImpl ); |
|
211 break; |
|
212 case ETXCOMPLETE: |
|
213 OnTxCompleteEvent( aCtxImpl ); |
|
214 break; |
|
215 case EABORT: |
|
216 OnAbortEvent( aCtxImpl ); |
|
217 break; |
|
218 default: |
|
219 // catch internal FSM programming error |
|
220 OsTracePrint( |
|
221 KErrorLevel, |
|
222 (TUint8*)("UMAC: WlanDot11PrepareForBssMode::Fsm(): event: %d"), |
|
223 aEvent); |
|
224 OsAssert( |
|
225 (TUint8*)("UMAC: WlanDot11PrepareForBssMode::Fsm(): panic"), |
|
226 (TUint8*)(WLAN_FILE), __LINE__ ); |
|
227 break; |
|
228 } |
|
229 } |
|
230 |
|
231 // ----------------------------------------------------------------------------- |
|
232 // |
|
233 // ----------------------------------------------------------------------------- |
|
234 // |
|
235 void WlanDot11PrepareForBssMode::OnStateEntryEvent( |
|
236 WlanContextImpl& aCtxImpl ) |
|
237 { |
|
238 switch ( iState ) |
|
239 { |
|
240 case EINIT: |
|
241 // as we are about to join a new AP, reset BSS Loss indicators |
|
242 aCtxImpl.ResetBssLossIndications(); |
|
243 iJoinFailed = EFalse; |
|
244 // make sure that this counter is reset; also in case the |
|
245 // previous connect attempt has failed |
|
246 aCtxImpl.ResetFailedTxPacketCount(); |
|
247 // start the FSM traversal |
|
248 ChangeInternalState( aCtxImpl, |
|
249 ESETSLEEPMODE ); |
|
250 break; |
|
251 case ESETSLEEPMODE: |
|
252 SetSleepMode( aCtxImpl ); |
|
253 break; |
|
254 case ESETDOT11SLOTTIME: |
|
255 SetDot11SlotTime( aCtxImpl ); |
|
256 break; |
|
257 case ESETCTSTOSELF: |
|
258 SetCtsToSelf( aCtxImpl ); |
|
259 break; |
|
260 case ECONFTXQUEUE: |
|
261 ConfigureQueue( aCtxImpl ); |
|
262 break; |
|
263 case ECONFTXQUEUEPARAMS: |
|
264 ConfigureTxQueueParams( aCtxImpl ); |
|
265 break; |
|
266 case ESETTXRATEPOLICY: |
|
267 SetTxRatePolicy( aCtxImpl ); |
|
268 break; |
|
269 case ESETHTCAPABILITIES: |
|
270 SetHtCapabilities( aCtxImpl ); |
|
271 break; |
|
272 case ESETHTBSSOPERATION: |
|
273 SetHtBssOperation( aCtxImpl ); |
|
274 break; |
|
275 case ERESETHTCAPABILITIES: |
|
276 ResetHtCapabilities( aCtxImpl ); |
|
277 break; |
|
278 case EISSUEJOIN: |
|
279 IssueJoin( aCtxImpl ); |
|
280 break; |
|
281 case ESETHTBLOCKACKCONF: |
|
282 SetHtBlockAckConfiguration( aCtxImpl ); |
|
283 break; |
|
284 case ERESETHTBLOCKACKCONF: |
|
285 ResetHtBlockAckConfiguration( aCtxImpl ); |
|
286 break; |
|
287 case ECONTINUEDOT11TRAVERSE: |
|
288 ContinueDot11StateTraversal( aCtxImpl ); |
|
289 break; |
|
290 default: |
|
291 // catch internal FSM programming error |
|
292 OsTracePrint( |
|
293 KErrorLevel, |
|
294 (TUint8*)("UMAC: WlanDot11PrepareForBssMode::OnStateEntryEvent(): state: %d"), |
|
295 iState); |
|
296 OsAssert( (TUint8*)("UMAC: WlanDot11PrepareForBssMode::OnStateEntryEvent(): panic"), |
|
297 (TUint8*)(WLAN_FILE), __LINE__ ); |
|
298 break; |
|
299 } |
|
300 } |
|
301 |
|
302 // ----------------------------------------------------------------------------- |
|
303 // |
|
304 // ----------------------------------------------------------------------------- |
|
305 // |
|
306 void WlanDot11PrepareForBssMode::OnTxCompleteEvent( |
|
307 WlanContextImpl& aCtxImpl ) |
|
308 { |
|
309 switch ( iState ) |
|
310 { |
|
311 case ESETSLEEPMODE: |
|
312 // depending if the WLAN vendor specific solution |
|
313 // implements dot11slottime mib we will configure it |
|
314 if ( aCtxImpl.WHASettings().iCapability |
|
315 & WHA::SSettings::KDot11SlotTime ) |
|
316 { |
|
317 // supported |
|
318 ChangeInternalState( aCtxImpl, ESETDOT11SLOTTIME ); |
|
319 } |
|
320 else |
|
321 { |
|
322 // not supported so skip it |
|
323 OsTracePrint( KWarningLevel, (TUint8*) |
|
324 ("UMAC: WlanDot11PrepareForBssMode::OnTxCompleteEvent")); |
|
325 OsTracePrint( KWarningLevel, (TUint8*) |
|
326 ("UMAC: no support for dot11slottime mib skipping")); |
|
327 |
|
328 ChangeInternalState( aCtxImpl, ESETCTSTOSELF ); |
|
329 } |
|
330 break; |
|
331 case ESETDOT11SLOTTIME: |
|
332 // continue state traversal |
|
333 ChangeInternalState( aCtxImpl, ESETCTSTOSELF ); |
|
334 break; |
|
335 case ESETCTSTOSELF: |
|
336 if ( aCtxImpl.QosEnabled() ) |
|
337 { |
|
338 // configure all the Tx queues & their AC parameters |
|
339 ChangeInternalState( aCtxImpl, ECONFTXQUEUEPARAMS ); |
|
340 } |
|
341 else |
|
342 { |
|
343 // configure just the legacy Tx queue |
|
344 // This is done in order to have the correct queue |
|
345 // configuration also in the case that the previous connect |
|
346 // attempt to a QoS AP failed (and we asked for a QoS queue |
|
347 // configuration for it), and we are now about to |
|
348 // connect to a non-QoS AP |
|
349 ChangeInternalState( aCtxImpl, ECONFTXQUEUE ); |
|
350 } |
|
351 break; |
|
352 case ECONFTXQUEUE: |
|
353 case ECONFTXQUEUEPARAMS: |
|
354 // continue state traversal |
|
355 ChangeInternalState( aCtxImpl, ESETTXRATEPOLICY ); |
|
356 break; |
|
357 case ESETTXRATEPOLICY: |
|
358 if ( aCtxImpl.HtSupportedByNw() ) |
|
359 { |
|
360 ChangeInternalState( aCtxImpl, ESETHTCAPABILITIES ); |
|
361 } |
|
362 else |
|
363 { |
|
364 if ( aCtxImpl.WHASettings().iCapability & |
|
365 WHA::SSettings::KHtOperation ) |
|
366 { |
|
367 ChangeInternalState( aCtxImpl, ERESETHTCAPABILITIES ); |
|
368 } |
|
369 else |
|
370 { |
|
371 ChangeInternalState( aCtxImpl, EISSUEJOIN ); |
|
372 } |
|
373 } |
|
374 break; |
|
375 case ESETHTCAPABILITIES: |
|
376 ChangeInternalState( aCtxImpl, ESETHTBSSOPERATION ); |
|
377 break; |
|
378 case ESETHTBSSOPERATION: |
|
379 ChangeInternalState( aCtxImpl, EISSUEJOIN ); |
|
380 break; |
|
381 case ERESETHTCAPABILITIES: |
|
382 ChangeInternalState( aCtxImpl, EISSUEJOIN ); |
|
383 break; |
|
384 case EISSUEJOIN: |
|
385 if ( aCtxImpl.HtSupportedByNw() ) |
|
386 { |
|
387 ChangeInternalState( aCtxImpl, ESETHTBLOCKACKCONF ); |
|
388 } |
|
389 else |
|
390 { |
|
391 if ( aCtxImpl.WHASettings().iCapability & |
|
392 WHA::SSettings::KHtOperation ) |
|
393 { |
|
394 ChangeInternalState( aCtxImpl, ERESETHTBLOCKACKCONF ); |
|
395 } |
|
396 else |
|
397 { |
|
398 ChangeInternalState( aCtxImpl, ECONTINUEDOT11TRAVERSE ); |
|
399 } |
|
400 } |
|
401 break; |
|
402 case ESETHTBLOCKACKCONF: |
|
403 ChangeInternalState( aCtxImpl, ECONTINUEDOT11TRAVERSE ); |
|
404 break; |
|
405 case ERESETHTBLOCKACKCONF: |
|
406 ChangeInternalState( aCtxImpl, ECONTINUEDOT11TRAVERSE ); |
|
407 break; |
|
408 default: |
|
409 // catch internal FSM programming error |
|
410 OsTracePrint( KErrorLevel, (TUint8*)("UMAC: state: %d"), iState); |
|
411 OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
|
412 break; |
|
413 } |
|
414 } |
|
415 |
|
416 // ----------------------------------------------------------------------------- |
|
417 // as there's really nothing else we can do in this situation |
|
418 // simulate macNotResponding error |
|
419 // ----------------------------------------------------------------------------- |
|
420 // |
|
421 void WlanDot11PrepareForBssMode::OnAbortEvent( |
|
422 WlanContextImpl& aCtxImpl ) |
|
423 { |
|
424 OsTracePrint( |
|
425 KUmacDetails, |
|
426 (TUint8*)("UMAC: WlanDot11PrepareForBssMode::OnAbortEvent()")); |
|
427 |
|
428 DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding ); |
|
429 } |
|
430 |
|
431 // ----------------------------------------------------------------------------- |
|
432 // |
|
433 // ----------------------------------------------------------------------------- |
|
434 // |
|
435 void WlanDot11PrepareForBssMode::SetSleepMode( |
|
436 WlanContextImpl& aCtxImpl ) |
|
437 { |
|
438 WHA::SsleepMode* mib |
|
439 = static_cast<WHA::SsleepMode*>(os_alloc( sizeof( WHA::SsleepMode ) )); |
|
440 |
|
441 if ( !mib ) |
|
442 { |
|
443 // alloc failue just send abort event to fsm |
|
444 // it takes care of the rest |
|
445 Fsm( aCtxImpl, EABORT ); |
|
446 return; |
|
447 } |
|
448 |
|
449 mib->iMode = WHA::KPowerDownMode; |
|
450 |
|
451 OsTracePrint( |
|
452 KUmacDetails, |
|
453 (TUint8*) |
|
454 ("UMAC: WlanDot11PrepareForBssMode::SetSleepMode(): set sleepmode: %d"), |
|
455 mib->iMode ); |
|
456 |
|
457 WlanWsaWriteMib& wha_cmd = aCtxImpl.WsaWriteMib(); |
|
458 wha_cmd.Set( |
|
459 aCtxImpl, WHA::KMibSleepMode, sizeof(*mib), mib ); |
|
460 |
|
461 // change global state: entry procedure triggers action |
|
462 ChangeState( aCtxImpl, |
|
463 *this, // prev state |
|
464 wha_cmd // next state |
|
465 ); |
|
466 |
|
467 // as the parameters have been supplied we can now deallocate |
|
468 os_free( mib ); |
|
469 } |
|
470 |
|
471 // ----------------------------------------------------------------------------- |
|
472 // |
|
473 // ----------------------------------------------------------------------------- |
|
474 // |
|
475 void WlanDot11PrepareForBssMode::SetDot11SlotTime( |
|
476 WlanContextImpl& aCtxImpl ) |
|
477 { |
|
478 WHA::Sdot11SlotTime* mib |
|
479 = static_cast<WHA::Sdot11SlotTime*> |
|
480 (os_alloc( sizeof( WHA::Sdot11SlotTime ) )); |
|
481 |
|
482 if ( !mib ) |
|
483 { |
|
484 // alloc failue just send abort event to fsm |
|
485 // it takes care of the rest |
|
486 Fsm( aCtxImpl, EABORT ); |
|
487 return; |
|
488 } |
|
489 |
|
490 if ( aCtxImpl.UseShortSlotTime() ) |
|
491 { |
|
492 mib->iDot11SlotTime = WHA::KSlotTime9; |
|
493 } |
|
494 else |
|
495 { |
|
496 mib->iDot11SlotTime = WHA::KSlotTime20; |
|
497 } |
|
498 |
|
499 OsTracePrint( KUmacDetails, (TUint8*)("UMAC * set slottime: %d"), |
|
500 mib->iDot11SlotTime ); |
|
501 |
|
502 WlanWsaWriteMib& wha_cmd = aCtxImpl.WsaWriteMib(); |
|
503 wha_cmd.Set( |
|
504 aCtxImpl, WHA::KMibDot11SlotTime, sizeof(*mib), mib ); |
|
505 |
|
506 // change global state: entry procedure triggers action |
|
507 ChangeState( aCtxImpl, |
|
508 *this, // prev state |
|
509 wha_cmd // next state |
|
510 ); |
|
511 |
|
512 // as the parameters have been supplied we can now deallocate |
|
513 os_free( mib ); |
|
514 } |
|
515 |
|
516 // ----------------------------------------------------------------------------- |
|
517 // |
|
518 // ----------------------------------------------------------------------------- |
|
519 // |
|
520 void WlanDot11PrepareForBssMode::SetCtsToSelf( |
|
521 WlanContextImpl& aCtxImpl ) |
|
522 { |
|
523 WHA::SctsToSelf* mib |
|
524 = static_cast<WHA::SctsToSelf*> |
|
525 (os_alloc( sizeof( WHA::SctsToSelf ) )); |
|
526 |
|
527 if ( !mib ) |
|
528 { |
|
529 // alloc failue just send abort event to fsm |
|
530 // it takes care of the rest |
|
531 Fsm( aCtxImpl, EABORT ); |
|
532 return; |
|
533 } |
|
534 |
|
535 if ( aCtxImpl.ProtectionBitSet() ) |
|
536 { |
|
537 OsTracePrint( |
|
538 KUmacDetails, |
|
539 (TUint8*)("UMAC: WlanDot11PrepareForBssMode::SetCtsToSelf(): enable CTS to self") ); |
|
540 |
|
541 mib->iCtsToSelf = ETrue; |
|
542 } |
|
543 else |
|
544 { |
|
545 OsTracePrint( |
|
546 KUmacDetails, |
|
547 (TUint8*)("UMAC: WlanDot11PrepareForBssMode::SetCtsToSelf(): disable CTS to self") ); |
|
548 |
|
549 mib->iCtsToSelf = EFalse; |
|
550 } |
|
551 |
|
552 WlanWsaWriteMib& wha_cmd = aCtxImpl.WsaWriteMib(); |
|
553 wha_cmd.Set( |
|
554 aCtxImpl, WHA::KMibCtsToSelf, sizeof(*mib), mib ); |
|
555 |
|
556 // change global state: entry procedure triggers action |
|
557 ChangeState( aCtxImpl, |
|
558 *this, // prev state |
|
559 wha_cmd // next state |
|
560 ); |
|
561 |
|
562 // as the parameters have been supplied we can now deallocate |
|
563 os_free( mib ); |
|
564 } |
|
565 |
|
566 // --------------------------------------------------------------------------- |
|
567 // |
|
568 // --------------------------------------------------------------------------- |
|
569 // |
|
570 void WlanDot11PrepareForBssMode::ConfigureQueue( |
|
571 WlanContextImpl& aCtxImpl ) |
|
572 { |
|
573 ConfigureTxQueue( aCtxImpl, WHA::ELegacy ); |
|
574 } |
|
575 |
|
576 // --------------------------------------------------------------------------- |
|
577 // |
|
578 // --------------------------------------------------------------------------- |
|
579 // |
|
580 void WlanDot11PrepareForBssMode::ConfigureTxQueueParams( |
|
581 WlanContextImpl& aCtxImpl ) |
|
582 { |
|
583 WlanConfigureTxQueueParams& complex_wsa_cmd = |
|
584 aCtxImpl.ConfigureTxQueueParams(); |
|
585 |
|
586 // change global state: entry procedure triggers action |
|
587 ChangeState( aCtxImpl, |
|
588 *this, // prev state |
|
589 complex_wsa_cmd // next state |
|
590 ); |
|
591 } |
|
592 |
|
593 // --------------------------------------------------------------------------- |
|
594 // |
|
595 // --------------------------------------------------------------------------- |
|
596 // |
|
597 void WlanDot11PrepareForBssMode::SetTxRatePolicy( |
|
598 WlanContextImpl& aCtxImpl ) |
|
599 { |
|
600 OsTracePrint( KUmacDetails, (TUint8*) |
|
601 ("UMAC: WlanDot11PrepareForBssMode::SetTxRatePolicy(): rate bitmask: 0x%08x"), |
|
602 aCtxImpl.RateBitMask() ); |
|
603 |
|
604 if ( !ConfigureTxRatePolicies( aCtxImpl ) ) |
|
605 { |
|
606 // alloc failue just send abort event to fsm |
|
607 // it takes care of the rest |
|
608 Fsm( aCtxImpl, EABORT ); |
|
609 return; |
|
610 } |
|
611 } |
|
612 |
|
613 // --------------------------------------------------------------------------- |
|
614 // |
|
615 // --------------------------------------------------------------------------- |
|
616 // |
|
617 void WlanDot11PrepareForBssMode::SetHtCapabilities( |
|
618 WlanContextImpl& aCtxImpl ) |
|
619 { |
|
620 OsTracePrint( KUmacDetails, (TUint8*) |
|
621 ("UMAC: WlanDot11PrepareForBssMode::SetHtCapabilities") ); |
|
622 |
|
623 ConfigureHtCapabilities( aCtxImpl ); |
|
624 } |
|
625 |
|
626 // --------------------------------------------------------------------------- |
|
627 // |
|
628 // --------------------------------------------------------------------------- |
|
629 // |
|
630 void WlanDot11PrepareForBssMode::SetHtBssOperation( |
|
631 WlanContextImpl& aCtxImpl ) |
|
632 { |
|
633 OsTracePrint( KUmacDetails, (TUint8*) |
|
634 ("UMAC: WlanDot11PrepareForBssMode::SetHtBssOperation") ); |
|
635 |
|
636 ConfigureHtBssOperation( aCtxImpl ); |
|
637 } |
|
638 |
|
639 // --------------------------------------------------------------------------- |
|
640 // |
|
641 // --------------------------------------------------------------------------- |
|
642 // |
|
643 void WlanDot11PrepareForBssMode::ResetHtCapabilities( |
|
644 WlanContextImpl& aCtxImpl ) |
|
645 { |
|
646 OsTracePrint( KUmacDetails, (TUint8*) |
|
647 ("UMAC: WlanDot11PrepareForBssMode::ResetHtCapabilities") ); |
|
648 |
|
649 ResetHtCapabilitiesMib( aCtxImpl ); |
|
650 } |
|
651 |
|
652 // --------------------------------------------------------------------------- |
|
653 // |
|
654 // --------------------------------------------------------------------------- |
|
655 // |
|
656 void WlanDot11PrepareForBssMode::ResetHtBlockAckConfiguration( |
|
657 WlanContextImpl& aCtxImpl ) |
|
658 { |
|
659 OsTracePrint( KUmacDetails, (TUint8*) |
|
660 ("UMAC: WlanDot11PrepareForBssMode::ResetHtBlockAckConfiguration") ); |
|
661 |
|
662 ResetHtBlockAckConfigureMib( aCtxImpl ); |
|
663 } |
|
664 |
|
665 // --------------------------------------------------------------------------- |
|
666 // |
|
667 // --------------------------------------------------------------------------- |
|
668 // |
|
669 void WlanDot11PrepareForBssMode::SetHtBlockAckConfiguration( |
|
670 WlanContextImpl& aCtxImpl ) |
|
671 { |
|
672 OsTracePrint( KUmacDetails, (TUint8*) |
|
673 ("UMAC: WlanDot11PrepareForBssMode::SetHtBlockAckConfiguration") ); |
|
674 |
|
675 // allocate memory for the mib to write |
|
676 WHA::ShtBlockAckConfigure* mib |
|
677 = static_cast<WHA::ShtBlockAckConfigure*> |
|
678 (os_alloc( sizeof( WHA::ShtBlockAckConfigure ) )); |
|
679 |
|
680 if ( !mib ) |
|
681 { |
|
682 // alloc failue just send abort event to fsm |
|
683 // it takes care of the rest |
|
684 Fsm( aCtxImpl, EABORT ); |
|
685 return; |
|
686 } |
|
687 |
|
688 // retrieve reference to the stored HT Block Ack configuration |
|
689 const WHA::ShtBlockAckConfigure& blockAckConf ( |
|
690 aCtxImpl.GetHtBlockAckConfigure() ); |
|
691 |
|
692 mib->iTxBlockAckUsage = blockAckConf.iTxBlockAckUsage; |
|
693 mib->iRxBlockAckUsage = blockAckConf.iRxBlockAckUsage; |
|
694 os_memset( mib->iReserved, 0, sizeof( mib->iReserved ) ); |
|
695 |
|
696 WlanWsaWriteMib& wha_cmd = aCtxImpl.WsaWriteMib(); |
|
697 |
|
698 wha_cmd.Set( |
|
699 aCtxImpl, |
|
700 WHA::KMibHtBlockAckConfigure, |
|
701 sizeof( *mib ), |
|
702 mib ); |
|
703 |
|
704 // change global state: entry procedure triggers action |
|
705 ChangeState( aCtxImpl, |
|
706 *this, // prev state |
|
707 wha_cmd ); // next state |
|
708 |
|
709 // as the parameters have been supplied we can now deallocate |
|
710 os_free( mib ); |
|
711 } |
|
712 |
|
713 // ----------------------------------------------------------------------------- |
|
714 // |
|
715 // ----------------------------------------------------------------------------- |
|
716 // |
|
717 void WlanDot11PrepareForBssMode::IssueJoin( |
|
718 WlanContextImpl& aCtxImpl ) |
|
719 { |
|
720 OsTracePrint( |
|
721 KUmacDetails, |
|
722 (TUint8*)("UMAC: WlanDot11PrepareForBssMode::IssueJoin()") ); |
|
723 |
|
724 // make WHA types |
|
725 WHA::SSSID ssid; |
|
726 ssid.iSSIDLength = aCtxImpl.GetSsId().ssidLength; |
|
727 os_memcpy( |
|
728 ssid.iSSID, |
|
729 aCtxImpl.GetSsId().ssid, |
|
730 aCtxImpl.GetSsId().ssidLength ); |
|
731 WHA::TMacAddress mac; |
|
732 os_memcpy( |
|
733 &mac, |
|
734 &(aCtxImpl.GetBssId()), |
|
735 WHA::TMacAddress::KMacAddressLength ); |
|
736 |
|
737 // feed the critter with parameters |
|
738 aCtxImpl.WsaJoin().Set( |
|
739 aCtxImpl, |
|
740 aCtxImpl.NetworkOperationMode(), |
|
741 mac, |
|
742 // only 2.4 GHz band is supported for now, so we can hard |
|
743 // code it should be changed as soon as our implemetation |
|
744 // supports multiple bands |
|
745 WHA::KBand2dot4GHzMask, |
|
746 ssid, |
|
747 aCtxImpl.NetworkChannelNumeber(), |
|
748 aCtxImpl.NetworkBeaconInterval(), |
|
749 aCtxImpl.BasicRateSet(), |
|
750 0, // ATIM |
|
751 (aCtxImpl.UseShortPreamble()) |
|
752 ? WHA::EShortPreamble : WHA::ELongPreamble, |
|
753 ( aCtxImpl.WHASettings().iCapability |
|
754 & WHA::SSettings::KProbe4Join ) ? ETrue : EFalse ); |
|
755 |
|
756 // change global state: entry procedure triggers action |
|
757 ChangeState( aCtxImpl, |
|
758 *this, // prev state |
|
759 aCtxImpl.WsaJoin() // next state |
|
760 ); |
|
761 } |
|
762 |
|
763 // ----------------------------------------------------------------------------- |
|
764 // |
|
765 // ----------------------------------------------------------------------------- |
|
766 // |
|
767 void WlanDot11PrepareForBssMode::ContinueDot11StateTraversal( |
|
768 WlanContextImpl& aCtxImpl ) |
|
769 { |
|
770 if ( iJoinFailed ) |
|
771 { |
|
772 // set the completion code value to be returned to user mode |
|
773 // as the dot11idle state does the OID completion in this case |
|
774 aCtxImpl.iStates.iIdleState.Set( KErrGeneral ); |
|
775 |
|
776 // go back to dot11Idle state |
|
777 ChangeState( aCtxImpl, |
|
778 *this, // prev state |
|
779 aCtxImpl.iStates.iIdleState // next state |
|
780 ); |
|
781 } |
|
782 else |
|
783 { |
|
784 if ( aCtxImpl.AuthenticationAlgorithmNumber() != |
|
785 K802Dot11AuthModeShared ) |
|
786 { |
|
787 // proceed with open authentication |
|
788 ChangeState( aCtxImpl, |
|
789 *this, // prev state |
|
790 aCtxImpl.iStates.iOpenAuthPendingState // next state |
|
791 ); |
|
792 } |
|
793 else |
|
794 { |
|
795 // proceed with shared authentication |
|
796 ChangeState( aCtxImpl, |
|
797 *this, // prev state |
|
798 aCtxImpl.iStates.iSharedAuthPending // next state |
|
799 ); |
|
800 } |
|
801 } |
|
802 } |