From 8a24f52aacee53841d1c26144c1f45ef1006d67f Mon Sep 17 00:00:00 2001 From: Rami Abdallah Date: Tue, 27 Feb 2024 23:26:08 +0100 Subject: [PATCH] wifi: HT and VHT are not supported on 6GHz links --- src/wifi/model/adhoc-wifi-mac.cc | 6 ++-- src/wifi/model/ap-wifi-mac.cc | 14 ++++----- src/wifi/model/mpdu-aggregator.cc | 7 ++++- src/wifi/model/msdu-aggregator.cc | 7 ++++- src/wifi/model/qos-txop.cc | 3 +- src/wifi/model/sta-wifi-mac.cc | 30 ++++++++----------- src/wifi/model/wifi-mac.cc | 16 +++++----- src/wifi/model/wifi-mac.h | 5 ++-- src/wifi/model/wifi-remote-station-manager.cc | 8 +++-- 9 files changed, 54 insertions(+), 42 deletions(-) diff --git a/src/wifi/model/adhoc-wifi-mac.cc b/src/wifi/model/adhoc-wifi-mac.cc index 397fedb42..8ac6c925a 100644 --- a/src/wifi/model/adhoc-wifi-mac.cc +++ b/src/wifi/model/adhoc-wifi-mac.cc @@ -78,7 +78,7 @@ AdhocWifiMac::Enqueue(Ptr packet, Mac48Address to) if (GetWifiRemoteStationManager()->IsBrandNew(to)) { // In ad hoc mode, we assume that every destination supports all the rates we support. - if (GetHtSupported()) + if (GetHtSupported(SINGLE_LINK_OP_ID)) { GetWifiRemoteStationManager()->AddAllSupportedMcs(to); GetWifiRemoteStationManager()->AddStationHtCapabilities( @@ -145,7 +145,7 @@ AdhocWifiMac::Enqueue(Ptr packet, Mac48Address to) hdr.SetType(WIFI_MAC_DATA); } - if (GetHtSupported()) + if (GetHtSupported(SINGLE_LINK_OP_ID)) { hdr.SetNoOrder(); // explicitly set to 0 for the time being since HT control field is not // yet implemented (set it to 1 when implemented) @@ -191,7 +191,7 @@ AdhocWifiMac::Receive(Ptr mpdu, uint8_t linkId) if (GetWifiRemoteStationManager()->IsBrandNew(from)) { // In ad hoc mode, we assume that every destination supports all the rates we support. - if (GetHtSupported()) + if (GetHtSupported(SINGLE_LINK_OP_ID)) { GetWifiRemoteStationManager()->AddAllSupportedMcs(from); GetWifiRemoteStationManager()->AddStationHtCapabilities( diff --git a/src/wifi/model/ap-wifi-mac.cc b/src/wifi/model/ap-wifi-mac.cc index 4c55c2c2c..89cfc9232 100644 --- a/src/wifi/model/ap-wifi-mac.cc +++ b/src/wifi/model/ap-wifi-mac.cc @@ -565,7 +565,7 @@ ApWifiMac::GetSupportedRates(uint8_t linkId) const // must have its MSB set to 1 (must be treated as a Basic Rate) // Also the standard mentioned that at least 1 element should be included in the SupportedRates // the rest can be in the ExtendedSupportedRates - if (GetHtSupported()) + if (GetHtSupported(linkId)) { for (const auto& selector : GetWifiPhy(linkId)->GetBssMembershipSelectorList()) { @@ -889,7 +889,7 @@ HtOperation ApWifiMac::GetHtOperation(uint8_t linkId) const { NS_LOG_FUNCTION(this << +linkId); - NS_ASSERT(GetHtSupported()); + NS_ASSERT(GetHtSupported(linkId)); HtOperation operation; auto phy = GetWifiPhy(linkId); auto remoteStationManager = GetWifiRemoteStationManager(linkId); @@ -1136,7 +1136,7 @@ ApWifiMac::SendProbeResp(Mac48Address to, uint8_t linkId) { probe.Get() = GetEdcaParameterSet(linkId); } - if (GetHtSupported()) + if (GetHtSupported(linkId)) { probe.Get() = GetExtendedCapabilities(); probe.Get() = GetHtCapabilities(linkId); @@ -1239,7 +1239,7 @@ ApWifiMac::GetAssocResp(Mac48Address to, uint8_t linkId) { assoc.Get() = GetEdcaParameterSet(linkId); } - if (GetHtSupported()) + if (GetHtSupported(linkId)) { assoc.Get() = GetExtendedCapabilities(); assoc.Get() = GetHtCapabilities(linkId); @@ -1535,7 +1535,7 @@ ApWifiMac::SendOneBeacon(uint8_t linkId) { beacon.Get() = GetEdcaParameterSet(linkId); } - if (GetHtSupported()) + if (GetHtSupported(linkId)) { beacon.Get() = GetExtendedCapabilities(); beacon.Get() = GetHtCapabilities(linkId); @@ -2109,7 +2109,7 @@ ApWifiMac::ReceiveAssocRequest(const AssocReqRefVariant& assoc, return failure("STA's supported rate set not compatible with our Basic Rate set"); } - if (GetHtSupported()) + if (GetHtSupported(linkId)) { // check whether the HT STA supports all MCSs in Basic MCS Set const auto& htCapabilities = frame.template Get(); @@ -2283,7 +2283,7 @@ ApWifiMac::ReceiveAssocRequest(const AssocReqRefVariant& assoc, { remoteStationManager->AddSupportedErpSlotTime(from, true); } - if (GetHtSupported()) + if (GetHtSupported(linkId)) { const auto& htCapabilities = frame.template Get(); if (htCapabilities.has_value() && htCapabilities->IsSupportedMcs(0)) diff --git a/src/wifi/model/mpdu-aggregator.cc b/src/wifi/model/mpdu-aggregator.cc index 98a667882..73971844c 100644 --- a/src/wifi/model/mpdu-aggregator.cc +++ b/src/wifi/model/mpdu-aggregator.cc @@ -150,6 +150,7 @@ MpduAggregator::GetMaxAmpduSize(Mac48Address recipient, // Retrieve the Capabilities elements advertised by the recipient auto ehtCapabilities = stationManager->GetStationEhtCapabilities(recipient); auto heCapabilities = stationManager->GetStationHeCapabilities(recipient); + auto he6GhzCapabilities = stationManager->GetStationHe6GhzCapabilities(recipient); auto vhtCapabilities = stationManager->GetStationVhtCapabilities(recipient); auto htCapabilities = stationManager->GetStationHtCapabilities(recipient); @@ -161,11 +162,15 @@ MpduAggregator::GetMaxAmpduSize(Mac48Address recipient, maxAmpduSize = std::min(maxAmpduSize, ehtCapabilities->GetMaxAmpduLength()); } - else if (modulation >= WIFI_MOD_CLASS_HE) + else if (modulation >= WIFI_MOD_CLASS_HE || m_mac->Is6GhzBand(m_linkId)) { NS_ABORT_MSG_IF(!heCapabilities, "HE Capabilities element not received"); maxAmpduSize = std::min(maxAmpduSize, heCapabilities->GetMaxAmpduLength()); + if (he6GhzCapabilities) + { + maxAmpduSize = std::min(maxAmpduSize, he6GhzCapabilities->GetMaxAmpduLength()); + } } else if (modulation == WIFI_MOD_CLASS_VHT) { diff --git a/src/wifi/model/msdu-aggregator.cc b/src/wifi/model/msdu-aggregator.cc index e58383947..65d50d087 100644 --- a/src/wifi/model/msdu-aggregator.cc +++ b/src/wifi/model/msdu-aggregator.cc @@ -187,6 +187,7 @@ MsduAggregator::GetMaxAmsduSize(Mac48Address recipient, // Retrieve the Capabilities elements advertised by the recipient auto ehtCapabilities = stationManager->GetStationEhtCapabilities(recipient); + auto he6GhzCapabilities = stationManager->GetStationHe6GhzCapabilities(recipient); auto vhtCapabilities = stationManager->GetStationVhtCapabilities(recipient); auto htCapabilities = stationManager->GetStationHtCapabilities(recipient); @@ -199,12 +200,16 @@ MsduAggregator::GetMaxAmsduSize(Mac48Address recipient, { maxMpduSize = ehtCapabilities->GetMaxMpduLength(); } + else if (he6GhzCapabilities && m_mac->Is6GhzBand(m_linkId)) + { + maxMpduSize = he6GhzCapabilities->GetMaxMpduLength(); + } else if (vhtCapabilities && m_mac->GetWifiPhy(m_linkId)->GetPhyBand() != WIFI_PHY_BAND_2_4GHZ) { maxMpduSize = vhtCapabilities->GetMaxMpduLength(); } - if (!htCapabilities) + if (!htCapabilities && !he6GhzCapabilities) { /* "A non-DMG STA shall not transmit an A-MSDU to a STA from which it has * not received a frame containing an HT Capabilities element" (Section diff --git a/src/wifi/model/qos-txop.cc b/src/wifi/model/qos-txop.cc index 76ed44a4a..a734893d5 100644 --- a/src/wifi/model/qos-txop.cc +++ b/src/wifi/model/qos-txop.cc @@ -35,6 +35,7 @@ #include "wifi-psdu.h" #include "wifi-tx-parameters.h" +#include "ns3/ht-configuration.h" #include "ns3/ht-frame-exchange-manager.h" #include "ns3/log.h" #include "ns3/pointer.h" @@ -541,7 +542,7 @@ QosTxop::GetNextMpdu(uint8_t linkId, // try A-MSDU aggregation if the MPDU does not contain an A-MSDU and does not already // have a sequence number assigned (may be a retransmission) - if (m_mac->GetHtSupported() && !recipient.IsBroadcast() && + if (m_mac->GetHtConfiguration() && !recipient.IsBroadcast() && !peekedItem->GetHeader().IsQosAmsdu() && !peekedItem->HasSeqNoAssigned() && !peekedItem->IsFragment()) { diff --git a/src/wifi/model/sta-wifi-mac.cc b/src/wifi/model/sta-wifi-mac.cc index 35eb6ed17..94407fcc4 100644 --- a/src/wifi/model/sta-wifi-mac.cc +++ b/src/wifi/model/sta-wifi-mac.cc @@ -371,7 +371,7 @@ StaWifiMac::SendProbeRequest(uint8_t linkId) auto supportedRates = GetSupportedRates(linkId); probe.Get() = supportedRates.rates; probe.Get() = supportedRates.extendedRates; - if (GetHtSupported()) + if (GetHtSupported(linkId)) { probe.Get() = GetExtendedCapabilities(); probe.Get() = GetHtCapabilities(linkId); @@ -437,7 +437,7 @@ StaWifiMac::GetAssociationRequest(bool isReassoc, uint8_t linkId) const frame.template Get() = supportedRates.extendedRates; frame.Capabilities() = GetCapabilities(linkId); frame.SetListenInterval(0); - if (GetHtSupported()) + if (GetHtSupported(linkId)) { frame.template Get() = GetExtendedCapabilities(); frame.template Get() = GetHtCapabilities(linkId); @@ -1714,26 +1714,22 @@ StaWifiMac::UpdateApInfo(const MgtFrameType& frame, } GetWifiRemoteStationManager(linkId)->SetQosSupport(apAddr, qosSupported); - if (!GetHtSupported()) + if (GetHtSupported(linkId)) { - return; - } - /* HT station */ - if (const auto& htCapabilities = frame.template Get(); - htCapabilities.has_value()) - { - if (!htCapabilities->IsSupportedMcs(0)) - { - GetWifiRemoteStationManager(linkId)->RemoveAllSupportedMcs(apAddr); - } - else + /* HT station */ + if (const auto& htCapabilities = frame.template Get(); + htCapabilities.has_value()) { GetWifiRemoteStationManager(linkId)->AddStationHtCapabilities(apAddr, *htCapabilities); } + else + { + GetWifiRemoteStationManager(linkId)->RemoveAllSupportedMcs(apAddr); + } + // TODO: process ExtendedCapabilities + // ExtendedCapabilities extendedCapabilities = frame.GetExtendedCapabilities (); } - // TODO: process ExtendedCapabilities - // ExtendedCapabilities extendedCapabilities = frame.GetExtendedCapabilities (); // we do not return if VHT is not supported because HE STAs operating in // the 2.4 GHz band do not support VHT @@ -1966,7 +1962,7 @@ StaWifiMac::GetSupportedRates(uint8_t linkId) const NS_LOG_DEBUG("Adding supported rate of " << modeDataRate); rates.AddSupportedRate(modeDataRate); } - if (GetHtSupported()) + if (GetHtSupported(linkId)) { for (const auto& selector : GetWifiPhy(linkId)->GetBssMembershipSelectorList()) { diff --git a/src/wifi/model/wifi-mac.cc b/src/wifi/model/wifi-mac.cc index 958493b09..9c27f1be5 100644 --- a/src/wifi/model/wifi-mac.cc +++ b/src/wifi/model/wifi-mac.cc @@ -471,7 +471,7 @@ void WifiMac::SetDevice(const Ptr device) { m_device = device; - if (GetHtSupported()) + if (device->GetHtConfiguration()) { // the configured BlockAck buffer size can now be capped m_mpduBufferSize = std::min(m_mpduBufferSize, GetMaxBaBufferSize()); @@ -1899,16 +1899,18 @@ WifiMac::GetEhtConfiguration() const } bool -WifiMac::GetHtSupported() const +WifiMac::GetHtSupported(uint8_t linkId) const { - return bool(GetDevice()->GetHtConfiguration()); + return (GetDevice()->GetHtConfiguration() && + GetWifiPhy(linkId)->GetPhyBand() != WIFI_PHY_BAND_6GHZ); } bool WifiMac::GetVhtSupported(uint8_t linkId) const { return (GetDevice()->GetVhtConfiguration() && - GetWifiPhy(linkId)->GetPhyBand() != WIFI_PHY_BAND_2_4GHZ); + GetWifiPhy(linkId)->GetPhyBand() != WIFI_PHY_BAND_2_4GHZ && + GetWifiPhy(linkId)->GetPhyBand() != WIFI_PHY_BAND_6GHZ); } bool @@ -1986,7 +1988,7 @@ WifiMac::GetMaxBaBufferSize(std::optional address) const { return 256; } - NS_ASSERT(address ? GetHtSupported(*address) : GetHtSupported()); + NS_ASSERT(address ? GetHtSupported(*address) : static_cast(GetHtConfiguration())); return 64; } @@ -2090,7 +2092,7 @@ WifiMac::GetExtendedCapabilities() const { NS_LOG_FUNCTION(this); ExtendedCapabilities capabilities; - capabilities.SetHtSupported(GetHtSupported()); + capabilities.SetHtSupported(GetHtSupported(SINGLE_LINK_OP_ID)); capabilities.SetVhtSupported(GetVhtSupported(SINGLE_LINK_OP_ID)); // TODO: to be completed return capabilities; @@ -2100,7 +2102,7 @@ HtCapabilities WifiMac::GetHtCapabilities(uint8_t linkId) const { NS_LOG_FUNCTION(this << +linkId); - NS_ASSERT(GetHtSupported()); + NS_ASSERT(GetHtSupported(linkId)); HtCapabilities capabilities; auto phy = GetWifiPhy(linkId); diff --git a/src/wifi/model/wifi-mac.h b/src/wifi/model/wifi-mac.h index 87ceb8985..20605a948 100644 --- a/src/wifi/model/wifi-mac.h +++ b/src/wifi/model/wifi-mac.h @@ -579,11 +579,12 @@ class WifiMac : public Object */ bool GetDsssSupported(uint8_t linkId) const; /** - * Return whether the device supports HT. + * Return whether the device supports HT on the given link. * + * \param linkId the ID of the given link. * \return true if HT is supported, false otherwise */ - bool GetHtSupported() const; + bool GetHtSupported(uint8_t linkId) const; /** * Return whether the device supports VHT on the given link. * diff --git a/src/wifi/model/wifi-remote-station-manager.cc b/src/wifi/model/wifi-remote-station-manager.cc index 001ee0c1e..d3641719a 100644 --- a/src/wifi/model/wifi-remote-station-manager.cc +++ b/src/wifi/model/wifi-remote-station-manager.cc @@ -260,7 +260,8 @@ bool WifiRemoteStationManager::GetVhtSupported() const { return (m_wifiPhy->GetDevice()->GetVhtConfiguration() && - m_wifiPhy->GetPhyBand() != WIFI_PHY_BAND_2_4GHZ); + m_wifiPhy->GetPhyBand() != WIFI_PHY_BAND_2_4GHZ && + m_wifiPhy->GetPhyBand() != WIFI_PHY_BAND_6GHZ); } bool @@ -2054,7 +2055,7 @@ WifiRemoteStationManager::GetQosSupported(const WifiRemoteStation* station) cons bool WifiRemoteStationManager::GetHtSupported(const WifiRemoteStation* station) const { - return bool(station->m_state->m_htCapabilities); + return station->m_state->m_htCapabilities || station->m_state->m_he6GhzBandCapabilities; } bool @@ -2169,7 +2170,8 @@ WifiRemoteStationManager::GetOfdmSupported(const Mac48Address& address) const bool WifiRemoteStationManager::GetHtSupported(Mac48Address address) const { - return bool(LookupState(address)->m_htCapabilities); + const auto state = LookupState(address); + return state->m_htCapabilities || state->m_he6GhzBandCapabilities; } bool