wifi: Adapt the PhyTxPsduBegin trace to handle HE MU PPDUs

This commit is contained in:
Stefano Avallone
2020-03-03 18:42:31 +01:00
committed by Sébastien Deronne
parent 9d67facba4
commit 0537d167b1
6 changed files with 38 additions and 32 deletions

View File

@@ -868,7 +868,7 @@ AnimationInterface::UanPhyGenRxTrace (std::string context, Ptr<const Packet> p)
}
void
AnimationInterface::WifiPhyTxBeginTrace (std::string context, Ptr<const WifiPsdu> psdu, WifiTxVector txVector, double txPowerW)
AnimationInterface::WifiPhyTxBeginTrace (std::string context, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
{
NS_LOG_FUNCTION (this);
NS_UNUSED (txVector);
@@ -879,13 +879,16 @@ AnimationInterface::WifiPhyTxBeginTrace (std::string context, Ptr<const WifiPsdu
AnimPacketInfo pktInfo (ndev, Simulator::Now ());
AnimUidPacketInfoMap * pendingPackets = ProtocolTypeToPendingPackets (WIFI);
for (auto mpdu = psdu->begin (); mpdu != psdu->end (); ++mpdu)
for (auto& psdu : psduMap)
{
++gAnimUid;
NS_LOG_INFO ("WifiPhyTxTrace for MPDU:" << gAnimUid);
AddByteTag (gAnimUid, (*mpdu)->GetPacket ()); //the underlying MSDU/A-MSDU should be handed off
AddPendingPacket (WIFI, gAnimUid, pktInfo);
OutputWirelessPacketTxInfo ((*mpdu)->GetProtocolDataUnit (), pendingPackets->at (gAnimUid), gAnimUid); //PDU should be considered in order to have header
for (auto& mpdu : *PeekPointer (psdu.second))
{
++gAnimUid;
NS_LOG_INFO ("WifiPhyTxTrace for MPDU:" << gAnimUid);
AddByteTag (gAnimUid, mpdu->GetPacket ()); //the underlying MSDU/A-MSDU should be handed off
AddPendingPacket (WIFI, gAnimUid, pktInfo);
OutputWirelessPacketTxInfo (mpdu->GetProtocolDataUnit (), pendingPackets->at (gAnimUid), gAnimUid); //PDU should be considered in order to have header
}
}
Ptr<WifiNetDevice> netDevice = DynamicCast<WifiNetDevice> (ndev);

View File

@@ -1047,11 +1047,11 @@ private:
/**
* wifi Phy transmit PSDU begin trace function
* \param context the context
* \param psdu the PSDU
* \param psduMap the PSDU map
* \param txVector the TXVECTOR
* \param txPowerW the tx power in Watts
*/
void WifiPhyTxBeginTrace (std::string context, Ptr<const WifiPsdu> psdu, WifiTxVector txVector, double txPowerW);
void WifiPhyTxBeginTrace (std::string context, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW);
/**
* wifi Phy receive begin trace function
*

View File

@@ -2768,7 +2768,7 @@ WifiPhy::Send (WifiConstPsduMap psdus, WifiTxVector txVector)
double txPowerW = DbmToW (GetTxPowerForTransmission (txVector) + GetTxGain ());
NotifyTxBegin (psdus, txPowerW);
m_phyTxPsduBeginTrace (psdus.begin()->second, txVector, txPowerW); // TODO: fix for MU
m_phyTxPsduBeginTrace (psdus, txVector, txPowerW);
NotifyMonitorSniffTx (psdus.begin()->second, GetFrequency (), txVector); //TODO: fix for MU
m_state->SwitchToTx (txDuration, psdus, GetPowerDbm (txVector.GetTxPowerLevel ()), txVector);

View File

@@ -1425,11 +1425,11 @@ public:
/**
* TracedCallback signature for PSDU transmit events.
*
* \param psdu the PSDU being transmitted
* \param psduMap the PSDU map being transmitted
* \param txVector the TXVECTOR holding the TX parameters
* \param txPowerW the transmit power in Watts
*/
typedef void (* PsduTxBeginCallback)(Ptr<const WifiPsdu> psdu, WifiTxVector txVector, double txPowerW);
typedef void (* PsduTxBeginCallback)(WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW);
/**
* Public method used to fire a EndOfHePreamble trace once both HE SIG fields have been received, as well as training fields.
@@ -1949,12 +1949,12 @@ private:
*/
TracedCallback<Ptr<const Packet>, double > m_phyTxBeginTrace;
/**
* The trace source fired when a PSDU begins the transmission process on
* The trace source fired when a PSDU map begins the transmission process on
* the medium.
*
* \see class CallBackTraceSource
*/
TracedCallback<Ptr<const WifiPsdu>, WifiTxVector, double /* TX power (W) */> m_phyTxPsduBeginTrace;
TracedCallback<WifiConstPsduMap, WifiTxVector, double /* TX power (W) */> m_phyTxPsduBeginTrace;
/**
* The trace source fired when a packet ends the transmission process on

View File

@@ -654,11 +654,11 @@ private:
void NotifyMacTransmit (Ptr<const Packet> packet);
/**
* Callback invoked when the sender MAC passes a PSDU(s) to the PHY
* \param psdu the PSDU
* \param psduMap the PSDU map
* \param txVector the TX vector
* \param txPowerW the transmit power in Watts
*/
void NotifyPsduForwardedDown (Ptr<const WifiPsdu> psdu, WifiTxVector txVector, double txPowerW);
void NotifyPsduForwardedDown (WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW);
/**
* Callback invoked when the receiver MAC forwards a packet up to the upper layer
* \param p the packet
@@ -682,16 +682,19 @@ PreservePacketsInAmpdus::NotifyMacTransmit (Ptr<const Packet> packet)
}
void
PreservePacketsInAmpdus::NotifyPsduForwardedDown (Ptr<const WifiPsdu> psdu, WifiTxVector txVector, double txPowerW)
PreservePacketsInAmpdus::NotifyPsduForwardedDown (WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
{
if (!psdu->GetHeader (0).IsQosData ())
NS_TEST_EXPECT_MSG_EQ ((psduMap.size () == 1 && psduMap.begin ()->first == SU_STA_ID),
true, "No DL MU PPDU expected");
if (!psduMap[SU_STA_ID]->GetHeader (0).IsQosData ())
{
return;
}
m_nMpdus.push_back (psdu->GetNMpdus ());
m_nMpdus.push_back (psduMap[SU_STA_ID]->GetNMpdus ());
for (auto& mpdu : *PeekPointer (psdu))
for (auto& mpdu : *PeekPointer (psduMap[SU_STA_ID]))
{
std::size_t dist = std::distance (mpdu->begin (), mpdu->end ());
// the list of aggregated MSDUs is empty if the MPDU includes a non-aggregated MSDU

View File

@@ -2422,11 +2422,11 @@ private:
/**
* Callback that indicates a PSDU is being transmitted
* \param context the context
* \param psdu the PSDU to transmit
* \param psduMap the PSDU map to transmit
* \param txVector the TX vector
* \param txPowerW the TX power (W)
*/
void TxCallback (std::string context, Ptr<const WifiPsdu> psdu, WifiTxVector txVector, double txPowerW);
void TxCallback (std::string context, WifiConstPsduMap psdus, WifiTxVector txVector, double txPowerW);
};
Issue169TestCase::Issue169TestCase ()
@@ -2452,9 +2452,9 @@ Issue169TestCase::SendPackets (uint8_t numPackets, Ptr<NetDevice> sourceDevice,
}
void
Issue169TestCase::TxCallback (std::string context, Ptr<const WifiPsdu> psdu, WifiTxVector txVector, double txPowerW)
Issue169TestCase::TxCallback (std::string context, WifiConstPsduMap psdus, WifiTxVector txVector, double txPowerW)
{
if (psdu->GetSize () >= 1000)
if (psdus.begin()->second->GetSize () >= 1000)
{
NS_TEST_ASSERT_MSG_EQ (txVector.GetMode ().GetModulationClass (), WifiModulationClass::WIFI_MOD_CLASS_VHT, "Ideal rate manager selected incorrect modulation class");
}
@@ -2556,11 +2556,11 @@ private:
/**
* Callback that indicates a PSDU is being transmitted
* \param context the context
* \param psdu the PSDU to transmit
* \param psduMap the PSDU map to transmit
* \param txVector the TX vector
* \param txPowerW the TX power (W)
*/
void TxCallback (std::string context, Ptr<const WifiPsdu> psdu, WifiTxVector txVector, double txPowerW);
void TxCallback (std::string context, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW);
/**
* Check if the selected WifiMode is correct
@@ -2594,9 +2594,9 @@ IdealRateManagerChannelWidthTest::SendPacket (Ptr<NetDevice> sourceDevice, Addre
}
void
IdealRateManagerChannelWidthTest::TxCallback (std::string context, Ptr<const WifiPsdu> psdu, WifiTxVector txVector, double txPowerW)
IdealRateManagerChannelWidthTest::TxCallback (std::string context, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
{
if (psdu->GetSize () >= 1000)
if (psduMap.begin ()->second->GetSize () >= 1000)
{
m_txMode = txVector.GetMode ();
}
@@ -2715,11 +2715,11 @@ private:
/**
* Callback that indicates a PSDU is being transmitted
* \param context the context
* \param psdu the PSDU to transmit
* \param psduMap the PSDU map to transmit
* \param txVector the TX vector
* \param txPowerW the TX power (W)
*/
void TxCallback (std::string context, Ptr<const WifiPsdu> psdu, WifiTxVector txVector, double txPowerW);
void TxCallback (std::string context, WifiConstPsduMap psdus, WifiTxVector txVector, double txPowerW);
/**
* Check if the selected WifiMode is correct
@@ -2768,9 +2768,9 @@ IdealRateManagerMimoTest::SendPacket (Ptr<NetDevice> sourceDevice, Address& dest
}
void
IdealRateManagerMimoTest::TxCallback (std::string context, Ptr<const WifiPsdu> psdu, WifiTxVector txVector, double txPowerW)
IdealRateManagerMimoTest::TxCallback (std::string context, WifiConstPsduMap psdus, WifiTxVector txVector, double txPowerW)
{
if (psdu->GetSize () >= 1000)
if (psdus.begin ()->second->GetSize () >= 1000)
{
m_txVector = txVector;
}