|
1 /* |
|
2 * Copyright (c) 2006-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: Declaration of the WlanDynamicPowerModeMgmtCntx class |
|
15 * |
|
16 */ |
|
17 |
|
18 /* |
|
19 * %version: 12 % |
|
20 */ |
|
21 |
|
22 #ifndef WLAN_DYNAMIC_POWER_MODE_MGMT_CNTX |
|
23 #define WLAN_DYNAMIC_POWER_MODE_MGMT_CNTX |
|
24 |
|
25 #include "umacinternaldefinitions.h" |
|
26 #include "umacactivemodepowermodemgr.h" |
|
27 #include "umaclightpsmodepowermodemgr.h" |
|
28 #include "umacdeeppsmodepowermodemgr.h" |
|
29 |
|
30 class WlanContextImpl; |
|
31 class WlanPowerModeMgrBase; |
|
32 |
|
33 /* |
|
34 * Context for implementing dynamic power mode transition algorithm in |
|
35 * infrastructure mode between PS and active power management mode |
|
36 */ |
|
37 class WlanDynamicPowerModeMgmtCntx |
|
38 { |
|
39 |
|
40 public: |
|
41 |
|
42 /** Ctor */ |
|
43 explicit WlanDynamicPowerModeMgmtCntx( WlanContextImpl& aWlanCtxImpl ); |
|
44 |
|
45 /** Dtor */ |
|
46 ~WlanDynamicPowerModeMgmtCntx(); |
|
47 |
|
48 /** |
|
49 * Starts dynamic power mode management |
|
50 * |
|
51 * @since S60 3.1 |
|
52 */ |
|
53 void StartPowerModeManagement(); |
|
54 |
|
55 /** |
|
56 * Stops dynamic power mode management |
|
57 * |
|
58 * @since S60 3.1 |
|
59 */ |
|
60 void StopPowerModeManagement(); |
|
61 |
|
62 /** |
|
63 * To be called before frame Tx |
|
64 * Determines the need to make a power mode transition |
|
65 * |
|
66 * @since S60 3.1 |
|
67 * @param aQueueId Id of the queue/AC via which the frame will be transmitted |
|
68 * @param aEtherType Ethernet type of the frame |
|
69 * @return To which power management mode to change; if any at all |
|
70 */ |
|
71 TPowerMgmtModeChange OnFrameTx( |
|
72 WHA::TQueueId aQueueId, |
|
73 TUint16 aEtherType ); |
|
74 |
|
75 /** |
|
76 * To be called when accepting an Rx frame |
|
77 * |
|
78 * @since S60 3.1 |
|
79 * @param aAccessCategory AC/Queue via which the frame has beeen transmitted |
|
80 * @param aEtherType Ethernet type of the received frame |
|
81 * @param aPayloadLength length of the ethernet frame payload |
|
82 * @param aDaType DA type (Unicast, Multicast or Broadcast) of the frame |
|
83 * @return To which power management mode to change; if any at all |
|
84 */ |
|
85 TPowerMgmtModeChange OnFrameRx( |
|
86 WHA::TQueueId aAccessCategory, |
|
87 TUint16 aEtherType, |
|
88 TUint aPayloadLength, |
|
89 TDaType aDaType ); |
|
90 |
|
91 /** |
|
92 * To be called upon Active to Light PS timer timeout |
|
93 * |
|
94 * @since S60 v5.1 |
|
95 * @return ETrue if power mode transition should be done, |
|
96 * EFalse otherwise |
|
97 */ |
|
98 TBool OnActiveToLightPsTimerTimeout(); |
|
99 |
|
100 /** |
|
101 * To be called upon Light PS to Active timer timeout |
|
102 * |
|
103 * @since S60 v5.1 |
|
104 * @return ETrue if power mode transition should be done, |
|
105 * EFalse otherwise |
|
106 */ |
|
107 TBool OnLightPsToActiveTimerTimeout(); |
|
108 |
|
109 /** |
|
110 * To be called upon Light PS to Deep PS timer timeout |
|
111 * |
|
112 * @since S60 v5.1 |
|
113 * @return ETrue if power mode transition should be done, |
|
114 * EFalse otherwise |
|
115 */ |
|
116 TBool OnLightPsToDeepPsTimerTimeout(); |
|
117 |
|
118 /** |
|
119 * Sets the dynamic power mode transition algorithm parameters |
|
120 * |
|
121 * @since S60 3.1 |
|
122 * @param aToLightPsTimeout time interval in microseconds after which |
|
123 * transition from Active mode to Light PS mode is considered |
|
124 * @param aToLightPsFrameThreshold frame count threshold used when |
|
125 * considering transition from Active to Light PS mode |
|
126 * @param aToActiveTimeout time interval in microseconds after which the |
|
127 * frame counter used when considering transition from Light PS |
|
128 * to Active mode is reset |
|
129 * @param aToActiveFrameThreshold frame count threshold used when |
|
130 * considering transition from Light PS to Active mode |
|
131 * @param aToDeepPsTimeout time interval in microseconds after which |
|
132 * transition from Light PS mode to Deep PS mode is considered |
|
133 * @param aToDeepPsFrameThreshold frame count threshold used when |
|
134 * considering transition from Light PS to Deep PS mode |
|
135 * @param aUapsdRxFrameLengthThreshold received frame |
|
136 * payload length (in bytes) threshold in U-APSD network for |
|
137 * Best Effort Access Category |
|
138 */ |
|
139 void SetParameters( |
|
140 TUint32 aToLightPsTimeout, |
|
141 TUint16 aToLightPsFrameThreshold, |
|
142 TUint32 aToActiveTimeout, |
|
143 TUint16 aToActiveFrameThreshold, |
|
144 TUint32 aToDeepPsTimeout, |
|
145 TUint16 aToDeepPsFrameThreshold, |
|
146 TUint16 aUapsdRxFrameLengthThreshold ); |
|
147 |
|
148 /** |
|
149 * Configures dynamic power mode management traffic override |
|
150 * |
|
151 * The settings here become effective once using the PS mode has been |
|
152 * allowed by WLAN Mgmt Client. |
|
153 * When a setting below is ETrue, any amount of Rx or Tx traffic via |
|
154 * the AC in question won't cause a change from PS to CAM mode once PS |
|
155 * mode has been entered, and traffic via that AC won't make us to |
|
156 * stay in CAM either. |
|
157 * Every AC has a separate setting for U-APSD and legacy PS. |
|
158 * The U-APSD setting is used if U-APSD is used for the AC in question. |
|
159 * Otherwise the corresponding legacy setting is used. |
|
160 * |
|
161 * @since S60 3.2 |
|
162 * @param aCtxImpl statemachine context |
|
163 * @param aStayInPsDespiteUapsdVoiceTraffic U-APSD Voice AC setting |
|
164 * @param aStayInPsDespiteUapsdVideoTraffic U-APSD Video AC setting |
|
165 * @param aStayInPsDespiteUapsdBestEffortTraffic U-APSD Best Effort AC |
|
166 * setting |
|
167 * @param aStayInPsDespiteUapsdBackgroundTraffic U-APSD Background AC |
|
168 * setting |
|
169 * @param aStayInPsDespiteLegacyVoiceTraffic legacy Voice AC setting |
|
170 * @param aStayInPsDespiteLegacyVideoTraffic legacy Video AC setting |
|
171 * @param aStayInPsDespiteLegacyBestEffortTraffic legacy Best Effort AC |
|
172 * setting |
|
173 * @param aStayInPsDespiteLegacyBackgroundTraffic legacy Background AC |
|
174 * setting |
|
175 * @return ETrue if a state change occurred |
|
176 * EFalse otherwise |
|
177 */ |
|
178 void ConfigureTrafficOverride( |
|
179 TBool aStayInPsDespiteUapsdVoiceTraffic, |
|
180 TBool aStayInPsDespiteUapsdVideoTraffic, |
|
181 TBool aStayInPsDespiteUapsdBestEffortTraffic, |
|
182 TBool aStayInPsDespiteUapsdBackgroundTraffic, |
|
183 TBool aStayInPsDespiteLegacyVoiceTraffic, |
|
184 TBool aStayInPsDespiteLegacyVideoTraffic, |
|
185 TBool aStayInPsDespiteLegacyBestEffortTraffic, |
|
186 TBool aStayInPsDespiteLegacyBackgroundTraffic ); |
|
187 |
|
188 /** |
|
189 * Freezes the dynamic power mode management traffic override settings |
|
190 * provided earlier with the ConfigureTrafficOverride() method and based |
|
191 * on whether U-APSD is used for the different ACs/Tx queues |
|
192 * |
|
193 * @since S60 3.2 |
|
194 */ |
|
195 void FreezeTrafficOverride(); |
|
196 |
|
197 private: |
|
198 |
|
199 /** |
|
200 * Starts ToLightPsTimer |
|
201 * |
|
202 * @since S60 5.1 |
|
203 * @param aTimeout timeout in microseconds |
|
204 */ |
|
205 void RegisterToLightPsTimeout(); |
|
206 |
|
207 /** |
|
208 * Starts ToActiveTimer |
|
209 * |
|
210 * @since S60 5.1 |
|
211 * @param aTimeout timeout in microseconds |
|
212 */ |
|
213 void RegisterToActiveTimeout(); |
|
214 |
|
215 /** |
|
216 * Starts ToDeepPsTimer |
|
217 * |
|
218 * @since S60 5.1 |
|
219 * @param aTimeout timeout in microseconds |
|
220 */ |
|
221 void RegisterToDeepPsTimeout(); |
|
222 |
|
223 /** |
|
224 * Cancels ToLightPsTimer |
|
225 * |
|
226 * @since S60 5.1 |
|
227 * @param aTimeout timeout in microseconds |
|
228 */ |
|
229 void CancelToLightPsTimeout(); |
|
230 |
|
231 /** |
|
232 * Cancels ToActiveTimer |
|
233 * |
|
234 * @since S60 5.1 |
|
235 * @param aTimeout timeout in microseconds |
|
236 */ |
|
237 void CancelToActiveTimeout(); |
|
238 |
|
239 /** |
|
240 * Cancels ToDeepPsTimer |
|
241 * |
|
242 * @since S60 5.1 |
|
243 * @param aTimeout timeout in microseconds |
|
244 */ |
|
245 void CancelToDeepPsTimeout(); |
|
246 |
|
247 /** |
|
248 * Cancels all running timers |
|
249 * |
|
250 * @since S60 5.1 |
|
251 */ |
|
252 inline void CancelTimeouts(); |
|
253 |
|
254 /** |
|
255 * Returns data traffic override setting for Voice AC |
|
256 * regarding U-APSD traffic |
|
257 * |
|
258 * @since S60 3.1 |
|
259 * @return ETrue if Voice AC traffic shall be ignored |
|
260 */ |
|
261 inline TBool StayInPsDespiteUapsdVoiceTraffic() const; |
|
262 |
|
263 /** |
|
264 * Returns data traffic override setting for Video AC |
|
265 * regarding U-APSD traffic |
|
266 * |
|
267 * @since S60 3.1 |
|
268 * @return ETrue if Video AC traffic shall be ignored |
|
269 */ |
|
270 inline TBool StayInPsDespiteUapsdVideoTraffic() const; |
|
271 |
|
272 /** |
|
273 * Returns data traffic override setting for Best Effort AC |
|
274 * regarding U-APSD traffic |
|
275 * |
|
276 * @since S60 3.1 |
|
277 * @return ETrue if Best Effort AC traffic shall be ignored |
|
278 */ |
|
279 inline TBool StayInPsDespiteUapsdBestEffortTraffic() const; |
|
280 |
|
281 /** |
|
282 * Returns data traffic override setting for Background AC |
|
283 * regarding U-APSD traffic |
|
284 * |
|
285 * @since S60 3.1 |
|
286 * @return ETrue if Background AC traffic shall be ignored |
|
287 */ |
|
288 inline TBool StayInPsDespiteUapsdBackgroundTraffic() const; |
|
289 |
|
290 /** |
|
291 * Returns data traffic override setting for Voice AC |
|
292 * regarding legacy, i.e. non-U-APSD, traffic |
|
293 * |
|
294 * @since S60 3.1 |
|
295 * @return ETrue if Voice AC traffic shall be ignored |
|
296 */ |
|
297 inline TBool StayInPsDespiteLegacyVoiceTraffic() const; |
|
298 |
|
299 /** |
|
300 * Returns data traffic override setting for Video AC |
|
301 * regarding legacy, i.e. non-U-APSD, traffic |
|
302 * |
|
303 * @since S60 3.1 |
|
304 * @return ETrue if Video AC traffic shall be ignored |
|
305 */ |
|
306 inline TBool StayInPsDespiteLegacyVideoTraffic() const; |
|
307 |
|
308 /** |
|
309 * Returns data traffic override setting for Best Effort AC |
|
310 * regarding legacy, i.e. non-U-APSD, traffic |
|
311 * |
|
312 * @since S60 3.1 |
|
313 * @return ETrue if Best Effort AC traffic shall be ignored |
|
314 */ |
|
315 inline TBool StayInPsDespiteLegacyBestEffortTraffic() const; |
|
316 |
|
317 /** |
|
318 * Returns data traffic override setting for Background AC |
|
319 * regarding legacy, i.e. non-U-APSD, traffic |
|
320 * |
|
321 * @since S60 3.1 |
|
322 * @return ETrue if Background AC traffic shall be ignored |
|
323 */ |
|
324 inline TBool StayInPsDespiteLegacyBackgroundTraffic() const; |
|
325 |
|
326 // Prohibit copy constructor |
|
327 WlanDynamicPowerModeMgmtCntx( |
|
328 const WlanDynamicPowerModeMgmtCntx& ); |
|
329 // Prohibit assigment operator |
|
330 WlanDynamicPowerModeMgmtCntx& operator= |
|
331 ( const WlanDynamicPowerModeMgmtCntx& ); |
|
332 |
|
333 private: // Data |
|
334 |
|
335 /** flag value to store state transition need internally */ |
|
336 TBool iStateChange; |
|
337 /** stores the flags defined below */ |
|
338 TUint32 iFlags; |
|
339 /** |
|
340 * any amount of U-APSD Voice AC Rx or Tx traffic won't cause a |
|
341 * change from PS to CAM mode once PS mode has been entered |
|
342 */ |
|
343 static const TUint32 KStayInPsDespiteUapsdVoiceTraffic = ( 1 << 0 ); |
|
344 /** |
|
345 * any amount of U-APSD Video AC Rx or Tx traffic won't cause a |
|
346 * change from PS to CAM mode once PS mode has been entered |
|
347 */ |
|
348 static const TUint32 KStayInPsDespiteUapsdVideoTraffic = ( 1 << 1 ); |
|
349 /** |
|
350 * any amount of U-APSD Best Effort AC Rx or Tx traffic won't cause a |
|
351 * change from PS to CAM mode once PS mode has been entered |
|
352 */ |
|
353 static const TUint32 KStayInPsDespiteUapsdBestEffortTraffic = ( 1 << 2 ); |
|
354 /** |
|
355 * any amount of U-APSD Background AC Rx or Tx traffic won't cause a |
|
356 * change from PS to CAM mode once PS mode has been entered |
|
357 */ |
|
358 static const TUint32 KStayInPsDespiteUapsdBackgroundTraffic = ( 1 << 3 ); |
|
359 /** |
|
360 * any amount of legacy, i.e. non U-APSD, Voice AC Rx or Tx traffic |
|
361 * won't cause a change from PS to CAM mode once PS mode has been entered |
|
362 */ |
|
363 static const TUint32 KStayInPsDespiteLegacyVoiceTraffic = ( 1 << 4 ); |
|
364 /** |
|
365 * any amount of legacy, i.e. non U-APSD, Video AC Rx or Tx traffic |
|
366 * won't cause a change from PS to CAM mode once PS mode has been entered |
|
367 */ |
|
368 static const TUint32 KStayInPsDespiteLegacyVideoTraffic = ( 1 << 5 ); |
|
369 /** |
|
370 * any amount of legacy, i.e. non U-APSD, Best Effort AC Rx or Tx traffic |
|
371 * won't cause a change from PS to CAM mode once PS mode has been entered |
|
372 */ |
|
373 static const TUint32 KStayInPsDespiteLegacyBestEffortTraffic = ( 1 << 6 ); |
|
374 /** |
|
375 * any amount of legacy, i.e. non U-APSD, Background AC Rx or Tx traffic |
|
376 * won't cause a change from PS to CAM mode once PS mode has been entered |
|
377 */ |
|
378 static const TUint32 KStayInPsDespiteLegacyBackgroundTraffic = ( 1 << 7 ); |
|
379 /** ToLightPsTimer started */ |
|
380 static const TUint32 KToLightPsTimerStarted = ( 1 << 8 ); |
|
381 /** ToActiveTimer started */ |
|
382 static const TUint32 KToActiveTimerStarted = ( 1 << 9 ); |
|
383 /** ToDeepPsTimer started */ |
|
384 static const TUint32 KToDeepPsTimerStarted = ( 1 << 10 ); |
|
385 |
|
386 // time interval in microseconds after which transition from Active |
|
387 // mode to Light PS mode is considered. |
|
388 TUint32 iToLightPsTimeout; |
|
389 |
|
390 // time interval in microseconds after which the frame counter |
|
391 // used when considering transition from Light PS to Active mode is reset. |
|
392 TUint32 iToActiveTimeout; |
|
393 |
|
394 // time interval in microseconds after which transition from Light PS |
|
395 // mode to Deep PS mode is considered. |
|
396 TUint32 iToDeepPsTimeout; |
|
397 |
|
398 /** currently active power management mode context */ |
|
399 WlanPowerModeMgrBase* iActiveCntx; |
|
400 /** context for active mode */ |
|
401 WlanActiveModePowerModeMgr iActiveModeCntx; |
|
402 /** context for Light PS mode */ |
|
403 WlanLightPsModePowerModeMgr iLightPsModeCntx; |
|
404 /** context for Deep PS mode */ |
|
405 WlanDeepPsModePowerModeMgr iDeepPsModeCntx; |
|
406 /** global state machine context reference */ |
|
407 WlanContextImpl& iWlanContextImpl; |
|
408 /** |
|
409 * the frozen Rx & Tx traffic ignoration setting for every AC |
|
410 */ |
|
411 TBool iIgnoreTraffic[WHA::EQueueIdMax]; |
|
412 }; |
|
413 |
|
414 #include "umacdynamicpowermodemgmtcntx.inl" |
|
415 |
|
416 #endif // WLAN_DYNAMIC_POWER_MODE_MGMT_CNTX |