wifi: No need to pass EifsNoDifs around
This commit is contained in:
@@ -94,8 +94,10 @@ AirtimeLinkMetricCalculator::CalculateMetric (Mac48Address peerAddress, Ptr<Mesh
|
||||
txVector.SetPreambleType (WIFI_PREAMBLE_LONG);
|
||||
//calculate metric
|
||||
uint32_t metric = (uint32_t)((double)( /*Overhead + payload*/
|
||||
mac->GetPifs () + mac->GetWifiPhy ()->GetSlot () + mac->GetEifsNoDifs () + //DIFS + SIFS + AckTxTime = PIFS + SLOT + EifsNoDifs
|
||||
mac->GetWifiPhy ()->CalculateTxDuration (m_testFrame->GetSize (), txVector, mac->GetWifiPhy ()->GetFrequency())
|
||||
//DIFS + SIFS + AckTxTime = 2 * SIFS + 2 * SLOT + AckTxTime
|
||||
2 * mac->GetWifiPhy ()->GetSifs () + 2 * mac->GetWifiPhy ()->GetSlot ()
|
||||
+ mac->GetWifiPhy ()->GetAckTxTime ()
|
||||
+ mac->GetWifiPhy ()->CalculateTxDuration (m_testFrame->GetSize (), txVector, mac->GetWifiPhy ()->GetFrequency())
|
||||
).GetMicroSeconds () / (10.24 * (1.0 - failAvg)));
|
||||
return metric;
|
||||
}
|
||||
|
||||
@@ -180,18 +180,10 @@ ChannelAccessManager::GetSifs (void) const
|
||||
return m_phy->GetSifs ();
|
||||
}
|
||||
|
||||
void
|
||||
ChannelAccessManager::SetEifsNoDifs (Time eifsNoDifs)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << eifsNoDifs);
|
||||
m_eifsNoDifs = eifsNoDifs;
|
||||
}
|
||||
|
||||
Time
|
||||
ChannelAccessManager::GetEifsNoDifs () const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_eifsNoDifs;
|
||||
return m_phy->GetSifs () + m_phy->GetAckTxTime ();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -413,7 +405,7 @@ ChannelAccessManager::GetAccessGrantStart (bool ignoreNav) const
|
||||
Time rxAccessStart = lastRxEnd + GetSifs ();
|
||||
if ((lastRxEnd <= Simulator::Now ()) && !m_lastRxReceivedOk)
|
||||
{
|
||||
rxAccessStart += m_eifsNoDifs;
|
||||
rxAccessStart += GetEifsNoDifs ();
|
||||
}
|
||||
Time busyAccessStart = m_lastBusyStart + m_lastBusyDuration + GetSifs ();
|
||||
Time txAccessStart = m_lastTxStart + m_lastTxDuration + GetSifs ();
|
||||
|
||||
@@ -73,19 +73,6 @@ public:
|
||||
*/
|
||||
void SetupLow (Ptr<MacLow> low);
|
||||
|
||||
/**
|
||||
* \param eifsNoDifs the duration of a EIFS minus the duration of DIFS.
|
||||
*
|
||||
* It is a bad idea to call this method after RequestAccess or
|
||||
* one of the Notify methods has been invoked.
|
||||
*/
|
||||
void SetEifsNoDifs (Time eifsNoDifs);
|
||||
|
||||
/**
|
||||
* \return value set previously using SetEifsNoDifs.
|
||||
*/
|
||||
Time GetEifsNoDifs (void) const;
|
||||
|
||||
/**
|
||||
* \param txop a new Txop.
|
||||
*
|
||||
@@ -292,6 +279,12 @@ private:
|
||||
* \return the slot duration
|
||||
*/
|
||||
virtual Time GetSlot (void) const;
|
||||
/**
|
||||
* Return the EIFS duration minus a DIFS.
|
||||
*
|
||||
* \return the EIFS duration minus a DIFS
|
||||
*/
|
||||
virtual Time GetEifsNoDifs (void) const;
|
||||
|
||||
/**
|
||||
* typedef for a vector of Txops
|
||||
|
||||
@@ -623,19 +623,6 @@ RegularWifiMac::SetCtsToSelfSupported (bool enable)
|
||||
m_low->SetCtsToSelfSupported (enable);
|
||||
}
|
||||
|
||||
void
|
||||
RegularWifiMac::SetEifsNoDifs (Time eifsNoDifs)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << eifsNoDifs);
|
||||
m_channelAccessManager->SetEifsNoDifs (eifsNoDifs);
|
||||
}
|
||||
|
||||
Time
|
||||
RegularWifiMac::GetEifsNoDifs (void) const
|
||||
{
|
||||
return m_channelAccessManager->GetEifsNoDifs ();
|
||||
}
|
||||
|
||||
void
|
||||
RegularWifiMac::SetRifs (Time rifs)
|
||||
{
|
||||
|
||||
@@ -54,7 +54,6 @@ public:
|
||||
virtual ~RegularWifiMac ();
|
||||
|
||||
// Implementations of pure virtual methods.
|
||||
void SetEifsNoDifs (Time eifsNoDifs);
|
||||
void SetPifs (Time pifs);
|
||||
void SetRifs (Time rifs);
|
||||
void SetShortSlotTimeSupported (bool enable);
|
||||
@@ -63,7 +62,6 @@ public:
|
||||
void SetPromisc (void);
|
||||
Time GetRifs (void) const;
|
||||
Time GetPifs (void) const;
|
||||
Time GetEifsNoDifs (void) const;
|
||||
bool GetShortSlotTimeSupported (void) const;
|
||||
Ssid GetSsid (void) const;
|
||||
Mac48Address GetAddress (void) const;
|
||||
|
||||
@@ -55,30 +55,12 @@ WifiMac::GetDefaultRifs (void)
|
||||
return MicroSeconds (2);
|
||||
}
|
||||
|
||||
Time
|
||||
WifiMac::GetDefaultEifsNoDifs (void)
|
||||
{
|
||||
return GetDefaultSifs () + GetDefaultCtsAckDelay ();
|
||||
}
|
||||
|
||||
Time
|
||||
WifiMac::GetDefaultCtsAckDelay (void)
|
||||
{
|
||||
//802.11-a specific: at 6 Mbit/s
|
||||
return MicroSeconds (44);
|
||||
}
|
||||
|
||||
TypeId
|
||||
WifiMac::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::WifiMac")
|
||||
.SetParent<Object> ()
|
||||
.SetGroupName ("Wifi")
|
||||
.AddAttribute ("EifsNoDifs", "The value of EIFS-DIFS.",
|
||||
TimeValue (GetDefaultEifsNoDifs ()),
|
||||
MakeTimeAccessor (&WifiMac::SetEifsNoDifs,
|
||||
&WifiMac::GetEifsNoDifs),
|
||||
MakeTimeChecker ())
|
||||
.AddAttribute ("Pifs", "The value of the PIFS constant.",
|
||||
TimeValue (GetDefaultSifs () + GetDefaultSlot ()),
|
||||
MakeTimeAccessor (&WifiMac::SetPifs,
|
||||
@@ -220,7 +202,6 @@ void
|
||||
WifiMac::Configure80211a (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
SetEifsNoDifs (MicroSeconds (16 + 44));
|
||||
SetPifs (MicroSeconds (16 + 9));
|
||||
}
|
||||
|
||||
@@ -228,7 +209,6 @@ void
|
||||
WifiMac::Configure80211b (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
SetEifsNoDifs (MicroSeconds (10 + 304));
|
||||
SetPifs (MicroSeconds (10 + 20));
|
||||
}
|
||||
|
||||
@@ -236,7 +216,6 @@ void
|
||||
WifiMac::Configure80211g (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
SetEifsNoDifs (MicroSeconds (10 + 304));
|
||||
SetPifs (MicroSeconds (10 + 20));
|
||||
}
|
||||
|
||||
@@ -244,7 +223,6 @@ void
|
||||
WifiMac::Configure80211_10Mhz (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
SetEifsNoDifs (MicroSeconds (32 + 88));
|
||||
SetPifs (MicroSeconds (32 + 13));
|
||||
}
|
||||
|
||||
@@ -252,7 +230,6 @@ void
|
||||
WifiMac::Configure80211_5Mhz (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
SetEifsNoDifs (MicroSeconds (64 + 176));
|
||||
SetPifs (MicroSeconds (64 + 21));
|
||||
}
|
||||
|
||||
|
||||
@@ -67,13 +67,6 @@ public:
|
||||
*/
|
||||
Ptr<NetDevice> GetDevice (void) const;
|
||||
|
||||
/**
|
||||
* \param eifsNoDifs the duration of an EIFS minus DIFS.
|
||||
*
|
||||
* This value is used to calculate the EIFS depending
|
||||
* on AIFSN.
|
||||
*/
|
||||
virtual void SetEifsNoDifs (Time eifsNoDifs) = 0;
|
||||
/**
|
||||
* \param pifs the PIFS duration.
|
||||
*/
|
||||
@@ -110,10 +103,6 @@ public:
|
||||
* \return the current PIFS duration.
|
||||
*/
|
||||
virtual Time GetPifs (void) const = 0;
|
||||
/**
|
||||
* \return the current EIFS minus DIFS duration
|
||||
*/
|
||||
virtual Time GetEifsNoDifs (void) const = 0;
|
||||
/**
|
||||
* \return the MAC address associated to this MAC layer.
|
||||
*/
|
||||
@@ -303,19 +292,6 @@ private:
|
||||
* Return a default RIFS value for 802.11n (2 microseconds).
|
||||
*/
|
||||
static Time GetDefaultRifs (void);
|
||||
/**
|
||||
* \return the default extended interframe space (EIFS) without
|
||||
* DCF interframe space (DIFS)
|
||||
*
|
||||
* Return default SIFS + default CTS-Ack delay
|
||||
*/
|
||||
static Time GetDefaultEifsNoDifs (void);
|
||||
/**
|
||||
* \return the default CTS-Ack delay
|
||||
*
|
||||
* Return a default value for 802.11a at 6Mbps (44 microseconds)
|
||||
*/
|
||||
static Time GetDefaultCtsAckDelay (void);
|
||||
|
||||
/**
|
||||
* \param standard the PHY standard to be used
|
||||
|
||||
@@ -174,6 +174,15 @@ public:
|
||||
{
|
||||
m_slot = slot;
|
||||
}
|
||||
/**
|
||||
* Set the duration of EIFS - DIFS
|
||||
*
|
||||
* \param eifsNoDifs the duration of EIFS - DIFS
|
||||
*/
|
||||
void SetEifsNoDifs (Time eifsNoDifs)
|
||||
{
|
||||
m_eifsNoDifs = eifsNoDifs;
|
||||
}
|
||||
|
||||
private:
|
||||
// Inherited from base class
|
||||
@@ -187,8 +196,14 @@ private:
|
||||
return m_slot;
|
||||
}
|
||||
|
||||
Time m_slot; // slot duration
|
||||
Time m_sifs; // SIFS duration
|
||||
Time GetEifsNoDifs (void) const
|
||||
{
|
||||
return m_eifsNoDifs;
|
||||
}
|
||||
|
||||
Time m_slot; // slot duration
|
||||
Time m_sifs; // SIFS duration
|
||||
Time m_eifsNoDifs; // EIFS duration minus a DIFS
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user