# HG changeset patch # User Mathieu Lacage # Date 1197457418 -3600 # Node ID 0e57ac7112205b12a156cf7efa6b59fe2a55e9c5 # Parent 87dd46db981dfb1bccd0ef80bc8f7dbbeb287d65 introduce a low latency parameter for rate control algorithms diff -r 87dd46db981d -r 0e57ac711220 src/devices/wifi/arf-mac-stations.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. diff -r 87dd46db981d -r 0e57ac711220 src/devices/wifi/arf-mac-stations.h --- 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; diff -r 87dd46db981d -r 0e57ac711220 src/devices/wifi/cr-mac-stations.cc --- 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 (); } diff -r 87dd46db981d -r 0e57ac711220 src/devices/wifi/cr-mac-stations.h --- 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; }; diff -r 87dd46db981d -r 0e57ac711220 src/devices/wifi/dca-txop.cc --- 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 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 (); } diff -r 87dd46db981d -r 0e57ac711220 src/devices/wifi/dca-txop.h --- 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; diff -r 87dd46db981d -r 0e57ac711220 src/devices/wifi/ideal-mac-stations.cc --- 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 diff -r 87dd46db981d -r 0e57ac711220 src/devices/wifi/ideal-mac-stations.h --- 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; }; diff -r 87dd46db981d -r 0e57ac711220 src/devices/wifi/mac-low.cc --- 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="<GetBasicMode (0); NS_LOG_DEBUG ("non-unicast size="< packet, uint32_t fullPacketSize); + WifiMode GetDataMode (Ptr packet, uint32_t fullPacketSize); + WifiMode GetRtsMode (Ptr 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 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; diff -r 87dd46db981d -r 0e57ac711220 src/devices/wifi/wifi-default-parameters.cc --- 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 diff -r 87dd46db981d -r 0e57ac711220 src/devices/wifi/wifi-default-parameters.h --- 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 diff -r 87dd46db981d -r 0e57ac711220 src/devices/wifi/wifi-net-device.cc --- 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;