A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-mac-queue-scheduler-impl.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Universita' degli Studi di Napoli Federico II
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Stefano Avallone <stavallo@unina.it>
18 */
19
20#ifndef WIFI_MAC_QUEUE_SCHEDULER_IMPL_H
21#define WIFI_MAC_QUEUE_SCHEDULER_IMPL_H
22
24#include "wifi-mac-queue.h"
25#include "wifi-mac.h"
26
27#include <functional>
28#include <list>
29#include <map>
30#include <numeric>
31#include <unordered_map>
32#include <vector>
33
35
36namespace ns3
37{
38
39class WifiMpdu;
40class WifiMacQueue;
41
49template <class Priority, class Compare = std::less<Priority>>
51{
52 public:
54 friend class ::WifiMacQueueDropOldestTest;
55
60 static TypeId GetTypeId();
61
66
68 void SetWifiMac(Ptr<WifiMac> mac) final;
70 std::optional<WifiContainerQueueId> GetNext(AcIndex ac, uint8_t linkId) final;
72 std::optional<WifiContainerQueueId> GetNext(AcIndex ac,
73 uint8_t linkId,
74 const WifiContainerQueueId& prevQueueId) final;
76 std::list<uint8_t> GetLinkIds(AcIndex ac, Ptr<const WifiMpdu> mpdu) final;
79 AcIndex ac,
80 const std::list<WifiContainerQueueType>& types,
81 const Mac48Address& rxAddress,
82 const Mac48Address& txAddress,
83 const std::set<uint8_t>& tids,
84 const std::set<uint8_t>& linkIds) final;
87 AcIndex ac,
88 const std::list<WifiContainerQueueType>& types,
89 const Mac48Address& rxAddress,
90 const Mac48Address& txAddress,
91 const std::set<uint8_t>& tids,
92 const std::set<uint8_t>& linkIds) final;
94 std::optional<Mask> GetQueueLinkMask(AcIndex ac,
95 const WifiContainerQueueId& queueId,
96 uint8_t linkId) final;
100 void NotifyEnqueue(AcIndex ac, Ptr<WifiMpdu> mpdu) final;
102 void NotifyDequeue(AcIndex ac, const std::list<Ptr<WifiMpdu>>& mpdus) final;
104 void NotifyRemove(AcIndex ac, const std::list<Ptr<WifiMpdu>>& mpdus) final;
105
106 protected:
108 void DoDispose() override;
109
117 void SetPriority(AcIndex ac, const WifiContainerQueueId& queueId, const Priority& priority);
118
119 struct QueueInfo;
120
127 using QueueInfoMap = std::unordered_map<WifiContainerQueueId, QueueInfo>;
128
130 using QueueInfoPair = std::pair<const WifiContainerQueueId, QueueInfo>;
131
141 using SortedQueues = std::multimap<Priority, std::reference_wrapper<QueueInfoPair>, Compare>;
142
147 {
148 std::optional<typename SortedQueues::iterator>
151 std::map<uint8_t, Mask> linkIds;
155 };
156
161 {
165 };
166
176
184
185 private:
197 typename QueueInfoMap::iterator InitQueueInfo(AcIndex ac, Ptr<const WifiMpdu> mpdu);
198
209 std::optional<WifiContainerQueueId> DoGetNext(AcIndex ac,
210 uint8_t linkId,
211 typename SortedQueues::iterator sortedQueuesIt);
212
229 virtual void DoNotifyEnqueue(AcIndex ac, Ptr<WifiMpdu> mpdu) = 0;
238 virtual void DoNotifyDequeue(AcIndex ac, const std::list<Ptr<WifiMpdu>>& mpdus) = 0;
247 virtual void DoNotifyRemove(AcIndex ac, const std::list<Ptr<WifiMpdu>>& mpdus) = 0;
248
263 void DoBlockQueues(bool block,
265 AcIndex ac,
266 const std::list<WifiContainerQueueType>& types,
267 const Mac48Address& rxAddress,
268 const Mac48Address& txAddress,
269 const std::set<uint8_t>& tids,
270 const std::set<uint8_t>& linkIds);
271
272 std::vector<PerAcInfo> m_perAcInfo{AC_UNDEF};
274};
275
280template <class Priority, class Compare>
282 : NS_LOG_TEMPLATE_DEFINE("WifiMacQueueScheduler")
283{
284}
285
286template <class Priority, class Compare>
287TypeId
289{
290 static TypeId tid = TypeId("ns3::WifiMacQueueSchedulerImpl")
292 .SetGroupName("Wifi");
293 return tid;
294}
295
296template <class Priority, class Compare>
297void
299{
300 m_perAcInfo.clear();
302}
303
304template <class Priority, class Compare>
305void
307{
308 for (auto ac : {AC_BE, AC_BK, AC_VI, AC_VO, AC_BE_NQOS, AC_BEACON})
309 {
310 if (auto queue = mac->GetTxopQueue(ac); queue != nullptr)
311 {
312 m_perAcInfo.at(ac).wifiMacQueue = queue;
313 queue->SetScheduler(this);
314 }
315 }
317}
318
319template <class Priority, class Compare>
322{
323 NS_ASSERT(static_cast<uint8_t>(ac) < AC_UNDEF);
324 return m_perAcInfo.at(ac).wifiMacQueue;
325}
326
327template <class Priority, class Compare>
330{
331 NS_ASSERT(static_cast<uint8_t>(ac) < AC_UNDEF);
332 return m_perAcInfo.at(ac).sortedQueues;
333}
334
335template <class Priority, class Compare>
338{
339 NS_LOG_FUNCTION(this << ac << *mpdu);
340
341 auto queueId = WifiMacQueueContainer::GetQueueId(mpdu);
342 // insert queueId in the queue info map if not present yet
343 auto [queueInfoIt, ret] = m_perAcInfo[ac].queueInfoMap.insert({queueId, QueueInfo()});
344
345 // Initialize/update the set of link IDs depending on the container queue type
346 if (GetMac() && GetMac()->GetNLinks() > 1 &&
347 mpdu->GetHeader().GetAddr2() == GetMac()->GetAddress())
348 {
349 // this is an MLD and the TA field of the frame contains the MLD address,
350 // which means that the frame can be sent on multiple links
351 const auto rxAddr = mpdu->GetHeader().GetAddr1();
352
353 // this assert checks that the RA field also contain an MLD address, unless
354 // it contains the broadcast address
355 NS_ASSERT_MSG(rxAddr.IsGroup() || GetMac()->GetMldAddress(rxAddr),
356 "Address 1 (" << rxAddr << ") is not an MLD address");
357
358 // this assert checks that association (ML setup) has been established
359 // between sender and receiver (unless the receiver is the broadcast address)
360 NS_ASSERT_MSG(GetMac()->CanForwardPacketsTo(rxAddr), "Cannot forward frame to " << rxAddr);
361
362 // we have to include all the links in case of broadcast frame (we are an AP)
363 // and the links that have been setup with the receiver in case of unicast frame
364 for (uint8_t linkId = 0; linkId < GetMac()->GetNLinks(); linkId++)
365 {
366 if (rxAddr.IsGroup() ||
367 GetMac()->GetWifiRemoteStationManager(linkId)->GetAffiliatedStaAddress(rxAddr))
368 {
369 // the mask is not modified if linkId is already in the map
370 queueInfoIt->second.linkIds.emplace(linkId, Mask{});
371 }
372 else
373 {
374 // this link is no (longer) setup
375 queueInfoIt->second.linkIds.erase(linkId);
376 }
377 }
378 }
379 else
380 {
381 // the TA field of the frame contains a link address, which means that the
382 // frame can only be sent on the corresponding link
383 auto linkId = GetMac() ? GetMac()->GetLinkIdByAddress(mpdu->GetHeader().GetAddr2())
384 : SINGLE_LINK_OP_ID; // make unit test happy
385 NS_ASSERT(linkId.has_value());
386 auto& linkIdsMap = queueInfoIt->second.linkIds;
387 NS_ASSERT_MSG(linkIdsMap.size() <= 1,
388 "At most one link can be associated with this container queue");
389 // set the link map to contain one entry corresponding to the computed link ID;
390 // unless the link map already contained such an entry (in which case the mask
391 // is preserved)
392 if (linkIdsMap.empty() || linkIdsMap.cbegin()->first != *linkId)
393 {
394 linkIdsMap = {{*linkId, Mask{}}};
395 }
396 }
397
398 return queueInfoIt;
399}
400
401template <class Priority, class Compare>
402void
404 const WifiContainerQueueId& queueId,
405 const Priority& priority)
406{
407 NS_LOG_FUNCTION(this << +ac);
408 NS_ASSERT(static_cast<uint8_t>(ac) < AC_UNDEF);
409
410 NS_ABORT_MSG_IF(GetWifiMacQueue(ac)->GetNBytes(queueId) == 0,
411 "Cannot set the priority of an empty queue");
412
413 auto queueInfoIt = m_perAcInfo[ac].queueInfoMap.find(queueId);
414 NS_ASSERT_MSG(queueInfoIt != m_perAcInfo[ac].queueInfoMap.end(),
415 "No queue info for the given container queue");
416 typename SortedQueues::iterator sortedQueuesIt;
417
418 if (queueInfoIt->second.priorityIt.has_value())
419 {
420 // an element for queueId is present in the set of sorted queues. If the priority
421 // has not changed, do nothing. Otherwise, unlink the node containing such element,
422 // change the priority and insert it back
423 if (queueInfoIt->second.priorityIt.value()->first == priority)
424 {
425 return;
426 }
427
428 auto handle = m_perAcInfo[ac].sortedQueues.extract(queueInfoIt->second.priorityIt.value());
429 handle.key() = priority;
430 sortedQueuesIt = m_perAcInfo[ac].sortedQueues.insert(std::move(handle));
431 }
432 else
433 {
434 // an element for queueId is not present in the set of sorted queues
435 sortedQueuesIt = m_perAcInfo[ac].sortedQueues.insert({priority, std::ref(*queueInfoIt)});
436 }
437 // update the stored iterator
438 queueInfoIt->second.priorityIt = sortedQueuesIt;
439}
440
441template <class Priority, class Compare>
442std::list<uint8_t>
444{
445 auto queueInfoIt = InitQueueInfo(ac, mpdu);
446 std::list<uint8_t> linkIds;
447
448 // include only links that are not blocked in the returned list
449 for (const auto [linkId, mask] : queueInfoIt->second.linkIds)
450 {
451 if (mask.none())
452 {
453 linkIds.emplace_back(linkId);
454 }
455 }
456
457 return linkIds;
458}
459
460template <class Priority, class Compare>
461void
463 bool block,
465 AcIndex ac,
466 const std::list<WifiContainerQueueType>& types,
467 const Mac48Address& rxAddress,
468 const Mac48Address& txAddress,
469 const std::set<uint8_t>& tids,
470 const std::set<uint8_t>& linkIds)
471{
472 NS_LOG_FUNCTION(this << block << reason << ac << rxAddress << txAddress);
473 std::list<WifiMacHeader> headers;
474
475 for (const auto queueType : types)
476 {
477 switch (queueType)
478 {
479 case WIFI_CTL_QUEUE:
480 headers.emplace_back(WIFI_MAC_CTL_BACKREQ);
481 break;
482 case WIFI_MGT_QUEUE:
483 headers.emplace_back(WIFI_MAC_MGT_ACTION);
484 break;
486 NS_ASSERT_MSG(!tids.empty(),
487 "TID must be specified for queues containing QoS data frames");
488 for (const auto tid : tids)
489 {
490 headers.emplace_back(WIFI_MAC_QOSDATA);
491 headers.back().SetQosTid(tid);
492 }
493 break;
494 case WIFI_DATA_QUEUE:
495 headers.emplace_back(WIFI_MAC_DATA);
496 break;
497 }
498 }
499 for (auto& hdr : headers)
500 {
501 hdr.SetAddr1(rxAddress);
502 hdr.SetAddr2(txAddress);
503
504 auto queueInfoIt = InitQueueInfo(ac, Create<WifiMpdu>(Create<Packet>(), hdr));
505 for (auto& [linkId, mask] : queueInfoIt->second.linkIds)
506 {
507 if (linkIds.empty() || linkIds.count(linkId) > 0)
508 {
509 mask.set(static_cast<std::size_t>(reason), block);
510 }
511 }
512 }
513}
514
515template <class Priority, class Compare>
516void
519 AcIndex ac,
520 const std::list<WifiContainerQueueType>& types,
521 const Mac48Address& rxAddress,
522 const Mac48Address& txAddress,
523 const std::set<uint8_t>& tids,
524 const std::set<uint8_t>& linkIds)
525{
526 DoBlockQueues(true, reason, ac, types, rxAddress, txAddress, tids, linkIds);
527}
528
529template <class Priority, class Compare>
530void
533 AcIndex ac,
534 const std::list<WifiContainerQueueType>& types,
535 const Mac48Address& rxAddress,
536 const Mac48Address& txAddress,
537 const std::set<uint8_t>& tids,
538 const std::set<uint8_t>& linkIds)
539{
540 DoBlockQueues(false, reason, ac, types, rxAddress, txAddress, tids, linkIds);
541}
542
543template <class Priority, class Compare>
544std::optional<WifiMacQueueScheduler::Mask>
546 const WifiContainerQueueId& queueId,
547 uint8_t linkId)
548{
549 NS_LOG_FUNCTION(this << +ac << +linkId);
550
551 const auto queueInfoIt = m_perAcInfo[ac].queueInfoMap.find(queueId);
552
553 if (queueInfoIt == m_perAcInfo[ac].queueInfoMap.cend())
554 {
555 // the given container queue does not exist
556 return std::nullopt;
557 }
558
559 const auto& linkIds = queueInfoIt->second.linkIds;
560 if (const auto linkIt = linkIds.find(linkId); linkIt != linkIds.cend())
561 {
562 return linkIt->second;
563 }
564
565 return std::nullopt;
566}
567
568template <class Priority, class Compare>
569std::optional<WifiContainerQueueId>
571{
572 NS_LOG_FUNCTION(this << +ac << +linkId);
573 return DoGetNext(ac, linkId, m_perAcInfo[ac].sortedQueues.begin());
574}
575
576template <class Priority, class Compare>
577std::optional<WifiContainerQueueId>
579 uint8_t linkId,
580 const WifiContainerQueueId& prevQueueId)
581{
582 NS_LOG_FUNCTION(this << +ac << +linkId);
583
584 auto queueInfoIt = m_perAcInfo[ac].queueInfoMap.find(prevQueueId);
585 NS_ABORT_IF(queueInfoIt == m_perAcInfo[ac].queueInfoMap.end() ||
586 !queueInfoIt->second.priorityIt.has_value());
587
588 auto sortedQueuesIt = queueInfoIt->second.priorityIt.value();
589 NS_ABORT_IF(sortedQueuesIt == m_perAcInfo[ac].sortedQueues.end());
590
591 return DoGetNext(ac, linkId, ++sortedQueuesIt);
592}
593
594template <class Priority, class Compare>
595std::optional<WifiContainerQueueId>
597 AcIndex ac,
598 uint8_t linkId,
599 typename SortedQueues::iterator sortedQueuesIt)
600{
601 NS_LOG_FUNCTION(this << +ac << +linkId);
602 NS_ASSERT(static_cast<uint8_t>(ac) < AC_UNDEF);
603
604 while (sortedQueuesIt != m_perAcInfo[ac].sortedQueues.end())
605 {
606 const auto& queueInfoPair = sortedQueuesIt->second.get();
607 const auto& linkIds = queueInfoPair.second.linkIds;
608
609 if (const auto linkIt = linkIds.find(linkId);
610 linkIt != linkIds.cend() && linkIt->second.none())
611 {
612 // Packets in this queue can be sent over the link we got channel access on.
613 // Now remove packets with expired lifetime from this queue.
614 // In case the queue becomes empty, the queue is removed from the sorted
615 // list and sortedQueuesIt is invalidated; thus, store an iterator to the
616 // previous queue in the sorted list (if any) to resume the search afterwards.
617 std::optional<typename SortedQueues::iterator> prevQueueIt;
618 if (sortedQueuesIt != m_perAcInfo[ac].sortedQueues.begin())
619 {
620 prevQueueIt = std::prev(sortedQueuesIt);
621 }
622
623 GetWifiMacQueue(ac)->ExtractExpiredMpdus(queueInfoPair.first);
624
625 if (GetWifiMacQueue(ac)->GetNBytes(queueInfoPair.first) == 0)
626 {
627 sortedQueuesIt = (prevQueueIt.has_value() ? std::next(prevQueueIt.value())
628 : m_perAcInfo[ac].sortedQueues.begin());
629 continue;
630 }
631 break;
632 }
633
634 sortedQueuesIt++;
635 }
636
637 std::optional<WifiContainerQueueId> queueId;
638
639 if (sortedQueuesIt != m_perAcInfo[ac].sortedQueues.end())
640 {
641 queueId = sortedQueuesIt->second.get().first;
642 }
643 return queueId;
644}
645
646template <class Priority, class Compare>
649{
650 NS_LOG_FUNCTION(this << +ac << *mpdu);
651 return HasToDropBeforeEnqueuePriv(ac, mpdu);
652}
653
654template <class Priority, class Compare>
655void
657{
658 NS_LOG_FUNCTION(this << +ac << *mpdu);
659 NS_ASSERT(static_cast<uint8_t>(ac) < AC_UNDEF);
660
661 // add information for the queue storing the MPDU to the queue info map, if not present yet
662 auto queueInfoIt = InitQueueInfo(ac, mpdu);
663
664 DoNotifyEnqueue(ac, mpdu);
665
666 if (!queueInfoIt->second.priorityIt.has_value())
667 {
669 "No info for the queue the MPDU was stored into (forgot to call SetPriority()?)");
670 }
671}
672
673template <class Priority, class Compare>
674void
676 const std::list<Ptr<WifiMpdu>>& mpdus)
677{
678 NS_LOG_FUNCTION(this << +ac);
679 NS_ASSERT(static_cast<uint8_t>(ac) < AC_UNDEF);
680
681 DoNotifyDequeue(ac, mpdus);
682
683 std::list<WifiContainerQueueId> queueIds;
684
685 for (const auto& mpdu : mpdus)
686 {
687 queueIds.push_back(WifiMacQueueContainer::GetQueueId(mpdu));
688 }
689
690 for (const auto& queueId : queueIds)
691 {
692 if (GetWifiMacQueue(ac)->GetNBytes(queueId) == 0)
693 {
694 // The queue has now become empty and needs to be removed from the sorted
695 // list kept by the scheduler
696 auto queueInfoIt = m_perAcInfo[ac].queueInfoMap.find(queueId);
697 NS_ASSERT(queueInfoIt != m_perAcInfo[ac].queueInfoMap.end());
698 if (queueInfoIt->second.priorityIt.has_value())
699 {
700 m_perAcInfo[ac].sortedQueues.erase(queueInfoIt->second.priorityIt.value());
701 queueInfoIt->second.priorityIt.reset();
702 }
703 }
704 }
705}
706
707template <class Priority, class Compare>
708void
710 const std::list<Ptr<WifiMpdu>>& mpdus)
711{
712 NS_LOG_FUNCTION(this << +ac);
713 NS_ASSERT(static_cast<uint8_t>(ac) < AC_UNDEF);
714
715 DoNotifyRemove(ac, mpdus);
716
717 std::list<WifiContainerQueueId> queueIds;
718
719 for (const auto& mpdu : mpdus)
720 {
721 queueIds.push_back(WifiMacQueueContainer::GetQueueId(mpdu));
722 }
723
724 for (const auto& queueId : queueIds)
725 {
726 if (GetWifiMacQueue(ac)->GetNBytes(queueId) == 0)
727 {
728 // The queue has now become empty and needs to be removed from the sorted
729 // list kept by the scheduler
730 auto queueInfoIt = m_perAcInfo[ac].queueInfoMap.find(queueId);
731 NS_ASSERT(queueInfoIt != m_perAcInfo[ac].queueInfoMap.end());
732 if (queueInfoIt->second.priorityIt.has_value())
733 {
734 m_perAcInfo[ac].sortedQueues.erase(queueInfoIt->second.priorityIt.value());
735 queueInfoIt->second.priorityIt.reset();
736 }
737 }
738 }
739}
740
741} // namespace ns3
742
743#endif /* WIFI_MAC_QUEUE_SCHEDULER_IMPL_H */
Test DROP_OLDEST setting.
an EUI-48 address
Definition: mac48-address.h:46
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:936
static WifiContainerQueueId GetQueueId(Ptr< const WifiMpdu > mpdu)
Return the QueueId identifying the container queue in which the given MPDU is (or is to be) enqueued.
WifiMacQueueScheduler is an abstract base class defining the public interface for a wifi MAC queue sc...
virtual void SetWifiMac(Ptr< WifiMac > mac)
Set the wifi MAC.
std::bitset< static_cast< std::size_t >(WifiQueueBlockedReason::REASONS_COUNT)> Mask
Bitset identifying the reasons to block individual links for a container queue.
void DoDispose() override
Destructor implementation.
WifiMacQueueSchedulerImpl is a template class enabling the definition of different types of priority ...
void DoBlockQueues(bool block, WifiQueueBlockedReason reason, AcIndex ac, const std::list< WifiContainerQueueType > &types, const Mac48Address &rxAddress, const Mac48Address &txAddress, const std::set< uint8_t > &tids, const std::set< uint8_t > &linkIds)
Block or unblock the given set of links for the container queues of the given types and Access Catego...
void UnblockQueues(WifiQueueBlockedReason reason, AcIndex ac, const std::list< WifiContainerQueueType > &types, const Mac48Address &rxAddress, const Mac48Address &txAddress, const std::set< uint8_t > &tids, const std::set< uint8_t > &linkIds) final
Unblock the given set of links for the container queues of the given types and Access Category that h...
std::pair< const WifiContainerQueueId, QueueInfo > QueueInfoPair
typedef for a QueueInfoMap element
std::optional< Mask > GetQueueLinkMask(AcIndex ac, const WifiContainerQueueId &queueId, uint8_t linkId) final
Get the mask associated with the given container queue indicating whether the given link is blocked a...
void SetWifiMac(Ptr< WifiMac > mac) final
Set the wifi MAC.
void DoDispose() override
Destructor implementation.
void NotifyDequeue(AcIndex ac, const std::list< Ptr< WifiMpdu > > &mpdus) final
Notify the scheduler that the given list of MPDUs have been dequeued by the given Access Category.
std::unordered_map< WifiContainerQueueId, QueueInfo > QueueInfoMap
Map identifiers (QueueIds) to information associated with container queues.
std::optional< WifiContainerQueueId > GetNext(AcIndex ac, uint8_t linkId, const WifiContainerQueueId &prevQueueId) final
Get the next queue to serve after the given one.
void NotifyEnqueue(AcIndex ac, Ptr< WifiMpdu > mpdu) final
Notify the scheduler that the given MPDU has been enqueued by the given Access Category.
virtual void DoNotifyDequeue(AcIndex ac, const std::list< Ptr< WifiMpdu > > &mpdus)=0
Notify the scheduler that the given list of MPDUs have been dequeued by the given Access Category.
void BlockQueues(WifiQueueBlockedReason reason, AcIndex ac, const std::list< WifiContainerQueueType > &types, const Mac48Address &rxAddress, const Mac48Address &txAddress, const std::set< uint8_t > &tids, const std::set< uint8_t > &linkIds) final
Block the given set of links for the container queues of the given types and Access Category that hol...
virtual void DoNotifyEnqueue(AcIndex ac, Ptr< WifiMpdu > mpdu)=0
Notify the scheduler that the given MPDU has been enqueued by the given Access Category.
Ptr< WifiMacQueue > GetWifiMacQueue(AcIndex ac) const
Get the wifi MAC queue associated with the given Access Category.
std::list< uint8_t > GetLinkIds(AcIndex ac, Ptr< const WifiMpdu > mpdu) final
Get the list of the IDs of the links the given MPDU (belonging to the given Access Category) can be s...
static TypeId GetTypeId()
Get the type ID.
std::optional< WifiContainerQueueId > DoGetNext(AcIndex ac, uint8_t linkId, typename SortedQueues::iterator sortedQueuesIt)
Get the next queue to serve.
std::vector< PerAcInfo > m_perAcInfo
vector of per-AC information
const SortedQueues & GetSortedQueues(AcIndex ac) const
Get a const reference to the sorted list of container queues for the given Access Category.
Ptr< WifiMpdu > HasToDropBeforeEnqueue(AcIndex ac, Ptr< WifiMpdu > mpdu) final
Check whether an MPDU has to be dropped before enqueuing the given MPDU.
void NotifyRemove(AcIndex ac, const std::list< Ptr< WifiMpdu > > &mpdus) final
Notify the scheduler that the given list of MPDUs have been removed by the given Access Category.
virtual Ptr< WifiMpdu > HasToDropBeforeEnqueuePriv(AcIndex ac, Ptr< WifiMpdu > mpdu)=0
Check whether an MPDU has to be dropped before enqueuing the given MPDU.
std::optional< WifiContainerQueueId > GetNext(AcIndex ac, uint8_t linkId) final
Get the next queue to serve, which is guaranteed to contain at least an MPDU whose lifetime has not e...
QueueInfoMap::iterator InitQueueInfo(AcIndex ac, Ptr< const WifiMpdu > mpdu)
If no information for the container queue used to store the given MPDU of the given Access Category i...
std::multimap< Priority, std::reference_wrapper< QueueInfoPair >, Compare > SortedQueues
List of container queues sorted in decreasing order of priority.
virtual void DoNotifyRemove(AcIndex ac, const std::list< Ptr< WifiMpdu > > &mpdus)=0
Notify the scheduler that the given list of MPDUs have been removed by the given Access Category.
void SetPriority(AcIndex ac, const WifiContainerQueueId &queueId, const Priority &priority)
Set the priority for the given container queue belonging to the given Access Category.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:66
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:86
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition: abort.h:49
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition: abort.h:108
#define NS_ABORT_IF(cond)
Abnormal program termination if a condition is true.
Definition: abort.h:76
#define NS_LOG_TEMPLATE_DEFINE(name)
Initialize a reference to a Log component.
Definition: log.h:236
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
WifiQueueBlockedReason
Enumeration of the reasons to block container queues.
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:72
@ AC_BE_NQOS
Non-QoS.
Definition: qos-utils.h:82
@ AC_BE
Best Effort.
Definition: qos-utils.h:74
@ AC_VO
Voice.
Definition: qos-utils.h:80
@ AC_VI
Video.
Definition: qos-utils.h:78
@ AC_BK
Background.
Definition: qos-utils.h:76
@ AC_UNDEF
Total number of ACs.
Definition: qos-utils.h:86
@ AC_BEACON
Beacon queue.
Definition: qos-utils.h:84
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::tuple< WifiContainerQueueType, WifiReceiverAddressType, Mac48Address, std::optional< uint8_t > > WifiContainerQueueId
Tuple (queue type, receiver address type, Address, TID) identifying a container queue.
static constexpr uint8_t SINGLE_LINK_OP_ID
Link ID for single link operations (helps tracking places where correct link ID is to be used to supp...
Definition: wifi-utils.h:140
@ WIFI_MAC_CTL_BACKREQ
@ WIFI_MAC_MGT_ACTION
@ WIFI_MAC_DATA
@ WIFI_MAC_QOSDATA
Information specific to a wifi MAC queue.
SortedQueues sortedQueues
sorted list of container queues
Ptr< WifiMacQueue > wifiMacQueue
pointer to the WifiMacQueue object
QueueInfoMap queueInfoMap
information associated with container queues
Information associated with a container queue.
std::map< uint8_t, Mask > linkIds
Maps ID of each link on which packets contained in this queue can be sent to a bitset indicating whet...
std::optional< typename SortedQueues::iterator > priorityIt
iterator pointing to the entry for this queue in the sorted list