wifi: Avoid copying WifiPpdu in YansWifiChannel::Send()
This commit is contained in:
committed by
Stefano Avallone
parent
c95370fb9d
commit
59e05f030e
@@ -347,12 +347,12 @@ HePhy::BuildPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector,
|
||||
}
|
||||
|
||||
void
|
||||
HePhy::StartReceivePreamble (Ptr<WifiPpdu> ppdu, RxPowerWattPerChannelBand& rxPowersW,
|
||||
HePhy::StartReceivePreamble (Ptr<const WifiPpdu> ppdu, RxPowerWattPerChannelBand& rxPowersW,
|
||||
Time rxDuration)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << ppdu << rxDuration);
|
||||
const WifiTxVector& txVector = ppdu->GetTxVector ();
|
||||
auto hePpdu = DynamicCast<HePpdu> (ppdu);
|
||||
auto hePpdu = DynamicCast<const HePpdu> (ppdu);
|
||||
NS_ASSERT (hePpdu);
|
||||
HePpdu::TxPsdFlag psdFlag = hePpdu->GetTxPsdFlag ();
|
||||
if (txVector.IsUlMu () && psdFlag == HePpdu::PSD_HE_TB_OFDMA_PORTION)
|
||||
@@ -1033,7 +1033,7 @@ HePhy::GetCenterFrequencyForNonOfdmaPart (const WifiTxVector& txVector, uint16_t
|
||||
}
|
||||
|
||||
void
|
||||
HePhy::StartTx (Ptr<WifiPpdu> ppdu)
|
||||
HePhy::StartTx (Ptr<const WifiPpdu> ppdu)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << ppdu);
|
||||
if (ppdu->GetType () == WIFI_PPDU_TYPE_UL_MU)
|
||||
|
||||
@@ -93,13 +93,13 @@ public:
|
||||
const WifiTxVector& txVector,
|
||||
Time ppduDuration) override;
|
||||
Ptr<const WifiPsdu> GetAddressedPsduInPpdu (Ptr<const WifiPpdu> ppdu) const override;
|
||||
void StartReceivePreamble (Ptr<WifiPpdu> ppdu,
|
||||
void StartReceivePreamble (Ptr<const WifiPpdu> ppdu,
|
||||
RxPowerWattPerChannelBand& rxPowersW,
|
||||
Time rxDuration) override;
|
||||
void CancelAllEvents (void) override;
|
||||
uint16_t GetStaId (const Ptr<const WifiPpdu> ppdu) const override;
|
||||
uint16_t GetMeasurementChannelWidth (const Ptr<const WifiPpdu> ppdu) const override;
|
||||
void StartTx (Ptr<WifiPpdu> ppdu) override;
|
||||
void StartTx (Ptr<const WifiPpdu> ppdu) override;
|
||||
Time CalculateTxDuration (WifiConstPsduMap psduMap, const WifiTxVector& txVector, WifiPhyBand band) const override;
|
||||
|
||||
/**
|
||||
|
||||
@@ -361,7 +361,7 @@ PhyEntity::DoEndReceiveField (WifiPpduField field, Ptr<Event> event)
|
||||
}
|
||||
|
||||
void
|
||||
PhyEntity::StartReceivePreamble (Ptr<WifiPpdu> ppdu, RxPowerWattPerChannelBand& rxPowersW,
|
||||
PhyEntity::StartReceivePreamble (Ptr<const WifiPpdu> ppdu, RxPowerWattPerChannelBand& rxPowersW,
|
||||
Time rxDuration)
|
||||
{
|
||||
//The total RX power corresponds to the maximum over all the bands
|
||||
@@ -1062,14 +1062,14 @@ PhyEntity::NotifyPayloadBegin (const WifiTxVector& txVector, const Time& payload
|
||||
}
|
||||
|
||||
void
|
||||
PhyEntity::StartTx (Ptr<WifiPpdu> ppdu)
|
||||
PhyEntity::StartTx (Ptr<const WifiPpdu> ppdu)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << ppdu);
|
||||
Transmit (ppdu->GetTxDuration (), ppdu, "transmission");
|
||||
}
|
||||
|
||||
void
|
||||
PhyEntity::Transmit (Time txDuration, Ptr<WifiPpdu> ppdu, std::string type)
|
||||
PhyEntity::Transmit (Time txDuration, Ptr<const WifiPpdu> ppdu, std::string type)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << txDuration << ppdu << type);
|
||||
double txPowerWatts = DbmToW (m_wifiPhy->GetTxPowerForTransmission (ppdu) + m_wifiPhy->GetTxGain ());
|
||||
|
||||
@@ -358,8 +358,8 @@ public:
|
||||
* \param rxPowersW the receive power in W per band
|
||||
* \param rxDuration the duration of the PPDU
|
||||
*/
|
||||
virtual void StartReceivePreamble (Ptr<WifiPpdu> ppdu, RxPowerWattPerChannelBand& rxPowersW,
|
||||
Time rxDuration);
|
||||
virtual void StartReceivePreamble (Ptr<const WifiPpdu> ppdu, RxPowerWattPerChannelBand& rxPowersW,
|
||||
Time rxDuration);
|
||||
/**
|
||||
* Start receiving a given field.
|
||||
*
|
||||
@@ -447,7 +447,7 @@ public:
|
||||
*
|
||||
* \param ppdu the PPDU to send
|
||||
*/
|
||||
virtual void StartTx (Ptr<WifiPpdu> ppdu);
|
||||
virtual void StartTx (Ptr<const WifiPpdu> ppdu);
|
||||
|
||||
/**
|
||||
* This function prepares most of the WifiSpectrumSignalParameters
|
||||
@@ -458,7 +458,7 @@ public:
|
||||
* \param ppdu the PPDU to send
|
||||
* \param type the type of transmission (for logging)
|
||||
*/
|
||||
void Transmit (Time txDuration, Ptr<WifiPpdu> ppdu, std::string type);
|
||||
void Transmit (Time txDuration, Ptr<const WifiPpdu> ppdu, std::string type);
|
||||
|
||||
/**
|
||||
* \param psduMap the PSDU(s) to transmit indexed by STA-ID
|
||||
|
||||
@@ -402,7 +402,7 @@ SpectrumWifiPhy::CreateWifiSpectrumPhyInterface (Ptr<NetDevice> device)
|
||||
}
|
||||
|
||||
void
|
||||
SpectrumWifiPhy::StartTx (Ptr<WifiPpdu> ppdu)
|
||||
SpectrumWifiPhy::StartTx (Ptr<const WifiPpdu> ppdu)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << ppdu);
|
||||
GetPhyEntity (ppdu->GetModulation ())->StartTx (ppdu);
|
||||
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
virtual ~SpectrumWifiPhy ();
|
||||
|
||||
// Implementation of pure virtual method.
|
||||
void StartTx (Ptr<WifiPpdu> ppdu) override;
|
||||
void StartTx (Ptr<const WifiPpdu> ppdu) override;
|
||||
Ptr<Channel> GetChannel (void) const override;
|
||||
uint16_t GetGuardBandwidth (uint16_t currentChannelWidth) const override;
|
||||
std::tuple<double, double, double> GetTxMaskRejectionParams (void) const override;
|
||||
|
||||
@@ -1634,7 +1634,7 @@ WifiPhy::Reset (void)
|
||||
}
|
||||
|
||||
void
|
||||
WifiPhy::StartReceivePreamble (Ptr<WifiPpdu> ppdu, RxPowerWattPerChannelBand& rxPowersW, Time rxDuration)
|
||||
WifiPhy::StartReceivePreamble (Ptr<const WifiPpdu> ppdu, RxPowerWattPerChannelBand& rxPowersW, Time rxDuration)
|
||||
{
|
||||
WifiModulationClass modulation = ppdu->GetTxVector ().GetModulationClass ();
|
||||
auto it = m_phyEntities.find (modulation);
|
||||
|
||||
@@ -104,7 +104,7 @@ public:
|
||||
* \param rxPowersW the receive power in W per band
|
||||
* \param rxDuration the duration of the PPDU
|
||||
*/
|
||||
void StartReceivePreamble (Ptr<WifiPpdu> ppdu, RxPowerWattPerChannelBand& rxPowersW, Time rxDuration);
|
||||
void StartReceivePreamble (Ptr<const WifiPpdu> ppdu, RxPowerWattPerChannelBand& rxPowersW, Time rxDuration);
|
||||
|
||||
/**
|
||||
* Reset PHY at the end of the packet under reception after it has failed the PHY header.
|
||||
@@ -153,7 +153,7 @@ public:
|
||||
/**
|
||||
* \param ppdu the PPDU to send
|
||||
*/
|
||||
virtual void StartTx (Ptr<WifiPpdu> ppdu) = 0;
|
||||
virtual void StartTx (Ptr<const WifiPpdu> ppdu) = 0;
|
||||
|
||||
/**
|
||||
* Put in sleep mode.
|
||||
|
||||
@@ -50,7 +50,7 @@ struct WifiSpectrumSignalParameters : public SpectrumSignalParameters
|
||||
*/
|
||||
WifiSpectrumSignalParameters (const WifiSpectrumSignalParameters& p);
|
||||
|
||||
Ptr<WifiPpdu> ppdu; ///< The PPDU being transmitted
|
||||
Ptr<const WifiPpdu> ppdu; ///< The PPDU being transmitted
|
||||
uint16_t txCenterFreq; ///< the center frequency of the transmitted signal in MHz
|
||||
};
|
||||
|
||||
|
||||
@@ -103,7 +103,6 @@ YansWifiChannel::Send (Ptr<YansWifiPhy> sender, Ptr<const WifiPpdu> ppdu, double
|
||||
double rxPowerDbm = m_loss->CalcRxPower (txPowerDbm, senderMobility, receiverMobility);
|
||||
NS_LOG_DEBUG ("propagation: txPower=" << txPowerDbm << "dbm, rxPower=" << rxPowerDbm << "dbm, " <<
|
||||
"distance=" << senderMobility->GetDistanceFrom (receiverMobility) << "m, delay=" << delay);
|
||||
Ptr<WifiPpdu> copy = ppdu->Copy ();
|
||||
Ptr<NetDevice> dstNetDevice = (*i)->GetDevice ();
|
||||
uint32_t dstNode;
|
||||
if (dstNetDevice == 0)
|
||||
@@ -117,13 +116,13 @@ YansWifiChannel::Send (Ptr<YansWifiPhy> sender, Ptr<const WifiPpdu> ppdu, double
|
||||
|
||||
Simulator::ScheduleWithContext (dstNode,
|
||||
delay, &YansWifiChannel::Receive,
|
||||
(*i), copy, rxPowerDbm);
|
||||
(*i), ppdu, rxPowerDbm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
YansWifiChannel::Receive (Ptr<YansWifiPhy> phy, Ptr<WifiPpdu> ppdu, double rxPowerDbm)
|
||||
YansWifiChannel::Receive (Ptr<YansWifiPhy> phy, Ptr<const WifiPpdu> ppdu, double rxPowerDbm)
|
||||
{
|
||||
NS_LOG_FUNCTION (phy << ppdu << rxPowerDbm);
|
||||
// Do no further processing if signal is too weak
|
||||
|
||||
@@ -112,7 +112,7 @@ private:
|
||||
* \param ppdu the PPDU being sent
|
||||
* \param txPowerDbm the TX power associated to the packet being sent (dBm)
|
||||
*/
|
||||
static void Receive (Ptr<YansWifiPhy> receiver, Ptr<WifiPpdu> ppdu, double txPowerDbm);
|
||||
static void Receive (Ptr<YansWifiPhy> receiver, Ptr<const WifiPpdu> ppdu, double txPowerDbm);
|
||||
|
||||
PhyList m_phyList; //!< List of YansWifiPhys connected to this YansWifiChannel
|
||||
Ptr<PropagationLossModel> m_loss; //!< Propagation loss model
|
||||
|
||||
@@ -86,7 +86,7 @@ YansWifiPhy::SetChannel (const Ptr<YansWifiChannel> channel)
|
||||
}
|
||||
|
||||
void
|
||||
YansWifiPhy::StartTx (Ptr<WifiPpdu> ppdu)
|
||||
YansWifiPhy::StartTx (Ptr<const WifiPpdu> ppdu)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << ppdu);
|
||||
NS_LOG_DEBUG ("Start transmission: signal power before antenna gain=" << GetPowerDbm (ppdu->GetTxVector ().GetTxPowerLevel ()) << "dBm");
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
virtual ~YansWifiPhy ();
|
||||
|
||||
void SetInterferenceHelper (const Ptr<InterferenceHelper> helper) override;
|
||||
void StartTx (Ptr<WifiPpdu> ppdu) override;
|
||||
void StartTx (Ptr<const WifiPpdu> ppdu) override;
|
||||
Ptr<Channel> GetChannel (void) const override;
|
||||
uint16_t GetGuardBandwidth (uint16_t currentChannelWidth) const override;
|
||||
std::tuple<double, double, double> GetTxMaskRejectionParams (void) const override;
|
||||
|
||||
@@ -157,7 +157,7 @@ public:
|
||||
/**
|
||||
* \param ppdu the PPDU to send
|
||||
*/
|
||||
void StartTx (Ptr<WifiPpdu> ppdu) override;
|
||||
void StartTx (Ptr<const WifiPpdu> ppdu) override;
|
||||
/**
|
||||
* \param currentChannelWidth channel width of the current transmission (MHz)
|
||||
* \return the width of the guard band (MHz) set to 2
|
||||
@@ -263,7 +263,7 @@ OfdmaSpectrumWifiPhy::SetTriggerFrameUid (uint64_t uid)
|
||||
}
|
||||
|
||||
void
|
||||
OfdmaSpectrumWifiPhy::StartTx (Ptr<WifiPpdu> ppdu)
|
||||
OfdmaSpectrumWifiPhy::StartTx (Ptr<const WifiPpdu> ppdu)
|
||||
{
|
||||
m_phyTxPpduUidTrace (ppdu->GetUid ());
|
||||
SpectrumWifiPhy::StartTx (ppdu);
|
||||
|
||||
Reference in New Issue
Block a user