author | Tom Henderson <tomh@tomh.org> |
Fri, 27 Mar 2015 11:28:59 -0700 | |
changeset 11245 | 5c781d7e5a25 |
parent 11100 | 86e53d8a4cfe |
child 11450 | 9f4ae69f12b7 |
permissions | -rw-r--r-- |
7385
10beb0e53130
standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents:
7141
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
4334
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
2 |
/* |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
3 |
* Copyright (c) 2004,2005,2006 INRIA |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
4 |
* |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
4334
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
8 |
* |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
13 |
* |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
17 |
* |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
18 |
* Author: Federico Maguolo <maguolof@dei.unipd.it> |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
19 |
*/ |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
20 |
|
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
21 |
#include "aarfcd-wifi-manager.h" |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
22 |
#include "ns3/assert.h" |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
23 |
#include "ns3/log.h" |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
24 |
#include "ns3/simulator.h" |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
25 |
#include "ns3/boolean.h" |
6065 | 26 |
#include "ns3/double.h" |
27 |
#include "ns3/uinteger.h" |
|
4334
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
28 |
#include <algorithm> |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
29 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
30 |
#define Min(a,b) ((a < b) ? a : b) |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
31 |
#define Max(a,b) ((a > b) ? a : b) |
6065 | 32 |
|
10968
2d29fee2b7b8
[Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10652
diff
changeset
|
33 |
namespace ns3 { |
4334
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
34 |
|
10968
2d29fee2b7b8
[Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10652
diff
changeset
|
35 |
NS_LOG_COMPONENT_DEFINE ("Aarfcd"); |
4334
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
36 |
|
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10410
diff
changeset
|
37 |
/** |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10410
diff
changeset
|
38 |
* \brief hold per-remote-station state for AARF-CD Wifi manager. |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10410
diff
changeset
|
39 |
* |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10410
diff
changeset
|
40 |
* This struct extends from WifiRemoteStation struct to hold additional |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10410
diff
changeset
|
41 |
* information required by the AARF-CD Wifi manager |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10410
diff
changeset
|
42 |
*/ |
6065 | 43 |
struct AarfcdWifiRemoteStation : public WifiRemoteStation |
4334
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
44 |
{ |
6065 | 45 |
uint32_t m_timer; |
46 |
uint32_t m_success; |
|
47 |
uint32_t m_failed; |
|
48 |
bool m_recovery; |
|
49 |
bool m_justModifyRate; |
|
50 |
uint32_t m_retry; |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
51 |
|
6065 | 52 |
uint32_t m_successThreshold; |
53 |
uint32_t m_timerTimeout; |
|
4334
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
54 |
|
6065 | 55 |
uint32_t m_rate; |
56 |
bool m_rtsOn; |
|
57 |
uint32_t m_rtsWnd; |
|
58 |
uint32_t m_rtsCounter; |
|
59 |
bool m_haveASuccess; |
|
60 |
}; |
|
4334
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
61 |
|
10652
dc18deba4502
[doxygen] Revert r10410, r10411, r10412
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10483
diff
changeset
|
62 |
NS_OBJECT_ENSURE_REGISTERED (AarfcdWifiManager); |
4334
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
63 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
64 |
TypeId |
4334
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
65 |
AarfcdWifiManager::GetTypeId (void) |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
66 |
{ |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
67 |
static TypeId tid = TypeId ("ns3::AarfcdWifiManager") |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
68 |
.SetParent<WifiRemoteStationManager> () |
11245
5c781d7e5a25
SetGroupName for wifi module
Tom Henderson <tomh@tomh.org>
parents:
11100
diff
changeset
|
69 |
.SetGroupName ("Wifi") |
4334
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
70 |
.AddConstructor<AarfcdWifiManager> () |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
71 |
.AddAttribute ("SuccessK", "Multiplication factor for the success threshold in the AARF algorithm.", |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
72 |
DoubleValue (2.0), |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
73 |
MakeDoubleAccessor (&AarfcdWifiManager::m_successK), |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
74 |
MakeDoubleChecker<double> ()) |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
75 |
.AddAttribute ("TimerK", |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
76 |
"Multiplication factor for the timer threshold in the AARF algorithm.", |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
77 |
DoubleValue (2.0), |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
78 |
MakeDoubleAccessor (&AarfcdWifiManager::m_timerK), |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
79 |
MakeDoubleChecker<double> ()) |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
80 |
.AddAttribute ("MaxSuccessThreshold", |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
81 |
"Maximum value of the success threshold in the AARF algorithm.", |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
82 |
UintegerValue (60), |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
83 |
MakeUintegerAccessor (&AarfcdWifiManager::m_maxSuccessThreshold), |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
84 |
MakeUintegerChecker<uint32_t> ()) |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
85 |
.AddAttribute ("MinTimerThreshold", |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
86 |
"The minimum value for the 'timer' threshold in the AARF algorithm.", |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
87 |
UintegerValue (15), |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
88 |
MakeUintegerAccessor (&AarfcdWifiManager::m_minTimerThreshold), |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
89 |
MakeUintegerChecker<uint32_t> ()) |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
90 |
.AddAttribute ("MinSuccessThreshold", |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
91 |
"The minimum value for the success threshold in the AARF algorithm.", |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
92 |
UintegerValue (10), |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
93 |
MakeUintegerAccessor (&AarfcdWifiManager::m_minSuccessThreshold), |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
94 |
MakeUintegerChecker<uint32_t> ()) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
95 |
.AddAttribute ("MinRtsWnd", |
4334
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
96 |
"Minimum value for Rts window of Aarf-CD", |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
97 |
UintegerValue (1), |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
98 |
MakeUintegerAccessor (&AarfcdWifiManager::m_minRtsWnd), |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
99 |
MakeUintegerChecker<uint32_t> ()) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
100 |
.AddAttribute ("MaxRtsWnd", |
4334
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
101 |
"Maximum value for Rts window of Aarf-CD", |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
102 |
UintegerValue (40), |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
103 |
MakeUintegerAccessor (&AarfcdWifiManager::m_maxRtsWnd), |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
104 |
MakeUintegerChecker<uint32_t> ()) |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
105 |
.AddAttribute ("TurnOffRtsAfterRateDecrease", |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
106 |
"If true the RTS mechanism will be turned off when the rate will be decreased", |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
107 |
BooleanValue (true), |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
108 |
MakeBooleanAccessor (&AarfcdWifiManager::m_turnOffRtsAfterRateDecrease), |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
109 |
MakeBooleanChecker ()) |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
110 |
.AddAttribute ("TurnOnRtsAfterRateIncrease", |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
111 |
"If true the RTS mechanism will be turned on when the rate will be increased", |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
112 |
BooleanValue (true), |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
113 |
MakeBooleanAccessor (&AarfcdWifiManager::m_turnOnRtsAfterRateIncrease), |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
114 |
MakeBooleanChecker ()) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
115 |
; |
4334
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
116 |
return tid; |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
117 |
} |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
118 |
AarfcdWifiManager::AarfcdWifiManager () |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
119 |
: WifiRemoteStationManager () |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
120 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
121 |
NS_LOG_FUNCTION (this); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
122 |
} |
4334
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
123 |
AarfcdWifiManager::~AarfcdWifiManager () |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
124 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
125 |
NS_LOG_FUNCTION (this); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
126 |
} |
4334
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
127 |
WifiRemoteStation * |
6065 | 128 |
AarfcdWifiManager::DoCreateStation (void) const |
4334
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
129 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
130 |
NS_LOG_FUNCTION (this); |
6065 | 131 |
AarfcdWifiRemoteStation *station = new AarfcdWifiRemoteStation (); |
132 |
||
133 |
// aarf fields below |
|
134 |
station->m_successThreshold = m_minSuccessThreshold; |
|
135 |
station->m_timerTimeout = m_minTimerThreshold; |
|
136 |
station->m_rate = 0; |
|
137 |
station->m_success = 0; |
|
138 |
station->m_failed = 0; |
|
139 |
station->m_recovery = false; |
|
140 |
station->m_retry = 0; |
|
141 |
station->m_timer = 0; |
|
142 |
||
143 |
// aarf-cd specific fields below |
|
144 |
station->m_rtsOn = false; |
|
145 |
station->m_rtsWnd = m_minRtsWnd; |
|
146 |
station->m_rtsCounter = 0; |
|
147 |
station->m_justModifyRate = true; |
|
148 |
station->m_haveASuccess = false; |
|
149 |
||
150 |
return station; |
|
4334
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
151 |
} |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
152 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
153 |
void |
6065 | 154 |
AarfcdWifiManager::DoReportRtsFailed (WifiRemoteStation *station) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
155 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
156 |
NS_LOG_FUNCTION (this << station); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
157 |
} |
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10410
diff
changeset
|
158 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
159 |
void |
6065 | 160 |
AarfcdWifiManager::DoReportDataFailed (WifiRemoteStation *st) |
161 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
162 |
NS_LOG_FUNCTION (this << st); |
6065 | 163 |
AarfcdWifiRemoteStation *station = (AarfcdWifiRemoteStation *)st; |
164 |
station->m_timer++; |
|
165 |
station->m_failed++; |
|
166 |
station->m_retry++; |
|
167 |
station->m_success = 0; |
|
168 |
||
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
169 |
if (!station->m_rtsOn) |
6065 | 170 |
{ |
171 |
TurnOnRts (station); |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
172 |
if (!station->m_justModifyRate && !station->m_haveASuccess) |
6065 | 173 |
{ |
174 |
IncreaseRtsWnd (station); |
|
175 |
} |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
176 |
else |
6065 | 177 |
{ |
178 |
ResetRtsWnd (station); |
|
179 |
} |
|
180 |
station->m_rtsCounter = station->m_rtsWnd; |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
181 |
if (station->m_retry >= 2) |
6065 | 182 |
{ |
183 |
station->m_timer = 0; |
|
184 |
} |
|
185 |
} |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
186 |
else if (station->m_recovery) |
6065 | 187 |
{ |
188 |
NS_ASSERT (station->m_retry >= 1); |
|
189 |
station->m_justModifyRate = false; |
|
190 |
station->m_rtsCounter = station->m_rtsWnd; |
|
191 |
if (station->m_retry == 1) |
|
192 |
{ |
|
193 |
// need recovery fallback |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
194 |
if (m_turnOffRtsAfterRateDecrease) |
6065 | 195 |
{ |
196 |
TurnOffRts (station); |
|
197 |
} |
|
198 |
station->m_justModifyRate = true; |
|
199 |
station->m_successThreshold = (int)(Min (station->m_successThreshold * m_successK, |
|
200 |
m_maxSuccessThreshold)); |
|
201 |
station->m_timerTimeout = (int)(Max (station->m_timerTimeout * m_timerK, |
|
202 |
m_minSuccessThreshold)); |
|
203 |
if (station->m_rate != 0) |
|
204 |
{ |
|
205 |
station->m_rate--; |
|
206 |
} |
|
207 |
} |
|
208 |
station->m_timer = 0; |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
209 |
} |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
210 |
else |
6065 | 211 |
{ |
212 |
NS_ASSERT (station->m_retry >= 1); |
|
213 |
station->m_justModifyRate = false; |
|
214 |
station->m_rtsCounter = station->m_rtsWnd; |
|
215 |
if (((station->m_retry - 1) % 2) == 1) |
|
216 |
{ |
|
217 |
// need normal fallback |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
218 |
if (m_turnOffRtsAfterRateDecrease) |
6065 | 219 |
{ |
220 |
TurnOffRts (station); |
|
221 |
} |
|
222 |
station->m_justModifyRate = true; |
|
223 |
station->m_timerTimeout = m_minTimerThreshold; |
|
224 |
station->m_successThreshold = m_minSuccessThreshold; |
|
225 |
if (station->m_rate != 0) |
|
226 |
{ |
|
227 |
station->m_rate--; |
|
228 |
} |
|
229 |
} |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
230 |
if (station->m_retry >= 2) |
6065 | 231 |
{ |
232 |
station->m_timer = 0; |
|
233 |
} |
|
234 |
} |
|
235 |
CheckRts (station); |
|
236 |
} |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
237 |
void |
6065 | 238 |
AarfcdWifiManager::DoReportRxOk (WifiRemoteStation *station, |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
239 |
double rxSnr, WifiMode txMode) |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
240 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
241 |
NS_LOG_FUNCTION (this << station << rxSnr << txMode); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
242 |
} |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
243 |
void |
6065 | 244 |
AarfcdWifiManager::DoReportRtsOk (WifiRemoteStation *st, |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
245 |
double ctsSnr, WifiMode ctsMode, double rtsSnr) |
6065 | 246 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
247 |
NS_LOG_FUNCTION (this << st << ctsSnr << ctsMode << rtsSnr); |
6065 | 248 |
AarfcdWifiRemoteStation *station = (AarfcdWifiRemoteStation *) st; |
249 |
NS_LOG_DEBUG ("station=" << station << " rts ok"); |
|
250 |
station->m_rtsCounter--; |
|
251 |
} |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
252 |
void |
6065 | 253 |
AarfcdWifiManager::DoReportDataOk (WifiRemoteStation *st, |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
254 |
double ackSnr, WifiMode ackMode, double dataSnr) |
6065 | 255 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
256 |
NS_LOG_FUNCTION (this << st << ackSnr << ackMode << dataSnr); |
6065 | 257 |
AarfcdWifiRemoteStation *station = (AarfcdWifiRemoteStation *) st; |
258 |
station->m_timer++; |
|
259 |
station->m_success++; |
|
260 |
station->m_failed = 0; |
|
261 |
station->m_recovery = false; |
|
262 |
station->m_retry = 0; |
|
263 |
station->m_justModifyRate = false; |
|
264 |
station->m_haveASuccess = true; |
|
265 |
NS_LOG_DEBUG ("station=" << station << " data ok success=" << station->m_success << ", timer=" << station->m_timer); |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
266 |
if ((station->m_success == station->m_successThreshold |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
267 |
|| station->m_timer == station->m_timerTimeout) |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
268 |
&& (station->m_rate < (GetNSupported (station) - 1))) |
6065 | 269 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
270 |
NS_LOG_DEBUG ("station=" << station << " inc rate"); |
6065 | 271 |
station->m_rate++; |
272 |
station->m_timer = 0; |
|
273 |
station->m_success = 0; |
|
274 |
station->m_recovery = true; |
|
275 |
station->m_justModifyRate = true; |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
276 |
if (m_turnOnRtsAfterRateIncrease) |
6065 | 277 |
{ |
278 |
TurnOnRts (station); |
|
279 |
ResetRtsWnd (station); |
|
280 |
station->m_rtsCounter = station->m_rtsWnd; |
|
281 |
} |
|
282 |
} |
|
283 |
CheckRts (station); |
|
284 |
} |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
285 |
void |
6065 | 286 |
AarfcdWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *station) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
287 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
288 |
NS_LOG_FUNCTION (this << station); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
289 |
} |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
290 |
void |
6065 | 291 |
AarfcdWifiManager::DoReportFinalDataFailed (WifiRemoteStation *station) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
292 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
293 |
NS_LOG_FUNCTION (this << station); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
294 |
} |
6065 | 295 |
|
10139 | 296 |
WifiTxVector |
297 |
AarfcdWifiManager::DoGetDataTxVector (WifiRemoteStation *st, uint32_t size) |
|
6065 | 298 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
299 |
NS_LOG_FUNCTION (this << st << size); |
6065 | 300 |
AarfcdWifiRemoteStation *station = (AarfcdWifiRemoteStation *) st; |
11100
86e53d8a4cfe
bug 2026: 802.11n Ness parameter badly set for data frames
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
10968
diff
changeset
|
301 |
return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas()), GetNess (station), GetStbc (station)); |
6065 | 302 |
} |
10139 | 303 |
WifiTxVector |
304 |
AarfcdWifiManager::DoGetRtsTxVector (WifiRemoteStation *st) |
|
6065 | 305 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
306 |
NS_LOG_FUNCTION (this << st); |
9894
ac4e52a91d5d
Doxygenate todo's
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9705
diff
changeset
|
307 |
/// \todo we could/should implement the Aarf algorithm for |
ac4e52a91d5d
Doxygenate todo's
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9705
diff
changeset
|
308 |
/// RTS only by picking a single rate within the BasicRateSet. |
6065 | 309 |
AarfcdWifiRemoteStation *station = (AarfcdWifiRemoteStation *) st; |
11100
86e53d8a4cfe
bug 2026: 802.11n Ness parameter badly set for data frames
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
10968
diff
changeset
|
310 |
return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas()), GetNess (station), GetStbc (station)); |
6065 | 311 |
} |
312 |
||
313 |
bool |
|
314 |
AarfcdWifiManager::DoNeedRts (WifiRemoteStation *st, |
|
315 |
Ptr<const Packet> packet, bool normally) |
|
316 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
317 |
NS_LOG_FUNCTION (this << st << packet << normally); |
6065 | 318 |
AarfcdWifiRemoteStation *station = (AarfcdWifiRemoteStation *) st; |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
319 |
NS_LOG_INFO ("" << station << " rate=" << station->m_rate << " rts=" << (station->m_rtsOn ? "RTS" : "BASIC") << |
6065 | 320 |
" rtsCounter=" << station->m_rtsCounter); |
321 |
return station->m_rtsOn; |
|
322 |
} |
|
323 |
||
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
324 |
bool |
6065 | 325 |
AarfcdWifiManager::IsLowLatency (void) const |
326 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
327 |
NS_LOG_FUNCTION (this); |
6065 | 328 |
return true; |
329 |
} |
|
330 |
||
331 |
void |
|
332 |
AarfcdWifiManager::CheckRts (AarfcdWifiRemoteStation *station) |
|
333 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
334 |
NS_LOG_FUNCTION (this << station); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
335 |
if (station->m_rtsCounter == 0 && station->m_rtsOn) |
6065 | 336 |
{ |
337 |
TurnOffRts (station); |
|
338 |
} |
|
339 |
} |
|
340 |
||
341 |
void |
|
342 |
AarfcdWifiManager::TurnOffRts (AarfcdWifiRemoteStation *station) |
|
343 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
344 |
NS_LOG_FUNCTION (this << station); |
6065 | 345 |
station->m_rtsOn = false; |
346 |
station->m_haveASuccess = false; |
|
347 |
} |
|
348 |
||
349 |
void |
|
350 |
AarfcdWifiManager::TurnOnRts (AarfcdWifiRemoteStation *station) |
|
351 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
352 |
NS_LOG_FUNCTION (this << station); |
6065 | 353 |
station->m_rtsOn = true; |
354 |
} |
|
355 |
||
356 |
void |
|
357 |
AarfcdWifiManager::IncreaseRtsWnd (AarfcdWifiRemoteStation *station) |
|
358 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
359 |
NS_LOG_FUNCTION (this << station); |
6065 | 360 |
if (station->m_rtsWnd == m_maxRtsWnd) |
361 |
{ |
|
362 |
return; |
|
363 |
} |
|
364 |
||
365 |
station->m_rtsWnd *= 2; |
|
366 |
if (station->m_rtsWnd > m_maxRtsWnd) |
|
367 |
{ |
|
368 |
station->m_rtsWnd = m_maxRtsWnd; |
|
369 |
} |
|
370 |
} |
|
371 |
||
372 |
void |
|
373 |
AarfcdWifiManager::ResetRtsWnd (AarfcdWifiRemoteStation *station) |
|
374 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
375 |
NS_LOG_FUNCTION (this << station); |
6065 | 376 |
station->m_rtsWnd = m_minRtsWnd; |
377 |
} |
|
378 |
||
379 |
||
4334
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
380 |
} // namespace ns3 |