diff --git a/src/wifi/model/rate-control/constant-rate-wifi-manager.cc b/src/wifi/model/rate-control/constant-rate-wifi-manager.cc index 928d1701b..b80d3b33d 100644 --- a/src/wifi/model/rate-control/constant-rate-wifi-manager.cc +++ b/src/wifi/model/rate-control/constant-rate-wifi-manager.cc @@ -25,7 +25,7 @@ #include "ns3/wifi-tx-vector.h" #include "ns3/wifi-utils.h" -#define Min(a, b) ((a < b) ? a : b) +#include namespace ns3 { @@ -127,7 +127,7 @@ WifiTxVector ConstantRateWifiManager::DoGetDataTxVector(WifiRemoteStation* st, uint16_t allowedWidth) { NS_LOG_FUNCTION(this << st << allowedWidth); - uint8_t nss = Min(GetMaxNumberOfTransmitStreams(), GetNumberOfSupportedStreams(st)); + uint8_t nss = std::min(GetMaxNumberOfTransmitStreams(), GetNumberOfSupportedStreams(st)); if (m_dataMode.GetModulationClass() == WIFI_MOD_CLASS_HT) { nss = 1 + (m_dataMode.GetMcsValue() / 8); @@ -142,7 +142,7 @@ ConstantRateWifiManager::DoGetDataTxVector(WifiRemoteStation* st, uint16_t allow GetNumberOfAntennas(), nss, 0, - GetChannelWidthForTransmission(m_dataMode, allowedWidth, GetChannelWidth(st)), + GetPhy()->GetTxBandwidth(m_dataMode, std::min(allowedWidth, GetChannelWidth(st))), GetAggregation(st)); } @@ -160,7 +160,7 @@ ConstantRateWifiManager::DoGetRtsTxVector(WifiRemoteStation* st) 1, 1, 0, - GetChannelWidthForTransmission(m_ctlMode, GetPhy()->GetChannelWidth(), GetChannelWidth(st)), + GetPhy()->GetTxBandwidth(m_ctlMode, GetChannelWidth(st)), GetAggregation(st)); } diff --git a/src/wifi/model/rate-control/ideal-wifi-manager.cc b/src/wifi/model/rate-control/ideal-wifi-manager.cc index 47498916a..17ecfd23c 100644 --- a/src/wifi/model/rate-control/ideal-wifi-manager.cc +++ b/src/wifi/model/rate-control/ideal-wifi-manager.cc @@ -571,7 +571,7 @@ IdealWifiManager::DoGetDataTxVector(WifiRemoteStation* st, uint16_t allowedWidth GetNumberOfAntennas(), selectedNss, 0, - GetChannelWidthForTransmission(maxMode, channelWidth), + GetPhy()->GetTxBandwidth(maxMode, channelWidth), GetAggregation(station)}; uint64_t maxDataRate = maxMode.GetDataRate(bestTxVector); if (m_currentRate != maxDataRate) diff --git a/src/wifi/model/rate-control/minstrel-ht-wifi-manager.cc b/src/wifi/model/rate-control/minstrel-ht-wifi-manager.cc index 4682d4236..9086ee810 100644 --- a/src/wifi/model/rate-control/minstrel-ht-wifi-manager.cc +++ b/src/wifi/model/rate-control/minstrel-ht-wifi-manager.cc @@ -1091,7 +1091,7 @@ MinstrelHtWifiManager::DoGetDataTxVector(WifiRemoteStation* st, uint16_t allowed GetNumberOfAntennas(), group.streams, GetNess(station), - GetChannelWidthForTransmission(mode, group.chWidth), + GetPhy()->GetTxBandwidth(mode, group.chWidth), GetAggregation(station) && !station->m_isSampling}; uint64_t dataRate = mode.GetDataRate(txVector); if (m_currentRate != dataRate && !station->m_isSampling) @@ -1181,9 +1181,7 @@ MinstrelHtWifiManager::DoGetRtsTxVector(WifiRemoteStation* st) 1, 1, 0, - GetChannelWidthForTransmission(rtsRate, - GetPhy()->GetChannelWidth(), - GetChannelWidth(station)), + GetPhy()->GetTxBandwidth(rtsRate, GetChannelWidth(station)), GetAggregation(station)); } } diff --git a/src/wifi/model/rate-control/thompson-sampling-wifi-manager.cc b/src/wifi/model/rate-control/thompson-sampling-wifi-manager.cc index a85d0ca9f..7da0ee9e8 100644 --- a/src/wifi/model/rate-control/thompson-sampling-wifi-manager.cc +++ b/src/wifi/model/rate-control/thompson-sampling-wifi-manager.cc @@ -350,7 +350,7 @@ ThompsonSamplingWifiManager::DoGetDataTxVector(WifiRemoteStation* st, uint16_t a GetNumberOfAntennas(), nss, 0, // NESS - GetChannelWidthForTransmission(mode, channelWidth), + GetPhy()->GetTxBandwidth(mode, channelWidth), GetAggregation(station), false); } @@ -365,7 +365,6 @@ ThompsonSamplingWifiManager::DoGetRtsTxVector(WifiRemoteStation* st) // Use the most robust MCS for the control channel. auto& stats = station->m_mcsStats.at(0); WifiMode mode = stats.mode; - uint16_t channelWidth = std::min(stats.channelWidth, GetPhy()->GetChannelWidth()); uint8_t nss = stats.nss; // Make sure control frames are sent using 1 spatial stream. @@ -379,7 +378,7 @@ ThompsonSamplingWifiManager::DoGetRtsTxVector(WifiRemoteStation* st) GetNumberOfAntennas(), nss, 0, // NESS - GetChannelWidthForTransmission(mode, channelWidth), + GetPhy()->GetTxBandwidth(mode, stats.channelWidth), GetAggregation(station), false); } diff --git a/src/wifi/model/wifi-remote-station-manager.cc b/src/wifi/model/wifi-remote-station-manager.cc index 3c7d8907e..0d5a69e14 100644 --- a/src/wifi/model/wifi-remote-station-manager.cc +++ b/src/wifi/model/wifi-remote-station-manager.cc @@ -598,7 +598,7 @@ WifiRemoteStationManager::GetDataTxVector(const WifiMacHeader& header, uint16_t v.SetPreambleType( GetPreambleForTransmission(mode.GetModulationClass(), GetShortPreambleEnabled())); v.SetTxPowerLevel(m_defaultTxPowerLevel); - v.SetChannelWidth(GetChannelWidthForTransmission(mode, allowedWidth)); + v.SetChannelWidth(m_wifiPhy->GetTxBandwidth(mode, allowedWidth)); v.SetGuardInterval(ConvertGuardIntervalToNanoSeconds(mode, m_wifiPhy->GetDevice())); v.SetNTx(GetNumberOfAntennas()); v.SetNss(1); @@ -632,7 +632,7 @@ WifiRemoteStationManager::GetDataTxVector(const WifiMacHeader& header, uint16_t } } - txVector.SetChannelWidth(GetChannelWidthForTransmission(mgtMode, channelWidth)); + txVector.SetChannelWidth(m_wifiPhy->GetTxBandwidth(mgtMode, channelWidth)); txVector.SetGuardInterval( ConvertGuardIntervalToNanoSeconds(mgtMode, m_wifiPhy->GetDevice())); } @@ -691,7 +691,7 @@ WifiRemoteStationManager::GetCtsToSelfTxVector() GetNumberOfAntennas(), 1, 0, - GetChannelWidthForTransmission(defaultMode, m_wifiPhy->GetChannelWidth()), + m_wifiPhy->GetTxBandwidth(defaultMode), false); } @@ -707,7 +707,7 @@ WifiRemoteStationManager::GetRtsTxVector(Mac48Address address) v.SetPreambleType( GetPreambleForTransmission(mode.GetModulationClass(), GetShortPreambleEnabled())); v.SetTxPowerLevel(m_defaultTxPowerLevel); - v.SetChannelWidth(GetChannelWidthForTransmission(mode, m_wifiPhy->GetChannelWidth())); + v.SetChannelWidth(m_wifiPhy->GetTxBandwidth(mode)); v.SetGuardInterval(ConvertGuardIntervalToNanoSeconds(mode, m_wifiPhy->GetDevice())); v.SetNTx(GetNumberOfAntennas()); v.SetNss(1); @@ -727,7 +727,7 @@ WifiRemoteStationManager::GetCtsTxVector(Mac48Address to, WifiMode rtsTxMode) co v.SetPreambleType( GetPreambleForTransmission(ctsMode.GetModulationClass(), GetShortPreambleEnabled())); v.SetTxPowerLevel(GetDefaultTxPowerLevel()); - v.SetChannelWidth(GetChannelWidthForTransmission(ctsMode, m_wifiPhy->GetChannelWidth())); + v.SetChannelWidth(m_wifiPhy->GetTxBandwidth(ctsMode)); uint16_t ctsTxGuardInterval = ConvertGuardIntervalToNanoSeconds(ctsMode, m_wifiPhy->GetDevice()); v.SetGuardInterval(ctsTxGuardInterval); @@ -745,7 +745,7 @@ WifiRemoteStationManager::GetAckTxVector(Mac48Address to, const WifiTxVector& da v.SetPreambleType( GetPreambleForTransmission(ackMode.GetModulationClass(), GetShortPreambleEnabled())); v.SetTxPowerLevel(GetDefaultTxPowerLevel()); - v.SetChannelWidth(GetChannelWidthForTransmission(ackMode, m_wifiPhy->GetChannelWidth())); + v.SetChannelWidth(m_wifiPhy->GetTxBandwidth(ackMode)); uint16_t ackTxGuardInterval = ConvertGuardIntervalToNanoSeconds(ackMode, m_wifiPhy->GetDevice()); v.SetGuardInterval(ackTxGuardInterval); @@ -764,7 +764,7 @@ WifiRemoteStationManager::GetBlockAckTxVector(Mac48Address to, v.SetPreambleType( GetPreambleForTransmission(blockAckMode.GetModulationClass(), GetShortPreambleEnabled())); v.SetTxPowerLevel(GetDefaultTxPowerLevel()); - v.SetChannelWidth(GetChannelWidthForTransmission(blockAckMode, m_wifiPhy->GetChannelWidth())); + v.SetChannelWidth(m_wifiPhy->GetTxBandwidth(blockAckMode)); uint16_t blockAckTxGuardInterval = ConvertGuardIntervalToNanoSeconds(blockAckMode, m_wifiPhy->GetDevice()); v.SetGuardInterval(blockAckTxGuardInterval);