A Discrete-Event Network Simulator
API
he-capabilities.cc
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2016
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: Sébastien Deronne <sebastien.deronne@gmail.com>
19  */
20 
21 #include "he-capabilities.h"
22 #include <algorithm>
23 
24 namespace ns3 {
25 
27  : m_plusHtcHeSupport (0),
28  m_twtRequesterSupport (0),
29  m_twtResponderSupport (0),
30  m_fragmentationSupport (0),
31  m_maximumNumberOfFragmentedMsdus (0),
32  m_minimumFragmentSize (0),
33  m_triggerFrameMacPaddingDuration (0),
34  m_multiTidAggregationRxSupport (0),
35  m_heLinkAdaptation (0),
36  m_allAckSupport (0),
37  m_trsSupport (0),
38  m_bsrSupport (0),
39  m_broadcastTwtSupport (0),
40  m_32bitBaBitmapSupport (0),
41  m_muCascadeSupport (0),
42  m_ackEnabledAggregationSupport (0),
43  m_omControlSupport (0),
44  m_ofdmaRaSupport (0),
45  m_maxAmpduLengthExponent (0),
46  m_amsduFragmentationSupport (0),
47  m_flexibleTwtScheduleSupport (0),
48  m_rxControlFrameToMultiBss (0),
49  m_bsrpBqrpAmpduAggregation (0),
50  m_qtpSupport (0),
51  m_bqrSupport (0),
52  m_psrResponder (0),
53  m_ndpFeedbackReportSupport (0),
54  m_opsSupport (0),
55  m_amsduNotUnderBaInAmpduSupport (0),
56  m_multiTidAggregationTxSupport (0),
57  m_heSubchannelSelectiveTxSupport (0),
58  m_ul2x996ToneRuSupport (0),
59  m_omControlUlMuDataDisableRxSupport (0),
60  m_heDynamicSmPowerSave (0),
61  m_puncturedSoundingSupport (0),
62  m_heVhtTriggerFrameRxSupport (0),
63  m_channelWidthSet (0),
64  m_puncturedPreambleRx (0),
65  m_deviceClass (0),
66  m_ldpcCodingInPayload (0),
67  m_heSuPpdu1xHeLtf800nsGi (0),
68  m_midambleRxMaxNsts (0),
69  m_ndp4xHeLtfAnd32msGi (0),
70  m_stbcTxLeq80MHz (0),
71  m_stbcRxLeq80MHz (0),
72  m_dopplerTx (0),
73  m_dopplerRx (0),
74  m_fullBwUlMuMimo (0),
75  m_partialBwUlMuMimo (0),
76  m_dcmMaxConstellationTx (0),
77  m_dcmMaxNssTx (0),
78  m_dcmMaxConstellationRx (0),
79  m_dcmMaxNssRx (0),
80  m_rxPartialBwSuInHeMu (0),
81  m_suBeamformer (0),
82  m_suBeamformee (0),
83  m_muBeamformer (0),
84  m_beamformeeStsForSmallerOrEqualThan80Mhz (0),
85  m_beamformeeStsForLargerThan80Mhz (0),
86  m_numberOfSoundingDimensionsForSmallerOrEqualThan80Mhz (0),
87  m_numberOfSoundingDimensionsForLargerThan80Mhz (0),
88  m_ngEqual16ForSuFeedbackSupport (0),
89  m_ngEqual16ForMuFeedbackSupport (0),
90  m_codebookSize42SuFeedback (0),
91  m_codebookSize75MuFeedback (0),
92  m_triggeredSuBfFeedback (0),
93  m_triggeredMuBfFeedback (0),
94  m_triggeredCqiFeedback (0),
95  m_erPartialBandwidth (0),
96  m_dlMuMimoOnPartialBandwidth (0),
97  m_ppeThresholdPresent (0),
98  m_psrBasedSrSupport (0),
99  m_powerBoostFactorAlphaSupport (0),
100  m_hePpdu4xHeLtf800nsGi (0),
101  m_maxNc (0),
102  m_stbcTxGt80MHz (0),
103  m_stbcRxGt80MHz (0),
104  m_heErSuPpdu4xHeLtf08sGi (0),
105  m_hePpdu20MHzIn40MHz24GHz (0),
106  m_hePpdu20MHzIn160MHz (0),
107  m_hePpdu80MHzIn160MHz (0),
108  m_heErSuPpdu1xHeLtf08Gi (0),
109  m_midamble2xAnd1xHeLtf (0),
110  m_dcmMaxRu (0),
111  m_longerThan16HeSigbOfdm (0),
112  m_nonTriggeredCqiFeedback (0),
113  m_tx1024QamLt242Ru (0),
114  m_rx1024QamLt242Ru (0),
115  m_rxFullBwSuInHeMuCompressedSigB (0),
116  m_rxFullBwSuInHeMuNonCompressedSigB (0),
117  m_nominalPacketPadding (0),
118  m_maxHeLtfRxInHeMuMoreThanOneRu (0),
119  m_highestNssSupportedM1 (0),
120  m_highestMcsSupported (0),
121  m_heSupported (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::SetHeSupported (uint8_t heSupported)
141 {
142  m_heSupported = heSupported;
143 }
144 
145 uint8_t
147 {
148  //we should not be here if HE is not supported
149  NS_ASSERT (m_heSupported > 0);
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 
160 {
161  if (m_heSupported < 1)
162  {
163  return i;
164  }
166 }
167 
168 uint16_t
170 {
171  if (m_heSupported < 1)
172  {
173  return 0;
174  }
176 }
177 
178 void
180 {
181  if (m_heSupported == 1)
182  {
183  //write the corresponding value for each bit
184  start.WriteHtolsbU32 (GetHeMacCapabilitiesInfo1 ());
185  start.WriteU16 (GetHeMacCapabilitiesInfo2 ());
186  start.WriteHtolsbU64 (GetHePhyCapabilitiesInfo1 ());
187  start.WriteHtolsbU16 (GetHePhyCapabilitiesInfo2 ());
188  start.WriteU8 (GetHePhyCapabilitiesInfo3 ());
189  start.WriteHtolsbU32 (GetSupportedMcsAndNss ());
190  // TODO: add another 32-bits field if 160 MHz channel is supported (variable length)
191  // TODO: optional PPE Threshold field (variable length)
192  }
193 }
194 
195 uint8_t
197 {
199  uint32_t macCapabilities1 = i.ReadLsbtohU32 ();
200  uint16_t macCapabilities2 = i.ReadLsbtohU16 ();
201  uint64_t phyCapabilities1 = i.ReadLsbtohU64 ();
202  uint64_t phyCapabilities2 = i.ReadLsbtohU16 ();
203  uint8_t phyCapabilities3 = i.ReadU8 ();
204  uint32_t mcsset = i.ReadU32 ();
205  SetHeMacCapabilitiesInfo (macCapabilities1, macCapabilities2);
206  SetHePhyCapabilitiesInfo (phyCapabilities1, phyCapabilities2, phyCapabilities3);
207  SetSupportedMcsAndNss (mcsset);
208  // TODO: add another 32-bits field if 160 MHz channel is supported (variable length)
209  // TODO: optional PPE Threshold field (variable length)
210  return length;
211 }
212 
213 void
214 HeCapabilities::SetHeMacCapabilitiesInfo (uint32_t ctrl1, uint16_t ctrl2)
215 {
216  m_plusHtcHeSupport = ctrl1 & 0x01;
217  m_twtRequesterSupport = (ctrl1 >> 1) & 0x01;
218  m_twtResponderSupport = (ctrl1 >> 2) & 0x01;
219  m_fragmentationSupport = (ctrl1 >> 3) & 0x03;
220  m_maximumNumberOfFragmentedMsdus = (ctrl1 >> 5) & 0x07;
221  m_minimumFragmentSize = (ctrl1 >> 8) & 0x03;
222  m_triggerFrameMacPaddingDuration = (ctrl1 >> 10) & 0x03;
223  m_multiTidAggregationRxSupport = (ctrl1 >> 12) & 0x07;
224  m_heLinkAdaptation = (ctrl1 >> 15) & 0x03;
225  m_allAckSupport = (ctrl1 >> 17) & 0x01;
226  m_trsSupport = (ctrl1 >> 18) & 0x01;
227  m_bsrSupport = (ctrl1 >> 19) & 0x01;
228  m_broadcastTwtSupport = (ctrl1 >> 20) & 0x01;
229  m_32bitBaBitmapSupport = (ctrl1 >> 21) & 0x01;
230  m_muCascadeSupport = (ctrl1 >> 22) & 0x01;
231  m_ackEnabledAggregationSupport = (ctrl1 >> 23) & 0x01;
232  // IEEE 802.11ax-2021 9.4.2.248.2 HE MAC Capabilities
233  // Bit 24 is reserved
234  m_omControlSupport = (ctrl1 >> 25) & 0x01;
235  m_ofdmaRaSupport = (ctrl1 >> 26) & 0x01;
236  m_maxAmpduLengthExponent = (ctrl1 >> 27) & 0x03;
237  m_amsduFragmentationSupport = (ctrl1 >> 29) & 0x01;
238  m_flexibleTwtScheduleSupport = (ctrl1 >> 30) & 0x01;
239  m_rxControlFrameToMultiBss = (ctrl1 >> 31) & 0x01;
240  m_bsrpBqrpAmpduAggregation = ctrl2 & 0x01;
241  m_qtpSupport = (ctrl2 >> 1) & 0x01;
242  m_bqrSupport = (ctrl2 >> 2) & 0x01;
243  m_psrResponder = (ctrl2 >> 3) & 0x01;
244  m_ndpFeedbackReportSupport = (ctrl2 >> 4) & 0x01;
245  m_opsSupport = (ctrl2 >> 5) & 0x01;
246  m_amsduNotUnderBaInAmpduSupport = (ctrl2 >> 6) & 0x01;
247  m_multiTidAggregationTxSupport = (ctrl2 >> 7) & 0x07;
248  m_heSubchannelSelectiveTxSupport = (ctrl2 >> 10) & 0x01;
249  m_ul2x996ToneRuSupport = (ctrl2 >> 11) & 0x01;
250  m_omControlUlMuDataDisableRxSupport = (ctrl2 >> 12) & 0x01;
251  m_heDynamicSmPowerSave = (ctrl2 >> 13) & 0x01;
252  m_puncturedSoundingSupport = (ctrl2 >> 14) & 0x01;
253  m_heVhtTriggerFrameRxSupport = (ctrl2 >> 15) & 0x01;
254 }
255 
256 uint32_t
258 {
259  uint32_t val = 0;
260  val |= m_plusHtcHeSupport & 0x01;
261  val |= (m_twtRequesterSupport & 0x01) << 1;
262  val |= (m_twtResponderSupport & 0x01) << 2;
263  val |= (m_fragmentationSupport & 0x03) << 3;
264  val |= (m_maximumNumberOfFragmentedMsdus & 0x07) << 5;
265  val |= (m_minimumFragmentSize & 0x03) << 8;
266  val |= (m_triggerFrameMacPaddingDuration & 0x03) << 10;
267  val |= (m_multiTidAggregationRxSupport & 0x07) << 12;
268  val |= (m_heLinkAdaptation & 0x03) << 15;
269  val |= (m_allAckSupport & 0x01) << 17;
270  val |= (m_trsSupport & 0x01) << 18;
271  val |= (m_bsrSupport & 0x01) << 19;
272  val |= (m_broadcastTwtSupport & 0x01) << 20;
273  val |= (m_32bitBaBitmapSupport & 0x01) << 21;
274  val |= (m_muCascadeSupport & 0x01) << 22;
275  val |= (m_ackEnabledAggregationSupport & 0x01) << 23;
276  // IEEE 802.11ax-2021 9.4.2.248.2 HE MAC Capabilities
277  // Bit 24 is reserved
278  val |= (m_omControlSupport & 0x01) << 25;
279  val |= (m_ofdmaRaSupport & 0x01) << 26;
280  val |= (m_maxAmpduLengthExponent & 0x03) << 27;
281  val |= (m_amsduFragmentationSupport & 0x01) << 29;
282  val |= (m_flexibleTwtScheduleSupport & 0x01) << 30;
283  val |= (m_rxControlFrameToMultiBss & 0x01) << 31;
284  return val;
285 }
286 
287 uint16_t
289 {
290  uint16_t val = 0;
291  val |= m_bsrpBqrpAmpduAggregation & 0x01;
292  val |= (m_qtpSupport & 0x01) << 1;
293  val |= (m_bqrSupport & 0x01) << 2;
294  val |= (m_psrResponder & 0x01) << 3;
295  val |= (m_ndpFeedbackReportSupport & 0x01) << 4;
296  val |= (m_opsSupport & 0x01) << 5;
297  val |= (m_amsduNotUnderBaInAmpduSupport & 0x01) << 6;
298  val |= (m_multiTidAggregationTxSupport & 0x07) << 7;
299  val |= (m_heSubchannelSelectiveTxSupport & 0x01) << 10;
300  val |= (m_ul2x996ToneRuSupport & 0x01) << 11;
301  val |= (m_omControlUlMuDataDisableRxSupport & 0x01) << 12;
302  val |= (m_heDynamicSmPowerSave & 0x01) << 13;
303  val |= (m_puncturedSoundingSupport & 0x01) << 14;
304  val |= (m_heVhtTriggerFrameRxSupport & 0x01) << 15;
305  return val;
306 }
307 
308 void
309 HeCapabilities::SetHePhyCapabilitiesInfo (uint64_t ctrl1, uint16_t ctrl2, uint8_t ctrl3)
310 {
311  // IEEE 802.11ax-2021 9.4.2.248.2 HE MAC Capabilities
312  // Bit 0 is reserved
313  m_channelWidthSet = (ctrl1 >> 1) & 0x7f;
314  m_puncturedPreambleRx = (ctrl1 >> 8) & 0x0f;
315  m_deviceClass = (ctrl1 >> 12) & 0x01;
316  m_ldpcCodingInPayload = (ctrl1 >> 13) & 0x01;
317  m_heSuPpdu1xHeLtf800nsGi = (ctrl1 >> 14) & 0x01;
318  m_midambleRxMaxNsts = (ctrl1 >> 15) & 0x03;
319  m_ndp4xHeLtfAnd32msGi = (ctrl1 >> 17) & 0x01;
320  m_stbcTxLeq80MHz = (ctrl1 >> 18) & 0x01;
321  m_stbcRxLeq80MHz = (ctrl1 >> 19) & 0x01;
322  m_dopplerTx = (ctrl1 >> 20) & 0x01;
323  m_dopplerRx = (ctrl1 >> 21) & 0x01;
324  m_fullBwUlMuMimo = (ctrl1 >> 22) & 0x01;
325  m_partialBwUlMuMimo = (ctrl1 >> 23) & 0x01;
326  m_dcmMaxConstellationTx = (ctrl1 >> 24) & 0x03;
327  m_dcmMaxNssTx = (ctrl1 >> 26) & 0x01;
328  m_dcmMaxConstellationRx = (ctrl1 >> 27) & 0x03;
329  m_dcmMaxNssRx = (ctrl1 >> 29) & 0x01;
330  m_rxPartialBwSuInHeMu = (ctrl1 >> 30) & 0x01;
331  m_suBeamformer = (ctrl1 >> 31) & 0x01;
332  m_suBeamformee = (ctrl1 >> 32) & 0x01;
333  m_muBeamformer = (ctrl1 >> 33) & 0x01;
334  m_beamformeeStsForSmallerOrEqualThan80Mhz = (ctrl1 >> 34) & 0x07;
335  m_beamformeeStsForLargerThan80Mhz = (ctrl1 >> 37) & 0x07;
337  m_numberOfSoundingDimensionsForLargerThan80Mhz = (ctrl1 >> 43) & 0x07;
338  m_ngEqual16ForSuFeedbackSupport = (ctrl1 >> 46) & 0x01;
339  m_ngEqual16ForMuFeedbackSupport = (ctrl1 >> 47) & 0x01;
340  m_codebookSize42SuFeedback = (ctrl1 >> 48) & 0x01;
341  m_codebookSize75MuFeedback = (ctrl1 >> 49) & 0x01;
342  m_triggeredSuBfFeedback = (ctrl1 >> 50) & 0x01;
343  m_triggeredMuBfFeedback = (ctrl1 >> 51) & 0x01;
344  m_triggeredCqiFeedback = (ctrl1 >> 52) & 0x01;
345  m_erPartialBandwidth = (ctrl1 >> 53) & 0x01;
346  m_dlMuMimoOnPartialBandwidth = (ctrl1 >> 54) & 0x01;
347  m_ppeThresholdPresent = (ctrl1 >> 55) & 0x01;
348  m_psrBasedSrSupport = (ctrl1 >> 56) & 0x01;
349  m_powerBoostFactorAlphaSupport = (ctrl1 >> 57) & 0x01;
350  m_hePpdu4xHeLtf800nsGi = ctrl2 & 0x01;
351  m_maxNc = (ctrl1 >> 59) & 0x07;
352  m_stbcTxGt80MHz = (ctrl1 >> 62) & 0x01;
353  m_stbcRxGt80MHz = (ctrl1 >> 63) & 0x01;
354  m_heErSuPpdu4xHeLtf08sGi = ctrl2 & 0x01;
355  m_hePpdu20MHzIn40MHz24GHz = (ctrl2 >> 1) & 0x01;
356  m_hePpdu20MHzIn160MHz = (ctrl2 >> 2) & 0x01;
357  m_hePpdu80MHzIn160MHz = (ctrl2 >> 3) & 0x01;
358  m_heErSuPpdu1xHeLtf08Gi = (ctrl2 >> 4) & 0x01;
359  m_midamble2xAnd1xHeLtf = (ctrl2 >> 5) & 0x01;
360  m_dcmMaxRu = (ctrl2 >> 6) & 0x03;
361  m_longerThan16HeSigbOfdm = (ctrl2 >> 8) & 0x01;
362  m_nonTriggeredCqiFeedback = (ctrl2 >> 9) & 0x01;
363  m_tx1024QamLt242Ru = (ctrl2 >> 10) & 0x01;
364  m_rx1024QamLt242Ru = (ctrl2 >> 11) & 0x01;
365  m_rxFullBwSuInHeMuCompressedSigB = (ctrl2 >> 12) & 0x01;
366  m_rxFullBwSuInHeMuNonCompressedSigB = (ctrl2 >> 13) & 0x01;
367  m_nominalPacketPadding = (ctrl2 >> 14) & 0x03;
368  m_maxHeLtfRxInHeMuMoreThanOneRu = ctrl3 & 0x01;
369  // IEEE 802.11ax-2021 9.4.2.248.2 HE MAC Capabilities
370  // Bits 81-87 are reserved
371 }
372 
373 uint64_t
375 {
376  uint64_t val = 0;
377  // IEEE 802.11ax-2021 9.4.2.248.2 HE MAC Capabilities
378  // Bit 0 is reserved
379  val |= (m_channelWidthSet & 0x7f) << 1;
380  val |= (m_puncturedPreambleRx & 0x0f) << 8;
381  val |= (m_deviceClass & 0x01) << 12;
382  val |= (m_ldpcCodingInPayload & 0x01) << 13;
383  val |= (m_heSuPpdu1xHeLtf800nsGi & 0x01) << 14;
384  val |= (m_midambleRxMaxNsts & 0x03) << 15;
385  val |= (m_ndp4xHeLtfAnd32msGi & 0x01) << 17;
386  val |= (m_stbcTxLeq80MHz & 0x01) << 18;
387  val |= (m_stbcRxLeq80MHz & 0x01) << 19;
388  val |= (m_dopplerTx & 0x01) << 20;
389  val |= (m_dopplerRx & 0x01) << 21;
390  val |= (m_fullBwUlMuMimo & 0x01) << 22;
391  val |= (m_partialBwUlMuMimo & 0x01) << 23;
392  val |= (m_dcmMaxConstellationTx & 0x03) << 24;
393  val |= (m_dcmMaxNssTx & 0x01) << 26;
394  val |= (m_dcmMaxConstellationRx & 0x03) << 27;
395  val |= (m_dcmMaxNssRx & 0x01) << 29;
396  val |= (m_rxPartialBwSuInHeMu & 0x01) << 30;
397  val |= (m_suBeamformer & 0x01) << 31;
398  val |= (static_cast<uint64_t> (m_suBeamformee) & 0x01) << 32;
399  val |= (static_cast<uint64_t> (m_muBeamformer) & 0x01) << 33;
400  val |= (static_cast<uint64_t> (m_beamformeeStsForSmallerOrEqualThan80Mhz) & 0x07) << 34;
401  val |= (static_cast<uint64_t> (m_beamformeeStsForLargerThan80Mhz) & 0x07) << 37;
402  val |= (static_cast<uint64_t> (m_numberOfSoundingDimensionsForSmallerOrEqualThan80Mhz) & 0x07) << 40;
403  val |= (static_cast<uint64_t> (m_numberOfSoundingDimensionsForLargerThan80Mhz) & 0x07) << 43;
404  val |= (static_cast<uint64_t> (m_ngEqual16ForSuFeedbackSupport) & 0x01) << 46;
405  val |= (static_cast<uint64_t> (m_ngEqual16ForMuFeedbackSupport) & 0x01) << 47;
406  val |= (static_cast<uint64_t> (m_codebookSize42SuFeedback) & 0x01) << 48;
407  val |= (static_cast<uint64_t> (m_codebookSize75MuFeedback) & 0x01) << 49;
408  val |= (static_cast<uint64_t> (m_triggeredSuBfFeedback) & 0x01) << 50;
409  val |= (static_cast<uint64_t> (m_triggeredMuBfFeedback) & 0x01) << 51;
410  val |= (static_cast<uint64_t> (m_triggeredCqiFeedback) & 0x01) << 52;
411  val |= (static_cast<uint64_t> (m_erPartialBandwidth) & 0x01) << 53;
412  val |= (static_cast<uint64_t> (m_dlMuMimoOnPartialBandwidth) & 0x01) << 54;
413  val |= (static_cast<uint64_t> (m_ppeThresholdPresent) & 0x01) << 55;
414  val |= (static_cast<uint64_t> (m_psrBasedSrSupport) & 0x01) << 56;
415  val |= (static_cast<uint64_t> (m_powerBoostFactorAlphaSupport) & 0x01) << 57;
416  val |= (static_cast<uint64_t> (m_hePpdu4xHeLtf800nsGi) & 0x01) << 58;
417  val |= (static_cast<uint64_t> (m_maxNc) & 0x07) << 59;
418  val |= (static_cast<uint64_t> (m_stbcTxGt80MHz) & 0x01) << 62;
419  val |= (static_cast<uint64_t> (m_stbcRxGt80MHz) & 0x01) << 63;
420  return val;
421 }
422 
423 uint16_t
425 {
426  uint16_t val = 0;
427  val |= m_heErSuPpdu4xHeLtf08sGi & 0x01;
428  val |= (m_hePpdu20MHzIn40MHz24GHz & 0x01) << 1;
429  val |= (m_hePpdu20MHzIn160MHz & 0x01) << 2;
430  val |= (m_hePpdu80MHzIn160MHz & 0x01) << 3;
431  val |= (m_heErSuPpdu1xHeLtf08Gi & 0x01) << 4;
432  val |= (m_midamble2xAnd1xHeLtf & 0x01) << 5;
433  val |= (m_dcmMaxRu & 0x03) << 6;
434  val |= (m_longerThan16HeSigbOfdm & 0x01) << 8;
435  val |= (m_nonTriggeredCqiFeedback & 0x01) << 9;
436  val |= (m_tx1024QamLt242Ru & 0x01) << 10;
437  val |= (m_rx1024QamLt242Ru & 0x01) << 11;
438  val |= (m_rxFullBwSuInHeMuCompressedSigB & 0x01) << 12;
439  val |= (m_rxFullBwSuInHeMuNonCompressedSigB & 0x01) << 13;
440  val |= (m_nominalPacketPadding & 0x03) << 14;
441  return val;
442 }
443 
444 uint8_t
446 {
447  uint8_t val = 0;
448  val |= m_maxHeLtfRxInHeMuMoreThanOneRu & 0x01;
449  // IEEE 802.11ax-2021 9.4.2.248.2 HE MAC Capabilities
450  // Bits 81-87 are reserved
451  return val;
452 }
453 
454 void
456 {
457  m_highestNssSupportedM1 = ctrl & 0x07;
458  m_highestMcsSupported = (ctrl >> 3) & 0x07;
460  uint8_t i;
461  for (i = 0; i < 5; i++)
462  {
463  m_txBwMap[i] = (ctrl >> (6 + i)) & 0x01;
464  }
465  for (i = 0; i < 5; i++)
466  {
467  m_rxBwMap[i] = (ctrl >> (11 + i)) & 0x01;
468  }
469  // TODO: MCS NSS Descriptors
470 }
471 
472 uint16_t
474 {
475  uint16_t val = 0;
476  val |= m_highestNssSupportedM1 & 0x07;
477  val |= (m_highestMcsSupported & 0x07) << 3;
478  uint8_t i;
479  for (i = 0; i < 5; i++)
480  {
481  val |= (m_txBwMap[i] & 0x01) << (6 + 1);
482  }
483  for (i = 0; i < 5; i++)
484  {
485  val |= (m_rxBwMap[i] & 0x01) << (11 + 1);
486  }
487  // TODO: MCS NSS Descriptors
488  return val;
489 }
490 
491 // TODO: PPE threshold
492 
493 bool
495 {
496  NS_ASSERT (mcs >= 0 && mcs <= 11);
497  if (mcs <= 7)
498  {
499  return true;
500  }
501  if (mcs == 8 && m_highestMcsSupported >= 1)
502  {
503  return true;
504  }
505  if (mcs == 9 && m_highestMcsSupported >= 2)
506  {
507  return true;
508  }
509  if (mcs == 10 && m_highestMcsSupported >= 3)
510  {
511  return true;
512  }
513  if (mcs == 11 && m_highestMcsSupported == 4)
514  {
515  return true;
516  }
517  return false;
518 }
519 
520 bool
522 {
523  NS_ASSERT (mcs >= 0 && mcs <= 11);
524  if (mcs <= 7)
525  {
526  return true;
527  }
528  if (mcs == 8 && m_highestMcsSupported >= 1)
529  {
530  return true;
531  }
532  if (mcs == 9 && m_highestMcsSupported >= 2)
533  {
534  return true;
535  }
536  if (mcs == 10 && m_highestMcsSupported >= 3)
537  {
538  return true;
539  }
540  if (mcs == 11 && m_highestMcsSupported == 4)
541  {
542  return true;
543  }
544  return false;
545 }
546 
547 void
548 HeCapabilities::SetChannelWidthSet (uint8_t channelWidthSet)
549 {
550  NS_ASSERT (channelWidthSet <= 0x2f);
551  m_channelWidthSet = channelWidthSet;
552 }
553 
554 void
555 HeCapabilities::SetLdpcCodingInPayload (uint8_t ldpcCodingInPayload)
556 {
557  m_ldpcCodingInPayload = ldpcCodingInPayload;
558 }
559 
560 void
561 HeCapabilities::SetHeSuPpdu1xHeLtf800nsGi (bool heSuPpdu1xHeLtf800nsGi)
562 {
563  m_heSuPpdu1xHeLtf800nsGi = (heSuPpdu1xHeLtf800nsGi ? 1 : 0);
564 }
565 
566 void
567 HeCapabilities::SetHePpdu4xHeLtf800nsGi (bool hePpdu4xHeLtf800nsGi)
568 {
569  m_hePpdu4xHeLtf800nsGi = (hePpdu4xHeLtf800nsGi ? 1 : 0);
570 }
571 
572 void
573 HeCapabilities::SetMaxAmpduLength (uint32_t maxAmpduLength)
574 {
575  for (uint8_t i = 0; i <= 3; i++)
576  {
577  if ((1ul << (20 + i)) - 1 == maxAmpduLength)
578  {
580  return;
581  }
582  }
583  NS_ABORT_MSG ("Invalid A-MPDU Max Length value");
584 }
585 
586 void
588 {
589  NS_ASSERT (mcs >= 7 && mcs <= 11);
590  m_highestMcsSupported = mcs - 7;
591 }
592 
593 void
595 {
596  NS_ASSERT (nss >= 1 && nss <= 8);
597  m_highestNssSupportedM1 = nss - 1;
598 }
599 
600 uint8_t
602 {
603  return m_channelWidthSet;
604 }
605 
606 uint8_t
608 {
609  return m_ldpcCodingInPayload;
610 }
611 
612 bool
614 {
615  return (m_heSuPpdu1xHeLtf800nsGi == 1);
616 }
617 
618 bool
620 {
621  return (m_hePpdu4xHeLtf800nsGi == 1);
622 }
623 
624 
625 uint8_t
627 {
628  return m_highestMcsSupported + 7;
629 }
630 
631 uint8_t
633 {
634  return m_highestNssSupportedM1 + 1;
635 }
636 
637 uint32_t
639 {
640  return std::min<uint32_t> ((1ul << (20 + m_maxAmpduLengthExponent)) - 1, 6500631);
641 }
642 
643 std::ostream &
644 operator << (std::ostream &os, const HeCapabilities &HeCapabilities)
645 {
652  return os;
653 }
654 
655 } //namespace ns3
iterator in a Buffer instance
Definition: buffer.h:99
uint32_t ReadLsbtohU32(void)
Definition: buffer.cc:1077
uint8_t ReadU8(void)
Definition: buffer.h:1021
uint16_t ReadLsbtohU16(void)
Definition: buffer.cc:1066
uint64_t ReadLsbtohU64(void)
Definition: buffer.cc:1094
uint32_t ReadU32(void)
Definition: buffer.cc:973
The IEEE 802.11ax HE Capabilities.
bool IsSupportedTxMcs(uint8_t mcs) const
Is RX MCS supported.
Buffer::Iterator Serialize(Buffer::Iterator start) const override
Serialize entire IE including Element ID and length fields.
uint8_t m_maximumNumberOfFragmentedMsdus
maximum number of fragmentation MSDUs
uint8_t GetInformationFieldSize() const override
Length of serialized information (i.e., the length of the body of the IE, not including the Element I...
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.
bool GetHePpdu4xHeLtf800nsGi(void) const
Get 4xHE-LTF and 800ns GI in HE SU PPDU and HE MU PPDU reception 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 GetHighestMcsSupported(void) const
Get highest MCS supported.
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...
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.
uint8_t GetLdpcCodingInPayload(void) const
Indicates support for the transmission and reception of LDPC encoded packets.
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.
uint8_t DeserializeInformationField(Buffer::Iterator start, uint8_t length) override
Deserialize information (i.e., the body of the IE, not including the Element ID and length octets)
std::vector< uint8_t > m_rxBwMap
receive BW map
uint8_t m_muCascadeSupport
MU cascade support.
void SetHeSupported(uint8_t heSupported)
Set HE supported.
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 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.
uint32_t GetMaxAmpduLength(void) const
Return the maximum A-MPDU length.
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 m_puncturedSoundingSupport
punctured sounding 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...
bool GetHeSuPpdu1xHeLtf800nsGi(void) const
Get 1xHE-LTF and 800ns GI in HE SU PPDU reception support.
uint8_t m_midamble2xAnd1xHeLtf
Midamble TX/RX 2x and 1x HE-LTF.
uint8_t m_heSupported
This is used to decide if this element should be added to the frame or not.
WifiInformationElementId ElementIdExt() const override
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
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
uint8_t m_ppeThresholdPresent
PPE threshold present.
uint8_t m_muBeamformer
MU beamformer.
uint8_t m_ndpFeedbackReportSupport
NDP feedback report support.
uint16_t GetSerializedSize() const override
Get the size of the serialized IE including Element ID and length fields.
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 GetChannelWidthSet(void) const
Get channel width set.
uint8_t m_dcmMaxConstellationRx
DCM Max Constellation Rx.
uint8_t m_triggeredMuBfFeedback
Triggered MU beamforming feedback.
uint8_t m_dcmMaxNssTx
DCM Max NSS Tx.
uint8_t GetHighestNssSupported(void) const
Get highest NSS supported.
void SetChannelWidthSet(uint8_t channelWidthSet)
Set channel width set.
uint8_t m_omControlUlMuDataDisableRxSupport
OM control UL MU data disable RX support.
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
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.
virtual uint16_t GetSerializedSize() const
Get the size of the serialized IE including Element ID and length fields.
virtual Buffer::Iterator Serialize(Buffer::Iterator i) const
Serialize entire IE including Element ID and length fields.
#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
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition: abort.h:50
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:139
uint8_t WifiInformationElementId
This type is used to represent an Information Element ID.
def start()
Definition: core.py:1853
#define IE_EXT_HE_CAPABILITIES
#define IE_EXTENSION