diff --git a/src/wifi/model/mac-low.cc b/src/wifi/model/mac-low.cc index 019a8e626..1a9f34940 100644 --- a/src/wifi/model/mac-low.cc +++ b/src/wifi/model/mac-low.cc @@ -563,10 +563,7 @@ MacLow::StartTransmission (Ptr packet, m_txParams.DisableRts (); } - if (m_currentHdr.IsMgt () - || (!m_currentHdr.IsQosData () - && !m_currentHdr.IsBlockAck () - && !m_currentHdr.IsBlockAckReq ())) + if (!m_currentHdr.IsQosData () || m_currentHdr.GetAddr1 ().IsBroadcast ()) { //This is mainly encountered when a higher priority control or management frame is //sent between A-MPDU transmissions. It avoids to unexpectedly flush the aggregate @@ -597,45 +594,106 @@ MacLow::StartTransmission (Ptr packet, //VHT/HE single MPDUs are followed by normal ACKs m_txParams.EnableAck (); } - AcIndex ac = QosUtilsMapTidToAc (GetTid (packet, *hdr)); Ptr aggregatedPacket = Create (); for (uint32_t i = 0; i < sentMpdus; i++) { - Ptr newPacket = (m_txPackets[GetTid (packet, *hdr)].at (i)->GetPacket ())->Copy (); - newPacket->AddHeader (m_txPackets[GetTid (packet, *hdr)].at (i)->GetHeader ()); - AddWifiMacTrailer (newPacket); - m_mpduAggregator->Aggregate (newPacket, aggregatedPacket, GetMaxAmpduSize (ac)); + Ptr newPacket; + newPacket = Create (m_txPackets[GetTid (packet, *hdr)].at (i)->GetPacket (), + m_txPackets[GetTid (packet, *hdr)].at (i)->GetHeader ()); + m_mpduAggregator->Aggregate (newPacket, aggregatedPacket, false); } m_currentPacket = aggregatedPacket; m_currentHdr = (m_txPackets[GetTid (packet, *hdr)].at (0)->GetHeader ()); m_currentTxVector = GetDataTxVector (m_currentPacket, &m_currentHdr); } - else + else if (m_mpduAggregator != 0) { //Perform MPDU aggregation if possible - m_ampdu = IsAmpdu (m_currentPacket, m_currentHdr); - if (m_ampdu) + uint8_t tid = GetTid (packet, *hdr); + Ptr qosTxop = m_edca.find (QosUtilsMapTidToAc (tid))->second; + std::vector> mpduList; + + mpduList = m_mpduAggregator->GetNextAmpdu (Create (m_currentPacket, m_currentHdr), + m_currentTxVector); + + if (mpduList.size () > 1) { - AmpduTag ampdu; - m_currentPacket->PeekPacketTag (ampdu); - if (ampdu.GetRemainingNbOfMpdus () > 0) + m_ampdu = true; + m_currentPacket = Create (); + + for (auto& mpdu : mpduList) { - AcIndex ac = QosUtilsMapTidToAc (GetTid (packet, *hdr)); - std::map >::const_iterator edcaIt = m_edca.find (ac); - if (edcaIt->second->GetBaBufferSize (m_currentHdr.GetAddr1 (), m_currentHdr.GetQosTid ()) > 64) + // Aggregate the MPDU to the A-MPDU + m_mpduAggregator->Aggregate (mpdu, m_currentPacket, false); + + // Store the MPDU in the aggregate queue + NS_LOG_DEBUG ("Adding packet with sequence number " << mpdu->GetHeader ().GetSequenceNumber () + << " to A-MPDU, packet size = " << mpdu->GetSize () + << ", A-MPDU size = " << m_currentPacket->GetSize ()); + m_aggregateQueue[tid]->Enqueue (mpdu); + + // Complete the processing of the MPDU + if (mpdu->GetHeader ().IsQosData ()) { - m_txParams.EnableExtendedCompressedBlockAck (); - } - else - { - m_txParams.EnableCompressedBlockAck (); + if (!m_txParams.MustSendRts ()) + { + qosTxop->CompleteMpduTx (mpdu); + } + else + { + InsertInTxQueue (mpdu, tid); + } } } - else if (m_currentHdr.IsQosData ()) + + // assume implicit block ack for now + qosTxop->CompleteAmpduTransfer (hdr->GetAddr1 (), tid); + + if (qosTxop->GetBaBufferSize (m_currentHdr.GetAddr1 (), m_currentHdr.GetQosTid ()) > 64) { - //VHT/HE single MPDUs are followed by normal ACKs - m_txParams.EnableAck (); + m_txParams.EnableExtendedCompressedBlockAck (); } + else + { + m_txParams.EnableCompressedBlockAck (); + } + + NS_LOG_DEBUG ("tx unicast A-MPDU containing " << mpduList.size () << " MPDUs"); + qosTxop->SetAmpduExist (hdr->GetAddr1 (), true); + } + else if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT + || m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HE) + { + // VHT/HE single MPDU + m_currentHdr.SetQosAckPolicy (WifiMacHeader::NORMAL_ACK); + + m_ampdu = true; + Ptr mpdu = Create (m_currentPacket, m_currentHdr); + m_currentPacket = Create (); + + m_mpduAggregator->Aggregate (mpdu, m_currentPacket, true); + + // Store the MPDU in the aggregate queue + NS_LOG_DEBUG ("Adding packet with sequence number " << mpdu->GetHeader ().GetSequenceNumber () + << " to S-MPDU, packet size = " << mpdu->GetSize () + << ", S-MPDU size = " << m_currentPacket->GetSize ()); + m_aggregateQueue[tid]->Enqueue (mpdu); + + // Complete the processing of the MPDU + if (m_txParams.MustSendRts ()) + { + InsertInTxQueue (mpdu, tid); + } + + if (qosTxop->GetBaAgreementEstablished (hdr->GetAddr1 (), tid)) + { + qosTxop->CompleteAmpduTransfer (hdr->GetAddr1 (), tid); + } + + //VHT/HE single MPDUs are followed by normal ACKs + m_txParams.EnableAck (); + NS_LOG_DEBUG ("tx unicast S-MPDU with sequence number " << hdr->GetSequenceNumber ()); + qosTxop->SetAmpduExist (hdr->GetAddr1 (), true); } else if (m_currentHdr.IsQosData () && !m_currentHdr.IsQosBlockAck () && !hdr->GetAddr1 ().IsGroup ()) { diff --git a/src/wifi/model/mac-low.h b/src/wifi/model/mac-low.h index 1fd2762ad..7da739c24 100644 --- a/src/wifi/model/mac-low.h +++ b/src/wifi/model/mac-low.h @@ -404,6 +404,7 @@ public: * * This function adds the packets that will be added to an A-MPDU to an aggregate queue * + * \todo TO BE REMOVED */ Ptr AggregateToAmpdu (Ptr packet, const WifiMacHeader hdr); /** @@ -453,6 +454,8 @@ public: * * \param ac the AC index * \return the maximum A-MSDU size (in bytes) + * + * \todo TO BE REMOVED */ uint16_t GetMaxAmsduSize (AcIndex ac) const; /** @@ -460,6 +463,8 @@ public: * * \param ac the AC index * \return the maximum A-MPDU size (in bytes) + * + * \todo TO BE REMOVED */ uint32_t GetMaxAmpduSize (AcIndex ac) const; @@ -526,6 +531,7 @@ private: * * This function decides if a given packet can be added to an A-MPDU or not * + * \todo TO BE REMOVED */ bool StopMpduAggregation (Ptr peekedPacket, WifiMacHeader peekedHdr, Ptr aggregatedPacket, uint8_t blockAckSize) const; /** @@ -891,6 +897,8 @@ private: * \param packet packet to check whether it can be aggregated in an A-MPDU * \param hdr 802.11 header for packet to check whether it can be aggregated in an A-MPDU * \returns true if is A-MPDU + * + * \todo TO BE REMOVED */ bool IsAmpdu (Ptr packet, const WifiMacHeader hdr); /** @@ -911,6 +919,8 @@ private: * \param blockAckSize size of the piggybacked block ack request * * \return the aggregate if MSDU aggregation succeeded, 0 otherwise + * + * \todo TO BE REMOVED */ Ptr PerformMsduAggregation (Ptr packet, WifiMacHeader *hdr, Time *tstamp, Ptr currentAmpduPacket, uint8_t blockAckSize); diff --git a/src/wifi/model/qos-txop.cc b/src/wifi/model/qos-txop.cc index fee67071b..da7473022 100644 --- a/src/wifi/model/qos-txop.cc +++ b/src/wifi/model/qos-txop.cc @@ -235,6 +235,7 @@ QosTxop::NotifyAccessGranted (void) return; } m_currentHdr = item->GetHeader (); + m_currentPacket = item->GetPacket (); m_currentPacketTimestamp = item->GetTimeStamp (); if (m_currentHdr.IsQosData () && !m_currentHdr.GetAddr1 ().IsBroadcast () && m_stationManager->GetQosSupported (m_currentHdr.GetAddr1 ()) @@ -244,7 +245,24 @@ QosTxop::NotifyAccessGranted (void) { return; } - item = m_queue->DequeueFirstAvailable (m_qosBlockedDestinations); + // Try A-MSDU aggregation + WifiTxVector txVector = m_low->GetDataTxVector (item->GetPacket (), &item->GetHeader ()); + item = 0; + if (m_low->GetMsduAggregator () != 0 && m_currentHdr.IsQosData () + && !m_currentHdr.GetAddr1 ().IsBroadcast () && !NeedFragmentation ()) + { + item = m_low->GetMsduAggregator ()->GetNextAmsdu (m_currentHdr.GetAddr1 (), + m_currentHdr.GetQosTid (), txVector); + } + if (item != 0) + { + NS_LOG_DEBUG ("tx unicast A-MSDU"); + } + else // dequeue the packet if aggregation was not attempted or failed + { + item = m_queue->DequeueFirstAvailable (m_qosBlockedDestinations); + } + NS_ASSERT (item != 0); m_currentPacket = item->GetPacket (); m_currentHdr = item->GetHeader (); m_currentPacketTimestamp = item->GetTimeStamp (); @@ -313,54 +331,6 @@ QosTxop::NotifyAccessGranted (void) else { m_currentIsFragmented = false; - WifiMacHeader peekedHdr; - Ptr item; - Ptr msduAggregator = GetLow ()->GetMsduAggregator (); - if (m_currentHdr.IsQosData () - && (item = m_queue->PeekByTidAndAddress (m_currentHdr.GetQosTid (), - m_currentHdr.GetAddr1 ())) - && !m_currentHdr.GetAddr1 ().IsBroadcast () - && msduAggregator != 0 && !m_currentHdr.IsRetry ()) - { - peekedHdr = item->GetHeader (); - /* here is performed aggregation */ - Ptr currentAggregatedPacket = Create (); - msduAggregator->Aggregate (m_currentPacket, currentAggregatedPacket, - MapSrcAddressForAggregation (peekedHdr), - MapDestAddressForAggregation (peekedHdr), - GetLow ()->GetMaxAmsduSize (QosUtilsMapTidToAc (m_currentHdr.GetQosTid ()))); - bool aggregated = false; - bool isAmsdu = false; - Ptr peekedItem = m_queue->PeekByTidAndAddress (m_currentHdr.GetQosTid (), - m_currentHdr.GetAddr1 ()); - while (peekedItem != 0) - { - peekedHdr = peekedItem->GetHeader (); - aggregated = msduAggregator->Aggregate (peekedItem->GetPacket (), currentAggregatedPacket, - MapSrcAddressForAggregation (peekedHdr), - MapDestAddressForAggregation (peekedHdr), - GetLow ()->GetMaxAmsduSize (QosUtilsMapTidToAc (m_currentHdr.GetQosTid ()))); - if (aggregated) - { - isAmsdu = true; - m_queue->Remove (peekedItem->GetPacket ()); - } - else - { - break; - } - peekedItem = m_queue->PeekByTidAndAddress (m_currentHdr.GetQosTid (), - m_currentHdr.GetAddr1 ()); - } - if (isAmsdu) - { - m_currentHdr.SetQosAmsdu (); - m_currentHdr.SetAddr3 (m_low->GetBssid ()); - m_currentPacket = currentAggregatedPacket; - currentAggregatedPacket = 0; - NS_LOG_DEBUG ("tx unicast A-MSDU"); - } - } m_currentParams.DisableNextData (); m_low->StartTransmission (m_currentPacket, &m_currentHdr, m_currentParams, this); if (!GetAmpduExist (m_currentHdr.GetAddr1 ())) diff --git a/src/wifi/test/wifi-aggregation-test.cc b/src/wifi/test/wifi-aggregation-test.cc index 258f91804..0497d7cd6 100644 --- a/src/wifi/test/wifi-aggregation-test.cc +++ b/src/wifi/test/wifi-aggregation-test.cc @@ -103,6 +103,10 @@ AmpduAggregationTest::DoRun (void) * Configure MPDU aggregation. */ m_mac->SetAttribute ("BE_MaxAmpduSize", UintegerValue (65535)); + HtCapabilities htCapabilities; + htCapabilities.SetMaxAmpduLength (65535); + m_manager->AddStationHtCapabilities (Mac48Address ("00:00:00:00:00:02"), htCapabilities); + m_manager->AddStationHtCapabilities (Mac48Address ("00:00:00:00:00:03"), htCapabilities); /* * Create a dummy packet of 1500 bytes and fill mac header fields. @@ -141,8 +145,9 @@ AmpduAggregationTest::DoRun (void) m_mac->GetBEQueue ()->GetLow ()->m_currentPacket = pkt->Copy (); m_mac->GetBEQueue ()->GetLow ()->m_currentTxVector = m_mac->GetBEQueue ()->GetLow ()->GetDataTxVector (m_mac->GetBEQueue ()->GetLow ()->m_currentPacket, &m_mac->GetBEQueue ()->GetLow ()->m_currentHdr); - bool isAmpdu = m_mac->GetBEQueue ()->GetLow ()->IsAmpdu (pkt, hdr); - NS_TEST_EXPECT_MSG_EQ (isAmpdu, false, "a single packet should not result in an A-MPDU"); + auto mpduList = m_mac->GetBEQueue ()->GetLow ()->GetMpduAggregator ()-> GetNextAmpdu (Create (pkt, hdr), + m_mac->GetBEQueue ()->GetLow ()->m_currentTxVector); + NS_TEST_EXPECT_MSG_EQ (mpduList.empty (), true, "a single packet should not result in an A-MPDU"); NS_TEST_EXPECT_MSG_EQ (m_mac->GetBEQueue ()->GetLow ()->m_aggregateQueue[0]->GetNPackets (), 0, "aggregation queue is not flushed"); //----------------------------------------------------------------------------------------------------- @@ -167,9 +172,19 @@ AmpduAggregationTest::DoRun (void) m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create (pkt1, hdr1)); m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create (pkt2, hdr2)); - isAmpdu = m_mac->GetBEQueue ()->GetLow ()->IsAmpdu (pkt, hdr); + mpduList = m_mac->GetBEQueue ()->GetLow ()->GetMpduAggregator ()-> GetNextAmpdu (Create (pkt, hdr), + m_mac->GetBEQueue ()->GetLow ()->m_currentTxVector); + m_mac->GetBEQueue ()->GetLow ()->m_currentPacket = Create (); + for (auto& mpdu : mpduList) + { + m_mac->GetBEQueue ()->GetLow ()->GetMpduAggregator ()->Aggregate (mpdu, + m_mac->GetBEQueue ()->GetLow ()->m_currentPacket, + false); + m_mac->GetBEQueue ()->GetLow ()->m_aggregateQueue[0]->Enqueue (Create (*mpdu)); + } + uint32_t aggregationQueueSize = m_mac->GetBEQueue ()->GetLow ()->m_aggregateQueue[0]->GetNPackets (); - NS_TEST_EXPECT_MSG_EQ (isAmpdu, true, "MPDU aggregation failed"); + NS_TEST_EXPECT_MSG_EQ (mpduList.empty (), false, "MPDU aggregation failed"); NS_TEST_EXPECT_MSG_EQ (m_mac->GetBEQueue ()->GetLow ()->m_currentPacket->GetSize (), 4606, "A-MPDU size is not correct"); NS_TEST_EXPECT_MSG_EQ (aggregationQueueSize, 3, "aggregation queue should not be empty"); NS_TEST_EXPECT_MSG_EQ (m_mac->GetBEQueue ()->GetWifiMacQueue ()->GetNPackets (), 0, "queue should be empty"); @@ -201,7 +216,7 @@ AmpduAggregationTest::DoRun (void) hdr1.SetSequenceNumber (3); hdr2.SetAddr1 (Mac48Address ("00:00:00:00:00:03")); hdr2.SetAddr2 (Mac48Address ("00:00:00:00:00:01")); - hdr2.SetType (WIFI_MAC_DATA); + hdr2.SetType (WIFI_MAC_QOSDATA); hdr2.SetQosTid (0); Ptr pkt3 = Create (1500); @@ -209,19 +224,21 @@ AmpduAggregationTest::DoRun (void) hdr3.SetSequenceNumber (0); hdr3.SetAddr1 (Mac48Address ("00:00:00:00:00:03")); hdr3.SetAddr2 (Mac48Address ("00:00:00:00:00:01")); - hdr3.SetType (WIFI_MAC_DATA); + hdr3.SetType (WIFI_MAC_QOSDATA); hdr3.SetQosTid (0); m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create (pkt3, hdr3)); - isAmpdu = m_mac->GetBEQueue ()->GetLow ()->IsAmpdu (pkt1, hdr1); - NS_TEST_EXPECT_MSG_EQ (isAmpdu, false, "a single packet for this destination should not result in an A-MPDU"); + mpduList = m_mac->GetBEQueue ()->GetLow ()->GetMpduAggregator ()-> GetNextAmpdu (Create (pkt1, hdr1), + m_mac->GetBEQueue ()->GetLow ()->m_currentTxVector); + NS_TEST_EXPECT_MSG_EQ (mpduList.empty (), true, "a single packet for this destination should not result in an A-MPDU"); NS_TEST_EXPECT_MSG_EQ (m_mac->GetBEQueue ()->GetLow ()->m_aggregateQueue[0]->GetNPackets (), 0, "aggregation queue is not flushed"); m_mac->GetBEQueue ()->m_currentHdr = hdr2; m_mac->GetBEQueue ()->m_currentPacket = pkt2->Copy (); - isAmpdu = m_mac->GetBEQueue ()->GetLow ()->IsAmpdu (pkt2, hdr2); - NS_TEST_EXPECT_MSG_EQ (isAmpdu, false, "no MPDU aggregation should be performed if there is no agreement"); + mpduList = m_mac->GetBEQueue ()->GetLow ()->GetMpduAggregator ()-> GetNextAmpdu (Create (pkt2, hdr2), + m_mac->GetBEQueue ()->GetLow ()->m_currentTxVector); + NS_TEST_EXPECT_MSG_EQ (mpduList.empty (), true, "no MPDU aggregation should be performed if there is no agreement"); NS_TEST_EXPECT_MSG_EQ (m_mac->GetBEQueue ()->GetLow ()->m_aggregateQueue[0]->GetNPackets (), 0, "aggregation queue is not flushed"); m_manager->SetMaxSsrc (0); //set to 0 in order to fake that the maximum number of retries has been reached @@ -310,6 +327,10 @@ TwoLevelAggregationTest::DoRun (void) */ m_mac->SetAttribute ("BE_MaxAmsduSize", UintegerValue (4095)); m_mac->SetAttribute ("BE_MaxAmpduSize", UintegerValue (65535)); + HtCapabilities htCapabilities; + htCapabilities.SetMaxAmsduLength (7935); + htCapabilities.SetMaxAmpduLength (65535); + m_manager->AddStationHtCapabilities (Mac48Address ("00:00:00:00:00:01"), htCapabilities); /* * Create dummy packets of 1500 bytes and fill mac header fields that will be used for the tests. @@ -326,7 +347,7 @@ TwoLevelAggregationTest::DoRun (void) //----------------------------------------------------------------------------------------------------- /* - * Test MSDU aggregation of two packets using MacLow::PerformMsduAggregation. + * Test MSDU aggregation of two packets using MsduAggregator::GetNextAmsdu. * It checks whether aggregation succeeded: * - returned packet should be different from 0; * - A-MSDU frame size should be 3030 bytes (= 2 packets + headers + padding); @@ -343,11 +364,13 @@ TwoLevelAggregationTest::DoRun (void) m_mac->GetBEQueue ()->GetLow ()->m_currentHdr = peekedHdr; m_mac->GetBEQueue ()->GetLow ()->m_currentTxVector = m_mac->GetBEQueue ()->GetLow ()->GetDataTxVector (m_mac->GetBEQueue ()->GetLow ()->m_currentPacket, &m_mac->GetBEQueue ()->GetLow ()->m_currentHdr); - Ptr packet = m_mac->GetBEQueue ()->GetLow ()->PerformMsduAggregation (peekedPacket, &peekedHdr, &tstamp, currentAggregatedPacket, 0); - - bool result = (packet != 0); + Ptr item; + item = m_mac->GetBEQueue ()->GetLow ()->GetMsduAggregator ()->GetNextAmsdu (hdr.GetAddr1 (), 0, + m_mac->GetBEQueue ()->GetLow ()->m_currentTxVector, + currentAggregatedPacket->GetSize ()); + bool result = (item != 0); NS_TEST_EXPECT_MSG_EQ (result, true, "aggregation failed"); - NS_TEST_EXPECT_MSG_EQ (packet->GetSize (), 3030, "wrong packet size"); + NS_TEST_EXPECT_MSG_EQ (item->GetPacket ()->GetSize (), 3030, "wrong packet size"); NS_TEST_EXPECT_MSG_EQ (m_mac->GetBEQueue ()->GetWifiMacQueue ()->GetNPackets (), 0, "aggregated packets not removed from the queue"); //----------------------------------------------------------------------------------------------------- @@ -355,14 +378,17 @@ TwoLevelAggregationTest::DoRun (void) /* * Aggregation is refused when the maximum size is reached. * It checks whether MSDU aggregation has been rejected because the maximum MPDU size is set to 0 (returned packet should be equal to 0). - * This test is needed to ensure that no packets are removed from the queue in MacLow::PerformMsduAggregation, since aggregation will no occur in MacLow::AggregateToAmpdu. + * This test is needed to ensure that no packets are removed from the queue in + * MsduAggregator::GetNextAmsdu, since aggregation will no occur in MacLow::AggregateToAmpdu. */ m_mac->SetAttribute ("BE_MaxAmpduSize", UintegerValue (65535)); m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create (pkt, hdr)); - packet = m_mac->GetBEQueue ()->GetLow ()->PerformMsduAggregation (peekedPacket, &peekedHdr, &tstamp, currentAggregatedPacket, 0); - result = (packet != 0); + item = m_mac->GetBEQueue ()->GetLow ()->GetMsduAggregator ()->GetNextAmsdu (hdr.GetAddr1 (), 0, + m_mac->GetBEQueue ()->GetLow ()->m_currentTxVector, + currentAggregatedPacket->GetSize ()); + result = (item != 0); NS_TEST_EXPECT_MSG_EQ (result, false, "maximum aggregated frame size check failed"); //----------------------------------------------------------------------------------------------------- @@ -376,9 +402,12 @@ TwoLevelAggregationTest::DoRun (void) m_mac->GetBEQueue ()->GetWifiMacQueue ()->Remove (pkt); m_mac->GetBEQueue ()->GetWifiMacQueue ()->Remove (pkt); - packet = m_mac->GetBEQueue ()->GetLow ()->PerformMsduAggregation (peekedPacket, &peekedHdr, &tstamp, currentAggregatedPacket, 0); - result = (packet != 0); + item = m_mac->GetBEQueue ()->GetLow ()->GetMsduAggregator ()->GetNextAmsdu (hdr.GetAddr1 (), 0, + m_mac->GetBEQueue ()->GetLow ()->m_currentTxVector, + currentAggregatedPacket->GetSize ()); + + result = (item != 0); NS_TEST_EXPECT_MSG_EQ (result, false, "aggregation failed to stop as queue is empty"); Simulator::Destroy (); @@ -457,6 +486,12 @@ HeAggregationTest::DoRunSubTest (uint16_t bufferSize) m_mac->ConfigureStandard (WIFI_PHY_STANDARD_80211ax_5GHZ); m_device->SetMac (m_mac); + /* + * Configure aggregation. + */ + HeCapabilities heCapabilities; + m_manager->AddStationHeCapabilities (Mac48Address ("00:00:00:00:00:02"), heCapabilities); + /* * Create a dummy packet of 100 bytes and fill mac header fields. */ @@ -508,8 +543,14 @@ HeAggregationTest::DoRunSubTest (uint16_t bufferSize) m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create (pkt, hdr)); } - bool isAmpdu = m_mac->GetBEQueue ()->GetLow ()->IsAmpdu (pkt, hdr); - NS_TEST_EXPECT_MSG_EQ (isAmpdu, true, "MPDU aggregation failed"); + auto mpduList = m_mac->GetBEQueue ()->GetLow ()->GetMpduAggregator ()-> GetNextAmpdu (Create (pkt, hdr), + m_mac->GetBEQueue ()->GetLow ()->m_currentTxVector); + for (auto& mpdu : mpduList) + { + m_mac->GetBEQueue ()->GetLow ()->m_aggregateQueue[0]->Enqueue (Create (*mpdu)); + } + + NS_TEST_EXPECT_MSG_EQ (mpduList.empty (), false, "MPDU aggregation failed"); uint32_t aggregationQueueSize = m_mac->GetBEQueue ()->GetLow ()->m_aggregateQueue[0]->GetNPackets (); NS_TEST_EXPECT_MSG_EQ (aggregationQueueSize, bufferSize, "aggregation queue should countain " << bufferSize << " MPDUs"); uint16_t expectedRemainingPacketsInQueue = 300 - bufferSize + 1;