wifi: Take sleep/off period into account when computing access grant start

This commit is contained in:
Stefano Avallone
2024-12-02 15:52:52 +01:00
parent 4496dcfe88
commit 384467cd96
3 changed files with 15 additions and 4 deletions

View File

@@ -219,6 +219,8 @@ ChannelAccessManager::ChannelAccessManager()
m_lastRxReceivedOk(true),
m_lastTxEnd(0),
m_lastSwitchingEnd(0),
m_lastSleepEnd(0),
m_lastOffEnd(0),
m_linkId(0)
{
NS_LOG_FUNCTION(this);
@@ -683,14 +685,18 @@ ChannelAccessManager::GetAccessGrantStart(bool ignoreNav) const
navAccessStart,
m_lastAckTimeoutEnd,
m_lastCtsTimeoutEnd,
m_lastSwitchingEnd});
m_lastSwitchingEnd,
m_lastSleepEnd,
m_lastOffEnd});
NS_LOG_INFO("access grant start="
<< accessGrantedStart.As(Time::US)
<< ", rx access start=" << rxAccessStart.As(Time::US) << ", busy access start="
<< busyAccessStart.As(Time::US) << ", tx access start=" << m_lastTxEnd.As(Time::US)
<< ", nav access start=" << navAccessStart.As(Time::US)
<< ", switching access start=" << m_lastSwitchingEnd.As(Time::US));
<< ", switching access start=" << m_lastSwitchingEnd.As(Time::US)
<< ", sleep access start=" << m_lastSleepEnd.As(Time::US)
<< ", off access start=" << m_lastOffEnd.As(Time::US));
return accessGrantedStart + GetSifs();
}
@@ -1146,6 +1152,7 @@ void
ChannelAccessManager::NotifyWakeupNow()
{
NS_LOG_FUNCTION(this);
m_lastSleepEnd = Simulator::Now();
for (auto txop : m_txops)
{
ResetBackoff(txop);
@@ -1157,6 +1164,7 @@ void
ChannelAccessManager::NotifyOnNow()
{
NS_LOG_FUNCTION(this);
m_lastOffEnd = Simulator::Now();
for (auto txop : m_txops)
{
ResetBackoff(txop);
@@ -1232,7 +1240,8 @@ void
ChannelAccessManager::UpdateLastIdlePeriod()
{
NS_LOG_FUNCTION(this);
Time idleStart = std::max({m_lastTxEnd, m_lastRx.end, m_lastSwitchingEnd});
Time idleStart =
std::max({m_lastTxEnd, m_lastRx.end, m_lastSwitchingEnd, m_lastSleepEnd, m_lastOffEnd});
Time now = Simulator::Now();
if (idleStart >= now)

View File

@@ -480,6 +480,8 @@ class ChannelAccessManager : public Object
std::map<WifiChannelListType, Timespan>
m_lastIdle; //!< the last idle start and end time for each channel type
Time m_lastSwitchingEnd; //!< the last switching end time
Time m_lastSleepEnd; //!< the last sleep end time
Time m_lastOffEnd; //!< the last off end time
Time m_eifsNoDifs; //!< EIFS no DIFS time
EventId m_accessTimeout; //!< the access timeout ID
bool m_generateBackoffOnNoTx; //!< whether the backoff should be invoked when the AC gains the

View File

@@ -301,7 +301,7 @@ EmlsrOperationsTestBase::DoSetup()
{
RngSeedManager::SetSeed(1);
RngSeedManager::SetRun(1);
int64_t streamNumber = 100;
int64_t streamNumber = 11;
Config::SetDefault("ns3::WifiMac::MpduBufferSize", UintegerValue(64));
Config::SetDefault("ns3::EmlsrManager::InDeviceInterference", BooleanValue(true));