wifi: Split calculation and setting of the TXOP holder
This commit is contained in:
committed by
Stefano Avallone
parent
f08ba56b33
commit
1bc60dae3e
@@ -2099,19 +2099,20 @@ HeFrameExchangeManager::IntraBssNavResetTimeout()
|
||||
m_channelAccessManager->NotifyNavResetNow(basicNav);
|
||||
}
|
||||
|
||||
void
|
||||
HeFrameExchangeManager::SetTxopHolder(Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector)
|
||||
std::optional<Mac48Address>
|
||||
HeFrameExchangeManager::FindTxopHolder(const WifiMacHeader& hdr, const WifiTxVector& txVector)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << psdu << txVector);
|
||||
NS_LOG_FUNCTION(this << hdr << txVector);
|
||||
|
||||
if (psdu->GetHeader(0).IsTrigger() && psdu->GetAddr2() == m_bssid)
|
||||
if (hdr.IsTrigger() && hdr.GetAddr2() == m_bssid)
|
||||
{
|
||||
m_txopHolder = m_bssid;
|
||||
return m_bssid;
|
||||
}
|
||||
else if (!txVector.IsUlMu()) // the sender of a TB PPDU is not the TXOP holder
|
||||
if (!txVector.IsUlMu()) // the sender of a TB PPDU is not the TXOP holder
|
||||
{
|
||||
VhtFrameExchangeManager::SetTxopHolder(psdu, txVector);
|
||||
return VhtFrameExchangeManager::FindTxopHolder(hdr, txVector);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
@@ -79,7 +79,8 @@ class HeFrameExchangeManager : public VhtFrameExchangeManager
|
||||
void SetWifiMac(const Ptr<WifiMac> mac) override;
|
||||
void CalculateAcknowledgmentTime(WifiAcknowledgment* acknowledgment) const override;
|
||||
void CalculateProtectionTime(WifiProtection* protection) const override;
|
||||
void SetTxopHolder(Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector) override;
|
||||
std::optional<Mac48Address> FindTxopHolder(const WifiMacHeader& hdr,
|
||||
const WifiTxVector& txVector) override;
|
||||
bool VirtualCsMediumIdle() const override;
|
||||
|
||||
/**
|
||||
|
||||
@@ -704,8 +704,16 @@ void
|
||||
QosFrameExchangeManager::SetTxopHolder(Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << psdu << txVector);
|
||||
if (auto txopHolder = FindTxopHolder(psdu->GetHeader(0), txVector))
|
||||
{
|
||||
m_txopHolder = *txopHolder;
|
||||
}
|
||||
}
|
||||
|
||||
const WifiMacHeader& hdr = psdu->GetHeader(0);
|
||||
std::optional<Mac48Address>
|
||||
QosFrameExchangeManager::FindTxopHolder(const WifiMacHeader& hdr, const WifiTxVector& txVector)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << hdr << txVector);
|
||||
|
||||
// A STA shall save the TXOP holder address for the BSS in which it is associated.
|
||||
// The TXOP holder address is the MAC address from the Address 2 field of the frame
|
||||
@@ -714,12 +722,13 @@ QosFrameExchangeManager::SetTxopHolder(Ptr<const WifiPsdu> psdu, const WifiTxVec
|
||||
if ((hdr.IsQosData() || hdr.IsMgt() || hdr.IsRts()) &&
|
||||
(hdr.GetAddr1() == m_bssid || hdr.GetAddr2() == m_bssid))
|
||||
{
|
||||
m_txopHolder = psdu->GetAddr2();
|
||||
return hdr.GetAddr2();
|
||||
}
|
||||
else if (hdr.IsCts() && hdr.GetAddr1() == m_bssid)
|
||||
if (hdr.IsCts() && hdr.GetAddr1() == m_bssid)
|
||||
{
|
||||
m_txopHolder = psdu->GetAddr1();
|
||||
return hdr.GetAddr1();
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -171,12 +171,14 @@ class QosFrameExchangeManager : public FrameExchangeManager
|
||||
virtual bool SendCfEndIfNeeded();
|
||||
|
||||
/**
|
||||
* Set the TXOP holder, if needed, based on the received frame
|
||||
* Determine the holder of the TXOP, if possible, based on the received frame
|
||||
*
|
||||
* \param psdu the received PSDU
|
||||
* \param hdr the MAC header of an MPDU included in the received PSDU
|
||||
* \param txVector TX vector of the received PSDU
|
||||
* \return the holder of the TXOP, if one was found
|
||||
*/
|
||||
virtual void SetTxopHolder(Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector);
|
||||
virtual std::optional<Mac48Address> FindTxopHolder(const WifiMacHeader& hdr,
|
||||
const WifiTxVector& txVector);
|
||||
|
||||
/**
|
||||
* Clear the TXOP holder if the NAV counted down to zero (includes the case of NAV reset).
|
||||
@@ -189,6 +191,14 @@ class QosFrameExchangeManager : public FrameExchangeManager
|
||||
QoS Control field of QoS data frames */
|
||||
|
||||
private:
|
||||
/**
|
||||
* Set the TXOP holder, if needed, based on the received frame
|
||||
*
|
||||
* \param psdu the received PSDU
|
||||
* \param txVector TX vector of the received PSDU
|
||||
*/
|
||||
void SetTxopHolder(Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector);
|
||||
|
||||
/**
|
||||
* Cancel the PIFS recovery event and have the EDCAF attempting PIFS recovery
|
||||
* release the channel.
|
||||
|
||||
Reference in New Issue
Block a user