A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
eht-configuration.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2021 DERONNE SOFTWARE ENGINEERING
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Authors: Sébastien Deronne <sebastien.deronne@gmail.com>
7 * Stefano Avallone <stavallo@unina.it>
8 */
9
10#include "eht-configuration.h"
11
12#include "ns3/attribute-container.h"
13#include "ns3/boolean.h"
14#include "ns3/enum.h"
15#include "ns3/integer.h"
16#include "ns3/log.h"
17#include "ns3/pair.h"
18#include "ns3/string.h"
19#include "ns3/uinteger.h"
20
21namespace ns3
22{
23
24NS_LOG_COMPONENT_DEFINE("EhtConfiguration");
25
26NS_OBJECT_ENSURE_REGISTERED(EhtConfiguration);
27
28std::ostream&
29operator<<(std::ostream& os, WifiTidToLinkMappingNegSupport negsupport)
30{
31 switch (negsupport)
32 {
34 return os << "NOT_SUPPORTED";
36 return os << "SAME_LINK_SET";
38 return os << "ANY_LINK_SET";
39 };
40 return os << "UNKNOWN(" << static_cast<uint32_t>(negsupport) << ")";
41}
42
47
52
55{
56 using TidLinkMapValue =
58
59 static ns3::TypeId tid =
60 ns3::TypeId("ns3::EhtConfiguration")
62 .SetGroupName("Wifi")
63 .AddConstructor<EhtConfiguration>()
64 .AddAttribute("EmlsrActivated",
65 "Whether EMLSR option is activated. If activated, EMLSR mode can be "
66 "enabled on the EMLSR links by an installed EMLSR Manager.",
68 TypeId::ATTR_CONSTRUCT, // prevent setting after construction
69 BooleanValue(false),
72 .AddAttribute("TransitionTimeout",
73 "The Transition Timeout (not used by non-AP MLDs). "
74 "Possible values are 0us or 2^n us, with n=7..16.",
78 .AddAttribute(
79 "MediumSyncDuration",
80 "The duration of the MediumSyncDelay timer (must be a multiple of 32 us). "
81 "The value of this attribute is only used by AP MLDs with EMLSR activated.",
85 .AddAttribute(
86 "MsdOfdmEdThreshold",
87 "Threshold (dBm) to be used instead of the normal CCA sensitivity for the primary "
88 "20 MHz channel if the MediumSyncDelay timer has a nonzero value. "
89 "The value of this attribute is only used by AP MLDs with EMLSR activated.",
93 .AddAttribute(
94 "MsdMaxNTxops",
95 "Maximum number of TXOPs that an EMLSR client is allowed to attempt to initiate "
96 "while the MediumSyncDelay timer is running (zero indicates no limit). "
97 "The value of this attribute is only used by AP MLDs with EMLSR activated.",
101 .AddAttribute("TidToLinkMappingNegSupport",
102 "TID-to-Link Mapping Negotiation Support.",
107 "NOT_SUPPORTED",
109 "SAME_LINK_SET",
111 "ANY_LINK_SET"))
112 .AddAttribute(
113 "TidToLinkMappingDl",
114 "A list-of-TIDs-indexed map of the list of links where the TIDs are mapped to "
115 "for the downlink direction. "
116 "In case a string is used to set this attribute, the string shall contain the "
117 "(TID list, link list) pairs separated by a semicolon (;); in every pair, the "
118 "TID list and the link list are separated by a blank space, and the elements of "
119 "each list are separated by a comma (,) without spaces. "
120 "E.g., \"0,4 1,2,3; 1 0;2 0,1\" means that TIDs 0 and 4 are mapped on links "
121 "1, 2 and 3; TID 1 is mapped on link 0 and TID 2 is mapped on links 0 and 1. "
122 "An empty map indicates the default mapping, i.e., all TIDs are mapped to all "
123 "setup links. If the map contains the mapping for some TID(s), the mapping "
124 "corresponding to the missing TID(s) remains unchanged. "
125 "A non-AP MLD includes this mapping in the Association Request frame sent to "
126 "an AP MLD, unless the AP MLD advertises a negotiation support of 1 and this "
127 "mapping is such that TIDs are mapped to distinct link sets, in which case "
128 "the default mapping is included.",
129 StringValue(""),
139 .AddAttribute(
140 "TidToLinkMappingUl",
141 "A list-of-TIDs-indexed map of the list of links where the TIDs are mapped to "
142 "for the uplink direction. "
143 "In case a string is used to set this attribute, the string shall contain the "
144 "(TID list, link list) pairs separated by a semicolon (;); in every pair, the "
145 "TID list and the link list are separated by a blank space, and the elements of "
146 "each list are separated by a comma (,) without spaces. "
147 "E.g., \"0,4 1,2,3; 1 0;2 0,1\" means that TIDs 0 and 4 are mapped on links "
148 "1, 2 and 3; TID 1 is mapped on link 0 and TID 2 is mapped on links 0 and 1. "
149 "An empty map indicates the default mapping, i.e., all TIDs are mapped to all "
150 "setup links. If the map contains the mapping for some TID(s), the mapping "
151 "corresponding to the missing TID(s) remains unchanged. "
152 "A non-AP MLD includes this mapping in the Association Request frame sent to "
153 "an AP MLD, unless the AP MLD advertises a negotiation support of 1 and this "
154 "mapping is such that TIDs are mapped to distinct link sets, in which case "
155 "the default mapping is included.",
156 StringValue(""),
166 return tid;
167}
168
171{
174 const auto& linkMapping = (dir == WifiDirection::DOWNLINK ? m_linkMappingDl : m_linkMappingUl);
175
176 for (const auto& [tids, links] : linkMapping)
177 {
178 for (auto tid : tids)
179 {
180 ret[tid] = std::set<uint8_t>(links.cbegin(), links.cend());
181 }
182 }
183 return ret;
184}
185
186void
188 const std::map<std::list<uint8_t>, std::list<uint8_t>>& mapping)
189{
191 auto& linkMapping = (dir == WifiDirection::DOWNLINK ? m_linkMappingDl : m_linkMappingUl);
192 linkMapping.clear();
193 for (const auto& [tids, links] : mapping)
194 {
195 linkMapping.emplace(std::list<uint64_t>(tids.cbegin(), tids.cend()),
196 std::list<uint64_t>(links.cbegin(), links.cend()));
197 }
198}
199
200} // namespace ns3
A container for one type of attribute.
EHT configuration.
static TypeId GetTypeId()
Get the type ID.
Time m_mediumSyncDuration
duration of the MediumSyncDelay timer
bool m_emlsrActivated
whether EMLSR option is activated
WifiTidLinkMapping GetTidLinkMapping(WifiDirection dir) const
Time m_transitionTimeout
Transition timeout.
std::map< std::list< uint64_t >, std::list< uint64_t > > m_linkMappingDl
TIDs-indexed Link Mapping for downlink.
void SetTidLinkMapping(WifiDirection dir, const std::map< std::list< uint8_t >, std::list< uint8_t > > &mapping)
Set the TID-to-Link mapping for the given direction.
WifiTidToLinkMappingNegSupport m_tidLinkMappingSupport
TID-to-Link Mapping Negotiation Support.
uint8_t m_msdMaxNTxops
MediumSyncDelay max number of TXOPs.
std::map< std::list< uint64_t >, std::list< uint64_t > > m_linkMappingUl
TIDs-indexed Link Mapping for uplink.
int8_t m_msdOfdmEdThreshold
MediumSyncDelay OFDM ED threshold.
Hold variables of type enum.
Definition enum.h:52
Hold a signed integer type.
Definition integer.h:34
A base class which provides memory management and object aggregation.
Definition object.h:78
AttributeValue implementation for Pair.
Definition pair.h:54
Hold variables of type string.
Definition string.h:45
a unique identifier for an interface.
Definition type-id.h:48
@ ATTR_GET
The attribute can be read.
Definition type-id.h:53
@ ATTR_CONSTRUCT
The attribute can be written at construction-time.
Definition type-id.h:55
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
Hold an unsigned integer type.
Definition uinteger.h:34
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition assert.h:55
Ptr< AttributeChecker > MakeAttributeContainerChecker()
Make uninitialized AttributeContainerChecker using explicit types.
Ptr< const AttributeAccessor > MakeAttributeContainerAccessor(T1 a1)
Make AttributeContainerAccessor using explicit types.
Ptr< AttributeChecker > MakePairChecker()
Make a PairChecker without abscissa and ordinate AttributeCheckers.
Definition pair.h:287
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#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:35
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition nstime.h:1332
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeBooleanChecker()
Definition boolean.cc:113
Ptr< const AttributeChecker > MakeIntegerChecker()
Definition integer.h:99
Ptr< const AttributeAccessor > MakeIntegerAccessor(T1 a1)
Definition integer.h:35
Ptr< const AttributeChecker > MakeUintegerChecker()
Definition uinteger.h:85
static constexpr uint8_t DEFAULT_MSD_MAX_N_TXOPS
default MediumSyncDelay max number of TXOP attempts
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Definition nstime.h:1396
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Definition uinteger.h:35
WifiTidToLinkMappingNegSupport
TID-to-Link Mapping Negotiation Support.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition angles.cc:148
Ptr< const AttributeChecker > MakeEnumChecker(T v, std::string n, Ts... args)
Make an EnumChecker pre-configured with a set of allowed values by name.
Definition enum.h:179
std::map< uint8_t, std::set< uint8_t > > WifiTidLinkMapping
TID-indexed map of the link set to which the TID is mapped.
Definition wifi-utils.h:65
WifiDirection
Wifi direction.
Definition wifi-utils.h:34
static constexpr int8_t DEFAULT_MSD_OFDM_ED_THRESH
default MediumSyncDelay timer OFDM ED threshold
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Definition boolean.h:70
static constexpr uint16_t DEFAULT_MSD_DURATION_USEC
default MediumSyncDelay timer duration (max PPDU TX time rounded to a multiple of 32 us)
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
Definition enum.h:221
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.
Definition nstime.h:1416
std::string dir