wifi: Add support for TXNAV

This commit is contained in:
Stefano Avallone
2024-06-14 09:47:35 +02:00
parent f8d34561cc
commit 92f488bc35
5 changed files with 30 additions and 1 deletions

View File

@@ -52,7 +52,8 @@ FrameExchangeManager::GetTypeId()
}
FrameExchangeManager::FrameExchangeManager()
: m_navEnd(Seconds(0)),
: m_navEnd(0),
m_txNav(0),
m_linkId(0),
m_allowedWidth(0),
m_promisc(false),
@@ -573,6 +574,14 @@ FrameExchangeManager::ForwardMpduDown(Ptr<WifiMpdu> mpdu, WifiTxVector& txVector
auto psdu = Create<WifiPsdu>(mpdu, false);
FinalizeMacHeader(psdu);
m_allowedWidth = std::min(m_allowedWidth, txVector.GetChannelWidth());
auto txDuration = WifiPhy::CalculateTxDuration(psdu, txVector, m_phy->GetPhyBand());
// The TXNAV timer is a single timer, shared by the EDCAFs within a STA, that is initialized
// with the duration from the Duration/ID field in the frame most recently successfully
// transmitted by the TXOP holder, except for PS-Poll frames. (Sec.10.23.2.2 IEEE 802.11-2020)
if (!mpdu->GetHeader().IsPsPoll())
{
m_txNav = Max(m_txNav, Simulator::Now() + txDuration + mpdu->GetHeader().GetDuration());
}
m_phy->Send(psdu, txVector);
}
@@ -968,6 +977,8 @@ FrameExchangeManager::TransmissionFailed()
// A non-QoS station always releases the channel upon a transmission failure
NotifyChannelReleased(m_dcf);
m_dcf = nullptr;
// reset TXNAV because transmission failed
m_txNav = Simulator::Now();
}
void

View File

@@ -512,6 +512,7 @@ class FrameExchangeManager : public Object
Mac48Address m_self; //!< the MAC address of this device
Mac48Address m_bssid; //!< BSSID address (Mac48Address)
Time m_navEnd; //!< NAV expiration time
Time m_txNav; //!< the TXNAV timer
std::set<Mac48Address> m_sentRtsTo; //!< the STA(s) which we sent an RTS to (waiting for CTS)
std::set<Mac48Address>
m_sentFrameTo; //!< the STA(s) to which we sent a frame requesting a response

View File

@@ -998,6 +998,12 @@ HeFrameExchangeManager::ForwardPsduMapDown(WifiConstPsduMap psduMap, WifiTxVecto
txVector.SetAggregation(true);
}
auto txDuration = WifiPhy::CalculateTxDuration(psduMap, txVector, m_phy->GetPhyBand());
// The TXNAV timer is a single timer, shared by the EDCAFs within a STA, that is initialized
// with the duration from the Duration/ID field in the frame most recently successfully
// transmitted by the TXOP holder, except for PS-Poll frames. (Sec.10.23.2.2 IEEE 802.11-2020)
m_txNav = Max(m_txNav, Simulator::Now() + txDuration + psduMap.cbegin()->second->GetDuration());
m_phy->Send(psduMap, txVector);
}

View File

@@ -1148,6 +1148,15 @@ HtFrameExchangeManager::ForwardPsduDown(Ptr<const WifiPsdu> psdu, WifiTxVector&
txVector.SetAggregation(true);
}
auto txDuration = WifiPhy::CalculateTxDuration(psdu, txVector, m_phy->GetPhyBand());
// The TXNAV timer is a single timer, shared by the EDCAFs within a STA, that is initialized
// with the duration from the Duration/ID field in the frame most recently successfully
// transmitted by the TXOP holder, except for PS-Poll frames. (Sec.10.23.2.2 IEEE 802.11-2020)
if (!psdu->GetHeader(0).IsPsPoll())
{
m_txNav = Max(m_txNav, Simulator::Now() + txDuration + psdu->GetDuration());
}
m_phy->Send(psdu, txVector);
}

View File

@@ -657,6 +657,8 @@ QosFrameExchangeManager::TransmissionFailed()
}
m_initialFrame = false;
m_sentFrameTo.clear();
// reset TXNAV because transmission failed
m_txNav = Simulator::Now();
}
void