wifi: Use constexpr values instead of true/false when calling StartAccessAfterEvent

This commit is contained in:
Stefano Avallone
2023-11-28 09:11:54 +01:00
committed by Stefano Avallone
parent cec80188dd
commit fb18aa503c
6 changed files with 28 additions and 13 deletions

View File

@@ -197,12 +197,14 @@ EhtFrameExchangeManager::StartTransmission(Ptr<Txop> edca, uint16_t allowedWidth
NS_LOG_DEBUG("No new TXOP attempts allowed while MediumSyncDelay is running");
// request channel access if needed when the MediumSyncDelay timer expires; in the
// meantime no queued packet can be transmitted
Simulator::Schedule(emlsrManager->GetMediumSyncDuration() - *elapsed,
&Txop::StartAccessAfterEvent,
edca,
m_linkId,
false, // queued frames cannot be transmitted until MSD expires
false); // generate backoff regardless of medium busy
Simulator::Schedule(
emlsrManager->GetMediumSyncDuration() - *elapsed,
&Txop::StartAccessAfterEvent,
edca,
m_linkId,
Txop::DIDNT_HAVE_FRAMES_TO_TRANSMIT, // queued frames cannot be transmitted until
// MSD expires
Txop::DONT_CHECK_MEDIUM_BUSY); // generate backoff regardless of medium busy
NotifyChannelReleased(edca);
return false;
}

View File

@@ -138,7 +138,7 @@ QosTxop::QosTxop(AcIndex ac)
// start access (if needed) on all the links
for (const auto& [id, link] : GetLinks())
{
StartAccessAfterEvent(id, hasFramesToTransmit.at(id), true);
StartAccessAfterEvent(id, hasFramesToTransmit.at(id), CHECK_MEDIUM_BUSY);
}
}));
m_queue->TraceConnectWithoutContext(

View File

@@ -1452,13 +1452,17 @@ StaWifiMac::ReceiveAssocResp(Ptr<const WifiMpdu> mpdu, uint8_t linkId)
{
if (const auto txop = GetTxop())
{
txop->StartAccessAfterEvent(id, false, true);
txop->StartAccessAfterEvent(id,
Txop::DIDNT_HAVE_FRAMES_TO_TRANSMIT,
Txop::CHECK_MEDIUM_BUSY);
}
for (const auto [acIndex, ac] : wifiAcList)
{
if (const auto edca = GetQosTxop(acIndex))
{
edca->StartAccessAfterEvent(id, false, true);
edca->StartAccessAfterEvent(id,
Txop::DIDNT_HAVE_FRAMES_TO_TRANSMIT,
Txop::CHECK_MEDIUM_BUSY);
}
}
}

View File

@@ -555,7 +555,7 @@ Txop::Queue(Ptr<WifiMpdu> mpdu)
this,
linkId,
hasFramesToTransmit.at(linkId),
true);
CHECK_MEDIUM_BUSY);
}
}
}
@@ -669,7 +669,7 @@ Txop::NotifyWakeUp(uint8_t linkId)
{
NS_LOG_FUNCTION(this << +linkId);
// before wake up, no packet can be transmitted
StartAccessAfterEvent(linkId, false, false);
StartAccessAfterEvent(linkId, DIDNT_HAVE_FRAMES_TO_TRANSMIT, DONT_CHECK_MEDIUM_BUSY);
}
void
@@ -679,7 +679,7 @@ Txop::NotifyOn()
for (const auto& [id, link] : m_links)
{
// before being turned on, no packet can be transmitted
StartAccessAfterEvent(id, false, false);
StartAccessAfterEvent(id, DIDNT_HAVE_FRAMES_TO_TRANSMIT, DONT_CHECK_MEDIUM_BUSY);
}
}

View File

@@ -412,6 +412,15 @@ class Txop : public Object
*/
void StartAccessAfterEvent(uint8_t linkId, bool hadFramesToTransmit, bool checkMediumBusy);
static constexpr bool HAD_FRAMES_TO_TRANSMIT =
true; //!< packets available for transmission were in the queue
static constexpr bool DIDNT_HAVE_FRAMES_TO_TRANSMIT =
false; //!< no packet available for transmission was in the queue
static constexpr bool CHECK_MEDIUM_BUSY =
true; //!< generation of backoff (also) depends on the busy/idle state of the medium
static constexpr bool DONT_CHECK_MEDIUM_BUSY =
false; //!< generation of backoff is independent of the busy/idle state of the medium
/**
* \param nSlots the number of slots of the backoff.
* \param linkId the ID of the given link

View File

@@ -1470,7 +1470,7 @@ WifiMac::UnblockUnicastTxOnLinks(WifiQueueBlockedReason reason,
GetQosTxop(acIndex),
linkId,
hasFramesToTransmit,
true); // generate backoff if medium busy
Txop::CHECK_MEDIUM_BUSY); // generate backoff if medium busy
}
}
}