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-aggregator.h" | 30 #include "msdu-aggregator.h" |
29 #include "mpdu-aggregator.h" | 31 #include "mpdu-aggregator.h" |
30 #include "wifi-utils.h" | 32 #include "wifi-utils.h" |
| 33 #include "mgt-headers.h" |
| 34 #include "amsdu-subframe-header.h" |
31 | 35 |
32 namespace ns3 { | 36 namespace ns3 { |
33 | 37 |
34 NS_LOG_COMPONENT_DEFINE ("RegularWifiMac"); | 38 NS_LOG_COMPONENT_DEFINE ("RegularWifiMac"); |
35 | 39 |
36 NS_OBJECT_ENSURE_REGISTERED (RegularWifiMac); | 40 NS_OBJECT_ENSURE_REGISTERED (RegularWifiMac); |
37 | 41 |
38 RegularWifiMac::RegularWifiMac () | 42 RegularWifiMac::RegularWifiMac () |
39 : m_htSupported (0), | 43 : m_htSupported (0), |
40 m_vhtSupported (0), | 44 m_vhtSupported (0), |
41 m_erpSupported (0), | 45 m_erpSupported (0), |
42 m_dsssSupported (0), | 46 m_dsssSupported (0), |
43 m_heSupported (0) | 47 m_heSupported (0) |
44 { | 48 { |
45 NS_LOG_FUNCTION (this); | 49 NS_LOG_FUNCTION (this); |
46 m_rxMiddle = Create<MacRxMiddle> (); | 50 m_rxMiddle = Create<MacRxMiddle> (); |
47 m_rxMiddle->SetForwardCallback (MakeCallback (&RegularWifiMac::Receive, this))
; | 51 m_rxMiddle->SetForwardCallback (MakeCallback (&RegularWifiMac::Receive, this))
; |
48 | 52 |
49 m_txMiddle = Create<MacTxMiddle> (); | 53 m_txMiddle = Create<MacTxMiddle> (); |
50 | 54 |
51 m_low = CreateObject<MacLow> (); | 55 m_low = CreateObject<MacLow> (); |
52 m_low->SetRxCallback (MakeCallback (&MacRxMiddle::Receive, m_rxMiddle)); | 56 m_low->SetRxCallback (MakeCallback (&MacRxMiddle::Receive, m_rxMiddle)); |
53 | 57 |
54 m_dcfManager = CreateObject<DcfManager> (); | 58 m_dcfManager = CreateObject<DcfManager> (); |
55 m_dcfManager->SetupLow (m_low); | 59 m_dcfManager->SetupLow (m_low); |
56 | 60 |
57 m_dca = CreateObject<DcaTxop> (); | 61 m_dca = CreateObject<DcaTxop> (); |
58 m_dca->SetLow (m_low); | 62 m_dca->SetMacLow (m_low); |
59 m_dca->SetManager (m_dcfManager); | 63 m_dca->SetDcfManager (m_dcfManager); |
60 m_dca->SetTxMiddle (m_txMiddle); | 64 m_dca->SetTxMiddle (m_txMiddle); |
61 m_dca->SetTxOkCallback (MakeCallback (&RegularWifiMac::TxOk, this)); | 65 m_dca->SetTxOkCallback (MakeCallback (&RegularWifiMac::TxOk, this)); |
62 m_dca->SetTxFailedCallback (MakeCallback (&RegularWifiMac::TxFailed, this)); | 66 m_dca->SetTxFailedCallback (MakeCallback (&RegularWifiMac::TxFailed, this)); |
63 m_dca->SetTxDroppedCallback (MakeCallback (&RegularWifiMac::NotifyTxDrop, this
)); | 67 m_dca->SetTxDroppedCallback (MakeCallback (&RegularWifiMac::NotifyTxDrop, this
)); |
64 | 68 |
65 //Construct the EDCAFs. The ordering is important - highest | 69 //Construct the EDCAFs. The ordering is important - highest |
66 //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 |
67 //first. | 71 //first. |
68 SetupEdcaQueue (AC_VO); | 72 SetupEdcaQueue (AC_VO); |
69 SetupEdcaQueue (AC_VI); | 73 SetupEdcaQueue (AC_VI); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 { | 152 { |
149 if (m_htSupported) | 153 if (m_htSupported) |
150 { | 154 { |
151 capabilities.SetHtSupported (1); | 155 capabilities.SetHtSupported (1); |
152 } | 156 } |
153 if (m_vhtSupported) | 157 if (m_vhtSupported) |
154 { | 158 { |
155 capabilities.SetVhtSupported (1); | 159 capabilities.SetVhtSupported (1); |
156 } | 160 } |
157 } | 161 } |
| 162 //TODO: to be completed |
158 return capabilities; | 163 return capabilities; |
159 } | 164 } |
160 | 165 |
161 HtCapabilities | 166 HtCapabilities |
162 RegularWifiMac::GetHtCapabilities (void) const | 167 RegularWifiMac::GetHtCapabilities (void) const |
163 { | 168 { |
164 NS_LOG_FUNCTION (this); | 169 NS_LOG_FUNCTION (this); |
165 HtCapabilities capabilities; | 170 HtCapabilities capabilities; |
166 if (m_htSupported) | 171 if (m_htSupported) |
167 { | 172 { |
(...skipping 24 matching lines...) Expand all Loading... |
192 capabilities.SetRxMcsBitmask (mcs.GetMcsValue ()); | 197 capabilities.SetRxMcsBitmask (mcs.GetMcsValue ()); |
193 uint8_t nss = (mcs.GetMcsValue () / 8) + 1; | 198 uint8_t nss = (mcs.GetMcsValue () / 8) + 1; |
194 NS_ASSERT (nss > 0 && nss < 5); | 199 NS_ASSERT (nss > 0 && nss < 5); |
195 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); |
196 if (dataRate > maxSupportedRate) | 201 if (dataRate > maxSupportedRate) |
197 { | 202 { |
198 maxSupportedRate = dataRate; | 203 maxSupportedRate = dataRate; |
199 NS_LOG_DEBUG ("Updating maxSupportedRate to " << maxSupportedRate)
; | 204 NS_LOG_DEBUG ("Updating maxSupportedRate to " << maxSupportedRate)
; |
200 } | 205 } |
201 } | 206 } |
202 capabilities.SetRxHighestSupportedDataRate (static_cast<uint16_t>(maxSuppo
rtedRate / 1e6)); //in Mbit/s | 207 capabilities.SetRxHighestSupportedDataRate (static_cast<uint16_t> (maxSupp
ortedRate / 1e6)); //in Mbit/s |
203 capabilities.SetTxMcsSetDefined (m_phy->GetNMcs () > 0); | 208 capabilities.SetTxMcsSetDefined (m_phy->GetNMcs () > 0); |
204 capabilities.SetTxMaxNSpatialStreams (m_phy->GetMaxSupportedTxSpatialStrea
ms ()); | 209 capabilities.SetTxMaxNSpatialStreams (m_phy->GetMaxSupportedTxSpatialStrea
ms ()); |
205 //we do not support unequal modulations | 210 //we do not support unequal modulations |
206 capabilities.SetTxRxMcsSetUnequal (0); | 211 capabilities.SetTxRxMcsSetUnequal (0); |
207 capabilities.SetTxUnequalModulation (0); | 212 capabilities.SetTxUnequalModulation (0); |
208 } | 213 } |
209 return capabilities; | 214 return capabilities; |
210 } | 215 } |
211 | 216 |
212 VhtCapabilities | 217 VhtCapabilities |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 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)) |
260 { | 265 { |
261 continue; | 266 continue; |
262 } | 267 } |
263 if (mcs.GetDataRate (m_phy->GetChannelWidth ()) > maxSupportedRateLGI) | 268 if (mcs.GetDataRate (m_phy->GetChannelWidth ()) > maxSupportedRateLGI) |
264 { | 269 { |
265 maxSupportedRateLGI = mcs.GetDataRate (m_phy->GetChannelWidth ()); | 270 maxSupportedRateLGI = mcs.GetDataRate (m_phy->GetChannelWidth ()); |
266 NS_LOG_DEBUG ("Updating maxSupportedRateLGI to " << maxSupportedRa
teLGI); | 271 NS_LOG_DEBUG ("Updating maxSupportedRateLGI to " << maxSupportedRa
teLGI); |
267 } | 272 } |
268 } | 273 } |
269 capabilities.SetRxHighestSupportedLgiDataRate (static_cast<uint16_t>(maxSu
pportedRateLGI / 1e6)); //in Mbit/s | 274 capabilities.SetRxHighestSupportedLgiDataRate (static_cast<uint16_t> (maxS
upportedRateLGI / 1e6)); //in Mbit/s |
270 capabilities.SetTxHighestSupportedLgiDataRate (static_cast<uint16_t>(maxSu
pportedRateLGI / 1e6)); //in Mbit/s | 275 capabilities.SetTxHighestSupportedLgiDataRate (static_cast<uint16_t> (maxS
upportedRateLGI / 1e6)); //in Mbit/s |
271 //To be filled in once supported | 276 //To be filled in once supported |
272 capabilities.SetRxStbc (0); | 277 capabilities.SetRxStbc (0); |
273 capabilities.SetTxStbc (0); | 278 capabilities.SetTxStbc (0); |
274 } | 279 } |
275 return capabilities; | 280 return capabilities; |
276 } | 281 } |
277 | 282 |
278 HeCapabilities | 283 HeCapabilities |
279 RegularWifiMac::GetHeCapabilities (void) const | 284 RegularWifiMac::GetHeCapabilities (void) const |
280 { | 285 { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 maxMcs = mcs.GetMcsValue (); | 330 maxMcs = mcs.GetMcsValue (); |
326 } | 331 } |
327 } | 332 } |
328 capabilities.SetHighestMcsSupported (maxMcs); | 333 capabilities.SetHighestMcsSupported (maxMcs); |
329 capabilities.SetHighestNssSupported (m_phy->GetMaxSupportedTxSpatialStream
s ()); | 334 capabilities.SetHighestNssSupported (m_phy->GetMaxSupportedTxSpatialStream
s ()); |
330 } | 335 } |
331 return capabilities; | 336 return capabilities; |
332 } | 337 } |
333 | 338 |
334 void | 339 void |
335 RegularWifiMac::SetVoMaxAmsduSize (uint32_t size) | 340 RegularWifiMac::SetVoMaxAmsduSize (uint16_t size) |
336 { | 341 { |
337 NS_LOG_FUNCTION (this << size); | 342 NS_LOG_FUNCTION (this << size); |
338 m_voMaxAmsduSize = size; | 343 m_voMaxAmsduSize = size; |
339 ConfigureAggregation (); | 344 ConfigureAggregation (); |
340 } | 345 } |
341 | 346 |
342 void | 347 void |
343 RegularWifiMac::SetViMaxAmsduSize (uint32_t size) | 348 RegularWifiMac::SetViMaxAmsduSize (uint16_t size) |
344 { | 349 { |
345 NS_LOG_FUNCTION (this << size); | 350 NS_LOG_FUNCTION (this << size); |
346 m_viMaxAmsduSize = size; | 351 m_viMaxAmsduSize = size; |
347 ConfigureAggregation (); | 352 ConfigureAggregation (); |
348 } | 353 } |
349 | 354 |
350 void | 355 void |
351 RegularWifiMac::SetBeMaxAmsduSize (uint32_t size) | 356 RegularWifiMac::SetBeMaxAmsduSize (uint16_t size) |
352 { | 357 { |
353 NS_LOG_FUNCTION (this << size); | 358 NS_LOG_FUNCTION (this << size); |
354 m_beMaxAmsduSize = size; | 359 m_beMaxAmsduSize = size; |
355 ConfigureAggregation (); | 360 ConfigureAggregation (); |
356 } | 361 } |
357 | 362 |
358 void | 363 void |
359 RegularWifiMac::SetBkMaxAmsduSize (uint32_t size) | 364 RegularWifiMac::SetBkMaxAmsduSize (uint16_t size) |
360 { | 365 { |
361 NS_LOG_FUNCTION (this << size); | 366 NS_LOG_FUNCTION (this << size); |
362 m_bkMaxAmsduSize = size; | 367 m_bkMaxAmsduSize = size; |
363 ConfigureAggregation (); | 368 ConfigureAggregation (); |
364 } | 369 } |
365 | 370 |
366 void | 371 void |
367 RegularWifiMac::SetVoMaxAmpduSize (uint32_t size) | 372 RegularWifiMac::SetVoMaxAmpduSize (uint16_t size) |
368 { | 373 { |
369 NS_LOG_FUNCTION (this << size); | 374 NS_LOG_FUNCTION (this << size); |
370 m_voMaxAmpduSize = size; | 375 m_voMaxAmpduSize = size; |
371 ConfigureAggregation (); | 376 ConfigureAggregation (); |
372 } | 377 } |
373 | 378 |
374 void | 379 void |
375 RegularWifiMac::SetViMaxAmpduSize (uint32_t size) | 380 RegularWifiMac::SetViMaxAmpduSize (uint16_t size) |
376 { | 381 { |
377 NS_LOG_FUNCTION (this << size); | 382 NS_LOG_FUNCTION (this << size); |
378 m_viMaxAmpduSize = size; | 383 m_viMaxAmpduSize = size; |
379 ConfigureAggregation (); | 384 ConfigureAggregation (); |
380 } | 385 } |
381 | 386 |
382 void | 387 void |
383 RegularWifiMac::SetBeMaxAmpduSize (uint32_t size) | 388 RegularWifiMac::SetBeMaxAmpduSize (uint16_t size) |
384 { | 389 { |
385 NS_LOG_FUNCTION (this << size); | 390 NS_LOG_FUNCTION (this << size); |
386 m_beMaxAmpduSize = size; | 391 m_beMaxAmpduSize = size; |
387 ConfigureAggregation (); | 392 ConfigureAggregation (); |
388 } | 393 } |
389 | 394 |
390 void | 395 void |
391 RegularWifiMac::SetBkMaxAmpduSize (uint32_t size) | 396 RegularWifiMac::SetBkMaxAmpduSize (uint16_t size) |
392 { | 397 { |
393 NS_LOG_FUNCTION (this << size); | 398 NS_LOG_FUNCTION (this << size); |
394 m_bkMaxAmpduSize = size; | 399 m_bkMaxAmpduSize = size; |
395 ConfigureAggregation (); | 400 ConfigureAggregation (); |
396 } | 401 } |
397 | 402 |
398 void | 403 void |
399 RegularWifiMac::SetVoBlockAckThreshold (uint8_t threshold) | 404 RegularWifiMac::SetVoBlockAckThreshold (uint8_t threshold) |
400 { | 405 { |
401 NS_LOG_FUNCTION (this << static_cast<uint16_t> (threshold)); | 406 NS_LOG_FUNCTION (this << +threshold); |
402 GetVOQueue ()->SetBlockAckThreshold (threshold); | 407 GetVOQueue ()->SetBlockAckThreshold (threshold); |
403 } | 408 } |
404 | 409 |
405 void | 410 void |
406 RegularWifiMac::SetViBlockAckThreshold (uint8_t threshold) | 411 RegularWifiMac::SetViBlockAckThreshold (uint8_t threshold) |
407 { | 412 { |
408 NS_LOG_FUNCTION (this << static_cast<uint16_t> (threshold)); | 413 NS_LOG_FUNCTION (this << +threshold); |
409 GetVIQueue ()->SetBlockAckThreshold (threshold); | 414 GetVIQueue ()->SetBlockAckThreshold (threshold); |
410 } | 415 } |
411 | 416 |
412 void | 417 void |
413 RegularWifiMac::SetBeBlockAckThreshold (uint8_t threshold) | 418 RegularWifiMac::SetBeBlockAckThreshold (uint8_t threshold) |
414 { | 419 { |
415 NS_LOG_FUNCTION (this << static_cast<uint16_t> (threshold)); | 420 NS_LOG_FUNCTION (this << +threshold); |
416 GetBEQueue ()->SetBlockAckThreshold (threshold); | 421 GetBEQueue ()->SetBlockAckThreshold (threshold); |
417 } | 422 } |
418 | 423 |
419 void | 424 void |
420 RegularWifiMac::SetBkBlockAckThreshold (uint8_t threshold) | 425 RegularWifiMac::SetBkBlockAckThreshold (uint8_t threshold) |
421 { | 426 { |
422 NS_LOG_FUNCTION (this << static_cast<uint16_t> (threshold)); | 427 NS_LOG_FUNCTION (this << +threshold); |
423 GetBKQueue ()->SetBlockAckThreshold (threshold); | 428 GetBKQueue ()->SetBlockAckThreshold (threshold); |
424 } | 429 } |
425 | 430 |
426 void | 431 void |
427 RegularWifiMac::SetVoBlockAckInactivityTimeout (uint16_t timeout) | 432 RegularWifiMac::SetVoBlockAckInactivityTimeout (uint16_t timeout) |
428 { | 433 { |
429 NS_LOG_FUNCTION (this << timeout); | 434 NS_LOG_FUNCTION (this << timeout); |
430 GetVOQueue ()->SetBlockAckInactivityTimeout (timeout); | 435 GetVOQueue ()->SetBlockAckInactivityTimeout (timeout); |
431 } | 436 } |
432 | 437 |
(...skipping 21 matching lines...) Expand all Loading... |
454 void | 459 void |
455 RegularWifiMac::SetupEdcaQueue (AcIndex ac) | 460 RegularWifiMac::SetupEdcaQueue (AcIndex ac) |
456 { | 461 { |
457 NS_LOG_FUNCTION (this << ac); | 462 NS_LOG_FUNCTION (this << ac); |
458 | 463 |
459 //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 |
460 //already configured. | 465 //already configured. |
461 NS_ASSERT (m_edca.find (ac) == m_edca.end ()); | 466 NS_ASSERT (m_edca.find (ac) == m_edca.end ()); |
462 | 467 |
463 Ptr<EdcaTxopN> edca = CreateObject<EdcaTxopN> (); | 468 Ptr<EdcaTxopN> edca = CreateObject<EdcaTxopN> (); |
464 edca->SetLow (m_low); | 469 edca->SetMacLow (m_low); |
465 edca->SetManager (m_dcfManager); | 470 edca->SetDcfManager (m_dcfManager); |
466 edca->SetTxMiddle (m_txMiddle); | 471 edca->SetTxMiddle (m_txMiddle); |
467 edca->SetTxOkCallback (MakeCallback (&RegularWifiMac::TxOk, this)); | 472 edca->SetTxOkCallback (MakeCallback (&RegularWifiMac::TxOk, this)); |
468 edca->SetTxFailedCallback (MakeCallback (&RegularWifiMac::TxFailed, this)); | 473 edca->SetTxFailedCallback (MakeCallback (&RegularWifiMac::TxFailed, this)); |
469 edca->SetTxDroppedCallback (MakeCallback (&RegularWifiMac::NotifyTxDrop, this)
); | 474 edca->SetTxDroppedCallback (MakeCallback (&RegularWifiMac::NotifyTxDrop, this)
); |
470 edca->SetAccessCategory (ac); | 475 edca->SetAccessCategory (ac); |
471 edca->CompleteConfig (); | 476 edca->CompleteConfig (); |
472 | 477 |
473 m_edca.insert (std::make_pair (ac, edca)); | 478 m_edca.insert (std::make_pair (ac, edca)); |
474 } | 479 } |
475 | 480 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 return m_dsssSupported; | 682 return m_dsssSupported; |
678 } | 683 } |
679 | 684 |
680 void | 685 void |
681 RegularWifiMac::SetCtsToSelfSupported (bool enable) | 686 RegularWifiMac::SetCtsToSelfSupported (bool enable) |
682 { | 687 { |
683 NS_LOG_FUNCTION (this); | 688 NS_LOG_FUNCTION (this); |
684 m_low->SetCtsToSelfSupported (enable); | 689 m_low->SetCtsToSelfSupported (enable); |
685 } | 690 } |
686 | 691 |
687 bool | |
688 RegularWifiMac::GetCtsToSelfSupported () const | |
689 { | |
690 return m_low->GetCtsToSelfSupported (); | |
691 } | |
692 | |
693 void | 692 void |
694 RegularWifiMac::SetSlot (Time slotTime) | 693 RegularWifiMac::SetSlot (Time slotTime) |
695 { | 694 { |
696 NS_LOG_FUNCTION (this << slotTime); | 695 NS_LOG_FUNCTION (this << slotTime); |
697 m_dcfManager->SetSlot (slotTime); | 696 m_dcfManager->SetSlot (slotTime); |
698 m_low->SetSlotTime (slotTime); | 697 m_low->SetSlotTime (slotTime); |
699 } | 698 } |
700 | 699 |
701 Time | 700 Time |
702 RegularWifiMac::GetSlot (void) const | 701 RegularWifiMac::GetSlot (void) const |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 } | 880 } |
882 | 881 |
883 void | 882 void |
884 RegularWifiMac::Enqueue (Ptr<const Packet> packet, | 883 RegularWifiMac::Enqueue (Ptr<const Packet> packet, |
885 Mac48Address to, Mac48Address from) | 884 Mac48Address to, Mac48Address from) |
886 { | 885 { |
887 //We expect RegularWifiMac subclasses which do support forwarding (e.g., | 886 //We expect RegularWifiMac subclasses which do support forwarding (e.g., |
888 //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 |
889 //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 |
890 //this. | 889 //this. |
891 NS_UNUSED(to); | |
892 NS_UNUSED(from); | |
893 NS_FATAL_ERROR ("This MAC entity (" << this << ", " << GetAddress () | 890 NS_FATAL_ERROR ("This MAC entity (" << this << ", " << GetAddress () |
894 << ") does not support Enqueue() with from
address"); | 891 << ") does not support Enqueue() with from
address"); |
895 } | 892 } |
896 | 893 |
897 bool | 894 bool |
898 RegularWifiMac::SupportsSendFrom (void) const | 895 RegularWifiMac::SupportsSendFrom (void) const |
899 { | 896 { |
900 return false; | 897 return false; |
901 } | 898 } |
902 | 899 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
999 } | 996 } |
1000 default: | 997 default: |
1001 NS_FATAL_ERROR ("Unsupported Action frame received"); | 998 NS_FATAL_ERROR ("Unsupported Action frame received"); |
1002 return; | 999 return; |
1003 } | 1000 } |
1004 } | 1001 } |
1005 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 ()); |
1006 } | 1003 } |
1007 | 1004 |
1008 void | 1005 void |
1009 RegularWifiMac::DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket, | 1006 RegularWifiMac::DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket, const
WifiMacHeader *hdr) |
1010 const WifiMacHeader *hdr) | 1007 { |
1011 { | 1008 NS_LOG_FUNCTION (this << aggregatedPacket << hdr); |
1012 NS_UNUSED(hdr); | 1009 MsduAggregator::DeaggregatedMsdus packets = MsduAggregator::Deaggregate (aggre
gatedPacket); |
1013 MsduAggregator::DeaggregatedMsdus packets = | |
1014 MsduAggregator::Deaggregate (aggregatedPacket); | |
1015 | |
1016 for (MsduAggregator::DeaggregatedMsdusCI i = packets.begin (); | 1010 for (MsduAggregator::DeaggregatedMsdusCI i = packets.begin (); |
1017 i != packets.end (); ++i) | 1011 i != packets.end (); ++i) |
1018 { | 1012 { |
1019 ForwardUp ((*i).first, (*i).second.GetSourceAddr (), | 1013 ForwardUp ((*i).first, (*i).second.GetSourceAddr (), |
1020 (*i).second.GetDestinationAddr ()); | 1014 (*i).second.GetDestinationAddr ()); |
1021 } | 1015 } |
1022 } | 1016 } |
1023 | 1017 |
1024 void | 1018 void |
1025 RegularWifiMac::SendAddBaResponse (const MgtAddBaRequestHeader *reqHdr, | 1019 RegularWifiMac::SendAddBaResponse (const MgtAddBaRequestHeader *reqHdr, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1105 MakeBooleanChecker ()) | 1099 MakeBooleanChecker ()) |
1106 .AddAttribute ("HeSupported", | 1100 .AddAttribute ("HeSupported", |
1107 "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.", |
1108 BooleanValue (false), | 1102 BooleanValue (false), |
1109 MakeBooleanAccessor (&RegularWifiMac::SetHeSupported, | 1103 MakeBooleanAccessor (&RegularWifiMac::SetHeSupported, |
1110 &RegularWifiMac::GetHeSupported), | 1104 &RegularWifiMac::GetHeSupported), |
1111 MakeBooleanChecker ()) | 1105 MakeBooleanChecker ()) |
1112 .AddAttribute ("CtsToSelfSupported", | 1106 .AddAttribute ("CtsToSelfSupported", |
1113 "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.", |
1114 BooleanValue (false), | 1108 BooleanValue (false), |
1115 MakeBooleanAccessor (&RegularWifiMac::SetCtsToSelfSupported, | 1109 MakeBooleanAccessor (&RegularWifiMac::SetCtsToSelfSupported), |
1116 &RegularWifiMac::GetCtsToSelfSupported), | |
1117 MakeBooleanChecker ()) | 1110 MakeBooleanChecker ()) |
1118 .AddAttribute ("VO_MaxAmsduSize", | 1111 .AddAttribute ("VO_MaxAmsduSize", |
1119 "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.
" |
1120 "Value 0 means A-MSDU is disabled for that AC.", | 1113 "Value 0 means A-MSDU is disabled for that AC.", |
1121 UintegerValue (0), | 1114 UintegerValue (0), |
1122 MakeUintegerAccessor (&RegularWifiMac::SetVoMaxAmsduSize), | 1115 MakeUintegerAccessor (&RegularWifiMac::SetVoMaxAmsduSize), |
1123 MakeUintegerChecker<uint32_t> (0, 11426)) | 1116 MakeUintegerChecker<uint16_t> (0, 11426)) |
1124 .AddAttribute ("VI_MaxAmsduSize", | 1117 .AddAttribute ("VI_MaxAmsduSize", |
1125 "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.
" |
1126 "Value 0 means A-MSDU is disabled for that AC.", | 1119 "Value 0 means A-MSDU is disabled for that AC.", |
1127 UintegerValue (0), | 1120 UintegerValue (0), |
1128 MakeUintegerAccessor (&RegularWifiMac::SetViMaxAmsduSize), | 1121 MakeUintegerAccessor (&RegularWifiMac::SetViMaxAmsduSize), |
1129 MakeUintegerChecker<uint32_t> (0, 11426)) | 1122 MakeUintegerChecker<uint16_t> (0, 11426)) |
1130 .AddAttribute ("BE_MaxAmsduSize", | 1123 .AddAttribute ("BE_MaxAmsduSize", |
1131 "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.
" |
1132 "Value 0 means A-MSDU is disabled for that AC.", | 1125 "Value 0 means A-MSDU is disabled for that AC.", |
1133 UintegerValue (0), | 1126 UintegerValue (0), |
1134 MakeUintegerAccessor (&RegularWifiMac::SetBeMaxAmsduSize), | 1127 MakeUintegerAccessor (&RegularWifiMac::SetBeMaxAmsduSize), |
1135 MakeUintegerChecker<uint32_t> (0, 11426)) | 1128 MakeUintegerChecker<uint16_t> (0, 11426)) |
1136 .AddAttribute ("BK_MaxAmsduSize", | 1129 .AddAttribute ("BK_MaxAmsduSize", |
1137 "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.
" |
1138 "Value 0 means A-MSDU is disabled for that AC.", | 1131 "Value 0 means A-MSDU is disabled for that AC.", |
1139 UintegerValue (0), | 1132 UintegerValue (0), |
1140 MakeUintegerAccessor (&RegularWifiMac::SetBkMaxAmsduSize), | 1133 MakeUintegerAccessor (&RegularWifiMac::SetBkMaxAmsduSize), |
1141 MakeUintegerChecker<uint32_t> (0, 11426)) | 1134 MakeUintegerChecker<uint16_t> (0, 11426)) |
1142 .AddAttribute ("VO_MaxAmpduSize", | 1135 .AddAttribute ("VO_MaxAmpduSize", |
1143 "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.
" |
1144 "Value 0 means A-MPDU is disabled for that AC.", | 1137 "Value 0 means A-MPDU is disabled for that AC.", |
1145 UintegerValue (0), | 1138 UintegerValue (0), |
1146 MakeUintegerAccessor (&RegularWifiMac::SetVoMaxAmpduSize), | 1139 MakeUintegerAccessor (&RegularWifiMac::SetVoMaxAmpduSize), |
1147 MakeUintegerChecker<uint32_t> (0, 65535)) | 1140 MakeUintegerChecker<uint16_t> ()) |
1148 .AddAttribute ("VI_MaxAmpduSize", | 1141 .AddAttribute ("VI_MaxAmpduSize", |
1149 "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.
" |
1150 "Value 0 means A-MPDU is disabled for that AC.", | 1143 "Value 0 means A-MPDU is disabled for that AC.", |
1151 UintegerValue (65535), | 1144 UintegerValue (65535), |
1152 MakeUintegerAccessor (&RegularWifiMac::SetViMaxAmpduSize), | 1145 MakeUintegerAccessor (&RegularWifiMac::SetViMaxAmpduSize), |
1153 MakeUintegerChecker<uint32_t> (0, 65535)) | 1146 MakeUintegerChecker<uint16_t> ()) |
1154 .AddAttribute ("BE_MaxAmpduSize", | 1147 .AddAttribute ("BE_MaxAmpduSize", |
1155 "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.
" |
1156 "Value 0 means A-MPDU is disabled for that AC.", | 1149 "Value 0 means A-MPDU is disabled for that AC.", |
1157 UintegerValue (65535), | 1150 UintegerValue (65535), |
1158 MakeUintegerAccessor (&RegularWifiMac::SetBeMaxAmpduSize), | 1151 MakeUintegerAccessor (&RegularWifiMac::SetBeMaxAmpduSize), |
1159 MakeUintegerChecker<uint32_t> (0, 65535)) | 1152 MakeUintegerChecker<uint16_t> ()) |
1160 .AddAttribute ("BK_MaxAmpduSize", | 1153 .AddAttribute ("BK_MaxAmpduSize", |
1161 "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.
" |
1162 "Value 0 means A-MPDU is disabled for that AC.", | 1155 "Value 0 means A-MPDU is disabled for that AC.", |
1163 UintegerValue (0), | 1156 UintegerValue (0), |
1164 MakeUintegerAccessor (&RegularWifiMac::SetBkMaxAmpduSize), | 1157 MakeUintegerAccessor (&RegularWifiMac::SetBkMaxAmpduSize), |
1165 MakeUintegerChecker<uint32_t> (0, 65535)) | 1158 MakeUintegerChecker<uint16_t> ()) |
1166 .AddAttribute ("VO_BlockAckThreshold", | 1159 .AddAttribute ("VO_BlockAckThreshold", |
1167 "If number of packets in VO queue reaches this value, " | 1160 "If number of packets in VO queue reaches this value, " |
1168 "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." |
1169 "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.", |
1170 UintegerValue (0), | 1163 UintegerValue (0), |
1171 MakeUintegerAccessor (&RegularWifiMac::SetVoBlockAckThreshold
), | 1164 MakeUintegerAccessor (&RegularWifiMac::SetVoBlockAckThreshold
), |
1172 MakeUintegerChecker<uint8_t> (0, 64)) | 1165 MakeUintegerChecker<uint8_t> (0, 64)) |
1173 .AddAttribute ("VI_BlockAckThreshold", | 1166 .AddAttribute ("VI_BlockAckThreshold", |
1174 "If number of packets in VI queue reaches this value, " | 1167 "If number of packets in VI queue reaches this value, " |
1175 "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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1342 NS_LOG_FUNCTION (this << hdr); | 1335 NS_LOG_FUNCTION (this << hdr); |
1343 m_txErrCallback (hdr); | 1336 m_txErrCallback (hdr); |
1344 } | 1337 } |
1345 | 1338 |
1346 void | 1339 void |
1347 RegularWifiMac::ConfigureAggregation (void) | 1340 RegularWifiMac::ConfigureAggregation (void) |
1348 { | 1341 { |
1349 NS_LOG_FUNCTION (this); | 1342 NS_LOG_FUNCTION (this); |
1350 if (GetVOQueue ()->GetMsduAggregator () != 0) | 1343 if (GetVOQueue ()->GetMsduAggregator () != 0) |
1351 { | 1344 { |
1352 GetVOQueue ()->GetMsduAggregator ()->SetMaxAmsduSize (static_cast<uint16_t
>(m_voMaxAmsduSize)); | 1345 GetVOQueue ()->GetMsduAggregator ()->SetMaxAmsduSize (m_voMaxAmsduSize); |
1353 } | 1346 } |
1354 if (GetVIQueue ()->GetMsduAggregator () != 0) | 1347 if (GetVIQueue ()->GetMsduAggregator () != 0) |
1355 { | 1348 { |
1356 GetVIQueue ()->GetMsduAggregator ()->SetMaxAmsduSize (static_cast<uint16_t
>(m_viMaxAmsduSize)); | 1349 GetVIQueue ()->GetMsduAggregator ()->SetMaxAmsduSize (m_viMaxAmsduSize); |
1357 } | 1350 } |
1358 if (GetBEQueue ()->GetMsduAggregator () != 0) | 1351 if (GetBEQueue ()->GetMsduAggregator () != 0) |
1359 { | 1352 { |
1360 GetBEQueue ()->GetMsduAggregator ()->SetMaxAmsduSize (static_cast<uint16_t
>(m_beMaxAmsduSize)); | 1353 GetBEQueue ()->GetMsduAggregator ()->SetMaxAmsduSize (m_beMaxAmsduSize); |
1361 } | 1354 } |
1362 if (GetBKQueue ()->GetMsduAggregator () != 0) | 1355 if (GetBKQueue ()->GetMsduAggregator () != 0) |
1363 { | 1356 { |
1364 GetBKQueue ()->GetMsduAggregator ()->SetMaxAmsduSize (static_cast<uint16_t
>(m_bkMaxAmsduSize)); | 1357 GetBKQueue ()->GetMsduAggregator ()->SetMaxAmsduSize (m_bkMaxAmsduSize); |
1365 } | 1358 } |
1366 if (GetVOQueue ()->GetMpduAggregator () != 0) | 1359 if (GetVOQueue ()->GetMpduAggregator () != 0) |
1367 { | 1360 { |
1368 GetVOQueue ()->GetMpduAggregator ()->SetMaxAmpduSize (static_cast<uint16_t
>(m_voMaxAmpduSize)); | 1361 GetVOQueue ()->GetMpduAggregator ()->SetMaxAmpduSize (m_voMaxAmpduSize); |
1369 } | 1362 } |
1370 if (GetVIQueue ()->GetMpduAggregator () != 0) | 1363 if (GetVIQueue ()->GetMpduAggregator () != 0) |
1371 { | 1364 { |
1372 GetVIQueue ()->GetMpduAggregator ()->SetMaxAmpduSize (static_cast<uint16_t
>(m_viMaxAmpduSize)); | 1365 GetVIQueue ()->GetMpduAggregator ()->SetMaxAmpduSize (m_viMaxAmpduSize); |
1373 } | 1366 } |
1374 if (GetBEQueue ()->GetMpduAggregator () != 0) | 1367 if (GetBEQueue ()->GetMpduAggregator () != 0) |
1375 { | 1368 { |
1376 GetBEQueue ()->GetMpduAggregator ()->SetMaxAmpduSize (static_cast<uint16_t
>(m_beMaxAmpduSize)); | 1369 GetBEQueue ()->GetMpduAggregator ()->SetMaxAmpduSize (m_beMaxAmpduSize); |
1377 } | 1370 } |
1378 if (GetBKQueue ()->GetMpduAggregator () != 0) | 1371 if (GetBKQueue ()->GetMpduAggregator () != 0) |
1379 { | 1372 { |
1380 GetBKQueue ()->GetMpduAggregator ()->SetMaxAmpduSize (static_cast<uint16_t
>(m_bkMaxAmpduSize)); | 1373 GetBKQueue ()->GetMpduAggregator ()->SetMaxAmpduSize (m_bkMaxAmpduSize); |
1381 } | 1374 } |
1382 } | 1375 } |
1383 | 1376 |
1384 void | 1377 void |
1385 RegularWifiMac::EnableAggregation (void) | 1378 RegularWifiMac::EnableAggregation (void) |
1386 { | 1379 { |
1387 NS_LOG_FUNCTION (this); | 1380 NS_LOG_FUNCTION (this); |
1388 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) |
1389 { | 1382 { |
1390 if (i->second->GetMsduAggregator () == 0) | 1383 if (i->second->GetMsduAggregator () == 0) |
(...skipping 15 matching lines...) Expand all Loading... |
1406 { | 1399 { |
1407 NS_LOG_FUNCTION (this); | 1400 NS_LOG_FUNCTION (this); |
1408 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) |
1409 { | 1402 { |
1410 i->second->SetMsduAggregator (0); | 1403 i->second->SetMsduAggregator (0); |
1411 i->second->SetMpduAggregator (0); | 1404 i->second->SetMpduAggregator (0); |
1412 } | 1405 } |
1413 } | 1406 } |
1414 | 1407 |
1415 } //namespace ns3 | 1408 } //namespace ns3 |
LEFT | RIGHT |