From b4e34135e96e804c468ec7c59ccad5e45f065d2c Mon Sep 17 00:00:00 2001 From: Getachew Redieteab Date: Wed, 14 Jun 2017 22:49:53 +0200 Subject: [PATCH] wifi: HtCapabilities/VhtCapabilities/HeCapabilities subfield binary coding changes --- src/wifi/model/ht-capabilities.cc | 10 ++++++++-- src/wifi/model/ht-capabilities.h | 6 ++++++ src/wifi/model/regular-wifi-mac.cc | 32 ++++++++++++++++++++++++------ src/wifi/model/vht-capabilities.cc | 5 +++++ 4 files changed, 45 insertions(+), 8 deletions(-) diff --git a/src/wifi/model/ht-capabilities.cc b/src/wifi/model/ht-capabilities.cc index ff983544d..1c3fab7e9 100644 --- a/src/wifi/model/ht-capabilities.cc +++ b/src/wifi/model/ht-capabilities.cc @@ -179,7 +179,7 @@ HtCapabilities::SetTxRxMcsSetUnequal (uint8_t txrxmcssetunequal) void HtCapabilities::SetTxMaxNSpatialStreams (uint8_t maxtxspatialstreams) { - m_txMaxNSpatialStreams = maxtxspatialstreams; + m_txMaxNSpatialStreams = maxtxspatialstreams - 1; //0 for 1 SS, 1 for 2 SSs, etc } void @@ -236,6 +236,12 @@ HtCapabilities::GetMaxAmpduLength (void) const return m_maxAmpduLength; } +uint8_t +HtCapabilities::GetMinMpduStartSpace (void) const +{ + return m_minMpduStartSpace; +} + uint8_t* HtCapabilities::GetRxMcsBitmask () { @@ -292,7 +298,7 @@ HtCapabilities::GetTxRxMcsSetUnequal (void) const uint8_t HtCapabilities::GetTxMaxNSpatialStreams (void) const { - return m_txMaxNSpatialStreams; + return m_txMaxNSpatialStreams; //0 for 1 SS, 1 for 2 SSs, etc } uint8_t diff --git a/src/wifi/model/ht-capabilities.h b/src/wifi/model/ht-capabilities.h index ebd7a8f92..c4649039d 100644 --- a/src/wifi/model/ht-capabilities.h +++ b/src/wifi/model/ht-capabilities.h @@ -268,6 +268,12 @@ public: * \return the maximum AMPDU length */ uint8_t GetMaxAmpduLength (void) const; + /** + * Return the minimum MPDU start space. + * + * \return the minimum MPDU start space + */ + uint8_t GetMinMpduStartSpace (void) const; /** * Return the receive MCS bitmask. diff --git a/src/wifi/model/regular-wifi-mac.cc b/src/wifi/model/regular-wifi-mac.cc index c1753d502..eb28e62c2 100644 --- a/src/wifi/model/regular-wifi-mac.cc +++ b/src/wifi/model/regular-wifi-mac.cc @@ -111,7 +111,7 @@ RegularWifiMac::DoDispose () i->second->Dispose (); i->second = 0; } - + delete m_dcfManager; m_dcfManager = 0; } @@ -154,9 +154,16 @@ RegularWifiMac::GetHtCapabilities (void) const capabilities.SetShortGuardInterval20 (m_phy->GetShortGuardInterval ()); capabilities.SetShortGuardInterval40 (m_phy->GetChannelWidth () >= 40 && m_phy->GetShortGuardInterval ()); capabilities.SetGreenfield (m_phy->GetGreenfield ()); - capabilities.SetMaxAmsduLength (1); //hardcoded for now (TBD) + uint32_t maxAmsduLength = std::max (std::max (m_beMaxAmsduSize, m_bkMaxAmsduSize), std::max (m_voMaxAmsduSize, m_viMaxAmsduSize)); + capabilities.SetMaxAmsduLength (maxAmsduLength > 3839); //0 if 3839 and 1 if 7935 capabilities.SetLSigProtectionSupport (!m_phy->GetGreenfield ()); - capabilities.SetMaxAmpduLength (3); //hardcoded for now (TBD) + double maxAmpduLengthExponent = std::max (std::ceil ((std::log (std::max (std::max (m_beMaxAmpduSize, m_bkMaxAmpduSize), std::max (m_voMaxAmpduSize, m_viMaxAmpduSize)) + + 1.0) + / std::log (2.0)) + - 13.0), + 0.0); + NS_ASSERT (maxAmpduLengthExponent >= 0 && maxAmpduLengthExponent <= 255); + capabilities.SetMaxAmpduLength (std::max (3, static_cast (maxAmpduLengthExponent))); //0 to 3 for HT uint64_t maxSupportedRate = 0; //in bit/s for (uint8_t i = 0; i < m_phy->GetNMcs (); i++) { @@ -198,11 +205,18 @@ RegularWifiMac::GetVhtCapabilities (void) const { capabilities.SetSupportedChannelWidthSet (0); } - capabilities.SetMaxMpduLength (2); //hardcoded for now (TBD) + uint32_t maxMpduLength = std::max (std::max (m_beMaxAmsduSize, m_bkMaxAmsduSize), std::max (m_voMaxAmsduSize, m_viMaxAmsduSize)) + 56; //see section 9.11 of 11ac standard + capabilities.SetMaxMpduLength (uint8_t (maxMpduLength > 3895) + uint8_t (maxMpduLength > 7991)); //0 if 3895, 1 if 7991, 2 for 11454 capabilities.SetRxLdpc (m_phy->GetLdpc ()); capabilities.SetShortGuardIntervalFor80Mhz ((m_phy->GetChannelWidth () == 80) && m_phy->GetShortGuardInterval ()); capabilities.SetShortGuardIntervalFor160Mhz ((m_phy->GetChannelWidth () == 160) && m_phy->GetShortGuardInterval ()); - capabilities.SetMaxAmpduLengthExponent (7); //hardcoded for now (TBD) + double maxAmpduLengthExponent = std::max (std::ceil ((std::log (std::max (std::max (m_beMaxAmpduSize, m_bkMaxAmpduSize), std::max (m_voMaxAmpduSize, m_viMaxAmpduSize)) + + 1.0) + / std::log (2.0)) + - 13.0), + 0.0); + NS_ASSERT (maxAmpduLengthExponent >= 0 && maxAmpduLengthExponent <= 255); + capabilities.SetMaxAmpduLengthExponent (std::max (7, static_cast (maxAmpduLengthExponent))); //0 to 7 for VHT uint8_t maxMcs = 0; for (uint8_t i = 0; i < m_phy->GetNMcs (); i++) { @@ -274,7 +288,13 @@ RegularWifiMac::GetHeCapabilities (void) const gi |= 0x02; } capabilities.SetHeLtfAndGiForHePpdus (gi); - capabilities.SetMaxAmpduLengthExponent (7); //hardcoded for now (TBD) + double maxAmpduLengthExponent = std::max (std::ceil ((std::log (std::max (std::max (m_beMaxAmpduSize, m_bkMaxAmpduSize), std::max (m_voMaxAmpduSize, m_viMaxAmpduSize)) + + 1.0) + / std::log (2.0)) + - 13.0), + 0.0); + NS_ASSERT (maxAmpduLengthExponent >= 0 && maxAmpduLengthExponent <= 255); + capabilities.SetMaxAmpduLengthExponent (std::max (7, static_cast (maxAmpduLengthExponent))); //assume 0 to 7 for HE uint8_t maxMcs = 0; for (uint8_t i = 0; i < m_phy->GetNMcs (); i++) { diff --git a/src/wifi/model/vht-capabilities.cc b/src/wifi/model/vht-capabilities.cc index e09edc319..0574862a1 100644 --- a/src/wifi/model/vht-capabilities.cc +++ b/src/wifi/model/vht-capabilities.cc @@ -49,6 +49,11 @@ VhtCapabilities::VhtCapabilities () { m_rxMcsMap.resize (8,0); m_txMcsMap.resize (8,0); + for (uint8_t i = 0; i < 8; i++) //set to 3 by default, i.e. #spatial streams not supported. 0 means supported up to MCS 7, not what we want to imply at this stage. + { + m_rxMcsMap[i] = 3; + m_txMcsMap[i] = 3; + } } WifiInformationElementId