wifi: Add per-MPDU reception status to RxOkCallback

RxOkCallback will be triggered if at least one MPDU of the A-MPDU is successfully received.
That's why per-MPDU reception status is also provided.
This commit is contained in:
Rediet
2019-03-26 09:23:46 +01:00
committed by Stefano Avallone
parent dfc7f88c1e
commit a47a047c52
9 changed files with 44 additions and 28 deletions

View File

@@ -67,8 +67,9 @@ private:
* \param p the packet
* \param snr the SNR
* \param txVector the wifi transmit vector
* \param statusPerMpdu reception status per MPDU
*/
void Receive (Ptr<Packet> p, double snr, WifiTxVector txVector);
void Receive (Ptr<Packet> p, double snr, WifiTxVector txVector, std::vector<bool> statusPerMpdu);
Ptr<WifiPhy> m_tx; ///< transmit
struct Input m_input; ///< input
struct Output m_output; ///< output
@@ -87,7 +88,7 @@ PsrExperiment::Send (void)
}
void
PsrExperiment::Receive (Ptr<Packet> p, double snr, WifiTxVector txVector)
PsrExperiment::Receive (Ptr<Packet> p, double snr, WifiTxVector txVector, std::vector<bool> statusPerMpdu)
{
m_output.received++;
}
@@ -188,8 +189,9 @@ private:
* \param p the packet
* \param snr the SNR
* \param txVector the wifi transmit vector
* \param statusPerMpdu reception status per MPDU
*/
void Receive (Ptr<Packet> p, double snr, WifiTxVector txVector);
void Receive (Ptr<Packet> p, double snr, WifiTxVector txVector, std::vector<bool> statusPerMpdu);
Ptr<WifiPhy> m_txA; ///< transmit A
Ptr<WifiPhy> m_txB; ///< transmit B
uint32_t m_flowIdA; ///< flow ID A
@@ -223,7 +225,7 @@ CollisionExperiment::SendB (void) const
}
void
CollisionExperiment::Receive (Ptr<Packet> p, double snr, WifiTxVector txVector)
CollisionExperiment::Receive (Ptr<Packet> p, double snr, WifiTxVector txVector, std::vector<bool> statusPerMpdu)
{
FlowIdTag tag;
if (p->FindFirstMatchingByteTag (tag))

View File

@@ -270,7 +270,7 @@ MacLow::GetPhy (void) const
void
MacLow::ResetPhy (void)
{
m_phy->SetReceiveOkCallback (MakeNullCallback<void, Ptr<Packet>, double, WifiTxVector> ());
m_phy->SetReceiveOkCallback (MakeNullCallback<void, Ptr<Packet>, double, WifiTxVector, std::vector<bool>> ());
m_phy->SetReceiveErrorCallback (MakeNullCallback<void, Ptr<Packet>> ());
RemovePhyMacLowListener (m_phy);
m_phy = 0;
@@ -2724,7 +2724,7 @@ MacLow::RegisterEdcaForAc (AcIndex ac, Ptr<QosTxop> edca)
}
void
MacLow::DeaggregateAmpduAndReceive (Ptr<Packet> aggregatedPacket, double rxSnr, WifiTxVector txVector)
MacLow::DeaggregateAmpduAndReceive (Ptr<Packet> aggregatedPacket, double rxSnr, WifiTxVector txVector, std::vector<bool> statusPerMpdu)
{
NS_LOG_FUNCTION (this);
AmpduTag ampdu;

View File

@@ -402,11 +402,13 @@ public:
* \param aggregatedPacket which is the current A-MPDU
* \param rxSnr snr of packet received
* \param txVector TXVECTOR of packet received
* \param statusPerMpdu reception status per MPDU
*
* This function de-aggregates an A-MPDU and decide if each MPDU is received correctly or not
*
*/
void DeaggregateAmpduAndReceive (Ptr<Packet> aggregatedPacket, double rxSnr, WifiTxVector txVector);
void DeaggregateAmpduAndReceive (Ptr<Packet> aggregatedPacket, double rxSnr, WifiTxVector txVector,
std::vector<bool> statusPerMpdu);
/**
*
* This function is called to flush the aggregate queue, which is used for A-MPDU

View File

@@ -458,15 +458,17 @@ WifiPhyStateHelper::SwitchToChannelSwitching (Time switchingDuration)
}
void
WifiPhyStateHelper::SwitchFromRxEndOk (Ptr<Packet> packet, double snr, WifiTxVector txVector)
WifiPhyStateHelper::SwitchFromRxEndOk (Ptr<Packet> packet, double snr, WifiTxVector txVector, std::vector<bool> statusPerMpdu)
{
NS_LOG_FUNCTION (this << packet << snr << txVector);
NS_LOG_FUNCTION (this << packet << snr << txVector << statusPerMpdu.size () <<
std::all_of(statusPerMpdu.begin(), statusPerMpdu.end(), [](bool v) { return v; })); //returns true if all true
NS_ASSERT (statusPerMpdu.size () != 0);
m_rxOkTrace (packet, snr, txVector.GetMode (), txVector.GetPreambleType ());
NotifyRxEndOk ();
DoSwitchFromRx ();
if (!m_rxOkCallback.IsNull ())
{
m_rxOkCallback (packet, snr, txVector);
m_rxOkCallback (packet, snr, txVector, statusPerMpdu);
}
}

View File

@@ -36,14 +36,16 @@ class WifiMode;
class Packet;
/**
* Callback if packet successfully received
* Callback if packet successfully received (i.e. if aggregate,
* it means that at least one MPDU of the A-MPDU was received,
* considering that the per-MPDU reception status is also provided).
*
* arg1: packet received successfully
* arg2: snr of packet
* arg2: SNR of packet
* arg3: TXVECTOR of packet
* arg4: type of preamble used for packet.
* arg4: vector of per-MPDU status of reception.
*/
typedef Callback<void, Ptr<Packet>, double, WifiTxVector> RxOkCallback;
typedef Callback<void, Ptr<Packet>, double, WifiTxVector, std::vector<bool>> RxOkCallback;
/**
* Callback if packet unsuccessfully received
*
@@ -179,8 +181,9 @@ public:
* \param packet the successfully received packet
* \param snr the SNR of the received packet
* \param txVector TXVECTOR of the packet
* \param statusPerMpdu reception status per MPDU
*/
void SwitchFromRxEndOk (Ptr<Packet> packet, double snr, WifiTxVector txVector);
void SwitchFromRxEndOk (Ptr<Packet> packet, double snr, WifiTxVector txVector, std::vector<bool> statusPerMpdu);
/**
* Switch from RX after the reception failed.
*

View File

@@ -2764,8 +2764,9 @@ WifiPhy::EndReceive (Ptr<Packet> packet, WifiPreamble preamble, MpduType mpdutyp
MpduInfo aMpdu;
aMpdu.type = mpdutype;
aMpdu.mpduRefNumber = m_rxMpduReferenceNumber;
std::vector<bool> statusPerMpdu {true}; //TODO update when A-MPDUs are handled as single packet
NotifyMonitorSniffRx (packet, GetFrequency (), event->GetTxVector (), aMpdu, signalNoise);
m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetTxVector ());
m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetTxVector (), statusPerMpdu);
}
else
{

View File

@@ -75,8 +75,9 @@ protected:
* \param p the packet
* \param snr the SNR
* \param txVector the transmit vector
* \param statusPerMpdu reception status per MPDU
*/
void SpectrumWifiPhyRxSuccess (Ptr<Packet> p, double snr, WifiTxVector txVector);
void SpectrumWifiPhyRxSuccess (Ptr<Packet> p, double snr, WifiTxVector txVector, std::vector<bool> statusPerMpdu);
/**
* Spectrum wifi receive failure function
* \param p the packet
@@ -138,7 +139,7 @@ SpectrumWifiPhyBasicTest::SendSignal (double txPowerWatts)
}
void
SpectrumWifiPhyBasicTest::SpectrumWifiPhyRxSuccess (Ptr<Packet> p, double snr, WifiTxVector txVector)
SpectrumWifiPhyBasicTest::SpectrumWifiPhyRxSuccess (Ptr<Packet> p, double snr, WifiTxVector txVector, std::vector<bool> statusPerMpdu)
{
NS_LOG_FUNCTION (this << p << snr << txVector);
m_count++;

View File

@@ -70,8 +70,9 @@ protected:
* \param p the packet
* \param snr the SNR
* \param txVector the transmit vector
* \param statusPerMpdu reception status per MPDU
*/
void RxSuccess (Ptr<Packet> p, double snr, WifiTxVector txVector);
void RxSuccess (Ptr<Packet> p, double snr, WifiTxVector txVector, std::vector<bool> statusPerMpdu);
/**
* Spectrum wifi receive failure function
* \param p the packet
@@ -152,7 +153,7 @@ TestThresholdPreambleDetectionWithoutFrameCapture::CheckRxPacketCount (uint32_t
}
void
TestThresholdPreambleDetectionWithoutFrameCapture::RxSuccess (Ptr<Packet> p, double snr, WifiTxVector txVector)
TestThresholdPreambleDetectionWithoutFrameCapture::RxSuccess (Ptr<Packet> p, double snr, WifiTxVector txVector, std::vector<bool> statusPerMpdu)
{
NS_LOG_FUNCTION (this << p << snr << txVector);
m_countRxSuccess++;
@@ -269,8 +270,9 @@ protected:
* \param p the packet
* \param snr the SNR
* \param txVector the transmit vector
* \param statusPerMpdu reception status per MPDU
*/
void RxSuccess (Ptr<Packet> p, double snr, WifiTxVector txVector);
void RxSuccess (Ptr<Packet> p, double snr, WifiTxVector txVector, std::vector<bool> statusPerMpdu);
/**
* Spectrum wifi receive failure function
* \param p the packet
@@ -351,7 +353,7 @@ TestThresholdPreambleDetectionWithFrameCapture::CheckRxPacketCount (uint32_t exp
}
void
TestThresholdPreambleDetectionWithFrameCapture::RxSuccess (Ptr<Packet> p, double snr, WifiTxVector txVector)
TestThresholdPreambleDetectionWithFrameCapture::RxSuccess (Ptr<Packet> p, double snr, WifiTxVector txVector, std::vector<bool> statusPerMpdu)
{
NS_LOG_FUNCTION (this << p << txVector);
m_countRxSuccess++;
@@ -481,8 +483,9 @@ private:
* \param p the packet
* \param snr the SNR
* \param txVector the transmit vector
* \param statusPerMpdu reception status per MPDU
*/
void RxSuccess (Ptr<Packet> p, double snr, WifiTxVector txVector);
void RxSuccess (Ptr<Packet> p, double snr, WifiTxVector txVector, std::vector<bool> statusPerMpdu);
/**
* RX packet dropped function
* \param p the packet
@@ -542,7 +545,7 @@ TestSimpleFrameCaptureModel::SendPacket (double txPowerDbm, uint32_t packetSize)
}
void
TestSimpleFrameCaptureModel::RxSuccess (Ptr<Packet> p, double snr, WifiTxVector txVector)
TestSimpleFrameCaptureModel::RxSuccess (Ptr<Packet> p, double snr, WifiTxVector txVector, std::vector<bool> statusPerMpdu)
{
NS_LOG_FUNCTION (this << p << snr << txVector);
if (p->GetSize () == 1030)
@@ -692,8 +695,9 @@ private:
* \param p the packet
* \param snr the SNR
* \param txVector the transmit vector
* \param statusPerMpdu reception status per MPDU
*/
void RxSuccess (Ptr<Packet> p, double snr, WifiTxVector txVector);
void RxSuccess (Ptr<Packet> p, double snr, WifiTxVector txVector, std::vector<bool> statusPerMpdu);
/**
* RX failure function
* \param p the packet
@@ -806,7 +810,7 @@ TestAmpduReception::ResetBitmaps()
}
void
TestAmpduReception::RxSuccess (Ptr<Packet> p, double snr, WifiTxVector txVector)
TestAmpduReception::RxSuccess (Ptr<Packet> p, double snr, WifiTxVector txVector, std::vector<bool> statusPerMpdu)
{
NS_LOG_FUNCTION (this << p << snr << txVector);
if (p->GetSize () == 1030) //A-MPDU 1 - MPDU #1

View File

@@ -74,8 +74,9 @@ protected:
* \param p the packet
* \param snr the SNR
* \param txVector the transmit vector
* \param statusPerMpdu reception status per MPDU
*/
virtual void RxSuccess (Ptr<Packet> p, double snr, WifiTxVector txVector);
virtual void RxSuccess (Ptr<Packet> p, double snr, WifiTxVector txVector, std::vector<bool> statusPerMpdu);
/**
* PHY receive failure callback function
* \param p the packet
@@ -177,7 +178,7 @@ WifiPhyThresholdsTest::SendSignal (double txPowerWatts, bool wifiSignal)
}
void
WifiPhyThresholdsTest::RxSuccess (Ptr<Packet> p, double snr, WifiTxVector txVector)
WifiPhyThresholdsTest::RxSuccess (Ptr<Packet> p, double snr, WifiTxVector txVector, std::vector<bool> statusPerMpdu)
{
NS_LOG_FUNCTION (this << p << snr << txVector);
m_rxSuccess++;