LEFT | RIGHT |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2008 INRIA | 3 * Copyright (c) 2008 INRIA |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with this program; if not, write to the Free Software | 15 * along with this program; if not, write to the Free Software |
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 * | 17 * |
18 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> | 18 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
19 */ | 19 */ |
20 | 20 |
21 #include "regular-wifi-mac.h" | |
22 #include "ns3/log.h" | 21 #include "ns3/log.h" |
23 #include "ns3/pointer.h" | 22 #include "ns3/pointer.h" |
| 23 #include "ns3/packet.h" |
| 24 #include "regular-wifi-mac.h" |
| 25 #include "wifi-phy.h" |
24 #include "mac-rx-middle.h" | 26 #include "mac-rx-middle.h" |
25 #include "mac-tx-middle.h" | 27 #include "mac-tx-middle.h" |
26 #include "mac-low.h" | 28 #include "mac-low.h" |
27 #include "dcf-manager.h" | 29 #include "dcf-manager.h" |
28 #include "msdu-standard-aggregator.h" | 30 #include "msdu-aggregator.h" |
29 #include "mpdu-standard-aggregator.h" | 31 #include "mpdu-aggregator.h" |
| 32 #include "wifi-utils.h" |
| 33 #include "mgt-headers.h" |
| 34 #include "amsdu-subframe-header.h" |
30 | 35 |
31 namespace ns3 { | 36 namespace ns3 { |
32 | 37 |
33 NS_LOG_COMPONENT_DEFINE ("RegularWifiMac"); | 38 NS_LOG_COMPONENT_DEFINE ("RegularWifiMac"); |
34 | 39 |
35 NS_OBJECT_ENSURE_REGISTERED (RegularWifiMac); | 40 NS_OBJECT_ENSURE_REGISTERED (RegularWifiMac); |
36 | 41 |
37 RegularWifiMac::RegularWifiMac () | 42 RegularWifiMac::RegularWifiMac () |
38 : m_htSupported (0), | 43 : m_htSupported (0), |
39 m_vhtSupported (0), | 44 m_vhtSupported (0), |
40 m_erpSupported (0), | 45 m_erpSupported (0), |
41 m_dsssSupported (0), | 46 m_dsssSupported (0), |
42 m_heSupported (0) | 47 m_heSupported (0) |
43 { | 48 { |
44 NS_LOG_FUNCTION (this); | 49 NS_LOG_FUNCTION (this); |
45 m_rxMiddle = Create<MacRxMiddle> (); | 50 m_rxMiddle = Create<MacRxMiddle> (); |
46 m_rxMiddle->SetForwardCallback (MakeCallback (&RegularWifiMac::Receive, this))
; | 51 m_rxMiddle->SetForwardCallback (MakeCallback (&RegularWifiMac::Receive, this))
; |
47 | 52 |
48 m_txMiddle = Create<MacTxMiddle> (); | 53 m_txMiddle = Create<MacTxMiddle> (); |
49 | 54 |
50 m_low = CreateObject<MacLow> (); | 55 m_low = CreateObject<MacLow> (); |
51 m_low->SetRxCallback (MakeCallback (&MacRxMiddle::Receive, m_rxMiddle)); | 56 m_low->SetRxCallback (MakeCallback (&MacRxMiddle::Receive, m_rxMiddle)); |
52 | 57 |
53 m_dcfManager = CreateObject<DcfManager> (); | 58 m_dcfManager = CreateObject<DcfManager> (); |
54 m_dcfManager->SetupLow (m_low); | 59 m_dcfManager->SetupLow (m_low); |
55 | 60 |
56 m_dca = CreateObject<DcaTxop> (); | 61 m_dca = CreateObject<DcaTxop> (); |
57 m_dca->SetLow (m_low); | 62 m_dca->SetMacLow (m_low); |
58 m_dca->SetManager (m_dcfManager); | 63 m_dca->SetDcfManager (m_dcfManager); |
59 m_dca->SetTxMiddle (m_txMiddle); | 64 m_dca->SetTxMiddle (m_txMiddle); |
60 m_dca->SetTxOkCallback (MakeCallback (&RegularWifiMac::TxOk, this)); | 65 m_dca->SetTxOkCallback (MakeCallback (&RegularWifiMac::TxOk, this)); |
61 m_dca->SetTxFailedCallback (MakeCallback (&RegularWifiMac::TxFailed, this)); | 66 m_dca->SetTxFailedCallback (MakeCallback (&RegularWifiMac::TxFailed, this)); |
62 m_dca->SetTxDroppedCallback (MakeCallback (&RegularWifiMac::NotifyTxDrop, this
)); | 67 m_dca->SetTxDroppedCallback (MakeCallback (&RegularWifiMac::NotifyTxDrop, this
)); |
63 | 68 |
64 //Construct the EDCAFs. The ordering is important - highest | 69 //Construct the EDCAFs. The ordering is important - highest |
65 //priority (Table 9-1 UP-to-AC mapping; IEEE 802.11-2012) must be created | 70 //priority (Table 9-1 UP-to-AC mapping; IEEE 802.11-2012) must be created |
66 //first. | 71 //first. |
67 SetupEdcaQueue (AC_VO); | 72 SetupEdcaQueue (AC_VO); |
68 SetupEdcaQueue (AC_VI); | 73 SetupEdcaQueue (AC_VI); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i) | 134 for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i) |
130 { | 135 { |
131 i->second->SetWifiRemoteStationManager (stationManager); | 136 i->second->SetWifiRemoteStationManager (stationManager); |
132 } | 137 } |
133 } | 138 } |
134 | 139 |
135 Ptr<WifiRemoteStationManager> | 140 Ptr<WifiRemoteStationManager> |
136 RegularWifiMac::GetWifiRemoteStationManager () const | 141 RegularWifiMac::GetWifiRemoteStationManager () const |
137 { | 142 { |
138 return m_stationManager; | 143 return m_stationManager; |
| 144 } |
| 145 |
| 146 ExtendedCapabilities |
| 147 RegularWifiMac::GetExtendedCapabilities (void) const |
| 148 { |
| 149 NS_LOG_FUNCTION (this); |
| 150 ExtendedCapabilities capabilities; |
| 151 if (m_htSupported || m_vhtSupported) |
| 152 { |
| 153 if (m_htSupported) |
| 154 { |
| 155 capabilities.SetHtSupported (1); |
| 156 } |
| 157 if (m_vhtSupported) |
| 158 { |
| 159 capabilities.SetVhtSupported (1); |
| 160 } |
| 161 } |
| 162 //TODO: to be completed |
| 163 return capabilities; |
139 } | 164 } |
140 | 165 |
141 HtCapabilities | 166 HtCapabilities |
142 RegularWifiMac::GetHtCapabilities (void) const | 167 RegularWifiMac::GetHtCapabilities (void) const |
143 { | 168 { |
144 NS_LOG_FUNCTION (this); | 169 NS_LOG_FUNCTION (this); |
145 HtCapabilities capabilities; | 170 HtCapabilities capabilities; |
146 if (m_htSupported) | 171 if (m_htSupported) |
147 { | 172 { |
148 capabilities.SetHtSupported (1); | 173 capabilities.SetHtSupported (1); |
(...skipping 23 matching lines...) Expand all Loading... |
172 capabilities.SetRxMcsBitmask (mcs.GetMcsValue ()); | 197 capabilities.SetRxMcsBitmask (mcs.GetMcsValue ()); |
173 uint8_t nss = (mcs.GetMcsValue () / 8) + 1; | 198 uint8_t nss = (mcs.GetMcsValue () / 8) + 1; |
174 NS_ASSERT (nss > 0 && nss < 5); | 199 NS_ASSERT (nss > 0 && nss < 5); |
175 uint64_t dataRate = mcs.GetDataRate (m_phy->GetChannelWidth (), m_phy-
>GetShortGuardInterval () ? 400 : 800, nss); | 200 uint64_t dataRate = mcs.GetDataRate (m_phy->GetChannelWidth (), m_phy-
>GetShortGuardInterval () ? 400 : 800, nss); |
176 if (dataRate > maxSupportedRate) | 201 if (dataRate > maxSupportedRate) |
177 { | 202 { |
178 maxSupportedRate = dataRate; | 203 maxSupportedRate = dataRate; |
179 NS_LOG_DEBUG ("Updating maxSupportedRate to " << maxSupportedRate)
; | 204 NS_LOG_DEBUG ("Updating maxSupportedRate to " << maxSupportedRate)
; |
180 } | 205 } |
181 } | 206 } |
182 capabilities.SetRxHighestSupportedDataRate ((uint16_t)(maxSupportedRate /
1e6)); //in Mbit/s | 207 capabilities.SetRxHighestSupportedDataRate (static_cast<uint16_t> (maxSupp
ortedRate / 1e6)); //in Mbit/s |
183 capabilities.SetTxMcsSetDefined (m_phy->GetNMcs () > 0); | 208 capabilities.SetTxMcsSetDefined (m_phy->GetNMcs () > 0); |
184 capabilities.SetTxMaxNSpatialStreams (m_phy->GetMaxSupportedTxSpatialStrea
ms ()); | 209 capabilities.SetTxMaxNSpatialStreams (m_phy->GetMaxSupportedTxSpatialStrea
ms ()); |
| 210 //we do not support unequal modulations |
| 211 capabilities.SetTxRxMcsSetUnequal (0); |
| 212 capabilities.SetTxUnequalModulation (0); |
185 } | 213 } |
186 return capabilities; | 214 return capabilities; |
187 } | 215 } |
188 | 216 |
189 VhtCapabilities | 217 VhtCapabilities |
190 RegularWifiMac::GetVhtCapabilities (void) const | 218 RegularWifiMac::GetVhtCapabilities (void) const |
191 { | 219 { |
192 NS_LOG_FUNCTION (this); | 220 NS_LOG_FUNCTION (this); |
193 VhtCapabilities capabilities; | 221 VhtCapabilities capabilities; |
194 if (m_vhtSupported) | 222 if (m_vhtSupported) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 if (mcs.GetModulationClass () != WIFI_MOD_CLASS_VHT || !mcs.IsAllowed
(m_phy->GetChannelWidth (), 1)) | 264 if (mcs.GetModulationClass () != WIFI_MOD_CLASS_VHT || !mcs.IsAllowed
(m_phy->GetChannelWidth (), 1)) |
237 { | 265 { |
238 continue; | 266 continue; |
239 } | 267 } |
240 if (mcs.GetDataRate (m_phy->GetChannelWidth ()) > maxSupportedRateLGI) | 268 if (mcs.GetDataRate (m_phy->GetChannelWidth ()) > maxSupportedRateLGI) |
241 { | 269 { |
242 maxSupportedRateLGI = mcs.GetDataRate (m_phy->GetChannelWidth ()); | 270 maxSupportedRateLGI = mcs.GetDataRate (m_phy->GetChannelWidth ()); |
243 NS_LOG_DEBUG ("Updating maxSupportedRateLGI to " << maxSupportedRa
teLGI); | 271 NS_LOG_DEBUG ("Updating maxSupportedRateLGI to " << maxSupportedRa
teLGI); |
244 } | 272 } |
245 } | 273 } |
246 capabilities.SetRxHighestSupportedLgiDataRate ((uint16_t)(maxSupportedRate
LGI / 1e6)); //in Mbit/s | 274 capabilities.SetRxHighestSupportedLgiDataRate (static_cast<uint16_t> (maxS
upportedRateLGI / 1e6)); //in Mbit/s |
247 capabilities.SetTxHighestSupportedLgiDataRate ((uint16_t)(maxSupportedRate
LGI / 1e6)); //in Mbit/s | 275 capabilities.SetTxHighestSupportedLgiDataRate (static_cast<uint16_t> (maxS
upportedRateLGI / 1e6)); //in Mbit/s |
248 //To be filled in once supported | 276 //To be filled in once supported |
249 capabilities.SetRxStbc (0); | 277 capabilities.SetRxStbc (0); |
250 capabilities.SetTxStbc (0); | 278 capabilities.SetTxStbc (0); |
251 } | 279 } |
252 return capabilities; | 280 return capabilities; |
253 } | 281 } |
254 | 282 |
255 HeCapabilities | 283 HeCapabilities |
256 RegularWifiMac::GetHeCapabilities (void) const | 284 RegularWifiMac::GetHeCapabilities (void) const |
257 { | 285 { |
258 NS_LOG_FUNCTION (this); | 286 NS_LOG_FUNCTION (this); |
259 HeCapabilities capabilities; | 287 HeCapabilities capabilities; |
260 if (m_heSupported) | 288 if (m_heSupported) |
261 { | 289 { |
262 capabilities.SetHeSupported (1); | 290 capabilities.SetHeSupported (1); |
263 uint8_t channelWidthSet = 0; | 291 uint8_t channelWidthSet = 0; |
264 if (m_phy->GetChannelWidth () >= 40 && m_phy->Is2_4Ghz (m_phy->GetFrequenc
y ())) | 292 if (m_phy->GetChannelWidth () >= 40 && Is2_4Ghz (m_phy->GetFrequency ())) |
265 { | 293 { |
266 channelWidthSet |= 0x01; | 294 channelWidthSet |= 0x01; |
267 } | 295 } |
268 if (m_phy->GetChannelWidth () >= 80 && m_phy->Is5Ghz (m_phy->GetFrequency
())) | 296 if (m_phy->GetChannelWidth () >= 80 && Is5Ghz (m_phy->GetFrequency ())) |
269 { | 297 { |
270 channelWidthSet |= 0x02; | 298 channelWidthSet |= 0x02; |
271 } | 299 } |
272 if (m_phy->GetChannelWidth () >= 160 && m_phy->Is5Ghz (m_phy->GetFrequency
())) | 300 if (m_phy->GetChannelWidth () >= 160 && Is5Ghz (m_phy->GetFrequency ())) |
273 { | 301 { |
274 channelWidthSet |= 0x04; | 302 channelWidthSet |= 0x04; |
275 } | 303 } |
276 capabilities.SetChannelWidthSet (channelWidthSet); | 304 capabilities.SetChannelWidthSet (channelWidthSet); |
277 uint8_t gi = 0; | 305 uint8_t gi = 0; |
278 if (m_phy->GetGuardInterval () <= NanoSeconds (1600)) | 306 if (m_phy->GetGuardInterval () <= NanoSeconds (1600)) |
279 { | 307 { |
280 //todo: We assume for now that if we support 800ns GI then 1600ns GI i
s supported as well | 308 //todo: We assume for now that if we support 800ns GI then 1600ns GI i
s supported as well |
281 gi |= 0x01; | 309 gi |= 0x01; |
282 } | 310 } |
(...skipping 19 matching lines...) Expand all Loading... |
302 maxMcs = mcs.GetMcsValue (); | 330 maxMcs = mcs.GetMcsValue (); |
303 } | 331 } |
304 } | 332 } |
305 capabilities.SetHighestMcsSupported (maxMcs); | 333 capabilities.SetHighestMcsSupported (maxMcs); |
306 capabilities.SetHighestNssSupported (m_phy->GetMaxSupportedTxSpatialStream
s ()); | 334 capabilities.SetHighestNssSupported (m_phy->GetMaxSupportedTxSpatialStream
s ()); |
307 } | 335 } |
308 return capabilities; | 336 return capabilities; |
309 } | 337 } |
310 | 338 |
311 void | 339 void |
312 RegularWifiMac::SetVoMaxAmsduSize (uint32_t size) | 340 RegularWifiMac::SetVoMaxAmsduSize (uint16_t size) |
313 { | 341 { |
314 NS_LOG_FUNCTION (this << size); | 342 NS_LOG_FUNCTION (this << size); |
315 m_voMaxAmsduSize = size; | 343 m_voMaxAmsduSize = size; |
316 ConfigureAggregation (); | 344 ConfigureAggregation (); |
317 } | 345 } |
318 | 346 |
319 void | 347 void |
320 RegularWifiMac::SetViMaxAmsduSize (uint32_t size) | 348 RegularWifiMac::SetViMaxAmsduSize (uint16_t size) |
321 { | 349 { |
322 NS_LOG_FUNCTION (this << size); | 350 NS_LOG_FUNCTION (this << size); |
323 m_viMaxAmsduSize = size; | 351 m_viMaxAmsduSize = size; |
324 ConfigureAggregation (); | 352 ConfigureAggregation (); |
325 } | 353 } |
326 | 354 |
327 void | 355 void |
328 RegularWifiMac::SetBeMaxAmsduSize (uint32_t size) | 356 RegularWifiMac::SetBeMaxAmsduSize (uint16_t size) |
329 { | 357 { |
330 NS_LOG_FUNCTION (this << size); | 358 NS_LOG_FUNCTION (this << size); |
331 m_beMaxAmsduSize = size; | 359 m_beMaxAmsduSize = size; |
332 ConfigureAggregation (); | 360 ConfigureAggregation (); |
333 } | 361 } |
334 | 362 |
335 void | 363 void |
336 RegularWifiMac::SetBkMaxAmsduSize (uint32_t size) | 364 RegularWifiMac::SetBkMaxAmsduSize (uint16_t size) |
337 { | 365 { |
338 NS_LOG_FUNCTION (this << size); | 366 NS_LOG_FUNCTION (this << size); |
339 m_bkMaxAmsduSize = size; | 367 m_bkMaxAmsduSize = size; |
340 ConfigureAggregation (); | 368 ConfigureAggregation (); |
341 } | 369 } |
342 | 370 |
343 void | 371 void |
344 RegularWifiMac::SetVoMaxAmpduSize (uint32_t size) | 372 RegularWifiMac::SetVoMaxAmpduSize (uint16_t size) |
345 { | 373 { |
346 NS_LOG_FUNCTION (this << size); | 374 NS_LOG_FUNCTION (this << size); |
347 m_voMaxAmpduSize = size; | 375 m_voMaxAmpduSize = size; |
348 ConfigureAggregation (); | 376 ConfigureAggregation (); |
349 } | 377 } |
350 | 378 |
351 void | 379 void |
352 RegularWifiMac::SetViMaxAmpduSize (uint32_t size) | 380 RegularWifiMac::SetViMaxAmpduSize (uint16_t size) |
353 { | 381 { |
354 NS_LOG_FUNCTION (this << size); | 382 NS_LOG_FUNCTION (this << size); |
355 m_viMaxAmpduSize = size; | 383 m_viMaxAmpduSize = size; |
356 ConfigureAggregation (); | 384 ConfigureAggregation (); |
357 } | 385 } |
358 | 386 |
359 void | 387 void |
360 RegularWifiMac::SetBeMaxAmpduSize (uint32_t size) | 388 RegularWifiMac::SetBeMaxAmpduSize (uint16_t size) |
361 { | 389 { |
362 NS_LOG_FUNCTION (this << size); | 390 NS_LOG_FUNCTION (this << size); |
363 m_beMaxAmpduSize = size; | 391 m_beMaxAmpduSize = size; |
364 ConfigureAggregation (); | 392 ConfigureAggregation (); |
365 } | 393 } |
366 | 394 |
367 void | 395 void |
368 RegularWifiMac::SetBkMaxAmpduSize (uint32_t size) | 396 RegularWifiMac::SetBkMaxAmpduSize (uint16_t size) |
369 { | 397 { |
370 NS_LOG_FUNCTION (this << size); | 398 NS_LOG_FUNCTION (this << size); |
371 m_bkMaxAmpduSize = size; | 399 m_bkMaxAmpduSize = size; |
372 ConfigureAggregation (); | 400 ConfigureAggregation (); |
373 } | 401 } |
374 | 402 |
375 void | 403 void |
376 RegularWifiMac::SetVoBlockAckThreshold (uint8_t threshold) | 404 RegularWifiMac::SetVoBlockAckThreshold (uint8_t threshold) |
377 { | 405 { |
378 NS_LOG_FUNCTION (this << (uint16_t) threshold); | 406 NS_LOG_FUNCTION (this << +threshold); |
379 GetVOQueue ()->SetBlockAckThreshold (threshold); | 407 GetVOQueue ()->SetBlockAckThreshold (threshold); |
380 } | 408 } |
381 | 409 |
382 void | 410 void |
383 RegularWifiMac::SetViBlockAckThreshold (uint8_t threshold) | 411 RegularWifiMac::SetViBlockAckThreshold (uint8_t threshold) |
384 { | 412 { |
385 NS_LOG_FUNCTION (this << (uint16_t) threshold); | 413 NS_LOG_FUNCTION (this << +threshold); |
386 GetVIQueue ()->SetBlockAckThreshold (threshold); | 414 GetVIQueue ()->SetBlockAckThreshold (threshold); |
387 } | 415 } |
388 | 416 |
389 void | 417 void |
390 RegularWifiMac::SetBeBlockAckThreshold (uint8_t threshold) | 418 RegularWifiMac::SetBeBlockAckThreshold (uint8_t threshold) |
391 { | 419 { |
392 NS_LOG_FUNCTION (this << (uint16_t) threshold); | 420 NS_LOG_FUNCTION (this << +threshold); |
393 GetBEQueue ()->SetBlockAckThreshold (threshold); | 421 GetBEQueue ()->SetBlockAckThreshold (threshold); |
394 } | 422 } |
395 | 423 |
396 void | 424 void |
397 RegularWifiMac::SetBkBlockAckThreshold (uint8_t threshold) | 425 RegularWifiMac::SetBkBlockAckThreshold (uint8_t threshold) |
398 { | 426 { |
399 NS_LOG_FUNCTION (this << (uint16_t) threshold); | 427 NS_LOG_FUNCTION (this << +threshold); |
400 GetBKQueue ()->SetBlockAckThreshold (threshold); | 428 GetBKQueue ()->SetBlockAckThreshold (threshold); |
401 } | 429 } |
402 | 430 |
403 void | 431 void |
404 RegularWifiMac::SetVoBlockAckInactivityTimeout (uint16_t timeout) | 432 RegularWifiMac::SetVoBlockAckInactivityTimeout (uint16_t timeout) |
405 { | 433 { |
406 NS_LOG_FUNCTION (this << timeout); | 434 NS_LOG_FUNCTION (this << timeout); |
407 GetVOQueue ()->SetBlockAckInactivityTimeout (timeout); | 435 GetVOQueue ()->SetBlockAckInactivityTimeout (timeout); |
408 } | 436 } |
409 | 437 |
(...skipping 21 matching lines...) Expand all Loading... |
431 void | 459 void |
432 RegularWifiMac::SetupEdcaQueue (AcIndex ac) | 460 RegularWifiMac::SetupEdcaQueue (AcIndex ac) |
433 { | 461 { |
434 NS_LOG_FUNCTION (this << ac); | 462 NS_LOG_FUNCTION (this << ac); |
435 | 463 |
436 //Our caller shouldn't be attempting to setup a queue that is | 464 //Our caller shouldn't be attempting to setup a queue that is |
437 //already configured. | 465 //already configured. |
438 NS_ASSERT (m_edca.find (ac) == m_edca.end ()); | 466 NS_ASSERT (m_edca.find (ac) == m_edca.end ()); |
439 | 467 |
440 Ptr<EdcaTxopN> edca = CreateObject<EdcaTxopN> (); | 468 Ptr<EdcaTxopN> edca = CreateObject<EdcaTxopN> (); |
441 edca->SetLow (m_low); | 469 edca->SetMacLow (m_low); |
442 edca->SetManager (m_dcfManager); | 470 edca->SetDcfManager (m_dcfManager); |
443 edca->SetTxMiddle (m_txMiddle); | 471 edca->SetTxMiddle (m_txMiddle); |
444 edca->SetTxOkCallback (MakeCallback (&RegularWifiMac::TxOk, this)); | 472 edca->SetTxOkCallback (MakeCallback (&RegularWifiMac::TxOk, this)); |
445 edca->SetTxFailedCallback (MakeCallback (&RegularWifiMac::TxFailed, this)); | 473 edca->SetTxFailedCallback (MakeCallback (&RegularWifiMac::TxFailed, this)); |
446 edca->SetTxDroppedCallback (MakeCallback (&RegularWifiMac::NotifyTxDrop, this)
); | 474 edca->SetTxDroppedCallback (MakeCallback (&RegularWifiMac::NotifyTxDrop, this)
); |
447 edca->SetAccessCategory (ac); | 475 edca->SetAccessCategory (ac); |
448 edca->CompleteConfig (); | 476 edca->CompleteConfig (); |
449 | 477 |
450 m_edca.insert (std::make_pair (ac, edca)); | 478 m_edca.insert (std::make_pair (ac, edca)); |
451 } | 479 } |
452 | 480 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 return m_dsssSupported; | 682 return m_dsssSupported; |
655 } | 683 } |
656 | 684 |
657 void | 685 void |
658 RegularWifiMac::SetCtsToSelfSupported (bool enable) | 686 RegularWifiMac::SetCtsToSelfSupported (bool enable) |
659 { | 687 { |
660 NS_LOG_FUNCTION (this); | 688 NS_LOG_FUNCTION (this); |
661 m_low->SetCtsToSelfSupported (enable); | 689 m_low->SetCtsToSelfSupported (enable); |
662 } | 690 } |
663 | 691 |
664 bool | |
665 RegularWifiMac::GetCtsToSelfSupported () const | |
666 { | |
667 return m_low->GetCtsToSelfSupported (); | |
668 } | |
669 | |
670 void | 692 void |
671 RegularWifiMac::SetSlot (Time slotTime) | 693 RegularWifiMac::SetSlot (Time slotTime) |
672 { | 694 { |
673 NS_LOG_FUNCTION (this << slotTime); | 695 NS_LOG_FUNCTION (this << slotTime); |
674 m_dcfManager->SetSlot (slotTime); | 696 m_dcfManager->SetSlot (slotTime); |
675 m_low->SetSlotTime (slotTime); | 697 m_low->SetSlotTime (slotTime); |
676 } | 698 } |
677 | 699 |
678 Time | 700 Time |
679 RegularWifiMac::GetSlot (void) const | 701 RegularWifiMac::GetSlot (void) const |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 } | 880 } |
859 | 881 |
860 void | 882 void |
861 RegularWifiMac::Enqueue (Ptr<const Packet> packet, | 883 RegularWifiMac::Enqueue (Ptr<const Packet> packet, |
862 Mac48Address to, Mac48Address from) | 884 Mac48Address to, Mac48Address from) |
863 { | 885 { |
864 //We expect RegularWifiMac subclasses which do support forwarding (e.g., | 886 //We expect RegularWifiMac subclasses which do support forwarding (e.g., |
865 //AP) to override this method. Therefore, we throw a fatal error if | 887 //AP) to override this method. Therefore, we throw a fatal error if |
866 //someone tries to invoke this method on a class which has not done | 888 //someone tries to invoke this method on a class which has not done |
867 //this. | 889 //this. |
868 NS_UNUSED(to); | |
869 NS_UNUSED(from); | |
870 NS_FATAL_ERROR ("This MAC entity (" << this << ", " << GetAddress () | 890 NS_FATAL_ERROR ("This MAC entity (" << this << ", " << GetAddress () |
871 << ") does not support Enqueue() with from
address"); | 891 << ") does not support Enqueue() with from
address"); |
872 } | 892 } |
873 | 893 |
874 bool | 894 bool |
875 RegularWifiMac::SupportsSendFrom (void) const | 895 RegularWifiMac::SupportsSendFrom (void) const |
876 { | 896 { |
877 return false; | 897 return false; |
878 } | 898 } |
879 | 899 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 } | 996 } |
977 default: | 997 default: |
978 NS_FATAL_ERROR ("Unsupported Action frame received"); | 998 NS_FATAL_ERROR ("Unsupported Action frame received"); |
979 return; | 999 return; |
980 } | 1000 } |
981 } | 1001 } |
982 NS_FATAL_ERROR ("Don't know how to handle frame (type=" << hdr->GetType ()); | 1002 NS_FATAL_ERROR ("Don't know how to handle frame (type=" << hdr->GetType ()); |
983 } | 1003 } |
984 | 1004 |
985 void | 1005 void |
986 RegularWifiMac::DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket, | 1006 RegularWifiMac::DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket, const
WifiMacHeader *hdr) |
987 const WifiMacHeader *hdr) | 1007 { |
988 { | 1008 NS_LOG_FUNCTION (this << aggregatedPacket << hdr); |
989 NS_UNUSED(hdr); | 1009 MsduAggregator::DeaggregatedMsdus packets = MsduAggregator::Deaggregate (aggre
gatedPacket); |
990 MsduAggregator::DeaggregatedMsdus packets = | |
991 MsduAggregator::Deaggregate (aggregatedPacket); | |
992 | |
993 for (MsduAggregator::DeaggregatedMsdusCI i = packets.begin (); | 1010 for (MsduAggregator::DeaggregatedMsdusCI i = packets.begin (); |
994 i != packets.end (); ++i) | 1011 i != packets.end (); ++i) |
995 { | 1012 { |
996 ForwardUp ((*i).first, (*i).second.GetSourceAddr (), | 1013 ForwardUp ((*i).first, (*i).second.GetSourceAddr (), |
997 (*i).second.GetDestinationAddr ()); | 1014 (*i).second.GetDestinationAddr ()); |
998 } | 1015 } |
999 } | 1016 } |
1000 | 1017 |
1001 void | 1018 void |
1002 RegularWifiMac::SendAddBaResponse (const MgtAddBaRequestHeader *reqHdr, | 1019 RegularWifiMac::SendAddBaResponse (const MgtAddBaRequestHeader *reqHdr, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1082 MakeBooleanChecker ()) | 1099 MakeBooleanChecker ()) |
1083 .AddAttribute ("HeSupported", | 1100 .AddAttribute ("HeSupported", |
1084 "This Boolean attribute is set to enable 802.11ax support at
this STA.", | 1101 "This Boolean attribute is set to enable 802.11ax support at
this STA.", |
1085 BooleanValue (false), | 1102 BooleanValue (false), |
1086 MakeBooleanAccessor (&RegularWifiMac::SetHeSupported, | 1103 MakeBooleanAccessor (&RegularWifiMac::SetHeSupported, |
1087 &RegularWifiMac::GetHeSupported), | 1104 &RegularWifiMac::GetHeSupported), |
1088 MakeBooleanChecker ()) | 1105 MakeBooleanChecker ()) |
1089 .AddAttribute ("CtsToSelfSupported", | 1106 .AddAttribute ("CtsToSelfSupported", |
1090 "Use CTS to Self when using a rate that is not in the basic r
ate set.", | 1107 "Use CTS to Self when using a rate that is not in the basic r
ate set.", |
1091 BooleanValue (false), | 1108 BooleanValue (false), |
1092 MakeBooleanAccessor (&RegularWifiMac::SetCtsToSelfSupported, | 1109 MakeBooleanAccessor (&RegularWifiMac::SetCtsToSelfSupported), |
1093 &RegularWifiMac::GetCtsToSelfSupported), | |
1094 MakeBooleanChecker ()) | 1110 MakeBooleanChecker ()) |
1095 .AddAttribute ("VO_MaxAmsduSize", | 1111 .AddAttribute ("VO_MaxAmsduSize", |
1096 "Maximum length in bytes of an A-MSDU for AC_VO access class.
" | 1112 "Maximum length in bytes of an A-MSDU for AC_VO access class.
" |
1097 "Value 0 means A-MSDU is disabled for that AC.", | 1113 "Value 0 means A-MSDU is disabled for that AC.", |
1098 UintegerValue (0), | 1114 UintegerValue (0), |
1099 MakeUintegerAccessor (&RegularWifiMac::SetVoMaxAmsduSize), | 1115 MakeUintegerAccessor (&RegularWifiMac::SetVoMaxAmsduSize), |
1100 MakeUintegerChecker<uint32_t> (0, 11426)) | 1116 MakeUintegerChecker<uint16_t> (0, 11426)) |
1101 .AddAttribute ("VI_MaxAmsduSize", | 1117 .AddAttribute ("VI_MaxAmsduSize", |
1102 "Maximum length in bytes of an A-MSDU for AC_VI access class.
" | 1118 "Maximum length in bytes of an A-MSDU for AC_VI access class.
" |
1103 "Value 0 means A-MSDU is disabled for that AC.", | 1119 "Value 0 means A-MSDU is disabled for that AC.", |
1104 UintegerValue (0), | 1120 UintegerValue (0), |
1105 MakeUintegerAccessor (&RegularWifiMac::SetViMaxAmsduSize), | 1121 MakeUintegerAccessor (&RegularWifiMac::SetViMaxAmsduSize), |
1106 MakeUintegerChecker<uint32_t> (0, 11426)) | 1122 MakeUintegerChecker<uint16_t> (0, 11426)) |
1107 .AddAttribute ("BE_MaxAmsduSize", | 1123 .AddAttribute ("BE_MaxAmsduSize", |
1108 "Maximum length in bytes of an A-MSDU for AC_BE access class.
" | 1124 "Maximum length in bytes of an A-MSDU for AC_BE access class.
" |
1109 "Value 0 means A-MSDU is disabled for that AC.", | 1125 "Value 0 means A-MSDU is disabled for that AC.", |
1110 UintegerValue (0), | 1126 UintegerValue (0), |
1111 MakeUintegerAccessor (&RegularWifiMac::SetBeMaxAmsduSize), | 1127 MakeUintegerAccessor (&RegularWifiMac::SetBeMaxAmsduSize), |
1112 MakeUintegerChecker<uint32_t> (0, 11426)) | 1128 MakeUintegerChecker<uint16_t> (0, 11426)) |
1113 .AddAttribute ("BK_MaxAmsduSize", | 1129 .AddAttribute ("BK_MaxAmsduSize", |
1114 "Maximum length in bytes of an A-MSDU for AC_BK access class.
" | 1130 "Maximum length in bytes of an A-MSDU for AC_BK access class.
" |
1115 "Value 0 means A-MSDU is disabled for that AC.", | 1131 "Value 0 means A-MSDU is disabled for that AC.", |
1116 UintegerValue (0), | 1132 UintegerValue (0), |
1117 MakeUintegerAccessor (&RegularWifiMac::SetBkMaxAmsduSize), | 1133 MakeUintegerAccessor (&RegularWifiMac::SetBkMaxAmsduSize), |
1118 MakeUintegerChecker<uint32_t> (0, 11426)) | 1134 MakeUintegerChecker<uint16_t> (0, 11426)) |
1119 .AddAttribute ("VO_MaxAmpduSize", | 1135 .AddAttribute ("VO_MaxAmpduSize", |
1120 "Maximum length in bytes of an A-MPDU for AC_VO access class.
" | 1136 "Maximum length in bytes of an A-MPDU for AC_VO access class.
" |
1121 "Value 0 means A-MPDU is disabled for that AC.", | 1137 "Value 0 means A-MPDU is disabled for that AC.", |
1122 UintegerValue (0), | 1138 UintegerValue (0), |
1123 MakeUintegerAccessor (&RegularWifiMac::SetVoMaxAmpduSize), | 1139 MakeUintegerAccessor (&RegularWifiMac::SetVoMaxAmpduSize), |
1124 MakeUintegerChecker<uint32_t> (0, 65535)) | 1140 MakeUintegerChecker<uint16_t> ()) |
1125 .AddAttribute ("VI_MaxAmpduSize", | 1141 .AddAttribute ("VI_MaxAmpduSize", |
1126 "Maximum length in bytes of an A-MPDU for AC_VI access class.
" | 1142 "Maximum length in bytes of an A-MPDU for AC_VI access class.
" |
1127 "Value 0 means A-MPDU is disabled for that AC.", | 1143 "Value 0 means A-MPDU is disabled for that AC.", |
1128 UintegerValue (65535), | 1144 UintegerValue (65535), |
1129 MakeUintegerAccessor (&RegularWifiMac::SetViMaxAmpduSize), | 1145 MakeUintegerAccessor (&RegularWifiMac::SetViMaxAmpduSize), |
1130 MakeUintegerChecker<uint32_t> (0, 65535)) | 1146 MakeUintegerChecker<uint16_t> ()) |
1131 .AddAttribute ("BE_MaxAmpduSize", | 1147 .AddAttribute ("BE_MaxAmpduSize", |
1132 "Maximum length in bytes of an A-MPDU for AC_BE access class.
" | 1148 "Maximum length in bytes of an A-MPDU for AC_BE access class.
" |
1133 "Value 0 means A-MPDU is disabled for that AC.", | 1149 "Value 0 means A-MPDU is disabled for that AC.", |
1134 UintegerValue (65535), | 1150 UintegerValue (65535), |
1135 MakeUintegerAccessor (&RegularWifiMac::SetBeMaxAmpduSize), | 1151 MakeUintegerAccessor (&RegularWifiMac::SetBeMaxAmpduSize), |
1136 MakeUintegerChecker<uint32_t> (0, 65535)) | 1152 MakeUintegerChecker<uint16_t> ()) |
1137 .AddAttribute ("BK_MaxAmpduSize", | 1153 .AddAttribute ("BK_MaxAmpduSize", |
1138 "Maximum length in bytes of an A-MPDU for AC_BK access class.
" | 1154 "Maximum length in bytes of an A-MPDU for AC_BK access class.
" |
1139 "Value 0 means A-MPDU is disabled for that AC.", | 1155 "Value 0 means A-MPDU is disabled for that AC.", |
1140 UintegerValue (0), | 1156 UintegerValue (0), |
1141 MakeUintegerAccessor (&RegularWifiMac::SetBkMaxAmpduSize), | 1157 MakeUintegerAccessor (&RegularWifiMac::SetBkMaxAmpduSize), |
1142 MakeUintegerChecker<uint32_t> (0, 65535)) | 1158 MakeUintegerChecker<uint16_t> ()) |
1143 .AddAttribute ("VO_BlockAckThreshold", | 1159 .AddAttribute ("VO_BlockAckThreshold", |
1144 "If number of packets in VO queue reaches this value, " | 1160 "If number of packets in VO queue reaches this value, " |
1145 "block ack mechanism is used. If this value is 0, block ack i
s never used." | 1161 "block ack mechanism is used. If this value is 0, block ack i
s never used." |
1146 "When A-MPDU is enabled, block ack mechanism is used regardle
ss of this value.", | 1162 "When A-MPDU is enabled, block ack mechanism is used regardle
ss of this value.", |
1147 UintegerValue (0), | 1163 UintegerValue (0), |
1148 MakeUintegerAccessor (&RegularWifiMac::SetVoBlockAckThreshold
), | 1164 MakeUintegerAccessor (&RegularWifiMac::SetVoBlockAckThreshold
), |
1149 MakeUintegerChecker<uint8_t> (0, 64)) | 1165 MakeUintegerChecker<uint8_t> (0, 64)) |
1150 .AddAttribute ("VI_BlockAckThreshold", | 1166 .AddAttribute ("VI_BlockAckThreshold", |
1151 "If number of packets in VI queue reaches this value, " | 1167 "If number of packets in VI queue reaches this value, " |
1152 "block ack mechanism is used. If this value is 0, block ack i
s never used." | 1168 "block ack mechanism is used. If this value is 0, block ack i
s never used." |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1359 } | 1375 } |
1360 | 1376 |
1361 void | 1377 void |
1362 RegularWifiMac::EnableAggregation (void) | 1378 RegularWifiMac::EnableAggregation (void) |
1363 { | 1379 { |
1364 NS_LOG_FUNCTION (this); | 1380 NS_LOG_FUNCTION (this); |
1365 for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i) | 1381 for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i) |
1366 { | 1382 { |
1367 if (i->second->GetMsduAggregator () == 0) | 1383 if (i->second->GetMsduAggregator () == 0) |
1368 { | 1384 { |
1369 Ptr<MsduStandardAggregator> msduAggregator = CreateObject<MsduStandard
Aggregator> (); | 1385 Ptr<MsduAggregator> msduAggregator = CreateObject<MsduAggregator> (); |
1370 i->second->SetMsduAggregator (msduAggregator); | 1386 i->second->SetMsduAggregator (msduAggregator); |
1371 } | 1387 } |
1372 if (i->second->GetMpduAggregator () == 0) | 1388 if (i->second->GetMpduAggregator () == 0) |
1373 { | 1389 { |
1374 Ptr<MpduStandardAggregator> mpduAggregator = CreateObject<MpduStandard
Aggregator> (); | 1390 Ptr<MpduAggregator> mpduAggregator = CreateObject<MpduAggregator> (); |
1375 i->second->SetMpduAggregator (mpduAggregator); | 1391 i->second->SetMpduAggregator (mpduAggregator); |
1376 } | 1392 } |
1377 } | 1393 } |
1378 ConfigureAggregation (); | 1394 ConfigureAggregation (); |
1379 } | 1395 } |
1380 | 1396 |
1381 void | 1397 void |
1382 RegularWifiMac::DisableAggregation (void) | 1398 RegularWifiMac::DisableAggregation (void) |
1383 { | 1399 { |
1384 NS_LOG_FUNCTION (this); | 1400 NS_LOG_FUNCTION (this); |
1385 for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i) | 1401 for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i) |
1386 { | 1402 { |
1387 i->second->SetMsduAggregator (0); | 1403 i->second->SetMsduAggregator (0); |
1388 i->second->SetMpduAggregator (0); | 1404 i->second->SetMpduAggregator (0); |
1389 } | 1405 } |
1390 } | 1406 } |
1391 | 1407 |
1392 } //namespace ns3 | 1408 } //namespace ns3 |
LEFT | RIGHT |