introduce a low latency parameter for rate control algorithms
This commit is contained in:
@@ -165,12 +165,12 @@ void ArfMacStation::ReportDataOk (double ackSnr, WifiMode ackMode, double dataSn
|
||||
}
|
||||
}
|
||||
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.
|
||||
|
||||
@@ -63,11 +63,11 @@ public:
|
||||
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;
|
||||
|
||||
@@ -47,12 +47,12 @@ void
|
||||
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 ();
|
||||
}
|
||||
|
||||
@@ -54,18 +54,15 @@ public:
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
@@ -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 @@ DcaTxop::SetParameters (MacParameters *parameters)
|
||||
{
|
||||
m_parameters = parameters;
|
||||
}
|
||||
void
|
||||
DcaTxop::SetStations (MacStations *stations)
|
||||
{
|
||||
m_stations = stations;
|
||||
}
|
||||
void
|
||||
DcaTxop::SetTxMiddle (MacTxMiddle *txMiddle)
|
||||
{
|
||||
@@ -162,6 +169,10 @@ DcaTxop::SetMaxQueueDelay (Time delay)
|
||||
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 ();
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ class MacLow;
|
||||
class MacParameters;
|
||||
class MacTxMiddle;
|
||||
class RandomStream;
|
||||
class MacStations;
|
||||
|
||||
/**
|
||||
* \brief handle packet fragmentation and retransmissions.
|
||||
@@ -80,6 +81,7 @@ public:
|
||||
|
||||
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 @@ private:
|
||||
WifiMacQueue *m_queue;
|
||||
MacTxMiddle *m_txMiddle;
|
||||
MacLow *m_low;
|
||||
MacStations *m_stations;
|
||||
MacParameters *m_parameters;
|
||||
TransmissionListener *m_transmissionListener;
|
||||
RandomStream *m_rng;
|
||||
|
||||
@@ -94,7 +94,7 @@ IdealMacStation::ReportDataOk (double ackSnr, WifiMode ackMode, double dataSnr)
|
||||
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 @@ IdealMacStation::GetDataMode (uint32_t size)
|
||||
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
|
||||
|
||||
@@ -72,11 +72,12 @@ public:
|
||||
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;
|
||||
};
|
||||
|
||||
@@ -366,7 +366,8 @@ MacLow::StartTransmission (Ptr<const Packet> packet,
|
||||
|
||||
//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 @@ MacLow::GetCtsTimeout (void) const
|
||||
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 @@ MacLow::GetAckTxModeForData (Mac48Address to, WifiMode dataTxMode) const
|
||||
|
||||
|
||||
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 @@ MacLow::SendRtsForPacket (void)
|
||||
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 @@ MacLow::SendRtsForPacket (void)
|
||||
}
|
||||
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 @@ MacLow::SendRtsForPacket (void)
|
||||
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 @@ MacLow::SendDataPacket (void)
|
||||
/* 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 @@ MacLow::SendDataAfterCts (Mac48Address source, Time duration, WifiMode txMode)
|
||||
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 ();
|
||||
|
||||
|
||||
@@ -305,8 +305,8 @@ public:
|
||||
* 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¶meters) const;
|
||||
|
||||
/**
|
||||
@@ -350,16 +350,16 @@ private:
|
||||
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 ¶ms) 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;
|
||||
|
||||
@@ -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 @@ public:
|
||||
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 @@ NonUnicastMacStation::ReportDataOk (double ackSnr, WifiMode ackMode, double data
|
||||
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 @@ namespace ns3 {
|
||||
|
||||
MacStations::MacStations (WifiMode defaultTxMode)
|
||||
: m_defaultTxMode (defaultTxMode),
|
||||
m_nonUnicast (new NonUnicastMacStation (this))
|
||||
m_nonUnicast (new NonUnicastMacStation (this)),
|
||||
m_isLowLatency (WifiDefaultParameters::GetIsLowLatency ())
|
||||
{
|
||||
Reset ();
|
||||
}
|
||||
@@ -198,10 +201,84 @@ MacStations::EndBasicModes (void) const
|
||||
{
|
||||
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 @@ MacStation::GetSupportedMode (uint32_t i) const
|
||||
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
|
||||
|
||||
@@ -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 @@ public:
|
||||
BasicModesIterator BeginBasicModes (void) const;
|
||||
BasicModesIterator EndBasicModes (void) const;
|
||||
|
||||
bool IsLowLatency (void) const;
|
||||
|
||||
MacStation *Lookup (Mac48Address address);
|
||||
MacStation *LookupNonUnicast (void);
|
||||
private:
|
||||
@@ -65,6 +68,7 @@ private:
|
||||
WifiMode m_defaultTxMode;
|
||||
NonUnicastMacStation *m_nonUnicast;
|
||||
BasicModes m_basicModes;
|
||||
bool m_isLowLatency;
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
@@ -94,6 +98,10 @@ public:
|
||||
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 @@ public:
|
||||
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 @@ public:
|
||||
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;
|
||||
|
||||
@@ -161,7 +161,10 @@ static NumericDefaultValue<double> g_idealBer
|
||||
("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 @@ GetSsid (void)
|
||||
{
|
||||
return Ssid (g_ssid.GetValue ().c_str ());
|
||||
}
|
||||
|
||||
bool
|
||||
GetIsLowLatency (void)
|
||||
{
|
||||
return g_isLowLatency.GetValue ();
|
||||
}
|
||||
|
||||
} // namespace WifiDefaultParameters
|
||||
|
||||
|
||||
@@ -75,6 +75,8 @@ double GetPhyRxGainDb (void);
|
||||
|
||||
Ssid GetSsid (void);
|
||||
|
||||
bool GetIsLowLatency (void);
|
||||
|
||||
} // namespace WifiDefaultParameters
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -264,6 +264,7 @@ WifiNetDevice::CreateDca (uint32_t minCw, uint32_t maxCw, uint32_t aifsn) const
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user