From fab6e9f7efc43747d0bb12fbba61e75d16ad3ec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deronne?= Date: Tue, 1 Sep 2015 22:02:05 +0200 Subject: [PATCH] Fix issue when a normal data packet is sent between A-MPDUs --- src/wifi/model/edca-txop-n.cc | 2 +- src/wifi/model/mac-low.cc | 9 +++++++++ src/wifi/model/mac-low.h | 5 +++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/wifi/model/edca-txop-n.cc b/src/wifi/model/edca-txop-n.cc index 20e9e8663..c2e2053a2 100644 --- a/src/wifi/model/edca-txop-n.cc +++ b/src/wifi/model/edca-txop-n.cc @@ -1249,7 +1249,7 @@ EdcaTxopN::VerifyBlockAck (void) { m_baManager->SwitchToBlockAckIfNeeded (recipient, tid, sequence); } - if (m_baManager->ExistsAgreementInState (recipient, tid, OriginatorBlockAckAgreement::ESTABLISHED)) + if ((m_baManager->ExistsAgreementInState (recipient, tid, OriginatorBlockAckAgreement::ESTABLISHED)) && (m_low->GetMpduAggregator () == 0)) { m_currentHdr.SetQosAckPolicy (WifiMacHeader::BLOCK_ACK); } diff --git a/src/wifi/model/mac-low.cc b/src/wifi/model/mac-low.cc index a7d0815f7..402b8626d 100644 --- a/src/wifi/model/mac-low.cc +++ b/src/wifi/model/mac-low.cc @@ -2650,6 +2650,12 @@ MacLow::SetMpduAggregator (Ptr aggregator) m_mpduAggregator = aggregator; } +Ptr +MacLow::GetMpduAggregator (void) +{ + return m_mpduAggregator; +} + void MacLow::DeaggregateAmpduAndReceive (Ptr aggregatedPacket, double rxSnr, WifiTxVector txVector, WifiPreamble preamble) { @@ -2746,17 +2752,20 @@ MacLow::StopMpduAggregation (Ptr peekedPacket, WifiMacHeader peeke if (peekedPacket == 0) { + NS_LOG_DEBUG ("no more packets in queue"); return true; } //An HT STA shall not transmit a PPDU that has a duration that is greater than aPPDUMaxTime (10 milliseconds) if (m_phy->CalculateTxDuration (aggregatedPacket->GetSize () + peekedPacket->GetSize () + peekedHdr.GetSize () + WIFI_MAC_FCS_LENGTH, dataTxVector, preamble, m_phy->GetFrequency (), 0, 0) > MilliSeconds (10)) { + NS_LOG_DEBUG ("no more packets can be aggregated to satisfy PPDU <= aPPDUMaxTime"); return true; } if (!m_mpduAggregator->CanBeAggregated (peekedPacket->GetSize () + peekedHdr.GetSize () + WIFI_MAC_FCS_LENGTH, aggregatedPacket, size)) { + NS_LOG_DEBUG ("no more packets can be aggregated because the maximum A-MPDU size has been reached"); return true; } diff --git a/src/wifi/model/mac-low.h b/src/wifi/model/mac-low.h index 8d77eeb67..d38705a33 100644 --- a/src/wifi/model/mac-low.h +++ b/src/wifi/model/mac-low.h @@ -529,6 +529,11 @@ public: * \param aggregator MpduAggregator associated with this MacLow */ void SetMpduAggregator (Ptr aggregator); + /** + * + * \return the attached MpduAggregator + */ + Ptr GetMpduAggregator (void); /** * Set MAC address of this MacLow. *