A Discrete-Event Network Simulator
API
wifi-aggregation-test.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2015
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 "ns3/string.h"
22 #include "ns3/test.h"
23 #include "ns3/simulator.h"
24 #include "ns3/wifi-mac-queue.h"
25 #include "ns3/wifi-psdu.h"
26 #include "ns3/sta-wifi-mac.h"
27 #include "ns3/yans-wifi-phy.h"
28 #include "ns3/interference-helper.h"
29 #include "ns3/mac-tx-middle.h"
30 #include "ns3/ht-frame-exchange-manager.h"
31 #include "ns3/msdu-aggregator.h"
32 #include "ns3/mpdu-aggregator.h"
33 #include "ns3/wifi-net-device.h"
34 #include "ns3/ht-configuration.h"
35 #include "ns3/vht-configuration.h"
36 #include "ns3/he-configuration.h"
37 #include "ns3/node-container.h"
38 #include "ns3/yans-wifi-helper.h"
39 #include "ns3/mobility-helper.h"
40 #include "ns3/pointer.h"
41 #include "ns3/packet-socket-server.h"
42 #include "ns3/packet-socket-client.h"
43 #include "ns3/packet-socket-helper.h"
44 #include "ns3/wifi-default-protection-manager.h"
45 #include "ns3/wifi-default-ack-manager.h"
46 #include <iterator>
47 #include <algorithm>
48 
49 using namespace ns3;
50 
58 {
59 public:
61 
62 private:
69  void MpduDiscarded (WifiMacDropReason reason, Ptr<const WifiMacQueueItem> mpdu);
70 
71  void DoRun (void) override;
77  bool m_discarded;
78 };
79 
81  : TestCase ("Check the correctness of MPDU aggregation operations"),
82  m_discarded (false)
83 {
84 }
85 
86 void
88 {
89  m_discarded = true;
90 }
91 
92 void
94 {
95  /*
96  * Create device and attach HT configuration.
97  */
98  m_device = CreateObject<WifiNetDevice> ();
99  Ptr<HtConfiguration> htConfiguration = CreateObject<HtConfiguration> ();
100  m_device->SetHtConfiguration (htConfiguration);
101 
102  /*
103  * Create and configure phy layer.
104  */
105  m_phy = CreateObject<YansWifiPhy> ();
106  Ptr<InterferenceHelper> interferenceHelper = CreateObject<InterferenceHelper> ();
107  m_phy->SetInterferenceHelper (interferenceHelper);
110  m_device->SetPhy (m_phy);
111 
112  /*
113  * Create and configure manager.
114  */
116  m_factory.SetTypeId ("ns3::ConstantRateWifiManager");
117  m_factory.Set ("DataMode", StringValue ("HtMcs7"));
121 
122  /*
123  * Create and configure mac layer.
124  */
125  m_mac = CreateObjectWithAttributes<StaWifiMac> ("QosSupported", BooleanValue (true));
128  m_mac->SetAddress (Mac48Address ("00:00:00:00:00:01"));
131  Ptr<WifiProtectionManager> protectionManager = CreateObject<WifiDefaultProtectionManager> ();
132  protectionManager->SetWifiMac (m_mac);
133  fem->SetProtectionManager (protectionManager);
134  Ptr<WifiAckManager> ackManager = CreateObject<WifiDefaultAckManager> ();
135  ackManager->SetWifiMac (m_mac);
136  fem->SetAckManager (ackManager);
138  m_device->SetMac (m_mac);
140 
141  /*
142  * Configure MPDU aggregation.
143  */
144  m_mac->SetAttribute ("BE_MaxAmpduSize", UintegerValue (65535));
145  HtCapabilities htCapabilities;
146  htCapabilities.SetMaxAmpduLength (65535);
147  m_manager->AddStationHtCapabilities (Mac48Address ("00:00:00:00:00:02"), htCapabilities);
148  m_manager->AddStationHtCapabilities (Mac48Address ("00:00:00:00:00:03"), htCapabilities);
149 
150  /*
151  * Create a dummy packet of 1500 bytes and fill mac header fields.
152  */
153  Ptr<const Packet> pkt = Create<Packet> (1500);
154  Ptr<Packet> currentAggregatedPacket = Create<Packet> ();
155  WifiMacHeader hdr;
156  hdr.SetAddr1 (Mac48Address ("00:00:00:00:00:02"));
157  hdr.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
159  hdr.SetQosTid (0);
160  hdr.SetFragmentNumber (0);
161  hdr.SetNoMoreFragments ();
162  hdr.SetNoRetry ();
163 
164  /*
165  * Establish agreement.
166  */
167  MgtAddBaRequestHeader reqHdr;
168  reqHdr.SetImmediateBlockAck ();
169  reqHdr.SetTid (0);
170  reqHdr.SetBufferSize (64);
171  reqHdr.SetTimeout (0);
172  reqHdr.SetStartingSequence (0);
173  m_mac->GetBEQueue ()->GetBaManager ()->CreateAgreement (&reqHdr, hdr.GetAddr1 ());
174 
175  MgtAddBaResponseHeader respHdr;
176  StatusCode code;
177  code.SetSuccess ();
178  respHdr.SetStatusCode (code);
179  respHdr.SetAmsduSupport (reqHdr.IsAmsduSupported ());
180  respHdr.SetImmediateBlockAck ();
181  respHdr.SetTid (reqHdr.GetTid ());
182  respHdr.SetBufferSize (64);
183  respHdr.SetTimeout (reqHdr.GetTimeout ());
184  m_mac->GetBEQueue ()->GetBaManager ()->UpdateAgreement (&respHdr, hdr.GetAddr1 (), 0);
185 
186  //-----------------------------------------------------------------------------------------------------
187 
188  /*
189  * Test behavior when no other packets are in the queue
190  */
191  Ptr<HtFrameExchangeManager> htFem = DynamicCast<HtFrameExchangeManager> (fem);
192  Ptr<MpduAggregator> mpduAggregator = htFem->GetMpduAggregator ();
193 
194  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt, hdr));
195 
197  WifiTxParameters txParams;
198  txParams.m_txVector = m_mac->GetWifiRemoteStationManager ()->GetDataTxVector (peeked->GetHeader ());
199  Ptr<WifiMacQueueItem> item = m_mac->GetBEQueue ()->GetNextMpdu (peeked, txParams, Time::Min (), true);
200 
201  auto mpduList = mpduAggregator->GetNextAmpdu (item, txParams, Time::Min ());
202 
203  NS_TEST_EXPECT_MSG_EQ (mpduList.empty (), true, "a single packet should not result in an A-MPDU");
204 
205  // the packet has not been "transmitted", release its sequence number
206  m_mac->m_txMiddle->SetSequenceNumberFor (&item->GetHeader ());
207 
208  //-----------------------------------------------------------------------------------------------------
209 
210  /*
211  * Test behavior when 2 more packets are in the queue
212  */
213  Ptr<const Packet> pkt1 = Create<Packet> (1500);
214  Ptr<const Packet> pkt2 = Create<Packet> (1500);
215  WifiMacHeader hdr1, hdr2;
216 
217  hdr1.SetAddr1 (Mac48Address ("00:00:00:00:00:02"));
218  hdr1.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
219  hdr1.SetType (WIFI_MAC_QOSDATA);
220  hdr1.SetQosTid (0);
221 
222  hdr2.SetAddr1 (Mac48Address ("00:00:00:00:00:02"));
223  hdr2.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
224  hdr2.SetType (WIFI_MAC_QOSDATA);
225  hdr2.SetQosTid (0);
226 
227  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt1, hdr1));
228  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt2, hdr2));
229 
230  item = m_mac->GetBEQueue ()->GetNextMpdu (peeked, txParams, Time::Min (), true);
231  mpduList = mpduAggregator->GetNextAmpdu (item, txParams, Time::Min ());
232 
233  NS_TEST_EXPECT_MSG_EQ (mpduList.empty (), false, "MPDU aggregation failed");
234 
235  Ptr<WifiPsdu> psdu = Create<WifiPsdu> (mpduList);
236  htFem->DequeuePsdu (psdu);
237 
238  NS_TEST_EXPECT_MSG_EQ (psdu->GetSize (), 4606, "A-MPDU size is not correct");
239  NS_TEST_EXPECT_MSG_EQ (mpduList.size (), 3, "A-MPDU should contain 3 MPDUs");
240  NS_TEST_EXPECT_MSG_EQ (m_mac->GetBEQueue ()->GetWifiMacQueue ()->GetNPackets (), 0, "queue should be empty");
241 
242  for (uint32_t i = 0; i < psdu->GetNMpdus (); i++)
243  {
244  NS_TEST_EXPECT_MSG_EQ (psdu->GetHeader (i).GetSequenceNumber (), i, "wrong sequence number");
245  }
246 
247  //-----------------------------------------------------------------------------------------------------
248 
249  /*
250  * Test behavior when the 802.11n station and another non-QoS station are associated to the AP.
251  * The AP sends an A-MPDU to the 802.11n station followed by the last retransmission of a non-QoS data frame to the non-QoS station.
252  * This is used to reproduce bug 2224.
253  */
254  pkt1 = Create<Packet> (1500);
255  pkt2 = Create<Packet> (1500);
256  hdr1.SetAddr1 (Mac48Address ("00:00:00:00:00:02"));
257  hdr1.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
258  hdr1.SetType (WIFI_MAC_QOSDATA);
259  hdr1.SetQosTid (0);
260  hdr1.SetSequenceNumber (3);
261  hdr2.SetAddr1 (Mac48Address ("00:00:00:00:00:03"));
262  hdr2.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
263  hdr2.SetType (WIFI_MAC_QOSDATA);
264  hdr2.SetQosTid (0);
265 
266  Ptr<const Packet> pkt3 = Create<Packet> (1500);
267  WifiMacHeader hdr3;
268  hdr3.SetSequenceNumber (0);
269  hdr3.SetAddr1 (Mac48Address ("00:00:00:00:00:03"));
270  hdr3.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
271  hdr3.SetType (WIFI_MAC_QOSDATA);
272  hdr3.SetQosTid (0);
273 
274  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt1, hdr1));
275  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt2, hdr2));
276  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt3, hdr3));
277 
278  peeked = m_mac->GetBEQueue ()->PeekNextMpdu ();
279  txParams.Clear ();
280  txParams.m_txVector = m_mac->GetWifiRemoteStationManager ()->GetDataTxVector (peeked->GetHeader ());
281  item = m_mac->GetBEQueue ()->GetNextMpdu (peeked, txParams, Time::Min (), true);
282 
283  mpduList = mpduAggregator->GetNextAmpdu (item, txParams, Time::Min ());
284 
285  NS_TEST_EXPECT_MSG_EQ (mpduList.empty (), true, "a single packet for this destination should not result in an A-MPDU");
286  // dequeue the MPDU
287  htFem->DequeueMpdu (item);
288 
289  peeked = m_mac->GetBEQueue ()->PeekNextMpdu ();
290  txParams.Clear ();
291  txParams.m_txVector = m_mac->GetWifiRemoteStationManager ()->GetDataTxVector (peeked->GetHeader ());
292  item = m_mac->GetBEQueue ()->GetNextMpdu (peeked, txParams, Time::Min (), true);
293 
294  mpduList = mpduAggregator->GetNextAmpdu (item, txParams, Time::Min ());
295 
296  NS_TEST_EXPECT_MSG_EQ (mpduList.empty (), true, "no MPDU aggregation should be performed if there is no agreement");
297 
298  m_manager->SetMaxSsrc (0); //set to 0 in order to fake that the maximum number of retries has been reached
300  htFem->m_dcf = m_mac->GetBEQueue ();
301  htFem->NormalAckTimeout (item, txParams.m_txVector);
302 
303  NS_TEST_EXPECT_MSG_EQ (m_discarded, true, "packet should be discarded");
304  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Flush ();
305 
306  Simulator::Destroy ();
307 
308  m_manager->Dispose ();
309  m_manager = 0;
310 
311  m_device->Dispose ();
312  m_device = 0;
313 
314  htConfiguration = 0;
315 }
316 
324 {
325 public:
327 
328 private:
329  void DoRun (void) override;
335 };
336 
338  : TestCase ("Check the correctness of two-level aggregation operations")
339 {
340 }
341 
342 void
344 {
345  /*
346  * Create device and attach HT configuration.
347  */
348  m_device = CreateObject<WifiNetDevice> ();
350  Ptr<HtConfiguration> htConfiguration = CreateObject<HtConfiguration> ();
351  m_device->SetHtConfiguration (htConfiguration);
352 
353  /*
354  * Create and configure phy layer.
355  */
356  m_phy = CreateObject<YansWifiPhy> ();
357  Ptr<InterferenceHelper> interferenceHelper = CreateObject<InterferenceHelper> ();
358  m_phy->SetInterferenceHelper (interferenceHelper);
361  m_device->SetPhy (m_phy);
362 
363  /*
364  * Create and configure manager.
365  */
367  m_factory.SetTypeId ("ns3::ConstantRateWifiManager");
368  m_factory.Set ("DataMode", StringValue ("HtMcs7"));
372 
373  /*
374  * Create and configure mac layer.
375  */
376  m_mac = CreateObjectWithAttributes<StaWifiMac> ("QosSupported", BooleanValue (true));
379  m_mac->SetAddress (Mac48Address ("00:00:00:00:00:01"));
382  Ptr<WifiProtectionManager> protectionManager = CreateObject<WifiDefaultProtectionManager> ();
383  protectionManager->SetWifiMac (m_mac);
384  fem->SetProtectionManager (protectionManager);
385  Ptr<WifiAckManager> ackManager = CreateObject<WifiDefaultAckManager> ();
386  ackManager->SetWifiMac (m_mac);
387  fem->SetAckManager (ackManager);
389  m_device->SetMac (m_mac);
391 
392  /*
393  * Configure aggregation.
394  */
395  m_mac->SetAttribute ("BE_MaxAmsduSize", UintegerValue (4095));
396  m_mac->SetAttribute ("BE_MaxAmpduSize", UintegerValue (65535));
397  HtCapabilities htCapabilities;
398  htCapabilities.SetMaxAmsduLength (7935);
399  htCapabilities.SetMaxAmpduLength (65535);
400  m_manager->AddStationHtCapabilities (Mac48Address ("00:00:00:00:00:02"), htCapabilities);
401 
402  /*
403  * Create dummy packets of 1500 bytes and fill mac header fields that will be used for the tests.
404  */
405  Ptr<const Packet> pkt = Create<Packet> (1500);
406  WifiMacHeader hdr;
407  hdr.SetAddr1 (Mac48Address ("00:00:00:00:00:02"));
408  hdr.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
410  hdr.SetQosTid (0);
411 
412  //-----------------------------------------------------------------------------------------------------
413 
414  /*
415  * Test MSDU and MPDU aggregation. Three MSDUs are in the queue and the maximum A-MSDU size
416  * is such that only two MSDUs can be aggregated. Therefore, the first MPDU we get contains
417  * an A-MSDU of 2 MSDUs.
418  */
419  Ptr<HtFrameExchangeManager> htFem = DynamicCast<HtFrameExchangeManager> (fem);
420  Ptr<MsduAggregator> msduAggregator = htFem->GetMsduAggregator ();
421  Ptr<MpduAggregator> mpduAggregator = htFem->GetMpduAggregator ();
422 
423  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (Create<Packet> (1500), hdr));
424  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (Create<Packet> (1500), hdr));
425  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (Create<Packet> (1500), hdr));
426 
428  WifiTxParameters txParams;
429  txParams.m_txVector = m_mac->GetWifiRemoteStationManager ()->GetDataTxVector (peeked->GetHeader ());
430  htFem->TryAddMpdu (peeked, txParams, Time::Min ());
431  Ptr<WifiMacQueueItem> item = msduAggregator->GetNextAmsdu (peeked, txParams, Time::Min ());
432 
433  bool result = (item != 0);
434  NS_TEST_EXPECT_MSG_EQ (result, true, "aggregation failed");
435  NS_TEST_EXPECT_MSG_EQ (item->GetPacketSize (), 3030, "wrong packet size");
436 
437  // dequeue the MSDUs
438  htFem->DequeueMpdu (item);
439 
440  NS_TEST_EXPECT_MSG_EQ (m_mac->GetBEQueue ()->GetWifiMacQueue ()->GetNPackets (), 1,
441  "Unexpected number of MSDUs left in the EDCA queue");
442 
443  //-----------------------------------------------------------------------------------------------------
444 
445  /*
446  * A-MSDU aggregation fails when there is just one MSDU in the queue.
447  */
448 
449  peeked = m_mac->GetBEQueue ()->PeekNextMpdu ();
450  txParams.Clear ();
451  txParams.m_txVector = m_mac->GetWifiRemoteStationManager ()->GetDataTxVector (peeked->GetHeader ());
452  htFem->TryAddMpdu (peeked, txParams, Time::Min ());
453  item = msduAggregator->GetNextAmsdu (peeked, txParams, Time::Min ());
454 
455  NS_TEST_EXPECT_MSG_EQ ((item == 0), true, "A-MSDU aggregation did not fail");
456 
457  htFem->DequeueMpdu (peeked);
458 
459  NS_TEST_EXPECT_MSG_EQ (m_mac->GetBEQueue ()->GetWifiMacQueue ()->GetNPackets (), 0, "queue should be empty");
460 
461  //-----------------------------------------------------------------------------------------------------
462 
463  /*
464  * Aggregation of MPDUs is stopped to prevent that the PPDU duration exceeds the TXOP limit.
465  * In this test, the VI AC is used, which has a default TXOP limit of 3008 microseconds.
466  */
467 
468  // Establish agreement.
469  uint8_t tid = 5;
470  MgtAddBaRequestHeader reqHdr;
471  reqHdr.SetImmediateBlockAck ();
472  reqHdr.SetTid (tid);
473  reqHdr.SetBufferSize (64);
474  reqHdr.SetTimeout (0);
475  reqHdr.SetStartingSequence (0);
476  m_mac->GetVIQueue ()->GetBaManager ()->CreateAgreement (&reqHdr, hdr.GetAddr1 ());
477 
478  MgtAddBaResponseHeader respHdr;
479  StatusCode code;
480  code.SetSuccess ();
481  respHdr.SetStatusCode (code);
482  respHdr.SetAmsduSupport (reqHdr.IsAmsduSupported ());
483  respHdr.SetImmediateBlockAck ();
484  respHdr.SetTid (reqHdr.GetTid ());
485  respHdr.SetBufferSize (64);
486  respHdr.SetTimeout (reqHdr.GetTimeout ());
487  m_mac->GetVIQueue ()->GetBaManager ()->UpdateAgreement (&respHdr, hdr.GetAddr1 (), 0);
488 
489  m_mac->SetAttribute ("VI_MaxAmsduSize", UintegerValue (3050)); // max 2 MSDUs per A-MSDU
490  m_mac->SetAttribute ("VI_MaxAmpduSize", UintegerValue (65535));
491  m_manager->SetAttribute ("DataMode", StringValue ("HtMcs2")); // 19.5Mbps
492 
493  hdr.SetQosTid (tid);
494 
495  // Add 10 MSDUs to the EDCA queue
496  for (uint8_t i = 0; i < 10; i++)
497  {
498  m_mac->GetVIQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (Create<Packet> (1300), hdr));
499  }
500 
501  peeked = m_mac->GetVIQueue ()->PeekNextMpdu ();
502  txParams.Clear ();
503  txParams.m_txVector = m_mac->GetWifiRemoteStationManager ()->GetDataTxVector (peeked->GetHeader ());
504  Time txopLimit = m_mac->GetVIQueue ()->GetTxopLimit (); // 3.008 ms
505 
506  // Compute the first MPDU to be aggregated in an A-MPDU. It must contain an A-MSDU
507  // aggregating two MSDUs
508  item = m_mac->GetVIQueue ()->GetNextMpdu (peeked, txParams, txopLimit, true);
509 
510  NS_TEST_EXPECT_MSG_EQ (std::distance (item->begin (), item->end ()), 2, "There must be 2 MSDUs in the A-MSDU");
511 
512  auto mpduList = mpduAggregator->GetNextAmpdu (item, txParams, txopLimit);
513 
514  // The maximum number of bytes that can be transmitted in a TXOP is (approximately, as we
515  // do not consider that the preamble is transmitted at a different rate):
516  // 19.5 Mbps * 3.008 ms = 7332 bytes
517  // Given that the max A-MSDU size is set to 3050, an A-MSDU will contain two MSDUs and have
518  // a size of 2 * 1300 (MSDU size) + 2 * 14 (A-MSDU subframe header size) + 2 (one padding field) = 2630 bytes
519  // Hence, we expect that the A-MPDU will consist of:
520  // - 2 MPDUs containing each an A-MSDU. The size of each MPDU is 2630 (A-MSDU) + 30 (header+trailer) = 2660
521  // - 1 MPDU containing a single MSDU. The size of such MPDU is 1300 (MSDU) + 30 (header+trailer) = 1330
522  // The size of the A-MPDU is 4 + 2660 + 4 + 2660 + 4 + 1330 = 6662
523  NS_TEST_EXPECT_MSG_EQ (mpduList.empty (), false, "aggregation failed");
524  NS_TEST_EXPECT_MSG_EQ (mpduList.size (), 3, "Unexpected number of MPDUs in the A-MPDU");
525  NS_TEST_EXPECT_MSG_EQ (mpduList.at (0)->GetSize (), 2660, "Unexpected size of the first MPDU");
526  NS_TEST_EXPECT_MSG_EQ (mpduList.at (1)->GetSize (), 2660, "Unexpected size of the second MPDU");
527  NS_TEST_EXPECT_MSG_EQ (mpduList.at (2)->GetSize (), 1330, "Unexpected size of the first MPDU");
528 
529  Ptr<WifiPsdu> psdu = Create<WifiPsdu> (mpduList);
530  htFem->DequeuePsdu (psdu);
531 
532  NS_TEST_EXPECT_MSG_EQ (m_mac->GetVIQueue ()->GetWifiMacQueue ()->GetNPackets (), 5,
533  "Unexpected number of MSDUs left in the EDCA queue");
534 
535  NS_TEST_EXPECT_MSG_EQ (psdu->GetSize (), 6662, "Unexpected size of the A-MPDU");
536 
537  Simulator::Destroy ();
538 
539  m_device->Dispose ();
540  m_device = 0;
541  htConfiguration = 0;
542 }
543 
551 {
552 public:
554 
555 private:
556  void DoRun (void) override;
562  void DoRunSubTest (uint16_t bufferSize);
568 };
569 
571  : TestCase ("Check the correctness of 802.11ax aggregation operations")
572 {
573 }
574 
575 void
576 HeAggregationTest::DoRunSubTest (uint16_t bufferSize)
577 {
578  /*
579  * Create device and attach configurations.
580  */
581  m_device = CreateObject<WifiNetDevice> ();
582  Ptr<HtConfiguration> htConfiguration = CreateObject<HtConfiguration> ();
583  m_device->SetHtConfiguration (htConfiguration);
584  Ptr<VhtConfiguration> vhtConfiguration = CreateObject<VhtConfiguration> ();
585  m_device->SetVhtConfiguration (vhtConfiguration);
586  Ptr<HeConfiguration> heConfiguration = CreateObject<HeConfiguration> ();
587  m_device->SetHeConfiguration (heConfiguration);
588 
589  /*
590  * Create and configure phy layer.
591  */
592  m_phy = CreateObject<YansWifiPhy> ();
593  Ptr<InterferenceHelper> interferenceHelper = CreateObject<InterferenceHelper> ();
594  m_phy->SetInterferenceHelper (interferenceHelper);
597  m_device->SetPhy (m_phy);
598 
599  /*
600  * Create and configure manager.
601  */
603  m_factory.SetTypeId ("ns3::ConstantRateWifiManager");
604  m_factory.Set ("DataMode", StringValue ("HeMcs11"));
608 
609  /*
610  * Create and configure mac layer.
611  */
612  m_mac = CreateObjectWithAttributes<StaWifiMac> ("QosSupported", BooleanValue (true));
615  m_mac->SetAddress (Mac48Address ("00:00:00:00:00:01"));
618  Ptr<WifiProtectionManager> protectionManager = CreateObject<WifiDefaultProtectionManager> ();
619  protectionManager->SetWifiMac (m_mac);
620  fem->SetProtectionManager (protectionManager);
621  Ptr<WifiAckManager> ackManager = CreateObject<WifiDefaultAckManager> ();
622  ackManager->SetWifiMac (m_mac);
623  fem->SetAckManager (ackManager);
625  m_device->SetMac (m_mac);
627 
628  /*
629  * Configure aggregation.
630  */
631  HeCapabilities heCapabilities;
632  m_manager->AddStationHeCapabilities (Mac48Address ("00:00:00:00:00:02"), heCapabilities);
633 
634  /*
635  * Fill mac header fields.
636  */
637  WifiMacHeader hdr;
638  hdr.SetAddr1 (Mac48Address ("00:00:00:00:00:02"));
639  hdr.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
641  hdr.SetQosTid (0);
642  uint16_t sequence = m_mac->m_txMiddle->PeekNextSequenceNumberFor (&hdr);
643  hdr.SetSequenceNumber (sequence);
644  hdr.SetFragmentNumber (0);
645  hdr.SetNoMoreFragments ();
646  hdr.SetNoRetry ();
647 
648  /*
649  * Establish agreement.
650  */
651  MgtAddBaRequestHeader reqHdr;
652  reqHdr.SetImmediateBlockAck ();
653  reqHdr.SetTid (0);
654  reqHdr.SetBufferSize (bufferSize);
655  reqHdr.SetTimeout (0);
656  reqHdr.SetStartingSequence (0);
657  m_mac->GetBEQueue ()->GetBaManager ()->CreateAgreement (&reqHdr, hdr.GetAddr1 ());
658 
659  MgtAddBaResponseHeader respHdr;
660  StatusCode code;
661  code.SetSuccess ();
662  respHdr.SetStatusCode (code);
663  respHdr.SetAmsduSupport (reqHdr.IsAmsduSupported ());
664  respHdr.SetImmediateBlockAck ();
665  respHdr.SetTid (reqHdr.GetTid ());
666  respHdr.SetBufferSize (bufferSize);
667  respHdr.SetTimeout (reqHdr.GetTimeout ());
668  m_mac->GetBEQueue ()->GetBaManager ()->UpdateAgreement (&respHdr, hdr.GetAddr1 (), 0);
669 
670  /*
671  * Test behavior when 300 packets are ready for transmission but negociated buffer size is 64
672  */
673  Ptr<HtFrameExchangeManager> htFem = DynamicCast<HtFrameExchangeManager> (fem);
674  Ptr<MpduAggregator> mpduAggregator = htFem->GetMpduAggregator ();
675 
676  for (uint16_t i = 0; i < 300; i++)
677  {
678  Ptr<const Packet> pkt = Create<Packet> (100);
679  WifiMacHeader hdr;
680 
681  hdr.SetAddr1 (Mac48Address ("00:00:00:00:00:02"));
682  hdr.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
684  hdr.SetQosTid (0);
685 
686  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt, hdr));
687  }
688 
690  WifiTxParameters txParams;
691  txParams.m_txVector = m_mac->GetWifiRemoteStationManager ()->GetDataTxVector (peeked->GetHeader ());
692  Ptr<WifiMacQueueItem> item = m_mac->GetBEQueue ()->GetNextMpdu (peeked, txParams, Time::Min (), true);
693 
694  auto mpduList = mpduAggregator->GetNextAmpdu (item, txParams, Time::Min ());
695  Ptr<WifiPsdu> psdu = Create<WifiPsdu> (mpduList);
696  htFem->DequeuePsdu (psdu);
697 
698  NS_TEST_EXPECT_MSG_EQ (mpduList.empty (), false, "MPDU aggregation failed");
699  NS_TEST_EXPECT_MSG_EQ (mpduList.size (), bufferSize, "A-MPDU should countain " << bufferSize << " MPDUs");
700  uint16_t expectedRemainingPacketsInQueue = 300 - bufferSize;
701  NS_TEST_EXPECT_MSG_EQ (m_mac->GetBEQueue ()->GetWifiMacQueue ()->GetNPackets (), expectedRemainingPacketsInQueue, "queue should contain 300 - "<< bufferSize << " = "<< expectedRemainingPacketsInQueue << " packets");
702 
703  Simulator::Destroy ();
704 
705  m_manager->Dispose ();
706  m_manager = 0;
707 
708  m_device->Dispose ();
709  m_device = 0;
710 
711  htConfiguration = 0;
712  vhtConfiguration = 0;
713  heConfiguration = 0;
714 }
715 
716 void
718 {
719  DoRunSubTest (64);
720  DoRunSubTest (256);
721 }
722 
743 {
744 public:
746  virtual ~PreservePacketsInAmpdus ();
747 
748  void DoRun (void) override;
749 
750 
751 private:
752  std::list<Ptr<const Packet>> m_packetList;
753  std::vector<std::size_t> m_nMpdus;
754  std::vector<std::size_t> m_nMsdus;
755 
760  void NotifyMacTransmit (Ptr<const Packet> packet);
767  void NotifyPsduForwardedDown (WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW);
773 };
774 
776  : TestCase ("Test case to check that the Wifi Mac forwards up the same packets received at sender side.")
777 {
778 }
779 
781 {
782 }
783 
784 void
786 {
787  m_packetList.push_back (packet);
788 }
789 
790 void
792 {
793  NS_TEST_EXPECT_MSG_EQ ((psduMap.size () == 1 && psduMap.begin ()->first == SU_STA_ID),
794  true, "No DL MU PPDU expected");
795 
796  if (!psduMap[SU_STA_ID]->GetHeader (0).IsQosData ())
797  {
798  return;
799  }
800 
801  m_nMpdus.push_back (psduMap[SU_STA_ID]->GetNMpdus ());
802 
803  for (auto& mpdu : *PeekPointer (psduMap[SU_STA_ID]))
804  {
805  std::size_t dist = std::distance (mpdu->begin (), mpdu->end ());
806  // the list of aggregated MSDUs is empty if the MPDU includes a non-aggregated MSDU
807  m_nMsdus.push_back (dist > 0 ? dist : 1);
808  }
809 }
810 
811 void
813 {
814  auto it = std::find (m_packetList.begin (), m_packetList.end (), p);
815  NS_TEST_EXPECT_MSG_EQ ((it != m_packetList.end ()), true, "Packet being forwarded up not found");
816  m_packetList.erase (it);
817 }
818 
819 void
821 {
822  NodeContainer wifiStaNode;
823  wifiStaNode.Create (1);
824 
826  wifiApNode.Create (1);
827 
828  YansWifiChannelHelper channel = YansWifiChannelHelper::Default ();
830  phy.SetChannel (channel.Create ());
831 
833  wifi.SetStandard (WIFI_STANDARD_80211n);
834  wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
835 
837  Ssid ssid = Ssid ("ns-3-ssid");
838  mac.SetType ("ns3::StaWifiMac",
839  "BE_MaxAmsduSize", UintegerValue (4500),
840  "BE_MaxAmpduSize", UintegerValue (7500),
841  "Ssid", SsidValue (ssid),
842  /* setting blockack threshold for sta's BE queue */
843  "BE_BlockAckThreshold", UintegerValue (2),
844  "ActiveProbing", BooleanValue (false));
845 
847  staDevices = wifi.Install (phy, mac, wifiStaNode);
848 
849  mac.SetType ("ns3::ApWifiMac",
850  "Ssid", SsidValue (ssid),
851  "BeaconGeneration", BooleanValue (true));
852 
854  apDevices = wifi.Install (phy, mac, wifiApNode);
855 
857  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
858 
859  positionAlloc->Add (Vector (0.0, 0.0, 0.0));
860  positionAlloc->Add (Vector (1.0, 0.0, 0.0));
861  mobility.SetPositionAllocator (positionAlloc);
862 
863  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
864  mobility.Install (wifiApNode);
865  mobility.Install (wifiStaNode);
866 
867  Ptr<WifiNetDevice> ap_device = DynamicCast<WifiNetDevice> (apDevices.Get (0));
868  Ptr<WifiNetDevice> sta_device = DynamicCast<WifiNetDevice> (staDevices.Get (0));
869 
870  PacketSocketAddress socket;
871  socket.SetSingleDevice (sta_device->GetIfIndex ());
872  socket.SetPhysicalAddress (ap_device->GetAddress ());
873  socket.SetProtocol (1);
874 
875  // install packet sockets on nodes.
876  PacketSocketHelper packetSocket;
877  packetSocket.Install (wifiStaNode);
878  packetSocket.Install (wifiApNode);
879 
880  Ptr<PacketSocketClient> client = CreateObject<PacketSocketClient> ();
881  client->SetAttribute ("PacketSize", UintegerValue (1000));
882  client->SetAttribute ("MaxPackets", UintegerValue (8));
883  client->SetAttribute ("Interval", TimeValue (Seconds (1)));
884  client->SetRemote (socket);
885  wifiStaNode.Get (0)->AddApplication (client);
886  client->SetStartTime (Seconds (1));
887  client->SetStopTime (Seconds (3.0));
888  Simulator::Schedule (Seconds (1.5), &PacketSocketClient::SetAttribute, client,
889  "Interval", TimeValue (MicroSeconds (0)));
890 
891  Ptr<PacketSocketServer> server = CreateObject<PacketSocketServer> ();
892  server->SetLocal (socket);
893  wifiApNode.Get (0)->AddApplication (server);
894  server->SetStartTime (Seconds (0.0));
895  server->SetStopTime (Seconds (4.0));
896 
897  sta_device->GetMac ()->TraceConnectWithoutContext ("MacTx",
899  sta_device->GetPhy ()->TraceConnectWithoutContext ("PhyTxPsduBegin",
901  ap_device->GetMac ()->TraceConnectWithoutContext ("MacRx",
903 
904  Simulator::Stop (Seconds (5));
905  Simulator::Run ();
906 
907  Simulator::Destroy ();
908 
909  // Two packets are transmitted. The first one is an MPDU containing a single MSDU.
910  // The second one is an A-MPDU containing two MPDUs: the first MPDU contains 4 MSDUs
911  // and the second MPDU contains 3 MSDUs
912  NS_TEST_EXPECT_MSG_EQ (m_nMpdus.size (), 2, "Unexpected number of transmitted packets");
913  NS_TEST_EXPECT_MSG_EQ (m_nMsdus.size (), 3, "Unexpected number of transmitted MPDUs");
914  NS_TEST_EXPECT_MSG_EQ (m_nMpdus[0], 1, "Unexpected number of MPDUs in the first A-MPDU");
915  NS_TEST_EXPECT_MSG_EQ (m_nMsdus[0], 1, "Unexpected number of MSDUs in the first MPDU");
916  NS_TEST_EXPECT_MSG_EQ (m_nMpdus[1], 2, "Unexpected number of MPDUs in the second A-MPDU");
917  NS_TEST_EXPECT_MSG_EQ (m_nMsdus[1], 4, "Unexpected number of MSDUs in the second MPDU");
918  NS_TEST_EXPECT_MSG_EQ (m_nMsdus[2], 3, "Unexpected number of MSDUs in the third MPDU");
919  // All the packets must have been forwarded up at the receiver
920  NS_TEST_EXPECT_MSG_EQ (m_packetList.empty (), true, "Some packets have not been forwarded up");
921 }
922 
930 {
931 public:
933 };
934 
936  : TestSuite ("wifi-aggregation", UNIT)
937 {
938  AddTestCase (new AmpduAggregationTest, TestCase::QUICK);
939  AddTestCase (new TwoLevelAggregationTest, TestCase::QUICK);
940  AddTestCase (new HeAggregationTest, TestCase::QUICK);
941  AddTestCase (new PreservePacketsInAmpdus, TestCase::QUICK);
942 }
943 
#define Min(a, b)
Ampdu Aggregation Test.
bool m_discarded
whether the packet should be discarded
Ptr< YansWifiPhy > m_phy
Phy.
void MpduDiscarded(WifiMacDropReason reason, Ptr< const WifiMacQueueItem > mpdu)
Fired when the MAC discards an MPDU.
ObjectFactory m_factory
factory
void DoRun(void) override
Implementation to actually run this TestCase.
Ptr< WifiRemoteStationManager > m_manager
remote station manager
Ptr< WifiNetDevice > m_device
WifiNetDevice.
Ptr< StaWifiMac > m_mac
Mac.
802.11ax aggregation test which permits 64 or 256 MPDUs in A-MPDU according to the negociated buffer ...
void DoRunSubTest(uint16_t bufferSize)
Run test for a given buffer size.
Ptr< StaWifiMac > m_mac
Mac.
Ptr< WifiNetDevice > m_device
WifiNetDevice.
void DoRun(void) override
Implementation to actually run this TestCase.
ObjectFactory m_factory
factory
Ptr< WifiRemoteStationManager > m_manager
remote station manager
Ptr< YansWifiPhy > m_phy
Phy.
Test for A-MSDU and A-MPDU aggregation.
void DoRun(void) override
Implementation to actually run this TestCase.
void NotifyPsduForwardedDown(WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
Callback invoked when the sender MAC passes a PSDU(s) to the PHY.
std::list< Ptr< const Packet > > m_packetList
List of packets passed to the MAC.
std::vector< std::size_t > m_nMsdus
Number of MSDUs in MPDUs passed to the PHY.
std::vector< std::size_t > m_nMpdus
Number of MPDUs in PSDUs passed to the PHY.
void NotifyMacForwardUp(Ptr< const Packet > p)
Callback invoked when the receiver MAC forwards a packet up to the upper layer.
void NotifyMacTransmit(Ptr< const Packet > packet)
Callback invoked when an MSDU is passed to the MAC.
Two Level Aggregation Test.
Ptr< WifiRemoteStationManager > m_manager
remote station manager
Ptr< YansWifiPhy > m_phy
Phy.
ObjectFactory m_factory
factory
void DoRun(void) override
Implementation to actually run this TestCase.
Ptr< StaWifiMac > m_mac
Mac.
Ptr< WifiNetDevice > m_device
WifiNetDevice.
Wifi Aggregation Test Suite.
AttributeValue implementation for Boolean.
Definition: boolean.h:37
The IEEE 802.11ax HE Capabilities.
The HT Capabilities Information Element.
void SetMaxAmsduLength(uint16_t maxAmsduLength)
Set the maximum AMSDU length.
void SetMaxAmpduLength(uint32_t maxAmpduLength)
Set the maximum AMPDU length.
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:1018
uint16_t GetTimeout(void) const
Return the timeout.
void SetBufferSize(uint16_t size)
Set buffer size.
void SetImmediateBlockAck()
Enable immediate BlockAck.
bool IsAmsduSupported(void) const
Return whether A-MSDU capability is supported.
uint8_t GetTid(void) const
Return the Traffic ID (TID).
void SetTimeout(uint16_t timeout)
Set timeout.
void SetTid(uint8_t tid)
Set Traffic ID (TID).
void SetStartingSequence(uint16_t seq)
Set the starting sequence number.
Implement the header for management frames of type Add Block Ack response.
Definition: mgt-headers.h:1150
void SetTid(uint8_t tid)
Set Traffic ID (TID).
void SetTimeout(uint16_t timeout)
Set timeout.
void SetBufferSize(uint16_t size)
Set buffer size.
void SetStatusCode(StatusCode code)
Set the status code.
void SetAmsduSupport(bool supported)
Enable or disable A-MSDU support.
void SetImmediateBlockAck()
Enable immediate BlockAck.
Helper class used to assign positions and mobility models to nodes.
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
uint32_t AddApplication(Ptr< Application > application)
Associate an Application to this Node.
Definition: node.cc:159
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
Definition: object-base.cc:364
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:256
Instantiate subclasses of ns3::Object.
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
void Dispose(void)
Dispose of this Object.
Definition: object.cc:214
an address for a packet socket
void SetProtocol(uint16_t protocol)
Set the protocol.
void SetPhysicalAddress(const Address address)
Set the destination address.
void SetSingleDevice(uint32_t device)
Set the address to match only a specified NetDevice.
Give ns3::PacketSocket powers to ns3::Node.
void Install(Ptr< Node > node) const
Aggregate an instance of a ns3::PacketSocketFactory onto the provided node.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
Ptr< WifiMacQueueItem > GetNextMpdu(Ptr< const WifiMacQueueItem > peekedItem, WifiTxParameters &txParams, Time availableTime, bool initialFrame)
Prepare the frame to transmit starting from the MPDU that has been previously peeked by calling PeekN...
Definition: qos-txop.cc:443
Ptr< BlockAckManager > GetBaManager(void)
Get the Block Ack Manager associated with this QosTxop.
Definition: qos-txop.cc:243
Ptr< const WifiMacQueueItem > PeekNextMpdu(uint8_t tid=8, Mac48Address recipient=Mac48Address::GetBroadcast(), Ptr< const WifiMacQueueItem > item=nullptr)
Peek the next frame to transmit to the given receiver and of the given TID from the EDCA queue.
Definition: qos-txop.cc:357
The IEEE 802.11 SSID Information Element.
Definition: ssid.h:36
AttributeValue implementation for Ssid.
Definition: ssid.h:105
void SetState(MacState value)
Set the current MAC state.
void SetWifiPhy(const Ptr< WifiPhy > phy) override
Status code for association response.
Definition: status-code.h:32
void SetSuccess(void)
Set success bit to 0 (success).
Definition: status-code.cc:30
Hold variables of type string.
Definition: string.h:41
encapsulates test code
Definition: test.h:994
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:299
A suite of tests to run.
Definition: test.h:1188
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
AttributeValue implementation for Time.
Definition: nstime.h:1308
Ptr< WifiMacQueue > GetWifiMacQueue() const
Return the packet queue associated with this Txop.
Definition: txop.cc:154
Time GetTxopLimit(void) const
Return the TXOP limit.
Definition: txop.cc:280
Hold an unsigned integer type.
Definition: uinteger.h:44
helps to create WifiNetDevice objects
Definition: wifi-helper.h:274
Implements the IEEE 802.11 MAC header.
void SetNoRetry(void)
Un-set the Retry bit in the Frame Control field.
void SetNoMoreFragments(void)
Un-set the More Fragment bit in the Frame Control Field.
uint16_t GetSequenceNumber(void) const
Return the sequence number of the header.
void SetSequenceNumber(uint16_t seq)
Set the sequence number of the header.
void SetAddr1(Mac48Address address)
Fill the Address 1 field with the given address.
void SetType(WifiMacType type, bool resetToDsFromDs=true)
Set Type/Subtype values with the correct values depending on the given type.
void SetQosTid(uint8_t tid)
Set the TID for the QoS header.
Mac48Address GetAddr1(void) const
Return the address in the Address 1 field.
void SetAddr2(Mac48Address address)
Fill the Address 2 field with the given address.
void SetFragmentNumber(uint8_t frag)
Set the fragment number of the header.
create MAC layers for a ns3::WifiNetDevice.
Ptr< FrameExchangeManager > GetFrameExchangeManager(void) const
Get the Frame Exchange Manager.
Definition: wifi-mac.cc:744
virtual void SetAddress(Mac48Address address)
Definition: wifi-mac.cc:396
virtual void ConfigureStandard(WifiStandard standard)
Definition: wifi-mac.cc:650
Ptr< QosTxop > GetBEQueue(void) const
Accessor for the AC_BE channel access function.
Definition: wifi-mac.cc:485
Ptr< WifiRemoteStationManager > GetWifiRemoteStationManager(void) const
Definition: wifi-mac.cc:757
Ptr< QosTxop > GetVIQueue(void) const
Accessor for the AC_VI channel access function.
Definition: wifi-mac.cc:479
void SetWifiRemoteStationManager(Ptr< WifiRemoteStationManager > stationManager)
Definition: wifi-mac.cc:750
Ptr< MacTxMiddle > m_txMiddle
TX middle (aggregation etc.)
Definition: wifi-mac.h:520
void SetDevice(const Ptr< WifiNetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-mac.cc:384
void SetMac(const Ptr< WifiMac > mac)
void SetHeConfiguration(Ptr< HeConfiguration > heConfiguration)
void SetHtConfiguration(Ptr< HtConfiguration > htConfiguration)
Ptr< WifiMac > GetMac(void) const
Address GetAddress(void) const override
void SetVhtConfiguration(Ptr< VhtConfiguration > vhtConfiguration)
Ptr< WifiPhy > GetPhy(void) const
void SetRemoteStationManager(const Ptr< WifiRemoteStationManager > manager)
uint32_t GetIfIndex(void) const override
void SetStandard(WifiStandard standard)
Set the Wifi standard.
void SetPhy(const Ptr< WifiPhy > phy)
virtual void ConfigureStandard(WifiStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
Definition: wifi-phy.cc:835
void SetDevice(const Ptr< WifiNetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-phy.cc:535
uint32_t GetSize(void) const
Return the size of the PSDU in bytes.
Definition: wifi-psdu.cc:260
const WifiMacHeader & GetHeader(std::size_t i) const
Get the header of the i-th MPDU.
Definition: wifi-psdu.cc:266
std::size_t GetNMpdus(void) const
Return the number of MPDUs constituting the PSDU.
Definition: wifi-psdu.cc:319
hold a list of per-remote-station state.
WifiTxVector GetDataTxVector(const WifiMacHeader &header)
void AddStationHeCapabilities(Mac48Address from, HeCapabilities heCapabilities)
Records HE capabilities of the remote station.
void SetMaxSsrc(uint32_t maxSsrc)
Sets the maximum STA short retry count (SSRC).
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...
void AddStationHtCapabilities(Mac48Address from, HtCapabilities htCapabilities)
Records HT capabilities of the remote station.
This class stores the TX parameters (TX vector, protection mechanism, acknowledgment mechanism,...
void Clear(void)
Reset the TX parameters.
WifiTxVector m_txVector
TXVECTOR of the frame being prepared.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
manage and create wifi channel objects for the YANS model.
Make it easy to create and manage PHY objects for the YANS model.
void SetInterferenceHelper(const Ptr< InterferenceHelper > helper) override
Sets the interference helper.
@ ASSOCIATED
Definition: lr-wpan-mac.h:152
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Definition: test.h:240
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1260
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1244
WifiMacDropReason
The reason why an MPDU was dropped.
Definition: wifi-mac.h:66
@ WIFI_STANDARD_80211n
@ WIFI_STANDARD_80211ax
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
@ WIFI_MAC_QOSDATA
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Definition: callback.h:1648
U * PeekPointer(const Ptr< U > &p)
Definition: ptr.h:415
staDevices
Definition: third.py:103
ssid
Definition: third.py:100
channel
Definition: third.py:92
mac
Definition: third.py:99
wifi
Definition: third.py:96
apDevices
Definition: third.py:106
wifiApNode
Definition: third.py:90
mobility
Definition: third.py:108
phy
Definition: third.py:93
static WifiAggregationTestSuite g_wifiAggregationTestSuite
the test suite
#define SU_STA_ID
Definition: wifi-mode.h:32