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