wifi: PHY shall call CCA detection logic from the PhyEntity corresponding to the configured standard

This commit is contained in:
Sebastien Deronne
2022-04-21 21:40:06 +02:00
parent 79ea8d014f
commit 95d40fb926
3 changed files with 27 additions and 10 deletions

View File

@@ -1040,6 +1040,22 @@ PhyEntity::GetRxChannelWidth (const WifiTxVector& txVector) const
return std::min (m_wifiPhy->GetChannelWidth (), txVector.GetChannelWidth ());
}
void
PhyEntity::SwitchMaybeToCcaBusy (uint16_t channelWidth)
{
NS_LOG_FUNCTION (this << channelWidth);
//We are here because we have received the first bit of a packet and we are
//not going to be able to synchronize on it
//In this model, CCA becomes busy when the aggregation of all signals as
//tracked by the InterferenceHelper class is higher than the CcaBusyThreshold
const Time delayUntilCcaEnd = m_wifiPhy->m_interference->GetEnergyDuration (m_wifiPhy->m_ccaEdThresholdW, m_wifiPhy->GetPrimaryBand (channelWidth));
if (!delayUntilCcaEnd.IsZero ())
{
NS_LOG_DEBUG ("Calling SwitchMaybeToCcaBusy for " << delayUntilCcaEnd.As (Time::S));
m_state->SwitchMaybeToCcaBusy (delayUntilCcaEnd);
}
}
uint64_t
PhyEntity::ObtainNextUid (const WifiTxVector& /* txVector */)
{

View File

@@ -440,6 +440,16 @@ public:
*/
virtual uint16_t GetRxChannelWidth (const WifiTxVector& txVector) const;
/**
* Check if PHY state should move to CCA busy state based on current
* state of interference tracker. In this model, CCA becomes busy when
* the aggregation of all signals as tracked by the InterferenceHelper
* class is higher than the CcaEdThreshold
*
* \param channelWidth the channel width in MHz used for RSSI measurement
*/
virtual void SwitchMaybeToCcaBusy (uint16_t channelWidth);
/**
* This function is called by SpectrumWifiPhy to send
* the PPDU while performing amendment-specific actions.

View File

@@ -1888,16 +1888,7 @@ void
WifiPhy::SwitchMaybeToCcaBusy (uint16_t channelWidth)
{
NS_LOG_FUNCTION (this << channelWidth);
//We are here because we have received the first bit of a packet and we are
//not going to be able to synchronize on it
//In this model, CCA becomes busy when the aggregation of all signals as
//tracked by the InterferenceHelper class is higher than the CcaBusyThreshold
Time delayUntilCcaEnd = m_interference->GetEnergyDuration (m_ccaEdThresholdW, GetPrimaryBand (channelWidth));
if (!delayUntilCcaEnd.IsZero ())
{
NS_LOG_DEBUG ("Calling SwitchMaybeToCcaBusy for " << delayUntilCcaEnd.As (Time::S));
m_state->SwitchMaybeToCcaBusy (delayUntilCcaEnd);
}
GetPhyEntity (m_standard)->SwitchMaybeToCcaBusy (channelWidth);
}
void