16#include "ns3/qos-txop.h"
17#include "ns3/wifi-acknowledgment.h"
18#include "ns3/wifi-mac-trailer.h"
19#include "ns3/wifi-protection.h"
32 TypeId(
"ns3::MultiUserScheduler")
35 .AddAttribute(
"AccessReqInterval",
36 "Duration of the interval between two consecutive requests for "
37 "channel access made by the MultiUserScheduler. Such requests are "
38 "made independently of the presence of frames in the queues of the "
39 "AP and are intended to allow the AP to coordinate UL MU transmissions "
40 "even without DL traffic. A null duration indicates that such "
41 "requests shall not be made.",
46 .AddAttribute(
"AccessReqAc",
47 "The Access Category for which the MultiUserScheduler makes requests "
48 "for channel access.",
59 .AddAttribute(
"DelayAccessReqUponAccess",
60 "If enabled, the access request interval is measured starting "
61 "from the last time an EDCA function obtained channel access. "
62 "Otherwise, the access request interval is measured starting "
63 "from the last time the MultiUserScheduler made a request for "
89 accessReqTimer.Cancel();
119 for (uint8_t
id = 0;
id <
m_apMac->GetNLinks(); ++id)
139 for (uint8_t
id = 0;
id <
m_apMac->GetNLinks(); ++id)
167 "MultiUserScheduler can only be installed on HE APs");
169 for (uint8_t linkId = 0; linkId <
m_apMac->GetNLinks(); linkId++)
173 heFem->SetMultiUserScheduler(
this);
180 return m_apMac->GetWifiRemoteStationManager(linkId);
199 m_apMac->GetChannelAccessManager(linkId)->RequestAccess(edca);
220 NS_LOG_FUNCTION(
this << edca << availableTime << initialFrame << allowedWidth << linkId);
254 if (txFormat !=
NO_TX)
271 "Next transmission is not DL MU");
273#ifdef NS3_BUILD_PROFILE_DEBUG
277 auto receiver = psdu.second->GetAddr1();
278 auto linkId =
m_apMac->IsAssociated(receiver);
279 NS_ABORT_MSG_IF(!linkId,
"Station " << receiver <<
" should be associated");
281 "Station " << psdu.second->GetAddr1() <<
" does not support HE");
292 "Next transmission is not UL MU");
303 packet->AddHeader(trigger);
308 auto aid = trigger.
begin()->GetAid12();
309 auto aidAddrMapIt =
m_apMac->GetStaList(linkId).find(aid);
311 receiver = aidAddrMapIt->second;
341 uint8_t maxNTids = 0;
342 for (
const auto& userInfo : trigger)
344 auto address =
m_apMac->GetMldOrLinkAddressByAid(userInfo.GetAid12());
345 NS_ASSERT_MSG(address,
"AID " << userInfo.GetAid12() <<
" not found");
347 uint8_t staNTids = 0;
348 for (uint8_t tid = 0; tid < 8; tid++)
350 if (
m_apMac->GetBaAgreementEstablishedAsRecipient(*address, tid))
355 maxNTids = std::max(maxNTids, staNTids);
365 for (uint8_t i = 0; i < maxNTids; i++)
Hold variables of type enum.
static Mac48Address GetBroadcast()
static uint32_t GetSizeIfAggregated(uint32_t mpduSize, uint32_t ampduSize)
Compute the size of the A-MPDU resulting from the aggregation of an MPDU of size mpduSize and an A-MP...
bool m_initialFrame
true if a TXOP is being started
void NotifyNewAggregate() override
Notify all Objects aggregated to this one of a new Object being aggregated.
~MultiUserScheduler() override
void DoInitialize() override
Initialize() implementation.
TxFormat GetLastTxFormat(uint8_t linkId)
Get the format of the last transmission on the given link, as determined by the last call to NotifyAc...
Ptr< ApWifiMac > m_apMac
the AP wifi MAC
std::vector< EventId > m_accessReqTimers
the per-link timer controlling additional channel access requests
void CheckTriggerFrame()
Ensure that the Trigger Frame returned in case of UL MU transmission is correct.
static TypeId GetTypeId()
Get the type ID.
Time m_availableTime
the time available for frame exchange
Ptr< WifiRemoteStationManager > GetWifiRemoteStationManager(uint8_t linkId) const
Get the station manager attached to the AP on the given link.
UlMuInfo & GetUlMuInfo(uint8_t linkId)
Get the information required to solicit an UL MU transmission on the given link.
uint8_t m_linkId
the ID of the link over which channel access has been granted
virtual TxFormat SelectTxFormat()=0
Select the format of the next transmission.
void SetAccessReqInterval(Time interval)
Set the duration of the interval between two consecutive requests for channel access made by the Mult...
uint32_t GetMaxSizeOfQosNullAmpdu(const CtrlTriggerHeader &trigger) const
Get the maximum size in bytes among the A-MPDUs containing QoS Null frames and solicited by the given...
bool m_restartTimerUponAccess
whether the channel access timer has to be restarted upon channel access
virtual DlMuInfo ComputeDlMuInfo()=0
Compute the information required to perform a DL MU transmission.
Ptr< QosTxop > m_edca
the AC that gained channel access
Time GetAccessReqInterval() const
virtual UlMuInfo ComputeUlMuInfo()=0
Prepare the information required to solicit an UL MU transmission.
void DoDispose() override
Destructor implementation.
Ptr< WifiMpdu > GetTriggerFrame(const CtrlTriggerHeader &trigger, uint8_t linkId) const
Get an MPDU containing the given Trigger Frame.
AcIndex m_accessReqAc
AC we request channel access for.
DlMuInfo & GetDlMuInfo(uint8_t linkId)
Get the information required to perform a DL MU transmission on the given link.
MHz_u m_allowedWidth
the allowed width for the current transmission
Ptr< HeFrameExchangeManager > GetHeFem(uint8_t linkId) const
Get the HE Frame Exchange Manager attached to the AP on the given link.
Time m_accessReqInterval
duration of the interval between channel access requests
TxFormat NotifyAccessGranted(Ptr< QosTxop > edca, Time availableTime, bool initialFrame, MHz_u allowedWidth, uint8_t linkId)
Notify the Multi-user Scheduler that the given AC of the AP gained channel access.
void SetWifiMac(Ptr< ApWifiMac > mac)
Set the wifi MAC.
TxFormat
Enumeration of the possible transmission formats.
std::map< uint8_t, LastTxInfo > m_lastTxInfo
Information about the last transmission.
void AccessReqTimeout(uint8_t linkId)
Perform actions required on expiration of the channel access request timer associated with the given ...
A base class which provides memory management and object aggregation.
virtual void NotifyNewAggregate()
Notify all Objects aggregated to this one of a new Object being aggregated.
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
virtual void DoDispose()
Destructor implementation.
bool IsInitialized() const
Check if the object has been initialized.
Smart pointer class similar to boost::intrusive_ptr.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Simulation virtual time values and global simulation resolution.
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
bool IsStrictlyPositive() const
Exactly equivalent to t > 0.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeBooleanChecker()
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
static const uint16_t WIFI_MAC_FCS_LENGTH
The length in octets of the IEEE 802.11 MAC FCS field.
Ptr< const AttributeChecker > MakeEnumChecker(T v, std::string n, Ts... args)
Make an EnumChecker pre-configured with a set of allowed values by name.
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
Ptr< T1 > StaticCast(const Ptr< T2 > &p)
Cast a Ptr.
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.
Information to be provided in case of DL MU transmission.
Information to be provided in case of UL MU transmission.