wifi: Add more reasons why a PSDU is dropped

This commit is contained in:
Sébastien Deronne
2020-03-30 09:58:27 +02:00
committed by Sebastien Deronne
parent 948e939526
commit 6a78dd9f50
2 changed files with 58 additions and 7 deletions

View File

@@ -2751,7 +2751,7 @@ WifiPhy::StartReceivePreamble (Ptr<WifiPpdu> 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<WifiPpdu> 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<WifiPpdu> 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<WifiPpdu> 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<WifiPpdu> 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> 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;

View File

@@ -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
{