wifi: (fixes #2468) Fix fragmentation rules for A-MPDU and HT transmissions
authorSébastien Deronne <sebastien.deronne@gmail.com>
Wed, 10 Aug 2016 20:51:54 +0200
changeset 12252 0abf417c0040
parent 12251 b7f2dfe39e02
child 12253 4128d362edc0
wifi: (fixes #2468) Fix fragmentation rules for A-MPDU and HT transmissions
RELEASE_NOTES
examples/wireless/simple-ht-hidden-stations.cc
src/wifi/model/edca-txop-n.cc
src/wifi/model/edca-txop-n.h
--- a/RELEASE_NOTES	Tue Aug 09 19:00:49 2016 -0700
+++ b/RELEASE_NOTES	Wed Aug 10 20:51:54 2016 +0200
@@ -90,6 +90,7 @@
 - Bug 2446 - Comma instead of pipe in Attributes
 - Bug 2351 - Wrong symbol rate calculation for channels with 10 and 5 Mhz width
 - Bug 2454 - DsrRouting::NotifyDataReceipt is also triggered for wifi management packets
+- Bug 2468 - Simulation with A-MPDU enabled hangs when fragmentation threshold is smaller than MSDU size
 
 Known issues
 ------------
--- a/examples/wireless/simple-ht-hidden-stations.cc	Tue Aug 09 19:00:49 2016 -0700
+++ b/examples/wireless/simple-ht-hidden-stations.cc	Wed Aug 10 20:51:54 2016 +0200
@@ -71,8 +71,6 @@
       Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue ("0"));
     }
 
-  Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", StringValue ("990000"));
-
   //Set the maximum size for A-MPDU with regards to the payload size
   maxAmpduSize = nMpdus * (payloadSize + 200);
 
--- a/src/wifi/model/edca-txop-n.cc	Tue Aug 09 19:00:49 2016 -0700
+++ b/src/wifi/model/edca-txop-n.cc	Wed Aug 10 20:51:54 2016 +0200
@@ -314,7 +314,7 @@
 }
 
 bool
-EdcaTxopN::GetBaAgreementExists (Mac48Address address, uint8_t tid)
+EdcaTxopN::GetBaAgreementExists (Mac48Address address, uint8_t tid) const
 {
   return m_baManager->ExistsAgreement (address, tid);
 }
@@ -717,7 +717,7 @@
 }
 
 uint8_t
-EdcaTxopN::GetCurrentTid ()
+EdcaTxopN::GetCurrentTid () const
 {
   NS_LOG_FUNCTION (this);
   if (m_currentHdr.IsQosData ())
@@ -1357,6 +1357,17 @@
 EdcaTxopN::NeedFragmentation (void) const
 {
   NS_LOG_FUNCTION (this);
+  if (m_stationManager->HasVhtSupported ()
+      || GetAmpduExist (m_currentHdr.GetAddr1 ())
+      || (m_stationManager->HasHtSupported ()
+      && m_currentHdr.IsQosData ()
+      && GetBaAgreementExists (m_currentHdr.GetAddr1 (), GetCurrentTid ())
+      && GetMpduAggregator ()->GetMaxAmpduSize () >= m_currentPacket->GetSize ()))
+    {
+      //MSDU is not fragmented when it is transmitted using an HT-immediate or
+      //HT-delayed Block Ack agreement or when it is carried in an A-MPDU.
+      return false;
+    }
   return m_stationManager->NeedFragmentation (m_currentHdr.GetAddr1 (), &m_currentHdr,
                                               m_currentPacket);
 }
@@ -1543,7 +1554,7 @@
     }
 }
 
-bool EdcaTxopN::GetAmpduExist (Mac48Address dest)
+bool EdcaTxopN::GetAmpduExist (Mac48Address dest) const
 {
   NS_LOG_FUNCTION (this << dest);
   if (m_aMpduEnabled.find (dest) != m_aMpduEnabled.end ())
--- a/src/wifi/model/edca-txop-n.h	Tue Aug 09 19:00:49 2016 -0700
+++ b/src/wifi/model/edca-txop-n.h	Wed Aug 10 20:51:54 2016 +0200
@@ -182,7 +182,7 @@
    * Checks if a block ack agreement exists with station addressed by
    * <i>recipient</i> for tid <i>tid</i>.
    */
-  bool GetBaAgreementExists (Mac48Address address, uint8_t tid);
+  bool GetBaAgreementExists (Mac48Address address, uint8_t tid) const;
   /**
    * \param recipient address of peer station involved in block ack mechanism.
    * \param tid traffic ID.
@@ -424,7 +424,7 @@
   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 (Mac48Address dest);
+  bool GetAmpduExist (Mac48Address dest) const;
   void SetAmpduExist (Mac48Address dest, bool enableAmpdu);
 
   /**
@@ -533,7 +533,7 @@
   /**
    * Get Traffic ID of the current packet.
    */
-  uint8_t GetCurrentTid ();
+  uint8_t GetCurrentTid () const;
   /*
    * Return the remaining duration in the current TXOP.
    *