wifi: Fix valgrind issues with Tx power computation

Two root causes: uninitialized WifiPhy::m_powerRestricted and WifiTxVector::m_powerLevel
This commit is contained in:
Rediet
2020-03-04 10:51:19 +01:00
committed by Tom Henderson
parent 6a2d9d1bed
commit b278e6be20
6 changed files with 8 additions and 3 deletions

View File

@@ -394,6 +394,7 @@ WifiPhy::WifiPhy ()
m_initialFrequency (0),
m_frequencyChannelNumberInitialized (false),
m_channelWidth (0),
m_powerRestricted (false),
m_channelAccessRequested (false),
m_txSpatialStreams (0),
m_rxSpatialStreams (0),

View File

@@ -1964,7 +1964,7 @@ private:
bool m_powerRestricted; //!< Flag whether transmit power is restricted by OBSS PD SR
double m_txPowerMaxSiso; //!< SISO maximum transmit power due to OBSS PD SR power restriction
double m_txPowerMaxMimo; //!< MIMO maximum transmit power due to OBSS PD SR power restriction
bool m_channelAccessRequested; //!< Flag if channels access has been requestd (used for OBSS_PD SR)
bool m_channelAccessRequested; //!< Flag if channels access has been requested (used for OBSS_PD SR)
bool m_greenfield; //!< Flag if GreenField format is supported (deprecated)
bool m_shortGuardInterval; //!< Flag if HT/VHT short guard interval is supported (deprecated)

View File

@@ -35,7 +35,8 @@ WifiPpdu::WifiPpdu (Ptr<const WifiPsdu> psdu, WifiTxVector txVector, Time ppduDu
m_psdu (psdu),
m_truncatedTx (false),
m_frequency (frequency),
m_channelWidth (txVector.GetChannelWidth ())
m_channelWidth (txVector.GetChannelWidth ()),
m_txPowerLevel (txVector.GetTxPowerLevel ())
{
NS_LOG_FUNCTION (this << psdu << txVector << ppduDuration << frequency);
if (!txVector.IsValid ())
@@ -502,6 +503,7 @@ WifiPpdu::GetTxVector (void) const
NS_FATAL_ERROR ("unsupported modulation class");
break;
}
txVector.SetTxPowerLevel (m_txPowerLevel);
return txVector;
}

View File

@@ -94,6 +94,7 @@ private:
bool m_truncatedTx; //!< flag indicating whether the frame's transmission was aborted due to transmitter switch off
uint16_t m_frequency; //!< the frequency used to transmit that PPDU
uint16_t m_channelWidth; //!< the channel width used to transmit that PPDU
uint8_t m_txPowerLevel; //!< the transmission power level (used only for Tx and initializing the returned WifiTxVector)
};
/**

View File

@@ -582,6 +582,7 @@ WifiRemoteStationManager::GetDataTxVector (Mac48Address address, const WifiMacHe
}
txVector.SetMode (mgtMode);
txVector.SetPreambleType (GetPreambleForTransmission (mgtMode.GetModulationClass (), GetShortPreambleEnabled (), UseGreenfieldForDestination (address)));
txVector.SetTxPowerLevel (m_defaultTxPowerLevel);
txVector.SetChannelWidth (GetChannelWidthForTransmission (mgtMode, m_wifiPhy->GetChannelWidth ()));
txVector.SetGuardInterval (ConvertGuardIntervalToNanoSeconds (mgtMode, DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ())));
}

View File

@@ -1326,7 +1326,7 @@ private:
uint32_t m_rtsCtsThreshold; //!< Threshold for RTS/CTS
uint32_t m_fragmentationThreshold; //!< Current threshold for fragmentation
uint32_t m_nextFragmentationThreshold; //!< Threshold for fragmentation that will be used for the next transmission
uint8_t m_defaultTxPowerLevel; //!< Default tranmission power level
uint8_t m_defaultTxPowerLevel; //!< Default transmission power level
WifiMode m_nonUnicastMode; //!< Transmission mode for non-unicast DATA frames
bool m_useNonErpProtection; //!< flag if protection for non-ERP stations against ERP transmissions is enabled
bool m_useNonHtProtection; //!< flag if protection for non-HT stations against HT transmissions is enabled