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