# HG changeset patch # User Mathieu Lacage # Date 1239953683 -7200 # Node ID 5327282789fc229e86dd3c7a534dd967316391c2 # Parent a74d21ce32982d5e13362ba0d5cb23bf72483006 cleanup a bit diff -r a74d21ce3298 -r 5327282789fc src/devices/wifi/aarfcd-wifi-manager.cc --- a/src/devices/wifi/aarfcd-wifi-manager.cc Fri Apr 17 09:23:50 2009 +0200 +++ b/src/devices/wifi/aarfcd-wifi-manager.cc Fri Apr 17 09:34:43 2009 +0200 @@ -31,21 +31,11 @@ NS_OBJECT_ENSURE_REGISTERED(AarfcdWifiManager); -AarfcdWifiRemoteStation::AarfcdWifiRemoteStation (Ptr manager, - int minTimerThreshold, - int minSuccessThreshold, - double successK, - int maxSuccessThreshold, - double timerK) +AarfcdWifiRemoteStation::AarfcdWifiRemoteStation (Ptr manager) : m_manager (manager) { - m_minTimerThreshold = minTimerThreshold; - m_timerTimeout = m_minTimerThreshold; - m_minSuccessThreshold = minSuccessThreshold; - m_successThreshold = m_minSuccessThreshold; - m_successK = successK; - m_maxSuccessThreshold = maxSuccessThreshold; - m_timerK = timerK; + m_timerTimeout = m_manager->m_minTimerThreshold; + m_successThreshold = m_manager->m_minSuccessThreshold; m_rate = GetMinRate (); m_success = 0; @@ -73,32 +63,20 @@ return 0; } -uint32_t -AarfcdWifiRemoteStation::GetMinTimerTimeout (void) -{ - return m_minTimerThreshold; -} - -uint32_t -AarfcdWifiRemoteStation::GetMinSuccessThreshold (void) -{ - return m_minSuccessThreshold; -} - void AarfcdWifiRemoteStation::ReportRecoveryFailure (void) { - SetSuccessThreshold ((int)(std::min ((uint32_t)(GetSuccessThreshold () * m_successK), - m_maxSuccessThreshold))); - SetTimerTimeout ((int)(std::max (GetMinTimerTimeout (), - (uint32_t)(GetSuccessThreshold () * m_timerK)))); + m_successThreshold = (int)(std::min ((uint32_t)(m_successThreshold * m_manager->m_successK), + m_manager->m_maxSuccessThreshold)); + m_timerTimeout = (int)(std::max (m_manager->m_minTimerThreshold, + (uint32_t)(m_successThreshold * m_manager->m_timerK))); } void AarfcdWifiRemoteStation::ReportFailure (void) { - SetTimerTimeout (GetMinTimerTimeout ()); - SetSuccessThreshold (GetMinSuccessThreshold ()); + m_timerTimeout = m_manager->m_minTimerThreshold; + m_successThreshold = m_manager->m_minSuccessThreshold; } bool @@ -195,7 +173,7 @@ { m_rate--; } - NS_LOG_INFO ("" << this << " JD rate=" << m_rate << " Sthr=" << GetSuccessThreshold ()); + NS_LOG_INFO ("" << this << " JD rate=" << m_rate << " Sthr=" << m_successTreshold); //printf ("%.9f %p DecreaseRateRecovery %d\n", Simulator::Now ().GetSeconds (),this, m_rate); } m_timer = 0; @@ -217,7 +195,7 @@ { m_rate--; } - NS_LOG_INFO ("" << this << " JD rate=" << m_rate << " Sthr=" << GetSuccessThreshold ()); + NS_LOG_INFO ("" << this << " JD rate=" << m_rate << " Sthr=" << m_successThreshold); //printf ("%.9f %p DecreaseRate %d\n", Simulator::Now ().GetSeconds (),this,m_rate); } if (m_retry >= 2) @@ -251,13 +229,13 @@ //printf ("%.9f %p Ok %d %d %d\n",Simulator::Now ().GetSeconds (),this,m_rate,m_timer,m_retry); //printf ("%p OK (m_success=%d, th=%d, m_rate=%d, maxRate=%d)\n",this,m_success,GetSuccessThreshold (), m_rate, GetMaxRate ()); NS_LOG_DEBUG ("self="<= GetTimerTimeout ()) + else if (m_success == m_successThreshold || + m_timer >= m_timerTimeout) { - NS_LOG_INFO ("" << this << " JI rate=" << m_rate << " Sthr=" << GetSuccessThreshold ()); + NS_LOG_INFO ("" << this << " JI rate=" << m_rate << " Sthr=" << m_successThreshold); } CheckRts (); } @@ -297,26 +275,6 @@ return GetSupportedMode (0); } -uint32_t -AarfcdWifiRemoteStation::GetTimerTimeout (void) -{ - return m_timerTimeout; -} -uint32_t -AarfcdWifiRemoteStation::GetSuccessThreshold (void) -{ - return m_successThreshold; -} -void -AarfcdWifiRemoteStation::SetTimerTimeout (uint32_t timerTimeout) -{ - m_timerTimeout = timerTimeout; -} -void -AarfcdWifiRemoteStation::SetSuccessThreshold (uint32_t successThreshold) -{ - m_successThreshold = successThreshold; -} Ptr AarfcdWifiRemoteStation::GetManager (void) const { @@ -446,12 +404,7 @@ WifiRemoteStation * AarfcdWifiManager::CreateStation (void) { - return new AarfcdWifiRemoteStation (this, - m_minTimerThreshold, - m_minSuccessThreshold, - m_successK, - m_maxSuccessThreshold, - m_timerK); + return new AarfcdWifiRemoteStation (this); } } // namespace ns3 diff -r a74d21ce3298 -r 5327282789fc src/devices/wifi/aarfcd-wifi-manager.h --- a/src/devices/wifi/aarfcd-wifi-manager.h Fri Apr 17 09:23:50 2009 +0200 +++ b/src/devices/wifi/aarfcd-wifi-manager.h Fri Apr 17 09:34:43 2009 +0200 @@ -50,12 +50,7 @@ class AarfcdWifiRemoteStation : public WifiRemoteStation { public: - AarfcdWifiRemoteStation (Ptr manager, - int minTimerThreshold, - int minSuccessThreshold, - double successK, - int maxSuccessThreshold, - double timerK); + AarfcdWifiRemoteStation (Ptr manager); virtual ~AarfcdWifiRemoteStation (); @@ -84,15 +79,6 @@ bool NeedRecoveryFallback (void); bool NeedNormalFallback (void); - - uint32_t GetTimerTimeout (void); - uint32_t GetSuccessThreshold (void); - uint32_t GetMinSuccessThreshold (void); - uint32_t GetMinTimerTimeout (void); - - void SetTimerTimeout (uint32_t timerTimeout); - void SetSuccessThreshold (uint32_t successThreshold); - uint32_t m_timer; uint32_t m_success; @@ -101,11 +87,6 @@ bool m_justModifyRate; uint32_t m_retry; - uint32_t m_minTimerThreshold; - uint32_t m_minSuccessThreshold; - double m_successK; - uint32_t m_maxSuccessThreshold; - double m_timerK; uint32_t m_successThreshold; uint32_t m_timerTimeout;