From 6a78dd9f50a477722c43951600fe11eff00e34a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deronne?= Date: Mon, 30 Mar 2020 09:58:27 +0200 Subject: [PATCH] wifi: Add more reasons why a PSDU is dropped --- src/wifi/model/wifi-phy.cc | 12 ++++----- src/wifi/model/wifi-phy.h | 53 +++++++++++++++++++++++++++++++++++++- 2 files changed, 58 insertions(+), 7 deletions(-) diff --git a/src/wifi/model/wifi-phy.cc b/src/wifi/model/wifi-phy.cc index 099751c2e..3deba3a96 100644 --- a/src/wifi/model/wifi-phy.cc +++ b/src/wifi/model/wifi-phy.cc @@ -2751,7 +2751,7 @@ WifiPhy::StartReceivePreamble (Ptr ppdu, double rxPowerW) { case WifiPhyState::SWITCHING: NS_LOG_DEBUG ("drop packet because of channel switching"); - NotifyRxDrop (psdu, NOT_ALLOWED); + NotifyRxDrop (psdu, CHANNEL_SWITCHING); /* * Packets received on the upcoming channel are added to the event list * during the switching state. This way the medium can be correctly sensed @@ -2780,7 +2780,7 @@ WifiPhy::StartReceivePreamble (Ptr ppdu, double rxPowerW) { NS_LOG_DEBUG ("Drop packet because already in Rx (power=" << rxPowerW << "W)"); - NotifyRxDrop (psdu, NOT_ALLOWED); + NotifyRxDrop (psdu, RXING); if (endRx > (Simulator::Now () + m_state->GetDelayUntilIdle ())) { //that packet will be noise _after_ the reception of the currently-received packet. @@ -2791,7 +2791,7 @@ WifiPhy::StartReceivePreamble (Ptr ppdu, double rxPowerW) case WifiPhyState::TX: NS_LOG_DEBUG ("Drop packet because already in Tx (power=" << rxPowerW << "W)"); - NotifyRxDrop (psdu, NOT_ALLOWED); + NotifyRxDrop (psdu, TXING); if (endRx > (Simulator::Now () + m_state->GetDelayUntilIdle ())) { //that packet will be noise _after_ the transmission of the currently-transmitted packet. @@ -2813,7 +2813,7 @@ WifiPhy::StartReceivePreamble (Ptr ppdu, double rxPowerW) { NS_LOG_DEBUG ("Drop packet because already in Rx (power=" << rxPowerW << "W)"); - NotifyRxDrop (psdu, NOT_ALLOWED); + NotifyRxDrop (psdu, RXING); if (endRx > (Simulator::Now () + m_state->GetDelayUntilIdle ())) { //that packet will be noise _after_ the reception of the currently-received packet. @@ -2831,7 +2831,7 @@ WifiPhy::StartReceivePreamble (Ptr ppdu, double rxPowerW) break; case WifiPhyState::SLEEP: NS_LOG_DEBUG ("Drop packet because in sleep mode"); - NotifyRxDrop (psdu, NOT_ALLOWED); + NotifyRxDrop (psdu, SLEEPING); if (endRx > (Simulator::Now () + m_state->GetDelayUntilIdle ())) { //that packet will be noise _after_ the sleep period. @@ -4201,7 +4201,7 @@ WifiPhy::StartRx (Ptr event, double rxPowerW) else { NS_LOG_DEBUG ("Drop packet because RX is already decoding preamble"); - NotifyRxDrop (event->GetPsdu (), NOT_ALLOWED); + NotifyRxDrop (event->GetPsdu (), BUSY_DECODING_PREAMBLE); return; } m_currentEvent = event; diff --git a/src/wifi/model/wifi-phy.h b/src/wifi/model/wifi-phy.h index ce1a68e38..4dad7164f 100644 --- a/src/wifi/model/wifi-phy.h +++ b/src/wifi/model/wifi-phy.h @@ -54,7 +54,11 @@ enum WifiPhyRxfailureReason { UNKNOWN = 0, UNSUPPORTED_SETTINGS, - NOT_ALLOWED, + CHANNEL_SWITCHING, + RXING, + TXING, + SLEEPING, + BUSY_DECODING_PREAMBLE, ERRONEOUS_FRAME, MPDU_WITHOUT_PHY_HEADER, PREAMBLE_DETECT_FAILURE, @@ -65,6 +69,53 @@ enum WifiPhyRxfailureReason OBSS_PD_CCA_RESET }; +/** +* \brief Stream insertion operator. +* +* \param os the stream +* \param reason the failure reason +* \returns a reference to the stream +*/ +inline std::ostream& operator<< (std::ostream& os, WifiPhyRxfailureReason reason) +{ + switch (reason) + { + case UNSUPPORTED_SETTINGS: + return (os << "UNSUPPORTED_SETTINGS"); + case CHANNEL_SWITCHING: + return (os << "CHANNEL_SWITCHING"); + case RXING: + return (os << "RXING"); + case TXING: + return (os << "TXING"); + case SLEEPING: + return (os << "SLEEPING"); + case BUSY_DECODING_PREAMBLE: + return (os << "BUSY_DECODING_PREAMBLE"); + case ERRONEOUS_FRAME: + return (os << "ERRONEOUS_FRAME"); + case MPDU_WITHOUT_PHY_HEADER: + return (os << "MPDU_WITHOUT_PHY_HEADER"); + case PREAMBLE_DETECT_FAILURE: + return (os << "PREAMBLE_DETECT_FAILURE"); + case L_SIG_FAILURE: + return (os << "L_SIG_FAILURE"); + case SIG_A_FAILURE: + return (os << "SIG_A_FAILURE"); + case PREAMBLE_DETECTION_PACKET_SWITCH: + return (os << "PREAMBLE_DETECTION_PACKET_SWITCH"); + case FRAME_CAPTURE_PACKET_SWITCH: + return (os << "FRAME_CAPTURE_PACKET_SWITCH"); + case OBSS_PD_CCA_RESET: + return (os << "OBSS_PD_CCA_RESET"); + case UNKNOWN: + default: + NS_FATAL_ERROR ("Unknown reason"); + return (os << "UNKNOWN"); + } +} + + /// SignalNoiseDbm structure struct SignalNoiseDbm {