wifi: Clear TXOP holder when NAV is reset or counts down to zero

This commit is contained in:
Stefano Avallone
2022-06-21 15:06:55 +02:00
parent ed89f4f439
commit 3161a2707f
3 changed files with 23 additions and 5 deletions

View File

@@ -1465,7 +1465,7 @@ HeFrameExchangeManager::SendQosNullFramesInTbPpdu(const CtrlTriggerHeader& trigg
if (trigger.GetCsRequired() && hdr.GetAddr2() != m_txopHolder && m_navEnd > Simulator::Now())
{
NS_LOG_DEBUG("Carrier Sensing required and channel busy (TA="
<< hdr.GetAddr2() << ", TxopHolder=" << m_txopHolder
<< hdr.GetAddr2() << ", TxopHolder=" << (m_txopHolder ? *m_txopHolder : "")
<< ", NAV end=" << m_navEnd.As(Time::S) << "), do nothing");
return;
}

View File

@@ -664,6 +664,13 @@ QosFrameExchangeManager::PreProcessFrame(Ptr<const WifiPsdu> psdu, const WifiTxV
}
}
// before updating the NAV, check if the NAV counted down to zero. In such a
// case, clear the saved TXOP holder address.
if (m_navEnd <= Simulator::Now())
{
m_txopHolder.reset();
}
FrameExchangeManager::PreProcessFrame(psdu, txVector);
}
@@ -698,6 +705,14 @@ QosFrameExchangeManager::SetTxopHolder(Ptr<const WifiPsdu> psdu, const WifiTxVec
}
}
void
QosFrameExchangeManager::NavResetTimeout()
{
NS_LOG_FUNCTION(this);
m_txopHolder.reset();
FrameExchangeManager::NavResetTimeout();
}
void
QosFrameExchangeManager::ReceiveMpdu(Ptr<const WifiMpdu> mpdu,
RxSignalInfo rxSignalInfo,

View File

@@ -22,6 +22,8 @@
#include "frame-exchange-manager.h"
#include <optional>
namespace ns3
{
@@ -111,6 +113,7 @@ class QosFrameExchangeManager : public FrameExchangeManager
bool inAmpdu) override;
void PreProcessFrame(Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector) override;
void PostProcessFrame(Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector) override;
void NavResetTimeout() override;
Time GetFrameDurationId(const WifiMacHeader& header,
uint32_t size,
const WifiTxParameters& txParams,
@@ -174,10 +177,10 @@ class QosFrameExchangeManager : public FrameExchangeManager
*/
virtual void SetTxopHolder(Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector);
Ptr<QosTxop> m_edca; //!< the EDCAF that gained channel access
Mac48Address m_txopHolder; //!< MAC address of the TXOP holder
bool m_setQosQueueSize; /**< whether to set the Queue Size subfield of the
QoS Control field of QoS data frames */
Ptr<QosTxop> m_edca; //!< the EDCAF that gained channel access
std::optional<Mac48Address> m_txopHolder; //!< MAC address of the TXOP holder
bool m_setQosQueueSize; /**< whether to set the Queue Size subfield of the
QoS Control field of QoS data frames */
private:
/**