wifi: Generate PHY CCA indication when the per20bitmap parameter changes

This commit is contained in:
Sebastien Deronne
2022-07-07 12:45:31 +02:00
committed by Sébastien Deronne
parent f2da0d7bf1
commit 7928fdeeab
2 changed files with 51 additions and 4 deletions

View File

@@ -73,7 +73,8 @@ const PhyEntity::PpduFormats HePhy::m_hePpduFormats { //Ignoring PE (Packet Exte
HePhy::HePhy (bool buildModeList /* = true */)
: VhtPhy (false), //don't add VHT modes to list
m_trigVectorExpirationTime (Seconds (0)),
m_rxHeTbPpdus (0)
m_rxHeTbPpdus (0),
m_lastPer20MHzDurations ()
{
NS_LOG_FUNCTION (this << buildModeList);
m_bssMembershipSelector = HE_PHY;
@@ -1015,12 +1016,47 @@ HePhy::GetCcaThreshold (const Ptr<const WifiPpdu> ppdu, WifiChannelListType chan
return std::max (VhtPhy::GetCcaThreshold (ppdu, channelType), obssPdLevel);
}
void
HePhy::SwitchMaybeToCcaBusy (const Ptr<const WifiPpdu> ppdu)
{
const auto ccaIndication = GetCcaIndication (ppdu);
const auto per20MHzDurations = GetPer20MHzDurations (ppdu);
if (ccaIndication.has_value ())
{
NS_LOG_DEBUG ("CCA busy for " << ccaIndication.value ().second << " during " << ccaIndication.value ().first.As (Time::S));
NotifyCcaBusy (ccaIndication.value ().first, ccaIndication.value ().second, per20MHzDurations);
return;
}
if (ppdu)
{
SwitchMaybeToCcaBusy (nullptr);
return;
}
if (per20MHzDurations != m_lastPer20MHzDurations)
{
/*
* 8.3.5.12.3: For Clause 27 PHYs, this primitive is generated when (...) the per20bitmap parameter changes.
*/
NS_LOG_DEBUG ("per-20MHz CCA durations changed");
NotifyCcaBusy (Seconds (0), WIFI_CHANLIST_PRIMARY, per20MHzDurations);
}
}
void
HePhy::NotifyCcaBusy (const Ptr<const WifiPpdu> ppdu, Time duration, WifiChannelListType channelType)
{
NS_LOG_FUNCTION (this << duration << channelType);
NS_LOG_DEBUG ("CCA busy for " << channelType << " during " << duration.As (Time::S));
m_state->SwitchMaybeToCcaBusy (duration, channelType, GetPer20MHzDurations (ppdu));
const auto per20MHzDurations = GetPer20MHzDurations (ppdu);
NotifyCcaBusy (duration, channelType, per20MHzDurations);
}
void
HePhy::NotifyCcaBusy (Time duration, WifiChannelListType channelType, const std::vector<Time>& per20MHzDurations)
{
NS_LOG_FUNCTION (this << duration << channelType);
m_state->SwitchMaybeToCcaBusy (duration, channelType, per20MHzDurations);
m_lastPer20MHzDurations = per20MHzDurations;
}
std::vector<Time>

View File

@@ -103,6 +103,7 @@ public:
uint16_t GetMeasurementChannelWidth (const Ptr<const WifiPpdu> ppdu) const override;
void StartTx (Ptr<const WifiPpdu> ppdu) override;
Time CalculateTxDuration (WifiConstPsduMap psduMap, const WifiTxVector& txVector, WifiPhyBand band) const override;
void SwitchMaybeToCcaBusy (const Ptr<const WifiPpdu> ppdu) override;
double GetCcaThreshold (const Ptr<const WifiPpdu> ppdu, WifiChannelListType channelType) const override;
void NotifyCcaBusy (const Ptr<const WifiPpdu> ppdu, Time duration, WifiChannelListType channelType) override;
@@ -479,6 +480,15 @@ private:
uint8_t GetNumberBccEncoders (const WifiTxVector& txVector) const override;
Time GetSymbolDuration (const WifiTxVector& txVector) const override;
/**
* Notify PHY state helper to switch to CCA busy state,
*
* \param duration the duration of the CCA state
* \param channelType the channel type for which the CCA busy state is reported.
* \param per20MHzDurations the per-20 MHz CCA durations vector
*/
void NotifyCcaBusy (Time duration, WifiChannelListType channelType, const std::vector<Time>& per20MHzDurations);
/**
* Compute the per-20 MHz CCA durations vector that indicates
* for how long each 20 MHz subchannel (corresponding to the
@@ -516,8 +526,9 @@ private:
static const PpduFormats m_hePpduFormats; //!< HE PPDU formats
std::size_t m_rxHeTbPpdus; //!< Number of successfully received HE TB PPDUS
Ptr<ObssPdAlgorithm> m_obssPdAlgorithm; //!< OBSS-PD algorithm
std::size_t m_rxHeTbPpdus; //!< Number of successfully received HE TB PPDUS
Ptr<ObssPdAlgorithm> m_obssPdAlgorithm; //!< OBSS-PD algorithm
std::vector<Time> m_lastPer20MHzDurations; //!< Hold the last per-20 MHz CCA durations vector
}; //class HePhy
} //namespace ns3