From 99a66d19a58c5eef846905af59fc5c5e10854a01 Mon Sep 17 00:00:00 2001 From: Stefano Avallone Date: Fri, 24 Nov 2023 14:27:02 +0100 Subject: [PATCH] wifi: Allow links blocked for specified reasons to be returned by GetLinkIds --- src/wifi/model/wifi-mac-queue-scheduler-impl.h | 17 ++++++++++++++--- src/wifi/model/wifi-mac-queue-scheduler.h | 6 +++++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/wifi/model/wifi-mac-queue-scheduler-impl.h b/src/wifi/model/wifi-mac-queue-scheduler-impl.h index 0bf92b47a..a28200066 100644 --- a/src/wifi/model/wifi-mac-queue-scheduler-impl.h +++ b/src/wifi/model/wifi-mac-queue-scheduler-impl.h @@ -79,7 +79,9 @@ class WifiMacQueueSchedulerImpl : public WifiMacQueueScheduler std::optional linkId, const WifiContainerQueueId& prevQueueId) final; /** \copydoc ns3::WifiMacQueueScheduler::GetLinkIds */ - std::list GetLinkIds(AcIndex ac, Ptr mpdu) final; + std::list GetLinkIds(AcIndex ac, + Ptr mpdu, + const std::list& ignoredReasons) final; /** \copydoc ns3::WifiMacQueueScheduler::BlockQueues */ void BlockQueues(WifiQueueBlockedReason reason, AcIndex ac, @@ -446,14 +448,23 @@ WifiMacQueueSchedulerImpl::SetPriority(AcIndex ac, template std::list -WifiMacQueueSchedulerImpl::GetLinkIds(AcIndex ac, Ptr mpdu) +WifiMacQueueSchedulerImpl::GetLinkIds( + AcIndex ac, + Ptr mpdu, + const std::list& ignoredReasons) { auto queueInfoIt = InitQueueInfo(ac, mpdu); std::list linkIds; // include only links that are not blocked in the returned list - for (const auto& [linkId, mask] : queueInfoIt->second.linkIds) + for (auto [linkId, mask] : queueInfoIt->second.linkIds) { + // reset the bits of the mask corresponding to the reasons to ignore + for (const auto reason : ignoredReasons) + { + mask.reset(static_cast(reason)); + } + if (mask.none()) { linkIds.emplace_back(linkId); diff --git a/src/wifi/model/wifi-mac-queue-scheduler.h b/src/wifi/model/wifi-mac-queue-scheduler.h index 51ccbcc62..3dcc17e6b 100644 --- a/src/wifi/model/wifi-mac-queue-scheduler.h +++ b/src/wifi/model/wifi-mac-queue-scheduler.h @@ -135,9 +135,13 @@ class WifiMacQueueScheduler : public Object * * \param ac the given Access Category * \param mpdu the given MPDU + * \param ignoredReasons list of reasons for blocking a link that are ignored * \return the list of the IDs of the links the given MPDU can be sent over */ - virtual std::list GetLinkIds(AcIndex ac, Ptr mpdu) = 0; + virtual std::list GetLinkIds( + AcIndex ac, + Ptr mpdu, + const std::list& ignoredReasons = {}) = 0; /** * Block the given set of links for the container queues of the given types and