A Discrete-Event Network Simulator
API
he-capabilities.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016
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: Sébastien Deronne <sebastien.deronne@gmail.com>
18  */
19 
20 #include "he-capabilities.h"
21 
22 #include <algorithm>
23 
24 namespace ns3
25 {
26 
28  : m_plusHtcHeSupport(0),
29  m_twtRequesterSupport(0),
30  m_twtResponderSupport(0),
31  m_fragmentationSupport(0),
32  m_maximumNumberOfFragmentedMsdus(0),
33  m_minimumFragmentSize(0),
34  m_triggerFrameMacPaddingDuration(0),
35  m_multiTidAggregationRxSupport(0),
36  m_heLinkAdaptation(0),
37  m_allAckSupport(0),
38  m_trsSupport(0),
39  m_bsrSupport(0),
40  m_broadcastTwtSupport(0),
41  m_32bitBaBitmapSupport(0),
42  m_muCascadeSupport(0),
43  m_ackEnabledAggregationSupport(0),
44  m_omControlSupport(0),
45  m_ofdmaRaSupport(0),
46  m_maxAmpduLengthExponent(0),
47  m_amsduFragmentationSupport(0),
48  m_flexibleTwtScheduleSupport(0),
49  m_rxControlFrameToMultiBss(0),
50  m_bsrpBqrpAmpduAggregation(0),
51  m_qtpSupport(0),
52  m_bqrSupport(0),
53  m_psrResponder(0),
54  m_ndpFeedbackReportSupport(0),
55  m_opsSupport(0),
56  m_amsduNotUnderBaInAmpduSupport(0),
57  m_multiTidAggregationTxSupport(0),
58  m_heSubchannelSelectiveTxSupport(0),
59  m_ul2x996ToneRuSupport(0),
60  m_omControlUlMuDataDisableRxSupport(0),
61  m_heDynamicSmPowerSave(0),
62  m_puncturedSoundingSupport(0),
63  m_heVhtTriggerFrameRxSupport(0),
64  m_channelWidthSet(0),
65  m_puncturedPreambleRx(0),
66  m_deviceClass(0),
67  m_ldpcCodingInPayload(0),
68  m_heSuPpdu1xHeLtf800nsGi(0),
69  m_midambleRxMaxNsts(0),
70  m_ndp4xHeLtfAnd32msGi(0),
71  m_stbcTxLeq80MHz(0),
72  m_stbcRxLeq80MHz(0),
73  m_dopplerTx(0),
74  m_dopplerRx(0),
75  m_fullBwUlMuMimo(0),
76  m_partialBwUlMuMimo(0),
77  m_dcmMaxConstellationTx(0),
78  m_dcmMaxNssTx(0),
79  m_dcmMaxConstellationRx(0),
80  m_dcmMaxNssRx(0),
81  m_rxPartialBwSuInHeMu(0),
82  m_suBeamformer(0),
83  m_suBeamformee(0),
84  m_muBeamformer(0),
85  m_beamformeeStsForSmallerOrEqualThan80Mhz(0),
86  m_beamformeeStsForLargerThan80Mhz(0),
87  m_numberOfSoundingDimensionsForSmallerOrEqualThan80Mhz(0),
88  m_numberOfSoundingDimensionsForLargerThan80Mhz(0),
89  m_ngEqual16ForSuFeedbackSupport(0),
90  m_ngEqual16ForMuFeedbackSupport(0),
91  m_codebookSize42SuFeedback(0),
92  m_codebookSize75MuFeedback(0),
93  m_triggeredSuBfFeedback(0),
94  m_triggeredMuBfFeedback(0),
95  m_triggeredCqiFeedback(0),
96  m_erPartialBandwidth(0),
97  m_dlMuMimoOnPartialBandwidth(0),
98  m_ppeThresholdPresent(0),
99  m_psrBasedSrSupport(0),
100  m_powerBoostFactorAlphaSupport(0),
101  m_hePpdu4xHeLtf800nsGi(0),
102  m_maxNc(0),
103  m_stbcTxGt80MHz(0),
104  m_stbcRxGt80MHz(0),
105  m_heErSuPpdu4xHeLtf08sGi(0),
106  m_hePpdu20MHzIn40MHz24GHz(0),
107  m_hePpdu20MHzIn160MHz(0),
108  m_hePpdu80MHzIn160MHz(0),
109  m_heErSuPpdu1xHeLtf08Gi(0),
110  m_midamble2xAnd1xHeLtf(0),
111  m_dcmMaxRu(0),
112  m_longerThan16HeSigbOfdm(0),
113  m_nonTriggeredCqiFeedback(0),
114  m_tx1024QamLt242Ru(0),
115  m_rx1024QamLt242Ru(0),
116  m_rxFullBwSuInHeMuCompressedSigB(0),
117  m_rxFullBwSuInHeMuNonCompressedSigB(0),
118  m_nominalPacketPadding(0),
119  m_maxHeLtfRxInHeMuMoreThanOneRu(0),
120  m_highestNssSupportedM1(0),
121  m_highestMcsSupported(0)
122 {
123  m_txBwMap.resize(8, 0);
124  m_rxBwMap.resize(8, 0);
125 }
126 
129 {
130  return IE_EXTENSION;
131 }
132 
135 {
136  return IE_EXT_HE_CAPABILITIES;
137 }
138 
139 void
140 HeCapabilities::Print(std::ostream& os) const
141 {
142  os << "HE Capabilities=" << GetHeMacCapabilitiesInfo1() << "|" << +GetHeMacCapabilitiesInfo2()
143  << "|" << GetHePhyCapabilitiesInfo1() << "|" << GetHePhyCapabilitiesInfo2() << "|"
145 }
146 
147 uint16_t
149 {
150  // IEEE 802.11ax-2021 9.4.2.248 HE Capabilities element
151  // Element ID Extension (1) + HE MAC Capabilities Information (6)
152  // + HE PHY Capabilities Information (11) + Supported HE-MCS And NSS Set (4)
153  // TODO: Supported HE-MCS And NSS Set field has variable length (4, 8 or 12)
154  // TODO: PPE Thresholds field (optional) is not implemented
155  return 22;
156 }
157 
158 void
160 {
161  // write the corresponding value for each bit
162  start.WriteHtolsbU32(GetHeMacCapabilitiesInfo1());
163  start.WriteHtolsbU16(GetHeMacCapabilitiesInfo2());
164  start.WriteHtolsbU64(GetHePhyCapabilitiesInfo1());
165  start.WriteHtolsbU16(GetHePhyCapabilitiesInfo2());
166  start.WriteU8(GetHePhyCapabilitiesInfo3());
167  start.WriteHtolsbU32(GetSupportedMcsAndNss());
168  // TODO: add another 32-bits field if 160 MHz channel is supported (variable length)
169  // TODO: optional PPE Threshold field (variable length)
170 }
171 
172 uint16_t
174 {
176  uint32_t macCapabilities1 = i.ReadLsbtohU32();
177  uint16_t macCapabilities2 = i.ReadLsbtohU16();
178  uint64_t phyCapabilities1 = i.ReadLsbtohU64();
179  uint64_t phyCapabilities2 = i.ReadLsbtohU16();
180  uint8_t phyCapabilities3 = i.ReadU8();
181  uint32_t mcsset = i.ReadU32();
182  SetHeMacCapabilitiesInfo(macCapabilities1, macCapabilities2);
183  SetHePhyCapabilitiesInfo(phyCapabilities1, phyCapabilities2, phyCapabilities3);
184  SetSupportedMcsAndNss(mcsset);
185  // TODO: add another 32-bits field if 160 MHz channel is supported (variable length)
186  // TODO: optional PPE Threshold field (variable length)
187  return length;
188 }
189 
190 void
191 HeCapabilities::SetHeMacCapabilitiesInfo(uint32_t ctrl1, uint16_t ctrl2)
192 {
193  m_plusHtcHeSupport = ctrl1 & 0x01;
194  m_twtRequesterSupport = (ctrl1 >> 1) & 0x01;
195  m_twtResponderSupport = (ctrl1 >> 2) & 0x01;
196  m_fragmentationSupport = (ctrl1 >> 3) & 0x03;
197  m_maximumNumberOfFragmentedMsdus = (ctrl1 >> 5) & 0x07;
198  m_minimumFragmentSize = (ctrl1 >> 8) & 0x03;
199  m_triggerFrameMacPaddingDuration = (ctrl1 >> 10) & 0x03;
200  m_multiTidAggregationRxSupport = (ctrl1 >> 12) & 0x07;
201  m_heLinkAdaptation = (ctrl1 >> 15) & 0x03;
202  m_allAckSupport = (ctrl1 >> 17) & 0x01;
203  m_trsSupport = (ctrl1 >> 18) & 0x01;
204  m_bsrSupport = (ctrl1 >> 19) & 0x01;
205  m_broadcastTwtSupport = (ctrl1 >> 20) & 0x01;
206  m_32bitBaBitmapSupport = (ctrl1 >> 21) & 0x01;
207  m_muCascadeSupport = (ctrl1 >> 22) & 0x01;
208  m_ackEnabledAggregationSupport = (ctrl1 >> 23) & 0x01;
209  // IEEE 802.11ax-2021 9.4.2.248.2 HE MAC Capabilities
210  // Bit 24 is reserved
211  m_omControlSupport = (ctrl1 >> 25) & 0x01;
212  m_ofdmaRaSupport = (ctrl1 >> 26) & 0x01;
213  m_maxAmpduLengthExponent = (ctrl1 >> 27) & 0x03;
214  m_amsduFragmentationSupport = (ctrl1 >> 29) & 0x01;
215  m_flexibleTwtScheduleSupport = (ctrl1 >> 30) & 0x01;
216  m_rxControlFrameToMultiBss = (ctrl1 >> 31) & 0x01;
217  m_bsrpBqrpAmpduAggregation = ctrl2 & 0x01;
218  m_qtpSupport = (ctrl2 >> 1) & 0x01;
219  m_bqrSupport = (ctrl2 >> 2) & 0x01;
220  m_psrResponder = (ctrl2 >> 3) & 0x01;
221  m_ndpFeedbackReportSupport = (ctrl2 >> 4) & 0x01;
222  m_opsSupport = (ctrl2 >> 5) & 0x01;
223  m_amsduNotUnderBaInAmpduSupport = (ctrl2 >> 6) & 0x01;
224  m_multiTidAggregationTxSupport = (ctrl2 >> 7) & 0x07;
225  m_heSubchannelSelectiveTxSupport = (ctrl2 >> 10) & 0x01;
226  m_ul2x996ToneRuSupport = (ctrl2 >> 11) & 0x01;
227  m_omControlUlMuDataDisableRxSupport = (ctrl2 >> 12) & 0x01;
228  m_heDynamicSmPowerSave = (ctrl2 >> 13) & 0x01;
229  m_puncturedSoundingSupport = (ctrl2 >> 14) & 0x01;
230  m_heVhtTriggerFrameRxSupport = (ctrl2 >> 15) & 0x01;
231 }
232 
233 uint32_t
235 {
236  uint32_t val = 0;
237  val |= m_plusHtcHeSupport & 0x01;
238  val |= (m_twtRequesterSupport & 0x01) << 1;
239  val |= (m_twtResponderSupport & 0x01) << 2;
240  val |= (m_fragmentationSupport & 0x03) << 3;
241  val |= (m_maximumNumberOfFragmentedMsdus & 0x07) << 5;
242  val |= (m_minimumFragmentSize & 0x03) << 8;
243  val |= (m_triggerFrameMacPaddingDuration & 0x03) << 10;
244  val |= (m_multiTidAggregationRxSupport & 0x07) << 12;
245  val |= (m_heLinkAdaptation & 0x03) << 15;
246  val |= (m_allAckSupport & 0x01) << 17;
247  val |= (m_trsSupport & 0x01) << 18;
248  val |= (m_bsrSupport & 0x01) << 19;
249  val |= (m_broadcastTwtSupport & 0x01) << 20;
250  val |= (m_32bitBaBitmapSupport & 0x01) << 21;
251  val |= (m_muCascadeSupport & 0x01) << 22;
252  val |= (m_ackEnabledAggregationSupport & 0x01) << 23;
253  // IEEE 802.11ax-2021 9.4.2.248.2 HE MAC Capabilities
254  // Bit 24 is reserved
255  val |= (m_omControlSupport & 0x01) << 25;
256  val |= (m_ofdmaRaSupport & 0x01) << 26;
257  val |= (m_maxAmpduLengthExponent & 0x03) << 27;
258  val |= (m_amsduFragmentationSupport & 0x01) << 29;
259  val |= (m_flexibleTwtScheduleSupport & 0x01) << 30;
260  val |= (m_rxControlFrameToMultiBss & 0x01) << 31;
261  return val;
262 }
263 
264 uint16_t
266 {
267  uint16_t val = 0;
268  val |= m_bsrpBqrpAmpduAggregation & 0x01;
269  val |= (m_qtpSupport & 0x01) << 1;
270  val |= (m_bqrSupport & 0x01) << 2;
271  val |= (m_psrResponder & 0x01) << 3;
272  val |= (m_ndpFeedbackReportSupport & 0x01) << 4;
273  val |= (m_opsSupport & 0x01) << 5;
274  val |= (m_amsduNotUnderBaInAmpduSupport & 0x01) << 6;
275  val |= (m_multiTidAggregationTxSupport & 0x07) << 7;
276  val |= (m_heSubchannelSelectiveTxSupport & 0x01) << 10;
277  val |= (m_ul2x996ToneRuSupport & 0x01) << 11;
278  val |= (m_omControlUlMuDataDisableRxSupport & 0x01) << 12;
279  val |= (m_heDynamicSmPowerSave & 0x01) << 13;
280  val |= (m_puncturedSoundingSupport & 0x01) << 14;
281  val |= (m_heVhtTriggerFrameRxSupport & 0x01) << 15;
282  return val;
283 }
284 
285 void
286 HeCapabilities::SetHePhyCapabilitiesInfo(uint64_t ctrl1, uint16_t ctrl2, uint8_t ctrl3)
287 {
288  // IEEE 802.11ax-2021 9.4.2.248.2 HE MAC Capabilities
289  // Bit 0 is reserved
290  m_channelWidthSet = (ctrl1 >> 1) & 0x7f;
291  m_puncturedPreambleRx = (ctrl1 >> 8) & 0x0f;
292  m_deviceClass = (ctrl1 >> 12) & 0x01;
293  m_ldpcCodingInPayload = (ctrl1 >> 13) & 0x01;
294  m_heSuPpdu1xHeLtf800nsGi = (ctrl1 >> 14) & 0x01;
295  m_midambleRxMaxNsts = (ctrl1 >> 15) & 0x03;
296  m_ndp4xHeLtfAnd32msGi = (ctrl1 >> 17) & 0x01;
297  m_stbcTxLeq80MHz = (ctrl1 >> 18) & 0x01;
298  m_stbcRxLeq80MHz = (ctrl1 >> 19) & 0x01;
299  m_dopplerTx = (ctrl1 >> 20) & 0x01;
300  m_dopplerRx = (ctrl1 >> 21) & 0x01;
301  m_fullBwUlMuMimo = (ctrl1 >> 22) & 0x01;
302  m_partialBwUlMuMimo = (ctrl1 >> 23) & 0x01;
303  m_dcmMaxConstellationTx = (ctrl1 >> 24) & 0x03;
304  m_dcmMaxNssTx = (ctrl1 >> 26) & 0x01;
305  m_dcmMaxConstellationRx = (ctrl1 >> 27) & 0x03;
306  m_dcmMaxNssRx = (ctrl1 >> 29) & 0x01;
307  m_rxPartialBwSuInHeMu = (ctrl1 >> 30) & 0x01;
308  m_suBeamformer = (ctrl1 >> 31) & 0x01;
309  m_suBeamformee = (ctrl1 >> 32) & 0x01;
310  m_muBeamformer = (ctrl1 >> 33) & 0x01;
311  m_beamformeeStsForSmallerOrEqualThan80Mhz = (ctrl1 >> 34) & 0x07;
312  m_beamformeeStsForLargerThan80Mhz = (ctrl1 >> 37) & 0x07;
314  m_numberOfSoundingDimensionsForLargerThan80Mhz = (ctrl1 >> 43) & 0x07;
315  m_ngEqual16ForSuFeedbackSupport = (ctrl1 >> 46) & 0x01;
316  m_ngEqual16ForMuFeedbackSupport = (ctrl1 >> 47) & 0x01;
317  m_codebookSize42SuFeedback = (ctrl1 >> 48) & 0x01;
318  m_codebookSize75MuFeedback = (ctrl1 >> 49) & 0x01;
319  m_triggeredSuBfFeedback = (ctrl1 >> 50) & 0x01;
320  m_triggeredMuBfFeedback = (ctrl1 >> 51) & 0x01;
321  m_triggeredCqiFeedback = (ctrl1 >> 52) & 0x01;
322  m_erPartialBandwidth = (ctrl1 >> 53) & 0x01;
323  m_dlMuMimoOnPartialBandwidth = (ctrl1 >> 54) & 0x01;
324  m_ppeThresholdPresent = (ctrl1 >> 55) & 0x01;
325  m_psrBasedSrSupport = (ctrl1 >> 56) & 0x01;
326  m_powerBoostFactorAlphaSupport = (ctrl1 >> 57) & 0x01;
327  m_hePpdu4xHeLtf800nsGi = ctrl2 & 0x01;
328  m_maxNc = (ctrl1 >> 59) & 0x07;
329  m_stbcTxGt80MHz = (ctrl1 >> 62) & 0x01;
330  m_stbcRxGt80MHz = (ctrl1 >> 63) & 0x01;
331  m_heErSuPpdu4xHeLtf08sGi = ctrl2 & 0x01;
332  m_hePpdu20MHzIn40MHz24GHz = (ctrl2 >> 1) & 0x01;
333  m_hePpdu20MHzIn160MHz = (ctrl2 >> 2) & 0x01;
334  m_hePpdu80MHzIn160MHz = (ctrl2 >> 3) & 0x01;
335  m_heErSuPpdu1xHeLtf08Gi = (ctrl2 >> 4) & 0x01;
336  m_midamble2xAnd1xHeLtf = (ctrl2 >> 5) & 0x01;
337  m_dcmMaxRu = (ctrl2 >> 6) & 0x03;
338  m_longerThan16HeSigbOfdm = (ctrl2 >> 8) & 0x01;
339  m_nonTriggeredCqiFeedback = (ctrl2 >> 9) & 0x01;
340  m_tx1024QamLt242Ru = (ctrl2 >> 10) & 0x01;
341  m_rx1024QamLt242Ru = (ctrl2 >> 11) & 0x01;
342  m_rxFullBwSuInHeMuCompressedSigB = (ctrl2 >> 12) & 0x01;
343  m_rxFullBwSuInHeMuNonCompressedSigB = (ctrl2 >> 13) & 0x01;
344  m_nominalPacketPadding = (ctrl2 >> 14) & 0x03;
345  m_maxHeLtfRxInHeMuMoreThanOneRu = ctrl3 & 0x01;
346  // IEEE 802.11ax-2021 9.4.2.248.2 HE MAC Capabilities
347  // Bits 81-87 are reserved
348 }
349 
350 uint64_t
352 {
353  uint64_t val = 0;
354  // IEEE 802.11ax-2021 9.4.2.248.2 HE MAC Capabilities
355  // Bit 0 is reserved
356  val |= (m_channelWidthSet & 0x7f) << 1;
357  val |= (m_puncturedPreambleRx & 0x0f) << 8;
358  val |= (m_deviceClass & 0x01) << 12;
359  val |= (m_ldpcCodingInPayload & 0x01) << 13;
360  val |= (m_heSuPpdu1xHeLtf800nsGi & 0x01) << 14;
361  val |= (m_midambleRxMaxNsts & 0x03) << 15;
362  val |= (m_ndp4xHeLtfAnd32msGi & 0x01) << 17;
363  val |= (m_stbcTxLeq80MHz & 0x01) << 18;
364  val |= (m_stbcRxLeq80MHz & 0x01) << 19;
365  val |= (m_dopplerTx & 0x01) << 20;
366  val |= (m_dopplerRx & 0x01) << 21;
367  val |= (m_fullBwUlMuMimo & 0x01) << 22;
368  val |= (m_partialBwUlMuMimo & 0x01) << 23;
369  val |= (m_dcmMaxConstellationTx & 0x03) << 24;
370  val |= (m_dcmMaxNssTx & 0x01) << 26;
371  val |= (m_dcmMaxConstellationRx & 0x03) << 27;
372  val |= (m_dcmMaxNssRx & 0x01) << 29;
373  val |= (m_rxPartialBwSuInHeMu & 0x01) << 30;
374  val |= (m_suBeamformer & 0x01) << 31;
375  val |= (static_cast<uint64_t>(m_suBeamformee) & 0x01) << 32;
376  val |= (static_cast<uint64_t>(m_muBeamformer) & 0x01) << 33;
377  val |= (static_cast<uint64_t>(m_beamformeeStsForSmallerOrEqualThan80Mhz) & 0x07) << 34;
378  val |= (static_cast<uint64_t>(m_beamformeeStsForLargerThan80Mhz) & 0x07) << 37;
379  val |= (static_cast<uint64_t>(m_numberOfSoundingDimensionsForSmallerOrEqualThan80Mhz) & 0x07)
380  << 40;
381  val |= (static_cast<uint64_t>(m_numberOfSoundingDimensionsForLargerThan80Mhz) & 0x07) << 43;
382  val |= (static_cast<uint64_t>(m_ngEqual16ForSuFeedbackSupport) & 0x01) << 46;
383  val |= (static_cast<uint64_t>(m_ngEqual16ForMuFeedbackSupport) & 0x01) << 47;
384  val |= (static_cast<uint64_t>(m_codebookSize42SuFeedback) & 0x01) << 48;
385  val |= (static_cast<uint64_t>(m_codebookSize75MuFeedback) & 0x01) << 49;
386  val |= (static_cast<uint64_t>(m_triggeredSuBfFeedback) & 0x01) << 50;
387  val |= (static_cast<uint64_t>(m_triggeredMuBfFeedback) & 0x01) << 51;
388  val |= (static_cast<uint64_t>(m_triggeredCqiFeedback) & 0x01) << 52;
389  val |= (static_cast<uint64_t>(m_erPartialBandwidth) & 0x01) << 53;
390  val |= (static_cast<uint64_t>(m_dlMuMimoOnPartialBandwidth) & 0x01) << 54;
391  val |= (static_cast<uint64_t>(m_ppeThresholdPresent) & 0x01) << 55;
392  val |= (static_cast<uint64_t>(m_psrBasedSrSupport) & 0x01) << 56;
393  val |= (static_cast<uint64_t>(m_powerBoostFactorAlphaSupport) & 0x01) << 57;
394  val |= (static_cast<uint64_t>(m_hePpdu4xHeLtf800nsGi) & 0x01) << 58;
395  val |= (static_cast<uint64_t>(m_maxNc) & 0x07) << 59;
396  val |= (static_cast<uint64_t>(m_stbcTxGt80MHz) & 0x01) << 62;
397  val |= (static_cast<uint64_t>(m_stbcRxGt80MHz) & 0x01) << 63;
398  return val;
399 }
400 
401 uint16_t
403 {
404  uint16_t val = 0;
405  val |= m_heErSuPpdu4xHeLtf08sGi & 0x01;
406  val |= (m_hePpdu20MHzIn40MHz24GHz & 0x01) << 1;
407  val |= (m_hePpdu20MHzIn160MHz & 0x01) << 2;
408  val |= (m_hePpdu80MHzIn160MHz & 0x01) << 3;
409  val |= (m_heErSuPpdu1xHeLtf08Gi & 0x01) << 4;
410  val |= (m_midamble2xAnd1xHeLtf & 0x01) << 5;
411  val |= (m_dcmMaxRu & 0x03) << 6;
412  val |= (m_longerThan16HeSigbOfdm & 0x01) << 8;
413  val |= (m_nonTriggeredCqiFeedback & 0x01) << 9;
414  val |= (m_tx1024QamLt242Ru & 0x01) << 10;
415  val |= (m_rx1024QamLt242Ru & 0x01) << 11;
416  val |= (m_rxFullBwSuInHeMuCompressedSigB & 0x01) << 12;
417  val |= (m_rxFullBwSuInHeMuNonCompressedSigB & 0x01) << 13;
418  val |= (m_nominalPacketPadding & 0x03) << 14;
419  return val;
420 }
421 
422 uint8_t
424 {
425  uint8_t val = 0;
426  val |= m_maxHeLtfRxInHeMuMoreThanOneRu & 0x01;
427  // IEEE 802.11ax-2021 9.4.2.248.2 HE MAC Capabilities
428  // Bits 81-87 are reserved
429  return val;
430 }
431 
432 void
434 {
435  m_highestNssSupportedM1 = ctrl & 0x07;
436  m_highestMcsSupported = (ctrl >> 3) & 0x07;
438  uint8_t i;
439  for (i = 0; i < 5; i++)
440  {
441  m_txBwMap[i] = (ctrl >> (6 + i)) & 0x01;
442  }
443  for (i = 0; i < 5; i++)
444  {
445  m_rxBwMap[i] = (ctrl >> (11 + i)) & 0x01;
446  }
447  // TODO: MCS NSS Descriptors
448 }
449 
450 uint16_t
452 {
453  uint16_t val = 0;
454  val |= m_highestNssSupportedM1 & 0x07;
455  val |= (m_highestMcsSupported & 0x07) << 3;
456  uint8_t i;
457  for (i = 0; i < 5; i++)
458  {
459  val |= (m_txBwMap[i] & 0x01) << (6 + 1);
460  }
461  for (i = 0; i < 5; i++)
462  {
463  val |= (m_rxBwMap[i] & 0x01) << (11 + 1);
464  }
465  // TODO: MCS NSS Descriptors
466  return val;
467 }
468 
469 // TODO: PPE threshold
470 
471 bool
473 {
474  NS_ASSERT(mcs >= 0 && mcs <= 11);
475  if (mcs <= 7)
476  {
477  return true;
478  }
479  if (mcs == 8 && m_highestMcsSupported >= 1)
480  {
481  return true;
482  }
483  if (mcs == 9 && m_highestMcsSupported >= 2)
484  {
485  return true;
486  }
487  if (mcs == 10 && m_highestMcsSupported >= 3)
488  {
489  return true;
490  }
491  if (mcs == 11 && m_highestMcsSupported == 4)
492  {
493  return true;
494  }
495  return false;
496 }
497 
498 bool
500 {
501  NS_ASSERT(mcs >= 0 && mcs <= 11);
502  if (mcs <= 7)
503  {
504  return true;
505  }
506  if (mcs == 8 && m_highestMcsSupported >= 1)
507  {
508  return true;
509  }
510  if (mcs == 9 && m_highestMcsSupported >= 2)
511  {
512  return true;
513  }
514  if (mcs == 10 && m_highestMcsSupported >= 3)
515  {
516  return true;
517  }
518  if (mcs == 11 && m_highestMcsSupported == 4)
519  {
520  return true;
521  }
522  return false;
523 }
524 
525 void
526 HeCapabilities::SetChannelWidthSet(uint8_t channelWidthSet)
527 {
528  NS_ASSERT(channelWidthSet <= 0x2f);
529  m_channelWidthSet = channelWidthSet;
530 }
531 
532 void
533 HeCapabilities::SetLdpcCodingInPayload(uint8_t ldpcCodingInPayload)
534 {
535  m_ldpcCodingInPayload = ldpcCodingInPayload;
536 }
537 
538 void
539 HeCapabilities::SetHeSuPpdu1xHeLtf800nsGi(bool heSuPpdu1xHeLtf800nsGi)
540 {
541  m_heSuPpdu1xHeLtf800nsGi = (heSuPpdu1xHeLtf800nsGi ? 1 : 0);
542 }
543 
544 void
545 HeCapabilities::SetHePpdu4xHeLtf800nsGi(bool hePpdu4xHeLtf800nsGi)
546 {
547  m_hePpdu4xHeLtf800nsGi = (hePpdu4xHeLtf800nsGi ? 1 : 0);
548 }
549 
550 void
551 HeCapabilities::SetMaxAmpduLength(uint32_t maxAmpduLength)
552 {
553  for (uint8_t i = 0; i <= 3; i++)
554  {
555  if ((1UL << (20 + i)) - 1 == maxAmpduLength)
556  {
558  return;
559  }
560  }
561  NS_ABORT_MSG("Invalid A-MPDU Max Length value");
562 }
563 
564 void
566 {
567  NS_ASSERT(mcs >= 7 && mcs <= 11);
568  m_highestMcsSupported = mcs - 7;
569 }
570 
571 void
573 {
574  NS_ASSERT(nss >= 1 && nss <= 8);
575  m_highestNssSupportedM1 = nss - 1;
576 }
577 
578 uint8_t
580 {
581  return m_channelWidthSet;
582 }
583 
584 uint8_t
586 {
587  return m_ldpcCodingInPayload;
588 }
589 
590 bool
592 {
593  return (m_heSuPpdu1xHeLtf800nsGi == 1);
594 }
595 
596 bool
598 {
599  return (m_hePpdu4xHeLtf800nsGi == 1);
600 }
601 
602 uint8_t
604 {
605  return m_highestMcsSupported + 7;
606 }
607 
608 uint8_t
610 {
611  return m_highestNssSupportedM1 + 1;
612 }
613 
614 uint32_t
616 {
617  return std::min<uint32_t>((1UL << (20 + m_maxAmpduLengthExponent)) - 1, 6500631);
618 }
619 
620 } // namespace ns3
iterator in a Buffer instance
Definition: buffer.h:100
uint8_t ReadU8()
Definition: buffer.h:1027
uint16_t ReadLsbtohU16()
Definition: buffer.cc:1064
uint64_t ReadLsbtohU64()
Definition: buffer.cc:1094
uint32_t ReadU32()
Definition: buffer.cc:966
uint32_t ReadLsbtohU32()
Definition: buffer.cc:1076
bool IsSupportedTxMcs(uint8_t mcs) const
Is RX MCS supported.
uint8_t m_maximumNumberOfFragmentedMsdus
maximum number of fragmentation MSDUs
uint8_t m_rxControlFrameToMultiBss
receive control frame to multi-BSS
uint8_t m_codebookSize75MuFeedback
Codebook Size = {7, 5} MU feedback.
uint8_t m_beamformeeStsForLargerThan80Mhz
beamformee STS for > 80MHz
bool IsSupportedRxMcs(uint8_t mcs) const
Is RX MCS supported.
uint8_t m_dcmMaxRu
DCM Max RU.
uint8_t m_erPartialBandwidth
Extended range partial bandwidth.
uint8_t m_rxFullBwSuInHeMuCompressedSigB
RX full BW SU using HE MU PPDU with compressed SIGB.
uint8_t m_stbcRxLeq80MHz
STBC RX <= 80Mhz.
uint8_t m_amsduFragmentationSupport
A-MSDU fragmentation support.
uint8_t m_bqrSupport
BQR support.
uint8_t m_midambleRxMaxNsts
Midamble TX/RX max NSTS.
uint8_t m_heSubchannelSelectiveTxSupport
HE subchannel selective transmission support.
void SetHePhyCapabilitiesInfo(uint64_t ctrl1, uint16_t ctrl2, uint8_t ctrl3)
Set the HE PHY Capabilities Info field in the HE Capabilities information element.
uint8_t m_partialBwUlMuMimo
Partial Bandwidth UL MU-MIMO.
uint8_t m_qtpSupport
QTP support.
uint8_t m_triggerFrameMacPaddingDuration
trigger frame MAC padding duration
void SetHeSuPpdu1xHeLtf800nsGi(bool heSuPpdu1xHeLtf800nsGi)
Set 1xHE-LTF and 800ns GI in HE SU PPDU reception support.
uint8_t m_heVhtTriggerFrameRxSupport
HE and VHT trigger frame RX support.
uint8_t m_dopplerRx
Doppler Rx.
uint8_t m_codebookSize42SuFeedback
Codebook Size = {4, 2} SU feedback.
uint8_t m_puncturedPreambleRx
Punctured preamble Rx.
uint8_t m_allAckSupport
all Ack support
void SetLdpcCodingInPayload(uint8_t ldpcCodingInPayload)
Set indication whether the transmission and reception of LDPC encoded packets is supported.
uint8_t m_twtRequesterSupport
TWT requester support.
uint8_t m_ackEnabledAggregationSupport
ack enabled aggregation support
void SetSupportedMcsAndNss(uint16_t ctrl)
Set the MCS and NSS field in the HE Capabilities information element.
uint16_t GetHePhyCapabilitiesInfo2() const
Return the octets 9-10 of the HE PHY Capabilities Info field in the HE Capabilities information eleme...
uint16_t DeserializeInformationField(Buffer::Iterator start, uint16_t length) override
Deserialize information (i.e., the body of the IE, not including the Element ID and length octets)
uint8_t m_bsrSupport
BSR support.
uint8_t m_hePpdu20MHzIn160MHz
20MHz in 160/80+80MHz HE PPDU
uint8_t m_multiTidAggregationRxSupport
multi-TID aggregation Rx support
uint8_t m_heSuPpdu1xHeLtf800nsGi
HE SU PPDU with 1x HE LTF and 0.8us GI.
void SetHePpdu4xHeLtf800nsGi(bool heSuPpdu4xHeLtf800nsGi)
Set 4xHE-LTF and 800ns GI in HE SU PPDU and HE MU PPDU reception support.
uint8_t m_broadcastTwtSupport
broadcast TXT support
uint8_t m_hePpdu20MHzIn40MHz24GHz
20MHz in 40MHz HE PPDU in 2.4GHz band
uint8_t m_nominalPacketPadding
Nominal packet padding.
void SetHeMacCapabilitiesInfo(uint32_t ctrl1, uint16_t ctrl2)
Set the HE MAC Capabilities Info field in the HE Capabilities information element.
uint8_t m_ldpcCodingInPayload
LDPC coding in payload.
uint8_t m_psrBasedSrSupport
PSR based SR support.
std::vector< uint8_t > m_rxBwMap
receive BW map
uint8_t m_muCascadeSupport
MU cascade support.
uint8_t m_ofdmaRaSupport
OFDMA RA support.
uint8_t m_psrResponder
PSR responder.
uint8_t m_nonTriggeredCqiFeedback
Non-Triggered CQI feedback.
uint8_t m_suBeamformee
SU beamformee.
uint8_t m_maxNc
Max Nc for HE compressed beamforming/CQI report.
uint8_t GetHePhyCapabilitiesInfo3() const
Return the last octet of the HE PHY Capabilities Info field in the HE Capabilities information elemen...
uint8_t GetHighestMcsSupported() const
Get highest MCS supported.
uint8_t m_heErSuPpdu1xHeLtf08Gi
HE ER SU PPDU with 1x HE LTF and 0.8us GI.
uint32_t GetHeMacCapabilitiesInfo1() const
Return the 4 first octets of the HE MAC Capabilities Info field in the HE Capabilities information el...
uint8_t m_stbcRxGt80MHz
STBC RX > 80MHz.
uint8_t m_rx1024QamLt242Ru
TX 1024 QAM < 242 =-tone RU support.
uint8_t m_amsduNotUnderBaInAmpduSupport
AMSDU not under BA in Ack enabled A-MPDU support.
uint8_t m_32bitBaBitmapSupport
32-bit BA bitmap support
void SetHighestNssSupported(uint8_t nss)
Set highest NSS supported.
uint8_t m_rxFullBwSuInHeMuNonCompressedSigB
RX full BW SU using HE MU PPDU with non-compressed SIGB.
uint8_t m_opsSupport
OPS support.
uint8_t m_hePpdu4xHeLtf800nsGi
4 times HE-LFT and 800ns GI support for HE-PPDUs
uint8_t m_hePpdu80MHzIn160MHz
80MHz in 160/80+80MHz HE PPDU
uint8_t m_fragmentationSupport
fragmentation support
uint8_t m_highestMcsSupported
highest MCS support
uint8_t m_ngEqual16ForSuFeedbackSupport
equal 16 for SU feedback
uint8_t m_suBeamformer
SU beamformer.
uint8_t m_minimumFragmentSize
minimum fragment size
uint8_t m_twtResponderSupport
TWT responder support.
uint8_t m_flexibleTwtScheduleSupport
flexible TWT schedule support
uint8_t m_bsrpBqrpAmpduAggregation
BSRP BQRP A-MPDU aggregation.
uint8_t m_ngEqual16ForMuFeedbackSupport
equal 16 for MU feedback
uint8_t GetHighestNssSupported() const
Get highest NSS supported.
uint8_t m_puncturedSoundingSupport
punctured sounding support
bool GetHeSuPpdu1xHeLtf800nsGi() const
Get 1xHE-LTF and 800ns GI in HE SU PPDU reception support.
uint8_t m_rxPartialBwSuInHeMu
Rx Partial BW SU in 20 MHz HE MU PPDU.
uint8_t m_omControlSupport
operation mode control support
uint8_t m_ndp4xHeLtfAnd32msGi
NDP with 4x HE-LTF and 3.2us GI.
uint8_t m_stbcTxGt80MHz
STBC Tx > 80MHz.
uint16_t GetHeMacCapabilitiesInfo2() const
Return the last 2 octets of the HE MAC Capabilities Info field in the HE Capabilities information ele...
uint8_t m_midamble2xAnd1xHeLtf
Midamble TX/RX 2x and 1x HE-LTF.
WifiInformationElementId ElementIdExt() const override
Get the wifi information element ID extension.
uint8_t m_beamformeeStsForSmallerOrEqualThan80Mhz
beam formee STS for < 80 MHz
uint8_t m_plusHtcHeSupport
HTC HE support.
void SetMaxAmpduLength(uint32_t maxAmpduLength)
Set the maximum AMPDU length.
uint8_t m_channelWidthSet
channel width set
uint8_t m_fullBwUlMuMimo
Full Bandwidth UL MU-MIMO.
uint8_t m_maxAmpduLengthExponent
maximum A-MPDU length exponent extension
uint16_t GetInformationFieldSize() const override
Length of serialized information (i.e., the length of the body of the IE, not including the Element I...
void SerializeInformationField(Buffer::Iterator start) const override
Serialize information (i.e., the body of the IE, not including the Element ID and length octets)
uint8_t m_deviceClass
device class
uint8_t m_dlMuMimoOnPartialBandwidth
DL MU-MIMO on partial bandwidth.
uint64_t GetHePhyCapabilitiesInfo1() const
Return the 8 first octets of the HE PHY Capabilities Info field in the HE Capabilities information el...
uint8_t m_powerBoostFactorAlphaSupport
power boost factor alpha support
WifiInformationElementId ElementId() const override
Get the wifi information element ID.
uint8_t m_ppeThresholdPresent
PPE threshold present.
uint8_t m_muBeamformer
MU beamformer.
uint8_t GetLdpcCodingInPayload() const
Indicates support for the transmission and reception of LDPC encoded packets.
uint8_t m_ndpFeedbackReportSupport
NDP feedback report support.
uint8_t m_trsSupport
TRS support.
uint8_t m_longerThan16HeSigbOfdm
Longer than 16 HE SIG-=B OFDM symbols support.
uint16_t GetSupportedMcsAndNss() const
Return the MCS and NSS field in the HE Capabilities information element.
uint8_t m_dcmMaxConstellationRx
DCM Max Constellation Rx.
void Print(std::ostream &os) const override
Generate human-readable form of IE.
uint8_t m_triggeredMuBfFeedback
Triggered MU beamforming feedback.
uint8_t m_dcmMaxNssTx
DCM Max NSS Tx.
void SetChannelWidthSet(uint8_t channelWidthSet)
Set channel width set.
uint8_t m_omControlUlMuDataDisableRxSupport
OM control UL MU data disable RX support.
uint32_t GetMaxAmpduLength() const
Return the maximum A-MPDU length.
uint8_t m_heErSuPpdu4xHeLtf08sGi
HE ER SU PPDU with 4x HE LTF and 0.8us GI.
uint8_t m_triggeredSuBfFeedback
Triggered SU beamforming feedback.
uint8_t m_ul2x996ToneRuSupport
UL 2x996 tone RU support.
uint8_t m_multiTidAggregationTxSupport
Multi-TID aggregation TX support.
std::vector< uint8_t > m_txBwMap
transmit BW map
uint8_t m_tx1024QamLt242Ru
TX 1024 QAM < 242 =-tone RU support.
uint8_t m_dopplerTx
Doppler Tx.
uint8_t m_stbcTxLeq80MHz
STBC TX <= 80MHz.
uint8_t m_maxHeLtfRxInHeMuMoreThanOneRu
max HE-LTF symbols STA can Rx in HE MU PPDU with more than one RU
uint8_t m_numberOfSoundingDimensionsForLargerThan80Mhz
void SetHighestMcsSupported(uint8_t mcs)
Set highest MCS supported.
uint8_t m_heLinkAdaptation
HE link adaptation.
uint8_t m_highestNssSupportedM1
highest NSS support M1
uint8_t m_triggeredCqiFeedback
Triggered CQI feedback.
uint8_t m_numberOfSoundingDimensionsForSmallerOrEqualThan80Mhz
bool GetHePpdu4xHeLtf800nsGi() const
Get 4xHE-LTF and 800ns GI in HE SU PPDU and HE MU PPDU reception support.
uint8_t m_dcmMaxNssRx
DCM Max NSS Rx.
uint8_t m_dcmMaxConstellationTx
DCM Max Constellation Tx.
uint8_t m_heDynamicSmPowerSave
HE dynamic SM power save.
uint8_t GetChannelWidthSet() const
Get channel width set.
#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
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition: abort.h:49
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint8_t WifiInformationElementId
This type is used to represent an Information Element ID.
#define IE_EXT_HE_CAPABILITIES
#define IE_EXTENSION