wifi: Cleanup stored TX width from spectrum signal parameters

This commit is contained in:
Sébastien Deronne
2023-07-26 20:55:17 +02:00
committed by Sébastien Deronne
parent 3034748f9a
commit 42472134c4
12 changed files with 15 additions and 33 deletions

View File

@@ -1779,7 +1779,7 @@ HePhy::GetMaxPsduSize() const
}
bool
HePhy::CanStartRx(Ptr<const WifiPpdu> ppdu, uint16_t txChannelWidth) const
HePhy::CanStartRx(Ptr<const WifiPpdu> ppdu) const
{
/*
* The PHY shall not issue a PHY-RXSTART.indication primitive in response to a PPDU
@@ -1794,7 +1794,7 @@ HePhy::CanStartRx(Ptr<const WifiPpdu> ppdu, uint16_t txChannelWidth) const
{
return true;
}
return VhtPhy::CanStartRx(ppdu, txChannelWidth);
return VhtPhy::CanStartRx(ppdu);
}
Ptr<const WifiPpdu>

View File

@@ -116,7 +116,7 @@ class HePhy : public VhtPhy
void NotifyCcaBusy(const Ptr<const WifiPpdu> ppdu,
Time duration,
WifiChannelListType channelType) override;
bool CanStartRx(Ptr<const WifiPpdu> ppdu, uint16_t txChannelWidth) const override;
bool CanStartRx(Ptr<const WifiPpdu> ppdu) const override;
Ptr<const WifiPpdu> GetRxPpduFromTxPpdu(Ptr<const WifiPpdu> ppdu) override;
/**

View File

@@ -1329,8 +1329,6 @@ PhyEntity::Transmit(Time txDuration,
txParams->duration = txDuration;
txParams->psd = txPowerSpectrum;
txParams->ppdu = ppdu;
txParams->txWidth = ppdu->GetTxVector().GetChannelWidth();
;
NS_LOG_DEBUG("Starting " << type << " with power " << txPowerDbm << " dBm on channel "
<< +m_wifiPhy->GetChannelNumber() << " for "
<< txParams->duration.As(Time::MS));
@@ -1365,7 +1363,7 @@ PhyEntity::CalculateTxDuration(WifiConstPsduMap psduMap,
}
bool
PhyEntity::CanStartRx(Ptr<const WifiPpdu> ppdu, uint16_t txChannelWidth) const
PhyEntity::CanStartRx(Ptr<const WifiPpdu> ppdu) const
{
// The PHY shall not issue a PHY-RXSTART.indication primitive in response to a PPDU that does
// not overlap the primary channel
@@ -1379,6 +1377,7 @@ PhyEntity::CanStartRx(Ptr<const WifiPpdu> ppdu, uint16_t txChannelWidth) const
const auto p20MinFreq = p20CenterFreq - (primaryWidth / 2);
const auto p20MaxFreq = p20CenterFreq + (primaryWidth / 2);
const auto txCenterFreq = ppdu->GetTxCenterFreq();
const auto txChannelWidth = ppdu->GetTxChannelWidth();
const auto minTxFreq = txCenterFreq - txChannelWidth / 2;
const auto maxTxFreq = txCenterFreq + txChannelWidth / 2;
return p20MinFreq >= minTxFreq && p20MaxFreq <= maxTxFreq;

View File

@@ -458,11 +458,10 @@ class PhyEntity : public SimpleRefCount<PhyEntity>
* given PPDU.
*
* \param ppdu the PPDU
* \param txChannelWidth the channel width (MHz) used to transmit the PPDU
* \return true if the PHY shall issue a PHY-RXSTART.indication primitive in response to a PPDU,
* false otherwise
*/
virtual bool CanStartRx(Ptr<const WifiPpdu> ppdu, uint16_t txChannelWidth) const;
virtual bool CanStartRx(Ptr<const WifiPpdu> ppdu) const;
/**
* Check if PHY state should move to CCA busy state based on current

View File

@@ -291,9 +291,9 @@ SpectrumWifiPhy::DoChannelSwitch()
}
bool
SpectrumWifiPhy::CanStartRx(Ptr<const WifiPpdu> ppdu, uint16_t txWidth) const
SpectrumWifiPhy::CanStartRx(Ptr<const WifiPpdu> ppdu) const
{
return GetLatestPhyEntity()->CanStartRx(ppdu, txWidth);
return GetLatestPhyEntity()->CanStartRx(ppdu);
}
void
@@ -405,9 +405,8 @@ SpectrumWifiPhy::StartRx(Ptr<SpectrumSignalParameters> rxParams,
// Do no further processing if signal is too weak
// Current implementation assumes constant RX power over the PPDU duration
// Compare received TX power per MHz to normalized RX sensitivity
const auto txWidth = wifiRxParams->txWidth;
const auto& ppdu = GetRxPpduFromTxPpdu(wifiRxParams->ppdu);
if (totalRxPowerW < DbmToW(GetRxSensitivity()) * (txWidth / 20.0))
if (totalRxPowerW < DbmToW(GetRxSensitivity()) * (ppdu->GetTxChannelWidth() / 20.0))
{
NS_LOG_INFO("Received signal too weak to process: " << WToDbm(totalRxPowerW) << " dBm");
m_interference->Add(ppdu, rxDuration, rxPowerW);
@@ -417,7 +416,7 @@ SpectrumWifiPhy::StartRx(Ptr<SpectrumSignalParameters> rxParams,
if (wifiRxParams->txPhy)
{
if (!CanStartRx(ppdu, txWidth))
if (!CanStartRx(ppdu))
{
NS_LOG_INFO("Cannot start reception of the PPDU, consider it as interference");
m_interference->Add(ppdu, rxDuration, rxPowerW);

View File

@@ -186,11 +186,10 @@ class SpectrumWifiPhy : public WifiPhy
* given PPDU.
*
* \param ppdu the PPDU
* \param txChannelWidth the channel width (MHz) used to transmit the PPDU
* \return true if the PHY shall issue a PHY-RXSTART.indication primitive in response to a PPDU,
* false otherwise
*/
bool CanStartRx(Ptr<const WifiPpdu> ppdu, uint16_t txChannelWidth) const;
bool CanStartRx(Ptr<const WifiPpdu> ppdu) const;
/**
* Get the spectrum PHY interface that covers a band portion of the RF channel

View File

@@ -31,16 +31,14 @@ NS_LOG_COMPONENT_DEFINE("WifiSpectrumSignalParameters");
WifiSpectrumSignalParameters::WifiSpectrumSignalParameters()
: SpectrumSignalParameters(),
ppdu(nullptr),
txWidth(0)
ppdu(nullptr)
{
NS_LOG_FUNCTION(this);
}
WifiSpectrumSignalParameters::WifiSpectrumSignalParameters(const WifiSpectrumSignalParameters& p)
: SpectrumSignalParameters(p),
ppdu(p.ppdu),
txWidth(p.txWidth)
ppdu(p.ppdu)
{
NS_LOG_FUNCTION(this << &p);
}

View File

@@ -50,7 +50,6 @@ struct WifiSpectrumSignalParameters : public SpectrumSignalParameters
WifiSpectrumSignalParameters(const WifiSpectrumSignalParameters& p);
Ptr<const WifiPpdu> ppdu; ///< The PPDU being transmitted
uint16_t txWidth; ///< The TX width in MHz
};
} // namespace ns3

View File

@@ -213,7 +213,6 @@ SpectrumWifiPhyBasicTest::MakeSignal(double txPowerWatts, const WifiPhyOperating
txParams->txPhy = nullptr;
txParams->duration = txDuration;
txParams->ppdu = ppdu;
txParams->txWidth = CHANNEL_WIDTH;
return txParams;
}

View File

@@ -2444,7 +2444,6 @@ TestMultipleHeTbPreambles::RxHeTbPpdu(uint64_t uid,
rxParams->txPhy = nullptr;
rxParams->duration = nonOfdmaDuration;
rxParams->ppdu = ppdu;
rxParams->txWidth = channelWidth;
uint16_t length;
std::tie(length, ppduDuration) =
@@ -2471,7 +2470,6 @@ TestMultipleHeTbPreambles::RxHeTbPpdu(uint64_t uid,
rxParamsOfdma->txPhy = nullptr;
rxParamsOfdma->duration = ppduDuration - nonOfdmaDuration;
rxParamsOfdma->ppdu = ppduOfdma;
rxParamsOfdma->txWidth = DEFAULT_CHANNEL_WIDTH;
Simulator::Schedule(nonOfdmaDuration,
&TestMultipleHeTbPreambles::RxHeTbPpduOfdmaPart,
this,

View File

@@ -145,7 +145,6 @@ WifiPhyReceptionTest::SendPacket(double rxPowerDbm, uint32_t packetSize, uint8_t
txParams->txPhy = nullptr;
txParams->duration = txDuration;
txParams->ppdu = ppdu;
txParams->txWidth = CHANNEL_WIDTH;
m_phy->StartRx(txParams, nullptr);
}
@@ -2805,7 +2804,6 @@ TestAmpduReception::SendAmpduWithThreeMpdus(double rxPowerDbm, uint32_t referenc
txParams->txPhy = nullptr;
txParams->duration = txDuration;
txParams->ppdu = ppdu;
txParams->txWidth = CHANNEL_WIDTH;
m_phy->StartRx(txParams, nullptr);
}
@@ -4328,7 +4326,6 @@ TestUnsupportedBandwidthReception::SendPpdu(uint16_t centerFreqMhz, uint16_t ban
txParams->txPhy = nullptr;
txParams->duration = txDuration;
txParams->ppdu = ppdu;
txParams->txWidth = bandwidthMhz;
m_rxPhy->StartRx(txParams, nullptr);
}
@@ -4619,12 +4616,8 @@ TestPrimary20CoveredByPpdu::RunOne(WifiPhyBand band,
"PPDU is " << (expectedP20Overlap ? "expected" : "not expected")
<< " to overlap with the P20");
auto p20Covered =
m_rxPhy->GetPhyEntity(WIFI_STANDARD_80211ax)
->CanStartRx(
ppdu,
ppdu->GetTxVector()
.GetChannelWidth()); // CanStartRx returns true is the P20 is fully covered
auto p20Covered = m_rxPhy->GetPhyEntity(WIFI_STANDARD_80211ax)
->CanStartRx(ppdu); // CanStartRx returns true is the P20 is fully covered
NS_TEST_ASSERT_MSG_EQ(p20Covered,
expectedP20Covered,
"PPDU is " << (expectedP20Covered ? "expected" : "not expected")

View File

@@ -179,7 +179,6 @@ WifiPhyThresholdsTest::MakeWifiSignal(double txPowerWatts, const WifiPhyOperatin
txParams->txPhy = nullptr;
txParams->duration = txDuration;
txParams->ppdu = ppdu;
txParams->txWidth = CHANNEL_WIDTH;
return txParams;
}