wifi: Split processing of a received PSDU from RX end notifications

This commit is contained in:
Sebastien Deronne
2022-05-01 09:41:43 +02:00
committed by Stefano Avallone
parent 5855aefa17
commit 55a1578633
3 changed files with 47 additions and 25 deletions

View File

@@ -626,7 +626,7 @@ PhyEntity::EndOfMpdu (Ptr<Event> event, Ptr<const WifiPsdu> psdu, size_t mpduInd
if (rxInfo.first && GetAddressedPsduInPpdu (ppdu)->GetNMpdus () > 1)
{
//only done for correct MPDU that is part of an A-MPDU
m_state->ContinueRxNextMpdu (Copy (psdu), rxSignalInfo, txVector);
m_state->NotifyRxMpdu (Copy (psdu), rxSignalInfo, txVector);
}
}
@@ -674,13 +674,15 @@ PhyEntity::RxPayloadSucceeded (Ptr<const WifiPsdu> psdu, RxSignalInfo rxSignalIn
const WifiTxVector& txVector, uint16_t staId,
const std::vector<bool>& statusPerMpdu)
{
m_state->SwitchFromRxEndOk (Copy (psdu), rxSignalInfo, txVector, staId, statusPerMpdu);
m_state->NotifyRxPsduSucceeded (Copy (psdu), rxSignalInfo, txVector, staId, statusPerMpdu);
m_state->SwitchFromRxEndOk ();
}
void
PhyEntity::RxPayloadFailed (Ptr<const WifiPsdu> psdu, double snr)
{
m_state->SwitchFromRxEndError (Copy (psdu), snr);
m_state->NotifyRxPsduFailed (Copy (psdu), snr);
m_state->SwitchFromRxEndError ();
}
void

View File

@@ -456,33 +456,28 @@ WifiPhyStateHelper::SwitchToChannelSwitching (Time switchingDuration)
}
void
WifiPhyStateHelper::ContinueRxNextMpdu (Ptr<WifiPsdu> psdu, RxSignalInfo rxSignalInfo, const WifiTxVector& txVector)
WifiPhyStateHelper::NotifyRxMpdu (Ptr<WifiPsdu> psdu, RxSignalInfo rxSignalInfo, const WifiTxVector& txVector)
{
NS_LOG_FUNCTION (this << *psdu << rxSignalInfo << txVector);
std::vector<bool> statusPerMpdu;
if (!m_rxOkCallback.IsNull ())
{
m_rxOkCallback (psdu, rxSignalInfo, txVector, statusPerMpdu);
m_rxOkCallback (psdu, rxSignalInfo, txVector, {});
}
}
void
WifiPhyStateHelper::SwitchFromRxEndOk (Ptr<WifiPsdu> psdu, RxSignalInfo rxSignalInfo,
const WifiTxVector& txVector, uint16_t staId,
const std::vector<bool>& statusPerMpdu)
WifiPhyStateHelper::NotifyRxPsduSucceeded (Ptr<WifiPsdu> psdu, RxSignalInfo rxSignalInfo,
const WifiTxVector& txVector, uint16_t staId,
const std::vector<bool>& statusPerMpdu)
{
NS_LOG_FUNCTION (this << *psdu << rxSignalInfo << txVector << staId << statusPerMpdu.size () <<
std::all_of(statusPerMpdu.begin(), statusPerMpdu.end(), [](bool v) { return v; })); //returns true if all true
NS_ASSERT (statusPerMpdu.size () != 0);
NS_ASSERT (Abs (m_endRx - Simulator::Now ()) < MicroSeconds (1)); //1us corresponds to the maximum propagation delay (delay spread)
//TODO: a better fix would be to call the function once all HE TB PPDUs are received
if (!m_rxOkTrace.IsEmpty ())
{
m_rxOkTrace (psdu->GetPacket (), rxSignalInfo.snr, txVector.GetMode (staId),
txVector.GetPreambleType ());
}
NotifyRxEndOk ();
DoSwitchFromRx ();
if (!m_rxOkCallback.IsNull ())
{
m_rxOkCallback (psdu, rxSignalInfo, txVector, statusPerMpdu);
@@ -490,23 +485,39 @@ WifiPhyStateHelper::SwitchFromRxEndOk (Ptr<WifiPsdu> psdu, RxSignalInfo rxSignal
}
void
WifiPhyStateHelper::SwitchFromRxEndError (Ptr<WifiPsdu> psdu, double snr)
WifiPhyStateHelper::NotifyRxPsduFailed (Ptr<WifiPsdu> psdu, double snr)
{
NS_LOG_FUNCTION (this << *psdu << snr);
NS_ASSERT (Abs (m_endRx - Simulator::Now ()) < MicroSeconds (1)); //1us corresponds to the maximum propagation delay (delay spread)
//TODO: a better fix would be to call the function once all HE TB PPDUs are received
if (!m_rxErrorTrace.IsEmpty ())
{
m_rxErrorTrace (psdu->GetPacket (), snr);
}
NotifyRxEndError ();
DoSwitchFromRx ();
if (!m_rxErrorCallback.IsNull ())
{
m_rxErrorCallback (psdu);
}
}
void
WifiPhyStateHelper::SwitchFromRxEndOk (void)
{
NS_LOG_FUNCTION (this);
NS_ASSERT (Abs (m_endRx - Simulator::Now ()) < MicroSeconds (1)); //1us corresponds to the maximum propagation delay (delay spread)
//TODO: a better fix would be to call the function once all HE TB PPDUs are received
NotifyRxEndOk ();
DoSwitchFromRx ();
}
void
WifiPhyStateHelper::SwitchFromRxEndError (void)
{
NS_LOG_FUNCTION (this);
NS_ASSERT (Abs (m_endRx - Simulator::Now ()) < MicroSeconds (1)); //1us corresponds to the maximum propagation delay (delay spread)
//TODO: a better fix would be to call the function once all HE TB PPDUs are received
NotifyRxEndError ();
DoSwitchFromRx ();
}
void
WifiPhyStateHelper::DoSwitchFromRx (void)
{

View File

@@ -187,15 +187,15 @@ public:
*/
void SwitchToChannelSwitching (Time switchingDuration);
/**
* Continue RX after the reception of an MPDU in an A-MPDU was successful.
* Notify the reception of an MPDU included in an A-MPDU.
*
* \param psdu the successfully received PSDU
* \param rxSignalInfo the info on the received signal (\see RxSignalInfo)
* \param txVector TXVECTOR of the PSDU
*/
void ContinueRxNextMpdu (Ptr<WifiPsdu> psdu, RxSignalInfo rxSignalInfo, const WifiTxVector& txVector);
void NotifyRxMpdu (Ptr<WifiPsdu> psdu, RxSignalInfo rxSignalInfo, const WifiTxVector& txVector);
/**
* Switch from RX after the reception was successful.
* Handle the successful reception of a PSDU.
*
* \param psdu the successfully received PSDU
* \param rxSignalInfo the info on the received signal (\see RxSignalInfo)
@@ -203,15 +203,24 @@ public:
* \param staId the station ID of the PSDU (only used for MU)
* \param statusPerMpdu reception status per MPDU
*/
void SwitchFromRxEndOk (Ptr<WifiPsdu> psdu, RxSignalInfo rxSignalInfo, const WifiTxVector& txVector,
uint16_t staId, const std::vector<bool>& statusPerMpdu);
void NotifyRxPsduSucceeded (Ptr<WifiPsdu> psdu, RxSignalInfo rxSignalInfo,
const WifiTxVector& txVector, uint16_t staId,
const std::vector<bool>& statusPerMpdu);
/**
* Switch from RX after the reception failed.
* Handle the unsuccessful reception of a PSDU.
*
* \param psdu the PSDU that we failed to received
* \param snr the SNR of the received PSDU in linear scale
*/
void SwitchFromRxEndError (Ptr<WifiPsdu> psdu, double snr);
void NotifyRxPsduFailed (Ptr<WifiPsdu> psdu, double snr);
/**
* Switch from RX after the reception was successful.
*/
void SwitchFromRxEndOk (void);
/**
* Switch from RX after the reception failed.
*/
void SwitchFromRxEndError (void);
/**
* Switch to CCA busy.
*