A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
rr-multi-user-scheduler.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 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
10
11#include "he-configuration.h"
12#include "he-phy.h"
13
14#include "ns3/eht-frame-exchange-manager.h"
15#include "ns3/log.h"
16#include "ns3/wifi-acknowledgment.h"
17#include "ns3/wifi-mac-queue.h"
18#include "ns3/wifi-protection.h"
19#include "ns3/wifi-psdu.h"
20
21#include <algorithm>
22#include <numeric>
23
24namespace ns3
25{
26
27NS_LOG_COMPONENT_DEFINE("RrMultiUserScheduler");
28
30
33{
34 static TypeId tid =
35 TypeId("ns3::RrMultiUserScheduler")
37 .SetGroupName("Wifi")
38 .AddConstructor<RrMultiUserScheduler>()
39 .AddAttribute("NStations",
40 "The maximum number of stations that can be granted an RU in a DL MU "
41 "OFDMA transmission",
45 .AddAttribute("EnableTxopSharing",
46 "If enabled, allow A-MPDUs of different TIDs in a DL MU PPDU.",
47 BooleanValue(true),
50 .AddAttribute("ForceDlOfdma",
51 "If enabled, return DL_MU_TX even if no DL MU PPDU could be built.",
52 BooleanValue(false),
55 .AddAttribute("EnableUlOfdma",
56 "If enabled, return UL_MU_TX if DL_MU_TX was returned the previous time.",
57 BooleanValue(true),
60 .AddAttribute("EnableBsrp",
61 "If enabled, send a BSRP Trigger Frame before an UL MU transmission.",
62 BooleanValue(true),
65 .AddAttribute(
66 "UlPsduSize",
67 "The default size in bytes of the solicited PSDU (to be sent in a TB PPDU)",
68 UintegerValue(500),
71 .AddAttribute("UseCentral26TonesRus",
72 "If enabled, central 26-tone RUs are allocated, too, when the "
73 "selected RU type is at least 52 tones.",
74 BooleanValue(false),
77 .AddAttribute(
78 "MaxCredits",
79 "Maximum amount of credits a station can have. When transmitting a DL MU PPDU, "
80 "the amount of credits received by each station equals the TX duration (in "
81 "microseconds) divided by the total number of stations. Stations that are the "
82 "recipient of the DL MU PPDU have to pay a number of credits equal to the TX "
83 "duration (in microseconds) times the allocated bandwidth share",
87 return tid;
88}
89
94
99
100void
102{
103 NS_LOG_FUNCTION(this);
105 m_apMac->TraceConnectWithoutContext(
106 "AssociatedSta",
108 m_apMac->TraceConnectWithoutContext(
109 "DeAssociatedSta",
111 for (const auto& ac : wifiAcList)
112 {
113 m_staListDl.insert({ac.first, {}});
114 }
116}
117
118void
120{
121 NS_LOG_FUNCTION(this);
122 m_staListDl.clear();
123 m_staListUl.clear();
124 m_candidates.clear();
125 m_txParams.Clear();
126 m_apMac->TraceDisconnectWithoutContext(
127 "AssociatedSta",
129 m_apMac->TraceDisconnectWithoutContext(
130 "DeAssociatedSta",
133}
134
137{
138 NS_LOG_FUNCTION(this);
139
140 Ptr<const WifiMpdu> mpdu = m_edca->PeekNextMpdu(m_linkId);
141
142 if (mpdu && !m_apMac->GetHeSupported(mpdu->GetHeader().GetAddr1()))
143 {
144 return SU_TX;
145 }
146
148 auto txopStartTime = m_edca->GetTxopStartTime(m_linkId);
149 NS_ASSERT_MSG(txopStartTime.has_value(), "A TXOP must be ongoing");
150 auto initialFrame = (txopStartTime.value() == Simulator::Now());
151
154 ((initialFrame || m_trigger.GetType() != TriggerFrameType::BSRP_TRIGGER) && !mpdu)))
155 {
156 TxFormat txFormat = TrySendingBsrpTf();
157
158 if (txFormat != DL_MU_TX)
159 {
160 return txFormat;
161 }
162 }
164 (m_trigger.GetType() == TriggerFrameType::BSRP_TRIGGER) || !mpdu))
165 {
166 TxFormat txFormat = TrySendingBasicTf();
167
168 if (txFormat != DL_MU_TX)
169 {
170 return txFormat;
171 }
172 }
173
174 return TrySendingDlMuPpdu();
175}
176
178RrMultiUserScheduler::GetTxVectorForUlMu(std::function<bool(const MasterInfo&)> canBeSolicited)
179{
180 NS_LOG_FUNCTION(this);
181
182 auto heConfiguration = m_apMac->GetHeConfiguration();
183 NS_ASSERT(heConfiguration);
184
185 WifiTxVector txVector;
187 txVector.SetGuardInterval(heConfiguration->GetGuardInterval());
188 txVector.SetBssColor(heConfiguration->m_bssColor);
190
191 const auto firstCandidate =
192 std::find_if(m_staListUl.begin(), m_staListUl.end(), canBeSolicited);
193 if (firstCandidate == m_staListUl.cend())
194 {
195 NS_LOG_DEBUG("No candidate");
196 return txVector;
197 }
198
199 // determine RUs to allocate to stations
200 const auto isEht =
201 (m_apMac->GetEhtSupported() && m_apMac->GetEhtSupported(firstCandidate->address));
202 auto count = std::min<std::size_t>(m_nStations, m_staListUl.size());
203 std::size_t nCentral26TonesRus;
205 count,
206 nCentral26TonesRus,
208 NS_ASSERT(count >= 1);
209
211 {
212 nCentral26TonesRus = 0;
213 }
214
215 if (isEht)
216 {
218 txVector.SetEhtPpduType(0);
219 }
220 // TODO otherwise make sure the TX width does not exceed 160 MHz
221
222 // iterate over the associated stations until an enough number of stations is identified
223 auto staIt = firstCandidate;
224 m_candidates.clear();
225
226 while (staIt != m_staListUl.end() &&
227 txVector.GetHeMuUserInfoMap().size() <
228 std::min<std::size_t>(m_nStations, count + nCentral26TonesRus))
229 {
230 NS_LOG_DEBUG("Next candidate STA (MAC=" << staIt->address << ", AID=" << staIt->aid << ")");
231
232 if (txVector.GetPreambleType() == WIFI_PREAMBLE_EHT_TB &&
233 !m_apMac->GetEhtSupported(staIt->address))
234 {
236 "Skipping non-EHT STA because this Trigger Frame is only soliciting EHT STAs");
237 staIt = std::find_if(++staIt, m_staListUl.end(), canBeSolicited);
238 continue;
239 }
240
241 // prepare the MAC header of a frame that would be sent to the candidate station,
242 // just for the purpose of retrieving the TXVECTOR used to transmit to that station
245 ->GetAffiliatedStaAddress(staIt->address)
246 .value_or(staIt->address));
247 hdr.SetAddr2(m_apMac->GetFrameExchangeManager(m_linkId)->GetAddress());
248 WifiTxVector suTxVector =
250 txVector.SetHeMuUserInfo(staIt->aid,
251 {HeRu::RuSpec(), // assigned later by FinalizeTxVector
252 suTxVector.GetMode().GetMcsValue(),
253 suTxVector.GetNss()});
254 m_candidates.emplace_back(staIt, nullptr);
255
256 // move to the next candidate station in the list
257 staIt = std::find_if(++staIt, m_staListUl.end(), canBeSolicited);
258 }
259
260 if (txVector.GetHeMuUserInfoMap().empty())
261 {
262 NS_LOG_DEBUG("No suitable station");
263 return txVector;
264 }
265
266 FinalizeTxVector(txVector);
267 return txVector;
268}
269
270bool
272{
273 // check if station has setup the current link
274 if (!m_apMac->GetStaList(m_linkId).contains(info.aid))
275 {
276 NS_LOG_INFO("STA with AID " << info.aid << " has not setup link " << +m_linkId
277 << ": skipping station");
278 return false;
279 }
280
281 uint8_t tid = 0;
282 while (tid < 8)
283 {
284 // check that a BA agreement is established with the receiver for the
285 // considered TID, since ack sequences for UL MU require block ack
286 if (m_apMac->GetBaAgreementEstablishedAsRecipient(info.address, tid))
287 {
288 break;
289 }
290 ++tid;
291 }
292 if (tid == 8)
293 {
294 NS_LOG_DEBUG("No Block Ack agreement established with " << info.address
295 << ": skipping station");
296 return false;
297 }
298
299 auto mldAddr = GetWifiRemoteStationManager(m_linkId)->GetMldAddress(info.address);
300
301 // remaining checks are for MLDs only
302 if (!mldAddr)
303 {
304 return true;
305 }
306
307 // check if at least one TID is mapped on the current link in the UL direction
308 bool mapped = false;
309 for (uint8_t tid = 0; tid < 8; ++tid)
310 {
311 if (m_apMac->TidMappedOnLink(*mldAddr, WifiDirection::UPLINK, tid, m_linkId))
312 {
313 mapped = true;
314 break;
315 }
316 }
317
318 if (!mapped)
319 {
320 NS_LOG_DEBUG("MLD " << *mldAddr << " has not mapped any TID on link " << +m_linkId
321 << ": skipping station");
322 return false;
323 }
324
325 // check if the station is an EMLSR client that is using another link
326 if (GetWifiRemoteStationManager(m_linkId)->GetEmlsrEnabled(info.address) &&
327 (m_apMac->GetTxBlockedOnLink(AC_BE,
329 m_linkId,
331 m_apMac->GetTxBlockedOnLink(AC_BE,
333 m_linkId,
335 {
336 NS_LOG_INFO("EMLSR client " << *mldAddr << " is using another link: skipping station");
337 return false;
338 }
339
340 return true;
341}
342
345{
346 NS_LOG_FUNCTION(this);
347
348 if (m_staListUl.empty())
349 {
350 NS_LOG_DEBUG("No HE stations associated: return SU_TX");
351 return TxFormat::SU_TX;
352 }
353
354 auto txVector = GetTxVectorForUlMu(
355 std::bind(&RrMultiUserScheduler::CanSolicitStaInBsrpTf, this, std::placeholders::_1));
356
357 if (txVector.GetHeMuUserInfoMap().empty())
358 {
359 NS_LOG_DEBUG("No suitable station found");
360 return TxFormat::DL_MU_TX;
361 }
362
364 txVector.SetGuardInterval(m_trigger.GetGuardInterval());
365
366 auto item = GetTriggerFrame(m_trigger, m_linkId);
367 m_triggerMacHdr = item->GetHeader();
368
369 m_txParams.Clear();
370 // set the TXVECTOR used to send the Trigger Frame
371 m_txParams.m_txVector =
372 m_apMac->GetWifiRemoteStationManager(m_linkId)->GetRtsTxVector(m_triggerMacHdr.GetAddr1(),
374
375 // If this BSRP TF is an ICF, we need to add padding and adjust the TXVECTOR
376 if (auto ehtFem =
377 DynamicCast<EhtFrameExchangeManager>(m_apMac->GetFrameExchangeManager(m_linkId)))
378 {
379 auto prevPaddingSize = m_trigger.GetPaddingSize();
380 ehtFem->SetIcfPaddingAndTxVector(m_trigger, m_txParams.m_txVector);
381 // serialize again if padding has been added
382 if (m_trigger.GetPaddingSize() != prevPaddingSize)
383 {
384 auto packet = Create<Packet>();
385 packet->AddHeader(m_trigger);
386 item = Create<WifiMpdu>(packet, item->GetHeader());
387 }
388 }
389
390 if (!GetHeFem(m_linkId)->TryAddMpdu(item, m_txParams, m_availableTime))
391 {
392 // sending the BSRP Trigger Frame is not possible, hence return NO_TX. In
393 // this way, no transmission will occur now and the next time we will
394 // try again sending a BSRP Trigger Frame.
395 NS_LOG_DEBUG("Remaining TXOP duration is not enough for BSRP TF exchange");
396 return NO_TX;
397 }
398
399 // Compute the time taken by each station to transmit 8 QoS Null frames
400 Time qosNullTxDuration;
401 for (const auto& userInfo : m_trigger)
402 {
404 txVector,
405 m_apMac->GetWifiPhy(m_linkId)->GetPhyBand(),
406 userInfo.GetAid12());
407 qosNullTxDuration = Max(qosNullTxDuration, duration);
408 }
409
410 NS_ASSERT(m_txParams.m_txDuration.has_value());
411 m_triggerTxDuration = m_txParams.m_txDuration.value();
412
413 if (m_availableTime)
414 {
415 // TryAddMpdu only considers the time to transmit the Trigger Frame
416 NS_ASSERT(m_txParams.m_protection && m_txParams.m_protection->protectionTime.has_value());
417 NS_ASSERT(m_txParams.m_acknowledgment &&
418 m_txParams.m_acknowledgment->acknowledgmentTime.has_value() &&
419 m_txParams.m_acknowledgment->acknowledgmentTime->IsZero());
420
421 if (*m_txParams.m_protection->protectionTime + *m_txParams.m_txDuration // BSRP TF tx time
422 + m_apMac->GetWifiPhy(m_linkId)->GetSifs() + qosNullTxDuration >
424 {
425 NS_LOG_DEBUG("Remaining TXOP duration is not enough for BSRP TF exchange");
426 return NO_TX;
427 }
428 }
429
430 uint16_t ulLength;
431 std::tie(ulLength, qosNullTxDuration) = HePhy::ConvertHeTbPpduDurationToLSigLength(
432 qosNullTxDuration,
433 m_trigger.GetHeTbTxVector(m_trigger.begin()->GetAid12()),
434 m_apMac->GetWifiPhy(m_linkId)->GetPhyBand());
435 NS_LOG_DEBUG("Duration of QoS Null frames: " << qosNullTxDuration.As(Time::MS));
436 m_trigger.SetUlLength(ulLength);
437
438 return UL_MU_TX;
439}
440
441bool
443{
444 // in addition to the checks performed when sending a BSRP TF, also check if the station
445 // has reported a null queue size
446 if (!CanSolicitStaInBsrpTf(info))
447 {
448 return false;
449 }
450
451 return m_apMac->GetMaxBufferStatus(info.address) > 0;
452}
453
456{
457 NS_LOG_FUNCTION(this);
458
459 if (m_staListUl.empty())
460 {
461 NS_LOG_DEBUG("No HE stations associated: return SU_TX");
462 return TxFormat::SU_TX;
463 }
464
465 // check if an UL OFDMA transmission is possible after a DL OFDMA transmission
466 NS_ABORT_MSG_IF(m_ulPsduSize == 0, "The UlPsduSize attribute must be set to a non-null value");
467
468 auto txVector = GetTxVectorForUlMu(
469 std::bind(&RrMultiUserScheduler::CanSolicitStaInBasicTf, this, std::placeholders::_1));
470
471 if (txVector.GetHeMuUserInfoMap().empty())
472 {
473 NS_LOG_DEBUG("No suitable station found");
474 return TxFormat::DL_MU_TX;
475 }
476
477 uint32_t maxBufferSize = 0;
478
479 for (const auto& candidate : txVector.GetHeMuUserInfoMap())
480 {
481 auto address = m_apMac->GetMldOrLinkAddressByAid(candidate.first);
482 NS_ASSERT_MSG(address, "AID " << candidate.first << " not found");
483
484 uint8_t queueSize = m_apMac->GetMaxBufferStatus(*address);
485 if (queueSize == 255)
486 {
487 NS_LOG_DEBUG("Buffer status of station " << *address << " is unknown");
488 maxBufferSize = std::max(maxBufferSize, m_ulPsduSize);
489 }
490 else if (queueSize == 254)
491 {
492 NS_LOG_DEBUG("Buffer status of station " << *address << " is not limited");
493 maxBufferSize = 0xffffffff;
494 }
495 else
496 {
497 NS_LOG_DEBUG("Buffer status of station " << *address << " is " << +queueSize);
498 maxBufferSize = std::max(maxBufferSize, static_cast<uint32_t>(queueSize * 256));
499 }
500 }
501
502 if (maxBufferSize == 0)
503 {
504 return DL_MU_TX;
505 }
506
508 txVector.SetGuardInterval(m_trigger.GetGuardInterval());
509
510 auto item = GetTriggerFrame(m_trigger, m_linkId);
511 m_triggerMacHdr = item->GetHeader();
512
513 // compute the maximum amount of time that can be granted to stations.
514 // This value is limited by the max PPDU duration
515 Time maxDuration = GetPpduMaxTime(txVector.GetPreambleType());
516
517 m_txParams.Clear();
518 // set the TXVECTOR used to send the Trigger Frame
519 m_txParams.m_txVector =
520 m_apMac->GetWifiRemoteStationManager(m_linkId)->GetRtsTxVector(m_triggerMacHdr.GetAddr1(),
522
523 if (!GetHeFem(m_linkId)->TryAddMpdu(item, m_txParams, m_availableTime))
524 {
525 // an UL OFDMA transmission is not possible, hence return NO_TX. In
526 // this way, no transmission will occur now and the next time we will
527 // try again performing an UL OFDMA transmission.
528 NS_LOG_DEBUG("Remaining TXOP duration is not enough for UL MU exchange");
529 return NO_TX;
530 }
531
532 NS_ASSERT(m_txParams.m_txDuration.has_value());
533 m_triggerTxDuration = m_txParams.m_txDuration.value();
534
535 if (m_availableTime)
536 {
537 // TryAddMpdu only considers the time to transmit the Trigger Frame
538 NS_ASSERT(m_txParams.m_protection && m_txParams.m_protection->protectionTime.has_value());
539 NS_ASSERT(m_txParams.m_acknowledgment &&
540 m_txParams.m_acknowledgment->acknowledgmentTime.has_value());
541
542 maxDuration = Min(maxDuration,
543 *m_availableTime - *m_txParams.m_protection->protectionTime -
544 *m_txParams.m_txDuration - m_apMac->GetWifiPhy(m_linkId)->GetSifs() -
545 *m_txParams.m_acknowledgment->acknowledgmentTime);
546 if (maxDuration.IsNegative())
547 {
548 NS_LOG_DEBUG("Remaining TXOP duration is not enough for UL MU exchange");
549 return NO_TX;
550 }
551 }
552
553 // Compute the time taken by each station to transmit a frame of maxBufferSize size
554 Time bufferTxTime;
555 for (const auto& userInfo : m_trigger)
556 {
557 Time duration = WifiPhy::CalculateTxDuration(maxBufferSize,
558 txVector,
559 m_apMac->GetWifiPhy(m_linkId)->GetPhyBand(),
560 userInfo.GetAid12());
561 bufferTxTime = Max(bufferTxTime, duration);
562 }
563
564 if (bufferTxTime < maxDuration)
565 {
566 // the maximum buffer size can be transmitted within the allowed time
567 maxDuration = bufferTxTime;
568 }
569 else
570 {
571 // maxDuration may be a too short time. If it does not allow any station to
572 // transmit at least m_ulPsduSize bytes, give up the UL MU transmission for now
573 Time minDuration;
574 for (const auto& userInfo : m_trigger)
575 {
576 Time duration =
578 txVector,
579 m_apMac->GetWifiPhy(m_linkId)->GetPhyBand(),
580 userInfo.GetAid12());
581 minDuration = (minDuration.IsZero() ? duration : Min(minDuration, duration));
582 }
583
584 if (maxDuration < minDuration)
585 {
586 // maxDuration is a too short time, hence return NO_TX. In this way,
587 // no transmission will occur now and the next time we will try again
588 // performing an UL OFDMA transmission.
589 NS_LOG_DEBUG("Available time " << maxDuration.As(Time::MS) << " is too short");
590 return NO_TX;
591 }
592 }
593
594 // maxDuration is the time to grant to the stations. Finalize the Trigger Frame
595 uint16_t ulLength;
596 std::tie(ulLength, maxDuration) =
598 txVector,
599 m_apMac->GetWifiPhy(m_linkId)->GetPhyBand());
600 NS_LOG_DEBUG("TB PPDU duration: " << maxDuration.As(Time::MS));
601 m_trigger.SetUlLength(ulLength);
602 // set Preferred AC to the AC that gained channel access
603 for (auto& userInfo : m_trigger)
604 {
605 userInfo.SetBasicTriggerDepUserInfo(0, 0, m_edca->GetAccessCategory());
606 }
607
608 UpdateCredits(m_staListUl, maxDuration, txVector);
609
610 return UL_MU_TX;
611}
612
613void
615 CtrlTriggerHeader& trigger,
616 WifiTxParameters& txParams) const
617{
618 NS_LOG_FUNCTION(this << linkId << &txParams);
619
620 // remove unprotected EMLSR clients, unless this is a BSRP TF (which acts as ICF)
621 if (trigger.IsBsrp())
622 {
623 NS_LOG_INFO("BSRP TF is an ICF for unprotected EMLSR clients");
624 return;
625 }
626
627 NS_LOG_INFO("Checking unprotected EMLSR clients");
628 RemoveRecipientsFromTf(linkId, trigger, txParams, m_isUnprotectedEmlsrClient);
629}
630
631void
633 WifiPsduMap& psduMap,
634 WifiTxParameters& txParams) const
635{
636 NS_LOG_FUNCTION(this << linkId << &txParams);
637
638 NS_LOG_INFO("Checking unprotected EMLSR clients");
639 RemoveRecipientsFromDlMu(linkId, psduMap, txParams, m_isUnprotectedEmlsrClient);
640}
641
642Time
644{
645 auto phy = m_apMac->GetWifiPhy(linkId);
647 uint16_t aid{0};
648 Mac48Address staAddress;
649
650 // we assume that a Basic Trigger Frame is sent after a BSRP Trigger Frame. In order to
651 // compute the TX duration of the Multi-STA BlockAck, we need to find the bitmap length
652 // for each STA solicited by the Trigger Frame
653 for (const auto& userInfo : m_trigger)
654 {
655 aid = userInfo.GetAid12();
656 auto it = m_apMac->GetStaList(linkId).find(aid);
657 NS_ASSERT(it != m_apMac->GetStaList(linkId).cend());
658 staAddress = it->second;
659
660 // find a TID for which a BA agreement exists with the given originator
661 uint8_t tid = 0;
662 while (tid < 8 && !m_apMac->GetBaAgreementEstablishedAsRecipient(staAddress, tid))
663 {
664 ++tid;
665 }
666 NS_ASSERT_MSG(tid < 8, "No Block Ack agreement established with originator " << staAddress);
667
668 baType.m_bitmapLen.push_back(
669 m_apMac->GetBaTypeAsRecipient(staAddress, tid).m_bitmapLen.at(0));
670 }
671
672 NS_ASSERT_MSG(aid != 0, "No User Info field in the Trigger Frame");
673
674 auto multiStaBaTxVector =
675 GetWifiRemoteStationManager(linkId)->GetBlockAckTxVector(staAddress,
676 m_trigger.GetHeTbTxVector(aid));
677
678 auto multiStaBaDuration = WifiPhy::CalculateTxDuration(GetBlockAckSize(baType),
679 multiStaBaTxVector,
680 phy->GetPhyBand());
681
682 return m_triggerTxDuration + m_defaultTbPpduDuration + multiStaBaDuration + 3 * phy->GetSifs();
683}
684
685void
687{
688 NS_LOG_FUNCTION(this << aid << address);
689
690 if (!m_apMac->GetHeSupported(address))
691 {
692 return;
693 }
694
695 auto mldOrLinkAddress = m_apMac->GetMldOrLinkAddressByAid(aid);
696 NS_ASSERT_MSG(mldOrLinkAddress, "AID " << aid << " not found");
697
698 for (auto& staList : m_staListDl)
699 {
700 // if this is not the first STA of a non-AP MLD to be notified, an entry
701 // for this non-AP MLD already exists
702 const auto staIt = std::find_if(staList.second.cbegin(),
703 staList.second.cend(),
704 [aid](auto&& info) { return info.aid == aid; });
705 if (staIt == staList.second.cend())
706 {
707 staList.second.push_back(MasterInfo{aid, *mldOrLinkAddress, 0.0});
708 }
709 }
710
711 const auto staIt = std::find_if(m_staListUl.cbegin(), m_staListUl.cend(), [aid](auto&& info) {
712 return info.aid == aid;
713 });
714 if (staIt == m_staListUl.cend())
715 {
716 m_staListUl.push_back(MasterInfo{aid, *mldOrLinkAddress, 0.0});
717 }
718}
719
720void
722{
723 NS_LOG_FUNCTION(this << aid << address);
724
725 if (!m_apMac->GetHeSupported(address))
726 {
727 return;
728 }
729
730 auto mldOrLinkAddress = m_apMac->GetMldOrLinkAddressByAid(aid);
731 NS_ASSERT_MSG(mldOrLinkAddress, "AID " << aid << " not found");
732
733 if (m_apMac->IsAssociated(*mldOrLinkAddress))
734 {
735 // Another STA of the non-AP MLD is still associated
736 return;
737 }
738
739 for (auto& staList : m_staListDl)
740 {
741 staList.second.remove_if([&aid](const MasterInfo& info) { return info.aid == aid; });
742 }
743 m_staListUl.remove_if([&aid](const MasterInfo& info) { return info.aid == aid; });
744}
745
748{
749 NS_LOG_FUNCTION(this);
750
751 AcIndex primaryAc = m_edca->GetAccessCategory();
752
753 if (m_staListDl[primaryAc].empty())
754 {
755 NS_LOG_DEBUG("No HE stations associated: return SU_TX");
756 return TxFormat::SU_TX;
757 }
758
759 std::size_t count =
760 std::min(static_cast<std::size_t>(m_nStations), m_staListDl[primaryAc].size());
761 std::size_t nCentral26TonesRus{0};
762
763 uint8_t currTid = wifiAcList.at(primaryAc).GetHighTid();
764
765 Ptr<WifiMpdu> mpdu = m_edca->PeekNextMpdu(m_linkId);
766
767 if (mpdu && mpdu->GetHeader().IsQosData())
768 {
769 currTid = mpdu->GetHeader().GetQosTid();
770 }
771
772 // determine the list of TIDs to check
773 std::vector<uint8_t> tids;
774
776 {
777 for (auto acIt = wifiAcList.find(primaryAc); acIt != wifiAcList.end(); acIt++)
778 {
779 uint8_t firstTid = (acIt->first == primaryAc ? currTid : acIt->second.GetHighTid());
780 tids.push_back(firstTid);
781 tids.push_back(acIt->second.GetOtherTid(firstTid));
782 }
783 }
784 else
785 {
786 tids.push_back(currTid);
787 }
788
789 Ptr<HeConfiguration> heConfiguration = m_apMac->GetHeConfiguration();
790 NS_ASSERT(heConfiguration);
791
792 m_txParams.Clear();
793 m_txParams.m_txVector.SetPreambleType(WIFI_PREAMBLE_HE_MU);
794 m_txParams.m_txVector.SetChannelWidth(m_allowedWidth);
795 m_txParams.m_txVector.SetGuardInterval(heConfiguration->GetGuardInterval());
796 m_txParams.m_txVector.SetBssColor(heConfiguration->m_bssColor);
797
798 // The TXOP holder may exceed the TXOP limit only if it does not transmit more than one Data
799 // or Management frame in the TXOP, only if it does not transmit a DL MU-MIMO PPDU in the TXOP
800 // (Sec. 10.23.2.9 of 802.11-2024)
801
802 auto staIt = m_staListDl[primaryAc].begin();
803 m_candidates.clear();
804
805 std::vector<uint8_t> ruAllocations;
806 const auto numRuAllocs = Count20MHzSubchannels(m_txParams.m_txVector.GetChannelWidth());
807 ruAllocations.resize(numRuAllocs);
808 NS_ASSERT((m_candidates.size() % numRuAllocs) == 0);
809
811 while (staIt != m_staListDl[primaryAc].end() &&
812 m_candidates.size() <
813 std::min(static_cast<std::size_t>(m_nStations), count + nCentral26TonesRus))
814 {
815 NS_LOG_DEBUG("Next candidate STA (MAC=" << staIt->address << ", AID=" << staIt->aid << ")");
816
817 if (m_txParams.m_txVector.GetPreambleType() == WIFI_PREAMBLE_EHT_MU &&
818 !m_apMac->GetEhtSupported(staIt->address))
819 {
820 NS_LOG_DEBUG("Skipping non-EHT STA because this DL MU PPDU is sent to EHT STAs only");
821 staIt++;
822 continue;
823 }
824
825 // check if the AP has at least one frame to be sent to the current station
826 for (uint8_t tid : tids)
827 {
828 AcIndex ac = QosUtilsMapTidToAc(tid);
829 NS_ASSERT(ac >= primaryAc);
830 // check that a BA agreement is established with the receiver for the
831 // considered TID, since ack sequences for DL MU PPDUs require block ack
832 if (m_apMac->GetBaAgreementEstablishedAsOriginator(staIt->address, tid))
833 {
834 mpdu = m_apMac->GetQosTxop(ac)->PeekNextMpdu(m_linkId, tid, staIt->address);
835
836 // we only check if the first frame of the current TID meets the size
837 // and duration constraints. We do not explore the queues further.
838 if (mpdu)
839 {
840 mpdu = GetHeFem(m_linkId)->CreateAliasIfNeeded(mpdu);
841 // Use a temporary TX vector including only the STA-ID of the
842 // candidate station to check if the MPDU meets the size and time limits.
843 // An RU of the computed size is tentatively assigned to the candidate
844 // station, so that the TX duration can be correctly computed.
845 WifiTxVector suTxVector =
846 GetWifiRemoteStationManager(m_linkId)->GetDataTxVector(mpdu->GetHeader(),
848
849 WifiTxVector txVectorCopy = m_txParams.m_txVector;
850
851 // the first candidate STA determines the preamble type for the DL MU PPDU
852 if (m_candidates.empty())
853 {
855 if (suTxVector.GetPreambleType() == WIFI_PREAMBLE_EHT_MU)
856 {
857 m_txParams.m_txVector.SetPreambleType(WIFI_PREAMBLE_EHT_MU);
858 m_txParams.m_txVector.SetEhtPpduType(
859 0); // indicates DL OFDMA transmission
861 }
863 count,
864 nCentral26TonesRus,
865 mc);
866 NS_ASSERT(count >= 1);
868 {
869 nCentral26TonesRus = 0;
870 }
871 }
872
874 const auto currRuType =
875 (m_candidates.size() < count ? ruType : RuType::RU_26_TONE);
876 const auto ru =
877 (m_txParams.m_txVector.GetPreambleType() == WIFI_PREAMBLE_EHT_MU)
878 ? WifiRu::RuSpec(EhtRu::RuSpec{currRuType, 1, true, true})
879 : WifiRu::RuSpec(HeRu::RuSpec{currRuType, 1, true});
880 m_txParams.m_txVector.SetHeMuUserInfo(
881 staIt->aid,
882 {ru, suTxVector.GetMode().GetMcsValue(), suTxVector.GetNss()});
883
884 if (!GetHeFem(m_linkId)->TryAddMpdu(mpdu, m_txParams, m_availableTime))
885 {
886 NS_LOG_DEBUG("Adding the peeked frame violates the time constraints");
887 m_txParams.m_txVector = txVectorCopy;
888 }
889 else
890 {
891 // the frame meets the constraints
892 NS_LOG_DEBUG("Adding candidate STA (MAC=" << staIt->address
893 << ", AID=" << staIt->aid
894 << ") TID=" << +tid);
895 m_candidates.emplace_back(staIt, mpdu);
896 break; // terminate the for loop
897 }
898 }
899 else
900 {
901 NS_LOG_DEBUG("No frames to send to " << staIt->address << " with TID=" << +tid);
902 }
903 }
904 else
905 {
906 NS_LOG_DEBUG("No BA agreement established with " << staIt->address
907 << " for TID=" << +tid);
908 }
909 }
910
911 // move to the next station in the list
912 staIt++;
913 }
914
915 if (m_candidates.empty())
916 {
917 if (m_forceDlOfdma)
918 {
919 NS_LOG_DEBUG("The AP does not have suitable frames to transmit: return NO_TX");
920 return NO_TX;
921 }
922 NS_LOG_DEBUG("The AP does not have suitable frames to transmit: return SU_TX");
923 return SU_TX;
924 }
925
926 return TxFormat::DL_MU_TX;
927}
928
929void
931{
932 // Do not log txVector because GetTxVectorForUlMu() left RUs undefined and
933 // printing them will crash the simulation
934 NS_LOG_FUNCTION(this);
935 NS_ASSERT(txVector.GetHeMuUserInfoMap().size() == m_candidates.size());
936
937 // compute how many stations can be granted an RU and the RU size
938 std::size_t nRusAssigned = m_candidates.size();
939 std::size_t nCentral26TonesRus;
941 nRusAssigned,
942 nCentral26TonesRus,
943 txVector.GetModulationClass());
944
945 NS_LOG_DEBUG(nRusAssigned << " station" << ((nRusAssigned > 1) ? "s are" : " is")
946 << " being assigned a " << ruType << " RU");
947
948 if (!m_useCentral26TonesRus || m_candidates.size() == nRusAssigned)
949 {
950 nCentral26TonesRus = 0;
951 }
952 else
953 {
954 nCentral26TonesRus = std::min(m_candidates.size() - nRusAssigned, nCentral26TonesRus);
955 NS_LOG_DEBUG(nCentral26TonesRus << " stations are being assigned a 26-tones RU");
956 }
957
958 // re-allocate RUs based on the actual number of candidate stations
959 WifiTxVector::HeMuUserInfoMap heMuUserInfoMap;
960 std::swap(heMuUserInfoMap, txVector.GetHeMuUserInfoMap());
961
962 const auto mc = IsEht(txVector.GetPreambleType()) ? WIFI_MOD_CLASS_EHT : WIFI_MOD_CLASS_HE;
963 auto candidateIt = m_candidates.begin(); // iterator over the list of candidate receivers
964 auto ruSet = WifiRu::GetRusOfType(m_allowedWidth, ruType, mc);
965 auto ruSetIt = ruSet.begin();
966 auto central26TonesRus = WifiRu::GetCentral26TonesRus(m_allowedWidth, ruType, mc);
967 auto central26TonesRusIt = central26TonesRus.begin();
968
969 for (std::size_t i = 0; i < nRusAssigned + nCentral26TonesRus; i++)
970 {
971 NS_ASSERT(candidateIt != m_candidates.end());
972 auto mapIt = heMuUserInfoMap.find(candidateIt->first->aid);
973 NS_ASSERT(mapIt != heMuUserInfoMap.end());
974
975 txVector.SetHeMuUserInfo(mapIt->first,
976 {(i < nRusAssigned ? *ruSetIt++ : *central26TonesRusIt++),
977 mapIt->second.mcs,
978 mapIt->second.nss});
979 candidateIt++;
980 }
981
982 // remove candidates that will not be served
983 m_candidates.erase(candidateIt, m_candidates.end());
984}
985
986void
987RrMultiUserScheduler::UpdateCredits(std::list<MasterInfo>& staList,
988 Time txDuration,
989 const WifiTxVector& txVector)
990{
991 NS_LOG_FUNCTION(this << txDuration.As(Time::US) << txVector);
992
993 // find how many RUs have been allocated for each RU type
994 std::map<RuType, std::size_t> ruMap;
995 for (const auto& userInfo : txVector.GetHeMuUserInfoMap())
996 {
997 ruMap.insert({WifiRu::GetRuType(userInfo.second.ru), 0}).first->second++;
998 }
999
1000 // The amount of credits received by each station equals the TX duration (in
1001 // microseconds) divided by the number of stations.
1002 double creditsPerSta = txDuration.ToDouble(Time::US) / staList.size();
1003 // Transmitting stations have to pay a number of credits equal to the TX duration
1004 // (in microseconds) times the allocated bandwidth share.
1005 double debitsPerMhz =
1006 txDuration.ToDouble(Time::US) /
1007 std::accumulate(ruMap.begin(), ruMap.end(), 0, [](uint16_t sum, auto pair) {
1008 return sum + pair.second * WifiRu::GetBandwidth(pair.first);
1009 });
1010
1011 // assign credits to all stations
1012 for (auto& sta : staList)
1013 {
1014 sta.credits += creditsPerSta;
1015 sta.credits = std::min(sta.credits, m_maxCredits.ToDouble(Time::US));
1016 }
1017
1018 // subtract debits to the selected stations
1019 for (auto& candidate : m_candidates)
1020 {
1021 auto mapIt = txVector.GetHeMuUserInfoMap().find(candidate.first->aid);
1022 NS_ASSERT(mapIt != txVector.GetHeMuUserInfoMap().end());
1023
1024 candidate.first->credits -=
1025 debitsPerMhz * WifiRu::GetBandwidth(WifiRu::GetRuType(mapIt->second.ru));
1026 }
1027
1028 // sort the list in decreasing order of credits
1029 staList.sort([](const MasterInfo& a, const MasterInfo& b) { return a.credits > b.credits; });
1030}
1031
1034{
1035 NS_LOG_FUNCTION(this);
1036
1037 if (m_candidates.empty())
1038 {
1039 return DlMuInfo();
1040 }
1041
1042 DlMuInfo dlMuInfo;
1043 std::swap(dlMuInfo.txParams.m_txVector, m_txParams.m_txVector);
1045
1046 m_txParams.Clear();
1047 Ptr<WifiMpdu> mpdu;
1048
1049 // Compute the TX params (again) by using the stored MPDUs and the final TXVECTOR
1050 for (const auto& candidate : m_candidates)
1051 {
1052 mpdu = candidate.second;
1053 NS_ASSERT(mpdu);
1054
1055 bool ret [[maybe_unused]] =
1056 GetHeFem(m_linkId)->TryAddMpdu(mpdu, dlMuInfo.txParams, m_availableTime);
1057 NS_ASSERT_MSG(ret,
1058 "Weird that an MPDU does not meet constraints when "
1059 "transmitted over a larger RU");
1060 }
1061
1062 // We have to complete the PSDUs to send
1063 Ptr<WifiMacQueue> queue;
1064
1065 for (const auto& candidate : m_candidates)
1066 {
1067 // Let us try first A-MSDU aggregation if possible
1068 mpdu = candidate.second;
1069 NS_ASSERT(mpdu);
1070 uint8_t tid = mpdu->GetHeader().GetQosTid();
1071 NS_ASSERT_MSG(mpdu->GetOriginal()->GetHeader().GetAddr1() == candidate.first->address,
1072 "RA of the stored MPDU must match the stored address");
1073
1074 NS_ASSERT(mpdu->IsQueued());
1075 Ptr<WifiMpdu> item = mpdu;
1076
1077 if (!mpdu->GetHeader().IsRetry())
1078 {
1079 // this MPDU must have been dequeued from the AC queue and we can try
1080 // A-MSDU aggregation
1081 item = GetHeFem(m_linkId)->GetMsduAggregator()->GetNextAmsdu(mpdu,
1082 dlMuInfo.txParams,
1084
1085 if (!item)
1086 {
1087 // A-MSDU aggregation failed or disabled
1088 item = mpdu;
1089 }
1090 m_apMac->GetQosTxop(QosUtilsMapTidToAc(tid))->AssignSequenceNumber(item);
1091 }
1092
1093 // Now, let's try A-MPDU aggregation if possible
1094 std::vector<Ptr<WifiMpdu>> mpduList =
1095 GetHeFem(m_linkId)->GetMpduAggregator()->GetNextAmpdu(item,
1096 dlMuInfo.txParams,
1098
1099 if (mpduList.size() > 1)
1100 {
1101 // A-MPDU aggregation succeeded, update psduMap
1102 dlMuInfo.psduMap[candidate.first->aid] = Create<WifiPsdu>(std::move(mpduList));
1103 }
1104 else
1105 {
1106 dlMuInfo.psduMap[candidate.first->aid] = Create<WifiPsdu>(item, true);
1107 }
1108 }
1109
1110 NS_ASSERT(dlMuInfo.txParams.m_txDuration.has_value());
1111 AcIndex primaryAc = m_edca->GetAccessCategory();
1112 UpdateCredits(m_staListDl[primaryAc],
1113 *dlMuInfo.txParams.m_txDuration,
1114 dlMuInfo.txParams.m_txVector);
1115
1116 NS_LOG_DEBUG("Next station to serve has AID=" << m_staListDl[primaryAc].front().aid);
1117
1118 return dlMuInfo;
1119}
1120
1126
1127const std::list<RrMultiUserScheduler::MasterInfo>&
1129{
1130 return m_staListUl;
1131}
1132
1133} // namespace ns3
#define Max(a, b)
#define Min(a, b)
Headers for Trigger frames.
bool IsBsrp() const
Check if this is a Buffer Status Report Poll Trigger frame.
RU Specification.
Definition eht-ru.h:35
static std::pair< uint16_t, Time > ConvertHeTbPpduDurationToLSigLength(Time ppduDuration, const WifiTxVector &txVector, WifiPhyBand band)
Compute the L-SIG length value corresponding to the given HE TB PPDU duration.
Definition he-phy.cc:263
RU Specification.
Definition he-ru.h:38
an EUI-48 address
void DoInitialize() override
Initialize() implementation.
Ptr< ApWifiMac > m_apMac
the AP wifi MAC
void RemoveRecipientsFromTf(uint8_t linkId, CtrlTriggerHeader &trigger, WifiTxParameters &txParams, std::function< bool(uint8_t, Mac48Address)> predicate) const
Remove the User Info fields for which the given predicate is true from the given Trigger Frame.
Ptr< WifiRemoteStationManager > GetWifiRemoteStationManager(uint8_t linkId) const
Get the station manager attached to the AP on the given link.
uint8_t m_linkId
the ID of the link over which channel access has been granted
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...
const std::function< bool(uint8_t, Mac48Address)> m_isUnprotectedEmlsrClient
predicate returning true if the device with the given (link) address is an EMLSR client that is not p...
Ptr< QosTxop > m_edca
the AC that gained channel access
Time m_defaultTbPpduDuration
the default duration of TB PPDUs solicited by Basic TFs
TxFormat GetLastTxFormat(uint8_t linkId) const
Get the format of the last transmission on the given link, as determined by the last call to NotifyAc...
void DoDispose() override
Destructor implementation.
Ptr< WifiMpdu > GetTriggerFrame(const CtrlTriggerHeader &trigger, uint8_t linkId) const
Get an MPDU containing the given Trigger Frame.
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.
TxFormat
Enumeration of the possible transmission formats.
std::optional< Time > m_availableTime
the limit on the time available for frame exchange
void RemoveRecipientsFromDlMu(uint8_t linkId, WifiPsduMap &psduMap, WifiTxParameters &txParams, std::function< bool(uint8_t, Mac48Address)> predicate) const
Remove PSDUs for which the given predicate is true from the given PSDU map.
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
RrMultiUserScheduler is a simple OFDMA scheduler that indicates to perform a DL OFDMA transmission if...
TxFormat SelectTxFormat() override
Select the format of the next transmission.
bool m_enableBsrp
send a BSRP before an UL MU transmission
void NotifyStationAssociated(uint16_t aid, Mac48Address address)
Notify the scheduler that a station associated with the AP.
static TypeId GetTypeId()
Get the type ID.
uint32_t m_ulPsduSize
the size in byte of the solicited PSDU
std::list< CandidateInfo > m_candidates
Candidate stations for MU TX.
bool m_useCentral26TonesRus
whether to allocate central 26-tone RUs
bool m_forceDlOfdma
return DL_OFDMA even if no DL MU PPDU was built
bool m_enableUlOfdma
enable the scheduler to also return UL_OFDMA
void DoInitialize() override
Initialize() implementation.
UlMuInfo ComputeUlMuInfo() override
Prepare the information required to solicit an UL MU transmission.
DlMuInfo ComputeDlMuInfo() override
Compute the information required to perform a DL MU transmission.
void DoDispose() override
Destructor implementation.
virtual const std::list< MasterInfo > & GetUlMuStas() const
Get UL MU eligible stations list.
void UpdateCredits(std::list< MasterInfo > &staList, Time txDuration, const WifiTxVector &txVector)
Update credits of the stations in the given list considering that a PPDU having the given duration is...
WifiMacHeader m_triggerMacHdr
MAC header for Trigger Frame.
uint8_t m_nStations
Number of stations/slots to fill.
Time m_triggerTxDuration
Trigger Frame TX duration.
void UpdateDlMuAfterProtection(uint8_t linkId, WifiPsduMap &psduMap, WifiTxParameters &txParams) const override
Update the given PSDU map after protection is completed on the given link.
WifiTxParameters m_txParams
TX parameters.
virtual TxFormat TrySendingDlMuPpdu()
Check if it is possible to send a DL MU PPDU given the current time limits.
void NotifyStationDeassociated(uint16_t aid, Mac48Address address)
Notify the scheduler that a station deassociated with the AP.
Time m_maxCredits
Max amount of credits a station can have.
void UpdateTriggerFrameAfterProtection(uint8_t linkId, CtrlTriggerHeader &trigger, WifiTxParameters &txParams) const override
Update the given Trigger Frame after protection is completed on the given link.
virtual WifiTxVector GetTxVectorForUlMu(std::function< bool(const MasterInfo &)> canBeSolicited)
Compute a TXVECTOR that can be used to construct a Trigger Frame to solicit transmissions from suitab...
Time GetExtraTimeForBsrpTfDurationId(uint8_t linkId) const override
When the TXOP limit is zero and the TXOP continues a SIFS after receiving a response to a BSRP TF,...
bool m_enableTxopSharing
allow A-MPDUs of different TIDs in a DL MU PPDU
CtrlTriggerHeader m_trigger
Trigger Frame to send.
std::map< AcIndex, std::list< MasterInfo > > m_staListDl
Per-AC list of stations (next to serve for DL first).
virtual bool CanSolicitStaInBasicTf(const MasterInfo &info) const
Determine whether the given STA can be solicited via a Basic Trigger Frame.
virtual TxFormat TrySendingBsrpTf()
Check if it is possible to send a BSRP Trigger Frame given the current time limits.
virtual bool CanSolicitStaInBsrpTf(const MasterInfo &info) const
Determine whether the given STA can be solicited via a BSRP Trigger Frame.
virtual TxFormat TrySendingBasicTf()
Check if it is possible to send a Basic Trigger Frame given the current time limits.
void FinalizeTxVector(WifiTxVector &txVector)
Finalize the given TXVECTOR by only including the largest subset of the current set of candidate stat...
std::list< MasterInfo > m_staListUl
List of stations to serve for UL.
static Time Now()
Return the current simulation virtual time.
Definition simulator.cc:191
Simulation virtual time values and global simulation resolution.
Definition nstime.h:95
@ US
microsecond
Definition nstime.h:108
@ MS
millisecond
Definition nstime.h:107
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Definition time.cc:422
bool IsNegative() const
Exactly equivalent to t <= 0.
Definition nstime.h:314
double ToDouble(Unit unit) const
Get the Time value expressed in a particular unit.
Definition nstime.h:600
bool IsZero() const
Exactly equivalent to t == 0.
Definition nstime.h:305
a unique identifier for an interface.
Definition type-id.h:50
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1003
Hold an unsigned integer type.
Definition uinteger.h:34
Implements the IEEE 802.11 MAC header.
void SetAddr1(Mac48Address address)
Fill the Address 1 field with the given address.
void SetAddr2(Mac48Address address)
Fill the Address 2 field with the given address.
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
Definition wifi-phy.cc:1574
std::variant< HeRu::RuSpec, EhtRu::RuSpec > RuSpec
variant of the RU specification
Definition wifi-ru.h:28
static std::vector< RuSpec > GetRusOfType(MHz_u bw, RuType ruType, WifiModulationClass mc)
Get the set of distinct RUs of the given type (number of tones) available in an MU PPDU of the given ...
Definition wifi-ru.cc:173
static MHz_u GetBandwidth(RuType ruType)
Get the approximate bandwidth occupied by a RU.
Definition wifi-ru.cc:78
static RuType GetEqualSizedRusForStations(MHz_u bandwidth, std::size_t &nStations, std::size_t &nCentral26TonesRus, WifiModulationClass mc)
Given the channel bandwidth and the number of stations candidate for being assigned an RU,...
Definition wifi-ru.cc:237
static RuType GetRuType(RuSpec ru)
Get the type of a given RU.
Definition wifi-ru.cc:45
static std::vector< RuSpec > GetCentral26TonesRus(MHz_u bw, RuType ruType, WifiModulationClass mc)
Get the set of 26-tone RUs that can be additionally allocated if the given bandwidth is split in RUs ...
Definition wifi-ru.cc:190
This class stores the TX parameters (TX vector, protection mechanism, acknowledgment mechanism,...
std::optional< Time > m_txDuration
TX duration of the frame.
WifiTxVector m_txVector
TXVECTOR of the frame being prepared.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
void SetEhtPpduType(uint8_t type)
Set the EHT_PPDU_TYPE parameter.
void SetGuardInterval(Time guardInterval)
Sets the guard interval duration.
std::map< uint16_t, HeMuUserInfo > HeMuUserInfoMap
map of HE MU specific user info parameters indexed by STA-ID
void SetHeMuUserInfo(uint16_t staId, HeMuUserInfo userInfo)
Set the HE MU user-specific transmission information for the given STA-ID.
WifiPreamble GetPreambleType() const
void SetChannelWidth(MHz_u channelWidth)
Sets the selected channelWidth.
const HeMuUserInfoMap & GetHeMuUserInfoMap() const
Get a const reference to the map HE MU user-specific transmission information indexed by STA-ID.
WifiModulationClass GetModulationClass() const
Get the modulation class specified by this TXVECTOR.
void SetBssColor(uint8_t color)
Set the BSS color.
void SetPreambleType(WifiPreamble preamble)
Sets the preamble type.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition assert.h:55
#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:76
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Definition callback.h:690
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition abort.h:99
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:201
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition log.h:267
#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_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition log.h:274
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:492
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1313
WifiContainerQueueId MakeWifiUnicastQueueId(WifiContainerQueueType type, Mac48Address addr1, std::optional< tid_t > tid=std::nullopt)
Helper function to create WifiContainerQueueId for unicast queues.
WifiModulationClass
This enumeration defines the modulation classes per (Table 10-6 "Modulation classes"; IEEE 802....
AcIndex QosUtilsMapTidToAc(uint8_t tid)
Maps TID (Traffic ID) to Access classes.
Definition qos-utils.cc:123
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition qos-utils.h:64
@ WIFI_PREAMBLE_EHT_TB
@ WIFI_PREAMBLE_HE_TB
@ WIFI_PREAMBLE_EHT_MU
@ WIFI_PREAMBLE_HE_MU
@ WIFI_MOD_CLASS_EHT
EHT (Clause 36).
@ WIFI_MOD_CLASS_HE
HE (Clause 27).
@ AC_BE
Best Effort.
Definition qos-utils.h:66
Declaration of ns3::HePhy class and ns3::HeSigAParameters struct.
Definition first.py:1
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeBooleanChecker()
Definition boolean.cc:113
Ptr< const AttributeChecker > MakeUintegerChecker()
Definition uinteger.h:85
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Definition nstime.h:1416
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Definition uinteger.h:35
Time GetPpduMaxTime(WifiPreamble preamble)
Get the maximum PPDU duration (see Section 10.14 of 802.11-2016) for the PHY layers defining the aPPD...
RuType
The different Resource Unit (RU) types.
Definition wifi-types.h:286
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
Definition ptr.h:643
std::unordered_map< uint16_t, Ptr< WifiPsdu > > WifiPsduMap
Map of PSDUs indexed by STA-ID.
Definition wifi-mac.h:105
std::size_t Count20MHzSubchannels(MHz_u channelWidth)
Return the number of 20 MHz subchannels covering the channel width.
Definition wifi-utils.h:147
@ WIFI_MAC_QOSDATA
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Definition boolean.h:70
uint32_t GetBlockAckSize(BlockAckType type)
Return the total BlockAck size (including FCS trailer).
Definition wifi-utils.cc:59
const std::map< AcIndex, WifiAc > wifiAcList
Map containing the four ACs in increasing order of priority (according to Table 10-1 "UP-to-AC Mappin...
Definition qos-utils.cc:115
bool IsEht(WifiPreamble preamble)
Return true if a preamble corresponds to an EHT transmission.
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.
Definition nstime.h:1436
The different BlockAck variants.
std::vector< uint8_t > m_bitmapLen
Length (bytes) of included bitmaps.
Information to be provided in case of DL MU transmission.
WifiTxParameters txParams
the transmission parameters
WifiPsduMap psduMap
the DL MU PPDU to transmit
Information to be provided in case of UL MU transmission.
Information used to sort stations.
Mac48Address address
station's MAC Address
double credits
credits accumulated by the station
std::ofstream queueSize