wifi: Set all per-20MHz CCA durations to zero upon CCA reset request

This commit is contained in:
Sebastien Deronne
2022-05-12 20:16:35 +02:00
committed by Sébastien Deronne
parent 383b537fbc
commit f2da0d7bf1
3 changed files with 15 additions and 8 deletions

View File

@@ -19,6 +19,7 @@
*/
#include <algorithm>
#include <iterator>
#include "ns3/log.h"
#include "ns3/simulator.h"
#include "ns3/packet.h"
@@ -590,14 +591,19 @@ WifiPhyStateHelper::SwitchFromSleep (void)
}
void
WifiPhyStateHelper::SwitchFromRxAbort (void)
WifiPhyStateHelper::SwitchFromRxAbort (uint16_t operatingWidth)
{
NS_LOG_FUNCTION (this);
NS_LOG_FUNCTION (this << operatingWidth);
NS_ASSERT (IsStateCcaBusy ()); //abort is called (with OBSS_PD_CCA_RESET reason) before RX is set by payload start
NotifyRxEndOk ();
DoSwitchFromRx ();
m_endCcaBusy = Simulator::Now ();
NotifyCcaBusyStart (Seconds (0), WIFI_CHANLIST_PRIMARY, {});
std::vector<Time> per20MhzDurations;
if (operatingWidth >= 40)
{
std::fill_n (std::back_inserter (per20MhzDurations), (operatingWidth / 20), Seconds (0));
}
NotifyCcaBusyStart (Seconds (0), WIFI_CHANLIST_PRIMARY, per20MhzDurations);
NS_ASSERT (IsStateIdle ());
}

View File

@@ -221,6 +221,11 @@ public:
* Switch from RX after the reception failed.
*/
void SwitchFromRxEndError (void);
/**
* Abort current reception following a CCA reset request.
* \param operatingWidth the channel width the PHY is operating on (in MHz)
*/
void SwitchFromRxAbort (uint16_t operatingWidth);
/**
* Switch to CCA busy.
*
@@ -241,10 +246,6 @@ public:
* Switch from sleep mode.
*/
void SwitchFromSleep (void);
/**
* Abort current reception
*/
void SwitchFromRxAbort (void);
/**
* Switch to off mode.
*/

View File

@@ -1931,7 +1931,7 @@ WifiPhy::AbortCurrentReception (WifiPhyRxfailureReason reason)
NotifyRxDrop (GetAddressedPsduInPpdu (m_currentEvent->GetPpdu ()), reason);
if (reason == OBSS_PD_CCA_RESET)
{
m_state->SwitchFromRxAbort ();
m_state->SwitchFromRxAbort (GetChannelWidth ());
}
for (auto it = m_currentPreambleEvents.begin (); it != m_currentPreambleEvents.end (); ++it)
{