diff --git a/src/wifi/model/ap-wifi-mac.cc b/src/wifi/model/ap-wifi-mac.cc index 225aab7de..bd9389e9d 100644 --- a/src/wifi/model/ap-wifi-mac.cc +++ b/src/wifi/model/ap-wifi-mac.cc @@ -225,7 +225,7 @@ void ApWifiMac::UpdateShortSlotTimeEnabled (void) { NS_LOG_FUNCTION (this); - if (GetErpSupported () && GetShortSlotTimeSupported () && (m_numNonErpStations == 0)) + if (GetErpSupported (SINGLE_LINK_OP_ID) && GetShortSlotTimeSupported () && (m_numNonErpStations == 0)) { for (const auto& sta : m_staList) { @@ -247,7 +247,7 @@ void ApWifiMac::UpdateShortPreambleEnabled (void) { NS_LOG_FUNCTION (this); - if (GetErpSupported () && GetWifiPhy ()->GetShortPhyPreambleSupported ()) + if (GetErpSupported (SINGLE_LINK_OP_ID) && GetWifiPhy ()->GetShortPhyPreambleSupported ()) { for (const auto& sta : m_staList) { @@ -427,7 +427,7 @@ ApWifiMac::GetDsssParameterSet (void) const { NS_LOG_FUNCTION (this); DsssParameterSet dsssParameters; - if (GetDsssSupported ()) + if (GetDsssSupported (SINGLE_LINK_OP_ID)) { dsssParameters.SetDsssSupported (1); dsssParameters.SetCurrentChannel (GetWifiPhy ()->GetChannelNumber ()); @@ -452,7 +452,7 @@ ApWifiMac::GetErpInformation (void) const NS_LOG_FUNCTION (this); ErpInformation information; information.SetErpSupported (1); - if (GetErpSupported ()) + if (GetErpSupported (SINGLE_LINK_OP_ID)) { information.SetNonErpPresent (m_numNonErpStations > 0); information.SetUseProtection (GetUseNonErpProtection ()); @@ -751,11 +751,11 @@ ApWifiMac::SendProbeResp (Mac48Address to) probe.SetCapabilities (GetCapabilities ()); GetWifiRemoteStationManager ()->SetShortPreambleEnabled (m_shortPreambleEnabled); GetWifiRemoteStationManager ()->SetShortSlotTimeEnabled (m_shortSlotTimeEnabled); - if (GetDsssSupported ()) + if (GetDsssSupported (SINGLE_LINK_OP_ID)) { probe.SetDsssParameterSet (GetDsssParameterSet ()); } - if (GetErpSupported ()) + if (GetErpSupported (SINGLE_LINK_OP_ID)) { probe.SetErpInformation (GetErpInformation ()); } @@ -864,7 +864,7 @@ ApWifiMac::SendAssocResp (Mac48Address to, bool success, bool isReassoc) assoc.SetSupportedRates (GetSupportedRates ()); assoc.SetStatusCode (code); assoc.SetCapabilities (GetCapabilities ()); - if (GetErpSupported ()) + if (GetErpSupported (SINGLE_LINK_OP_ID)) { assoc.SetErpInformation (GetErpInformation ()); } @@ -935,11 +935,11 @@ ApWifiMac::SendOneBeacon (void) beacon.SetCapabilities (GetCapabilities ()); GetWifiRemoteStationManager ()->SetShortPreambleEnabled (m_shortPreambleEnabled); GetWifiRemoteStationManager ()->SetShortSlotTimeEnabled (m_shortSlotTimeEnabled); - if (GetDsssSupported ()) + if (GetDsssSupported (SINGLE_LINK_OP_ID)) { beacon.SetDsssParameterSet (GetDsssParameterSet ()); } - if (GetErpSupported ()) + if (GetErpSupported (SINGLE_LINK_OP_ID)) { beacon.SetErpInformation (GetErpInformation ()); } @@ -977,7 +977,7 @@ ApWifiMac::SendOneBeacon (void) //If a STA that does not support Short Slot Time associates, //the AP shall use long slot time beginning at the first Beacon //subsequent to the association of the long slot time STA. - if (GetErpSupported ()) + if (GetErpSupported (SINGLE_LINK_OP_ID)) { if (m_shortSlotTimeEnabled) { @@ -1210,7 +1210,7 @@ ApWifiMac::Receive (Ptr mpdu) GetWifiRemoteStationManager ()->AddSupportedMode (from, mode); } } - if (GetErpSupported () && GetWifiRemoteStationManager ()->GetErpOfdmSupported (from) && capabilities.IsShortSlotTime ()) + if (GetErpSupported (SINGLE_LINK_OP_ID) && GetWifiRemoteStationManager ()->GetErpOfdmSupported (from) && capabilities.IsShortSlotTime ()) { GetWifiRemoteStationManager ()->AddSupportedErpSlotTime (from, true); } @@ -1366,7 +1366,7 @@ ApWifiMac::Receive (Ptr mpdu) GetWifiRemoteStationManager ()->AddSupportedMode (from, mode); } } - if (GetErpSupported () && GetWifiRemoteStationManager ()->GetErpOfdmSupported (from) && capabilities.IsShortSlotTime ()) + if (GetErpSupported (SINGLE_LINK_OP_ID) && GetWifiRemoteStationManager ()->GetErpOfdmSupported (from) && capabilities.IsShortSlotTime ()) { GetWifiRemoteStationManager ()->AddSupportedErpSlotTime (from, true); } diff --git a/src/wifi/model/sta-wifi-mac.cc b/src/wifi/model/sta-wifi-mac.cc index 34512aaa6..cb476a67c 100644 --- a/src/wifi/model/sta-wifi-mac.cc +++ b/src/wifi/model/sta-wifi-mac.cc @@ -789,7 +789,7 @@ StaWifiMac::UpdateApInfoFromBeacon (MgtBeaconHeader beacon, Mac48Address apAddr, } } bool isShortPreambleEnabled = capabilities.IsShortPreamble (); - if (GetErpSupported ()) + if (GetErpSupported (SINGLE_LINK_OP_ID)) { const ErpInformation& erpInformation = beacon.GetErpInformation (); isShortPreambleEnabled &= !erpInformation.GetBarkerPreambleMode (); @@ -925,7 +925,7 @@ StaWifiMac::UpdateApInfoFromProbeResp (MgtProbeResponseHeader probeResp, Mac48Ad } bool isShortPreambleEnabled = capabilities.IsShortPreamble (); - if (GetErpSupported ()) + if (GetErpSupported (SINGLE_LINK_OP_ID)) { bool isErpAllowed = false; for (const auto & mode : GetWifiPhy ()->GetModeList (WIFI_MOD_CLASS_ERP_OFDM)) @@ -971,7 +971,7 @@ StaWifiMac::UpdateApInfoFromAssocResp (MgtAssocResponseHeader assocResp, Mac48Ad const CapabilityInformation& capabilities = assocResp.GetCapabilities (); const SupportedRates& rates = assocResp.GetSupportedRates (); bool isShortPreambleEnabled = capabilities.IsShortPreamble (); - if (GetErpSupported ()) + if (GetErpSupported (SINGLE_LINK_OP_ID)) { bool isErpAllowed = false; for (const auto & mode : GetWifiPhy ()->GetModeList (WIFI_MOD_CLASS_ERP_OFDM)) @@ -1156,8 +1156,8 @@ CapabilityInformation StaWifiMac::GetCapabilities (void) const { CapabilityInformation capabilities; - capabilities.SetShortPreamble (GetWifiPhy ()->GetShortPhyPreambleSupported () || GetErpSupported ()); - capabilities.SetShortSlotTime (GetShortSlotTimeSupported () && GetErpSupported ()); + capabilities.SetShortPreamble (GetWifiPhy ()->GetShortPhyPreambleSupported () || GetErpSupported (SINGLE_LINK_OP_ID)); + capabilities.SetShortSlotTime (GetShortSlotTimeSupported () && GetErpSupported (SINGLE_LINK_OP_ID)); return capabilities; } diff --git a/src/wifi/model/wifi-mac.cc b/src/wifi/model/wifi-mac.cc index d13255492..93c112f61 100644 --- a/src/wifi/model/wifi-mac.cc +++ b/src/wifi/model/wifi-mac.cc @@ -44,9 +44,7 @@ NS_LOG_COMPONENT_DEFINE ("WifiMac"); NS_OBJECT_ENSURE_REGISTERED (WifiMac); WifiMac::WifiMac () - : m_qosSupported (false), - m_erpSupported (false), - m_dsssSupported (false) + : m_qosSupported (false) { NS_LOG_FUNCTION (this); @@ -577,7 +575,12 @@ WifiMac::SetupEdcaQueue (AcIndex ac) void WifiMac::ConfigureContentionWindow (uint32_t cwMin, uint32_t cwMax) { - bool isDsssOnly = GetDsssSupported () && !GetErpSupported (); + std::list isDsssOnly; + for (const auto& link : m_links) + { + isDsssOnly.push_back (link->dsssSupported && !link->erpSupported); + } + if (m_txop != nullptr) { //The special value of AC_BE_NQOS which exists in the Access @@ -593,55 +596,53 @@ WifiMac::ConfigureContentionWindow (uint32_t cwMin, uint32_t cwMax) } void -WifiMac::ConfigureDcf (Ptr dcf, uint32_t cwmin, uint32_t cwmax, bool isDsss, AcIndex ac) +WifiMac::ConfigureDcf (Ptr dcf, uint32_t cwmin, uint32_t cwmax, + std::list isDsss, AcIndex ac) { - NS_LOG_FUNCTION (this << dcf << cwmin << cwmax << isDsss << +ac); - /* see IEEE 802.11 section 7.3.2.29 */ + NS_LOG_FUNCTION (this << dcf << cwmin << cwmax << +ac); + + uint32_t cwMinValue = 0; + uint32_t cwMaxValue = 0; + uint8_t aifsnValue = 0; + Time txopLimitDsss (0); + Time txopLimitNoDsss (0); + + /* see IEEE 802.11-2020 Table 9-155 "Default EDCA Parameter Set element parameter values" */ switch (ac) { case AC_VO: - dcf->SetMinCw ((cwmin + 1) / 4 - 1, SINGLE_LINK_OP_ID); - dcf->SetMaxCw ((cwmin + 1) / 2 - 1, SINGLE_LINK_OP_ID); - dcf->SetAifsn (2, SINGLE_LINK_OP_ID); - if (isDsss) - { - dcf->SetTxopLimit (MicroSeconds (3264), SINGLE_LINK_OP_ID); - } - else - { - dcf->SetTxopLimit (MicroSeconds (1504), SINGLE_LINK_OP_ID); - } + cwMinValue = (cwmin + 1) / 4 - 1; + cwMaxValue = (cwmin + 1) / 2 - 1; + aifsnValue = 2; + txopLimitDsss = MicroSeconds (3264); + txopLimitNoDsss = MicroSeconds (1504); // TODO should be MicroSeconds (2080) break; case AC_VI: - dcf->SetMinCw ((cwmin + 1) / 2 - 1, SINGLE_LINK_OP_ID); - dcf->SetMaxCw (cwmin, SINGLE_LINK_OP_ID); - dcf->SetAifsn (2, SINGLE_LINK_OP_ID); - if (isDsss) - { - dcf->SetTxopLimit (MicroSeconds (6016), SINGLE_LINK_OP_ID); - } - else - { - dcf->SetTxopLimit (MicroSeconds (3008), SINGLE_LINK_OP_ID); - } + cwMinValue = (cwmin + 1) / 2 - 1; + cwMaxValue = cwmin; + aifsnValue = 2; + txopLimitDsss = MicroSeconds (6016); + txopLimitNoDsss = MicroSeconds (3008); // TODO should be MicroSeconds (4096) break; case AC_BE: - dcf->SetMinCw (cwmin, SINGLE_LINK_OP_ID); - dcf->SetMaxCw (cwmax, SINGLE_LINK_OP_ID); - dcf->SetAifsn (3, SINGLE_LINK_OP_ID); - dcf->SetTxopLimit (MicroSeconds (0), SINGLE_LINK_OP_ID); + cwMinValue = cwmin; + cwMaxValue = cwmax; + aifsnValue = 3; + txopLimitDsss = MicroSeconds (0); // TODO should be MicroSeconds (3264) + txopLimitNoDsss = MicroSeconds (0); // TODO should be MicroSeconds (2528) break; case AC_BK: - dcf->SetMinCw (cwmin, SINGLE_LINK_OP_ID); - dcf->SetMaxCw (cwmax, SINGLE_LINK_OP_ID); - dcf->SetAifsn (7, SINGLE_LINK_OP_ID); - dcf->SetTxopLimit (MicroSeconds (0), SINGLE_LINK_OP_ID); + cwMinValue = cwmin; + cwMaxValue = cwmax; + aifsnValue = 7; + txopLimitDsss = MicroSeconds (0); // TODO should be MicroSeconds (3264) + txopLimitNoDsss = MicroSeconds (0); // TODO should be MicroSeconds (2528) break; case AC_BE_NQOS: - dcf->SetMinCw (cwmin, SINGLE_LINK_OP_ID); - dcf->SetMaxCw (cwmax, SINGLE_LINK_OP_ID); - dcf->SetAifsn (2, SINGLE_LINK_OP_ID); - dcf->SetTxopLimit (MicroSeconds (0), SINGLE_LINK_OP_ID); + cwMinValue = cwmin; + cwMaxValue = cwmax; + aifsnValue = 2; + txopLimitDsss = txopLimitNoDsss = MicroSeconds (0); break; case AC_BEACON: // done by ApWifiMac @@ -650,6 +651,21 @@ WifiMac::ConfigureDcf (Ptr dcf, uint32_t cwmin, uint32_t cwmax, bool isDss NS_FATAL_ERROR ("I don't know what to do with this"); break; } + + std::vector cwValues (m_links.size ()); + std::vector aifsnValues (m_links.size ()); + std::vector