author | Alexander Krotov <krotov@iitp.ru> |
Sat, 04 Aug 2018 20:02:47 +0300 | |
changeset 13716 | 0b3abcc6f68f |
parent 13496 | df02bf906b2b |
child 13834 | 2670ce559a9b |
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; -*- */ |
2273
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
2 |
/* |
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
3 |
* Copyright (c) 2003,2007 INRIA |
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
4 |
* |
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
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 |
2273
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
8 |
* |
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
13 |
* |
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
17 |
* |
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
18 |
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
19 |
*/ |
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
20 |
|
13478
a7a1405b9b46
wifi: Use forward declaration as often as possible (part 9)
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
13468
diff
changeset
|
21 |
#include "ns3/log.h" |
a7a1405b9b46
wifi: Use forward declaration as often as possible (part 9)
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
13468
diff
changeset
|
22 |
#include "ns3/simulator.h" |
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2279
diff
changeset
|
23 |
#include "amrr-wifi-manager.h" |
13468
64f744da5cfe
wifi: Use forward declaration as often as possible (part 1)
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
13345
diff
changeset
|
24 |
#include "wifi-tx-vector.h" |
2273
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
25 |
|
10139 | 26 |
#define Min(a,b) ((a < b) ? a : b) |
27 |
||
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
|
28 |
namespace ns3 { |
2273
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
29 |
|
12498
4da85fa4f268
wifi: Update EnableLogComponents
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12429
diff
changeset
|
30 |
NS_LOG_COMPONENT_DEFINE ("AmrrWifiManager"); |
2273
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
31 |
|
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10410
diff
changeset
|
32 |
/** |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10410
diff
changeset
|
33 |
* \brief hold per-remote-station state for AMRR Wifi manager. |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10410
diff
changeset
|
34 |
* |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10410
diff
changeset
|
35 |
* This struct extends from WifiRemoteStation struct to hold additional |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10410
diff
changeset
|
36 |
* information required by the AMRR Wifi manager |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10410
diff
changeset
|
37 |
*/ |
6065 | 38 |
struct AmrrWifiRemoteStation : public WifiRemoteStation |
39 |
{ |
|
12691
e33cd795e21a
wifi: Doxygen updates for model files (thanks to Robert Ammon)
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12687
diff
changeset
|
40 |
Time m_nextModeUpdate; ///< next mode update time |
e33cd795e21a
wifi: Doxygen updates for model files (thanks to Robert Ammon)
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12687
diff
changeset
|
41 |
uint32_t m_tx_ok; ///< transmit ok |
e33cd795e21a
wifi: Doxygen updates for model files (thanks to Robert Ammon)
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12687
diff
changeset
|
42 |
uint32_t m_tx_err; ///< transmit error |
e33cd795e21a
wifi: Doxygen updates for model files (thanks to Robert Ammon)
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12687
diff
changeset
|
43 |
uint32_t m_tx_retr; ///< transmit retry |
e33cd795e21a
wifi: Doxygen updates for model files (thanks to Robert Ammon)
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12687
diff
changeset
|
44 |
uint32_t m_retry; ///< retry |
13292
5600444e6a98
wifi: Use uint8_t for the number of supported rates
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
13290
diff
changeset
|
45 |
uint8_t m_txrate; ///< transmit rate |
12691
e33cd795e21a
wifi: Doxygen updates for model files (thanks to Robert Ammon)
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12687
diff
changeset
|
46 |
uint32_t m_successThreshold; ///< success threshold |
e33cd795e21a
wifi: Doxygen updates for model files (thanks to Robert Ammon)
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12687
diff
changeset
|
47 |
uint32_t m_success; ///< success |
e33cd795e21a
wifi: Doxygen updates for model files (thanks to Robert Ammon)
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12687
diff
changeset
|
48 |
bool m_recovery; ///< recovery |
6065 | 49 |
}; |
50 |
||
51 |
||
10652
dc18deba4502
[doxygen] Revert r10410, r10411, r10412
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10483
diff
changeset
|
52 |
NS_OBJECT_ENSURE_REGISTERED (AmrrWifiManager); |
2273
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
53 |
|
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2279
diff
changeset
|
54 |
TypeId |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2279
diff
changeset
|
55 |
AmrrWifiManager::GetTypeId (void) |
2273
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
56 |
{ |
2602
d9262bff6df2
add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2599
diff
changeset
|
57 |
static TypeId tid = TypeId ("ns3::AmrrWifiManager") |
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2279
diff
changeset
|
58 |
.SetParent<WifiRemoteStationManager> () |
11245
5c781d7e5a25
SetGroupName for wifi module
Tom Henderson <tomh@tomh.org>
parents:
11100
diff
changeset
|
59 |
.SetGroupName ("Wifi") |
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2279
diff
changeset
|
60 |
.AddConstructor<AmrrWifiManager> () |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2279
diff
changeset
|
61 |
.AddAttribute ("UpdatePeriod", |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2279
diff
changeset
|
62 |
"The interval between decisions about rate control changes", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2784
diff
changeset
|
63 |
TimeValue (Seconds (1.0)), |
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2279
diff
changeset
|
64 |
MakeTimeAccessor (&AmrrWifiManager::m_updatePeriod), |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2279
diff
changeset
|
65 |
MakeTimeChecker ()) |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2279
diff
changeset
|
66 |
.AddAttribute ("FailureRatio", |
6273
8d70de29d514
spell check, mostly in comments.
Andrey Mazo <mazo@iitp.ru>
parents:
6065
diff
changeset
|
67 |
"Ratio of minimum erroneous transmissions needed to switch to a lower rate", |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
68 |
DoubleValue (1.0 / 3.0), |
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2279
diff
changeset
|
69 |
MakeDoubleAccessor (&AmrrWifiManager::m_failureRatio), |
2599
fcc1728eb669
Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2544
diff
changeset
|
70 |
MakeDoubleChecker<double> (0.0, 1.0)) |
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2279
diff
changeset
|
71 |
.AddAttribute ("SuccessRatio", |
6273
8d70de29d514
spell check, mostly in comments.
Andrey Mazo <mazo@iitp.ru>
parents:
6065
diff
changeset
|
72 |
"Ratio of maximum erroneous transmissions needed to switch to a higher rate", |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
73 |
DoubleValue (1.0 / 10.0), |
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2279
diff
changeset
|
74 |
MakeDoubleAccessor (&AmrrWifiManager::m_successRatio), |
2599
fcc1728eb669
Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2544
diff
changeset
|
75 |
MakeDoubleChecker<double> (0.0, 1.0)) |
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2279
diff
changeset
|
76 |
.AddAttribute ("MaxSuccessThreshold", |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2279
diff
changeset
|
77 |
"Maximum number of consecutive success periods needed to switch to a higher rate", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2784
diff
changeset
|
78 |
UintegerValue (10), |
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2279
diff
changeset
|
79 |
MakeUintegerAccessor (&AmrrWifiManager::m_maxSuccessThreshold), |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2279
diff
changeset
|
80 |
MakeUintegerChecker<uint32_t> ()) |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2279
diff
changeset
|
81 |
.AddAttribute ("MinSuccessThreshold", |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2279
diff
changeset
|
82 |
"Minimum number of consecutive success periods needed to switch to a higher rate", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2784
diff
changeset
|
83 |
UintegerValue (1), |
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2279
diff
changeset
|
84 |
MakeUintegerAccessor (&AmrrWifiManager::m_minSuccessThreshold), |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2279
diff
changeset
|
85 |
MakeUintegerChecker<uint32_t> ()) |
12687
05d210a15753
wifi: Add wifi-manager-example to test all wifi managers
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12583
diff
changeset
|
86 |
.AddTraceSource ("Rate", |
05d210a15753
wifi: Add wifi-manager-example to test all wifi managers
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12583
diff
changeset
|
87 |
"Traced value for rate changes (b/s)", |
05d210a15753
wifi: Add wifi-manager-example to test all wifi managers
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12583
diff
changeset
|
88 |
MakeTraceSourceAccessor (&AmrrWifiManager::m_currentRate), |
05d210a15753
wifi: Add wifi-manager-example to test all wifi managers
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12583
diff
changeset
|
89 |
"ns3::TracedValueCallback::Uint64") |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
90 |
; |
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2279
diff
changeset
|
91 |
return tid; |
2273
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
92 |
} |
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
93 |
|
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2279
diff
changeset
|
94 |
AmrrWifiManager::AmrrWifiManager () |
12687
05d210a15753
wifi: Add wifi-manager-example to test all wifi managers
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12583
diff
changeset
|
95 |
: WifiRemoteStationManager (), |
05d210a15753
wifi: Add wifi-manager-example to test all wifi managers
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12583
diff
changeset
|
96 |
m_currentRate (0) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
97 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
98 |
NS_LOG_FUNCTION (this); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
99 |
} |
6065 | 100 |
|
12691
e33cd795e21a
wifi: Doxygen updates for model files (thanks to Robert Ammon)
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12687
diff
changeset
|
101 |
AmrrWifiManager::~AmrrWifiManager () |
e33cd795e21a
wifi: Doxygen updates for model files (thanks to Robert Ammon)
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12687
diff
changeset
|
102 |
{ |
e33cd795e21a
wifi: Doxygen updates for model files (thanks to Robert Ammon)
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12687
diff
changeset
|
103 |
NS_LOG_FUNCTION (this); |
e33cd795e21a
wifi: Doxygen updates for model files (thanks to Robert Ammon)
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12687
diff
changeset
|
104 |
} |
e33cd795e21a
wifi: Doxygen updates for model files (thanks to Robert Ammon)
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12687
diff
changeset
|
105 |
|
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2279
diff
changeset
|
106 |
WifiRemoteStation * |
6065 | 107 |
AmrrWifiManager::DoCreateStation (void) const |
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2279
diff
changeset
|
108 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
109 |
NS_LOG_FUNCTION (this); |
6065 | 110 |
AmrrWifiRemoteStation *station = new AmrrWifiRemoteStation (); |
111 |
station->m_nextModeUpdate = Simulator::Now () + m_updatePeriod; |
|
112 |
station->m_tx_ok = 0; |
|
113 |
station->m_tx_err = 0; |
|
114 |
station->m_tx_retr = 0; |
|
115 |
station->m_retry = 0; |
|
116 |
station->m_txrate = 0; |
|
117 |
station->m_successThreshold = m_minSuccessThreshold; |
|
118 |
station->m_success = 0; |
|
119 |
station->m_recovery = false; |
|
120 |
return station; |
|
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2279
diff
changeset
|
121 |
} |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2279
diff
changeset
|
122 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
123 |
void |
6065 | 124 |
AmrrWifiManager::DoReportRxOk (WifiRemoteStation *station, |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
125 |
double rxSnr, WifiMode txMode) |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
126 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
127 |
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
|
128 |
} |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
129 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
130 |
void |
6065 | 131 |
AmrrWifiManager::DoReportRtsFailed (WifiRemoteStation *station) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
132 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
133 |
NS_LOG_FUNCTION (this << station); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
134 |
} |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
135 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
136 |
void |
6065 | 137 |
AmrrWifiManager::DoReportDataFailed (WifiRemoteStation *st) |
2273
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
138 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
139 |
NS_LOG_FUNCTION (this << st); |
6065 | 140 |
AmrrWifiRemoteStation *station = (AmrrWifiRemoteStation *)st; |
141 |
station->m_retry++; |
|
142 |
station->m_tx_retr++; |
|
2273
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
143 |
} |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
144 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
145 |
void |
6065 | 146 |
AmrrWifiManager::DoReportRtsOk (WifiRemoteStation *st, |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
147 |
double ctsSnr, WifiMode ctsMode, double rtsSnr) |
2273
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
148 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
149 |
NS_LOG_FUNCTION (this << st << ctsSnr << ctsMode << rtsSnr); |
2273
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
150 |
} |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
151 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
152 |
void |
6065 | 153 |
AmrrWifiManager::DoReportDataOk (WifiRemoteStation *st, |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
154 |
double ackSnr, WifiMode ackMode, double dataSnr) |
6065 | 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 << st << ackSnr << ackMode << dataSnr); |
6065 | 157 |
AmrrWifiRemoteStation *station = (AmrrWifiRemoteStation *)st; |
158 |
station->m_retry = 0; |
|
159 |
station->m_tx_ok++; |
|
160 |
} |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
161 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
162 |
void |
6065 | 163 |
AmrrWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *station) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
164 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
165 |
NS_LOG_FUNCTION (this << station); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
166 |
} |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
167 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
168 |
void |
6065 | 169 |
AmrrWifiManager::DoReportFinalDataFailed (WifiRemoteStation *st) |
2273
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
170 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
171 |
NS_LOG_FUNCTION (this << st); |
6065 | 172 |
AmrrWifiRemoteStation *station = (AmrrWifiRemoteStation *)st; |
173 |
station->m_retry = 0; |
|
174 |
station->m_tx_err++; |
|
2273
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
175 |
} |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
176 |
|
2274
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
177 |
bool |
6065 | 178 |
AmrrWifiManager::IsMinRate (AmrrWifiRemoteStation *station) const |
2274
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
179 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
180 |
NS_LOG_FUNCTION (this << station); |
6065 | 181 |
return (station->m_txrate == 0); |
2274
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
182 |
} |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
183 |
|
2274
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
184 |
bool |
6065 | 185 |
AmrrWifiManager::IsMaxRate (AmrrWifiRemoteStation *station) const |
2274
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
186 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
187 |
NS_LOG_FUNCTION (this << station); |
6065 | 188 |
NS_ASSERT (station->m_txrate + 1 <= GetNSupported (station)); |
189 |
return (station->m_txrate + 1 == GetNSupported (station)); |
|
2274
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
190 |
} |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
191 |
|
2274
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
192 |
bool |
6065 | 193 |
AmrrWifiManager::IsSuccess (AmrrWifiRemoteStation *station) const |
2274
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
194 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
195 |
NS_LOG_FUNCTION (this << station); |
6065 | 196 |
return (station->m_tx_retr + station->m_tx_err) < station->m_tx_ok * m_successRatio; |
2274
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
197 |
} |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
198 |
|
2274
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
199 |
bool |
6065 | 200 |
AmrrWifiManager::IsFailure (AmrrWifiRemoteStation *station) const |
2273
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
201 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
202 |
NS_LOG_FUNCTION (this << station); |
6065 | 203 |
return (station->m_tx_retr + station->m_tx_err) > station->m_tx_ok * m_failureRatio; |
2274
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
204 |
} |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
205 |
|
2274
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
206 |
bool |
6065 | 207 |
AmrrWifiManager::IsEnough (AmrrWifiRemoteStation *station) const |
2274
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
208 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
209 |
NS_LOG_FUNCTION (this << station); |
6065 | 210 |
return (station->m_tx_retr + station->m_tx_err + station->m_tx_ok) > 10; |
2273
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
211 |
} |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
212 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
213 |
void |
6065 | 214 |
AmrrWifiManager::ResetCnt (AmrrWifiRemoteStation *station) |
2274
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
215 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
216 |
NS_LOG_FUNCTION (this << station); |
6065 | 217 |
station->m_tx_ok = 0; |
218 |
station->m_tx_err = 0; |
|
219 |
station->m_tx_retr = 0; |
|
2274
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
220 |
} |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
221 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
222 |
void |
6065 | 223 |
AmrrWifiManager::IncreaseRate (AmrrWifiRemoteStation *station) |
2274
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
224 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
225 |
NS_LOG_FUNCTION (this << station); |
6065 | 226 |
station->m_txrate++; |
227 |
NS_ASSERT (station->m_txrate < GetNSupported (station)); |
|
2274
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
228 |
} |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
229 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
230 |
void |
6065 | 231 |
AmrrWifiManager::DecreaseRate (AmrrWifiRemoteStation *station) |
2274
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
232 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
233 |
NS_LOG_FUNCTION (this << station); |
6065 | 234 |
station->m_txrate--; |
2274
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
235 |
} |
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
236 |
|
2273
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
237 |
void |
6065 | 238 |
AmrrWifiManager::UpdateMode (AmrrWifiRemoteStation *station) |
2273
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
239 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
240 |
NS_LOG_FUNCTION (this << station); |
6065 | 241 |
if (Simulator::Now () < station->m_nextModeUpdate) |
2273
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
242 |
{ |
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
243 |
return; |
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
244 |
} |
6065 | 245 |
station->m_nextModeUpdate = Simulator::Now () + m_updatePeriod; |
2278
4b05fbf5c6e3
some debugging. Max rate test was inverted.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2277
diff
changeset
|
246 |
NS_LOG_DEBUG ("Update"); |
2274
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
247 |
|
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
248 |
bool needChange = false; |
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
249 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
250 |
if (IsSuccess (station) && IsEnough (station)) |
2274
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
251 |
{ |
6065 | 252 |
station->m_success++; |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
253 |
NS_LOG_DEBUG ("++ success=" << station->m_success << " successThreshold=" << station->m_successThreshold << |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
254 |
" tx_ok=" << station->m_tx_ok << " tx_err=" << station->m_tx_err << " tx_retr=" << station->m_tx_retr << |
13339
b4aab4764a9b
wifi: Remove casts in logging outputs
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
13310
diff
changeset
|
255 |
" rate=" << +station->m_txrate << " n-supported-rates=" << +GetNSupported (station)); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
256 |
if (station->m_success >= station->m_successThreshold |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
257 |
&& !IsMaxRate (station)) |
2274
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
258 |
{ |
6065 | 259 |
station->m_recovery = true; |
260 |
station->m_success = 0; |
|
261 |
IncreaseRate (station); |
|
2274
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
262 |
needChange = true; |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
263 |
} |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
264 |
else |
2274
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
265 |
{ |
6065 | 266 |
station->m_recovery = false; |
2274
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
267 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
268 |
} |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
269 |
else if (IsFailure (station)) |
2274
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
270 |
{ |
6065 | 271 |
station->m_success = 0; |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
272 |
NS_LOG_DEBUG ("-- success=" << station->m_success << " successThreshold=" << station->m_successThreshold << |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
273 |
" tx_ok=" << station->m_tx_ok << " tx_err=" << station->m_tx_err << " tx_retr=" << station->m_tx_retr << |
13339
b4aab4764a9b
wifi: Remove casts in logging outputs
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
13310
diff
changeset
|
274 |
" rate=" << +station->m_txrate << " n-supported-rates=" << +GetNSupported (station)); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
275 |
if (!IsMinRate (station)) |
2274
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
276 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
277 |
if (station->m_recovery) |
2274
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
278 |
{ |
6065 | 279 |
station->m_successThreshold *= 2; |
280 |
station->m_successThreshold = std::min (station->m_successThreshold, |
|
281 |
m_maxSuccessThreshold); |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
282 |
} |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
283 |
else |
2274
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
284 |
{ |
6065 | 285 |
station->m_successThreshold = m_minSuccessThreshold; |
2274
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
286 |
} |
6065 | 287 |
station->m_recovery = false; |
288 |
DecreaseRate (station); |
|
2274
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
289 |
needChange = true; |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
290 |
} |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
291 |
else |
2274
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
292 |
{ |
6065 | 293 |
station->m_recovery = false; |
2274
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
294 |
} |
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
295 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
296 |
if (IsEnough (station) || needChange) |
2274
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
297 |
{ |
2278
4b05fbf5c6e3
some debugging. Max rate test was inverted.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2277
diff
changeset
|
298 |
NS_LOG_DEBUG ("Reset"); |
6065 | 299 |
ResetCnt (station); |
2274
406712a0c6ef
implement AMRR for true.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2273
diff
changeset
|
300 |
} |
2273
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
301 |
} |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
302 |
|
10139 | 303 |
WifiTxVector |
11947
a141a91efd94
wifi: clean unused size parameter in rate managers
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11902
diff
changeset
|
304 |
AmrrWifiManager::DoGetDataTxVector (WifiRemoteStation *st) |
2273
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
305 |
{ |
11947
a141a91efd94
wifi: clean unused size parameter in rate managers
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11902
diff
changeset
|
306 |
NS_LOG_FUNCTION (this << st); |
6065 | 307 |
AmrrWifiRemoteStation *station = (AmrrWifiRemoteStation *)st; |
308 |
UpdateMode (station); |
|
309 |
NS_ASSERT (station->m_txrate < GetNSupported (station)); |
|
13292
5600444e6a98
wifi: Use uint8_t for the number of supported rates
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
13290
diff
changeset
|
310 |
uint8_t rateIndex; |
6065 | 311 |
if (station->m_retry < 1) |
2276
26e3bc114fdd
implement the MRR portion of AMRR
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2275
diff
changeset
|
312 |
{ |
6065 | 313 |
rateIndex = station->m_txrate; |
2276
26e3bc114fdd
implement the MRR portion of AMRR
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2275
diff
changeset
|
314 |
} |
6065 | 315 |
else if (station->m_retry < 2) |
2276
26e3bc114fdd
implement the MRR portion of AMRR
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2275
diff
changeset
|
316 |
{ |
6065 | 317 |
if (station->m_txrate > 0) |
2276
26e3bc114fdd
implement the MRR portion of AMRR
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2275
diff
changeset
|
318 |
{ |
6065 | 319 |
rateIndex = station->m_txrate - 1; |
2276
26e3bc114fdd
implement the MRR portion of AMRR
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2275
diff
changeset
|
320 |
} |
26e3bc114fdd
implement the MRR portion of AMRR
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2275
diff
changeset
|
321 |
else |
26e3bc114fdd
implement the MRR portion of AMRR
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2275
diff
changeset
|
322 |
{ |
6065 | 323 |
rateIndex = station->m_txrate; |
2276
26e3bc114fdd
implement the MRR portion of AMRR
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2275
diff
changeset
|
324 |
} |
26e3bc114fdd
implement the MRR portion of AMRR
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2275
diff
changeset
|
325 |
} |
6065 | 326 |
else if (station->m_retry < 3) |
2276
26e3bc114fdd
implement the MRR portion of AMRR
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2275
diff
changeset
|
327 |
{ |
6065 | 328 |
if (station->m_txrate > 1) |
2276
26e3bc114fdd
implement the MRR portion of AMRR
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2275
diff
changeset
|
329 |
{ |
6065 | 330 |
rateIndex = station->m_txrate - 2; |
2276
26e3bc114fdd
implement the MRR portion of AMRR
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2275
diff
changeset
|
331 |
} |
26e3bc114fdd
implement the MRR portion of AMRR
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2275
diff
changeset
|
332 |
else |
26e3bc114fdd
implement the MRR portion of AMRR
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2275
diff
changeset
|
333 |
{ |
6065 | 334 |
rateIndex = station->m_txrate; |
2276
26e3bc114fdd
implement the MRR portion of AMRR
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2275
diff
changeset
|
335 |
} |
26e3bc114fdd
implement the MRR portion of AMRR
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2275
diff
changeset
|
336 |
} |
26e3bc114fdd
implement the MRR portion of AMRR
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2275
diff
changeset
|
337 |
else |
26e3bc114fdd
implement the MRR portion of AMRR
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2275
diff
changeset
|
338 |
{ |
6065 | 339 |
if (station->m_txrate > 2) |
2276
26e3bc114fdd
implement the MRR portion of AMRR
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2275
diff
changeset
|
340 |
{ |
6065 | 341 |
rateIndex = station->m_txrate - 3; |
2276
26e3bc114fdd
implement the MRR portion of AMRR
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2275
diff
changeset
|
342 |
} |
26e3bc114fdd
implement the MRR portion of AMRR
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2275
diff
changeset
|
343 |
else |
26e3bc114fdd
implement the MRR portion of AMRR
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2275
diff
changeset
|
344 |
{ |
6065 | 345 |
rateIndex = station->m_txrate; |
2276
26e3bc114fdd
implement the MRR portion of AMRR
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2275
diff
changeset
|
346 |
} |
26e3bc114fdd
implement the MRR portion of AMRR
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2275
diff
changeset
|
347 |
} |
13496
df02bf906b2b
wifi: Use uint16_t for channel widths to prepare 802.11ad support and silent some Visual Studio compiler warnings
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
13478
diff
changeset
|
348 |
uint16_t channelWidth = GetChannelWidth (station); |
11644
527ed7692b84
Better visibility in if conditions
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11628
diff
changeset
|
349 |
if (channelWidth > 20 && channelWidth != 22) |
11628
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11479
diff
changeset
|
350 |
{ |
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11479
diff
changeset
|
351 |
//avoid to use legacy rate adaptation algorithms for IEEE 802.11n/ac |
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11479
diff
changeset
|
352 |
channelWidth = 20; |
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11479
diff
changeset
|
353 |
} |
12429
d12f1640acca
wifi: (fixes #2551) Move preamble to TXVECTOR
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12413
diff
changeset
|
354 |
WifiMode mode = GetSupported (station, rateIndex); |
12687
05d210a15753
wifi: Add wifi-manager-example to test all wifi managers
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12583
diff
changeset
|
355 |
if (m_currentRate != mode.GetDataRate (channelWidth)) |
05d210a15753
wifi: Add wifi-manager-example to test all wifi managers
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12583
diff
changeset
|
356 |
{ |
05d210a15753
wifi: Add wifi-manager-example to test all wifi managers
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12583
diff
changeset
|
357 |
NS_LOG_DEBUG ("New datarate: " << mode.GetDataRate (channelWidth)); |
05d210a15753
wifi: Add wifi-manager-example to test all wifi managers
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12583
diff
changeset
|
358 |
m_currentRate = mode.GetDataRate (channelWidth); |
05d210a15753
wifi: Add wifi-manager-example to test all wifi managers
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12583
diff
changeset
|
359 |
} |
13345
ed3d0361b647
wifi: Get rid of unused retries parameter in WifiTxVector
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
13339
diff
changeset
|
360 |
return WifiTxVector (mode, GetDefaultTxPowerLevel (), GetPreambleForTransmission (mode, GetAddress (station)), 800, 1, 1, 0, channelWidth, GetAggregation (station), false); |
2273
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
361 |
} |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
362 |
|
10139 | 363 |
WifiTxVector |
364 |
AmrrWifiManager::DoGetRtsTxVector (WifiRemoteStation *st) |
|
2273
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
365 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7385
diff
changeset
|
366 |
NS_LOG_FUNCTION (this << st); |
6065 | 367 |
AmrrWifiRemoteStation *station = (AmrrWifiRemoteStation *)st; |
13496
df02bf906b2b
wifi: Use uint16_t for channel widths to prepare 802.11ad support and silent some Visual Studio compiler warnings
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
13478
diff
changeset
|
368 |
uint16_t channelWidth = GetChannelWidth (station); |
11644
527ed7692b84
Better visibility in if conditions
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11628
diff
changeset
|
369 |
if (channelWidth > 20 && channelWidth != 22) |
11628
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11479
diff
changeset
|
370 |
{ |
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11479
diff
changeset
|
371 |
//avoid to use legacy rate adaptation algorithms for IEEE 802.11n/ac |
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11479
diff
changeset
|
372 |
channelWidth = 20; |
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11479
diff
changeset
|
373 |
} |
6065 | 374 |
UpdateMode (station); |
11881
8707c44ecc30
wifi: (fixes #2120) 802.11g backward compatible with 802.11b
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11644
diff
changeset
|
375 |
WifiTxVector rtsTxVector; |
12429
d12f1640acca
wifi: (fixes #2551) Move preamble to TXVECTOR
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12413
diff
changeset
|
376 |
WifiMode mode; |
11902
669c63365b9e
wifi: (fixes #2297) 802.11n/ac backward compatible with legacy
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11881
diff
changeset
|
377 |
if (GetUseNonErpProtection () == false) |
11881
8707c44ecc30
wifi: (fixes #2120) 802.11g backward compatible with 802.11b
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11644
diff
changeset
|
378 |
{ |
12429
d12f1640acca
wifi: (fixes #2551) Move preamble to TXVECTOR
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12413
diff
changeset
|
379 |
mode = GetSupported (station, 0); |
11881
8707c44ecc30
wifi: (fixes #2120) 802.11g backward compatible with 802.11b
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11644
diff
changeset
|
380 |
} |
8707c44ecc30
wifi: (fixes #2120) 802.11g backward compatible with 802.11b
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11644
diff
changeset
|
381 |
else |
8707c44ecc30
wifi: (fixes #2120) 802.11g backward compatible with 802.11b
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11644
diff
changeset
|
382 |
{ |
12429
d12f1640acca
wifi: (fixes #2551) Move preamble to TXVECTOR
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12413
diff
changeset
|
383 |
mode = GetNonErpSupported (station, 0); |
11881
8707c44ecc30
wifi: (fixes #2120) 802.11g backward compatible with 802.11b
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11644
diff
changeset
|
384 |
} |
13345
ed3d0361b647
wifi: Get rid of unused retries parameter in WifiTxVector
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
13339
diff
changeset
|
385 |
rtsTxVector = WifiTxVector (mode, GetDefaultTxPowerLevel (), GetPreambleForTransmission (mode, GetAddress (station)), 800, 1, 1, 0, channelWidth, GetAggregation (station), false); |
11881
8707c44ecc30
wifi: (fixes #2120) 802.11g backward compatible with 802.11b
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11644
diff
changeset
|
386 |
return rtsTxVector; |
6065 | 387 |
} |
388 |
||
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
389 |
bool |
6065 | 390 |
AmrrWifiManager::IsLowLatency (void) const |
391 |
{ |
|
392 |
return true; |
|
2273
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
393 |
} |
0bfe240ec168
AMRR rate control algorithm
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
394 |
|
12153
090887671b94
wifi: (fixes #1797) Assert when non-HT RAA is used with HT/VHT device
Matias Richart <mrichart@fing.edu.uy>
parents:
11947
diff
changeset
|
395 |
void |
090887671b94
wifi: (fixes #1797) Assert when non-HT RAA is used with HT/VHT device
Matias Richart <mrichart@fing.edu.uy>
parents:
11947
diff
changeset
|
396 |
AmrrWifiManager::SetHtSupported (bool enable) |
090887671b94
wifi: (fixes #1797) Assert when non-HT RAA is used with HT/VHT device
Matias Richart <mrichart@fing.edu.uy>
parents:
11947
diff
changeset
|
397 |
{ |
090887671b94
wifi: (fixes #1797) Assert when non-HT RAA is used with HT/VHT device
Matias Richart <mrichart@fing.edu.uy>
parents:
11947
diff
changeset
|
398 |
//HT is not supported by this algorithm. |
090887671b94
wifi: (fixes #1797) Assert when non-HT RAA is used with HT/VHT device
Matias Richart <mrichart@fing.edu.uy>
parents:
11947
diff
changeset
|
399 |
if (enable) |
090887671b94
wifi: (fixes #1797) Assert when non-HT RAA is used with HT/VHT device
Matias Richart <mrichart@fing.edu.uy>
parents:
11947
diff
changeset
|
400 |
{ |
090887671b94
wifi: (fixes #1797) Assert when non-HT RAA is used with HT/VHT device
Matias Richart <mrichart@fing.edu.uy>
parents:
11947
diff
changeset
|
401 |
NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HT rates"); |
090887671b94
wifi: (fixes #1797) Assert when non-HT RAA is used with HT/VHT device
Matias Richart <mrichart@fing.edu.uy>
parents:
11947
diff
changeset
|
402 |
} |
090887671b94
wifi: (fixes #1797) Assert when non-HT RAA is used with HT/VHT device
Matias Richart <mrichart@fing.edu.uy>
parents:
11947
diff
changeset
|
403 |
} |
090887671b94
wifi: (fixes #1797) Assert when non-HT RAA is used with HT/VHT device
Matias Richart <mrichart@fing.edu.uy>
parents:
11947
diff
changeset
|
404 |
|
090887671b94
wifi: (fixes #1797) Assert when non-HT RAA is used with HT/VHT device
Matias Richart <mrichart@fing.edu.uy>
parents:
11947
diff
changeset
|
405 |
void |
090887671b94
wifi: (fixes #1797) Assert when non-HT RAA is used with HT/VHT device
Matias Richart <mrichart@fing.edu.uy>
parents:
11947
diff
changeset
|
406 |
AmrrWifiManager::SetVhtSupported (bool enable) |
090887671b94
wifi: (fixes #1797) Assert when non-HT RAA is used with HT/VHT device
Matias Richart <mrichart@fing.edu.uy>
parents:
11947
diff
changeset
|
407 |
{ |
090887671b94
wifi: (fixes #1797) Assert when non-HT RAA is used with HT/VHT device
Matias Richart <mrichart@fing.edu.uy>
parents:
11947
diff
changeset
|
408 |
//VHT is not supported by this algorithm. |
090887671b94
wifi: (fixes #1797) Assert when non-HT RAA is used with HT/VHT device
Matias Richart <mrichart@fing.edu.uy>
parents:
11947
diff
changeset
|
409 |
if (enable) |
090887671b94
wifi: (fixes #1797) Assert when non-HT RAA is used with HT/VHT device
Matias Richart <mrichart@fing.edu.uy>
parents:
11947
diff
changeset
|
410 |
{ |
090887671b94
wifi: (fixes #1797) Assert when non-HT RAA is used with HT/VHT device
Matias Richart <mrichart@fing.edu.uy>
parents:
11947
diff
changeset
|
411 |
NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support VHT rates"); |
090887671b94
wifi: (fixes #1797) Assert when non-HT RAA is used with HT/VHT device
Matias Richart <mrichart@fing.edu.uy>
parents:
11947
diff
changeset
|
412 |
} |
090887671b94
wifi: (fixes #1797) Assert when non-HT RAA is used with HT/VHT device
Matias Richart <mrichart@fing.edu.uy>
parents:
11947
diff
changeset
|
413 |
} |
090887671b94
wifi: (fixes #1797) Assert when non-HT RAA is used with HT/VHT device
Matias Richart <mrichart@fing.edu.uy>
parents:
11947
diff
changeset
|
414 |
|
12583
40a9ab9779c6
wifi: Add initial support for 802.11ax
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12498
diff
changeset
|
415 |
void |
40a9ab9779c6
wifi: Add initial support for 802.11ax
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12498
diff
changeset
|
416 |
AmrrWifiManager::SetHeSupported (bool enable) |
40a9ab9779c6
wifi: Add initial support for 802.11ax
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12498
diff
changeset
|
417 |
{ |
40a9ab9779c6
wifi: Add initial support for 802.11ax
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12498
diff
changeset
|
418 |
//HE is not supported by this algorithm. |
40a9ab9779c6
wifi: Add initial support for 802.11ax
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12498
diff
changeset
|
419 |
if (enable) |
40a9ab9779c6
wifi: Add initial support for 802.11ax
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12498
diff
changeset
|
420 |
{ |
40a9ab9779c6
wifi: Add initial support for 802.11ax
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12498
diff
changeset
|
421 |
NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HE rates"); |
40a9ab9779c6
wifi: Add initial support for 802.11ax
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12498
diff
changeset
|
422 |
} |
40a9ab9779c6
wifi: Add initial support for 802.11ax
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
12498
diff
changeset
|
423 |
} |
12153
090887671b94
wifi: (fixes #1797) Assert when non-HT RAA is used with HT/VHT device
Matias Richart <mrichart@fing.edu.uy>
parents:
11947
diff
changeset
|
424 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
425 |
} //namespace ns3 |