wifi: Add a WifiMac method to check if TX is blocked on a link

This commit is contained in:
Stefano Avallone
2024-05-13 10:41:15 +02:00
parent 2d4ff42649
commit bb22630df7
2 changed files with 35 additions and 0 deletions

View File

@@ -1620,6 +1620,25 @@ WifiMac::UnblockUnicastTxOnLinks(WifiQueueBlockedReason reason,
}
}
bool
WifiMac::GetTxBlockedOnLink(AcIndex ac,
const WifiContainerQueueId& queueId,
uint8_t linkId,
WifiQueueBlockedReason reason) const
{
auto mask = m_scheduler->GetQueueLinkMask(ac, queueId, linkId);
if (!mask.has_value())
{
return true; // the link may have not been setup
}
if (reason == WifiQueueBlockedReason::REASONS_COUNT)
{
return mask->any();
}
return mask->test(static_cast<std::size_t>(reason));
}
void
WifiMac::Enqueue(Ptr<Packet> packet, Mac48Address to)
{

View File

@@ -351,6 +351,22 @@ class WifiMac : public Object
const Mac48Address& address,
const std::set<uint8_t>& linkIds);
/**
* Check whether the transmission of the packets in the given container queue of the given
* Access Category are blocked on the given link for the given reason (if any).
*
* \param ac the given Access Category
* \param queueId the given container queue
* \param linkId the ID of the given link
* \param reason the reason to block transmissions (REASONS_COUNT indicate no reason)
* \return whether transmission is blocked
*/
bool GetTxBlockedOnLink(
AcIndex ac,
const WifiContainerQueueId& queueId,
uint8_t linkId,
WifiQueueBlockedReason reason = WifiQueueBlockedReason::REASONS_COUNT) const;
/**
* Return true if packets can be forwarded to the given destination,
* false otherwise.