wifi: Handle case PHY is switched off when checking on current state

This commit is contained in:
Sébastien Deronne
2023-11-25 14:18:56 +01:00
committed by Sébastien Deronne
parent 2c73b9e59c
commit 6deb869ce0

View File

@@ -414,17 +414,6 @@ PhyEntity::StartReceivePreamble(Ptr<const WifiPpdu> ppdu,
}
Time endRx = Simulator::Now() + rxDuration;
if (m_state->GetState() == WifiPhyState::OFF)
{
NS_LOG_DEBUG("Cannot start RX because device is OFF");
if (endRx > (Simulator::Now() + m_state->GetDelayUntilIdle()))
{
m_wifiPhy->SwitchMaybeToCcaBusy(nullptr);
}
DropPreambleEvent(ppdu, WifiPhyRxfailureReason::POWERED_OFF, endRx);
return;
}
if (ppdu->IsTruncatedTx())
{
NS_LOG_DEBUG("Packet reception stopped because transmitter has been switched off");
@@ -512,6 +501,10 @@ PhyEntity::StartReceivePreamble(Ptr<const WifiPpdu> ppdu,
NS_LOG_DEBUG("Drop packet because in sleep mode");
DropPreambleEvent(ppdu, SLEEPING, endRx);
break;
case WifiPhyState::OFF:
NS_LOG_DEBUG("Drop packet because in switched off");
DropPreambleEvent(ppdu, WifiPhyRxfailureReason::POWERED_OFF, endRx);
break;
default:
NS_FATAL_ERROR("Invalid WifiPhy state.");
break;