wifi: (fixes #2224) Replace m_ampduExist flag by a map of flags keyed on recipient address
--- a/RELEASE_NOTES Mon Feb 22 10:58:10 2016 +0100
+++ b/RELEASE_NOTES Mon Feb 22 10:58:12 2016 +0100
@@ -79,6 +79,7 @@
- Bug 2211 - Ipv{4,6}EndPoint can cause memory corruption
- Bug 2213 - Inconsistencies may exist between the selected WifiMacHelper and the chosen 802.11 version
- Bug 2219 - SixLowPanNetDevice hangs trying to decode a IPv6 Fragment extension header
+- Bug 2224 - scope of GetAmpduExist() in EdcaTxopN
- Bug 2233 - Implement RFC 1222 - Strong End System Model
- Bug 2234 - Ipv6L3Protocol should trash multicast packets not interesting for the node
- Bug 2238 - Ipv6 routing reorganization
--- a/src/wifi/model/edca-txop-n.cc Mon Feb 22 10:58:10 2016 +0100
+++ b/src/wifi/model/edca-txop-n.cc Mon Feb 22 10:58:12 2016 +0100
@@ -164,9 +164,9 @@
{
m_txop->CompleteAmpduTransfer (recipient, tid);
}
- virtual void SetAmpdu (bool ampdu)
+ virtual void SetAmpdu (Mac48Address dest, bool enableAmpdu)
{
- return m_txop->SetAmpduExist (ampdu);
+ return m_txop->SetAmpduExist (dest, enableAmpdu);
}
virtual void CompleteMpduTx (Ptr<const Packet> packet, WifiMacHeader hdr, Time tstamp)
{
@@ -245,8 +245,7 @@
m_msduAggregator (0),
m_mpduAggregator (0),
m_typeOfStation (STA),
- m_blockAckType (COMPRESSED_BLOCK_ACK),
- m_ampduExist (false)
+ m_blockAckType (COMPRESSED_BLOCK_ACK)
{
NS_LOG_FUNCTION (this);
m_transmissionListener = new EdcaTxopN::TransmissionListener (this);
@@ -610,7 +609,7 @@
params.DisableNextData ();
m_low->StartTransmission (m_currentPacket, &m_currentHdr,
params, m_transmissionListener);
- if (!GetAmpduExist ())
+ if (!GetAmpduExist (m_currentHdr.GetAddr1 ()))
{
CompleteTx ();
}
@@ -653,7 +652,7 @@
{
m_txFailedCallback (m_currentHdr);
}
- if (GetAmpduExist ())
+ if (GetAmpduExist (m_currentHdr.GetAddr1 ()))
{
m_low->FlushAggregateQueue ();
uint8_t tid = 0;
@@ -805,7 +804,7 @@
{
m_txFailedCallback (m_currentHdr);
}
- if (GetAmpduExist ())
+ if (GetAmpduExist (m_currentHdr.GetAddr1 ()))
{
uint8_t tid = 0;
if (m_currentHdr.IsQosData ())
@@ -868,7 +867,7 @@
NS_LOG_DEBUG ("missed block ack");
if (NeedBarRetransmission ())
{
- if (!GetAmpduExist ())
+ if (!GetAmpduExist (m_currentHdr.GetAddr1 ()))
{
//should i report this to station addressed by ADDR1?
NS_LOG_DEBUG ("Retransmit block ack request");
@@ -1250,14 +1249,27 @@
}
}
-bool EdcaTxopN::GetAmpduExist (void)
+bool EdcaTxopN::GetAmpduExist (Mac48Address dest)
{
- return m_ampduExist;
+ NS_LOG_FUNCTION (this << dest);
+ if (m_aMpduEnabled.find (dest) != m_aMpduEnabled.end ())
+ {
+ return m_aMpduEnabled.find (dest)->second;
+ }
+ return false;
}
-void EdcaTxopN::SetAmpduExist (bool ampdu)
+void EdcaTxopN::SetAmpduExist (Mac48Address dest, bool enableAmpdu)
{
- m_ampduExist = ampdu;
+ NS_LOG_FUNCTION (this << dest << enableAmpdu);
+ if (m_aMpduEnabled.find (dest) != m_aMpduEnabled.end () && m_aMpduEnabled.find (dest)->second != enableAmpdu)
+ {
+ m_aMpduEnabled.erase (m_aMpduEnabled.find (dest));
+ }
+ if (m_aMpduEnabled.find (dest) == m_aMpduEnabled.end ())
+ {
+ m_aMpduEnabled.insert (std::make_pair (dest, enableAmpdu));
+ }
}
void
--- a/src/wifi/model/edca-txop-n.h Mon Feb 22 10:58:10 2016 +0100
+++ b/src/wifi/model/edca-txop-n.h Mon Feb 22 10:58:12 2016 +0100
@@ -98,6 +98,8 @@
* packet transmission was failed.
*/
typedef Callback <void, const WifiMacHeader&> TxFailed;
+
+ std::map<Mac48Address, bool> m_aMpduEnabled;
static TypeId GetTypeId (void);
EdcaTxopN ();
@@ -413,8 +415,8 @@
void SetBlockAckInactivityTimeout (uint16_t timeout);
void SendDelbaFrame (Mac48Address addr, uint8_t tid, bool byOriginator);
void CompleteMpduTx (Ptr<const Packet> packet, WifiMacHeader hdr, Time tstamp);
- bool GetAmpduExist (void);
- void SetAmpduExist (bool ampdu);
+ bool GetAmpduExist (Mac48Address dest);
+ void SetAmpduExist (Mac48Address dest, bool enableAmpdu);
/**
* Return the next sequence number for the given header.
@@ -558,7 +560,6 @@
Time m_currentPacketTimestamp;
uint16_t m_blockAckInactivityTimeout;
struct Bar m_currentBar;
- bool m_ampduExist;
};
} //namespace ns3
--- a/src/wifi/model/mac-low.cc Mon Feb 22 10:58:10 2016 +0100
+++ b/src/wifi/model/mac-low.cc Mon Feb 22 10:58:12 2016 +0100
@@ -72,7 +72,7 @@
MacLowAggregationCapableTransmissionListener::~MacLowAggregationCapableTransmissionListener ()
{
}
-void MacLowAggregationCapableTransmissionListener::SetAmpdu (bool ampdu)
+void MacLowAggregationCapableTransmissionListener::SetAmpdu (Mac48Address dest, bool enableAmpdu)
{
}
void MacLowAggregationCapableTransmissionListener::CompleteTransfer (Mac48Address address, uint8_t tid)
@@ -3168,7 +3168,7 @@
newPacket = currentAggregatedPacket;
newPacket->AddPacketTag (ampdutag);
NS_LOG_DEBUG ("tx unicast A-MPDU");
- listenerIt->second->SetAmpdu (true);
+ listenerIt->second->SetAmpdu (hdr.GetAddr2 (), true);
}
else
{
@@ -3210,7 +3210,7 @@
newPacket->AddPacketTag (ampdutag);
NS_LOG_DEBUG ("tx unicast VHT single MPDU with sequence number " << hdr.GetSequenceNumber ());
- listenerIt->second->SetAmpdu (true);
+ listenerIt->second->SetAmpdu (hdr.GetAddr2 (), true);
}
}
}
--- a/src/wifi/model/mac-low.h Mon Feb 22 10:58:10 2016 +0100
+++ b/src/wifi/model/mac-low.h Mon Feb 22 10:58:12 2016 +0100
@@ -222,7 +222,7 @@
* of an A-MPDU with ImmediateBlockAck policy (i.e. no BAR is scheduled)
*/
virtual void CompleteTransfer (Mac48Address address, uint8_t tid);
- virtual void SetAmpdu (bool ampdu);
+ virtual void SetAmpdu (Mac48Address dest, bool enableAmpdu);
/**
* This function stores an MPDU (part of an A-MPDU) in blockackagreement (i.e. the sender is waiting
* for a blockack containing the sequence number of this MPDU).