From cad310831676683d2199e8a1722b0233b4a51fc4 Mon Sep 17 00:00:00 2001 From: Stefano Avallone Date: Wed, 4 May 2022 13:54:42 +0200 Subject: [PATCH] wifi: Fix setting of max supported channel width in (V)HT Capabilities --- src/wifi/model/wifi-mac.cc | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/wifi/model/wifi-mac.cc b/src/wifi/model/wifi-mac.cc index d21db6e2b..aded8df46 100644 --- a/src/wifi/model/wifi-mac.cc +++ b/src/wifi/model/wifi-mac.cc @@ -1214,7 +1214,7 @@ WifiMac::GetHtCapabilities (void) const bool sgiSupported = htConfiguration->GetShortGuardIntervalSupported (); capabilities.SetHtSupported (1); capabilities.SetLdpc (htConfiguration->GetLdpcSupported ()); - capabilities.SetSupportedChannelWidth (GetWifiPhy ()->GetChannelWidth () >= 40); + capabilities.SetSupportedChannelWidth (htConfiguration->Get40MHzOperationSupported () ? 1 : 0); capabilities.SetShortGuardInterval20 (sgiSupported); capabilities.SetShortGuardInterval40 (GetWifiPhy ()->GetChannelWidth () >= 40 && sgiSupported); // Set Maximum A-MSDU Length subfield @@ -1267,17 +1267,12 @@ WifiMac::GetVhtCapabilities (void) const if (GetVhtSupported ()) { Ptr htConfiguration = GetHtConfiguration (); + NS_ABORT_MSG_IF (!htConfiguration->Get40MHzOperationSupported (), + "VHT stations have to support 40 MHz operation"); Ptr vhtConfiguration = GetVhtConfiguration (); bool sgiSupported = htConfiguration->GetShortGuardIntervalSupported (); capabilities.SetVhtSupported (1); - if (GetWifiPhy ()->GetChannelWidth () == 160) - { - capabilities.SetSupportedChannelWidthSet (1); - } - else - { - capabilities.SetSupportedChannelWidthSet (0); - } + capabilities.SetSupportedChannelWidthSet (vhtConfiguration->Get160MHzOperationSupported () ? 1 : 0); // Set Maximum MPDU Length subfield uint16_t maxAmsduSize = std::max ({m_voMaxAmsduSize, m_viMaxAmsduSize, m_beMaxAmsduSize, m_bkMaxAmsduSize});