|
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: Implementation of the WlanPowerModeMgrBase class |
|
15 * |
|
16 */ |
|
17 |
|
18 /* |
|
19 * %version: 8 % |
|
20 */ |
|
21 |
|
22 #include "config.h" |
|
23 #include "umacpowermodemgrbase.h" |
|
24 #include "UmacContextImpl.h" |
|
25 |
|
26 // Default frame payload length threshold value (in bytes) for U-APSD |
|
27 const TUint32 KUapsdRxFrameLengthThreshold = 400; |
|
28 |
|
29 |
|
30 // ================= MEMBER FUNCTIONS ======================= |
|
31 |
|
32 // --------------------------------------------------------------------------- |
|
33 // |
|
34 // --------------------------------------------------------------------------- |
|
35 // |
|
36 WlanPowerModeMgrBase::WlanPowerModeMgrBase() : |
|
37 iUapsdRxFrameLengthThreshold( KUapsdRxFrameLengthThreshold ) |
|
38 { |
|
39 } |
|
40 |
|
41 // --------------------------------------------------------------------------- |
|
42 // |
|
43 // --------------------------------------------------------------------------- |
|
44 // |
|
45 WlanPowerModeMgrBase::~WlanPowerModeMgrBase() |
|
46 { |
|
47 } |
|
48 |
|
49 // --------------------------------------------------------------------------- |
|
50 // |
|
51 // --------------------------------------------------------------------------- |
|
52 // |
|
53 TBool WlanPowerModeMgrBase::OnActiveToLightPsTimerTimeout() |
|
54 { |
|
55 return EFalse; |
|
56 } |
|
57 |
|
58 // --------------------------------------------------------------------------- |
|
59 // |
|
60 // --------------------------------------------------------------------------- |
|
61 // |
|
62 TBool WlanPowerModeMgrBase::OnLightPsToActiveTimerTimeout( |
|
63 WlanContextImpl& /*aCtxImpl*/ ) |
|
64 { |
|
65 return EFalse; |
|
66 } |
|
67 |
|
68 // --------------------------------------------------------------------------- |
|
69 // |
|
70 // --------------------------------------------------------------------------- |
|
71 // |
|
72 TBool WlanPowerModeMgrBase::OnLightPsToDeepPsTimerTimeout() |
|
73 { |
|
74 return EFalse; |
|
75 } |
|
76 |
|
77 // --------------------------------------------------------------------------- |
|
78 // |
|
79 // --------------------------------------------------------------------------- |
|
80 // |
|
81 void WlanPowerModeMgrBase::Reset() |
|
82 { |
|
83 DoReset(); |
|
84 } |
|
85 |
|
86 // --------------------------------------------------------------------------- |
|
87 // |
|
88 // --------------------------------------------------------------------------- |
|
89 // |
|
90 TBool WlanPowerModeMgrBase::CountThisFrame( |
|
91 WlanContextImpl& aCtxImpl, |
|
92 WHA::TQueueId aAccessCategory, |
|
93 TUint16 aEtherType, |
|
94 TBool aIgnoreThisFrame, |
|
95 TUint aPayloadLength, |
|
96 TUint16 aUapsdRxFrameLengthThreshold, |
|
97 TDaType aDaType ) |
|
98 { |
|
99 TBool countThisFrame( ETrue ); |
|
100 |
|
101 if ( !( aEtherType == KEapolType || |
|
102 aEtherType == KWaiType ) ) |
|
103 { |
|
104 if ( !aIgnoreThisFrame ) |
|
105 { |
|
106 // this is not a frame to be ignored based on WLAN mgmt client |
|
107 // settings. However, check if it should be ignored for other |
|
108 // reasons |
|
109 |
|
110 if ( aDaType == EBroadcastAddress ) |
|
111 { |
|
112 countThisFrame = EFalse; |
|
113 |
|
114 OsTracePrint( KPwrStateTransition, (TUint8*) |
|
115 ("UMAC: WlanPowerModeMgrBase::CountThisFrame: no; a bcast frame") ); |
|
116 } |
|
117 else if ( aDaType == EMulticastAddress ) |
|
118 { |
|
119 if ( !aCtxImpl.MulticastAddressCount() ) |
|
120 { |
|
121 // no multicast MAC filters defined, so no downlink |
|
122 // multicast data stream expected => don't count the frame |
|
123 countThisFrame = EFalse; |
|
124 |
|
125 OsTracePrint( KPwrStateTransition, (TUint8*) |
|
126 ("UMAC: WlanPowerModeMgrBase::CountThisFrame: no; a mcast frame and no mcast MAC filters defined") ); |
|
127 } |
|
128 else |
|
129 { |
|
130 // at least one multicast MAC filter defined so a downlink |
|
131 // multicast data stream may be expected => count the frame |
|
132 OsTracePrint( KPwrStateTransition, (TUint8*) |
|
133 ("UMAC: WlanPowerModeMgrBase::CountThisFrame: yes; a mcast frame and at least one mcast MAC filter defined") ); |
|
134 } |
|
135 } |
|
136 else |
|
137 { |
|
138 // a unicast frame |
|
139 |
|
140 if ( aCtxImpl.UapsdUsedForBestEffort() && |
|
141 aAccessCategory == WHA::ELegacy && |
|
142 aPayloadLength < aUapsdRxFrameLengthThreshold ) |
|
143 { |
|
144 // U-APSD is being used for Best Effort (Legacy) AC (queue) |
|
145 // and access category of this frame == WHA::ELegacy |
|
146 // and payload is shorter than the defined threshold => |
|
147 // don't count this frame |
|
148 countThisFrame = EFalse; |
|
149 |
|
150 OsTracePrint( KPwrStateTransition, (TUint8*) |
|
151 ("UMAC: WlanPowerModeMgrBase::CountThisFrame: no, as uapsd in use for legacy, AC == legacy and payload < thr")); |
|
152 } |
|
153 else |
|
154 { |
|
155 OsTracePrint( KPwrStateTransition, (TUint8*) |
|
156 ("UMAC: WlanPowerModeMgrBase::CountThisFrame: yes")); |
|
157 } |
|
158 } |
|
159 } |
|
160 else |
|
161 { |
|
162 // this is a frame to be ignored based on WLAN mgmt client AC settings |
|
163 |
|
164 countThisFrame = EFalse; |
|
165 |
|
166 OsTracePrint( KPwrStateTransition, (TUint8*) |
|
167 ("UMAC: WlanPowerModeMgrBase::CountThisFrame: no, as frames are ignored for this queue/AC: %d"), |
|
168 aAccessCategory ); |
|
169 } |
|
170 } |
|
171 else |
|
172 { |
|
173 // EAPOL and WAI frames we always count. Not further actions needed |
|
174 |
|
175 OsTracePrint( KPwrStateTransition, (TUint8*) |
|
176 ("UMAC: WlanPowerModeMgrBase::CountThisFrame: yes; EAPOL or WAI frame")); |
|
177 } |
|
178 |
|
179 return countThisFrame; |
|
180 } |