A Discrete-Event Network Simulator
API
wifi-mac.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008 INRIA
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18 */
19
20#include "wifi-mac.h"
21
24#include "mac-rx-middle.h"
25#include "mac-tx-middle.h"
26#include "mgt-headers.h"
27#include "qos-txop.h"
28#include "ssid.h"
30#include "wifi-mac-queue.h"
31#include "wifi-net-device.h"
32
33#include "ns3/eht-configuration.h"
34#include "ns3/he-configuration.h"
35#include "ns3/he-frame-exchange-manager.h"
36#include "ns3/ht-configuration.h"
37#include "ns3/log.h"
38#include "ns3/packet.h"
39#include "ns3/pointer.h"
40#include "ns3/vht-configuration.h"
41
42namespace ns3
43{
44
46
48
50 : m_qosSupported(false)
51{
52 NS_LOG_FUNCTION(this);
53
54 m_rxMiddle = Create<MacRxMiddle>();
55 m_rxMiddle->SetForwardCallback(MakeCallback(&WifiMac::Receive, this));
56
57 m_txMiddle = Create<MacTxMiddle>();
58}
59
61{
62 NS_LOG_FUNCTION(this);
63}
64
67{
68 static TypeId tid =
69 TypeId("ns3::WifiMac")
71 .SetGroupName("Wifi")
72 .AddAttribute("Ssid",
73 "The ssid we want to belong to.",
74 SsidValue(Ssid("default")),
75 MakeSsidAccessor(&WifiMac::GetSsid, &WifiMac::SetSsid),
76 MakeSsidChecker())
77 .AddAttribute("QosSupported",
78 "This Boolean attribute is set to enable 802.11e/WMM-style QoS support "
79 "at this STA.",
81 TypeId::ATTR_CONSTRUCT, // prevent setting after construction
82 BooleanValue(false),
85 .AddAttribute("CtsToSelfSupported",
86 "Use CTS to Self when using a rate that is not in the basic rate set.",
87 BooleanValue(false),
90 .AddAttribute(
91 "ShortSlotTimeSupported",
92 "Whether or not short slot time is supported (only used by ERP APs or STAs).",
93 BooleanValue(true),
97 .AddAttribute("Txop",
98 "The Txop object.",
101 MakePointerChecker<Txop>())
102 .AddAttribute("VO_Txop",
103 "Queue that manages packets belonging to AC_VO access class.",
104 PointerValue(),
106 MakePointerChecker<QosTxop>())
107 .AddAttribute("VI_Txop",
108 "Queue that manages packets belonging to AC_VI access class.",
109 PointerValue(),
111 MakePointerChecker<QosTxop>())
112 .AddAttribute("BE_Txop",
113 "Queue that manages packets belonging to AC_BE access class.",
114 PointerValue(),
116 MakePointerChecker<QosTxop>())
117 .AddAttribute("BK_Txop",
118 "Queue that manages packets belonging to AC_BK access class.",
119 PointerValue(),
121 MakePointerChecker<QosTxop>())
122 .AddAttribute("VO_MaxAmsduSize",
123 "Maximum length in bytes of an A-MSDU for AC_VO access class "
124 "(capped to 7935 for HT PPDUs and 11398 for VHT/HE/EHT PPDUs). "
125 "Value 0 means A-MSDU aggregation is disabled for that AC.",
126 UintegerValue(0),
128 MakeUintegerChecker<uint16_t>(0, 11398))
129 .AddAttribute("VI_MaxAmsduSize",
130 "Maximum length in bytes of an A-MSDU for AC_VI access class "
131 "(capped to 7935 for HT PPDUs and 11398 for VHT/HE/EHT PPDUs). "
132 "Value 0 means A-MSDU aggregation is disabled for that AC.",
133 UintegerValue(0),
135 MakeUintegerChecker<uint16_t>(0, 11398))
136 .AddAttribute("BE_MaxAmsduSize",
137 "Maximum length in bytes of an A-MSDU for AC_BE access class "
138 "(capped to 7935 for HT PPDUs and 11398 for VHT/HE/EHT PPDUs). "
139 "Value 0 means A-MSDU aggregation is disabled for that AC.",
140 UintegerValue(0),
142 MakeUintegerChecker<uint16_t>(0, 11398))
143 .AddAttribute("BK_MaxAmsduSize",
144 "Maximum length in bytes of an A-MSDU for AC_BK access class "
145 "(capped to 7935 for HT PPDUs and 11398 for VHT/HE/EHT PPDUs). "
146 "Value 0 means A-MSDU aggregation is disabled for that AC.",
147 UintegerValue(0),
149 MakeUintegerChecker<uint16_t>(0, 11398))
150 .AddAttribute(
151 "VO_MaxAmpduSize",
152 "Maximum length in bytes of an A-MPDU for AC_VO access class "
153 "(capped to 65535 for HT PPDUs, 1048575 for VHT PPDUs, 6500631 for HE PPDUs "
154 "and 15523200 for EHT PPDUs). "
155 "Value 0 means A-MPDU aggregation is disabled for that AC.",
156 UintegerValue(0),
158 MakeUintegerChecker<uint32_t>(0, 15523200))
159 .AddAttribute(
160 "VI_MaxAmpduSize",
161 "Maximum length in bytes of an A-MPDU for AC_VI access class "
162 "(capped to 65535 for HT PPDUs, 1048575 for VHT PPDUs, 6500631 for HE PPDUs "
163 "and 15523200 for EHT PPDUs). "
164 "Value 0 means A-MPDU aggregation is disabled for that AC.",
165 UintegerValue(65535),
167 MakeUintegerChecker<uint32_t>(0, 15523200))
168 .AddAttribute(
169 "BE_MaxAmpduSize",
170 "Maximum length in bytes of an A-MPDU for AC_BE access class "
171 "(capped to 65535 for HT PPDUs, 1048575 for VHT PPDUs, 6500631 for HE PPDUs "
172 "and 15523200 for EHT PPDUs). "
173 "Value 0 means A-MPDU aggregation is disabled for that AC.",
174 UintegerValue(65535),
176 MakeUintegerChecker<uint32_t>(0, 15523200))
177 .AddAttribute(
178 "BK_MaxAmpduSize",
179 "Maximum length in bytes of an A-MPDU for AC_BK access class "
180 "(capped to 65535 for HT PPDUs, 1048575 for VHT PPDUs, 6500631 for HE PPDUs "
181 "and 15523200 for EHT PPDUs). "
182 "Value 0 means A-MPDU aggregation is disabled for that AC.",
183 UintegerValue(0),
185 MakeUintegerChecker<uint32_t>(0, 15523200))
186 .AddAttribute(
187 "VO_BlockAckThreshold",
188 "If number of packets in VO queue reaches this value, "
189 "block ack mechanism is used. If this value is 0, block ack is never used."
190 "When A-MPDU is enabled, block ack mechanism is used regardless of this value.",
191 UintegerValue(0),
193 MakeUintegerChecker<uint8_t>(0, 64))
194 .AddAttribute(
195 "VI_BlockAckThreshold",
196 "If number of packets in VI queue reaches this value, "
197 "block ack mechanism is used. If this value is 0, block ack is never used."
198 "When A-MPDU is enabled, block ack mechanism is used regardless of this value.",
199 UintegerValue(0),
201 MakeUintegerChecker<uint8_t>(0, 64))
202 .AddAttribute(
203 "BE_BlockAckThreshold",
204 "If number of packets in BE queue reaches this value, "
205 "block ack mechanism is used. If this value is 0, block ack is never used."
206 "When A-MPDU is enabled, block ack mechanism is used regardless of this value.",
207 UintegerValue(0),
209 MakeUintegerChecker<uint8_t>(0, 64))
210 .AddAttribute(
211 "BK_BlockAckThreshold",
212 "If number of packets in BK queue reaches this value, "
213 "block ack mechanism is used. If this value is 0, block ack is never used."
214 "When A-MPDU is enabled, block ack mechanism is used regardless of this value.",
215 UintegerValue(0),
217 MakeUintegerChecker<uint8_t>(0, 64))
218 .AddAttribute(
219 "VO_BlockAckInactivityTimeout",
220 "Represents max time (blocks of 1024 microseconds) allowed for block ack"
221 "inactivity for AC_VO. If this value isn't equal to 0 a timer start after that a"
222 "block ack setup is completed and will be reset every time that a block ack"
223 "frame is received. If this value is 0, block ack inactivity timeout won't be "
224 "used.",
225 UintegerValue(0),
227 MakeUintegerChecker<uint16_t>())
228 .AddAttribute(
229 "VI_BlockAckInactivityTimeout",
230 "Represents max time (blocks of 1024 microseconds) allowed for block ack"
231 "inactivity for AC_VI. If this value isn't equal to 0 a timer start after that a"
232 "block ack setup is completed and will be reset every time that a block ack"
233 "frame is received. If this value is 0, block ack inactivity timeout won't be "
234 "used.",
235 UintegerValue(0),
237 MakeUintegerChecker<uint16_t>())
238 .AddAttribute(
239 "BE_BlockAckInactivityTimeout",
240 "Represents max time (blocks of 1024 microseconds) allowed for block ack"
241 "inactivity for AC_BE. If this value isn't equal to 0 a timer start after that a"
242 "block ack setup is completed and will be reset every time that a block ack"
243 "frame is received. If this value is 0, block ack inactivity timeout won't be "
244 "used.",
245 UintegerValue(0),
247 MakeUintegerChecker<uint16_t>())
248 .AddAttribute(
249 "BK_BlockAckInactivityTimeout",
250 "Represents max time (blocks of 1024 microseconds) allowed for block ack"
251 "inactivity for AC_BK. If this value isn't equal to 0 a timer start after that a"
252 "block ack setup is completed and will be reset every time that a block ack"
253 "frame is received. If this value is 0, block ack inactivity timeout won't be "
254 "used.",
255 UintegerValue(0),
257 MakeUintegerChecker<uint16_t>())
258 .AddTraceSource("MacTx",
259 "A packet has been received from higher layers and is being processed "
260 "in preparation for "
261 "queueing for transmission.",
263 "ns3::Packet::TracedCallback")
264 .AddTraceSource(
265 "MacTxDrop",
266 "A packet has been dropped in the MAC layer before being queued for transmission. "
267 "This trace source is fired, e.g., when an AP's MAC receives from the upper layer "
268 "a packet destined to a station that is not associated with the AP or a STA's MAC "
269 "receives a packet from the upper layer while it is not associated with any AP.",
271 "ns3::Packet::TracedCallback")
272 .AddTraceSource(
273 "MacPromiscRx",
274 "A packet has been received by this device, has been passed up from the physical "
275 "layer "
276 "and is being forwarded up the local protocol stack. This is a promiscuous trace.",
278 "ns3::Packet::TracedCallback")
279 .AddTraceSource("MacRx",
280 "A packet has been received by this device, has been passed up from "
281 "the physical layer "
282 "and is being forwarded up the local protocol stack. This is a "
283 "non-promiscuous trace.",
285 "ns3::Packet::TracedCallback")
286 .AddTraceSource("MacRxDrop",
287 "A packet has been dropped in the MAC layer after it has been passed "
288 "up from the physical layer.",
290 "ns3::Packet::TracedCallback")
291 .AddTraceSource("TxOkHeader",
292 "The header of successfully transmitted packet.",
294 "ns3::WifiMacHeader::TracedCallback",
296 "Use the AckedMpdu trace instead.")
297 .AddTraceSource("TxErrHeader",
298 "The header of unsuccessfully transmitted packet.",
300 "ns3::WifiMacHeader::TracedCallback",
302 "Depending on the failure type, use the NAckedMpdu trace, the "
303 "DroppedMpdu trace or one of the traces associated with TX timeouts.")
304 .AddTraceSource("AckedMpdu",
305 "An MPDU that was successfully acknowledged, via either a "
306 "Normal Ack or a Block Ack.",
308 "ns3::WifiMpdu::TracedCallback")
309 .AddTraceSource("NAckedMpdu",
310 "An MPDU that was negatively acknowledged via a Block Ack.",
312 "ns3::WifiMpdu::TracedCallback")
313 .AddTraceSource(
314 "DroppedMpdu",
315 "An MPDU that was dropped for the given reason (see WifiMacDropReason).",
317 "ns3::WifiMac::DroppedMpduCallback")
318 .AddTraceSource(
319 "MpduResponseTimeout",
320 "An MPDU whose response was not received before the timeout, along with "
321 "an identifier of the type of timeout (see WifiTxTimer::Reason) and the "
322 "TXVECTOR used to transmit the MPDU. This trace source is fired when a "
323 "CTS is missing after an RTS or a Normal Ack is missing after an MPDU "
324 "or after a DL MU PPDU acknowledged in SU format.",
326 "ns3::WifiMac::MpduResponseTimeoutCallback")
327 .AddTraceSource(
328 "PsduResponseTimeout",
329 "A PSDU whose response was not received before the timeout, along with "
330 "an identifier of the type of timeout (see WifiTxTimer::Reason) and the "
331 "TXVECTOR used to transmit the PSDU. This trace source is fired when a "
332 "BlockAck is missing after an A-MPDU, a BlockAckReq (possibly in the "
333 "context of the acknowledgment of a DL MU PPDU in SU format) or a TB PPDU "
334 "(in the latter case the missing BlockAck is a Multi-STA BlockAck).",
336 "ns3::WifiMac::PsduResponseTimeoutCallback")
337 .AddTraceSource(
338 "PsduMapResponseTimeout",
339 "A PSDU map for which not all the responses were received before the timeout, "
340 "along with an identifier of the type of timeout (see WifiTxTimer::Reason), "
341 "the set of MAC addresses of the stations that did not respond and the total "
342 "number of stations that had to respond. This trace source is fired when not "
343 "all the addressed stations responded to an MU-BAR Trigger frame (either sent as "
344 "a SU frame or aggregated to PSDUs in the DL MU PPDU), a Basic Trigger Frame or "
345 "a BSRP Trigger Frame.",
347 "ns3::WifiMac::PsduMapResponseTimeoutCallback");
348 return tid;
349}
350
351void
353{
354 NS_LOG_FUNCTION(this);
355
356 if (m_txop)
357 {
359 }
360
361 for (auto it = m_edca.begin(); it != m_edca.end(); ++it)
362 {
363 it->second->Initialize();
364 }
365}
366
367void
369{
370 NS_LOG_FUNCTION(this);
371
372 m_rxMiddle = nullptr;
373 m_txMiddle = nullptr;
374 m_links.clear();
375
376 if (m_txop)
377 {
378 m_txop->Dispose();
379 }
380 m_txop = nullptr;
381
382 for (auto it = m_edca.begin(); it != m_edca.end(); ++it)
383 {
384 it->second->Dispose();
385 it->second = nullptr;
386 }
387
388 m_device = nullptr;
389 if (m_scheduler != nullptr)
390 {
391 m_scheduler->Dispose();
392 }
393 m_scheduler = nullptr;
394}
395
397{
398 // WifiMac owns pointers to ChannelAccessManager and FrameExchangeManager
400 {
402 }
403 if (feManager)
404 {
405 feManager->Dispose();
406 }
407}
408
409void
411{
412 NS_LOG_FUNCTION(this << type);
414}
415
418{
419 return m_typeOfStation;
420}
421
422void
424{
425 m_device = device;
426}
427
430{
431 return m_device;
432}
433
434void
436{
437 NS_LOG_FUNCTION(this << address);
439}
440
443{
444 return m_address;
445}
446
447void
449{
450 NS_LOG_FUNCTION(this << ssid);
451 m_ssid = ssid;
452}
453
454Ssid
456{
457 return m_ssid;
458}
459
460void
461WifiMac::SetBssid(Mac48Address bssid, uint8_t linkId)
462{
463 NS_LOG_FUNCTION(this << bssid << +linkId);
464 GetLink(linkId).feManager->SetBssid(bssid);
465}
466
468WifiMac::GetBssid(uint8_t linkId) const
469{
470 return GetLink(linkId).feManager->GetBssid();
471}
472
473void
475{
476 for (auto& link : m_links)
477 {
478 link->feManager->SetPromisc();
479 }
480}
481
484{
485 return m_txop;
486}
487
490{
491 // Use std::find_if() instead of std::map::find() because the latter compares
492 // the given AC index with the AC index of an element in the map by using the
493 // operator< defined for AcIndex, which aborts if an operand is not a QoS AC
494 // (the AC index passed to this method may not be a QoS AC).
495 // The performance penalty is limited because std::map::find() performs 3
496 // comparisons in the worst case, while std::find_if() performs 4 comparisons
497 // in the worst case.
498 const auto it = std::find_if(m_edca.cbegin(), m_edca.cend(), [ac](const auto& pair) {
499 return pair.first == ac;
500 });
501 return (it == m_edca.cend() ? nullptr : it->second);
502}
503
505WifiMac::GetQosTxop(uint8_t tid) const
506{
507 return GetQosTxop(QosUtilsMapTidToAc(tid));
508}
509
512{
513 return (m_qosSupported ? GetQosTxop(AC_VO) : nullptr);
514}
515
518{
519 return (m_qosSupported ? GetQosTxop(AC_VI) : nullptr);
520}
521
524{
525 return (m_qosSupported ? GetQosTxop(AC_BE) : nullptr);
526}
527
530{
531 return (m_qosSupported ? GetQosTxop(AC_BK) : nullptr);
532}
533
536{
537 Ptr<Txop> txop = (ac == AC_BE_NQOS ? m_txop : StaticCast<Txop>(GetQosTxop(ac)));
538 return (txop ? txop->GetWifiMacQueue() : nullptr);
539}
540
541void
543{
544 m_scheduler = scheduler;
545 m_scheduler->SetWifiMac(this);
546}
547
550{
551 return m_scheduler;
552}
553
554void
556{
557 NS_LOG_FUNCTION(this << +linkId);
558
559 // we may have changed PHY band, in which case it is necessary to re-configure
560 // the PHY dependent parameters. In any case, this makes no harm
562
563 // SetupPhy not only resets the remote station manager, but also sets the
564 // default TX mode and MCS, which is required when switching to a channel
565 // in a different band
566 GetLink(linkId).stationManager->SetupPhy(GetLink(linkId).phy);
567}
568
569void
571{
572 m_macTxTrace(packet);
573}
574
575void
577{
578 m_macTxDropTrace(packet);
579}
580
581void
583{
584 m_macRxTrace(packet);
585}
586
587void
589{
590 m_macPromiscRxTrace(packet);
591}
592
593void
595{
596 m_macRxDropTrace(packet);
597}
598
599void
601{
602 NS_LOG_FUNCTION(this << ac);
603
604 // Our caller shouldn't be attempting to setup a queue that is
605 // already configured.
606 NS_ASSERT(m_edca.find(ac) == m_edca.end());
607
608 Ptr<QosTxop> edca = CreateObject<QosTxop>(ac);
609 edca->SetTxMiddle(m_txMiddle);
610 edca->GetBaManager()->SetTxOkCallback(
611 MakeCallback(&MpduTracedCallback::operator(), &m_ackedMpduCallback));
612 edca->GetBaManager()->SetTxFailedCallback(
613 MakeCallback(&MpduTracedCallback::operator(), &m_nackedMpduCallback));
615 MakeCallback(&DroppedMpduTracedCallback::operator(), &m_droppedMpduCallback));
616
617 m_edca.insert(std::make_pair(ac, edca));
618}
619
620void
622{
623 std::list<bool> isDsssOnly;
624 for (const auto& link : m_links)
625 {
626 isDsssOnly.push_back(link->dsssSupported && !link->erpSupported);
627 }
628
629 if (m_txop)
630 {
631 // The special value of AC_BE_NQOS which exists in the Access
632 // Category enumeration allows us to configure plain old DCF.
633 ConfigureDcf(m_txop, cwMin, cwMax, isDsssOnly, AC_BE_NQOS);
634 }
635
636 // Now we configure the EDCA functions
637 for (auto it = m_edca.begin(); it != m_edca.end(); ++it)
638 {
639 ConfigureDcf(it->second, cwMin, cwMax, isDsssOnly, it->first);
640 }
641}
642
643void
645 uint32_t cwmin,
646 uint32_t cwmax,
647 std::list<bool> isDsss,
648 AcIndex ac)
649{
650 NS_LOG_FUNCTION(this << dcf << cwmin << cwmax << +ac);
651
652 uint32_t cwMinValue = 0;
653 uint32_t cwMaxValue = 0;
654 uint8_t aifsnValue = 0;
655 Time txopLimitDsss(0);
656 Time txopLimitNoDsss(0);
657
658 /* see IEEE 802.11-2020 Table 9-155 "Default EDCA Parameter Set element parameter values" */
659 switch (ac)
660 {
661 case AC_VO:
662 cwMinValue = (cwmin + 1) / 4 - 1;
663 cwMaxValue = (cwmin + 1) / 2 - 1;
664 aifsnValue = 2;
665 txopLimitDsss = MicroSeconds(3264);
666 txopLimitNoDsss = MicroSeconds(2080);
667 break;
668 case AC_VI:
669 cwMinValue = (cwmin + 1) / 2 - 1;
670 cwMaxValue = cwmin;
671 aifsnValue = 2;
672 txopLimitDsss = MicroSeconds(6016);
673 txopLimitNoDsss = MicroSeconds(4096);
674 break;
675 case AC_BE:
676 cwMinValue = cwmin;
677 cwMaxValue = cwmax;
678 aifsnValue = 3;
679 txopLimitDsss = MicroSeconds(0); // TODO should be MicroSeconds (3264)
680 txopLimitNoDsss = MicroSeconds(0); // TODO should be MicroSeconds (2528)
681 break;
682 case AC_BK:
683 cwMinValue = cwmin;
684 cwMaxValue = cwmax;
685 aifsnValue = 7;
686 txopLimitDsss = MicroSeconds(0); // TODO should be MicroSeconds (3264)
687 txopLimitNoDsss = MicroSeconds(0); // TODO should be MicroSeconds (2528)
688 break;
689 case AC_BE_NQOS:
690 cwMinValue = cwmin;
691 cwMaxValue = cwmax;
692 aifsnValue = 2;
693 txopLimitDsss = txopLimitNoDsss = MicroSeconds(0);
694 break;
695 case AC_BEACON:
696 // done by ApWifiMac
697 break;
698 case AC_UNDEF:
699 NS_FATAL_ERROR("I don't know what to do with this");
700 break;
701 }
702
703 std::vector<uint32_t> cwValues(m_links.size());
704 std::vector<uint8_t> aifsnValues(m_links.size());
705 std::vector<Time> txopLimitValues(m_links.size());
706
707 std::fill(cwValues.begin(), cwValues.end(), cwMinValue);
708 dcf->SetMinCws(cwValues);
709 std::fill(cwValues.begin(), cwValues.end(), cwMaxValue);
710 dcf->SetMaxCws(cwValues);
711 std::fill(aifsnValues.begin(), aifsnValues.end(), aifsnValue);
712 dcf->SetAifsns(aifsnValues);
713 std::transform(isDsss.begin(),
714 isDsss.end(),
715 txopLimitValues.begin(),
716 [&txopLimitDsss, &txopLimitNoDsss](bool dsss) {
717 return (dsss ? txopLimitDsss : txopLimitNoDsss);
718 });
719 dcf->SetTxopLimits(txopLimitValues);
720}
721
722void
724{
725 NS_LOG_FUNCTION(this << standard);
727 NS_ABORT_MSG_IF(m_links.empty(), "No PHY configured yet");
728
729 for (auto& link : m_links)
730 {
732 !link->phy || !link->phy->GetOperatingChannel().IsSet(),
733 "[LinkID " << link->id
734 << "] PHY must have been set and an operating channel must have been set");
735
736 // do not create a ChannelAccessManager and a FrameExchangeManager if they
737 // already exist (this function may be called after ResetWifiPhys)
738 if (!link->channelAccessManager)
739 {
740 link->channelAccessManager = CreateObject<ChannelAccessManager>();
741 }
742 link->channelAccessManager->SetupPhyListener(link->phy);
743
744 if (!link->feManager)
745 {
746 link->feManager = SetupFrameExchangeManager(standard);
747 }
748 link->feManager->SetWifiPhy(link->phy);
749 link->feManager->SetWifiMac(this);
750 link->feManager->SetLinkId(link->id);
751 link->channelAccessManager->SetLinkId(link->id);
752 link->channelAccessManager->SetupFrameExchangeManager(link->feManager);
753
754 if (m_txop)
755 {
756 m_txop->SetWifiMac(this);
757 link->channelAccessManager->Add(m_txop);
758 }
759 for (auto it = m_edca.begin(); it != m_edca.end(); ++it)
760 {
761 it->second->SetWifiMac(this);
762 link->channelAccessManager->Add(it->second);
763 }
764
766 }
767}
768
769void
771{
772 NS_LOG_FUNCTION(this << +linkId);
773
774 WifiStandard standard = GetLink(linkId).phy->GetStandard();
775
776 uint32_t cwmin = (standard == WIFI_STANDARD_80211b ? 31 : 15);
777 uint32_t cwmax = 1023;
778
779 SetDsssSupported(standard == WIFI_STANDARD_80211b, linkId);
781 m_links[linkId]->phy->GetPhyBand() == WIFI_PHY_BAND_2_4GHZ,
782 linkId);
783
784 ConfigureContentionWindow(cwmin, cwmax);
785}
786
789{
790 NS_LOG_FUNCTION(this << standard);
791 NS_ABORT_MSG_IF(standard == WIFI_STANDARD_UNSPECIFIED, "Wifi standard not set");
793
794 if (standard >= WIFI_STANDARD_80211ax)
795 {
796 feManager = CreateObject<HeFrameExchangeManager>();
797 }
798 else if (standard >= WIFI_STANDARD_80211ac)
799 {
800 feManager = CreateObject<VhtFrameExchangeManager>();
801 }
802 else if (standard >= WIFI_STANDARD_80211n)
803 {
804 feManager = CreateObject<HtFrameExchangeManager>();
805 }
806 else if (m_qosSupported)
807 {
808 feManager = CreateObject<QosFrameExchangeManager>();
809 }
810 else
811 {
812 feManager = CreateObject<FrameExchangeManager>();
813 }
814
815 feManager->SetMacTxMiddle(m_txMiddle);
816 feManager->SetMacRxMiddle(m_rxMiddle);
817 feManager->SetAddress(GetAddress());
818 feManager->GetWifiTxTimer().SetMpduResponseTimeoutCallback(
819 MakeCallback(&MpduResponseTimeoutTracedCallback::operator(),
821 feManager->GetWifiTxTimer().SetPsduResponseTimeoutCallback(
822 MakeCallback(&PsduResponseTimeoutTracedCallback::operator(),
824 feManager->GetWifiTxTimer().SetPsduMapResponseTimeoutCallback(
825 MakeCallback(&PsduMapResponseTimeoutTracedCallback::operator(),
827 feManager->SetDroppedMpduCallback(
828 MakeCallback(&DroppedMpduTracedCallback::operator(), &m_droppedMpduCallback));
829 feManager->SetAckedMpduCallback(
830 MakeCallback(&MpduTracedCallback::operator(), &m_ackedMpduCallback));
831 return feManager;
832}
833
836{
837 return GetLink(linkId).feManager;
838}
839
842{
843 return GetLink(linkId).channelAccessManager;
844}
845
846void
848{
849 NS_LOG_FUNCTION(this << stationManager);
850 SetWifiRemoteStationManagers({stationManager});
851}
852
853void
855 const std::vector<Ptr<WifiRemoteStationManager>>& stationManagers)
856{
857 NS_LOG_FUNCTION(this);
858
859 NS_ABORT_MSG_UNLESS(m_links.size() == 0 || m_links.size() == stationManagers.size(),
860 "If links have been already created, the number of provided "
861 "Remote Manager objects ("
862 << stationManagers.size()
863 << ") must "
864 "match the number of links ("
865 << m_links.size() << ")");
866
867 for (std::size_t i = 0; i < stationManagers.size(); i++)
868 {
869 // the link may already exist in case PHY objects were configured first
870 if (i == m_links.size())
871 {
872 m_links.push_back(CreateLinkEntity());
873 m_links.back()->id = i;
874 }
875 NS_ABORT_IF(i != m_links[i]->id);
876 m_links[i]->stationManager = stationManagers[i];
877 }
878}
879
882{
883 return GetLink(linkId).stationManager;
884}
885
886std::unique_ptr<WifiMac::LinkEntity>
888{
889 return std::make_unique<LinkEntity>();
890}
891
893WifiMac::GetLink(uint8_t linkId) const
894{
895 NS_ASSERT(linkId < m_links.size());
896 NS_ASSERT(m_links.at(linkId)); // check that the pointer owns an object
897 return *m_links.at(linkId);
898}
899
900uint8_t
902{
903 return m_links.size();
904}
905
906std::optional<uint8_t>
908{
909 for (std::size_t ret = 0; ret < m_links.size(); ++ret)
910 {
911 if (m_links[ret]->feManager->GetAddress() == address)
912 {
913 return ret;
914 }
915 }
916 return std::nullopt;
917}
918
919void
920WifiMac::SetWifiPhys(const std::vector<Ptr<WifiPhy>>& phys)
921{
922 NS_LOG_FUNCTION(this);
924
925 NS_ABORT_MSG_UNLESS(m_links.size() == 0 || m_links.size() == phys.size(),
926 "If links have been already created, the number of provided "
927 "PHY objects ("
928 << phys.size()
929 << ") must match the number "
930 "of links ("
931 << m_links.size() << ")");
932
933 for (std::size_t i = 0; i < phys.size(); i++)
934 {
935 // the link may already exist in case we are setting new PHY objects
936 // (ResetWifiPhys just nullified the PHY(s) but left the links)
937 // or the remote station managers were configured first
938 if (i == m_links.size())
939 {
940 m_links.push_back(CreateLinkEntity());
941 m_links.back()->id = i;
942 }
943 NS_ABORT_IF(i != m_links[i]->id);
944 m_links[i]->phy = phys[i];
945 }
946}
947
949WifiMac::GetWifiPhy(uint8_t linkId) const
950{
951 NS_LOG_FUNCTION(this << +linkId);
952 return GetLink(linkId).phy;
953}
954
955void
957{
958 NS_LOG_FUNCTION(this);
959 for (auto& link : m_links)
960 {
961 if (link->feManager)
962 {
963 link->feManager->ResetPhy();
964 }
965 if (link->channelAccessManager)
966 {
967 link->channelAccessManager->RemovePhyListener(link->phy);
968 }
969 link->phy = nullptr;
970 }
971}
972
973void
975{
976 NS_LOG_FUNCTION(this << enable);
978 m_qosSupported = enable;
979
980 if (!m_qosSupported)
981 {
982 // create a non-QoS TXOP
983 m_txop = CreateObject<Txop>();
986 MakeCallback(&DroppedMpduTracedCallback::operator(), &m_droppedMpduCallback));
987 }
988 else
989 {
990 // Construct the EDCAFs. The ordering is important - highest
991 // priority (Table 9-1 UP-to-AC mapping; IEEE 802.11-2012) must be created
992 // first.
997
998 std::map<AcIndex, Ptr<BlockAckManager>> bamMap;
999 for (const auto& ac : {AC_BE, AC_BK, AC_VI, AC_VO})
1000 {
1001 bamMap[ac] = GetQosTxop(ac)->GetBaManager();
1002 }
1003 for (const auto& ac : {AC_BE, AC_BK, AC_VI, AC_VO})
1004 {
1005 GetQosTxop(ac)->GetBaManager()->SetBlockAckManagerMap(bamMap);
1006 }
1007 }
1008}
1009
1010bool
1012{
1013 return m_qosSupported;
1014}
1015
1016bool
1017WifiMac::GetErpSupported(uint8_t linkId) const
1018{
1019 return GetLink(linkId).erpSupported;
1020}
1021
1022void
1023WifiMac::SetErpSupported(bool enable, uint8_t linkId)
1024{
1025 NS_LOG_FUNCTION(this << enable << +linkId);
1026 if (enable)
1027 {
1028 SetDsssSupported(true, linkId);
1029 }
1030 GetLink(linkId).erpSupported = enable;
1031}
1032
1033void
1034WifiMac::SetDsssSupported(bool enable, uint8_t linkId)
1035{
1036 NS_LOG_FUNCTION(this << enable << +linkId);
1037 GetLink(linkId).dsssSupported = enable;
1038}
1039
1040bool
1041WifiMac::GetDsssSupported(uint8_t linkId) const
1042{
1043 return GetLink(linkId).dsssSupported;
1044}
1045
1046void
1048{
1049 NS_LOG_FUNCTION(this);
1050 m_ctsToSelfSupported = enable;
1051}
1052
1053void
1055{
1056 NS_LOG_FUNCTION(this << enable);
1057 m_shortSlotTimeSupported = enable;
1058}
1059
1060bool
1062{
1064}
1065
1066bool
1068{
1069 return false;
1070}
1071
1072void
1074{
1075 NS_LOG_FUNCTION(this);
1076 m_forwardUp = upCallback;
1077}
1078
1079void
1081{
1082 NS_LOG_FUNCTION(this);
1083 m_linkUp = linkUp;
1084}
1085
1086void
1088{
1089 NS_LOG_FUNCTION(this);
1090 m_linkDown = linkDown;
1091}
1092
1093void
1095{
1096 // We expect WifiMac subclasses which do support forwarding (e.g.,
1097 // AP) to override this method. Therefore, we throw a fatal error if
1098 // someone tries to invoke this method on a class which has not done
1099 // this.
1100 NS_FATAL_ERROR("This MAC entity (" << this << ", " << GetAddress()
1101 << ") does not support Enqueue() with from address");
1102}
1103
1104void
1106{
1107 NS_LOG_FUNCTION(this << packet << from << to);
1108 m_forwardUp(packet, from, to);
1109}
1110
1111void
1113{
1114 NS_LOG_FUNCTION(this << *mpdu << linkId);
1115
1116 const WifiMacHeader* hdr = &mpdu->GetHeader();
1117 Ptr<Packet> packet = mpdu->GetPacket()->Copy();
1118 Mac48Address to = hdr->GetAddr1();
1119 Mac48Address from = hdr->GetAddr2();
1120 auto& link = GetLink(SINGLE_LINK_OP_ID);
1121
1122 // We don't know how to deal with any frame that is not addressed to
1123 // us (and odds are there is nothing sensible we could do anyway),
1124 // so we ignore such frames.
1125 //
1126 // The derived class may also do some such filtering, but it doesn't
1127 // hurt to have it here too as a backstop.
1128 if (to != GetAddress())
1129 {
1130 return;
1131 }
1132
1133 if (hdr->IsMgt() && hdr->IsAction())
1134 {
1135 // There is currently only any reason for Management Action
1136 // frames to be flying about if we are a QoS STA.
1138
1139 WifiActionHeader actionHdr;
1140 packet->RemoveHeader(actionHdr);
1141
1142 switch (actionHdr.GetCategory())
1143 {
1145
1146 switch (actionHdr.GetAction().blockAck)
1147 {
1149 MgtAddBaRequestHeader reqHdr;
1150 packet->RemoveHeader(reqHdr);
1151
1152 // We've received an ADDBA Request. Our policy here is
1153 // to automatically accept it, so we get the ADDBA
1154 // Response on it's way immediately.
1155 NS_ASSERT(link.feManager);
1156 auto htFem = DynamicCast<HtFrameExchangeManager>(link.feManager);
1157 if (htFem)
1158 {
1159 htFem->SendAddBaResponse(&reqHdr, from);
1160 }
1161 // This frame is now completely dealt with, so we're done.
1162 return;
1163 }
1165 MgtAddBaResponseHeader respHdr;
1166 packet->RemoveHeader(respHdr);
1167
1168 // We've received an ADDBA Response. We assume that it
1169 // indicates success after an ADDBA Request we have
1170 // sent (we could, in principle, check this, but it
1171 // seems a waste given the level of the current model)
1172 // and act by locally establishing the agreement on
1173 // the appropriate queue.
1174 GetQosTxop(respHdr.GetTid())->GotAddBaResponse(&respHdr, from);
1175 auto htFem = DynamicCast<HtFrameExchangeManager>(link.feManager);
1176 if (htFem)
1177 {
1178 GetQosTxop(respHdr.GetTid())
1179 ->GetBaManager()
1180 ->SetBlockAckInactivityCallback(
1182 }
1183 // This frame is now completely dealt with, so we're done.
1184 return;
1185 }
1187 MgtDelBaHeader delBaHdr;
1188 packet->RemoveHeader(delBaHdr);
1189
1190 if (delBaHdr.IsByOriginator())
1191 {
1192 // This DELBA frame was sent by the originator, so
1193 // this means that an ingoing established
1194 // agreement exists in HtFrameExchangeManager and we need to
1195 // destroy it.
1196 NS_ASSERT(link.feManager);
1197 auto htFem = DynamicCast<HtFrameExchangeManager>(link.feManager);
1198 if (htFem)
1199 {
1200 htFem->DestroyBlockAckAgreement(from, delBaHdr.GetTid());
1201 }
1202 }
1203 else
1204 {
1205 // We must have been the originator. We need to
1206 // tell the correct queue that the agreement has
1207 // been torn down
1208 GetQosTxop(delBaHdr.GetTid())->GotDelBaFrame(&delBaHdr, from);
1209 }
1210 // This frame is now completely dealt with, so we're done.
1211 return;
1212 }
1213 default:
1214 NS_FATAL_ERROR("Unsupported Action field in Block Ack Action frame");
1215 return;
1216 }
1217 default:
1218 NS_FATAL_ERROR("Unsupported Action frame received");
1219 return;
1220 }
1221 }
1222 NS_FATAL_ERROR("Don't know how to handle frame (type=" << hdr->GetType());
1223}
1224
1225void
1227{
1228 NS_LOG_FUNCTION(this << *mpdu);
1229 for (auto& msduPair : *PeekPointer(mpdu))
1230 {
1231 ForwardUp(msduPair.first,
1232 msduPair.second.GetSourceAddr(),
1233 msduPair.second.GetDestinationAddr());
1234 }
1235}
1236
1239{
1240 return GetDevice()->GetHtConfiguration();
1241}
1242
1245{
1246 return GetDevice()->GetVhtConfiguration();
1247}
1248
1251{
1252 return GetDevice()->GetHeConfiguration();
1253}
1254
1257{
1258 return GetDevice()->GetEhtConfiguration();
1259}
1260
1261bool
1263{
1264 return bool(GetDevice()->GetHtConfiguration());
1265}
1266
1267bool
1268WifiMac::GetVhtSupported(uint8_t linkId) const
1269{
1270 return (GetDevice()->GetVhtConfiguration() &&
1271 GetWifiPhy(linkId)->GetPhyBand() != WIFI_PHY_BAND_2_4GHZ);
1272}
1273
1274bool
1276{
1277 return bool(GetDevice()->GetHeConfiguration());
1278}
1279
1280bool
1282{
1283 return bool(GetDevice()->GetEhtConfiguration());
1284}
1285
1286void
1288{
1289 NS_LOG_FUNCTION(this << +threshold);
1290 if (m_qosSupported)
1291 {
1292 GetVOQueue()->SetBlockAckThreshold(threshold);
1293 }
1294}
1295
1296void
1298{
1299 NS_LOG_FUNCTION(this << +threshold);
1300 if (m_qosSupported)
1301 {
1302 GetVIQueue()->SetBlockAckThreshold(threshold);
1303 }
1304}
1305
1306void
1308{
1309 NS_LOG_FUNCTION(this << +threshold);
1310 if (m_qosSupported)
1311 {
1312 GetBEQueue()->SetBlockAckThreshold(threshold);
1313 }
1314}
1315
1316void
1318{
1319 NS_LOG_FUNCTION(this << +threshold);
1320 if (m_qosSupported)
1321 {
1322 GetBKQueue()->SetBlockAckThreshold(threshold);
1323 }
1324}
1325
1326void
1328{
1329 NS_LOG_FUNCTION(this << timeout);
1330 if (m_qosSupported)
1331 {
1333 }
1334}
1335
1336void
1338{
1339 NS_LOG_FUNCTION(this << timeout);
1340 if (m_qosSupported)
1341 {
1343 }
1344}
1345
1346void
1348{
1349 NS_LOG_FUNCTION(this << timeout);
1350 if (m_qosSupported)
1351 {
1353 }
1354}
1355
1356void
1358{
1359 NS_LOG_FUNCTION(this << timeout);
1360 if (m_qosSupported)
1361 {
1363 }
1364}
1365
1368{
1369 NS_LOG_FUNCTION(this);
1370 ExtendedCapabilities capabilities;
1371 capabilities.SetHtSupported(GetHtSupported());
1373 // TODO: to be completed
1374 return capabilities;
1375}
1376
1378WifiMac::GetHtCapabilities(uint8_t linkId) const
1379{
1380 NS_LOG_FUNCTION(this << +linkId);
1382 HtCapabilities capabilities;
1383
1384 auto phy = GetWifiPhy(linkId);
1385 Ptr<HtConfiguration> htConfiguration = GetHtConfiguration();
1386 bool sgiSupported = htConfiguration->GetShortGuardIntervalSupported();
1387 capabilities.SetLdpc(htConfiguration->GetLdpcSupported());
1388 capabilities.SetSupportedChannelWidth(htConfiguration->Get40MHzOperationSupported() ? 1 : 0);
1389 capabilities.SetShortGuardInterval20(sgiSupported);
1390 capabilities.SetShortGuardInterval40(phy->GetChannelWidth() >= 40 && sgiSupported);
1391 // Set Maximum A-MSDU Length subfield
1392 uint16_t maxAmsduSize =
1394 if (maxAmsduSize <= 3839)
1395 {
1396 capabilities.SetMaxAmsduLength(3839);
1397 }
1398 else
1399 {
1400 capabilities.SetMaxAmsduLength(7935);
1401 }
1402 uint32_t maxAmpduLength =
1404 // round to the next power of two minus one
1405 maxAmpduLength = (1UL << static_cast<uint32_t>(std::ceil(std::log2(maxAmpduLength + 1)))) - 1;
1406 // The maximum A-MPDU length in HT capabilities elements ranges from 2^13-1 to 2^16-1
1407 capabilities.SetMaxAmpduLength(std::min(std::max(maxAmpduLength, 8191U), 65535U));
1408
1409 capabilities.SetLSigProtectionSupport(true);
1410 uint64_t maxSupportedRate = 0; // in bit/s
1411 for (const auto& mcs : phy->GetMcsList(WIFI_MOD_CLASS_HT))
1412 {
1413 capabilities.SetRxMcsBitmask(mcs.GetMcsValue());
1414 uint8_t nss = (mcs.GetMcsValue() / 8) + 1;
1415 NS_ASSERT(nss > 0 && nss < 5);
1416 uint64_t dataRate = mcs.GetDataRate(phy->GetChannelWidth(), sgiSupported ? 400 : 800, nss);
1417 if (dataRate > maxSupportedRate)
1418 {
1419 maxSupportedRate = dataRate;
1420 NS_LOG_DEBUG("Updating maxSupportedRate to " << maxSupportedRate);
1421 }
1422 }
1423 capabilities.SetRxHighestSupportedDataRate(
1424 static_cast<uint16_t>(maxSupportedRate / 1e6)); // in Mbit/s
1425 capabilities.SetTxMcsSetDefined(phy->GetNMcs() > 0);
1426 capabilities.SetTxMaxNSpatialStreams(phy->GetMaxSupportedTxSpatialStreams());
1427 // we do not support unequal modulations
1428 capabilities.SetTxRxMcsSetUnequal(0);
1429 capabilities.SetTxUnequalModulation(0);
1430
1431 return capabilities;
1432}
1433
1435WifiMac::GetVhtCapabilities(uint8_t linkId) const
1436{
1437 NS_LOG_FUNCTION(this << +linkId);
1438 NS_ASSERT(GetVhtSupported(linkId));
1439 VhtCapabilities capabilities;
1440
1441 auto phy = GetWifiPhy(linkId);
1442 Ptr<HtConfiguration> htConfiguration = GetHtConfiguration();
1443 NS_ABORT_MSG_IF(!htConfiguration->Get40MHzOperationSupported(),
1444 "VHT stations have to support 40 MHz operation");
1445 Ptr<VhtConfiguration> vhtConfiguration = GetVhtConfiguration();
1446 bool sgiSupported = htConfiguration->GetShortGuardIntervalSupported();
1447 capabilities.SetSupportedChannelWidthSet(vhtConfiguration->Get160MHzOperationSupported() ? 1
1448 : 0);
1449 // Set Maximum MPDU Length subfield
1450 uint16_t maxAmsduSize =
1452 if (maxAmsduSize <= 3839)
1453 {
1454 capabilities.SetMaxMpduLength(3895);
1455 }
1456 else if (maxAmsduSize <= 7935)
1457 {
1458 capabilities.SetMaxMpduLength(7991);
1459 }
1460 else
1461 {
1462 capabilities.SetMaxMpduLength(11454);
1463 }
1464 uint32_t maxAmpduLength =
1466 // round to the next power of two minus one
1467 maxAmpduLength = (1UL << static_cast<uint32_t>(std::ceil(std::log2(maxAmpduLength + 1)))) - 1;
1468 // The maximum A-MPDU length in VHT capabilities elements ranges from 2^13-1 to 2^20-1
1469 capabilities.SetMaxAmpduLength(std::min(std::max(maxAmpduLength, 8191U), 1048575U));
1470
1471 capabilities.SetRxLdpc(htConfiguration->GetLdpcSupported());
1472 capabilities.SetShortGuardIntervalFor80Mhz((phy->GetChannelWidth() == 80) && sgiSupported);
1473 capabilities.SetShortGuardIntervalFor160Mhz((phy->GetChannelWidth() == 160) && sgiSupported);
1474 uint8_t maxMcs = 0;
1475 for (const auto& mcs : phy->GetMcsList(WIFI_MOD_CLASS_VHT))
1476 {
1477 if (mcs.GetMcsValue() > maxMcs)
1478 {
1479 maxMcs = mcs.GetMcsValue();
1480 }
1481 }
1482 // Support same MaxMCS for each spatial stream
1483 for (uint8_t nss = 1; nss <= phy->GetMaxSupportedRxSpatialStreams(); nss++)
1484 {
1485 capabilities.SetRxMcsMap(maxMcs, nss);
1486 }
1487 for (uint8_t nss = 1; nss <= phy->GetMaxSupportedTxSpatialStreams(); nss++)
1488 {
1489 capabilities.SetTxMcsMap(maxMcs, nss);
1490 }
1491 uint64_t maxSupportedRateLGI = 0; // in bit/s
1492 for (const auto& mcs : phy->GetMcsList(WIFI_MOD_CLASS_VHT))
1493 {
1494 if (!mcs.IsAllowed(phy->GetChannelWidth(), 1))
1495 {
1496 continue;
1497 }
1498 if (mcs.GetDataRate(phy->GetChannelWidth()) > maxSupportedRateLGI)
1499 {
1500 maxSupportedRateLGI = mcs.GetDataRate(phy->GetChannelWidth());
1501 NS_LOG_DEBUG("Updating maxSupportedRateLGI to " << maxSupportedRateLGI);
1502 }
1503 }
1505 static_cast<uint16_t>(maxSupportedRateLGI / 1e6)); // in Mbit/s
1507 static_cast<uint16_t>(maxSupportedRateLGI / 1e6)); // in Mbit/s
1508 // To be filled in once supported
1509 capabilities.SetRxStbc(0);
1510 capabilities.SetTxStbc(0);
1511
1512 return capabilities;
1513}
1514
1516WifiMac::GetHeCapabilities(uint8_t linkId) const
1517{
1518 NS_LOG_FUNCTION(this << +linkId);
1520 HeCapabilities capabilities;
1521
1522 Ptr<WifiPhy> phy = GetLink(linkId).phy;
1523 Ptr<HtConfiguration> htConfiguration = GetHtConfiguration();
1524 Ptr<HeConfiguration> heConfiguration = GetHeConfiguration();
1525 uint8_t channelWidthSet = 0;
1526 if ((phy->GetChannelWidth() >= 40) && (phy->GetPhyBand() == WIFI_PHY_BAND_2_4GHZ))
1527 {
1528 channelWidthSet |= 0x01;
1529 }
1530 if ((phy->GetChannelWidth() >= 80) &&
1531 ((phy->GetPhyBand() == WIFI_PHY_BAND_5GHZ) || (phy->GetPhyBand() == WIFI_PHY_BAND_6GHZ)))
1532 {
1533 channelWidthSet |= 0x02;
1534 }
1535 if ((phy->GetChannelWidth() >= 160) &&
1536 ((phy->GetPhyBand() == WIFI_PHY_BAND_5GHZ) || (phy->GetPhyBand() == WIFI_PHY_BAND_6GHZ)))
1537 {
1538 channelWidthSet |= 0x04;
1539 }
1540 capabilities.SetChannelWidthSet(channelWidthSet);
1541 capabilities.SetLdpcCodingInPayload(htConfiguration->GetLdpcSupported());
1542 if (heConfiguration->GetGuardInterval() == NanoSeconds(800))
1543 {
1544 // todo: We assume for now that if we support 800ns GI then 1600ns GI is supported as well
1545 // todo: Assuming reception support for both 1x HE LTF and 4x HE LTF 800 ns
1546 capabilities.SetHeSuPpdu1xHeLtf800nsGi(true);
1547 capabilities.SetHePpdu4xHeLtf800nsGi(true);
1548 }
1549
1550 uint32_t maxAmpduLength =
1552 // round to the next power of two minus one
1553 maxAmpduLength = (1UL << static_cast<uint32_t>(std::ceil(std::log2(maxAmpduLength + 1)))) - 1;
1554 // The maximum A-MPDU length in HE capabilities elements ranges from 2^20-1 to 2^23-1
1555 capabilities.SetMaxAmpduLength(std::min(std::max(maxAmpduLength, 1048575U), 8388607U));
1556
1557 uint8_t maxMcs = 0;
1558 for (const auto& mcs : phy->GetMcsList(WIFI_MOD_CLASS_HE))
1559 {
1560 if (mcs.GetMcsValue() > maxMcs)
1561 {
1562 maxMcs = mcs.GetMcsValue();
1563 }
1564 }
1565 capabilities.SetHighestMcsSupported(maxMcs);
1566 capabilities.SetHighestNssSupported(phy->GetMaxSupportedTxSpatialStreams());
1567
1568 return capabilities;
1569}
1570
1572WifiMac::GetEhtCapabilities(uint8_t linkId) const
1573{
1574 NS_LOG_FUNCTION(this << +linkId);
1576 EhtCapabilities capabilities;
1577 // TODO: fill in EHT capabilities
1578 return capabilities;
1579}
1580
1583{
1584 uint32_t maxSize = 0;
1585 switch (ac)
1586 {
1587 case AC_BE:
1588 maxSize = m_beMaxAmpduSize;
1589 break;
1590 case AC_BK:
1591 maxSize = m_bkMaxAmpduSize;
1592 break;
1593 case AC_VI:
1594 maxSize = m_viMaxAmpduSize;
1595 break;
1596 case AC_VO:
1597 maxSize = m_voMaxAmpduSize;
1598 break;
1599 default:
1600 NS_ABORT_MSG("Unknown AC " << ac);
1601 return 0;
1602 }
1603 return maxSize;
1604}
1605
1606uint16_t
1608{
1609 uint16_t maxSize = 0;
1610 switch (ac)
1611 {
1612 case AC_BE:
1613 maxSize = m_beMaxAmsduSize;
1614 break;
1615 case AC_BK:
1616 maxSize = m_bkMaxAmsduSize;
1617 break;
1618 case AC_VI:
1619 maxSize = m_viMaxAmsduSize;
1620 break;
1621 case AC_VO:
1622 maxSize = m_voMaxAmsduSize;
1623 break;
1624 default:
1625 NS_ABORT_MSG("Unknown AC " << ac);
1626 return 0;
1627 }
1628 return maxSize;
1629}
1630
1631} // namespace ns3
#define min(a, b)
Definition: 80211b.c:42
#define max(a, b)
Definition: 80211b.c:43
AttributeValue implementation for Boolean.
Definition: boolean.h:37
The IEEE 802.11be EHT Capabilities.
The Extended Capabilities Information Element.
void SetHtSupported(uint8_t htSupported)
Set the HT Supported flag.
void SetVhtSupported(uint8_t vhtSupported)
Set the VHT Supported flag.
The IEEE 802.11ax HE Capabilities.
void SetHeSuPpdu1xHeLtf800nsGi(bool heSuPpdu1xHeLtf800nsGi)
Set 1xHE-LTF and 800ns GI in HE SU PPDU reception support.
void SetLdpcCodingInPayload(uint8_t ldpcCodingInPayload)
Set indication whether the transmission and reception of LDPC encoded packets is supported.
void SetHePpdu4xHeLtf800nsGi(bool heSuPpdu4xHeLtf800nsGi)
Set 4xHE-LTF and 800ns GI in HE SU PPDU and HE MU PPDU reception support.
void SetHighestNssSupported(uint8_t nss)
Set highest NSS supported.
void SetMaxAmpduLength(uint32_t maxAmpduLength)
Set the maximum AMPDU length.
void SetChannelWidthSet(uint8_t channelWidthSet)
Set channel width set.
void SetHighestMcsSupported(uint8_t mcs)
Set highest MCS supported.
The HT Capabilities Information Element.
void SetLdpc(uint8_t ldpc)
Set the LDPC field.
void SetTxRxMcsSetUnequal(uint8_t txRxMcsSetUnequal)
Set the transmit / receive MCS set unequal.
void SetRxHighestSupportedDataRate(uint16_t maxSupportedRate)
Set the receive highest supported data rate.
void SetLSigProtectionSupport(uint8_t lSigProtection)
Set the LSIG protection support.
void SetMaxAmsduLength(uint16_t maxAmsduLength)
Set the maximum AMSDU length.
void SetTxMaxNSpatialStreams(uint8_t maxTxSpatialStreams)
Set the transmit maximum N spatial streams.
void SetShortGuardInterval20(uint8_t shortGuardInterval)
Set the short guard interval 20 field.
void SetTxUnequalModulation(uint8_t txUnequalModulation)
Set the transmit unequal modulation.
void SetTxMcsSetDefined(uint8_t txMcsSetDefined)
Set the transmit MCS set defined.
void SetRxMcsBitmask(uint8_t index)
Set the receive MCS bitmask.
void SetSupportedChannelWidth(uint8_t supportedChannelWidth)
Set the supported channel width field.
void SetMaxAmpduLength(uint32_t maxAmpduLength)
Set the maximum AMPDU length.
void SetShortGuardInterval40(uint8_t shortGuardInterval)
Set the short guard interval 40 field.
void SendDelbaFrame(Mac48Address addr, uint8_t tid, bool byOriginator)
Sends DELBA frame to cancel a block ack agreement with STA addressed by addr for TID tid.
an EUI-48 address
Definition: mac48-address.h:46
Implement the header for management frames of type Add Block Ack request.
Definition: mgt-headers.h:1476
Implement the header for management frames of type Add Block Ack response.
Definition: mgt-headers.h:1607
uint8_t GetTid() const
Return the Traffic ID (TID).
Implement the header for management frames of type Delete Block Ack.
Definition: mgt-headers.h:1726
uint8_t GetTid() const
Return the Traffic ID (TID).
bool IsByOriginator() const
Check if the initiator bit in the DELBA is set.
A base class which provides memory management and object aggregation.
Definition: object.h:89
void Initialize()
Invoke DoInitialize on all Objects aggregated to this one.
Definition: object.cc:186
void Dispose()
Dispose of this Object.
Definition: object.cc:219
bool IsInitialized() const
Check if the object has been initialized.
Definition: object.cc:212
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Definition: packet.cc:294
Hold objects of type Ptr<T>.
Definition: pointer.h:37
Ptr< BlockAckManager > GetBaManager()
Get the Block Ack Manager associated with this QosTxop.
Definition: qos-txop.cc:255
void SetDroppedMpduCallback(DroppedMpdu callback) override
Definition: qos-txop.cc:159
void GotAddBaResponse(const MgtAddBaResponseHeader *respHdr, Mac48Address recipient)
Event handler when an ADDBA response is received.
Definition: qos-txop.cc:597
void SetBlockAckThreshold(uint8_t threshold)
Set threshold for block ack mechanism.
Definition: qos-txop.cc:652
void GotDelBaFrame(const MgtDelBaHeader *delBaHdr, Mac48Address recipient)
Event handler when a DELBA frame is received.
Definition: qos-txop.cc:633
void SetBlockAckInactivityTimeout(uint16_t timeout)
Set the BlockAck inactivity timeout.
Definition: qos-txop.cc:660
The IEEE 802.11 SSID Information Element.
Definition: ssid.h:36
AttributeValue implementation for Ssid.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
Ptr< WifiMacQueue > GetWifiMacQueue() const
Return the packet queue associated with this Txop.
Definition: txop.cc:220
virtual void SetWifiMac(const Ptr< WifiMac > mac)
Set the wifi MAC this Txop is associated to.
Definition: txop.cc:195
void SetMaxCws(std::vector< uint32_t > maxCws)
Set the maximum contention window size for each link.
Definition: txop.cc:262
void SetTxopLimits(const std::vector< Time > &txopLimits)
Set the TXOP limit for each link.
Definition: txop.cc:382
void SetTxMiddle(const Ptr< MacTxMiddle > txMiddle)
Set MacTxMiddle this Txop is associated to.
Definition: txop.cc:188
void SetMinCws(std::vector< uint32_t > minCws)
Set the minimum contention window size for each link.
Definition: txop.cc:233
virtual void SetDroppedMpduCallback(DroppedMpdu callback)
Definition: txop.cc:209
void SetAifsns(std::vector< uint8_t > aifsns)
Set the number of slots that make up an AIFS for each link.
Definition: txop.cc:359
a unique identifier for an interface.
Definition: type-id.h:60
@ ATTR_GET
The attribute can be read.
Definition: type-id.h:65
@ ATTR_CONSTRUCT
The attribute can be written at construction-time.
Definition: type-id.h:67
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:935
@ OBSOLETE
Attribute or trace source is not used anymore; simulation fails.
Definition: type-id.h:77
Hold an unsigned integer type.
Definition: uinteger.h:45
The IEEE 802.11ac VHT Capabilities.
void SetRxHighestSupportedLgiDataRate(uint16_t supportedDatarate)
Set the receive highest supported LGI data rate.
void SetSupportedChannelWidthSet(uint8_t channelWidthSet)
Set the supported channel width set.
void SetMaxMpduLength(uint16_t length)
Set the maximum MPDU length.
void SetRxLdpc(uint8_t rxLdpc)
Set the receive LDPC.
void SetTxStbc(uint8_t txStbc)
Set the transmit STBC.
void SetTxMcsMap(uint8_t mcs, uint8_t nss)
void SetShortGuardIntervalFor80Mhz(uint8_t shortGuardInterval)
Set the short guard interval 80 MHz.
void SetTxHighestSupportedLgiDataRate(uint16_t supportedDatarate)
Set the transmit highest supported LGI data rate.
void SetShortGuardIntervalFor160Mhz(uint8_t shortGuardInterval)
Set the short guard interval 160 MHz.
void SetMaxAmpduLength(uint32_t maxAmpduLength)
Set the maximum AMPDU length.
void SetRxMcsMap(uint8_t mcs, uint8_t nss)
void SetRxStbc(uint8_t rxStbc)
Set the receive STBC.
bool Get160MHzOperationSupported() const
See IEEE 802.11 chapter 7.3.1.11 Header format: | category: 1 | action value: 1 |.
Definition: mgt-headers.h:1244
CategoryValue GetCategory()
Return the category value.
ActionValue GetAction()
Return the action value.
Implements the IEEE 802.11 MAC header.
Mac48Address GetAddr1() const
Return the address in the Address 1 field.
WifiMacType GetType() const
Return the type (enum WifiMacType)
bool IsMgt() const
Return true if the Type is Management.
bool IsAction() const
Return true if the header is an Action header.
Mac48Address GetAddr2() const
Return the address in the Address 2 field.
uint16_t GetMaxAmsduSize(AcIndex ac) const
Return the maximum A-MSDU size of the given Access Category.
Definition: wifi-mac.cc:1607
Ptr< FrameExchangeManager > GetFrameExchangeManager(uint8_t linkId=SINGLE_LINK_OP_ID) const
Get the Frame Exchange Manager associated with the given link.
Definition: wifi-mac.cc:835
Ptr< QosTxop > GetBEQueue() const
Accessor for the AC_BE channel access function.
Definition: wifi-mac.cc:523
virtual void NotifyChannelSwitching(uint8_t linkId)
Notify that channel on the given link has been switched.
Definition: wifi-mac.cc:555
virtual void SetMacQueueScheduler(Ptr< WifiMacQueueScheduler > scheduler)
Set the wifi MAC queue scheduler.
Definition: wifi-mac.cc:542
Mac48Address GetBssid(uint8_t linkId) const
Definition: wifi-mac.cc:468
uint16_t m_viMaxAmsduSize
maximum A-MSDU size for AC_VI (in bytes)
Definition: wifi-mac.h:794
bool m_shortSlotTimeSupported
flag whether short slot time is supported
Definition: wifi-mac.h:773
void ConfigurePhyDependentParameters(uint8_t linkId)
Configure PHY dependent parameters such as CWmin and CWmax on the given link.
Definition: wifi-mac.cc:770
Ptr< HeConfiguration > GetHeConfiguration() const
Definition: wifi-mac.cc:1250
DroppedMpduTracedCallback m_droppedMpduCallback
This trace indicates that an MPDU was dropped for the given reason.
Definition: wifi-mac.h:860
TypeOfStation GetTypeOfStation() const
Return the type of station.
Definition: wifi-mac.cc:417
bool m_qosSupported
This Boolean is set true iff this WifiMac is to model 802.11e/WMM style Quality of Service.
Definition: wifi-mac.h:771
Ptr< Txop > GetTxop() const
Accessor for the Txop object.
Definition: wifi-mac.cc:483
VhtCapabilities GetVhtCapabilities(uint8_t linkId) const
Return the VHT capabilities of the device for the given link.
Definition: wifi-mac.cc:1435
Callback< void > m_linkDown
Callback when a link is down.
Definition: wifi-mac.h:644
bool GetQosSupported() const
Return whether the device supports QoS.
Definition: wifi-mac.cc:1011
virtual void SetAddress(Mac48Address address)
Definition: wifi-mac.cc:435
Ptr< Txop > m_txop
TXOP used for transmission of frames to non-QoS peers.
Definition: wifi-mac.h:640
void SetQosSupported(bool enable)
Enable or disable QoS support for the device.
Definition: wifi-mac.cc:974
Mac48Address m_address
MAC address of this station.
Definition: wifi-mac.h:781
Ptr< WifiMacQueueScheduler > GetMacQueueScheduler() const
Get the wifi MAC queue scheduler.
Definition: wifi-mac.cc:549
uint8_t GetNLinks() const
Get the number of links (can be greater than 1 for 11be devices only).
Definition: wifi-mac.cc:901
uint16_t m_voMaxAmsduSize
maximum A-MSDU size for AC_VO (in bytes)
Definition: wifi-mac.h:793
Ptr< MacRxMiddle > m_rxMiddle
RX middle (defragmentation etc.)
Definition: wifi-mac.h:638
Ptr< WifiMacQueueScheduler > m_scheduler
wifi MAC queue scheduler
Definition: wifi-mac.h:641
void DoInitialize() override
Initialize() implementation.
Definition: wifi-mac.cc:352
std::vector< std::unique_ptr< LinkEntity > > m_links
vector of Link objects
Definition: wifi-mac.h:779
TypeOfStation m_typeOfStation
the type of station
Definition: wifi-mac.h:776
uint32_t m_beMaxAmpduSize
maximum A-MPDU size for AC_BE (in bytes)
Definition: wifi-mac.h:800
virtual void ConfigureStandard(WifiStandard standard)
Definition: wifi-mac.cc:723
Ssid GetSsid() const
Definition: wifi-mac.cc:455
void SetWifiRemoteStationManagers(const std::vector< Ptr< WifiRemoteStationManager > > &stationManagers)
Definition: wifi-mac.cc:854
void SetBeBlockAckThreshold(uint8_t threshold)
Set the block ack threshold for AC_BE.
Definition: wifi-mac.cc:1307
bool GetErpSupported(uint8_t linkId) const
Return whether the device supports ERP on the given link.
Definition: wifi-mac.cc:1017
bool GetHtSupported() const
Return whether the device supports HT.
Definition: wifi-mac.cc:1262
void ResetWifiPhys()
Remove currently attached WifiPhy objects from this MAC.
Definition: wifi-mac.cc:956
TracedCallback< Ptr< const Packet > > m_macTxTrace
The trace source fired when packets come into the "top" of the device at the L3/L2 transition,...
Definition: wifi-mac.h:811
void SetErpSupported(bool enable, uint8_t linkId)
Enable or disable ERP support for the given link.
Definition: wifi-mac.cc:1023
uint32_t m_voMaxAmpduSize
maximum A-MPDU size for AC_VO (in bytes)
Definition: wifi-mac.h:798
void ConfigureDcf(Ptr< Txop > dcf, uint32_t cwmin, uint32_t cwmax, std::list< bool > isDsss, AcIndex ac)
Definition: wifi-mac.cc:644
Ptr< WifiNetDevice > m_device
Pointer to the device.
Definition: wifi-mac.h:778
void SetSsid(Ssid ssid)
Definition: wifi-mac.cc:448
Ptr< QosTxop > GetVOQueue() const
Accessor for the AC_VO channel access function.
Definition: wifi-mac.cc:511
void SetTypeOfStation(TypeOfStation type)
This method is invoked by a subclass to specify what type of station it is implementing.
Definition: wifi-mac.cc:410
MpduTracedCallback m_ackedMpduCallback
ack'ed MPDU callback
Definition: wifi-mac.h:865
Ptr< WifiPhy > GetWifiPhy(uint8_t linkId=SINGLE_LINK_OP_ID) const
Definition: wifi-mac.cc:949
MpduTracedCallback m_nackedMpduCallback
nack'ed MPDU callback
Definition: wifi-mac.h:866
bool GetEhtSupported() const
Return whether the device supports EHT.
Definition: wifi-mac.cc:1281
bool GetHeSupported() const
Return whether the device supports HE.
Definition: wifi-mac.cc:1275
HtCapabilities GetHtCapabilities(uint8_t linkId) const
Return the HT capabilities of the device for the given link.
Definition: wifi-mac.cc:1378
void SetBkBlockAckThreshold(uint8_t threshold)
Set the block ack threshold for AC_BK.
Definition: wifi-mac.cc:1317
void SetVoBlockAckThreshold(uint8_t threshold)
Set the block ack threshold for AC_VO.
Definition: wifi-mac.cc:1287
virtual std::optional< uint8_t > GetLinkIdByAddress(const Mac48Address &address) const
Get the ID of the link having the given MAC address, if any.
Definition: wifi-mac.cc:907
void NotifyPromiscRx(Ptr< const Packet > packet)
Definition: wifi-mac.cc:588
void SetWifiRemoteStationManager(Ptr< WifiRemoteStationManager > stationManager)
Definition: wifi-mac.cc:847
void SetBeBlockAckInactivityTimeout(uint16_t timeout)
Set BE block ack inactivity timeout.
Definition: wifi-mac.cc:1347
Ptr< EhtConfiguration > GetEhtConfiguration() const
Definition: wifi-mac.cc:1256
TracedCallback< Ptr< const Packet > > m_macRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
Definition: wifi-mac.h:834
bool GetVhtSupported(uint8_t linkId) const
Return whether the device supports VHT on the given link.
Definition: wifi-mac.cc:1268
void SetDsssSupported(bool enable, uint8_t linkId)
Enable or disable DSSS support for the given link.
Definition: wifi-mac.cc:1034
TracedCallback< Ptr< const Packet > > m_macTxDropTrace
The trace source fired when packets coming into the "top" of the device are dropped at the MAC layer ...
Definition: wifi-mac.h:818
Ptr< MacTxMiddle > m_txMiddle
TX middle (aggregation etc.)
Definition: wifi-mac.h:639
void NotifyTx(Ptr< const Packet > packet)
Definition: wifi-mac.cc:570
static TypeId GetTypeId()
Get the type ID.
Definition: wifi-mac.cc:66
Ptr< HtConfiguration > GetHtConfiguration() const
Definition: wifi-mac.cc:1238
uint32_t GetMaxAmpduSize(AcIndex ac) const
Return the maximum A-MPDU size of the given Access Category.
Definition: wifi-mac.cc:1582
Ssid m_ssid
Service Set ID (SSID)
Definition: wifi-mac.h:782
virtual void DeaggregateAmsduAndForward(Ptr< const WifiMpdu > mpdu)
This method can be called to de-aggregate an A-MSDU and forward the constituent packets up the stack.
Definition: wifi-mac.cc:1226
Ptr< QosTxop > GetVIQueue() const
Accessor for the AC_VI channel access function.
Definition: wifi-mac.cc:517
void SetBssid(Mac48Address bssid, uint8_t linkId)
Definition: wifi-mac.cc:461
Ptr< WifiNetDevice > GetDevice() const
Return the device this PHY is associated with.
Definition: wifi-mac.cc:429
Ptr< FrameExchangeManager > SetupFrameExchangeManager(WifiStandard standard)
Create a Frame Exchange Manager depending on the supported version of the standard.
Definition: wifi-mac.cc:788
virtual void Enqueue(Ptr< Packet > packet, Mac48Address to, Mac48Address from)
Definition: wifi-mac.cc:1094
void NotifyRx(Ptr< const Packet > packet)
Definition: wifi-mac.cc:582
TracedCallback< Ptr< const Packet > > m_macRxDropTrace
The trace source fired when packets coming into the "top" of the device are dropped at the MAC layer ...
Definition: wifi-mac.h:841
MpduResponseTimeoutTracedCallback m_mpduResponseTimeoutCallback
MPDU response timeout traced callback.
Definition: wifi-mac.h:887
void SetForwardUpCallback(ForwardUpCallback upCallback)
Definition: wifi-mac.cc:1073
PsduMapResponseTimeoutTracedCallback m_psduMapResponseTimeoutCallback
PSDU map response timeout traced callback.
Definition: wifi-mac.h:931
ExtendedCapabilities GetExtendedCapabilities() const
Return the extended capabilities of the device.
Definition: wifi-mac.cc:1367
TracedCallback< Ptr< const Packet > > m_macPromiscRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
Definition: wifi-mac.h:826
uint16_t m_bkMaxAmsduSize
maximum A-MSDU size for AC_BK (in bytes)
Definition: wifi-mac.h:796
void SetBkBlockAckInactivityTimeout(uint16_t timeout)
Set BK block ack inactivity timeout.
Definition: wifi-mac.cc:1357
virtual bool SupportsSendFrom() const
Definition: wifi-mac.cc:1067
virtual Ptr< WifiMacQueue > GetTxopQueue(AcIndex ac) const
Get the wifi MAC queue of the (Qos)Txop associated with the given AC, if such (Qos)Txop is installed,...
Definition: wifi-mac.cc:535
void SetViBlockAckThreshold(uint8_t threshold)
Set the block ack threshold for AC_VI.
Definition: wifi-mac.cc:1297
void SetViBlockAckInactivityTimeout(uint16_t timeout)
Set VI block ack inactivity timeout.
Definition: wifi-mac.cc:1337
bool GetShortSlotTimeSupported() const
Definition: wifi-mac.cc:1061
void SetupEdcaQueue(AcIndex ac)
This method is a private utility invoked to configure the channel access function for the specified A...
Definition: wifi-mac.cc:600
void SetLinkDownCallback(Callback< void > linkDown)
Definition: wifi-mac.cc:1087
Ptr< QosTxop > GetBKQueue() const
Accessor for the AC_BK channel access function.
Definition: wifi-mac.cc:529
~WifiMac() override
Definition: wifi-mac.cc:60
void SetPromisc()
Sets the interface in promiscuous mode.
Definition: wifi-mac.cc:474
Ptr< VhtConfiguration > GetVhtConfiguration() const
Definition: wifi-mac.cc:1244
void NotifyRxDrop(Ptr< const Packet > packet)
Definition: wifi-mac.cc:594
virtual void SetLinkUpCallback(Callback< void > linkUp)
Definition: wifi-mac.cc:1080
Ptr< WifiRemoteStationManager > GetWifiRemoteStationManager(uint8_t linkId=0) const
Definition: wifi-mac.cc:881
void SetDevice(const Ptr< WifiNetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-mac.cc:423
void SetCtsToSelfSupported(bool enable)
Enable or disable CTS-to-self feature.
Definition: wifi-mac.cc:1047
EdcaQueues m_edca
This is a map from Access Category index to the corresponding channel access function.
Definition: wifi-mac.h:791
uint32_t m_bkMaxAmpduSize
maximum A-MPDU size for AC_BK (in bytes)
Definition: wifi-mac.h:801
void ForwardUp(Ptr< const Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet up to the device.
Definition: wifi-mac.cc:1105
virtual void ConfigureContentionWindow(uint32_t cwMin, uint32_t cwMax)
Definition: wifi-mac.cc:621
virtual void Receive(Ptr< const WifiMpdu > mpdu, uint8_t linkId)
This method acts as the MacRxMiddle receive callback and is invoked to notify us that a frame has bee...
Definition: wifi-mac.cc:1112
Mac48Address GetAddress() const
Definition: wifi-mac.cc:442
TracedCallback< const WifiMacHeader & > m_txErrCallback
transmit error callback
Definition: wifi-mac.h:844
ForwardUpCallback m_forwardUp
Callback to forward packet up the stack.
Definition: wifi-mac.h:803
EhtCapabilities GetEhtCapabilities(uint8_t linkId) const
Return the EHT capabilities of the device for the given link.
Definition: wifi-mac.cc:1572
Callback< void > m_linkUp
Callback when a link is up.
Definition: wifi-mac.h:643
TracedCallback< const WifiMacHeader & > m_txOkCallback
transmit OK callback
Definition: wifi-mac.h:843
LinkEntity & GetLink(uint8_t linkId) const
Get a reference to the link associated with the given ID.
Definition: wifi-mac.cc:893
HeCapabilities GetHeCapabilities(uint8_t linkId) const
Return the HE capabilities of the device for the given link.
Definition: wifi-mac.cc:1516
virtual void SetWifiPhys(const std::vector< Ptr< WifiPhy > > &phys)
Definition: wifi-mac.cc:920
PsduResponseTimeoutTracedCallback m_psduResponseTimeoutCallback
PSDU response timeout traced callback.
Definition: wifi-mac.h:908
Ptr< QosTxop > GetQosTxop(AcIndex ac) const
Accessor for a specified EDCA object.
Definition: wifi-mac.cc:489
void NotifyTxDrop(Ptr< const Packet > packet)
Definition: wifi-mac.cc:576
void DoDispose() override
Destructor implementation.
Definition: wifi-mac.cc:368
bool GetDsssSupported(uint8_t linkId) const
Return whether the device supports DSSS on the given link.
Definition: wifi-mac.cc:1041
Ptr< ChannelAccessManager > GetChannelAccessManager(uint8_t linkId=SINGLE_LINK_OP_ID) const
Get the Channel Access Manager associated with the given link.
Definition: wifi-mac.cc:841
void SetVoBlockAckInactivityTimeout(uint16_t timeout)
Set VO block ack inactivity timeout.
Definition: wifi-mac.cc:1327
virtual std::unique_ptr< LinkEntity > CreateLinkEntity() const
Create a LinkEntity object.
Definition: wifi-mac.cc:887
void SetShortSlotTimeSupported(bool enable)
Enable or disable short slot time feature.
Definition: wifi-mac.cc:1054
bool m_ctsToSelfSupported
flag indicating whether CTS-To-Self is supported
Definition: wifi-mac.h:774
uint16_t m_beMaxAmsduSize
maximum A-MSDU size for AC_BE (in bytes)
Definition: wifi-mac.h:795
uint32_t m_viMaxAmpduSize
maximum A-MPDU size for AC_VI (in bytes)
Definition: wifi-mac.h:799
Ptr< VhtConfiguration > GetVhtConfiguration() const
Ptr< EhtConfiguration > GetEhtConfiguration() const
Ptr< HtConfiguration > GetHtConfiguration() const
Ptr< HeConfiguration > GetHeConfiguration() const
WifiStandard GetStandard() const
Get the configured Wi-Fi standard.
Definition: wifi-phy.cc:956
virtual void SetupPhy(const Ptr< WifiPhy > phy)
Set up PHY associated with this device since it is the object that knows the full set of transmit rat...
#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
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Definition: boolean.h:86
Ptr< const AttributeChecker > MakeBooleanChecker()
Definition: boolean.cc:124
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Definition: pointer.h:230
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Definition: uinteger.h:46
#define NS_ABORT_MSG_UNLESS(cond, msg)
Abnormal program termination if a condition is false, with a message.
Definition: abort.h:144
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:160
#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_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:268
#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.
Definition: object-base.h:45
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1362
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1374
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
WifiStandard
Identifies the IEEE 802.11 specifications that a Wifi device can be configured to use.
AcIndex QosUtilsMapTidToAc(uint8_t tid)
Maps TID (Traffic ID) to Access classes.
Definition: qos-utils.cc:132
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:74
@ WIFI_STANDARD_80211n
@ WIFI_STANDARD_80211g
@ WIFI_STANDARD_80211ax
@ WIFI_STANDARD_UNSPECIFIED
@ WIFI_STANDARD_80211ac
@ WIFI_STANDARD_80211b
@ WIFI_PHY_BAND_6GHZ
The 6 GHz band.
Definition: wifi-phy-band.h:39
@ WIFI_PHY_BAND_2_4GHZ
The 2.4 GHz band.
Definition: wifi-phy-band.h:35
@ WIFI_PHY_BAND_5GHZ
The 5 GHz band.
Definition: wifi-phy-band.h:37
@ WIFI_MOD_CLASS_HT
HT (Clause 19)
@ WIFI_MOD_CLASS_VHT
VHT (Clause 22)
@ WIFI_MOD_CLASS_HE
HE (Clause 27)
@ AC_BE_NQOS
Non-QoS.
Definition: qos-utils.h:84
@ AC_BE
Best Effort.
Definition: qos-utils.h:76
@ AC_VO
Voice.
Definition: qos-utils.h:82
@ AC_VI
Video.
Definition: qos-utils.h:80
@ AC_BK
Background.
Definition: qos-utils.h:78
@ AC_UNDEF
Total number of ACs.
Definition: qos-utils.h:88
@ AC_BEACON
Beacon queue.
Definition: qos-utils.h:86
address
Definition: first.py:40
Every class exported by the ns3 library is enclosed in the ns3 namespace.
U * PeekPointer(const Ptr< U > &p)
Definition: ptr.h:488
TypeOfStation
Enumeration for type of station.
Definition: wifi-mac.h:59
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:691
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
ssid
Definition: third.py:86
phy
Definition: third.py:82
ns3::Time timeout
BlockAckActionValue blockAck
block ack
Definition: mgt-headers.h:1411