diff --git a/src/wifi/model/ap-wifi-mac.cc b/src/wifi/model/ap-wifi-mac.cc index 292aa5819..5ed67b934 100644 --- a/src/wifi/model/ap-wifi-mac.cc +++ b/src/wifi/model/ap-wifi-mac.cc @@ -671,17 +671,20 @@ ApWifiMac::GetVhtOperation (void) const { operation.SetChannelWidth (0); } - for (uint8_t nss = 1; nss <= 8; nss++) + uint8_t maxSpatialStream = m_phy->GetMaxSupportedRxSpatialStreams (); + for (std::map::const_iterator i = m_staList.begin (); i != m_staList.end (); i++) { - uint8_t maxMcs; - if (nss <= m_phy->GetMaxSupportedRxSpatialStreams ()) + if (m_stationManager->GetVhtSupported (i->second)) { - maxMcs = 9; //TBD: hardcode to 9 for now since we assume all MCS values are supported - } - else - { - maxMcs = 0; + if (m_stationManager->GetNumberOfSupportedStreams (i->second) < maxSpatialStream) + { + maxSpatialStream = m_stationManager->GetNumberOfSupportedStreams (i->second); + } } + } + for (uint8_t nss = 1; nss <= maxSpatialStream; nss++) + { + uint8_t maxMcs = 9; //TBD: hardcode to 9 for now since we assume all MCS values are supported operation.SetMaxVhtMcsPerNss (nss, maxMcs); } } @@ -696,7 +699,18 @@ ApWifiMac::GetHeOperation (void) const if (GetHeSupported ()) { operation.SetHeSupported (1); - for (uint8_t nss = 1; nss <= m_phy->GetMaxSupportedRxSpatialStreams (); nss++) + uint8_t maxSpatialStream = m_phy->GetMaxSupportedRxSpatialStreams (); + for (std::map::const_iterator i = m_staList.begin (); i != m_staList.end (); i++) + { + if (m_stationManager->GetHeSupported (i->second)) + { + if (m_stationManager->GetNumberOfSupportedStreams (i->second) < maxSpatialStream) + { + maxSpatialStream = m_stationManager->GetNumberOfSupportedStreams (i->second); + } + } + } + for (uint8_t nss = 1; nss <= maxSpatialStream; nss++) { operation.SetMaxHeMcsPerNss (nss, 11); //TBD: hardcode to 11 for now since we assume all MCS values are supported } diff --git a/src/wifi/model/wifi-remote-station-manager.cc b/src/wifi/model/wifi-remote-station-manager.cc index b45776114..21ac2100b 100644 --- a/src/wifi/model/wifi-remote-station-manager.cc +++ b/src/wifi/model/wifi-remote-station-manager.cc @@ -2215,6 +2215,12 @@ WifiRemoteStationManager::GetVhtSupported (Mac48Address address) const return LookupState (address)->m_vhtSupported; } +bool +WifiRemoteStationManager::GetHeSupported (Mac48Address address) const +{ + return LookupState (address)->m_heSupported; +} + void WifiRemoteStationManager::SetDefaultTxPowerLevel (uint8_t txPower) { diff --git a/src/wifi/model/wifi-remote-station-manager.h b/src/wifi/model/wifi-remote-station-manager.h index bdccd2149..eb11b57e5 100644 --- a/src/wifi/model/wifi-remote-station-manager.h +++ b/src/wifi/model/wifi-remote-station-manager.h @@ -485,6 +485,15 @@ public: * false otherwise */ bool GetVhtSupported (Mac48Address address) const; + /** + * Return whether the station supports HE or not. + * + * \param address the address of the station + * + * \return true if HE is supported by the station, + * false otherwise + */ + bool GetHeSupported (Mac48Address address) const; /** * Return a mode for non-unicast packets.