A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
rr-wifi-queue-scheduler.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2026 Universita' degli Studi di Napoli Federico II
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Stefano Avallone <stavallo@unina.it>
7 */
8
9#ifndef RR_WIFI_QUEUE_SCHEDULER_H
10#define RR_WIFI_QUEUE_SCHEDULER_H
11
13#include "wifi-psdu.h"
14
15#include "ns3/nstime.h"
16
17#include <unordered_map>
18#include <vector>
19
20namespace ns3
21{
22
23class WifiMpdu;
24
25/**
26 * @ingroup wifi
27 *
28 * RrWifiQueueScheduler is a wifi queue scheduler that serves container queues in a round robin
29 * fashion. The priority of a container queue is defined as the last time a frame contained in that
30 * container queue was transmitted. Specifically, every time a frame is transmitted (regardless of
31 * the link used) within a TXOP of which this device is the holder, the priority of the container
32 * queue containing the frame is set to the current time. Container queues of a same AC are
33 * therefore sorted in increasing order of last serving time and, every time an AC of this device
34 * can transmit, the container queue at the front of the list for that AC is served.
35 */
36class RrWifiQueueScheduler : public WifiMacQueueSchedulerImpl<WifiSchedPrecedence<Time>>
37{
38 public:
39 /**
40 * @brief Get the type ID.
41 * @return the object TypeId
42 */
43 static TypeId GetTypeId();
44
46
47 void SetWifiMac(Ptr<WifiMac> mac) override;
48
49 private:
50 void DoNotifyEnqueue(AcIndex ac, Ptr<WifiMpdu> mpdu) override;
51 void DoNotifyDequeue(AcIndex ac, const std::list<Ptr<WifiMpdu>>& mpdus) override;
52 void DoNotifyRemove(AcIndex ac, const std::list<Ptr<WifiMpdu>>& mpdus) override;
53
54 /**
55 * Callback connected to the PHY trace that is fired every time a PSDU (map) is transmitted.
56 * If the PSDU is transmitted in a TXOP of which this device is the holder, the priority of the
57 * queue(s) containing the transmitted MPDUs is updated.
58 *
59 * @param phyId the ID of the PHY transmitting the PSDUs
60 * @param psduMap the PSDU map
61 * @param txVector the TX vector
62 * @param txPower the tx power
63 */
64 void PsduTransmitted(uint8_t phyId,
65 WifiConstPsduMap psduMap,
66 WifiTxVector txVector,
67 Watt_u txPower);
68
69 /// Maps the queue Id of containers to the last time a frame from each of them was transmitted
70 using QueueIdLastTimeMap = std::unordered_map<WifiContainerQueueId, Time>;
71
72 /// per-AC map of last time a frame in each container queue was transmitted
73 std::vector<QueueIdLastTimeMap> m_perAcQueueIdLastTxTime{AC_UNDEF};
74
75 NS_LOG_TEMPLATE_DECLARE; //!< redefinition of the log component
76};
77
78} // namespace ns3
79
80#endif /* RR_WIFI_QUEUE_SCHEDULER_H */
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
std::vector< QueueIdLastTimeMap > m_perAcQueueIdLastTxTime
per-AC map of last time a frame in each container queue was transmitted
void PsduTransmitted(uint8_t phyId, WifiConstPsduMap psduMap, WifiTxVector txVector, Watt_u txPower)
Callback connected to the PHY trace that is fired every time a PSDU (map) is transmitted.
std::unordered_map< WifiContainerQueueId, Time > QueueIdLastTimeMap
Maps the queue Id of containers to the last time a frame from each of them was transmitted.
NS_LOG_TEMPLATE_DECLARE
redefinition of the log component
void DoNotifyEnqueue(AcIndex ac, Ptr< WifiMpdu > mpdu) override
Notify the scheduler that the given MPDU has been enqueued by the given Access Category.
void SetWifiMac(Ptr< WifiMac > mac) override
Set the wifi MAC.
static TypeId GetTypeId()
Get the type ID.
void DoNotifyDequeue(AcIndex ac, const std::list< Ptr< WifiMpdu > > &mpdus) override
Notify the scheduler that the given list of MPDUs have been dequeued by the given Access Category.
void DoNotifyRemove(AcIndex ac, const std::list< Ptr< WifiMpdu > > &mpdus) override
Notify the scheduler that the given list of MPDUs have been removed by the given Access Category.
a unique identifier for an interface.
Definition type-id.h:50
WifiMpdu stores a (const) packet along with a MAC header.
Definition wifi-mpdu.h:51
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition qos-utils.h:64
@ AC_UNDEF
Total number of ACs.
Definition qos-utils.h:78
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
Definition wifi-ppdu.h:38
double Watt_u
Watt weak type.
Definition wifi-units.h:25