102 |
104 |
103 void |
105 void |
104 AmrrWifiManager::DoReportRxOk (WifiRemoteStation *station, |
106 AmrrWifiManager::DoReportRxOk (WifiRemoteStation *station, |
105 double rxSnr, WifiMode txMode) |
107 double rxSnr, WifiMode txMode) |
106 { |
108 { |
|
109 NS_LOG_FUNCTION (this << station << rxSnr << txMode); |
107 } |
110 } |
108 void |
111 void |
109 AmrrWifiManager::DoReportRtsFailed (WifiRemoteStation *station) |
112 AmrrWifiManager::DoReportRtsFailed (WifiRemoteStation *station) |
110 { |
113 { |
|
114 NS_LOG_FUNCTION (this << station); |
111 } |
115 } |
112 void |
116 void |
113 AmrrWifiManager::DoReportDataFailed (WifiRemoteStation *st) |
117 AmrrWifiManager::DoReportDataFailed (WifiRemoteStation *st) |
114 { |
118 { |
|
119 NS_LOG_FUNCTION (this << st); |
115 AmrrWifiRemoteStation *station = (AmrrWifiRemoteStation *)st; |
120 AmrrWifiRemoteStation *station = (AmrrWifiRemoteStation *)st; |
116 station->m_retry++; |
121 station->m_retry++; |
117 station->m_tx_retr++; |
122 station->m_tx_retr++; |
118 } |
123 } |
119 void |
124 void |
120 AmrrWifiManager::DoReportRtsOk (WifiRemoteStation *st, |
125 AmrrWifiManager::DoReportRtsOk (WifiRemoteStation *st, |
121 double ctsSnr, WifiMode ctsMode, double rtsSnr) |
126 double ctsSnr, WifiMode ctsMode, double rtsSnr) |
122 { |
127 { |
|
128 NS_LOG_FUNCTION (this << st << ctsSnr << ctsMode << rtsSnr); |
123 } |
129 } |
124 void |
130 void |
125 AmrrWifiManager::DoReportDataOk (WifiRemoteStation *st, |
131 AmrrWifiManager::DoReportDataOk (WifiRemoteStation *st, |
126 double ackSnr, WifiMode ackMode, double dataSnr) |
132 double ackSnr, WifiMode ackMode, double dataSnr) |
127 { |
133 { |
|
134 NS_LOG_FUNCTION (this << st << ackSnr << ackMode << dataSnr); |
128 AmrrWifiRemoteStation *station = (AmrrWifiRemoteStation *)st; |
135 AmrrWifiRemoteStation *station = (AmrrWifiRemoteStation *)st; |
129 station->m_retry = 0; |
136 station->m_retry = 0; |
130 station->m_tx_ok++; |
137 station->m_tx_ok++; |
131 } |
138 } |
132 void |
139 void |
133 AmrrWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *station) |
140 AmrrWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *station) |
134 { |
141 { |
|
142 NS_LOG_FUNCTION (this << station); |
135 } |
143 } |
136 void |
144 void |
137 AmrrWifiManager::DoReportFinalDataFailed (WifiRemoteStation *st) |
145 AmrrWifiManager::DoReportFinalDataFailed (WifiRemoteStation *st) |
138 { |
146 { |
|
147 NS_LOG_FUNCTION (this << st); |
139 AmrrWifiRemoteStation *station = (AmrrWifiRemoteStation *)st; |
148 AmrrWifiRemoteStation *station = (AmrrWifiRemoteStation *)st; |
140 station->m_retry = 0; |
149 station->m_retry = 0; |
141 station->m_tx_err++; |
150 station->m_tx_err++; |
142 } |
151 } |
143 bool |
152 bool |
144 AmrrWifiManager::IsMinRate (AmrrWifiRemoteStation *station) const |
153 AmrrWifiManager::IsMinRate (AmrrWifiRemoteStation *station) const |
145 { |
154 { |
|
155 NS_LOG_FUNCTION (this << station); |
146 return (station->m_txrate == 0); |
156 return (station->m_txrate == 0); |
147 } |
157 } |
148 bool |
158 bool |
149 AmrrWifiManager::IsMaxRate (AmrrWifiRemoteStation *station) const |
159 AmrrWifiManager::IsMaxRate (AmrrWifiRemoteStation *station) const |
150 { |
160 { |
|
161 NS_LOG_FUNCTION (this << station); |
151 NS_ASSERT (station->m_txrate + 1 <= GetNSupported (station)); |
162 NS_ASSERT (station->m_txrate + 1 <= GetNSupported (station)); |
152 return (station->m_txrate + 1 == GetNSupported (station)); |
163 return (station->m_txrate + 1 == GetNSupported (station)); |
153 } |
164 } |
154 bool |
165 bool |
155 AmrrWifiManager::IsSuccess (AmrrWifiRemoteStation *station) const |
166 AmrrWifiManager::IsSuccess (AmrrWifiRemoteStation *station) const |
156 { |
167 { |
|
168 NS_LOG_FUNCTION (this << station); |
157 return (station->m_tx_retr + station->m_tx_err) < station->m_tx_ok * m_successRatio; |
169 return (station->m_tx_retr + station->m_tx_err) < station->m_tx_ok * m_successRatio; |
158 } |
170 } |
159 bool |
171 bool |
160 AmrrWifiManager::IsFailure (AmrrWifiRemoteStation *station) const |
172 AmrrWifiManager::IsFailure (AmrrWifiRemoteStation *station) const |
161 { |
173 { |
|
174 NS_LOG_FUNCTION (this << station); |
162 return (station->m_tx_retr + station->m_tx_err) > station->m_tx_ok * m_failureRatio; |
175 return (station->m_tx_retr + station->m_tx_err) > station->m_tx_ok * m_failureRatio; |
163 } |
176 } |
164 bool |
177 bool |
165 AmrrWifiManager::IsEnough (AmrrWifiRemoteStation *station) const |
178 AmrrWifiManager::IsEnough (AmrrWifiRemoteStation *station) const |
166 { |
179 { |
|
180 NS_LOG_FUNCTION (this << station); |
167 return (station->m_tx_retr + station->m_tx_err + station->m_tx_ok) > 10; |
181 return (station->m_tx_retr + station->m_tx_err + station->m_tx_ok) > 10; |
168 } |
182 } |
169 void |
183 void |
170 AmrrWifiManager::ResetCnt (AmrrWifiRemoteStation *station) |
184 AmrrWifiManager::ResetCnt (AmrrWifiRemoteStation *station) |
171 { |
185 { |
|
186 NS_LOG_FUNCTION (this << station); |
172 station->m_tx_ok = 0; |
187 station->m_tx_ok = 0; |
173 station->m_tx_err = 0; |
188 station->m_tx_err = 0; |
174 station->m_tx_retr = 0; |
189 station->m_tx_retr = 0; |
175 } |
190 } |
176 void |
191 void |
177 AmrrWifiManager::IncreaseRate (AmrrWifiRemoteStation *station) |
192 AmrrWifiManager::IncreaseRate (AmrrWifiRemoteStation *station) |
178 { |
193 { |
|
194 NS_LOG_FUNCTION (this << station); |
179 station->m_txrate++; |
195 station->m_txrate++; |
180 NS_ASSERT (station->m_txrate < GetNSupported (station)); |
196 NS_ASSERT (station->m_txrate < GetNSupported (station)); |
181 } |
197 } |
182 void |
198 void |
183 AmrrWifiManager::DecreaseRate (AmrrWifiRemoteStation *station) |
199 AmrrWifiManager::DecreaseRate (AmrrWifiRemoteStation *station) |
184 { |
200 { |
|
201 NS_LOG_FUNCTION (this << station); |
185 station->m_txrate--; |
202 station->m_txrate--; |
186 } |
203 } |
187 |
204 |
188 void |
205 void |
189 AmrrWifiManager::UpdateMode (AmrrWifiRemoteStation *station) |
206 AmrrWifiManager::UpdateMode (AmrrWifiRemoteStation *station) |
190 { |
207 { |
|
208 NS_LOG_FUNCTION (this << station); |
191 if (Simulator::Now () < station->m_nextModeUpdate) |
209 if (Simulator::Now () < station->m_nextModeUpdate) |
192 { |
210 { |
193 return; |
211 return; |
194 } |
212 } |
195 station->m_nextModeUpdate = Simulator::Now () + m_updatePeriod; |
213 station->m_nextModeUpdate = Simulator::Now () + m_updatePeriod; |