From a73970b783cd45843fb5b33eef80ccfc5be5220f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deronne?= Date: Sat, 7 Nov 2015 21:32:56 +0100 Subject: [PATCH] Add checks when setting the HT and VHT capabilities; fix issue when a 20MHz channel width is selected in 802.11ac --- src/wifi/model/ap-wifi-mac.cc | 6 ++++-- src/wifi/model/sta-wifi-mac.cc | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/wifi/model/ap-wifi-mac.cc b/src/wifi/model/ap-wifi-mac.cc index a95cf8431..261568ff7 100644 --- a/src/wifi/model/ap-wifi-mac.cc +++ b/src/wifi/model/ap-wifi-mac.cc @@ -362,7 +362,8 @@ ApWifiMac::GetHtCapabilities (void) const { WifiMode mcs = m_phy->GetMcs (i); capabilities.SetRxMcsBitmask (mcs.GetMcsValue ()); - if (mcs.GetDataRate (m_phy->GetChannelWidth (), m_phy->GetGuardInterval (), 1) > maxSupportedRate) + if ((mcs.GetModulationClass () == WIFI_MOD_CLASS_HT) + && (mcs.GetDataRate (m_phy->GetChannelWidth (), m_phy->GetGuardInterval (), 1) > maxSupportedRate)) { maxSupportedRate = mcs.GetDataRate (m_phy->GetChannelWidth (), m_phy->GetGuardInterval (), 1); } @@ -398,7 +399,8 @@ ApWifiMac::GetVhtCapabilities (void) const for (uint8_t i = 0; i < m_phy->GetNMcs (); i++) { WifiMode mcs = m_phy->GetMcs (i); - if (mcs.GetMcsValue () > maxMcs) + if ((mcs.GetModulationClass () == WIFI_MOD_CLASS_VHT) + && (mcs.GetMcsValue () > maxMcs)) { maxMcs = mcs.GetMcsValue (); } diff --git a/src/wifi/model/sta-wifi-mac.cc b/src/wifi/model/sta-wifi-mac.cc index ff7ef2a13..71b84e333 100644 --- a/src/wifi/model/sta-wifi-mac.cc +++ b/src/wifi/model/sta-wifi-mac.cc @@ -686,7 +686,8 @@ StaWifiMac::GetHtCapabilities (void) const { WifiMode mcs = m_phy->GetMcs (i); capabilities.SetRxMcsBitmask (mcs.GetMcsValue ()); - if (mcs.GetDataRate (m_phy->GetChannelWidth (), m_phy->GetGuardInterval (), 1) > maxSupportedRate) + if ((mcs.GetModulationClass () == WIFI_MOD_CLASS_HT) + && (mcs.GetDataRate (m_phy->GetChannelWidth (), m_phy->GetGuardInterval (), 1) > maxSupportedRate)) { maxSupportedRate = mcs.GetDataRate (m_phy->GetChannelWidth (), m_phy->GetGuardInterval (), 1); } @@ -722,7 +723,8 @@ StaWifiMac::GetVhtCapabilities (void) const for (uint8_t i = 0; i < m_phy->GetNMcs (); i++) { WifiMode mcs = m_phy->GetMcs (i); - if (mcs.GetMcsValue () > maxMcs) + if ((mcs.GetModulationClass () == WIFI_MOD_CLASS_VHT) + && (mcs.GetMcsValue () > maxMcs)) { maxMcs = mcs.GetMcsValue (); }