From 42472134c457cfef111e1240d7a8985db75b39bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deronne?= Date: Wed, 26 Jul 2023 20:55:17 +0200 Subject: [PATCH] wifi: Cleanup stored TX width from spectrum signal parameters --- src/wifi/model/he/he-phy.cc | 4 ++-- src/wifi/model/he/he-phy.h | 2 +- src/wifi/model/phy-entity.cc | 5 ++--- src/wifi/model/phy-entity.h | 3 +-- src/wifi/model/spectrum-wifi-phy.cc | 9 ++++----- src/wifi/model/spectrum-wifi-phy.h | 3 +-- src/wifi/model/wifi-spectrum-signal-parameters.cc | 6 ++---- src/wifi/model/wifi-spectrum-signal-parameters.h | 1 - src/wifi/test/spectrum-wifi-phy-test.cc | 1 - src/wifi/test/wifi-phy-ofdma-test.cc | 2 -- src/wifi/test/wifi-phy-reception-test.cc | 11 ++--------- src/wifi/test/wifi-phy-thresholds-test.cc | 1 - 12 files changed, 15 insertions(+), 33 deletions(-) diff --git a/src/wifi/model/he/he-phy.cc b/src/wifi/model/he/he-phy.cc index bb9189d8d..35476c44b 100644 --- a/src/wifi/model/he/he-phy.cc +++ b/src/wifi/model/he/he-phy.cc @@ -1779,7 +1779,7 @@ HePhy::GetMaxPsduSize() const } bool -HePhy::CanStartRx(Ptr ppdu, uint16_t txChannelWidth) const +HePhy::CanStartRx(Ptr ppdu) const { /* * The PHY shall not issue a PHY-RXSTART.indication primitive in response to a PPDU @@ -1794,7 +1794,7 @@ HePhy::CanStartRx(Ptr ppdu, uint16_t txChannelWidth) const { return true; } - return VhtPhy::CanStartRx(ppdu, txChannelWidth); + return VhtPhy::CanStartRx(ppdu); } Ptr diff --git a/src/wifi/model/he/he-phy.h b/src/wifi/model/he/he-phy.h index 6c942e828..a3ee418d7 100644 --- a/src/wifi/model/he/he-phy.h +++ b/src/wifi/model/he/he-phy.h @@ -116,7 +116,7 @@ class HePhy : public VhtPhy void NotifyCcaBusy(const Ptr ppdu, Time duration, WifiChannelListType channelType) override; - bool CanStartRx(Ptr ppdu, uint16_t txChannelWidth) const override; + bool CanStartRx(Ptr ppdu) const override; Ptr GetRxPpduFromTxPpdu(Ptr ppdu) override; /** diff --git a/src/wifi/model/phy-entity.cc b/src/wifi/model/phy-entity.cc index f24ab1db7..7f404cc2c 100644 --- a/src/wifi/model/phy-entity.cc +++ b/src/wifi/model/phy-entity.cc @@ -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 ppdu, uint16_t txChannelWidth) const +PhyEntity::CanStartRx(Ptr 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 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; diff --git a/src/wifi/model/phy-entity.h b/src/wifi/model/phy-entity.h index 395fb4fa7..593958453 100644 --- a/src/wifi/model/phy-entity.h +++ b/src/wifi/model/phy-entity.h @@ -458,11 +458,10 @@ class PhyEntity : public SimpleRefCount * 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 ppdu, uint16_t txChannelWidth) const; + virtual bool CanStartRx(Ptr ppdu) const; /** * Check if PHY state should move to CCA busy state based on current diff --git a/src/wifi/model/spectrum-wifi-phy.cc b/src/wifi/model/spectrum-wifi-phy.cc index ebed6f75a..16e58b34c 100644 --- a/src/wifi/model/spectrum-wifi-phy.cc +++ b/src/wifi/model/spectrum-wifi-phy.cc @@ -291,9 +291,9 @@ SpectrumWifiPhy::DoChannelSwitch() } bool -SpectrumWifiPhy::CanStartRx(Ptr ppdu, uint16_t txWidth) const +SpectrumWifiPhy::CanStartRx(Ptr ppdu) const { - return GetLatestPhyEntity()->CanStartRx(ppdu, txWidth); + return GetLatestPhyEntity()->CanStartRx(ppdu); } void @@ -405,9 +405,8 @@ SpectrumWifiPhy::StartRx(Ptr 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 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); diff --git a/src/wifi/model/spectrum-wifi-phy.h b/src/wifi/model/spectrum-wifi-phy.h index 62b711a25..d8e3d534b 100644 --- a/src/wifi/model/spectrum-wifi-phy.h +++ b/src/wifi/model/spectrum-wifi-phy.h @@ -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 ppdu, uint16_t txChannelWidth) const; + bool CanStartRx(Ptr ppdu) const; /** * Get the spectrum PHY interface that covers a band portion of the RF channel diff --git a/src/wifi/model/wifi-spectrum-signal-parameters.cc b/src/wifi/model/wifi-spectrum-signal-parameters.cc index 8a8109412..7523de4bc 100644 --- a/src/wifi/model/wifi-spectrum-signal-parameters.cc +++ b/src/wifi/model/wifi-spectrum-signal-parameters.cc @@ -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); } diff --git a/src/wifi/model/wifi-spectrum-signal-parameters.h b/src/wifi/model/wifi-spectrum-signal-parameters.h index b85f2f059..5a5411e8b 100644 --- a/src/wifi/model/wifi-spectrum-signal-parameters.h +++ b/src/wifi/model/wifi-spectrum-signal-parameters.h @@ -50,7 +50,6 @@ struct WifiSpectrumSignalParameters : public SpectrumSignalParameters WifiSpectrumSignalParameters(const WifiSpectrumSignalParameters& p); Ptr ppdu; ///< The PPDU being transmitted - uint16_t txWidth; ///< The TX width in MHz }; } // namespace ns3 diff --git a/src/wifi/test/spectrum-wifi-phy-test.cc b/src/wifi/test/spectrum-wifi-phy-test.cc index 57fd47a2b..b2e974be2 100644 --- a/src/wifi/test/spectrum-wifi-phy-test.cc +++ b/src/wifi/test/spectrum-wifi-phy-test.cc @@ -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; } diff --git a/src/wifi/test/wifi-phy-ofdma-test.cc b/src/wifi/test/wifi-phy-ofdma-test.cc index cc71f1f4a..7eab359ac 100644 --- a/src/wifi/test/wifi-phy-ofdma-test.cc +++ b/src/wifi/test/wifi-phy-ofdma-test.cc @@ -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, diff --git a/src/wifi/test/wifi-phy-reception-test.cc b/src/wifi/test/wifi-phy-reception-test.cc index 2bb77dfb5..a589eab6b 100644 --- a/src/wifi/test/wifi-phy-reception-test.cc +++ b/src/wifi/test/wifi-phy-reception-test.cc @@ -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") diff --git a/src/wifi/test/wifi-phy-thresholds-test.cc b/src/wifi/test/wifi-phy-thresholds-test.cc index db1fd63bf..5141e1c33 100644 --- a/src/wifi/test/wifi-phy-thresholds-test.cc +++ b/src/wifi/test/wifi-phy-thresholds-test.cc @@ -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; }