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) 2005,2006,2007 INRIA | 3 * Copyright (c) 2005,2006,2007 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 "wifi-remote-station-manager.h" | |
22 #include "ns3/simulator.h" | |
23 #include "ns3/log.h" | 21 #include "ns3/log.h" |
24 #include "ns3/boolean.h" | 22 #include "ns3/boolean.h" |
| 23 #include "ns3/uinteger.h" |
25 #include "ns3/enum.h" | 24 #include "ns3/enum.h" |
| 25 #include "ns3/packet.h" |
| 26 #include "ns3/simulator.h" |
| 27 #include "ns3/tag.h" |
| 28 #include "wifi-remote-station-manager.h" |
| 29 #include "wifi-phy.h" |
26 #include "wifi-mac.h" | 30 #include "wifi-mac.h" |
27 #include "wifi-phy.h" | |
28 #include "wifi-utils.h" | 31 #include "wifi-utils.h" |
29 #include "wifi-mac-header.h" | 32 #include "wifi-mac-header.h" |
30 #include "wifi-mac-trailer.h" | 33 #include "wifi-mac-trailer.h" |
| 34 #include "ht-capabilities.h" |
| 35 #include "vht-capabilities.h" |
| 36 #include "he-capabilities.h" |
31 | 37 |
32 /*************************************************************** | 38 /*************************************************************** |
33 * Packet Mode Tagger | 39 * Packet Mode Tagger |
34 ***************************************************************/ | 40 ***************************************************************/ |
35 | 41 |
36 namespace ns3 { | 42 namespace ns3 { |
37 | 43 |
38 NS_LOG_COMPONENT_DEFINE ("WifiRemoteStationManager"); | 44 NS_LOG_COMPONENT_DEFINE ("WifiRemoteStationManager"); |
39 | 45 |
40 /** | 46 /** |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 "Otherwise, we modelize a high-latency device, that is a devi
ce where we cannot update " | 330 "Otherwise, we modelize a high-latency device, that is a devi
ce where we cannot update " |
325 "our decision about tx parameters after every packet transmis
sion.", | 331 "our decision about tx parameters after every packet transmis
sion.", |
326 TypeId::ATTR_GET, | 332 TypeId::ATTR_GET, |
327 BooleanValue (true), //this value is ignored because there is
no setter | 333 BooleanValue (true), //this value is ignored because there is
no setter |
328 MakeBooleanAccessor (&WifiRemoteStationManager::IsLowLatency)
, | 334 MakeBooleanAccessor (&WifiRemoteStationManager::IsLowLatency)
, |
329 MakeBooleanChecker ()) | 335 MakeBooleanChecker ()) |
330 .AddAttribute ("MaxSsrc", | 336 .AddAttribute ("MaxSsrc", |
331 "The maximum number of retransmission attempts for an RTS. " | 337 "The maximum number of retransmission attempts for an RTS. " |
332 " This value will not have any effect on some rate control al
gorithms.", | 338 " This value will not have any effect on some rate control al
gorithms.", |
333 UintegerValue (7), | 339 UintegerValue (7), |
334 MakeUintegerAccessor (&WifiRemoteStationManager::m_maxSsrc), | 340 MakeUintegerAccessor (&WifiRemoteStationManager::SetMaxSsrc), |
335 MakeUintegerChecker<uint32_t> ()) | 341 MakeUintegerChecker<uint32_t> ()) |
336 .AddAttribute ("MaxSlrc", | 342 .AddAttribute ("MaxSlrc", |
337 "The maximum number of retransmission attempts for a DATA pac
ket. " | 343 "The maximum number of retransmission attempts for a DATA pac
ket. " |
338 "This value will not have any effect on some rate control alg
orithms.", | 344 "This value will not have any effect on some rate control alg
orithms.", |
339 UintegerValue (7), | 345 UintegerValue (7), |
340 MakeUintegerAccessor (&WifiRemoteStationManager::m_maxSlrc), | 346 MakeUintegerAccessor (&WifiRemoteStationManager::SetMaxSlrc), |
341 MakeUintegerChecker<uint32_t> ()) | 347 MakeUintegerChecker<uint32_t> ()) |
342 .AddAttribute ("RtsCtsThreshold", | 348 .AddAttribute ("RtsCtsThreshold", |
343 "If the size of the PSDU is bigger than this value, we use an
RTS/CTS handshake before sending the data frame." | 349 "If the size of the PSDU is bigger than this value, we use an
RTS/CTS handshake before sending the data frame." |
344 "This value will not have any effect on some rate control alg
orithms.", | 350 "This value will not have any effect on some rate control alg
orithms.", |
345 UintegerValue (65535), | 351 UintegerValue (65535), |
346 MakeUintegerAccessor (&WifiRemoteStationManager::m_rtsCtsThre
shold), | 352 MakeUintegerAccessor (&WifiRemoteStationManager::SetRtsCtsThr
eshold), |
347 MakeUintegerChecker<uint32_t> ()) | 353 MakeUintegerChecker<uint32_t> ()) |
348 .AddAttribute ("FragmentationThreshold", | 354 .AddAttribute ("FragmentationThreshold", |
349 "If the size of the PSDU is bigger than this value, we fragme
nt it such that the size of the fragments are equal or smaller. " | 355 "If the size of the PSDU is bigger than this value, we fragme
nt it such that the size of the fragments are equal or smaller. " |
350 "This value does not apply when it is carried in an A-MPDU. " | 356 "This value does not apply when it is carried in an A-MPDU. " |
351 "This value will not have any effect on some rate control alg
orithms.", | 357 "This value will not have any effect on some rate control alg
orithms.", |
352 UintegerValue (2346), | 358 UintegerValue (2346), |
353 MakeUintegerAccessor (&WifiRemoteStationManager::DoSetFragmen
tationThreshold, | 359 MakeUintegerAccessor (&WifiRemoteStationManager::DoSetFragmen
tationThreshold, |
354 &WifiRemoteStationManager::DoGetFragmen
tationThreshold), | 360 &WifiRemoteStationManager::DoGetFragmen
tationThreshold), |
355 MakeUintegerChecker<uint32_t> ()) | 361 MakeUintegerChecker<uint32_t> ()) |
356 .AddAttribute ("NonUnicastMode", | 362 .AddAttribute ("NonUnicastMode", |
357 "Wifi mode used for non-unicast transmissions.", | 363 "Wifi mode used for non-unicast transmissions.", |
358 WifiModeValue (), | 364 WifiModeValue (), |
359 MakeWifiModeAccessor (&WifiRemoteStationManager::m_nonUnicast
Mode), | 365 MakeWifiModeAccessor (&WifiRemoteStationManager::m_nonUnicast
Mode), |
360 MakeWifiModeChecker ()) | 366 MakeWifiModeChecker ()) |
361 .AddAttribute ("DefaultTxPowerLevel", | 367 .AddAttribute ("DefaultTxPowerLevel", |
362 "Default power level to be used for transmissions. " | 368 "Default power level to be used for transmissions. " |
363 "This is the power level that is used by all those WifiManage
rs that do not implement TX power control.", | 369 "This is the power level that is used by all those WifiManage
rs that do not implement TX power control.", |
364 UintegerValue (0), | 370 UintegerValue (0), |
365 MakeUintegerAccessor (&WifiRemoteStationManager::m_defaultTxP
owerLevel), | 371 MakeUintegerAccessor (&WifiRemoteStationManager::m_defaultTxP
owerLevel), |
366 MakeUintegerChecker<uint8_t> ()) | 372 MakeUintegerChecker<uint8_t> ()) |
367 .AddAttribute ("ErpProtectionMode", | 373 .AddAttribute ("ErpProtectionMode", |
368 "Protection mode used when non-ERP STAs are connected to an E
RP AP: Rts-Cts or Cts-To-Self", | 374 "Protection mode used when non-ERP STAs are connected to an E
RP AP: Rts-Cts or Cts-To-Self", |
369 EnumValue (WifiRemoteStationManager::CTS_TO_SELF), | 375 EnumValue (WifiRemoteStationManager::CTS_TO_SELF), |
370 MakeEnumAccessor (&WifiRemoteStationManager::SetErpProtection
Mode, | 376 MakeEnumAccessor (&WifiRemoteStationManager::m_erpProtectionM
ode), |
371 &WifiRemoteStationManager::GetErpProtection
Mode), | |
372 MakeEnumChecker (WifiRemoteStationManager::RTS_CTS, "Rts-Cts"
, | 377 MakeEnumChecker (WifiRemoteStationManager::RTS_CTS, "Rts-Cts"
, |
373 WifiRemoteStationManager::CTS_TO_SELF, "Cts-
To-Self")) | 378 WifiRemoteStationManager::CTS_TO_SELF, "Cts-
To-Self")) |
374 .AddAttribute ("HtProtectionMode", | 379 .AddAttribute ("HtProtectionMode", |
375 "Protection mode used when non-HT STAs are connected to a HT
AP: Rts-Cts or Cts-To-Self", | 380 "Protection mode used when non-HT STAs are connected to a HT
AP: Rts-Cts or Cts-To-Self", |
376 EnumValue (WifiRemoteStationManager::CTS_TO_SELF), | 381 EnumValue (WifiRemoteStationManager::CTS_TO_SELF), |
377 MakeEnumAccessor (&WifiRemoteStationManager::SetHtProtectionM
ode, | 382 MakeEnumAccessor (&WifiRemoteStationManager::m_htProtectionMo
de), |
378 &WifiRemoteStationManager::GetHtProtectionM
ode), | |
379 MakeEnumChecker (WifiRemoteStationManager::RTS_CTS, "Rts-Cts"
, | 383 MakeEnumChecker (WifiRemoteStationManager::RTS_CTS, "Rts-Cts"
, |
380 WifiRemoteStationManager::CTS_TO_SELF, "Cts-
To-Self")) | 384 WifiRemoteStationManager::CTS_TO_SELF, "Cts-
To-Self")) |
381 .AddTraceSource ("MacTxRtsFailed", | 385 .AddTraceSource ("MacTxRtsFailed", |
382 "The transmission of a RTS by the MAC layer has failed", | 386 "The transmission of a RTS by the MAC layer has failed", |
383 MakeTraceSourceAccessor (&WifiRemoteStationManager::m_macTx
RtsFailed), | 387 MakeTraceSourceAccessor (&WifiRemoteStationManager::m_macTx
RtsFailed), |
384 "ns3::Mac48Address::TracedCallback") | 388 "ns3::Mac48Address::TracedCallback") |
385 .AddTraceSource ("MacTxDataFailed", | 389 .AddTraceSource ("MacTxDataFailed", |
386 "The transmission of a data packet by the MAC layer has fai
led", | 390 "The transmission of a data packet by the MAC layer has fai
led", |
387 MakeTraceSourceAccessor (&WifiRemoteStationManager::m_macTx
DataFailed), | 391 MakeTraceSourceAccessor (&WifiRemoteStationManager::m_macTx
DataFailed), |
388 "ns3::Mac48Address::TracedCallback") | 392 "ns3::Mac48Address::TracedCallback") |
389 .AddTraceSource ("MacTxFinalRtsFailed", | 393 .AddTraceSource ("MacTxFinalRtsFailed", |
390 "The transmission of a RTS has exceeded the maximum number
of attempts", | 394 "The transmission of a RTS has exceeded the maximum number
of attempts", |
391 MakeTraceSourceAccessor (&WifiRemoteStationManager::m_macTx
FinalRtsFailed), | 395 MakeTraceSourceAccessor (&WifiRemoteStationManager::m_macTx
FinalRtsFailed), |
392 "ns3::Mac48Address::TracedCallback") | 396 "ns3::Mac48Address::TracedCallback") |
393 .AddTraceSource ("MacTxFinalDataFailed", | 397 .AddTraceSource ("MacTxFinalDataFailed", |
394 "The transmission of a data packet has exceeded the maximum
number of attempts", | 398 "The transmission of a data packet has exceeded the maximum
number of attempts", |
395 MakeTraceSourceAccessor (&WifiRemoteStationManager::m_macTx
FinalDataFailed), | 399 MakeTraceSourceAccessor (&WifiRemoteStationManager::m_macTx
FinalDataFailed), |
396 "ns3::Mac48Address::TracedCallback") | 400 "ns3::Mac48Address::TracedCallback") |
397 ; | 401 ; |
398 return tid; | 402 return tid; |
399 } | 403 } |
400 | 404 |
401 WifiRemoteStationManager::WifiRemoteStationManager () | 405 WifiRemoteStationManager::WifiRemoteStationManager () |
402 : m_qosSupported (false), | 406 : m_htSupported (false), |
403 m_htSupported (false), | |
404 m_vhtSupported (false), | 407 m_vhtSupported (false), |
405 m_heSupported (false), | 408 m_heSupported (false), |
406 m_useNonErpProtection (false), | 409 m_useNonErpProtection (false), |
407 m_useNonHtProtection (false), | 410 m_useNonHtProtection (false), |
408 m_useGreenfieldProtection (false), | 411 m_useGreenfieldProtection (false), |
409 m_shortPreambleEnabled (false), | 412 m_shortPreambleEnabled (false), |
410 m_shortSlotTimeEnabled (false), | 413 m_shortSlotTimeEnabled (false), |
411 m_rifsPermitted (false) | 414 m_rifsPermitted (false) |
412 { | 415 { |
| 416 NS_LOG_FUNCTION (this); |
413 } | 417 } |
414 | 418 |
415 WifiRemoteStationManager::~WifiRemoteStationManager () | 419 WifiRemoteStationManager::~WifiRemoteStationManager () |
416 { | 420 { |
| 421 NS_LOG_FUNCTION (this); |
417 } | 422 } |
418 | 423 |
419 void | 424 void |
420 WifiRemoteStationManager::DoDispose (void) | 425 WifiRemoteStationManager::DoDispose (void) |
421 { | 426 { |
422 for (StationStates::const_iterator i = m_states.begin (); i != m_states.end ()
; i++) | 427 NS_LOG_FUNCTION (this); |
423 { | 428 Reset (); |
424 delete (*i); | |
425 } | |
426 m_states.clear (); | |
427 for (Stations::const_iterator i = m_stations.begin (); i != m_stations.end ();
i++) | |
428 { | |
429 delete (*i); | |
430 } | |
431 m_stations.clear (); | |
432 } | 429 } |
433 | 430 |
434 void | 431 void |
435 WifiRemoteStationManager::SetupPhy (const Ptr<WifiPhy> phy) | 432 WifiRemoteStationManager::SetupPhy (const Ptr<WifiPhy> phy) |
436 { | 433 { |
| 434 NS_LOG_FUNCTION (this << phy); |
437 //We need to track our PHY because it is the object that knows the | 435 //We need to track our PHY because it is the object that knows the |
438 //full set of transmit rates that are supported. We need to know | 436 //full set of transmit rates that are supported. We need to know |
439 //this in order to find the relevant mandatory rates when chosing a | 437 //this in order to find the relevant mandatory rates when chosing a |
440 //transmit rate for automatic control responses like | 438 //transmit rate for automatic control responses like |
441 //acknowledgements. | 439 //acknowledgements. |
442 m_wifiPhy = phy; | 440 m_wifiPhy = phy; |
443 m_defaultTxMode = phy->GetMode (0); | 441 m_defaultTxMode = phy->GetMode (0); |
| 442 NS_ASSERT (m_defaultTxMode.IsMandatory ()); |
444 if (HasHtSupported () || HasVhtSupported () || HasHeSupported ()) | 443 if (HasHtSupported () || HasVhtSupported () || HasHeSupported ()) |
445 { | 444 { |
446 m_defaultTxMcs = phy->GetMcs (0); | 445 m_defaultTxMcs = phy->GetMcs (0); |
447 } | 446 } |
448 Reset (); | 447 Reset (); |
449 } | 448 } |
450 | 449 |
451 void | 450 void |
452 WifiRemoteStationManager::SetupMac (const Ptr<WifiMac> mac) | 451 WifiRemoteStationManager::SetupMac (const Ptr<WifiMac> mac) |
453 { | 452 { |
| 453 NS_LOG_FUNCTION (this << mac); |
454 //We need to track our MAC because it is the object that knows the | 454 //We need to track our MAC because it is the object that knows the |
455 //full set of interframe spaces. | 455 //full set of interframe spaces. |
456 m_wifiMac = mac; | 456 m_wifiMac = mac; |
457 Reset (); | 457 Reset (); |
458 } | 458 } |
459 | 459 |
460 void | 460 void |
461 WifiRemoteStationManager::SetQosSupported (bool enable) | 461 WifiRemoteStationManager::SetMaxSsrc (uint32_t maxSsrc) |
462 { | 462 { |
463 m_qosSupported = enable; | 463 NS_LOG_FUNCTION (this << maxSsrc); |
| 464 m_maxSsrc = maxSsrc; |
| 465 } |
| 466 |
| 467 void |
| 468 WifiRemoteStationManager::SetMaxSlrc (uint32_t maxSlrc) |
| 469 { |
| 470 NS_LOG_FUNCTION (this << maxSlrc); |
| 471 m_maxSlrc = maxSlrc; |
| 472 } |
| 473 |
| 474 void |
| 475 WifiRemoteStationManager::SetRtsCtsThreshold (uint32_t threshold) |
| 476 { |
| 477 NS_LOG_FUNCTION (this << threshold); |
| 478 m_rtsCtsThreshold = threshold; |
464 } | 479 } |
465 | 480 |
466 void | 481 void |
467 WifiRemoteStationManager::SetHtSupported (bool enable) | 482 WifiRemoteStationManager::SetHtSupported (bool enable) |
468 { | 483 { |
| 484 NS_LOG_FUNCTION (this << enable); |
469 m_htSupported = enable; | 485 m_htSupported = enable; |
470 } | 486 } |
471 | 487 |
472 void | 488 void |
473 WifiRemoteStationManager::SetMaxSsrc (uint32_t maxSsrc) | |
474 { | |
475 m_maxSsrc = maxSsrc; | |
476 } | |
477 | |
478 void | |
479 WifiRemoteStationManager::SetMaxSlrc (uint32_t maxSlrc) | |
480 { | |
481 m_maxSlrc = maxSlrc; | |
482 } | |
483 | |
484 void | |
485 WifiRemoteStationManager::SetRtsCtsThreshold (uint32_t threshold) | |
486 { | |
487 m_rtsCtsThreshold = threshold; | |
488 } | |
489 | |
490 void | |
491 WifiRemoteStationManager::SetFragmentationThreshold (uint32_t threshold) | 489 WifiRemoteStationManager::SetFragmentationThreshold (uint32_t threshold) |
492 { | 490 { |
| 491 NS_LOG_FUNCTION (this << threshold); |
493 DoSetFragmentationThreshold (threshold); | 492 DoSetFragmentationThreshold (threshold); |
494 } | |
495 | |
496 void | |
497 WifiRemoteStationManager::SetErpProtectionMode (WifiRemoteStationManager::Protec
tionMode mode) | |
498 { | |
499 NS_LOG_FUNCTION (this << mode); | |
500 m_erpProtectionMode = mode; | |
501 } | |
502 | |
503 void | |
504 WifiRemoteStationManager::SetHtProtectionMode (WifiRemoteStationManager::Protect
ionMode mode) | |
505 { | |
506 NS_LOG_FUNCTION (this << mode); | |
507 m_htProtectionMode = mode; | |
508 } | 493 } |
509 | 494 |
510 void | 495 void |
511 WifiRemoteStationManager::SetShortPreambleEnabled (bool enable) | 496 WifiRemoteStationManager::SetShortPreambleEnabled (bool enable) |
512 { | 497 { |
513 NS_LOG_FUNCTION (this << enable); | 498 NS_LOG_FUNCTION (this << enable); |
514 m_shortPreambleEnabled = enable; | 499 m_shortPreambleEnabled = enable; |
515 } | 500 } |
516 | 501 |
517 void | 502 void |
(...skipping 21 matching lines...) Expand all Loading... |
539 { | 524 { |
540 return m_shortPreambleEnabled; | 525 return m_shortPreambleEnabled; |
541 } | 526 } |
542 | 527 |
543 bool | 528 bool |
544 WifiRemoteStationManager::GetRifsPermitted (void) const | 529 WifiRemoteStationManager::GetRifsPermitted (void) const |
545 { | 530 { |
546 return m_rifsPermitted; | 531 return m_rifsPermitted; |
547 } | 532 } |
548 | 533 |
549 WifiRemoteStationManager::ProtectionMode | |
550 WifiRemoteStationManager::GetErpProtectionMode (void) const | |
551 { | |
552 return m_erpProtectionMode; | |
553 } | |
554 | |
555 WifiRemoteStationManager::ProtectionMode | |
556 WifiRemoteStationManager::GetHtProtectionMode (void) const | |
557 { | |
558 return m_htProtectionMode; | |
559 } | |
560 | |
561 bool | |
562 WifiRemoteStationManager::HasQosSupported (void) const | |
563 { | |
564 return m_qosSupported; | |
565 } | |
566 | |
567 bool | 534 bool |
568 WifiRemoteStationManager::HasHtSupported (void) const | 535 WifiRemoteStationManager::HasHtSupported (void) const |
569 { | 536 { |
570 return m_htSupported; | 537 return m_htSupported; |
571 } | 538 } |
572 | 539 |
573 void | 540 void |
574 WifiRemoteStationManager::SetVhtSupported (bool enable) | 541 WifiRemoteStationManager::SetVhtSupported (bool enable) |
575 { | 542 { |
576 m_vhtSupported = enable; | 543 m_vhtSupported = enable; |
577 } | 544 } |
578 | 545 |
579 bool | 546 bool |
580 WifiRemoteStationManager::HasVhtSupported (void) const | 547 WifiRemoteStationManager::HasVhtSupported (void) const |
581 { | 548 { |
582 return m_vhtSupported; | 549 return m_vhtSupported; |
583 } | 550 } |
584 | 551 |
585 void | 552 void |
586 WifiRemoteStationManager::SetHeSupported (bool enable) | 553 WifiRemoteStationManager::SetHeSupported (bool enable) |
587 { | 554 { |
588 m_heSupported = enable; | 555 m_heSupported = enable; |
589 } | 556 } |
590 | 557 |
591 bool | 558 bool |
592 WifiRemoteStationManager::HasHeSupported (void) const | 559 WifiRemoteStationManager::HasHeSupported (void) const |
593 { | 560 { |
594 return m_heSupported; | 561 return m_heSupported; |
595 } | |
596 | |
597 uint32_t | |
598 WifiRemoteStationManager::GetMaxSsrc (void) const | |
599 { | |
600 return m_maxSsrc; | |
601 } | |
602 | |
603 uint32_t | |
604 WifiRemoteStationManager::GetMaxSlrc (void) const | |
605 { | |
606 return m_maxSlrc; | |
607 } | |
608 | |
609 uint32_t | |
610 WifiRemoteStationManager::GetRtsCtsThreshold (void) const | |
611 { | |
612 return m_rtsCtsThreshold; | |
613 } | 562 } |
614 | 563 |
615 uint32_t | 564 uint32_t |
616 WifiRemoteStationManager::GetFragmentationThreshold (void) const | 565 WifiRemoteStationManager::GetFragmentationThreshold (void) const |
617 { | 566 { |
618 return DoGetFragmentationThreshold (); | 567 return DoGetFragmentationThreshold (); |
619 } | 568 } |
620 | 569 |
621 void | 570 void |
622 WifiRemoteStationManager::Reset (Mac48Address address) | 571 WifiRemoteStationManager::AddSupportedPlcpPreamble (Mac48Address address, bool i
sShortPreambleSupported) |
| 572 { |
| 573 NS_LOG_FUNCTION (this << address << isShortPreambleSupported); |
| 574 NS_ASSERT (!address.IsGroup ()); |
| 575 WifiRemoteStationState *state = LookupState (address); |
| 576 state->m_shortPreamble = isShortPreambleSupported; |
| 577 } |
| 578 |
| 579 void |
| 580 WifiRemoteStationManager::AddSupportedErpSlotTime (Mac48Address address, bool is
ShortSlotTimeSupported) |
| 581 { |
| 582 NS_LOG_FUNCTION (this << address << isShortSlotTimeSupported); |
| 583 NS_ASSERT (!address.IsGroup ()); |
| 584 WifiRemoteStationState *state = LookupState (address); |
| 585 state->m_shortSlotTime = isShortSlotTimeSupported; |
| 586 } |
| 587 |
| 588 void |
| 589 WifiRemoteStationManager::AddSupportedMode (Mac48Address address, WifiMode mode) |
| 590 { |
| 591 NS_LOG_FUNCTION (this << address << mode); |
| 592 NS_ASSERT (!address.IsGroup ()); |
| 593 WifiRemoteStationState *state = LookupState (address); |
| 594 for (WifiModeListIterator i = state->m_operationalRateSet.begin (); i != state
->m_operationalRateSet.end (); i++) |
| 595 { |
| 596 if ((*i) == mode) |
| 597 { |
| 598 //already in. |
| 599 return; |
| 600 } |
| 601 } |
| 602 state->m_operationalRateSet.push_back (mode); |
| 603 } |
| 604 |
| 605 void |
| 606 WifiRemoteStationManager::AddAllSupportedModes (Mac48Address address) |
623 { | 607 { |
624 NS_LOG_FUNCTION (this << address); | 608 NS_LOG_FUNCTION (this << address); |
625 NS_ASSERT (!address.IsGroup ()); | 609 NS_ASSERT (!address.IsGroup ()); |
626 WifiRemoteStationState *state = LookupState (address); | 610 WifiRemoteStationState *state = LookupState (address); |
627 state->m_operationalRateSet.clear (); | 611 state->m_operationalRateSet.clear (); |
628 state->m_operationalMcsSet.clear (); | 612 for (uint8_t i = 0; i < m_wifiPhy->GetNModes (); i++) |
629 AddSupportedMode (address, GetDefaultMode ()); | |
630 AddSupportedMcs (address, GetDefaultMcs ()); | |
631 } | |
632 | |
633 void | |
634 WifiRemoteStationManager::AddSupportedPlcpPreamble (Mac48Address address, bool i
sShortPreambleSupported) | |
635 { | |
636 NS_LOG_FUNCTION (this << address << isShortPreambleSupported); | |
637 NS_ASSERT (!address.IsGroup ()); | |
638 WifiRemoteStationState *state = LookupState (address); | |
639 state->m_shortPreamble = isShortPreambleSupported; | |
640 } | |
641 | |
642 void | |
643 WifiRemoteStationManager::AddSupportedErpSlotTime (Mac48Address address, bool is
ShortSlotTimeSupported) | |
644 { | |
645 NS_LOG_FUNCTION (this << address << isShortSlotTimeSupported); | |
646 NS_ASSERT (!address.IsGroup ()); | |
647 WifiRemoteStationState *state = LookupState (address); | |
648 state->m_shortSlotTime = isShortSlotTimeSupported; | |
649 } | |
650 | |
651 void | |
652 WifiRemoteStationManager::AddSupportedMode (Mac48Address address, WifiMode mode) | |
653 { | |
654 NS_LOG_FUNCTION (this << address << mode); | |
655 NS_ASSERT (!address.IsGroup ()); | |
656 WifiRemoteStationState *state = LookupState (address); | |
657 for (WifiModeListIterator i = state->m_operationalRateSet.begin (); i != state
->m_operationalRateSet.end (); i++) | |
658 { | |
659 if ((*i) == mode) | |
660 { | |
661 //already in. | |
662 return; | |
663 } | |
664 } | |
665 state->m_operationalRateSet.push_back (mode); | |
666 } | |
667 | |
668 void | |
669 WifiRemoteStationManager::AddAllSupportedModes (Mac48Address address) | |
670 { | |
671 NS_LOG_FUNCTION (this << address); | |
672 NS_ASSERT (!address.IsGroup ()); | |
673 WifiRemoteStationState *state = LookupState (address); | |
674 state->m_operationalRateSet.clear (); | |
675 for (uint32_t i = 0; i < m_wifiPhy->GetNModes (); i++) | |
676 { | 613 { |
677 state->m_operationalRateSet.push_back (m_wifiPhy->GetMode (i)); | 614 state->m_operationalRateSet.push_back (m_wifiPhy->GetMode (i)); |
678 if (m_wifiPhy->GetMode (i).IsMandatory ()) | 615 if (m_wifiPhy->GetMode (i).IsMandatory ()) |
679 { | 616 { |
680 AddBasicMode (m_wifiPhy->GetMode (i)); | 617 AddBasicMode (m_wifiPhy->GetMode (i)); |
681 } | 618 } |
682 } | 619 } |
683 } | 620 } |
684 | 621 |
685 void | 622 void |
686 WifiRemoteStationManager::AddAllSupportedMcs (Mac48Address address) | 623 WifiRemoteStationManager::AddAllSupportedMcs (Mac48Address address) |
687 { | 624 { |
688 NS_LOG_FUNCTION (this << address); | 625 NS_LOG_FUNCTION (this << address); |
689 NS_ASSERT (!address.IsGroup ()); | 626 NS_ASSERT (!address.IsGroup ()); |
690 WifiRemoteStationState *state = LookupState (address); | 627 WifiRemoteStationState *state = LookupState (address); |
691 state->m_operationalMcsSet.clear (); | 628 state->m_operationalMcsSet.clear (); |
692 for (uint32_t i = 0; i < m_wifiPhy->GetNMcs (); i++) | 629 for (uint8_t i = 0; i < m_wifiPhy->GetNMcs (); i++) |
693 { | 630 { |
694 state->m_operationalMcsSet.push_back (m_wifiPhy->GetMcs ((uint8_t)i)); | 631 state->m_operationalMcsSet.push_back (m_wifiPhy->GetMcs (i)); |
695 } | 632 } |
696 } | 633 } |
697 | 634 |
698 void | 635 void |
699 WifiRemoteStationManager::RemoveAllSupportedMcs (Mac48Address address) | 636 WifiRemoteStationManager::RemoveAllSupportedMcs (Mac48Address address) |
700 { | 637 { |
701 NS_LOG_FUNCTION (this << address); | 638 NS_LOG_FUNCTION (this << address); |
702 NS_ASSERT (!address.IsGroup ()); | 639 NS_ASSERT (!address.IsGroup ()); |
703 WifiRemoteStationState *state = LookupState (address); | 640 WifiRemoteStationState *state = LookupState (address); |
704 state->m_operationalMcsSet.clear (); | 641 state->m_operationalMcsSet.clear (); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 ConstCast<Packet> (packet)->RemovePacketTag (ctstoselftag); | 755 ConstCast<Packet> (packet)->RemovePacketTag (ctstoselftag); |
819 datatag = HighLatencyDataTxVectorTag (data); | 756 datatag = HighLatencyDataTxVectorTag (data); |
820 rtstag = HighLatencyRtsTxVectorTag (rts); | 757 rtstag = HighLatencyRtsTxVectorTag (rts); |
821 ctstoselftag = HighLatencyCtsToSelfTxVectorTag (ctstoself); | 758 ctstoselftag = HighLatencyCtsToSelfTxVectorTag (ctstoself); |
822 //and then, add it back | 759 //and then, add it back |
823 packet->AddPacketTag (datatag); | 760 packet->AddPacketTag (datatag); |
824 packet->AddPacketTag (rtstag); | 761 packet->AddPacketTag (rtstag); |
825 packet->AddPacketTag (ctstoselftag); | 762 packet->AddPacketTag (ctstoselftag); |
826 } | 763 } |
827 | 764 |
| 765 uint16_t |
| 766 WifiRemoteStationManager::GetChannelWidthForTransmission (WifiMode mode, uint16_
t maxSupportedChannelWidth) |
| 767 { |
| 768 NS_LOG_FUNCTION (mode << maxSupportedChannelWidth); |
| 769 WifiModulationClass modulationClass = mode.GetModulationClass (); |
| 770 if (maxSupportedChannelWidth > 20 |
| 771 && (modulationClass == WifiModulationClass::WIFI_MOD_CLASS_OFDM // all non
-HT OFDM control and management frames |
| 772 || modulationClass == WifiModulationClass::WIFI_MOD_CLASS_ERP_OFDM)) /
/ special case of beacons at 2.4 GHz |
| 773 { |
| 774 NS_LOG_LOGIC ("Channel width reduced to 20 MHz"); |
| 775 return 20; |
| 776 } |
| 777 //at 2.4 GHz basic rate can be non-ERP DSSS |
| 778 if (modulationClass == WifiModulationClass::WIFI_MOD_CLASS_DSSS |
| 779 || modulationClass == WifiModulationClass::WIFI_MOD_CLASS_HR_DSSS) |
| 780 { |
| 781 return 22; |
| 782 } |
| 783 return maxSupportedChannelWidth; |
| 784 } |
| 785 |
828 WifiTxVector | 786 WifiTxVector |
829 WifiRemoteStationManager::GetDataTxVector (Mac48Address address, const WifiMacHe
ader *header, Ptr<const Packet> packet) | 787 WifiRemoteStationManager::GetDataTxVector (Mac48Address address, const WifiMacHe
ader *header, Ptr<const Packet> packet) |
830 { | 788 { |
831 NS_LOG_FUNCTION (this << address << *header << packet); | 789 NS_LOG_FUNCTION (this << address << *header << packet); |
832 if (address.IsGroup ()) | 790 if (address.IsGroup ()) |
833 { | 791 { |
834 WifiMode mode = GetNonUnicastMode (); | 792 WifiMode mode = GetNonUnicastMode (); |
835 WifiTxVector v; | 793 WifiTxVector v; |
836 v.SetMode (mode); | 794 v.SetMode (mode); |
837 v.SetPreambleType (GetPreambleForTransmission (mode, address)); | 795 v.SetPreambleType (GetPreambleForTransmission (mode, address)); |
838 v.SetTxPowerLevel (m_defaultTxPowerLevel); | 796 v.SetTxPowerLevel (m_defaultTxPowerLevel); |
839 v.SetChannelWidth (m_wifiPhy->GetChannelWidth ()); | 797 v.SetChannelWidth (GetChannelWidthForTransmission (mode, m_wifiPhy->GetCha
nnelWidth ())); |
840 v.SetGuardInterval (ConvertGuardIntervalToNanoSeconds (mode, m_wifiPhy->Ge
tShortGuardInterval (), m_wifiPhy->GetGuardInterval ())); | 798 v.SetGuardInterval (ConvertGuardIntervalToNanoSeconds (mode, m_wifiPhy->Ge
tShortGuardInterval (), m_wifiPhy->GetGuardInterval ())); |
| 799 v.SetNTx (1); |
841 v.SetNss (1); | 800 v.SetNss (1); |
842 v.SetNess (0); | 801 v.SetNess (0); |
843 v.SetStbc (false); | 802 v.SetStbc (m_wifiPhy->GetStbc ()); |
844 return v; | 803 return v; |
845 } | 804 } |
846 if (!IsLowLatency ()) | 805 if (!IsLowLatency ()) |
847 { | 806 { |
848 HighLatencyDataTxVectorTag datatag; | 807 HighLatencyDataTxVectorTag datatag; |
849 bool found; | 808 bool found; |
850 found = ConstCast<Packet> (packet)->PeekPacketTag (datatag); | 809 found = ConstCast<Packet> (packet)->PeekPacketTag (datatag); |
851 NS_ASSERT (found); | 810 NS_ASSERT (found); |
852 //cast found to void, to suppress 'found' set but not used | 811 //cast found to void, to suppress 'found' set but not used |
853 //compiler warning | 812 //compiler warning |
854 (void) found; | 813 (void) found; |
855 return datatag.GetDataTxVector (); | 814 return datatag.GetDataTxVector (); |
856 } | 815 } |
857 return DoGetDataTxVector (Lookup (address, header)); | 816 WifiTxVector txVector = DoGetDataTxVector (Lookup (address, header)); |
| 817 if (header->IsMgt ()) |
| 818 { |
| 819 //Use the lowest basic rate for management frames |
| 820 WifiMode mgtMode; |
| 821 if (GetNBasicModes () > 0) |
| 822 { |
| 823 mgtMode = GetBasicMode (0); |
| 824 } |
| 825 else |
| 826 { |
| 827 mgtMode = GetDefaultMode (); |
| 828 } |
| 829 txVector.SetMode (mgtMode); |
| 830 txVector.SetPreambleType (GetPreambleForTransmission (mgtMode, address)); |
| 831 txVector.SetChannelWidth (GetChannelWidthForTransmission (mgtMode, m_wifiP
hy->GetChannelWidth ())); |
| 832 txVector.SetGuardInterval (ConvertGuardIntervalToNanoSeconds (mgtMode, m_w
ifiPhy->GetShortGuardInterval (), m_wifiPhy->GetGuardInterval ())); |
| 833 } |
| 834 return txVector; |
858 } | 835 } |
859 | 836 |
860 WifiTxVector | 837 WifiTxVector |
861 WifiRemoteStationManager::GetCtsToSelfTxVector (const WifiMacHeader *header, | 838 WifiRemoteStationManager::GetCtsToSelfTxVector (const WifiMacHeader *header, |
862 Ptr<const Packet> packet) | 839 Ptr<const Packet> packet) |
863 { | 840 { |
864 NS_LOG_FUNCTION (this << *header << packet); | 841 NS_LOG_FUNCTION (this << *header << packet); |
865 if (!IsLowLatency ()) | 842 if (!IsLowLatency ()) |
866 { | 843 { |
867 HighLatencyCtsToSelfTxVectorTag ctstoselftag; | 844 HighLatencyCtsToSelfTxVectorTag ctstoselftag; |
(...skipping 25 matching lines...) Expand all Loading... |
893 { | 870 { |
894 defaultPreamble = WIFI_PREAMBLE_HT_MF; | 871 defaultPreamble = WIFI_PREAMBLE_HT_MF; |
895 } | 872 } |
896 else | 873 else |
897 { | 874 { |
898 defaultPreamble = WIFI_PREAMBLE_LONG; | 875 defaultPreamble = WIFI_PREAMBLE_LONG; |
899 } | 876 } |
900 | 877 |
901 return WifiTxVector (defaultMode, | 878 return WifiTxVector (defaultMode, |
902 GetDefaultTxPowerLevel (), | 879 GetDefaultTxPowerLevel (), |
903 0, | |
904 defaultPreamble, | 880 defaultPreamble, |
905 ConvertGuardIntervalToNanoSeconds (defaultMode, m_wifiPhy
->GetShortGuardInterval (), m_wifiPhy->GetGuardInterval ()), | 881 ConvertGuardIntervalToNanoSeconds (defaultMode, m_wifiPhy
->GetShortGuardInterval (), m_wifiPhy->GetGuardInterval ()), |
906 GetNumberOfAntennas (), | 882 GetNumberOfAntennas (), |
907 GetMaxNumberOfTransmitStreams (), | 883 GetMaxNumberOfTransmitStreams (), |
908 0, | 884 0, |
909 m_wifiPhy->GetChannelWidth (), | 885 GetChannelWidthForTransmission (defaultMode, m_wifiPhy->G
etChannelWidth ()), |
910 false, | 886 false, |
911 false); | 887 false); |
912 } | 888 } |
913 | 889 |
914 WifiTxVector | 890 WifiTxVector |
915 WifiRemoteStationManager::GetRtsTxVector (Mac48Address address, const WifiMacHea
der *header, | 891 WifiRemoteStationManager::GetRtsTxVector (Mac48Address address, const WifiMacHea
der *header, |
916 Ptr<const Packet> packet) | 892 Ptr<const Packet> packet) |
917 { | 893 { |
918 NS_LOG_FUNCTION (this << address << *header << packet); | 894 NS_LOG_FUNCTION (this << address << *header << packet); |
919 NS_ASSERT (!address.IsGroup ()); | 895 NS_ASSERT (!address.IsGroup ()); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 } | 988 } |
1013 WifiRemoteStation *station = Lookup (address, header); | 989 WifiRemoteStation *station = Lookup (address, header); |
1014 DoReportRxOk (station, rxSnr, txMode); | 990 DoReportRxOk (station, rxSnr, txMode); |
1015 } | 991 } |
1016 | 992 |
1017 void | 993 void |
1018 WifiRemoteStationManager::ReportAmpduTxStatus (Mac48Address address, uint8_t tid
, | 994 WifiRemoteStationManager::ReportAmpduTxStatus (Mac48Address address, uint8_t tid
, |
1019 uint8_t nSuccessfulMpdus, uint8_t
nFailedMpdus, | 995 uint8_t nSuccessfulMpdus, uint8_t
nFailedMpdus, |
1020 double rxSnr, double dataSnr) | 996 double rxSnr, double dataSnr) |
1021 { | 997 { |
1022 NS_LOG_FUNCTION (this << address << (uint16_t)tid << (uint16_t)nSuccessfulMpdu
s << (uint16_t)nFailedMpdus << rxSnr << dataSnr); | 998 NS_LOG_FUNCTION (this << address << +tid << +nSuccessfulMpdus << +nFailedMpdus
<< rxSnr << dataSnr); |
1023 NS_ASSERT (!address.IsGroup ()); | 999 NS_ASSERT (!address.IsGroup ()); |
1024 WifiRemoteStation *station = Lookup (address, tid); | 1000 WifiRemoteStation *station = Lookup (address, tid); |
1025 for (uint32_t i = 0; i < nFailedMpdus; i++) | 1001 for (uint8_t i = 0; i < nFailedMpdus; i++) |
1026 { | 1002 { |
1027 m_macTxDataFailed (address); | 1003 m_macTxDataFailed (address); |
1028 } | 1004 } |
1029 DoReportAmpduTxStatus (station, nSuccessfulMpdus, nFailedMpdus, rxSnr, dataSnr
); | 1005 DoReportAmpduTxStatus (station, nSuccessfulMpdus, nFailedMpdus, rxSnr, dataSnr
); |
1030 } | 1006 } |
1031 | 1007 |
1032 bool | 1008 bool |
1033 WifiRemoteStationManager::NeedRts (Mac48Address address, const WifiMacHeader *he
ader, | 1009 WifiRemoteStationManager::NeedRts (Mac48Address address, const WifiMacHeader *he
ader, |
1034 Ptr<const Packet> packet, WifiTxVector txVect
or) | 1010 Ptr<const Packet> packet, WifiTxVector txVect
or) |
1035 { | 1011 { |
(...skipping 15 matching lines...) Expand all Loading... |
1051 } | 1027 } |
1052 else if (m_htProtectionMode == RTS_CTS | 1028 else if (m_htProtectionMode == RTS_CTS |
1053 && ((mode.GetModulationClass () == WIFI_MOD_CLASS_HT) | 1029 && ((mode.GetModulationClass () == WIFI_MOD_CLASS_HT) |
1054 || (mode.GetModulationClass () == WIFI_MOD_CLASS_VHT)) | 1030 || (mode.GetModulationClass () == WIFI_MOD_CLASS_VHT)) |
1055 && m_useNonHtProtection | 1031 && m_useNonHtProtection |
1056 && !(m_erpProtectionMode != RTS_CTS && m_useNonErpProtection)) | 1032 && !(m_erpProtectionMode != RTS_CTS && m_useNonErpProtection)) |
1057 { | 1033 { |
1058 NS_LOG_DEBUG ("WifiRemoteStationManager::NeedRTS returning true to protect
non-HT stations"); | 1034 NS_LOG_DEBUG ("WifiRemoteStationManager::NeedRTS returning true to protect
non-HT stations"); |
1059 return true; | 1035 return true; |
1060 } | 1036 } |
1061 bool normally = (packet->GetSize () + header->GetSize () + WIFI_MAC_FCS_LENGTH
) > GetRtsCtsThreshold (); | 1037 bool normally = (packet->GetSize () + header->GetSize () + WIFI_MAC_FCS_LENGTH
) > m_rtsCtsThreshold; |
1062 return DoNeedRts (Lookup (address, header), packet, normally); | 1038 return DoNeedRts (Lookup (address, header), packet, normally); |
1063 } | 1039 } |
1064 | 1040 |
1065 bool | 1041 bool |
1066 WifiRemoteStationManager::NeedCtsToSelf (WifiTxVector txVector) | 1042 WifiRemoteStationManager::NeedCtsToSelf (WifiTxVector txVector) |
1067 { | 1043 { |
1068 WifiMode mode = txVector.GetMode (); | 1044 WifiMode mode = txVector.GetMode (); |
1069 NS_LOG_FUNCTION (this << mode); | 1045 NS_LOG_FUNCTION (this << mode); |
1070 if (m_erpProtectionMode == CTS_TO_SELF | 1046 if (m_erpProtectionMode == CTS_TO_SELF |
1071 && ((mode.GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM) | 1047 && ((mode.GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM) |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1154 return m_useGreenfieldProtection; | 1130 return m_useGreenfieldProtection; |
1155 } | 1131 } |
1156 | 1132 |
1157 bool | 1133 bool |
1158 WifiRemoteStationManager::NeedRtsRetransmission (Mac48Address address, const Wif
iMacHeader *header, | 1134 WifiRemoteStationManager::NeedRtsRetransmission (Mac48Address address, const Wif
iMacHeader *header, |
1159 Ptr<const Packet> packet) | 1135 Ptr<const Packet> packet) |
1160 { | 1136 { |
1161 NS_LOG_FUNCTION (this << address << packet << *header); | 1137 NS_LOG_FUNCTION (this << address << packet << *header); |
1162 NS_ASSERT (!address.IsGroup ()); | 1138 NS_ASSERT (!address.IsGroup ()); |
1163 WifiRemoteStation *station = Lookup (address, header); | 1139 WifiRemoteStation *station = Lookup (address, header); |
1164 bool normally = station->m_ssrc < GetMaxSsrc (); | 1140 bool normally = station->m_ssrc < m_maxSsrc; |
1165 NS_LOG_DEBUG ("WifiRemoteStationManager::NeedDataRetransmission count: " << st
ation->m_ssrc << " result: " << std::boolalpha << normally); | 1141 NS_LOG_DEBUG ("WifiRemoteStationManager::NeedDataRetransmission count: " << st
ation->m_ssrc << " result: " << std::boolalpha << normally); |
1166 return DoNeedRtsRetransmission (station, packet, normally); | 1142 return DoNeedRtsRetransmission (station, packet, normally); |
1167 } | 1143 } |
1168 | 1144 |
1169 bool | 1145 bool |
1170 WifiRemoteStationManager::NeedDataRetransmission (Mac48Address address, const Wi
fiMacHeader *header, | 1146 WifiRemoteStationManager::NeedDataRetransmission (Mac48Address address, const Wi
fiMacHeader *header, |
1171 Ptr<const Packet> packet) | 1147 Ptr<const Packet> packet) |
1172 { | 1148 { |
1173 NS_LOG_FUNCTION (this << address << packet << *header); | 1149 NS_LOG_FUNCTION (this << address << packet << *header); |
1174 NS_ASSERT (!address.IsGroup ()); | 1150 NS_ASSERT (!address.IsGroup ()); |
1175 WifiRemoteStation *station = Lookup (address, header); | 1151 WifiRemoteStation *station = Lookup (address, header); |
1176 bool normally = station->m_slrc < GetMaxSlrc (); | 1152 bool normally = station->m_slrc < m_maxSlrc; |
1177 NS_LOG_DEBUG ("WifiRemoteStationManager::NeedDataRetransmission count: " << st
ation->m_slrc << " result: " << std::boolalpha << normally); | 1153 NS_LOG_DEBUG ("WifiRemoteStationManager::NeedDataRetransmission count: " << st
ation->m_slrc << " result: " << std::boolalpha << normally); |
1178 return DoNeedDataRetransmission (station, packet, normally); | 1154 return DoNeedDataRetransmission (station, packet, normally); |
1179 } | 1155 } |
1180 | 1156 |
1181 bool | 1157 bool |
1182 WifiRemoteStationManager::NeedFragmentation (Mac48Address address, const WifiMac
Header *header, | 1158 WifiRemoteStationManager::NeedFragmentation (Mac48Address address, const WifiMac
Header *header, |
1183 Ptr<const Packet> packet) | 1159 Ptr<const Packet> packet) |
1184 { | 1160 { |
1185 NS_LOG_FUNCTION (this << address << packet << *header); | 1161 NS_LOG_FUNCTION (this << address << packet << *header); |
1186 if (address.IsGroup ()) | 1162 if (address.IsGroup ()) |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1397 * rate of the PHY that is less than or equal to the rate of the | 1373 * rate of the PHY that is less than or equal to the rate of the |
1398 * received frame, and that is of the same modulation class as the | 1374 * received frame, and that is of the same modulation class as the |
1399 * received frame. In addition, the Control Response frame shall | 1375 * received frame. In addition, the Control Response frame shall |
1400 * be sent using the same PHY options as the received frame, | 1376 * be sent using the same PHY options as the received frame, |
1401 * unless they conflict with the requirement to use the | 1377 * unless they conflict with the requirement to use the |
1402 * BSSBasicRateSet parameter. | 1378 * BSSBasicRateSet parameter. |
1403 * | 1379 * |
1404 * \todo Note that we're ignoring the last sentence for now, because | 1380 * \todo Note that we're ignoring the last sentence for now, because |
1405 * there is not yet any manipulation here of PHY options. | 1381 * there is not yet any manipulation here of PHY options. |
1406 */ | 1382 */ |
1407 for (uint32_t idx = 0; idx < m_wifiPhy->GetNModes (); idx++) | 1383 for (uint8_t idx = 0; idx < m_wifiPhy->GetNModes (); idx++) |
1408 { | 1384 { |
1409 WifiMode thismode = m_wifiPhy->GetMode (idx); | 1385 WifiMode thismode = m_wifiPhy->GetMode (idx); |
1410 /* If the rate: | 1386 /* If the rate: |
1411 * | 1387 * |
1412 * - is a mandatory rate for the PHY, and | 1388 * - is a mandatory rate for the PHY, and |
1413 * - is equal to or faster than our current best choice, and | 1389 * - is equal to or faster than our current best choice, and |
1414 * - is less than or equal to the rate of the received frame, and | 1390 * - is less than or equal to the rate of the received frame, and |
1415 * - is of the same modulation class as the received frame | 1391 * - is of the same modulation class as the received frame |
1416 * | 1392 * |
1417 * ...then it's our best choice so far. | 1393 * ...then it's our best choice so far. |
1418 */ | 1394 */ |
1419 if (thismode.IsMandatory () | 1395 if (thismode.IsMandatory () |
1420 && (!found || thismode.IsHigherDataRate (mode)) | 1396 && (!found || thismode.IsHigherDataRate (mode)) |
1421 && (!thismode.IsHigherDataRate (reqMode)) | 1397 && (!thismode.IsHigherDataRate (reqMode)) |
1422 && (IsAllowedControlAnswerModulationClass (reqMode.GetModulationClass
(), thismode.GetModulationClass ()))) | 1398 && (IsAllowedControlAnswerModulationClass (reqMode.GetModulationClass
(), thismode.GetModulationClass ()))) |
1423 { | 1399 { |
1424 mode = thismode; | 1400 mode = thismode; |
1425 //As above; we've found a potentially-suitable transmit | 1401 //As above; we've found a potentially-suitable transmit |
1426 //rate, but we need to continue and consider all the | 1402 //rate, but we need to continue and consider all the |
1427 //mandatory rates before we can be sure we've got the right one. | 1403 //mandatory rates before we can be sure we've got the right one. |
1428 found = true; | 1404 found = true; |
1429 } | 1405 } |
1430 } | 1406 } |
1431 if (HasHtSupported () || HasVhtSupported () || HasHeSupported ()) | 1407 if (HasHtSupported () || HasVhtSupported () || HasHeSupported ()) |
1432 { | 1408 { |
1433 for (uint32_t idx = 0; idx < m_wifiPhy->GetNMcs (); idx++) | 1409 for (uint8_t idx = 0; idx < m_wifiPhy->GetNMcs (); idx++) |
1434 { | 1410 { |
1435 WifiMode thismode = m_wifiPhy->GetMcs ((uint8_t)idx); | 1411 WifiMode thismode = m_wifiPhy->GetMcs (idx); |
1436 if (thismode.IsMandatory () | 1412 if (thismode.IsMandatory () |
1437 && (!found || thismode.IsHigherDataRate (mode)) | 1413 && (!found || thismode.IsHigherDataRate (mode)) |
1438 && (!thismode.IsHigherCodeRate (reqMode)) | 1414 && (!thismode.IsHigherCodeRate (reqMode)) |
1439 && (thismode.GetModulationClass () == reqMode.GetModulationClass (
))) | 1415 && (thismode.GetModulationClass () == reqMode.GetModulationClass (
))) |
1440 { | 1416 { |
1441 mode = thismode; | 1417 mode = thismode; |
1442 //As above; we've found a potentially-suitable transmit | 1418 //As above; we've found a potentially-suitable transmit |
1443 //rate, but we need to continue and consider all the | 1419 //rate, but we need to continue and consider all the |
1444 //mandatory rates before we can be sure we've got the right one. | 1420 //mandatory rates before we can be sure we've got the right one. |
1445 found = true; | 1421 found = true; |
1446 } | 1422 } |
1447 | |
1448 } | 1423 } |
1449 } | 1424 } |
1450 | 1425 |
1451 /** | 1426 /** |
1452 * If we still haven't found a suitable rate for the response then | 1427 * If we still haven't found a suitable rate for the response then |
1453 * someone has messed up the simulation config. This probably means | 1428 * someone has messed up the simulation config. This probably means |
1454 * that the WifiPhyStandard is not set correctly, or that a rate that | 1429 * that the WifiPhyStandard is not set correctly, or that a rate that |
1455 * is not supported by the PHY has been explicitly requested in a | 1430 * is not supported by the PHY has been explicitly requested in a |
1456 * WifiRemoteStationManager (or descendant) configuration. | 1431 * WifiRemoteStationManager (or descendant) configuration. |
1457 * | 1432 * |
(...skipping 11 matching lines...) Expand all Loading... |
1469 | 1444 |
1470 WifiTxVector | 1445 WifiTxVector |
1471 WifiRemoteStationManager::GetCtsTxVector (Mac48Address address, WifiMode rtsMode
) | 1446 WifiRemoteStationManager::GetCtsTxVector (Mac48Address address, WifiMode rtsMode
) |
1472 { | 1447 { |
1473 NS_ASSERT (!address.IsGroup ()); | 1448 NS_ASSERT (!address.IsGroup ()); |
1474 WifiMode ctsMode = GetControlAnswerMode (address, rtsMode); | 1449 WifiMode ctsMode = GetControlAnswerMode (address, rtsMode); |
1475 WifiTxVector v; | 1450 WifiTxVector v; |
1476 v.SetMode (ctsMode); | 1451 v.SetMode (ctsMode); |
1477 v.SetPreambleType (GetPreambleForTransmission (ctsMode, address)); | 1452 v.SetPreambleType (GetPreambleForTransmission (ctsMode, address)); |
1478 v.SetTxPowerLevel (DoGetCtsTxPowerLevel (address, ctsMode)); | 1453 v.SetTxPowerLevel (DoGetCtsTxPowerLevel (address, ctsMode)); |
1479 v.SetChannelWidth (DoGetCtsTxChannelWidth (address, ctsMode)); | 1454 v.SetChannelWidth (GetChannelWidthForTransmission (ctsMode, DoGetCtsTxChannelW
idth (address, ctsMode))); |
1480 v.SetGuardInterval (DoGetCtsTxGuardInterval (address, ctsMode)); | 1455 v.SetGuardInterval (DoGetCtsTxGuardInterval (address, ctsMode)); |
1481 v.SetNss (DoGetCtsTxNss (address, ctsMode)); | 1456 v.SetNss (DoGetCtsTxNss (address, ctsMode)); |
1482 v.SetNess (DoGetCtsTxNess (address, ctsMode)); | 1457 v.SetNess (DoGetCtsTxNess (address, ctsMode)); |
1483 v.SetStbc (DoGetCtsTxStbc (address, ctsMode)); | 1458 v.SetStbc (m_wifiPhy->GetStbc ()); |
1484 return v; | 1459 return v; |
1485 } | 1460 } |
1486 | 1461 |
1487 WifiTxVector | 1462 WifiTxVector |
1488 WifiRemoteStationManager::GetAckTxVector (Mac48Address address, WifiMode dataMod
e) | 1463 WifiRemoteStationManager::GetAckTxVector (Mac48Address address, WifiMode dataMod
e) |
1489 { | 1464 { |
1490 NS_ASSERT (!address.IsGroup ()); | 1465 NS_ASSERT (!address.IsGroup ()); |
1491 WifiMode ackMode = GetControlAnswerMode (address, dataMode); | 1466 WifiMode ackMode = GetControlAnswerMode (address, dataMode); |
1492 WifiTxVector v; | 1467 WifiTxVector v; |
1493 v.SetMode (ackMode); | 1468 v.SetMode (ackMode); |
1494 v.SetPreambleType (GetPreambleForTransmission (ackMode, address)); | 1469 v.SetPreambleType (GetPreambleForTransmission (ackMode, address)); |
1495 v.SetTxPowerLevel (DoGetAckTxPowerLevel (address, ackMode)); | 1470 v.SetTxPowerLevel (DoGetAckTxPowerLevel (address, ackMode)); |
1496 v.SetChannelWidth (DoGetAckTxChannelWidth (address, ackMode)); | 1471 v.SetChannelWidth (GetChannelWidthForTransmission (ackMode, DoGetAckTxChannelW
idth (address, ackMode))); |
1497 v.SetGuardInterval (DoGetAckTxGuardInterval (address, ackMode)); | 1472 v.SetGuardInterval (DoGetAckTxGuardInterval (address, ackMode)); |
1498 v.SetNss (DoGetAckTxNss (address, ackMode)); | 1473 v.SetNss (DoGetAckTxNss (address, ackMode)); |
1499 v.SetNess (DoGetAckTxNess (address, ackMode)); | 1474 v.SetNess (DoGetAckTxNess (address, ackMode)); |
1500 v.SetStbc (DoGetAckTxStbc (address, ackMode)); | 1475 v.SetStbc (m_wifiPhy->GetStbc ()); |
1501 return v; | 1476 return v; |
1502 } | 1477 } |
1503 | 1478 |
1504 WifiTxVector | 1479 WifiTxVector |
1505 WifiRemoteStationManager::GetBlockAckTxVector (Mac48Address address, WifiMode bl
ockAckReqMode) | 1480 WifiRemoteStationManager::GetBlockAckTxVector (Mac48Address address, WifiMode bl
ockAckReqMode) |
1506 { | 1481 { |
1507 NS_ASSERT (!address.IsGroup ()); | 1482 NS_ASSERT (!address.IsGroup ()); |
1508 WifiMode blockAckMode = GetControlAnswerMode (address, blockAckReqMode); | 1483 WifiMode blockAckMode = GetControlAnswerMode (address, blockAckReqMode); |
1509 WifiTxVector v; | 1484 WifiTxVector v; |
1510 v.SetMode (blockAckMode); | 1485 v.SetMode (blockAckMode); |
1511 v.SetPreambleType (GetPreambleForTransmission (blockAckMode, address)); | 1486 v.SetPreambleType (GetPreambleForTransmission (blockAckMode, address)); |
1512 v.SetTxPowerLevel (DoGetBlockAckTxPowerLevel (address, blockAckMode)); | 1487 v.SetTxPowerLevel (DoGetBlockAckTxPowerLevel (address, blockAckMode)); |
1513 v.SetChannelWidth (DoGetBlockAckTxChannelWidth (address, blockAckMode)); | 1488 v.SetChannelWidth (GetChannelWidthForTransmission (blockAckMode, DoGetBlockAck
TxChannelWidth (address, blockAckMode))); |
1514 v.SetGuardInterval (DoGetBlockAckTxGuardInterval (address, blockAckMode)); | 1489 v.SetGuardInterval (DoGetBlockAckTxGuardInterval (address, blockAckMode)); |
1515 v.SetNss (DoGetBlockAckTxNss (address, blockAckMode)); | 1490 v.SetNss (DoGetBlockAckTxNss (address, blockAckMode)); |
1516 v.SetNess (DoGetBlockAckTxNess (address, blockAckMode)); | 1491 v.SetNess (DoGetBlockAckTxNess (address, blockAckMode)); |
1517 v.SetStbc (DoGetBlockAckTxStbc (address, blockAckMode)); | 1492 v.SetStbc (m_wifiPhy->GetStbc ()); |
1518 return v; | 1493 return v; |
1519 } | 1494 } |
1520 | 1495 |
1521 uint8_t | 1496 uint8_t |
1522 WifiRemoteStationManager::DoGetCtsTxPowerLevel (Mac48Address address, WifiMode c
tsMode) | 1497 WifiRemoteStationManager::DoGetCtsTxPowerLevel (Mac48Address address, WifiMode c
tsMode) |
1523 { | 1498 { |
1524 NS_UNUSED(address); | |
1525 NS_UNUSED(ctsMode); | |
1526 return m_defaultTxPowerLevel; | 1499 return m_defaultTxPowerLevel; |
1527 } | 1500 } |
1528 | 1501 |
1529 uint8_t | 1502 uint16_t |
1530 WifiRemoteStationManager::DoGetCtsTxChannelWidth (Mac48Address address, WifiMode
ctsMode) | 1503 WifiRemoteStationManager::DoGetCtsTxChannelWidth (Mac48Address address, WifiMode
ctsMode) |
1531 { | 1504 { |
1532 NS_UNUSED(address); | |
1533 NS_UNUSED(ctsMode); | |
1534 return m_wifiPhy->GetChannelWidth (); | 1505 return m_wifiPhy->GetChannelWidth (); |
1535 } | 1506 } |
1536 | 1507 |
1537 uint16_t | 1508 uint16_t |
1538 WifiRemoteStationManager::DoGetCtsTxGuardInterval (Mac48Address address, WifiMod
e ctsMode) | 1509 WifiRemoteStationManager::DoGetCtsTxGuardInterval (Mac48Address address, WifiMod
e ctsMode) |
1539 { | 1510 { |
1540 NS_UNUSED(address); | |
1541 | |
1542 return ConvertGuardIntervalToNanoSeconds (ctsMode, m_wifiPhy->GetShortGuardInt
erval (), m_wifiPhy->GetGuardInterval ()); | 1511 return ConvertGuardIntervalToNanoSeconds (ctsMode, m_wifiPhy->GetShortGuardInt
erval (), m_wifiPhy->GetGuardInterval ()); |
1543 } | 1512 } |
1544 | 1513 |
1545 uint8_t | 1514 uint8_t |
1546 WifiRemoteStationManager::DoGetCtsTxNss (Mac48Address address, WifiMode ctsMode) | 1515 WifiRemoteStationManager::DoGetCtsTxNss (Mac48Address address, WifiMode ctsMode) |
1547 { | 1516 { |
1548 NS_UNUSED(address); | |
1549 NS_UNUSED(ctsMode); | |
1550 return 1; | 1517 return 1; |
1551 } | 1518 } |
1552 | 1519 |
1553 uint8_t | 1520 uint8_t |
1554 WifiRemoteStationManager::DoGetCtsTxNess (Mac48Address address, WifiMode ctsMode
) | 1521 WifiRemoteStationManager::DoGetCtsTxNess (Mac48Address address, WifiMode ctsMode
) |
1555 { | 1522 { |
1556 NS_UNUSED(address); | |
1557 NS_UNUSED(ctsMode); | |
1558 return 0; | 1523 return 0; |
1559 } | |
1560 | |
1561 bool | |
1562 WifiRemoteStationManager::DoGetCtsTxStbc (Mac48Address address, WifiMode ctsMode
) | |
1563 { | |
1564 NS_UNUSED(address); | |
1565 NS_UNUSED(ctsMode); | |
1566 return m_wifiPhy->GetStbc (); | |
1567 } | 1524 } |
1568 | 1525 |
1569 uint8_t | 1526 uint8_t |
1570 WifiRemoteStationManager::DoGetAckTxPowerLevel (Mac48Address address, WifiMode a
ckMode) | 1527 WifiRemoteStationManager::DoGetAckTxPowerLevel (Mac48Address address, WifiMode a
ckMode) |
1571 { | 1528 { |
1572 NS_UNUSED(address); | |
1573 NS_UNUSED(ackMode); | |
1574 return m_defaultTxPowerLevel; | 1529 return m_defaultTxPowerLevel; |
1575 } | 1530 } |
1576 | 1531 |
1577 uint8_t | 1532 uint16_t |
1578 WifiRemoteStationManager::DoGetAckTxChannelWidth (Mac48Address address, WifiMode
ctsMode) | 1533 WifiRemoteStationManager::DoGetAckTxChannelWidth (Mac48Address address, WifiMode
ctsMode) |
1579 { | 1534 { |
1580 NS_UNUSED(address); | |
1581 NS_UNUSED(ctsMode); | |
1582 return m_wifiPhy->GetChannelWidth (); | 1535 return m_wifiPhy->GetChannelWidth (); |
1583 } | 1536 } |
1584 | 1537 |
1585 uint16_t | 1538 uint16_t |
1586 WifiRemoteStationManager::DoGetAckTxGuardInterval (Mac48Address address, WifiMod
e ackMode) | 1539 WifiRemoteStationManager::DoGetAckTxGuardInterval (Mac48Address address, WifiMod
e ackMode) |
1587 { | 1540 { |
1588 NS_UNUSED(address); | |
1589 return ConvertGuardIntervalToNanoSeconds (ackMode, m_wifiPhy->GetShortGuardInt
erval (), m_wifiPhy->GetGuardInterval ()); | 1541 return ConvertGuardIntervalToNanoSeconds (ackMode, m_wifiPhy->GetShortGuardInt
erval (), m_wifiPhy->GetGuardInterval ()); |
1590 } | 1542 } |
1591 | 1543 |
1592 uint8_t | 1544 uint8_t |
1593 WifiRemoteStationManager::DoGetAckTxNss (Mac48Address address, WifiMode ackMode) | 1545 WifiRemoteStationManager::DoGetAckTxNss (Mac48Address address, WifiMode ackMode) |
1594 { | 1546 { |
1595 NS_UNUSED(address); | |
1596 NS_UNUSED(ackMode); | |
1597 return 1; | 1547 return 1; |
1598 } | 1548 } |
1599 | 1549 |
1600 uint8_t | 1550 uint8_t |
1601 WifiRemoteStationManager::DoGetAckTxNess (Mac48Address address, WifiMode ackMode
) | 1551 WifiRemoteStationManager::DoGetAckTxNess (Mac48Address address, WifiMode ackMode
) |
1602 { | 1552 { |
1603 NS_UNUSED(address); | |
1604 NS_UNUSED(ackMode); | |
1605 return 0; | 1553 return 0; |
1606 } | |
1607 | |
1608 bool | |
1609 WifiRemoteStationManager::DoGetAckTxStbc (Mac48Address address, WifiMode ackMode
) | |
1610 { | |
1611 NS_UNUSED(address); | |
1612 NS_UNUSED(ackMode); | |
1613 return m_wifiPhy->GetStbc (); | |
1614 } | 1554 } |
1615 | 1555 |
1616 uint8_t | 1556 uint8_t |
1617 WifiRemoteStationManager::DoGetBlockAckTxPowerLevel (Mac48Address address, WifiM
ode blockAckMode) | 1557 WifiRemoteStationManager::DoGetBlockAckTxPowerLevel (Mac48Address address, WifiM
ode blockAckMode) |
1618 { | 1558 { |
1619 NS_UNUSED(address); | |
1620 NS_UNUSED(blockAckMode); | |
1621 return m_defaultTxPowerLevel; | 1559 return m_defaultTxPowerLevel; |
1622 } | 1560 } |
1623 | 1561 |
1624 uint8_t | 1562 uint16_t |
1625 WifiRemoteStationManager::DoGetBlockAckTxChannelWidth (Mac48Address address, Wif
iMode ctsMode) | 1563 WifiRemoteStationManager::DoGetBlockAckTxChannelWidth (Mac48Address address, Wif
iMode ctsMode) |
1626 { | 1564 { |
1627 NS_UNUSED(address); | |
1628 NS_UNUSED(ctsMode); | |
1629 return m_wifiPhy->GetChannelWidth (); | 1565 return m_wifiPhy->GetChannelWidth (); |
1630 } | 1566 } |
1631 | 1567 |
1632 uint16_t | 1568 uint16_t |
1633 WifiRemoteStationManager::DoGetBlockAckTxGuardInterval (Mac48Address address, Wi
fiMode blockAckMode) | 1569 WifiRemoteStationManager::DoGetBlockAckTxGuardInterval (Mac48Address address, Wi
fiMode blockAckMode) |
1634 { | 1570 { |
1635 NS_UNUSED(address); | |
1636 return ConvertGuardIntervalToNanoSeconds (blockAckMode, m_wifiPhy->GetShortGua
rdInterval (), m_wifiPhy->GetGuardInterval ()); | 1571 return ConvertGuardIntervalToNanoSeconds (blockAckMode, m_wifiPhy->GetShortGua
rdInterval (), m_wifiPhy->GetGuardInterval ()); |
1637 } | 1572 } |
1638 | 1573 |
1639 uint8_t | 1574 uint8_t |
1640 WifiRemoteStationManager::DoGetBlockAckTxNss (Mac48Address address, WifiMode blo
ckAckMode) | 1575 WifiRemoteStationManager::DoGetBlockAckTxNss (Mac48Address address, WifiMode blo
ckAckMode) |
1641 { | 1576 { |
1642 NS_UNUSED(address); | |
1643 NS_UNUSED(blockAckMode); | |
1644 return 1; | 1577 return 1; |
1645 } | 1578 } |
1646 | 1579 |
1647 uint8_t | 1580 uint8_t |
1648 WifiRemoteStationManager::DoGetBlockAckTxNess (Mac48Address address, WifiMode bl
ockAckMode) | 1581 WifiRemoteStationManager::DoGetBlockAckTxNess (Mac48Address address, WifiMode bl
ockAckMode) |
1649 { | 1582 { |
1650 NS_UNUSED(address); | |
1651 NS_UNUSED(blockAckMode); | |
1652 return 0; | 1583 return 0; |
1653 } | |
1654 | |
1655 bool | |
1656 WifiRemoteStationManager::DoGetBlockAckTxStbc (Mac48Address address, WifiMode bl
ockAckMode) | |
1657 { | |
1658 NS_UNUSED(address); | |
1659 NS_UNUSED(blockAckMode); | |
1660 return m_wifiPhy->GetStbc (); | |
1661 } | 1584 } |
1662 | 1585 |
1663 uint8_t | 1586 uint8_t |
1664 WifiRemoteStationManager::GetDefaultTxPowerLevel (void) const | 1587 WifiRemoteStationManager::GetDefaultTxPowerLevel (void) const |
1665 { | 1588 { |
1666 return m_defaultTxPowerLevel; | 1589 return m_defaultTxPowerLevel; |
1667 } | 1590 } |
1668 | 1591 |
1669 WifiRemoteStationInfo | 1592 WifiRemoteStationInfo |
1670 WifiRemoteStationManager::GetInfo (Mac48Address address) | 1593 WifiRemoteStationManager::GetInfo (Mac48Address address) |
(...skipping 14 matching lines...) Expand all Loading... |
1685 return (*i); | 1608 return (*i); |
1686 } | 1609 } |
1687 } | 1610 } |
1688 WifiRemoteStationState *state = new WifiRemoteStationState (); | 1611 WifiRemoteStationState *state = new WifiRemoteStationState (); |
1689 state->m_state = WifiRemoteStationState::BRAND_NEW; | 1612 state->m_state = WifiRemoteStationState::BRAND_NEW; |
1690 state->m_address = address; | 1613 state->m_address = address; |
1691 state->m_operationalRateSet.push_back (GetDefaultMode ()); | 1614 state->m_operationalRateSet.push_back (GetDefaultMode ()); |
1692 state->m_operationalMcsSet.push_back (GetDefaultMcs ()); | 1615 state->m_operationalMcsSet.push_back (GetDefaultMcs ()); |
1693 state->m_channelWidth = m_wifiPhy->GetChannelWidth (); | 1616 state->m_channelWidth = m_wifiPhy->GetChannelWidth (); |
1694 state->m_shortGuardInterval = m_wifiPhy->GetShortGuardInterval (); | 1617 state->m_shortGuardInterval = m_wifiPhy->GetShortGuardInterval (); |
1695 state->m_guardInterval = (uint16_t)m_wifiPhy->GetGuardInterval ().GetNanoSecon
ds (); | 1618 state->m_guardInterval = static_cast<uint16_t> (m_wifiPhy->GetGuardInterval ()
.GetNanoSeconds ()); |
1696 state->m_greenfield = m_wifiPhy->GetGreenfield (); | 1619 state->m_greenfield = m_wifiPhy->GetGreenfield (); |
1697 state->m_streams = 1; | 1620 state->m_streams = 1; |
1698 state->m_ness = 0; | 1621 state->m_ness = 0; |
1699 state->m_aggregation = false; | 1622 state->m_aggregation = false; |
1700 state->m_stbc = false; | 1623 state->m_stbc = false; |
| 1624 state->m_ldpc = false; |
1701 state->m_qosSupported = false; | 1625 state->m_qosSupported = false; |
1702 state->m_htSupported = false; | 1626 state->m_htSupported = false; |
1703 state->m_vhtSupported = false; | 1627 state->m_vhtSupported = false; |
1704 state->m_heSupported = false; | 1628 state->m_heSupported = false; |
1705 const_cast<WifiRemoteStationManager *> (this)->m_states.push_back (state); | 1629 const_cast<WifiRemoteStationManager *> (this)->m_states.push_back (state); |
1706 NS_LOG_DEBUG ("WifiRemoteStationManager::LookupState returning new state"); | 1630 NS_LOG_DEBUG ("WifiRemoteStationManager::LookupState returning new state"); |
1707 return state; | 1631 return state; |
1708 } | 1632 } |
1709 | 1633 |
1710 WifiRemoteStation * | 1634 WifiRemoteStation * |
1711 WifiRemoteStationManager::Lookup (Mac48Address address, const WifiMacHeader *hea
der) const | 1635 WifiRemoteStationManager::Lookup (Mac48Address address, const WifiMacHeader *hea
der) const |
1712 { | 1636 { |
1713 uint8_t tid; | 1637 uint8_t tid; |
1714 if (header->IsQosData ()) | 1638 if (header->IsQosData ()) |
1715 { | 1639 { |
1716 tid = header->GetQosTid (); | 1640 tid = header->GetQosTid (); |
1717 } | 1641 } |
1718 else | 1642 else |
1719 { | 1643 { |
1720 tid = 0; | 1644 tid = 0; |
1721 } | 1645 } |
1722 return Lookup (address, tid); | 1646 return Lookup (address, tid); |
1723 } | 1647 } |
1724 | 1648 |
1725 WifiRemoteStation * | 1649 WifiRemoteStation * |
1726 WifiRemoteStationManager::Lookup (Mac48Address address, uint8_t tid) const | 1650 WifiRemoteStationManager::Lookup (Mac48Address address, uint8_t tid) const |
1727 { | 1651 { |
1728 NS_LOG_FUNCTION (this << address << (uint16_t)tid); | 1652 NS_LOG_FUNCTION (this << address << +tid); |
1729 for (Stations::const_iterator i = m_stations.begin (); i != m_stations.end ();
i++) | 1653 for (Stations::const_iterator i = m_stations.begin (); i != m_stations.end ();
i++) |
1730 { | 1654 { |
1731 if ((*i)->m_tid == tid | 1655 if ((*i)->m_tid == tid |
1732 && (*i)->m_state->m_address == address) | 1656 && (*i)->m_state->m_address == address) |
1733 { | 1657 { |
1734 return (*i); | 1658 return (*i); |
1735 } | 1659 } |
1736 } | 1660 } |
1737 WifiRemoteStationState *state = LookupState (address); | 1661 WifiRemoteStationState *state = LookupState (address); |
1738 | 1662 |
(...skipping 24 matching lines...) Expand all Loading... |
1763 state = LookupState (from); | 1687 state = LookupState (from); |
1764 state->m_shortGuardInterval = htCapabilities.GetShortGuardInterval20 (); | 1688 state->m_shortGuardInterval = htCapabilities.GetShortGuardInterval20 (); |
1765 if (htCapabilities.GetSupportedChannelWidth () == 1) | 1689 if (htCapabilities.GetSupportedChannelWidth () == 1) |
1766 { | 1690 { |
1767 state->m_channelWidth = 40; | 1691 state->m_channelWidth = 40; |
1768 } | 1692 } |
1769 else | 1693 else |
1770 { | 1694 { |
1771 state->m_channelWidth = 20; | 1695 state->m_channelWidth = 20; |
1772 } | 1696 } |
1773 state->m_htSupported = true; | |
1774 SetQosSupport (from, true); | 1697 SetQosSupport (from, true); |
1775 state->m_greenfield = htCapabilities.GetGreenfield (); | 1698 state->m_greenfield = htCapabilities.GetGreenfield (); |
1776 state->m_streams = htCapabilities.GetRxHighestSupportedAntennas (); | 1699 state->m_streams = htCapabilities.GetRxHighestSupportedAntennas (); |
| 1700 for (uint8_t j = 0; j < m_wifiPhy->GetNMcs (); j++) |
| 1701 { |
| 1702 WifiMode mcs = m_wifiPhy->GetMcs (j); |
| 1703 if (mcs.GetModulationClass () == WIFI_MOD_CLASS_HT && htCapabilities.IsSup
portedMcs (mcs.GetMcsValue ())) |
| 1704 { |
| 1705 AddSupportedMcs (from, mcs); |
| 1706 } |
| 1707 } |
| 1708 state->m_htSupported = true; |
1777 } | 1709 } |
1778 | 1710 |
1779 void | 1711 void |
1780 WifiRemoteStationManager::AddStationVhtCapabilities (Mac48Address from, VhtCapab
ilities vhtCapabilities) | 1712 WifiRemoteStationManager::AddStationVhtCapabilities (Mac48Address from, VhtCapab
ilities vhtCapabilities) |
1781 { | 1713 { |
1782 //Used by all stations to record VHT capabilities of remote stations | 1714 //Used by all stations to record VHT capabilities of remote stations |
1783 NS_LOG_FUNCTION (this << from << vhtCapabilities); | 1715 NS_LOG_FUNCTION (this << from << vhtCapabilities); |
1784 WifiRemoteStationState *state; | 1716 WifiRemoteStationState *state; |
1785 state = LookupState (from); | 1717 state = LookupState (from); |
1786 if (vhtCapabilities.GetSupportedChannelWidthSet () == 1) | 1718 if (vhtCapabilities.GetSupportedChannelWidthSet () == 1) |
1787 { | 1719 { |
1788 state->m_channelWidth = 160; | 1720 state->m_channelWidth = 160; |
1789 } | 1721 } |
1790 else | 1722 else |
1791 { | 1723 { |
1792 state->m_channelWidth = 80; | 1724 state->m_channelWidth = 80; |
1793 } | 1725 } |
1794 //This is a workaround to enable users to force a 20 or 40 MHz channel for a V
HT-compliant device, | 1726 //This is a workaround to enable users to force a 20 or 40 MHz channel for a V
HT-compliant device, |
1795 //since IEEE 802.11ac standard says that 20, 40 and 80 MHz channels are mandat
ory. | 1727 //since IEEE 802.11ac standard says that 20, 40 and 80 MHz channels are mandat
ory. |
1796 if (m_wifiPhy->GetChannelWidth () < state->m_channelWidth) | 1728 if (m_wifiPhy->GetChannelWidth () < state->m_channelWidth) |
1797 { | 1729 { |
1798 state->m_channelWidth = m_wifiPhy->GetChannelWidth (); | 1730 state->m_channelWidth = m_wifiPhy->GetChannelWidth (); |
1799 } | 1731 } |
| 1732 state->m_ldpc = (vhtCapabilities.GetRxLdpc () != 0); |
| 1733 state->m_stbc = (vhtCapabilities.GetTxStbc () != 0 || vhtCapabilities.GetRxStb
c () != 0); |
| 1734 for (uint8_t i = 1; i <= m_wifiPhy->GetMaxSupportedTxSpatialStreams (); i++) |
| 1735 { |
| 1736 for (uint8_t j = 0; j < m_wifiPhy->GetNMcs (); j++) |
| 1737 { |
| 1738 WifiMode mcs = m_wifiPhy->GetMcs (j); |
| 1739 if (mcs.GetModulationClass () == WIFI_MOD_CLASS_VHT && vhtCapabilities
.IsSupportedMcs (mcs.GetMcsValue (), i)) |
| 1740 { |
| 1741 AddSupportedMcs (from, mcs); |
| 1742 } |
| 1743 } |
| 1744 } |
1800 state->m_vhtSupported = true; | 1745 state->m_vhtSupported = true; |
1801 } | 1746 } |
1802 | 1747 |
1803 void | 1748 void |
1804 WifiRemoteStationManager::AddStationHeCapabilities (Mac48Address from, HeCapabil
ities heCapabilities) | 1749 WifiRemoteStationManager::AddStationHeCapabilities (Mac48Address from, HeCapabil
ities heCapabilities) |
1805 { | 1750 { |
1806 //Used by all stations to record HE capabilities of remote stations | 1751 //Used by all stations to record HE capabilities of remote stations |
1807 NS_LOG_FUNCTION (this << from << heCapabilities); | 1752 NS_LOG_FUNCTION (this << from << heCapabilities); |
1808 WifiRemoteStationState *state; | 1753 WifiRemoteStationState *state; |
1809 state = LookupState (from); | 1754 state = LookupState (from); |
| 1755 if (Is5Ghz (m_wifiPhy->GetFrequency ())) |
| 1756 { |
| 1757 if (heCapabilities.GetChannelWidthSet () & 0x04) |
| 1758 { |
| 1759 state->m_channelWidth = 160; |
| 1760 } |
| 1761 else if (heCapabilities.GetChannelWidthSet () & 0x02) |
| 1762 { |
| 1763 state->m_channelWidth = 80; |
| 1764 } |
| 1765 //For other cases at 5 GHz, the supported channel width is set by the VHT
capabilities |
| 1766 } |
| 1767 else if (Is2_4Ghz (m_wifiPhy->GetFrequency ())) |
| 1768 { |
| 1769 if (heCapabilities.GetChannelWidthSet () & 0x01) |
| 1770 { |
| 1771 state->m_channelWidth = 40; |
| 1772 } |
| 1773 else |
| 1774 { |
| 1775 state->m_channelWidth = 20; |
| 1776 } |
| 1777 } |
1810 if (heCapabilities.GetHeLtfAndGiForHePpdus () >= 2) | 1778 if (heCapabilities.GetHeLtfAndGiForHePpdus () >= 2) |
1811 { | 1779 { |
1812 state->m_guardInterval = 800; | 1780 state->m_guardInterval = 800; |
1813 } | 1781 } |
1814 else if (heCapabilities.GetHeLtfAndGiForHePpdus () == 1) | 1782 else if (heCapabilities.GetHeLtfAndGiForHePpdus () == 1) |
1815 { | 1783 { |
1816 state->m_guardInterval = 1600; | 1784 state->m_guardInterval = 1600; |
1817 } | 1785 } |
1818 else | 1786 else |
1819 { | 1787 { |
1820 state->m_guardInterval = 3200; | 1788 state->m_guardInterval = 3200; |
| 1789 } |
| 1790 for (uint8_t i = 1; i <= m_wifiPhy->GetMaxSupportedTxSpatialStreams (); i++) |
| 1791 { |
| 1792 for (uint8_t j = 0; j < m_wifiPhy->GetNMcs (); j++) |
| 1793 { |
| 1794 WifiMode mcs = m_wifiPhy->GetMcs (j); |
| 1795 if (mcs.GetModulationClass () == WIFI_MOD_CLASS_HE |
| 1796 && heCapabilities.GetHighestNssSupported () >= i |
| 1797 && heCapabilities.GetHighestMcsSupported () >= j) |
| 1798 { |
| 1799 AddSupportedMcs (from, mcs); |
| 1800 } |
| 1801 } |
1821 } | 1802 } |
1822 state->m_heSupported = true; | 1803 state->m_heSupported = true; |
1823 SetQosSupport (from, true); | 1804 SetQosSupport (from, true); |
1824 } | 1805 } |
1825 | 1806 |
1826 bool | 1807 bool |
1827 WifiRemoteStationManager::GetGreenfieldSupported (Mac48Address address) const | 1808 WifiRemoteStationManager::GetGreenfieldSupported (Mac48Address address) const |
1828 { | 1809 { |
1829 return LookupState (address)->m_greenfield; | 1810 return LookupState (address)->m_greenfield; |
1830 } | 1811 } |
1831 | 1812 |
1832 WifiMode | 1813 WifiMode |
1833 WifiRemoteStationManager::GetDefaultMode (void) const | 1814 WifiRemoteStationManager::GetDefaultMode (void) const |
1834 { | 1815 { |
1835 return m_defaultTxMode; | 1816 return m_defaultTxMode; |
1836 } | 1817 } |
1837 | 1818 |
1838 WifiMode | 1819 WifiMode |
1839 WifiRemoteStationManager::GetDefaultMcs (void) const | 1820 WifiRemoteStationManager::GetDefaultMcs (void) const |
1840 { | 1821 { |
1841 return m_defaultTxMcs; | 1822 return m_defaultTxMcs; |
1842 } | 1823 } |
1843 | 1824 |
1844 void | 1825 void |
1845 WifiRemoteStationManager::Reset (void) | 1826 WifiRemoteStationManager::Reset (void) |
1846 { | 1827 { |
1847 NS_LOG_FUNCTION (this); | 1828 NS_LOG_FUNCTION (this); |
| 1829 for (StationStates::const_iterator i = m_states.begin (); i != m_states.end ()
; i++) |
| 1830 { |
| 1831 delete (*i); |
| 1832 } |
| 1833 m_states.clear (); |
1848 for (Stations::const_iterator i = m_stations.begin (); i != m_stations.end ();
i++) | 1834 for (Stations::const_iterator i = m_stations.begin (); i != m_stations.end ();
i++) |
1849 { | 1835 { |
1850 delete (*i); | 1836 delete (*i); |
1851 } | 1837 } |
1852 m_stations.clear (); | 1838 m_stations.clear (); |
1853 m_bssBasicRateSet.clear (); | 1839 m_bssBasicRateSet.clear (); |
1854 m_bssBasicRateSet.push_back (m_defaultTxMode); | |
1855 m_bssBasicMcsSet.clear (); | 1840 m_bssBasicMcsSet.clear (); |
1856 m_bssBasicMcsSet.push_back (m_defaultTxMcs); | |
1857 NS_ASSERT (m_defaultTxMode.IsMandatory ()); | |
1858 } | 1841 } |
1859 | 1842 |
1860 void | 1843 void |
1861 WifiRemoteStationManager::AddBasicMode (WifiMode mode) | 1844 WifiRemoteStationManager::AddBasicMode (WifiMode mode) |
1862 { | 1845 { |
1863 NS_LOG_FUNCTION (this << mode); | 1846 NS_LOG_FUNCTION (this << mode); |
1864 if (mode.GetModulationClass () == WIFI_MOD_CLASS_HT || mode.GetModulationClass
() == WIFI_MOD_CLASS_VHT || mode.GetModulationClass () == WIFI_MOD_CLASS_HE) | 1847 if (mode.GetModulationClass () == WIFI_MOD_CLASS_HT || mode.GetModulationClass
() == WIFI_MOD_CLASS_VHT || mode.GetModulationClass () == WIFI_MOD_CLASS_HE) |
1865 { | 1848 { |
1866 NS_FATAL_ERROR ("It is not allowed to add a (V)HT rate in the BSSBasicRate
Set!"); | 1849 NS_FATAL_ERROR ("It is not allowed to add a (V)HT rate in the BSSBasicRate
Set!"); |
1867 } | 1850 } |
1868 for (uint32_t i = 0; i < GetNBasicModes (); i++) | 1851 for (uint8_t i = 0; i < GetNBasicModes (); i++) |
1869 { | 1852 { |
1870 if (GetBasicMode (i) == mode) | 1853 if (GetBasicMode (i) == mode) |
1871 { | 1854 { |
1872 return; | 1855 return; |
1873 } | 1856 } |
1874 } | 1857 } |
1875 m_bssBasicRateSet.push_back (mode); | 1858 m_bssBasicRateSet.push_back (mode); |
1876 } | 1859 } |
1877 | 1860 |
1878 uint32_t | 1861 uint8_t |
1879 WifiRemoteStationManager::GetNBasicModes (void) const | 1862 WifiRemoteStationManager::GetNBasicModes (void) const |
1880 { | 1863 { |
1881 return m_bssBasicRateSet.size (); | 1864 return static_cast<uint8_t> (m_bssBasicRateSet.size ()); |
1882 } | 1865 } |
1883 | 1866 |
1884 WifiMode | 1867 WifiMode |
1885 WifiRemoteStationManager::GetBasicMode (uint32_t i) const | 1868 WifiRemoteStationManager::GetBasicMode (uint8_t i) const |
1886 { | 1869 { |
1887 NS_ASSERT (i < GetNBasicModes ()); | 1870 NS_ASSERT (i < GetNBasicModes ()); |
1888 return m_bssBasicRateSet[i]; | 1871 return m_bssBasicRateSet[i]; |
1889 } | 1872 } |
1890 | 1873 |
1891 uint32_t | 1874 uint32_t |
1892 WifiRemoteStationManager::GetNNonErpBasicModes (void) const | 1875 WifiRemoteStationManager::GetNNonErpBasicModes (void) const |
1893 { | 1876 { |
1894 uint32_t size = 0; | 1877 uint32_t size = 0; |
1895 for (WifiModeListIterator i = m_bssBasicRateSet.begin (); i != m_bssBasicRateS
et.end (); i++) | 1878 for (WifiModeListIterator i = m_bssBasicRateSet.begin (); i != m_bssBasicRateS
et.end (); i++) |
1896 { | 1879 { |
1897 if (i->GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM) | 1880 if (i->GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM) |
1898 { | 1881 { |
1899 continue; | 1882 continue; |
1900 } | 1883 } |
1901 size++; | 1884 size++; |
1902 } | 1885 } |
1903 return size; | 1886 return size; |
1904 } | 1887 } |
1905 | 1888 |
1906 WifiMode | 1889 WifiMode |
1907 WifiRemoteStationManager::GetNonErpBasicMode (uint32_t i) const | 1890 WifiRemoteStationManager::GetNonErpBasicMode (uint8_t i) const |
1908 { | 1891 { |
1909 NS_ASSERT (i < GetNNonErpBasicModes ()); | 1892 NS_ASSERT (i < GetNNonErpBasicModes ()); |
1910 uint32_t index = 0; | 1893 uint32_t index = 0; |
1911 bool found = false; | 1894 bool found = false; |
1912 for (WifiModeListIterator j = m_bssBasicRateSet.begin (); j != m_bssBasicRateS
et.end (); ) | 1895 for (WifiModeListIterator j = m_bssBasicRateSet.begin (); j != m_bssBasicRateS
et.end (); ) |
1913 { | 1896 { |
1914 if (i == index) | 1897 if (i == index) |
1915 { | 1898 { |
1916 found = true; | 1899 found = true; |
1917 } | 1900 } |
1918 if (j->GetModulationClass () != WIFI_MOD_CLASS_ERP_OFDM) | 1901 if (j->GetModulationClass () != WIFI_MOD_CLASS_ERP_OFDM) |
1919 { | 1902 { |
1920 if (found) | 1903 if (found) |
1921 { | 1904 { |
1922 break; | 1905 break; |
1923 } | 1906 } |
1924 } | 1907 } |
1925 index++; | 1908 index++; |
1926 j++; | 1909 j++; |
1927 } | 1910 } |
1928 return m_bssBasicRateSet[index]; | 1911 return m_bssBasicRateSet[index]; |
1929 } | 1912 } |
1930 | 1913 |
1931 void | 1914 void |
1932 WifiRemoteStationManager::AddBasicMcs (WifiMode mcs) | 1915 WifiRemoteStationManager::AddBasicMcs (WifiMode mcs) |
1933 { | 1916 { |
1934 NS_LOG_FUNCTION (this << (uint16_t)mcs.GetMcsValue ()); | 1917 NS_LOG_FUNCTION (this << +mcs.GetMcsValue ()); |
1935 for (uint32_t i = 0; i < GetNBasicMcs (); i++) | 1918 for (uint8_t i = 0; i < GetNBasicMcs (); i++) |
1936 { | 1919 { |
1937 if (GetBasicMcs (i) == mcs) | 1920 if (GetBasicMcs (i) == mcs) |
1938 { | 1921 { |
1939 return; | 1922 return; |
1940 } | 1923 } |
1941 } | 1924 } |
1942 m_bssBasicMcsSet.push_back (mcs); | 1925 m_bssBasicMcsSet.push_back (mcs); |
1943 } | 1926 } |
1944 | 1927 |
1945 uint32_t | 1928 uint8_t |
1946 WifiRemoteStationManager::GetNBasicMcs (void) const | 1929 WifiRemoteStationManager::GetNBasicMcs (void) const |
1947 { | 1930 { |
1948 return m_bssBasicMcsSet.size (); | 1931 return static_cast<uint8_t> (m_bssBasicMcsSet.size ()); |
1949 } | 1932 } |
1950 | 1933 |
1951 WifiMode | 1934 WifiMode |
1952 WifiRemoteStationManager::GetBasicMcs (uint32_t i) const | 1935 WifiRemoteStationManager::GetBasicMcs (uint8_t i) const |
1953 { | 1936 { |
1954 NS_ASSERT (i < GetNBasicMcs ()); | 1937 NS_ASSERT (i < GetNBasicMcs ()); |
1955 return m_bssBasicMcsSet[i]; | 1938 return m_bssBasicMcsSet[i]; |
1956 } | 1939 } |
1957 | 1940 |
1958 WifiMode | 1941 WifiMode |
1959 WifiRemoteStationManager::GetNonUnicastMode (void) const | 1942 WifiRemoteStationManager::GetNonUnicastMode (void) const |
1960 { | 1943 { |
1961 if (m_nonUnicastMode == WifiMode ()) | 1944 if (m_nonUnicastMode == WifiMode ()) |
1962 { | 1945 { |
1963 return GetBasicMode (0); | 1946 if (GetNBasicModes () > 0) |
| 1947 { |
| 1948 return GetBasicMode (0); |
| 1949 } |
| 1950 else |
| 1951 { |
| 1952 return GetDefaultMode (); |
| 1953 } |
1964 } | 1954 } |
1965 else | 1955 else |
1966 { | 1956 { |
1967 return m_nonUnicastMode; | 1957 return m_nonUnicastMode; |
1968 } | 1958 } |
1969 } | 1959 } |
1970 | 1960 |
1971 bool | 1961 bool |
1972 WifiRemoteStationManager::DoNeedRts (WifiRemoteStation *station, | 1962 WifiRemoteStationManager::DoNeedRts (WifiRemoteStation *station, |
1973 Ptr<const Packet> packet, bool normally) | 1963 Ptr<const Packet> packet, bool normally) |
1974 { | 1964 { |
1975 NS_UNUSED(station); | |
1976 return normally; | 1965 return normally; |
1977 } | 1966 } |
1978 | 1967 |
1979 bool | 1968 bool |
1980 WifiRemoteStationManager::DoNeedRtsRetransmission (WifiRemoteStation *station, | 1969 WifiRemoteStationManager::DoNeedRtsRetransmission (WifiRemoteStation *station, |
1981 Ptr<const Packet> packet, boo
l normally) | 1970 Ptr<const Packet> packet, boo
l normally) |
1982 { | 1971 { |
1983 NS_UNUSED(station); | |
1984 return normally; | 1972 return normally; |
1985 } | 1973 } |
1986 | 1974 |
1987 bool | 1975 bool |
1988 WifiRemoteStationManager::DoNeedDataRetransmission (WifiRemoteStation *station, | 1976 WifiRemoteStationManager::DoNeedDataRetransmission (WifiRemoteStation *station, |
1989 Ptr<const Packet> packet, bo
ol normally) | 1977 Ptr<const Packet> packet, bo
ol normally) |
1990 { | 1978 { |
1991 NS_UNUSED(station); | |
1992 return normally; | 1979 return normally; |
1993 } | 1980 } |
1994 | 1981 |
1995 bool | 1982 bool |
1996 WifiRemoteStationManager::DoNeedFragmentation (WifiRemoteStation *station, | 1983 WifiRemoteStationManager::DoNeedFragmentation (WifiRemoteStation *station, |
1997 Ptr<const Packet> packet, bool no
rmally) | 1984 Ptr<const Packet> packet, bool no
rmally) |
1998 { | 1985 { |
1999 NS_UNUSED(station); | |
2000 return normally; | 1986 return normally; |
2001 } | 1987 } |
2002 | 1988 |
2003 void | 1989 void |
2004 WifiRemoteStationManager::DoReportAmpduTxStatus (WifiRemoteStation *station, uin
t8_t nSuccessfulMpdus, uint8_t nFailedMpdus, double rxSnr, double dataSnr) | 1990 WifiRemoteStationManager::DoReportAmpduTxStatus (WifiRemoteStation *station, uin
t8_t nSuccessfulMpdus, uint8_t nFailedMpdus, double rxSnr, double dataSnr) |
2005 { | 1991 { |
2006 NS_UNUSED(station); | |
2007 NS_UNUSED(nSuccessfulMpdus); | |
2008 NS_UNUSED(nFailedMpdus); | |
2009 NS_UNUSED(rxSnr); | |
2010 NS_UNUSED(dataSnr); | |
2011 NS_LOG_DEBUG ("DoReportAmpduTxStatus received but the manager does not handle
A-MPDUs!"); | 1992 NS_LOG_DEBUG ("DoReportAmpduTxStatus received but the manager does not handle
A-MPDUs!"); |
2012 } | 1993 } |
2013 | 1994 |
2014 WifiMode | 1995 WifiMode |
2015 WifiRemoteStationManager::GetSupported (const WifiRemoteStation *station, uint32
_t i) const | 1996 WifiRemoteStationManager::GetSupported (const WifiRemoteStation *station, uint8_
t i) const |
2016 { | 1997 { |
2017 NS_ASSERT (i < GetNSupported (station)); | 1998 NS_ASSERT (i < GetNSupported (station)); |
2018 return station->m_state->m_operationalRateSet[i]; | 1999 return station->m_state->m_operationalRateSet[i]; |
2019 } | 2000 } |
2020 | 2001 |
2021 WifiMode | 2002 WifiMode |
2022 WifiRemoteStationManager::GetMcsSupported (const WifiRemoteStation *station, uin
t32_t i) const | 2003 WifiRemoteStationManager::GetMcsSupported (const WifiRemoteStation *station, uin
t8_t i) const |
2023 { | 2004 { |
2024 NS_ASSERT (i < GetNMcsSupported (station)); | 2005 NS_ASSERT (i < GetNMcsSupported (station)); |
2025 return station->m_state->m_operationalMcsSet[i]; | 2006 return station->m_state->m_operationalMcsSet[i]; |
2026 } | 2007 } |
2027 | 2008 |
2028 WifiMode | 2009 WifiMode |
2029 WifiRemoteStationManager::GetNonErpSupported (const WifiRemoteStation *station,
uint32_t i) const | 2010 WifiRemoteStationManager::GetNonErpSupported (const WifiRemoteStation *station,
uint8_t i) const |
2030 { | 2011 { |
2031 NS_ASSERT (i < GetNNonErpSupported (station)); | 2012 NS_ASSERT (i < GetNNonErpSupported (station)); |
2032 //IEEE 802.11g standard defines that if the protection mechanism is enabled, R
ts, Cts and Cts-To-Self | 2013 //IEEE 802.11g standard defines that if the protection mechanism is enabled, R
ts, Cts and Cts-To-Self |
2033 //frames should select a rate in the BSSBasicRateSet that corresponds to an 80
2.11b basic rate. | 2014 //frames should select a rate in the BSSBasicRateSet that corresponds to an 80
2.11b basic rate. |
2034 //This is a implemented here to avoid changes in every RAA, but should maybe b
e moved in case it breaks standard rules. | 2015 //This is a implemented here to avoid changes in every RAA, but should maybe b
e moved in case it breaks standard rules. |
2035 uint32_t index = 0; | 2016 uint32_t index = 0; |
2036 bool found = false; | 2017 bool found = false; |
2037 for (WifiModeListIterator j = station->m_state->m_operationalRateSet.begin ();
j != station->m_state->m_operationalRateSet.end (); ) | 2018 for (WifiModeListIterator j = station->m_state->m_operationalRateSet.begin ();
j != station->m_state->m_operationalRateSet.end (); ) |
2038 { | 2019 { |
2039 if (i == index) | 2020 if (i == index) |
(...skipping 12 matching lines...) Expand all Loading... |
2052 } | 2033 } |
2053 return station->m_state->m_operationalRateSet[index]; | 2034 return station->m_state->m_operationalRateSet[index]; |
2054 } | 2035 } |
2055 | 2036 |
2056 Mac48Address | 2037 Mac48Address |
2057 WifiRemoteStationManager::GetAddress (const WifiRemoteStation *station) const | 2038 WifiRemoteStationManager::GetAddress (const WifiRemoteStation *station) const |
2058 { | 2039 { |
2059 return station->m_state->m_address; | 2040 return station->m_state->m_address; |
2060 } | 2041 } |
2061 | 2042 |
2062 uint8_t | 2043 uint16_t |
2063 WifiRemoteStationManager::GetChannelWidth (const WifiRemoteStation *station) con
st | 2044 WifiRemoteStationManager::GetChannelWidth (const WifiRemoteStation *station) con
st |
2064 { | 2045 { |
2065 return station->m_state->m_channelWidth; | 2046 return station->m_state->m_channelWidth; |
2066 } | 2047 } |
2067 | 2048 |
2068 bool | 2049 bool |
2069 WifiRemoteStationManager::GetShortGuardInterval (const WifiRemoteStation *statio
n) const | 2050 WifiRemoteStationManager::GetShortGuardInterval (const WifiRemoteStation *statio
n) const |
2070 { | 2051 { |
2071 return station->m_state->m_shortGuardInterval; | 2052 return station->m_state->m_shortGuardInterval; |
2072 } | 2053 } |
2073 | 2054 |
2074 uint16_t | 2055 uint16_t |
2075 WifiRemoteStationManager::GetGuardInterval (const WifiRemoteStation *station) co
nst | 2056 WifiRemoteStationManager::GetGuardInterval (const WifiRemoteStation *station) co
nst |
2076 { | 2057 { |
2077 return station->m_state->m_guardInterval; | 2058 return station->m_state->m_guardInterval; |
2078 } | 2059 } |
2079 | 2060 |
2080 bool | 2061 bool |
2081 WifiRemoteStationManager::GetGreenfield (const WifiRemoteStation *station) const | 2062 WifiRemoteStationManager::GetGreenfield (const WifiRemoteStation *station) const |
2082 { | 2063 { |
2083 return station->m_state->m_greenfield; | 2064 return station->m_state->m_greenfield; |
2084 } | 2065 } |
2085 | 2066 |
2086 bool | 2067 bool |
2087 WifiRemoteStationManager::GetAggregation (const WifiRemoteStation *station) cons
t | 2068 WifiRemoteStationManager::GetAggregation (const WifiRemoteStation *station) cons
t |
2088 { | 2069 { |
2089 return station->m_state->m_aggregation; | 2070 return station->m_state->m_aggregation; |
2090 } | 2071 } |
2091 | 2072 |
2092 bool | |
2093 WifiRemoteStationManager::GetStbc (const WifiRemoteStation *station) const | |
2094 { | |
2095 return station->m_state->m_stbc; | |
2096 } | |
2097 | |
2098 uint8_t | 2073 uint8_t |
2099 WifiRemoteStationManager::GetNumberOfSupportedStreams (const WifiRemoteStation *
station) const | 2074 WifiRemoteStationManager::GetNumberOfSupportedStreams (const WifiRemoteStation *
station) const |
2100 { | 2075 { |
2101 return station->m_state->m_streams; | 2076 return station->m_state->m_streams; |
2102 } | 2077 } |
2103 | 2078 |
2104 uint32_t | 2079 uint32_t |
2105 WifiRemoteStationManager::GetNess (const WifiRemoteStation *station) const | 2080 WifiRemoteStationManager::GetNess (const WifiRemoteStation *station) const |
2106 { | 2081 { |
2107 return station->m_state->m_ness; | 2082 return station->m_state->m_ness; |
2108 } | 2083 } |
2109 | 2084 |
2110 uint32_t | |
2111 WifiRemoteStationManager::GetShortRetryCount (const WifiRemoteStation *station)
const | |
2112 { | |
2113 return station->m_ssrc; | |
2114 } | |
2115 | |
2116 Ptr<WifiPhy> | 2085 Ptr<WifiPhy> |
2117 WifiRemoteStationManager::GetPhy (void) const | 2086 WifiRemoteStationManager::GetPhy (void) const |
2118 { | 2087 { |
2119 return m_wifiPhy; | 2088 return m_wifiPhy; |
2120 } | 2089 } |
2121 | 2090 |
2122 Ptr<WifiMac> | 2091 Ptr<WifiMac> |
2123 WifiRemoteStationManager::GetMac (void) const | 2092 WifiRemoteStationManager::GetMac (void) const |
2124 { | 2093 { |
2125 return m_wifiMac; | 2094 return m_wifiMac; |
2126 } | 2095 } |
2127 | 2096 |
2128 uint32_t | 2097 uint8_t |
2129 WifiRemoteStationManager::GetLongRetryCount (const WifiRemoteStation *station) c
onst | |
2130 { | |
2131 return station->m_slrc; | |
2132 } | |
2133 | |
2134 uint32_t | |
2135 WifiRemoteStationManager::GetNSupported (const WifiRemoteStation *station) const | 2098 WifiRemoteStationManager::GetNSupported (const WifiRemoteStation *station) const |
2136 { | 2099 { |
2137 return station->m_state->m_operationalRateSet.size (); | 2100 return static_cast<uint8_t> (station->m_state->m_operationalRateSet.size ()); |
2138 } | 2101 } |
2139 | 2102 |
2140 bool | 2103 bool |
2141 WifiRemoteStationManager::GetQosSupported (const WifiRemoteStation *station) con
st | 2104 WifiRemoteStationManager::GetQosSupported (const WifiRemoteStation *station) con
st |
2142 { | 2105 { |
2143 return station->m_state->m_qosSupported; | 2106 return station->m_state->m_qosSupported; |
2144 } | 2107 } |
2145 | 2108 |
2146 bool | 2109 bool |
2147 WifiRemoteStationManager::GetHtSupported (const WifiRemoteStation *station) cons
t | 2110 WifiRemoteStationManager::GetHtSupported (const WifiRemoteStation *station) cons
t |
2148 { | 2111 { |
2149 return station->m_state->m_htSupported; | 2112 return station->m_state->m_htSupported; |
2150 } | 2113 } |
2151 | 2114 |
2152 bool | 2115 bool |
2153 WifiRemoteStationManager::GetVhtSupported (const WifiRemoteStation *station) con
st | 2116 WifiRemoteStationManager::GetVhtSupported (const WifiRemoteStation *station) con
st |
2154 { | 2117 { |
2155 return station->m_state->m_vhtSupported; | 2118 return station->m_state->m_vhtSupported; |
2156 } | 2119 } |
2157 | 2120 |
2158 bool | 2121 bool |
2159 WifiRemoteStationManager::GetHeSupported (const WifiRemoteStation *station) cons
t | 2122 WifiRemoteStationManager::GetHeSupported (const WifiRemoteStation *station) cons
t |
2160 { | 2123 { |
2161 return station->m_state->m_heSupported; | 2124 return station->m_state->m_heSupported; |
2162 } | 2125 } |
2163 | 2126 |
2164 uint8_t | 2127 uint8_t |
2165 WifiRemoteStationManager::GetNMcsSupported (const WifiRemoteStation *station) co
nst | 2128 WifiRemoteStationManager::GetNMcsSupported (const WifiRemoteStation *station) co
nst |
2166 { | 2129 { |
2167 return (uint8_t)station->m_state->m_operationalMcsSet.size (); | 2130 return static_cast<uint8_t> (station->m_state->m_operationalMcsSet.size ()); |
2168 } | 2131 } |
2169 | 2132 |
2170 uint32_t | 2133 uint32_t |
2171 WifiRemoteStationManager::GetNNonErpSupported (const WifiRemoteStation *station)
const | 2134 WifiRemoteStationManager::GetNNonErpSupported (const WifiRemoteStation *station)
const |
2172 { | 2135 { |
2173 uint32_t size = 0; | 2136 uint32_t size = 0; |
2174 for (WifiModeListIterator i = station->m_state->m_operationalRateSet.begin ();
i != station->m_state->m_operationalRateSet.end (); i++) | 2137 for (WifiModeListIterator i = station->m_state->m_operationalRateSet.begin ();
i != station->m_state->m_operationalRateSet.end (); i++) |
2175 { | 2138 { |
2176 if (i->GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM) | 2139 if (i->GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM) |
2177 { | 2140 { |
2178 continue; | 2141 continue; |
2179 } | 2142 } |
2180 size++; | 2143 size++; |
2181 } | 2144 } |
2182 return size; | 2145 return size; |
2183 } | 2146 } |
2184 | 2147 |
2185 uint8_t | 2148 uint16_t |
2186 WifiRemoteStationManager::GetChannelWidthSupported (Mac48Address address) const | 2149 WifiRemoteStationManager::GetChannelWidthSupported (Mac48Address address) const |
2187 { | 2150 { |
2188 return LookupState (address)->m_channelWidth; | 2151 return LookupState (address)->m_channelWidth; |
2189 } | 2152 } |
2190 | 2153 |
2191 bool | 2154 bool |
2192 WifiRemoteStationManager::GetShortGuardInterval (Mac48Address address) const | 2155 WifiRemoteStationManager::GetShortGuardInterval (Mac48Address address) const |
2193 { | 2156 { |
2194 return LookupState (address)->m_shortGuardInterval; | 2157 return LookupState (address)->m_shortGuardInterval; |
2195 } | 2158 } |
2196 | 2159 |
2197 uint8_t | 2160 uint8_t |
2198 WifiRemoteStationManager::GetNumberOfSupportedStreams (Mac48Address address) con
st | 2161 WifiRemoteStationManager::GetNumberOfSupportedStreams (Mac48Address address) con
st |
2199 { | 2162 { |
2200 return LookupState (address)->m_streams; | 2163 return LookupState (address)->m_streams; |
2201 } | 2164 } |
2202 | 2165 |
2203 uint8_t | 2166 uint8_t |
2204 WifiRemoteStationManager::GetNMcsSupported (Mac48Address address) const | 2167 WifiRemoteStationManager::GetNMcsSupported (Mac48Address address) const |
2205 { | 2168 { |
2206 return (uint8_t)LookupState (address)->m_operationalMcsSet.size (); | 2169 return static_cast<uint8_t> (LookupState (address)->m_operationalMcsSet.size (
)); |
2207 } | 2170 } |
2208 | 2171 |
2209 bool | 2172 bool |
2210 WifiRemoteStationManager::GetHtSupported (Mac48Address address) const | 2173 WifiRemoteStationManager::GetHtSupported (Mac48Address address) const |
2211 { | 2174 { |
2212 return LookupState (address)->m_htSupported; | 2175 return LookupState (address)->m_htSupported; |
2213 } | 2176 } |
2214 | 2177 |
2215 bool | 2178 bool |
2216 WifiRemoteStationManager::GetVhtSupported (Mac48Address address) const | 2179 WifiRemoteStationManager::GetVhtSupported (Mac48Address address) const |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2273 WifiRemoteStation::~WifiRemoteStation () | 2236 WifiRemoteStation::~WifiRemoteStation () |
2274 { | 2237 { |
2275 NS_LOG_FUNCTION (this); | 2238 NS_LOG_FUNCTION (this); |
2276 } | 2239 } |
2277 | 2240 |
2278 WifiRemoteStationInfo::WifiRemoteStationInfo () | 2241 WifiRemoteStationInfo::WifiRemoteStationInfo () |
2279 : m_memoryTime (Seconds (1.0)), | 2242 : m_memoryTime (Seconds (1.0)), |
2280 m_lastUpdate (Seconds (0.0)), | 2243 m_lastUpdate (Seconds (0.0)), |
2281 m_failAvg (0.0) | 2244 m_failAvg (0.0) |
2282 { | 2245 { |
| 2246 NS_LOG_FUNCTION (this); |
2283 } | 2247 } |
2284 | 2248 |
2285 double | 2249 double |
2286 WifiRemoteStationInfo::CalculateAveragingCoefficient () | 2250 WifiRemoteStationInfo::CalculateAveragingCoefficient () |
2287 { | 2251 { |
2288 double retval = std::exp ((double)(m_lastUpdate.GetMicroSeconds () - Simulator
::Now ().GetMicroSeconds ()) | 2252 double retval = std::exp (static_cast<double> (m_lastUpdate.GetMicroSeconds ()
- Simulator::Now ().GetMicroSeconds ()) / m_memoryTime.GetMicroSeconds ()); |
2289 / (double)m_memoryTime.GetMicroSeconds ()); | |
2290 m_lastUpdate = Simulator::Now (); | 2253 m_lastUpdate = Simulator::Now (); |
2291 return retval; | 2254 return retval; |
2292 } | 2255 } |
2293 | 2256 |
2294 void | 2257 void |
2295 WifiRemoteStationInfo::NotifyTxSuccess (uint32_t retryCounter) | 2258 WifiRemoteStationInfo::NotifyTxSuccess (uint32_t retryCounter) |
2296 { | 2259 { |
2297 double coefficient = CalculateAveragingCoefficient (); | 2260 double coefficient = CalculateAveragingCoefficient (); |
2298 m_failAvg = (double)retryCounter / (1 + (double)retryCounter) * (1.0 - coeffic
ient) + coefficient * m_failAvg; | 2261 m_failAvg = static_cast<double> (retryCounter) / (1 + retryCounter) * (1 - coe
fficient) + coefficient * m_failAvg; |
2299 } | 2262 } |
2300 | 2263 |
2301 void | 2264 void |
2302 WifiRemoteStationInfo::NotifyTxFailed () | 2265 WifiRemoteStationInfo::NotifyTxFailed () |
2303 { | 2266 { |
2304 double coefficient = CalculateAveragingCoefficient (); | 2267 double coefficient = CalculateAveragingCoefficient (); |
2305 m_failAvg = (1.0 - coefficient) + coefficient * m_failAvg; | 2268 m_failAvg = (1 - coefficient) + coefficient * m_failAvg; |
2306 } | 2269 } |
2307 | 2270 |
2308 double | 2271 double |
2309 WifiRemoteStationInfo::GetFrameErrorRate () const | 2272 WifiRemoteStationInfo::GetFrameErrorRate () const |
2310 { | 2273 { |
2311 return m_failAvg; | 2274 return m_failAvg; |
2312 } | 2275 } |
2313 | 2276 |
2314 } //namespace ns3 | 2277 } //namespace ns3 |
LEFT | RIGHT |