introduce a low latency parameter for rate control algorithms
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Wed, 12 Dec 2007 12:03:38 +0100
changeset 2268 0e57ac711220
parent 2267 87dd46db981d
child 2269 06c660ffc070
introduce a low latency parameter for rate control algorithms
src/devices/wifi/arf-mac-stations.cc
src/devices/wifi/arf-mac-stations.h
src/devices/wifi/cr-mac-stations.cc
src/devices/wifi/cr-mac-stations.h
src/devices/wifi/dca-txop.cc
src/devices/wifi/dca-txop.h
src/devices/wifi/ideal-mac-stations.cc
src/devices/wifi/ideal-mac-stations.h
src/devices/wifi/mac-low.cc
src/devices/wifi/mac-low.h
src/devices/wifi/mac-stations.cc
src/devices/wifi/mac-stations.h
src/devices/wifi/wifi-default-parameters.cc
src/devices/wifi/wifi-default-parameters.h
src/devices/wifi/wifi-net-device.cc
--- a/src/devices/wifi/arf-mac-stations.cc	Wed Dec 12 09:33:22 2007 +0100
+++ b/src/devices/wifi/arf-mac-stations.cc	Wed Dec 12 12:03:38 2007 +0100
@@ -165,12 +165,12 @@
     }
 }
 WifiMode
-ArfMacStation::GetDataMode (uint32_t size)
+ArfMacStation::DoGetDataMode (uint32_t size)
 {
   return GetSupportedMode (m_rate);
 }
 WifiMode
-ArfMacStation::GetRtsMode (void)
+ArfMacStation::DoGetRtsMode (void)
 {
   // XXX: we could/should implement the Arf algorithm for
   // RTS only by picking a single rate within the BasicRateSet.
--- a/src/devices/wifi/arf-mac-stations.h	Wed Dec 12 09:33:22 2007 +0100
+++ b/src/devices/wifi/arf-mac-stations.h	Wed Dec 12 12:03:38 2007 +0100
@@ -63,11 +63,11 @@
   virtual void ReportDataFailed (void);
   virtual void ReportRtsOk (double ctsSnr, WifiMode ctsMode, double rtsSnr);
   virtual void ReportDataOk (double ackSnr, WifiMode ackMode, double dataSnr);
-  virtual WifiMode GetDataMode (uint32_t size);
-  virtual WifiMode GetRtsMode (void);
 
 private:
   virtual ArfMacStations *GetStations (void) const;
+  virtual WifiMode DoGetDataMode (uint32_t size);
+  virtual WifiMode DoGetRtsMode (void);
 
   uint32_t m_timer;
   uint32_t m_success;
--- a/src/devices/wifi/cr-mac-stations.cc	Wed Dec 12 09:33:22 2007 +0100
+++ b/src/devices/wifi/cr-mac-stations.cc	Wed Dec 12 12:03:38 2007 +0100
@@ -47,12 +47,12 @@
 CrMacStation::ReportDataOk (double ackSnr, WifiMode ackMode, double dataSnr)
 {}
 WifiMode 
-CrMacStation::GetDataMode (uint32_t size)
+CrMacStation::DoGetDataMode (uint32_t size)
 {
   return m_stations->GetDataMode ();
 }
 WifiMode 
-CrMacStation::GetRtsMode (void)
+CrMacStation::DoGetRtsMode (void)
 {
   return m_stations->GetCtlMode ();
 }
--- a/src/devices/wifi/cr-mac-stations.h	Wed Dec 12 09:33:22 2007 +0100
+++ b/src/devices/wifi/cr-mac-stations.h	Wed Dec 12 12:03:38 2007 +0100
@@ -54,18 +54,15 @@
   CrMacStation (CrMacStations *stations);
   virtual ~CrMacStation ();
 
-  WifiMode GetDataMode (void) const;
-  WifiMode GetCtlMode (void) const;
-
   virtual void ReportRxOk (double rxSnr, WifiMode txMode);
   virtual void ReportRtsFailed (void);
   virtual void ReportDataFailed (void);
   virtual void ReportRtsOk (double ctsSnr, WifiMode ctsMode, double rtsSnr);
   virtual void ReportDataOk (double ackSnr, WifiMode ackMode, double dataSnr);
-  virtual WifiMode GetDataMode (uint32_t size);
-  virtual WifiMode GetRtsMode (void);
 private:
   virtual CrMacStations *GetStations (void) const;
+  virtual WifiMode DoGetDataMode (uint32_t size);
+  virtual WifiMode DoGetRtsMode (void);
   CrMacStations *m_stations;
 };
 
--- a/src/devices/wifi/dca-txop.cc	Wed Dec 12 09:33:22 2007 +0100
+++ b/src/devices/wifi/dca-txop.cc	Wed Dec 12 12:03:38 2007 +0100
@@ -31,6 +31,8 @@
 #include "mac-low.h"
 #include "wifi-mac-queue.h"
 #include "mac-tx-middle.h"
+#include "wifi-mac-trailer.h"
+#include "mac-stations.h"
 #include "wifi-phy.h"
 #include "random-stream.h"
 
@@ -132,6 +134,11 @@
 {
   m_parameters = parameters;
 }
+void
+DcaTxop::SetStations (MacStations *stations)
+{
+  m_stations = stations;
+}
 void 
 DcaTxop::SetTxMiddle (MacTxMiddle *txMiddle)
 {
@@ -162,6 +169,10 @@
 void 
 DcaTxop::Queue (Ptr<const Packet> packet, WifiMacHeader const &hdr)
 {
+  WifiMacTrailer fcs;
+  uint32_t fullPacketSize = hdr.GetSerializedSize () + packet->GetSize () + fcs.GetSerializedSize ();
+  MacStation *station = m_stations->Lookup (hdr.GetAddr1 ());
+  station->PrepareForQueue (packet, fullPacketSize);
   m_queue->Enqueue (packet, hdr);
   StartAccessIfNeeded ();
 }
--- a/src/devices/wifi/dca-txop.h	Wed Dec 12 09:33:22 2007 +0100
+++ b/src/devices/wifi/dca-txop.h	Wed Dec 12 12:03:38 2007 +0100
@@ -38,6 +38,7 @@
 class MacParameters;
 class MacTxMiddle;
 class RandomStream;
+class MacStations;
 
 /**
  * \brief handle packet fragmentation and retransmissions.
@@ -80,6 +81,7 @@
 
   void SetLow (MacLow *low);
   void SetParameters (MacParameters *parameters);
+  void SetStations (MacStations *stations);
   void SetTxMiddle (MacTxMiddle *txMiddle);
   /**
    * \param callback the callback to invoke when a 
@@ -147,6 +149,7 @@
   WifiMacQueue *m_queue;
   MacTxMiddle *m_txMiddle;
   MacLow *m_low;
+  MacStations *m_stations;
   MacParameters *m_parameters;
   TransmissionListener *m_transmissionListener;
   RandomStream *m_rng;
--- a/src/devices/wifi/ideal-mac-stations.cc	Wed Dec 12 09:33:22 2007 +0100
+++ b/src/devices/wifi/ideal-mac-stations.cc	Wed Dec 12 12:03:38 2007 +0100
@@ -94,7 +94,7 @@
   m_lastSnr = dataSnr;
 }
 WifiMode
-IdealMacStation::GetDataMode (uint32_t size)
+IdealMacStation::DoGetDataMode (uint32_t size)
 {
   // We search within the Supported rate set the mode with the 
   // highest snr threshold possible which is smaller than m_lastSnr 
@@ -115,7 +115,7 @@
   return maxMode;
 }
 WifiMode
-IdealMacStation::GetRtsMode (void)
+IdealMacStation::DoGetRtsMode (void)
 {
   // We search within the Basic rate set the mode with the highest 
   // snr threshold possible which is smaller than m_lastSnr to 
--- a/src/devices/wifi/ideal-mac-stations.h	Wed Dec 12 09:33:22 2007 +0100
+++ b/src/devices/wifi/ideal-mac-stations.h	Wed Dec 12 12:03:38 2007 +0100
@@ -72,11 +72,12 @@
   virtual void ReportDataFailed (void);
   virtual void ReportRtsOk (double ctsSnr, WifiMode ctsMode, double rtsSnr);
   virtual void ReportDataOk (double ackSnr, WifiMode ackMode, double dataSnr);
-  virtual WifiMode GetDataMode (uint32_t size);
-  virtual WifiMode GetRtsMode (void);
 
 private:
   virtual IdealMacStations *GetStations (void) const;
+  virtual WifiMode DoGetDataMode (uint32_t size);
+  virtual WifiMode DoGetRtsMode (void);
+
   IdealMacStations *m_stations;
   double m_lastSnr;
 };
--- a/src/devices/wifi/mac-low.cc	Wed Dec 12 09:33:22 2007 +0100
+++ b/src/devices/wifi/mac-low.cc	Wed Dec 12 12:03:38 2007 +0100
@@ -366,7 +366,8 @@
 
   //NS_ASSERT (m_phy->IsStateIdle ());
 
-  MY_DEBUG ("startTx size="<< GetCurrentSize () << ", to=" << m_currentHdr.GetAddr1()<<", listener="<<m_listener);
+  MY_DEBUG ("startTx size="<< GetSize (m_currentPacket, &m_currentHdr) << 
+            ", to=" << m_currentHdr.GetAddr1()<<", listener="<<m_listener);
 
   if (m_txParams.MustSendRts ()) 
     {
@@ -597,21 +598,25 @@
   return m_parameters->GetCtsTimeout ();
 }
 uint32_t 
-MacLow::GetCurrentSize (void) const
+MacLow::GetSize (Ptr<const Packet> packet, const WifiMacHeader *hdr) const
 {
   WifiMacTrailer fcs;
-  return m_currentPacket->GetSize () + m_currentHdr.GetSize () + fcs.GetSerializedSize ();
+  return packet->GetSize () + hdr->GetSize () + fcs.GetSerializedSize ();
 }
 
 WifiMode
-MacLow::GetRtsTxMode (Mac48Address to) const
+MacLow::GetRtsTxMode (Ptr<const Packet> packet, const WifiMacHeader *hdr) const
 {
-  return GetStation (to)->GetRtsMode ();
+  Mac48Address to = hdr->GetAddr1 ();
+  return GetStation (to)->GetRtsMode (packet);
 }
 WifiMode
-MacLow::GetDataTxMode (Mac48Address to, uint32_t size) const
+MacLow::GetDataTxMode (Ptr<const Packet> packet, const WifiMacHeader *hdr) const
 {
-  return GetStation (to)->GetDataMode (size);
+  Mac48Address to = hdr->GetAddr1 ();
+  WifiMacTrailer fcs;
+  uint32_t size =  packet->GetSize () + hdr->GetSize () + fcs.GetSerializedSize ();
+  return GetStation (to)->GetDataMode (packet, size);
 }
 
 WifiMode
@@ -627,35 +632,38 @@
 
 
 Time
-MacLow::CalculateOverallTxTime (uint32_t dataSize, Mac48Address to, 
+MacLow::CalculateOverallTxTime (Ptr<const Packet> packet,
+                                WifiMacHeader const*hdr, 
                                 MacLowTransmissionParameters const& params) const
 {
   Time txTime = Seconds (0);
-  WifiMode rtsMode = GetRtsTxMode (to);
-  WifiMode dataMode = GetDataTxMode (to, dataSize);
+  WifiMode rtsMode = GetRtsTxMode (packet, hdr);
+  WifiMode dataMode = GetDataTxMode (packet, hdr);
   if (params.MustSendRts ()) 
     {
       txTime += m_phy->CalculateTxDuration (GetRtsSize (), rtsMode, WIFI_PREAMBLE_LONG);
-      txTime += GetCtsDuration (m_currentHdr.GetAddr1 (), rtsMode);
+      txTime += GetCtsDuration (hdr->GetAddr1 (), rtsMode);
       txTime += GetSifs () * Scalar (2);
     }
+  uint32_t dataSize = GetSize (packet, hdr);
   txTime += m_phy->CalculateTxDuration (dataSize, dataMode, WIFI_PREAMBLE_LONG);
   if (params.MustWaitAck ())
     {
       txTime += GetSifs ();
-      txTime += GetAckDuration (m_currentHdr.GetAddr1 (), dataMode);
+      txTime += GetAckDuration (hdr->GetAddr1 (), dataMode);
     }
   return txTime;
 }
 
 Time
-MacLow::CalculateTransmissionTime (uint32_t dataSize, Mac48Address to, 
+MacLow::CalculateTransmissionTime (Ptr<const Packet> packet,
+                                   WifiMacHeader const*hdr, 
                                    MacLowTransmissionParameters const& params) const
 {
-  Time txTime = CalculateOverallTxTime (dataSize, to, params);
+  Time txTime = CalculateOverallTxTime (packet, hdr, params);
   if (params.HasNextPacket ()) 
     {
-      WifiMode dataMode = GetDataTxMode (to, dataSize );
+      WifiMode dataMode = GetDataTxMode (packet, hdr);
       txTime += GetSifs ();
       txTime += m_phy->CalculateTxDuration (params.GetNextPacketSize (), dataMode, WIFI_PREAMBLE_LONG);
     }
@@ -833,7 +841,7 @@
   rts.SetDsNotTo ();
   rts.SetAddr1 (m_currentHdr.GetAddr1 ());
   rts.SetAddr2 (m_device->GetSelfAddress ());
-  WifiMode rtsTxMode = GetRtsTxMode (m_currentHdr.GetAddr1 ());
+  WifiMode rtsTxMode = GetRtsTxMode (m_currentPacket, &m_currentHdr);
   Time duration = Seconds (0);
   if (m_txParams.HasDurationId ()) 
     {
@@ -841,11 +849,12 @@
     } 
   else 
     {
-      WifiMode dataTxMode = GetDataTxMode (m_currentHdr.GetAddr1 (), GetCurrentSize ());
+      WifiMode dataTxMode = GetDataTxMode (m_currentPacket, &m_currentHdr);
       duration += GetSifs ();
       duration += GetCtsDuration (m_currentHdr.GetAddr1 (), rtsTxMode);
       duration += GetSifs ();
-      duration += m_phy->CalculateTxDuration (GetCurrentSize (), dataTxMode, WIFI_PREAMBLE_LONG);
+      duration += m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr), 
+                                              dataTxMode, WIFI_PREAMBLE_LONG);
       duration += GetSifs ();
       duration += GetAckDuration (m_currentHdr.GetAddr1 (), dataTxMode);
     }
@@ -868,8 +877,8 @@
 void
 MacLow::StartDataTxTimers (void)
 {
-  WifiMode dataTxMode = GetDataTxMode (m_currentHdr.GetAddr1 (), GetCurrentSize ());
-  Time txDuration = m_phy->CalculateTxDuration (GetCurrentSize (), dataTxMode, WIFI_PREAMBLE_LONG);
+  WifiMode dataTxMode = GetDataTxMode (m_currentPacket, &m_currentHdr);
+  Time txDuration = m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr), dataTxMode, WIFI_PREAMBLE_LONG);
   if (m_txParams.MustWaitNormalAck ()) 
     {
       Time timerDelay = txDuration + GetAckTimeout ();
@@ -908,7 +917,7 @@
   /* send this packet directly. No RTS is needed. */
   StartDataTxTimers ();
 
-  WifiMode dataTxMode = GetDataTxMode (m_currentHdr.GetAddr1 (), GetCurrentSize ());
+  WifiMode dataTxMode = GetDataTxMode (m_currentPacket, &m_currentHdr);
   Time duration = Seconds (0.0);
   if (m_txParams.HasDurationId ()) 
     {
@@ -1000,11 +1009,12 @@
   NS_ASSERT (m_currentPacket != 0);
   StartDataTxTimers ();
 
-  WifiMode dataTxMode = GetDataTxMode (m_currentHdr.GetAddr1 (), GetCurrentSize ());
+  WifiMode dataTxMode = GetDataTxMode (m_currentPacket, &m_currentHdr);
   Time newDuration = Seconds (0);
   newDuration += GetSifs ();
   newDuration += GetAckDuration (m_currentHdr.GetAddr1 (), dataTxMode);
-  Time txDuration = m_phy->CalculateTxDuration (GetCurrentSize (), dataTxMode, WIFI_PREAMBLE_LONG);
+  Time txDuration = m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr), 
+                                                dataTxMode, WIFI_PREAMBLE_LONG);
   duration -= txDuration;
   duration -= GetSifs ();
 
--- a/src/devices/wifi/mac-low.h	Wed Dec 12 09:33:22 2007 +0100
+++ b/src/devices/wifi/mac-low.h	Wed Dec 12 12:03:38 2007 +0100
@@ -305,8 +305,8 @@
    * This transmission time includes the time required for
    * the next packet transmission if one was selected.
    */
-  Time CalculateTransmissionTime (uint32_t payloadSize,
-                                  Mac48Address to,
+  Time CalculateTransmissionTime (Ptr<const Packet> packet,
+                                  WifiMacHeader const*hdr, 
                                   MacLowTransmissionParameters const&parameters) const;
 
   /**
@@ -350,16 +350,16 @@
   Time GetPifs (void) const;
   Time GetAckTimeout (void) const;
   Time GetCtsTimeout (void) const;
-  uint32_t GetCurrentSize (void) const;
+  uint32_t GetSize (Ptr<const Packet> packet, const WifiMacHeader *hdr) const;
   Time NowUs (void) const;
   MacStation *GetStation (Mac48Address to) const;
   void ForwardDown (Ptr<const Packet> packet, WifiMacHeader const *hdr, 
                     WifiMode txMode);
-  Time CalculateOverallTxTime (uint32_t size,
-                               Mac48Address to,
+  Time CalculateOverallTxTime (Ptr<const Packet> packet,
+                               WifiMacHeader const*hdr, 
                                MacLowTransmissionParameters const &params) const;
-  WifiMode GetRtsTxMode (Mac48Address to) const;
-  WifiMode GetDataTxMode (Mac48Address to, uint32_t size) const;
+  WifiMode GetRtsTxMode (Ptr<const Packet> packet, const WifiMacHeader *hdr) const;
+  WifiMode GetDataTxMode (Ptr<const Packet> packet, const WifiMacHeader *hdr) const;
   WifiMode GetCtsTxModeForRts (Mac48Address to, WifiMode rtsTxMode) const;
   WifiMode GetAckTxModeForData (Mac48Address to, WifiMode dataTxMode) const;
   Time GetCtsDuration (Mac48Address to, WifiMode rtsTxMode) const;
--- a/src/devices/wifi/mac-stations.cc	Wed Dec 12 09:33:22 2007 +0100
+++ b/src/devices/wifi/mac-stations.cc	Wed Dec 12 12:03:38 2007 +0100
@@ -19,8 +19,10 @@
  */
 
 #include "mac-stations.h"
+#include "wifi-default-parameters.h"
 #include "ns3/assert.h"
 #include "ns3/log.h"
+#include "ns3/tag.h"
 
 NS_LOG_COMPONENT_DEFINE ("MacStations");
 
@@ -42,10 +44,10 @@
   virtual void ReportDataFailed (void);
   virtual void ReportRtsOk (double ctsSnr, WifiMode ctsMode, double rtsSnr);
   virtual void ReportDataOk (double ackSnr, WifiMode ackMode, double dataSnr);
-  virtual WifiMode GetDataMode (uint32_t size);
-  virtual WifiMode GetRtsMode (void);
 private:
   virtual MacStations *GetStations (void) const;
+  virtual WifiMode DoGetDataMode (uint32_t size);
+  virtual WifiMode DoGetRtsMode (void);
   MacStations *m_stations;
 };
 
@@ -80,14 +82,14 @@
   NS_ASSERT (false);
 }
 WifiMode 
-NonUnicastMacStation::GetDataMode (uint32_t size)
+NonUnicastMacStation::DoGetDataMode (uint32_t size)
 {
   WifiMode mode = m_stations->GetBasicMode (0);
   NS_LOG_DEBUG ("non-unicast size="<<size<<", mode="<<mode);
   return mode;
 }
 WifiMode 
-NonUnicastMacStation::GetRtsMode (void)
+NonUnicastMacStation::DoGetRtsMode (void)
 {
   NS_ASSERT (false);
   // theoretically, no rts for broadcast/multicast packets.
@@ -106,7 +108,8 @@
 
 MacStations::MacStations (WifiMode defaultTxMode)
   : m_defaultTxMode (defaultTxMode),
-    m_nonUnicast (new NonUnicastMacStation (this))
+    m_nonUnicast (new NonUnicastMacStation (this)),
+    m_isLowLatency (WifiDefaultParameters::GetIsLowLatency ())
 {
   Reset ();
 }
@@ -198,11 +201,85 @@
 {
   return m_basicModes.end ();
 }
+bool
+MacStations::IsLowLatency (void) const
+{
+  return m_isLowLatency;
+}
 
 
 } // namespace ns3
 
 /***************************************************************
+ *           Packet Mode Tagger
+ ***************************************************************/ 
+
+namespace ns3 {
+
+class TxModeTag : public Tag
+{
+public:
+  TxModeTag ();
+  TxModeTag (WifiMode rtsMode, WifiMode dataMode);
+  WifiMode GetRtsMode (void) const;
+  WifiMode GetDataMode (void) const;
+
+  static uint32_t GetUid (void);
+  void Print (std::ostream &os) const;
+  void Serialize (ns3::Buffer::Iterator start) const;
+  uint32_t Deserialize (ns3::Buffer::Iterator start);
+  uint32_t GetSerializedSize (void) const;
+private:
+  WifiMode m_rtsMode;
+  WifiMode m_dataMode;
+};
+
+TxModeTag::TxModeTag ()
+{}
+TxModeTag::TxModeTag (WifiMode rtsMode, WifiMode dataMode)
+  : m_rtsMode (rtsMode),
+    m_dataMode (dataMode)
+{}
+WifiMode 
+TxModeTag::GetRtsMode (void) const
+{
+  return m_rtsMode;
+}
+WifiMode 
+TxModeTag::GetDataMode (void) const
+{
+  return m_dataMode;
+}
+
+uint32_t 
+TxModeTag::GetUid (void)
+{
+  static uint32_t uid = Tag::AllocateUid<TxModeTag> ("ns3.wifi.TxModeTag");
+  return uid;
+}
+void 
+TxModeTag::Print (std::ostream &os) const
+{
+  os << "rts="<<m_rtsMode<<" data="<<m_dataMode;
+}
+void 
+TxModeTag::Serialize (ns3::Buffer::Iterator start) const
+{}
+uint32_t 
+TxModeTag::Deserialize (ns3::Buffer::Iterator start)
+{
+  return 0;
+}
+uint32_t 
+TxModeTag::GetSerializedSize (void) const
+{
+  return 0;
+}
+
+} // namespace ns3
+
+
+/***************************************************************
  *           MacStation below.
  ***************************************************************/ 
 
@@ -345,6 +422,40 @@
   NS_ASSERT (i < m_modes.size ());
   return m_modes[i];
 }
+void 
+MacStation::PrepareForQueue (Ptr<const Packet> packet, uint32_t fullPacketSize)
+{
+  if (GetStations ()->IsLowLatency ())
+    {
+      return;
+    }
+  TxModeTag tag = TxModeTag (DoGetRtsMode (), DoGetDataMode (fullPacketSize));
+  packet->AddTag (tag);
+}
+WifiMode 
+MacStation::GetDataMode (Ptr<const Packet> packet, uint32_t fullPacketSize)
+{
+  if (GetStations ()->IsLowLatency ())
+    {
+      return DoGetDataMode (fullPacketSize);
+    }
+  TxModeTag tag;
+  bool found = packet->PeekTag (tag);
+  NS_ASSERT (found);
+  return tag.GetDataMode ();
+}
+WifiMode 
+MacStation::GetRtsMode (Ptr<const Packet> packet)
+{
+  if (GetStations ()->IsLowLatency ())
+    {
+      return DoGetRtsMode ();
+    }
+  TxModeTag tag;
+  bool found = packet->PeekTag (tag);
+  NS_ASSERT (found);
+  return tag.GetRtsMode ();
+}
 
 
 } // namespace ns3
--- a/src/devices/wifi/mac-stations.h	Wed Dec 12 09:33:22 2007 +0100
+++ b/src/devices/wifi/mac-stations.h	Wed Dec 12 12:03:38 2007 +0100
@@ -23,6 +23,7 @@
 #include <vector>
 #include <utility>
 #include "ns3/mac48-address.h"
+#include "ns3/packet.h"
 #include "wifi-mode.h"
 
 namespace ns3 {
@@ -56,6 +57,8 @@
   BasicModesIterator BeginBasicModes (void) const;
   BasicModesIterator EndBasicModes (void) const;
 
+  bool IsLowLatency (void) const;
+
   MacStation *Lookup (Mac48Address address);
   MacStation *LookupNonUnicast (void);
 private:
@@ -65,6 +68,7 @@
   WifiMode m_defaultTxMode;
   NonUnicastMacStation *m_nonUnicast;
   BasicModes m_basicModes;
+  bool m_isLowLatency;
 };
 
 } // namespace ns3
@@ -94,6 +98,10 @@
   void RecordGotAssocTxFailed (void);
   void RecordDisassociated (void);
 
+  void PrepareForQueue (Ptr<const Packet> packet, uint32_t fullPacketSize);
+  WifiMode GetDataMode (Ptr<const Packet> packet, uint32_t fullPacketSize);
+  WifiMode GetRtsMode (Ptr<const Packet> packet);
+
   // reception-related method
   virtual void ReportRxOk (double rxSnr, WifiMode txMode) = 0;
 
@@ -102,8 +110,6 @@
   virtual void ReportDataFailed (void) = 0;
   virtual void ReportRtsOk (double ctsSnr, WifiMode ctsMode, double rtsSnr) = 0;
   virtual void ReportDataOk (double ackSnr, WifiMode ackMode, double dataSnr) = 0;
-  virtual WifiMode GetDataMode (uint32_t size) = 0;
-  virtual WifiMode GetRtsMode (void) = 0;
 
   WifiMode GetCtsMode (WifiMode rtsMode);
   WifiMode GetAckMode (WifiMode dataMode);
@@ -111,6 +117,8 @@
 private:
   typedef std::vector<WifiMode> SupportedModes;
   virtual MacStations *GetStations (void) const = 0;
+  virtual WifiMode DoGetDataMode (uint32_t size) = 0;
+  virtual WifiMode DoGetRtsMode (void) = 0;
 protected:
   uint32_t GetNSupportedModes (void) const;
   WifiMode GetSupportedMode (uint32_t i) const;
--- a/src/devices/wifi/wifi-default-parameters.cc	Wed Dec 12 09:33:22 2007 +0100
+++ b/src/devices/wifi/wifi-default-parameters.cc	Wed Dec 12 12:03:38 2007 +0100
@@ -161,7 +161,10 @@
 ("WifiIdealRateControlBerThreshold",
  "The maximum Bit Error Rate acceptable at any transmission mode",
  10e-6);
-
+static BooleanDefaultValue g_isLowLatency
+("WifiMacPhyIsLowLatency",
+ "Is the communication latency between the MAC and PHY low ?",
+ true);
 
 
 uint32_t 
@@ -294,7 +297,11 @@
 {
   return Ssid (g_ssid.GetValue ().c_str ());
 }
-
+bool 
+GetIsLowLatency (void)
+{
+  return g_isLowLatency.GetValue ();
+}
 
 } // namespace WifiDefaultParameters
 
--- a/src/devices/wifi/wifi-default-parameters.h	Wed Dec 12 09:33:22 2007 +0100
+++ b/src/devices/wifi/wifi-default-parameters.h	Wed Dec 12 12:03:38 2007 +0100
@@ -75,6 +75,8 @@
 
 Ssid GetSsid (void);
 
+bool GetIsLowLatency (void);
+
 } // namespace WifiDefaultParameters
 
 } // namespace ns3
--- a/src/devices/wifi/wifi-net-device.cc	Wed Dec 12 09:33:22 2007 +0100
+++ b/src/devices/wifi/wifi-net-device.cc	Wed Dec 12 12:03:38 2007 +0100
@@ -264,6 +264,7 @@
   dca->SetParameters (m_parameters);
   dca->SetTxMiddle (m_txMiddle);
   dca->SetLow (m_low);
+  dca->SetStations (m_stations);
   dca->SetMaxQueueSize (400);
   dca->SetMaxQueueDelay (Seconds (10));
   return dca;