author | Sébastien Deronne <sebastien.deronne@gmail.com> |
Wed, 08 Jul 2015 23:44:17 +0200 | |
changeset 11479 | a3dcf66928f3 |
parent 11450 | 9f4ae69f12b7 |
child 11628 | 243b71de25a0 |
permissions | -rw-r--r-- |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
2 |
/* |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
3 |
* Copyright (c) 2009 Duy Nguyen |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
4 |
* |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
8 |
* |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
13 |
* |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
17 |
* |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
18 |
* Author: Duy Nguyen <duy@soe.ucsc.edu> |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
19 |
* |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
20 |
* Some Comments: |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
21 |
* |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
22 |
* 1) Segment Size is declared for completeness but not used because it has |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
23 |
* to do more with the requirement of the specific hardware. |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
24 |
* |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
25 |
* 2) By default, Minstrel applies the multi-rate retry(the core of Minstrel |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
26 |
* algorithm). Otherwise, please use ConstantRateWifiManager instead. |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
27 |
* |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
28 |
* http://linuxwireless.org/en/developers/Documentation/mac80211/RateControl/minstrel |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
29 |
*/ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
30 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
31 |
#include "minstrel-wifi-manager.h" |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
32 |
#include "wifi-phy.h" |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
33 |
#include "ns3/simulator.h" |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
34 |
#include "ns3/log.h" |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
35 |
#include "ns3/uinteger.h" |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
36 |
#include "ns3/double.h" |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
37 |
#include "ns3/wifi-mac.h" |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
38 |
#include "ns3/assert.h" |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
39 |
#include <vector> |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
40 |
|
10139 | 41 |
#define Min(a,b) ((a < b) ? a : b) |
42 |
||
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
|
43 |
namespace ns3 { |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
44 |
|
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
|
45 |
NS_LOG_COMPONENT_DEFINE ("MinstrelWifiManager"); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
46 |
|
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10410
diff
changeset
|
47 |
/** |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10410
diff
changeset
|
48 |
* \brief hold per-remote-station state for Minstrel Wifi manager. |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10410
diff
changeset
|
49 |
* |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10410
diff
changeset
|
50 |
* This struct extends from WifiRemoteStation struct to hold additional |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10410
diff
changeset
|
51 |
* information required by the Minstrel Wifi manager |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10410
diff
changeset
|
52 |
*/ |
6065 | 53 |
struct MinstrelWifiRemoteStation : public WifiRemoteStation |
54 |
{ |
|
55 |
Time m_nextStatsUpdate; ///< 10 times every second |
|
56 |
||
57 |
/** |
|
58 |
* To keep track of the current position in the our random sample table |
|
59 |
* going row by row from 1st column until the 10th column(Minstrel defines 10) |
|
60 |
* then we wrap back to the row 1 col 1. |
|
61 |
* note: there are many other ways to do this. |
|
62 |
*/ |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
63 |
uint32_t m_col, m_index; |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
64 |
uint32_t m_maxTpRate; ///< the current throughput rate |
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
65 |
uint32_t m_maxTpRate2; ///< second highest throughput rate |
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
66 |
uint32_t m_maxProbRate; ///< rate with highest prob of success |
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
67 |
int m_packetCount; ///< total number of packets as of now |
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
68 |
int m_sampleCount; ///< how many packets we have sample so far |
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
69 |
bool m_isSampling; ///< a flag to indicate we are currently sampling |
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
70 |
uint32_t m_sampleRate; ///< current sample rate |
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
71 |
bool m_sampleRateSlower; ///< a flag to indicate sample rate is slower |
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
72 |
uint32_t m_shortRetry; ///< short retries such as control packts |
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
73 |
uint32_t m_longRetry; ///< long retries such as data packets |
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
74 |
uint32_t m_retry; ///< total retries short + long |
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
75 |
uint32_t m_err; ///< retry errors |
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
76 |
uint32_t m_txrate; ///< current transmit rate |
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
77 |
bool m_initialized; ///< for initializing tables |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
78 |
MinstrelRate m_minstrelTable; ///< minstrel table |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
79 |
SampleRate m_sampleTable; ///< sample table |
6065 | 80 |
}; |
81 |
||
10652
dc18deba4502
[doxygen] Revert r10410, r10411, r10412
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10483
diff
changeset
|
82 |
NS_OBJECT_ENSURE_REGISTERED (MinstrelWifiManager); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
83 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
84 |
TypeId |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
85 |
MinstrelWifiManager::GetTypeId (void) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
86 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
87 |
static TypeId tid = TypeId ("ns3::MinstrelWifiManager") |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
88 |
.SetParent<WifiRemoteStationManager> () |
11245
5c781d7e5a25
SetGroupName for wifi module
Tom Henderson <tomh@tomh.org>
parents:
11174
diff
changeset
|
89 |
.SetGroupName ("Wifi") |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
90 |
.AddConstructor<MinstrelWifiManager> () |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
91 |
.AddAttribute ("UpdateStatistics", |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
92 |
"The interval between updating statistics table ", |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
93 |
TimeValue (Seconds (0.1)), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
94 |
MakeTimeAccessor (&MinstrelWifiManager::m_updateStats), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
95 |
MakeTimeChecker ()) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
96 |
.AddAttribute ("LookAroundRate", |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
97 |
"the percentage to try other rates", |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
98 |
DoubleValue (10), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
99 |
MakeDoubleAccessor (&MinstrelWifiManager::m_lookAroundRate), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
100 |
MakeDoubleChecker<double> ()) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
101 |
.AddAttribute ("EWMA", |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
102 |
"EWMA level", |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
103 |
DoubleValue (75), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
104 |
MakeDoubleAccessor (&MinstrelWifiManager::m_ewmaLevel), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
105 |
MakeDoubleChecker<double> ()) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
106 |
.AddAttribute ("SampleColumn", |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
107 |
"The number of columns used for sampling", |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
108 |
DoubleValue (10), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
109 |
MakeDoubleAccessor (&MinstrelWifiManager::m_sampleCol), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
110 |
MakeDoubleChecker <double> ()) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
111 |
.AddAttribute ("PacketLength", |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
112 |
"The packet length used for calculating mode TxTime", |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
113 |
DoubleValue (1200), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
114 |
MakeDoubleAccessor (&MinstrelWifiManager::m_pktLen), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
115 |
MakeDoubleChecker <double> ()) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
116 |
; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
117 |
return tid; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
118 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
119 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
120 |
MinstrelWifiManager::MinstrelWifiManager () |
6337 | 121 |
{ |
8981
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
122 |
m_uniformRandomVariable = CreateObject<UniformRandomVariable> (); |
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
123 |
|
6337 | 124 |
m_nsupported = 0; |
125 |
} |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
126 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
127 |
MinstrelWifiManager::~MinstrelWifiManager () |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
128 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
129 |
} |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
130 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
131 |
void |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
132 |
MinstrelWifiManager::SetupPhy (Ptr<WifiPhy> phy) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
133 |
{ |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
134 |
NS_LOG_FUNCTION (this << phy); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
135 |
uint32_t nModes = phy->GetNModes (); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
136 |
for (uint32_t i = 0; i < nModes; i++) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
137 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
138 |
WifiMode mode = phy->GetMode (i); |
10139 | 139 |
WifiTxVector txVector; |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
140 |
txVector.SetMode (mode); |
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
141 |
AddCalcTxTime (mode, phy->CalculateTxDuration (m_pktLen, txVector, WIFI_PREAMBLE_LONG, phy->GetFrequency (), 0, 0)); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
142 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
143 |
WifiRemoteStationManager::SetupPhy (phy); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
144 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
145 |
|
8981
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
146 |
int64_t |
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
147 |
MinstrelWifiManager::AssignStreams (int64_t stream) |
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
148 |
{ |
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
149 |
NS_LOG_FUNCTION (this << stream); |
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
150 |
m_uniformRandomVariable->SetStream (stream); |
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
151 |
return 1; |
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
152 |
} |
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
153 |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
154 |
Time |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
155 |
MinstrelWifiManager::GetCalcTxTime (WifiMode mode) const |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
156 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
157 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
158 |
for (TxTime::const_iterator i = m_calcTxTime.begin (); i != m_calcTxTime.end (); i++) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
159 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
160 |
if (mode == i->second) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
161 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
162 |
return i->first; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
163 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
164 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
165 |
NS_ASSERT (false); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
166 |
return Seconds (0); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
167 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
168 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
169 |
void |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
170 |
MinstrelWifiManager::AddCalcTxTime (WifiMode mode, Time t) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
171 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
172 |
m_calcTxTime.push_back (std::make_pair (t, mode)); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
173 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
174 |
|
6065 | 175 |
WifiRemoteStation * |
176 |
MinstrelWifiManager::DoCreateStation (void) const |
|
177 |
{ |
|
178 |
MinstrelWifiRemoteStation *station = new MinstrelWifiRemoteStation (); |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
179 |
|
6065 | 180 |
station->m_nextStatsUpdate = Simulator::Now () + m_updateStats; |
181 |
station->m_col = 0; |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
182 |
station->m_index = 0; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
183 |
station->m_maxTpRate = 0; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
184 |
station->m_maxTpRate2 = 0; |
6065 | 185 |
station->m_maxProbRate = 0; |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
186 |
station->m_packetCount = 0; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
187 |
station->m_sampleCount = 0; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
188 |
station->m_isSampling = false; |
6065 | 189 |
station->m_sampleRate = 0; |
190 |
station->m_sampleRateSlower = false; |
|
191 |
station->m_shortRetry = 0; |
|
192 |
station->m_longRetry = 0; |
|
193 |
station->m_retry = 0; |
|
194 |
station->m_err = 0; |
|
195 |
station->m_txrate = 0; |
|
196 |
station->m_initialized = false; |
|
197 |
||
198 |
return station; |
|
199 |
} |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
200 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
201 |
void |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
202 |
MinstrelWifiManager::CheckInit (MinstrelWifiRemoteStation *station) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
203 |
{ |
6337 | 204 |
if (!station->m_initialized && GetNSupported (station) > 1) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
205 |
{ |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
206 |
//Note: we appear to be doing late initialization of the table |
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
207 |
//to make sure that the set of supported rates has been initialized |
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
208 |
//before we perform our own initialization. |
6337 | 209 |
m_nsupported = GetNSupported (station); |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
210 |
station->m_minstrelTable = MinstrelRate (m_nsupported); |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
211 |
station->m_sampleTable = SampleRate (m_nsupported, std::vector<uint32_t> (m_sampleCol)); |
6065 | 212 |
InitSampleTable (station); |
213 |
RateInit (station); |
|
214 |
station->m_initialized = true; |
|
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
215 |
|
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
216 |
PrintTable (station); |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
217 |
PrintSampleTable (station); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
218 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
219 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
220 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
221 |
void |
6065 | 222 |
MinstrelWifiManager::DoReportRxOk (WifiRemoteStation *st, |
223 |
double rxSnr, WifiMode txMode) |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
224 |
{ |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
225 |
NS_LOG_FUNCTION (this); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
226 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
227 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
228 |
void |
6065 | 229 |
MinstrelWifiManager::DoReportRtsFailed (WifiRemoteStation *st) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
230 |
{ |
6065 | 231 |
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *)st; |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
232 |
NS_LOG_DEBUG ("DoReportRtsFailed m_txrate=" << station->m_txrate); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
233 |
|
6065 | 234 |
station->m_shortRetry++; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
235 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
236 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
237 |
void |
6065 | 238 |
MinstrelWifiManager::DoReportRtsOk (WifiRemoteStation *st, double ctsSnr, WifiMode ctsMode, double rtsSnr) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
239 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
240 |
NS_LOG_DEBUG ("self=" << st << " rts ok"); |
6065 | 241 |
} |
242 |
||
243 |
void |
|
244 |
MinstrelWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *st) |
|
245 |
{ |
|
246 |
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *)st; |
|
247 |
UpdateRetry (station); |
|
248 |
station->m_err++; |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
249 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
250 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
251 |
void |
6065 | 252 |
MinstrelWifiManager::DoReportDataFailed (WifiRemoteStation *st) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
253 |
{ |
6065 | 254 |
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *)st; |
255 |
/** |
|
256 |
* |
|
257 |
* Retry Chain table is implemented here |
|
258 |
* |
|
259 |
* Try | LOOKAROUND RATE | NORMAL RATE |
|
260 |
* | random < best | random > best | |
|
261 |
* -------------------------------------------------------------- |
|
262 |
* 1 | Best throughput | Random rate | Best throughput |
|
263 |
* 2 | Random rate | Best throughput | Next best throughput |
|
264 |
* 3 | Best probability | Best probability | Best probability |
|
265 |
* 4 | Lowest Baserate | Lowest baserate | Lowest baserate |
|
266 |
* |
|
267 |
* Note: For clarity, multiple blocks of if's and else's are used |
|
268 |
* After a failing 7 times, DoReportFinalDataFailed will be called |
|
269 |
*/ |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
270 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
271 |
CheckInit (station); |
6337 | 272 |
if (!station->m_initialized) |
273 |
{ |
|
274 |
return; |
|
275 |
} |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
276 |
|
6065 | 277 |
station->m_longRetry++; |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
278 |
station->m_minstrelTable[station->m_txrate].numRateAttempt++; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
279 |
|
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
280 |
PrintTable (station); |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
281 |
|
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
282 |
NS_LOG_DEBUG ("DoReportDataFailed " << station << " rate " << station->m_txrate << " longRetry " << station->m_longRetry); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
283 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
284 |
//for normal rate, we're not currently sampling random rates |
6065 | 285 |
if (!station->m_isSampling) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
286 |
{ |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
287 |
NS_LOG_DEBUG ("Failed with normal rate: current=" << station->m_txrate << ", sample=" << station->m_sampleRate << ", maxTp=" << station->m_maxTpRate << ", maxTp2=" << station->m_maxTpRate2 << ", maxProb=" << station->m_maxProbRate); |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
288 |
//use best throughput rate |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
289 |
if (station->m_longRetry < station->m_minstrelTable[station->m_maxTpRate].adjustedRetryCount) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
290 |
{ |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
291 |
NS_LOG_DEBUG (" More retries left for the maximum throughput rate."); |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
292 |
station->m_txrate = station->m_maxTpRate; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
293 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
294 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
295 |
//use second best throughput rate |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
296 |
else if (station->m_longRetry <= (station->m_minstrelTable[station->m_maxTpRate].adjustedRetryCount + |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
297 |
station->m_minstrelTable[station->m_maxTpRate2].adjustedRetryCount)) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
298 |
{ |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
299 |
NS_LOG_DEBUG (" More retries left for the second maximum throughput rate."); |
6065 | 300 |
station->m_txrate = station->m_maxTpRate2; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
301 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
302 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
303 |
//use best probability rate |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
304 |
else if (station->m_longRetry <= (station->m_minstrelTable[station->m_maxTpRate].adjustedRetryCount + |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
305 |
station->m_minstrelTable[station->m_maxTpRate2].adjustedRetryCount + |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
306 |
station->m_minstrelTable[station->m_maxProbRate].adjustedRetryCount)) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
307 |
{ |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
308 |
NS_LOG_DEBUG (" More retries left for the maximum probability rate."); |
6065 | 309 |
station->m_txrate = station->m_maxProbRate; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
310 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
311 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
312 |
//use lowest base rate |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
313 |
else if (station->m_longRetry > (station->m_minstrelTable[station->m_maxTpRate].adjustedRetryCount + |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
314 |
station->m_minstrelTable[station->m_maxTpRate2].adjustedRetryCount + |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
315 |
station->m_minstrelTable[station->m_maxProbRate].adjustedRetryCount)) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
316 |
{ |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
317 |
NS_LOG_DEBUG (" More retries left for the base rate."); |
6065 | 318 |
station->m_txrate = 0; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
319 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
320 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
321 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
322 |
//for look-around rate, we're currently sampling random rates |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
323 |
else |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
324 |
{ |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
325 |
NS_LOG_DEBUG ("Failed with look around rate: current=" << station->m_txrate << ", sample=" << station->m_sampleRate << ", maxTp=" << station->m_maxTpRate << ", maxTp2=" << station->m_maxTpRate2 << ", maxProb=" << station->m_maxProbRate); |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
326 |
//current sampling rate is slower than the current best rate |
6065 | 327 |
if (station->m_sampleRateSlower) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
328 |
{ |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
329 |
NS_LOG_DEBUG ("Look around rate is slower than the maximum throughput rate."); |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
330 |
//use best throughput rate |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
331 |
if (station->m_longRetry < station->m_minstrelTable[station->m_maxTpRate].adjustedRetryCount) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
332 |
{ |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
333 |
NS_LOG_DEBUG (" More retries left for the maximum throughput rate."); |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
334 |
station->m_txrate = station->m_maxTpRate; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
335 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
336 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
337 |
//use random rate |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
338 |
else if (station->m_longRetry <= (station->m_minstrelTable[station->m_maxTpRate].adjustedRetryCount + |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
339 |
station->m_minstrelTable[station->m_sampleRate].adjustedRetryCount)) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
340 |
{ |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
341 |
NS_LOG_DEBUG (" More retries left for the sampling rate."); |
6065 | 342 |
station->m_txrate = station->m_sampleRate; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
343 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
344 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
345 |
//use max probability rate |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
346 |
else if (station->m_longRetry <= (station->m_minstrelTable[station->m_maxTpRate].adjustedRetryCount + |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
347 |
station->m_minstrelTable[station->m_sampleRate].adjustedRetryCount + |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
348 |
station->m_minstrelTable[station->m_maxProbRate].adjustedRetryCount )) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
349 |
{ |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
350 |
NS_LOG_DEBUG (" More retries left for the maximum probability rate."); |
6065 | 351 |
station->m_txrate = station->m_maxProbRate; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
352 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
353 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
354 |
//use lowest base rate |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
355 |
else if (station->m_longRetry > (station->m_minstrelTable[station->m_maxTpRate].adjustedRetryCount + |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
356 |
station->m_minstrelTable[station->m_sampleRate].adjustedRetryCount + |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
357 |
station->m_minstrelTable[station->m_maxProbRate].adjustedRetryCount)) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
358 |
{ |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
359 |
NS_LOG_DEBUG (" More retries left for the base rate."); |
6065 | 360 |
station->m_txrate = 0; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
361 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
362 |
} |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
363 |
//current sampling rate is better than current best rate |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
364 |
else |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
365 |
{ |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
366 |
NS_LOG_DEBUG ("Look around rate is faster than the maximum throughput rate."); |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
367 |
//use random rate |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
368 |
if (station->m_longRetry < station->m_minstrelTable[station->m_sampleRate].adjustedRetryCount) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
369 |
{ |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
370 |
NS_LOG_DEBUG (" More retries left for the sampling rate."); |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
371 |
station->m_txrate = station->m_sampleRate; |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
372 |
} |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
373 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
374 |
//use the best throughput rate |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
375 |
else if (station->m_longRetry <= (station->m_minstrelTable[station->m_sampleRate].adjustedRetryCount + |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
376 |
station->m_minstrelTable[station->m_maxTpRate].adjustedRetryCount)) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
377 |
{ |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
378 |
NS_LOG_DEBUG (" More retries left for the maximum throughput rate."); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
379 |
station->m_txrate = station->m_maxTpRate; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
380 |
} |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
381 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
382 |
//use the best probability rate |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
383 |
else if (station->m_longRetry <= (station->m_minstrelTable[station->m_sampleRate].adjustedRetryCount + |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
384 |
station->m_minstrelTable[station->m_maxTpRate].adjustedRetryCount + |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
385 |
station->m_minstrelTable[station->m_maxProbRate].adjustedRetryCount)) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
386 |
{ |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
387 |
NS_LOG_DEBUG (" More retries left for the maximum probability rate."); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
388 |
station->m_txrate = station->m_maxProbRate; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
389 |
} |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
390 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
391 |
//use the lowest base rate |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
392 |
else if (station->m_longRetry > (station->m_minstrelTable[station->m_sampleRate].adjustedRetryCount + |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
393 |
station->m_minstrelTable[station->m_maxTpRate].adjustedRetryCount + |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
394 |
station->m_minstrelTable[station->m_maxProbRate].adjustedRetryCount)) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
395 |
{ |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
396 |
NS_LOG_DEBUG (" More retries left for the base rate."); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
397 |
station->m_txrate = 0; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
398 |
} |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
399 |
} |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
400 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
401 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
402 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
403 |
void |
6065 | 404 |
MinstrelWifiManager::DoReportDataOk (WifiRemoteStation *st, |
405 |
double ackSnr, WifiMode ackMode, double dataSnr) |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
406 |
{ |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
407 |
NS_LOG_FUNCTION (st << ackSnr << ackMode << dataSnr); |
6065 | 408 |
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *) st; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
409 |
|
6065 | 410 |
station->m_isSampling = false; |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
411 |
station->m_sampleRateSlower = false; |
6065 | 412 |
|
413 |
CheckInit (station); |
|
6337 | 414 |
if (!station->m_initialized) |
415 |
{ |
|
416 |
return; |
|
417 |
} |
|
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
418 |
NS_LOG_DEBUG ("DoReportDataOk m_txrate = " << station->m_txrate << ", attempt = " << station->m_minstrelTable[station->m_txrate].numRateAttempt << ", success = " << station->m_minstrelTable[station->m_txrate].numRateSuccess << " (before update)."); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
419 |
|
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
420 |
station->m_minstrelTable[station->m_txrate].numRateSuccess++; |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
421 |
station->m_minstrelTable[station->m_txrate].numRateAttempt++; |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
422 |
|
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
423 |
NS_LOG_DEBUG ("DoReportDataOk m_txrate = " << station->m_txrate << ", attempt = " << station->m_minstrelTable[station->m_txrate].numRateAttempt << ", success = " << station->m_minstrelTable[station->m_txrate].numRateSuccess << " (after update)."); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
424 |
|
6065 | 425 |
UpdateRetry (station); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
426 |
|
6065 | 427 |
station->m_packetCount++; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
428 |
|
6337 | 429 |
if (m_nsupported >= 1) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
430 |
{ |
6065 | 431 |
station->m_txrate = FindRate (station); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
432 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
433 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
434 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
435 |
void |
6065 | 436 |
MinstrelWifiManager::DoReportFinalDataFailed (WifiRemoteStation *st) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
437 |
{ |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
438 |
NS_LOG_FUNCTION (st); |
6065 | 439 |
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *) st; |
11154
305803f4125c
bug 1726: avoid segmentation fault when logging; code cleanup
Matias Richart <mrichart@fing.edu.uy>
parents:
11100
diff
changeset
|
440 |
|
305803f4125c
bug 1726: avoid segmentation fault when logging; code cleanup
Matias Richart <mrichart@fing.edu.uy>
parents:
11100
diff
changeset
|
441 |
CheckInit (station); |
305803f4125c
bug 1726: avoid segmentation fault when logging; code cleanup
Matias Richart <mrichart@fing.edu.uy>
parents:
11100
diff
changeset
|
442 |
if (!station->m_initialized) |
305803f4125c
bug 1726: avoid segmentation fault when logging; code cleanup
Matias Richart <mrichart@fing.edu.uy>
parents:
11100
diff
changeset
|
443 |
{ |
305803f4125c
bug 1726: avoid segmentation fault when logging; code cleanup
Matias Richart <mrichart@fing.edu.uy>
parents:
11100
diff
changeset
|
444 |
return; |
305803f4125c
bug 1726: avoid segmentation fault when logging; code cleanup
Matias Richart <mrichart@fing.edu.uy>
parents:
11100
diff
changeset
|
445 |
} |
305803f4125c
bug 1726: avoid segmentation fault when logging; code cleanup
Matias Richart <mrichart@fing.edu.uy>
parents:
11100
diff
changeset
|
446 |
|
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
447 |
NS_LOG_DEBUG ("DoReportFinalDataFailed m_txrate = " << station->m_txrate << ", attempt = " << station->m_minstrelTable[station->m_txrate].numRateAttempt << ", success = " << station->m_minstrelTable[station->m_txrate].numRateSuccess << " (before update)."); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
448 |
|
6065 | 449 |
station->m_isSampling = false; |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
450 |
station->m_sampleRateSlower = false; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
451 |
|
6065 | 452 |
UpdateRetry (station); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
453 |
|
6065 | 454 |
station->m_err++; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
455 |
|
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
456 |
NS_LOG_DEBUG ("DoReportFinalDataFailed m_txrate = " << station->m_txrate << ", attempt = " << station->m_minstrelTable[station->m_txrate].numRateAttempt << ", success = " << station->m_minstrelTable[station->m_txrate].numRateSuccess << " (after update)."); |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
457 |
|
6337 | 458 |
if (m_nsupported >= 1) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
459 |
{ |
6065 | 460 |
station->m_txrate = FindRate (station); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
461 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
462 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
463 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
464 |
void |
6065 | 465 |
MinstrelWifiManager::UpdateRetry (MinstrelWifiRemoteStation *station) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
466 |
{ |
6065 | 467 |
station->m_retry = station->m_shortRetry + station->m_longRetry; |
468 |
station->m_shortRetry = 0; |
|
469 |
station->m_longRetry = 0; |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
470 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
471 |
|
10139 | 472 |
WifiTxVector |
473 |
MinstrelWifiManager::DoGetDataTxVector (WifiRemoteStation *st, |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
474 |
uint32_t size) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
475 |
{ |
6065 | 476 |
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *) st; |
477 |
if (!station->m_initialized) |
|
478 |
{ |
|
479 |
CheckInit (station); |
|
480 |
||
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
481 |
//start the rate at half way |
6337 | 482 |
station->m_txrate = m_nsupported / 2; |
6065 | 483 |
} |
484 |
UpdateStats (station); |
|
11479
a3dcf66928f3
add support for HT MCS and A-MPDU in radiotap headers
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11450
diff
changeset
|
485 |
return WifiTxVector (GetSupported (station, station->m_txrate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas ()), GetNess (station), GetAggregation (station), GetStbc (station)); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
486 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
487 |
|
10139 | 488 |
WifiTxVector |
489 |
MinstrelWifiManager::DoGetRtsTxVector (WifiRemoteStation *st) |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
490 |
{ |
6065 | 491 |
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *) st; |
492 |
NS_LOG_DEBUG ("DoGetRtsMode m_txrate=" << station->m_txrate); |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
493 |
|
11479
a3dcf66928f3
add support for HT MCS and A-MPDU in radiotap headers
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11450
diff
changeset
|
494 |
return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas ()), GetNess (station), GetAggregation (station), GetStbc (station)); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
495 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
496 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
497 |
bool |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
498 |
MinstrelWifiManager::DoNeedDataRetransmission (WifiRemoteStation *st, Ptr<const Packet> packet, bool normally) |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
499 |
{ |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
500 |
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *)st; |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
501 |
|
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
502 |
CheckInit (station); |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
503 |
if (!station->m_initialized) |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
504 |
{ |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
505 |
return normally; |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
506 |
} |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
507 |
|
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
508 |
if (!station->m_isSampling) |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
509 |
{ |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
510 |
if (station->m_longRetry > (station->m_minstrelTable[station->m_maxTpRate].adjustedRetryCount + |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
511 |
station->m_minstrelTable[station->m_maxTpRate2].adjustedRetryCount + |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
512 |
station->m_minstrelTable[station->m_maxProbRate].adjustedRetryCount + |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
513 |
station->m_minstrelTable[0].adjustedRetryCount)) |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
514 |
{ |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
515 |
return false; |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
516 |
} |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
517 |
else |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
518 |
{ |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
519 |
return true; |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
520 |
} |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
521 |
} |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
522 |
else |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
523 |
{ |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
524 |
if (station->m_longRetry > (station->m_minstrelTable[station->m_sampleRate].adjustedRetryCount + |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
525 |
station->m_minstrelTable[station->m_maxTpRate].adjustedRetryCount + |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
526 |
station->m_minstrelTable[station->m_maxProbRate].adjustedRetryCount + |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
527 |
station->m_minstrelTable[0].adjustedRetryCount)) |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
528 |
{ |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
529 |
return false; |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
530 |
} |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
531 |
else |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
532 |
{ |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
533 |
return true; |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
534 |
} |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
535 |
} |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
536 |
} |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
537 |
|
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
538 |
bool |
6065 | 539 |
MinstrelWifiManager::IsLowLatency (void) const |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
540 |
{ |
6268
84e114d34b89
Bug 802 - Minstrel algorithm causes segmentation fault
Duy Nguyen <dnlove@gmail.com>
parents:
6079
diff
changeset
|
541 |
return true; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
542 |
} |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
543 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
544 |
uint32_t |
6065 | 545 |
MinstrelWifiManager::GetNextSample (MinstrelWifiRemoteStation *station) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
546 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
547 |
uint32_t bitrate; |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
548 |
bitrate = station->m_sampleTable[station->m_index][station->m_col]; |
6065 | 549 |
station->m_index++; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
550 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
551 |
//bookeeping for m_index and m_col variables |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
552 |
if (station->m_index > (m_nsupported - 2)) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
553 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
554 |
station->m_index = 0; |
6065 | 555 |
station->m_col++; |
556 |
if (station->m_col >= m_sampleCol) |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
557 |
{ |
6065 | 558 |
station->m_col = 0; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
559 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
560 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
561 |
return bitrate; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
562 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
563 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
564 |
uint32_t |
6065 | 565 |
MinstrelWifiManager::FindRate (MinstrelWifiRemoteStation *station) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
566 |
{ |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
567 |
NS_LOG_FUNCTION (this << station); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
568 |
|
6065 | 569 |
if ((station->m_sampleCount + station->m_packetCount) == 0) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
570 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
571 |
return 0; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
572 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
573 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
574 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
575 |
uint32_t idx; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
576 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
577 |
//for determining when to try a sample rate |
8981
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
578 |
int coinFlip = m_uniformRandomVariable->GetInteger (0, 100) % 2; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
579 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
580 |
/** |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
581 |
* if we are below the target of look around rate percentage, look around |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
582 |
* note: do it randomly by flipping a coin instead sampling |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
583 |
* all at once until it reaches the look around rate |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
584 |
*/ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
585 |
if ( (((100 * station->m_sampleCount) / (station->m_sampleCount + station->m_packetCount )) < m_lookAroundRate) |
8981
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
586 |
&& (coinFlip == 1) ) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
587 |
{ |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
588 |
NS_LOG_DEBUG ("Using look around rate"); |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
589 |
//now go through the table and find an index rate |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
590 |
idx = GetNextSample (station); |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
591 |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
592 |
/** |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
593 |
* This if condition is used to make sure that we don't need to use |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
594 |
* the sample rate it is the same as our current rate |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
595 |
*/ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
596 |
if (idx != station->m_maxTpRate && idx != station->m_txrate) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
597 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
598 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
599 |
//start sample count |
6065 | 600 |
station->m_sampleCount++; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
601 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
602 |
//set flag that we are currently sampling |
6065 | 603 |
station->m_isSampling = true; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
604 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
605 |
//bookeeping for resetting stuff |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
606 |
if (station->m_packetCount >= 10000) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
607 |
{ |
6065 | 608 |
station->m_sampleCount = 0; |
609 |
station->m_packetCount = 0; |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
610 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
611 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
612 |
//error check |
6645 | 613 |
if (idx >= m_nsupported) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
614 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
615 |
NS_LOG_DEBUG ("ALERT!!! ERROR"); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
616 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
617 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
618 |
//set the rate that we're currently sampling |
6065 | 619 |
station->m_sampleRate = idx; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
620 |
|
6065 | 621 |
if (station->m_sampleRate == station->m_maxTpRate) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
622 |
{ |
6065 | 623 |
station->m_sampleRate = station->m_maxTpRate2; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
624 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
625 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
626 |
//is this rate slower than the current best rate |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
627 |
station->m_sampleRateSlower = |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
628 |
(station->m_minstrelTable[idx].perfectTxTime > station->m_minstrelTable[station->m_maxTpRate].perfectTxTime); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
629 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
630 |
//using the best rate instead |
6065 | 631 |
if (station->m_sampleRateSlower) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
632 |
{ |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
633 |
NS_LOG_DEBUG ("The next look around rate is slower than the maximum throughput rate, continue with the maximum throughput rate: " << station->m_maxTpRate << "(" << GetSupported (station, station->m_maxTpRate) << ")"); |
6065 | 634 |
idx = station->m_maxTpRate; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
635 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
636 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
637 |
} |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
638 |
//continue using the best rate |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
639 |
else |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
640 |
{ |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
641 |
NS_LOG_DEBUG ("Continue using the maximum throughput rate: " << station->m_maxTpRate << "(" << GetSupported (station, station->m_maxTpRate) << ")"); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
642 |
idx = station->m_maxTpRate; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
643 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
644 |
|
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
645 |
NS_LOG_DEBUG ("Rate = " << idx << "(" << GetSupported (station, idx) << ")"); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
646 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
647 |
return idx; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
648 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
649 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
650 |
void |
6065 | 651 |
MinstrelWifiManager::UpdateStats (MinstrelWifiRemoteStation *station) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
652 |
{ |
6065 | 653 |
if (Simulator::Now () < station->m_nextStatsUpdate) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
654 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
655 |
return; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
656 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
657 |
|
6337 | 658 |
if (!station->m_initialized) |
659 |
{ |
|
660 |
return; |
|
661 |
} |
|
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
662 |
NS_LOG_FUNCTION (this); |
6065 | 663 |
station->m_nextStatsUpdate = Simulator::Now () + m_updateStats; |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
664 |
NS_LOG_DEBUG ("Next update at " << station->m_nextStatsUpdate); |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
665 |
NS_LOG_DEBUG ("Currently using rate: " << station->m_txrate << " (" << GetSupported (station, station->m_txrate) << ")"); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
666 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
667 |
Time txTime; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
668 |
uint32_t tempProb; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
669 |
|
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
670 |
NS_LOG_DEBUG ("Index-Rate\t\tAttempt\tSuccess"); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
671 |
for (uint32_t i = 0; i < m_nsupported; i++) |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
672 |
{ |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
673 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
674 |
//calculate the perfect tx time for this rate |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
675 |
txTime = station->m_minstrelTable[i].perfectTxTime; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
676 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
677 |
//just for initialization |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
678 |
if (txTime.GetMicroSeconds () == 0) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
679 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
680 |
txTime = Seconds (1); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
681 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
682 |
|
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
683 |
NS_LOG_DEBUG (i << " " << GetSupported (station, i) << |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
684 |
"\t" << station->m_minstrelTable[i].numRateAttempt << |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
685 |
"\t" << station->m_minstrelTable[i].numRateSuccess); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
686 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
687 |
//if we've attempted something |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
688 |
if (station->m_minstrelTable[i].numRateAttempt) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
689 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
690 |
/** |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
691 |
* calculate the probability of success |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
692 |
* assume probability scales from 0 to 18000 |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
693 |
*/ |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
694 |
tempProb = (station->m_minstrelTable[i].numRateSuccess * 18000) / station->m_minstrelTable[i].numRateAttempt; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
695 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
696 |
//bookeeping |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
697 |
station->m_minstrelTable[i].prob = tempProb; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
698 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
699 |
//ewma probability (cast for gcc 3.4 compatibility) |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
700 |
tempProb = static_cast<uint32_t> (((tempProb * (100 - m_ewmaLevel)) + (station->m_minstrelTable[i].ewmaProb * m_ewmaLevel) ) / 100); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
701 |
|
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
702 |
station->m_minstrelTable[i].ewmaProb = tempProb; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
703 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
704 |
//calculating throughput |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
705 |
station->m_minstrelTable[i].throughput = tempProb * (1000000 / txTime.GetMicroSeconds ()); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
706 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
707 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
708 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
709 |
//bookeeping |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
710 |
station->m_minstrelTable[i].numRateSuccess = 0; |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
711 |
station->m_minstrelTable[i].numRateAttempt = 0; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
712 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
713 |
//Sample less often below 10% and above 95% of success |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
714 |
if ((station->m_minstrelTable[i].ewmaProb > 17100) || (station->m_minstrelTable[i].ewmaProb < 1800)) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
715 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
716 |
/** |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
717 |
* See: http://wireless.kernel.org/en/developers/Documentation/mac80211/RateControl/minstrel/ |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
718 |
* |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
719 |
* Analysis of information showed that the system was sampling too hard at some rates. |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
720 |
* For those rates that never work (54mb, 500m range) there is no point in sending 10 sample packets (< 6 ms time). |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
721 |
* Consequently, for the very very low probability rates, we sample at most twice. |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
722 |
*/ |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
723 |
if (station->m_minstrelTable[i].retryCount > 2) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
724 |
{ |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
725 |
station->m_minstrelTable[i].adjustedRetryCount = 2; |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
726 |
} |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
727 |
else |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
728 |
{ |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
729 |
station->m_minstrelTable[i].adjustedRetryCount = station->m_minstrelTable[i].retryCount; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
730 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
731 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
732 |
else |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
733 |
{ |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
734 |
station->m_minstrelTable[i].adjustedRetryCount = station->m_minstrelTable[i].retryCount; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
735 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
736 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
737 |
//if it's 0 allow one retry limit |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
738 |
if (station->m_minstrelTable[i].adjustedRetryCount == 0) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
739 |
{ |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
740 |
station->m_minstrelTable[i].adjustedRetryCount = 1; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
741 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
742 |
} |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
743 |
|
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
744 |
NS_LOG_DEBUG ("Attempt/success resetted to 0"); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
745 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
746 |
uint32_t max_prob = 0, index_max_prob = 0, max_tp = 0, index_max_tp = 0, index_max_tp2 = 0; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
747 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
748 |
//go find max throughput, second maximum throughput, high probability succ |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
749 |
NS_LOG_DEBUG ("Finding the maximum throughput, second maximum throughput, and highest probability"); |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
750 |
NS_LOG_DEBUG ("Index-Rate\t\tT-put\tEWMA"); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
751 |
for (uint32_t i = 0; i < m_nsupported; i++) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
752 |
{ |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
753 |
NS_LOG_DEBUG (i << " " << GetSupported (station, i) << |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
754 |
"\t" << station->m_minstrelTable[i].throughput << |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
755 |
"\t" << station->m_minstrelTable[i].ewmaProb); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
756 |
|
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
757 |
if (max_tp < station->m_minstrelTable[i].throughput) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
758 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
759 |
index_max_tp = i; |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
760 |
max_tp = station->m_minstrelTable[i].throughput; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
761 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
762 |
|
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
763 |
if (max_prob < station->m_minstrelTable[i].ewmaProb) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
764 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
765 |
index_max_prob = i; |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
766 |
max_prob = station->m_minstrelTable[i].ewmaProb; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
767 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
768 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
769 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
770 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
771 |
max_tp = 0; |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
772 |
//find the second highest max |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
773 |
for (uint32_t i = 0; i < m_nsupported; i++) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
774 |
{ |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
775 |
if ((i != index_max_tp) && (max_tp < station->m_minstrelTable[i].throughput)) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
776 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
777 |
index_max_tp2 = i; |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
778 |
max_tp = station->m_minstrelTable[i].throughput; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
779 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
780 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
781 |
|
6065 | 782 |
station->m_maxTpRate = index_max_tp; |
783 |
station->m_maxTpRate2 = index_max_tp2; |
|
784 |
station->m_maxProbRate = index_max_prob; |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
785 |
|
6065 | 786 |
if (index_max_tp > station->m_txrate) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
787 |
{ |
6065 | 788 |
station->m_txrate = index_max_tp; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
789 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
790 |
|
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
791 |
NS_LOG_DEBUG ("max throughput=" << index_max_tp << "(" << GetSupported (station, index_max_tp) << |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
792 |
")\tsecond max throughput=" << index_max_tp2 << "(" << GetSupported (station, index_max_tp2) << |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
793 |
")\tmax prob=" << index_max_prob << "(" << GetSupported (station, index_max_prob) << ")"); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
794 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
795 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
796 |
void |
6065 | 797 |
MinstrelWifiManager::RateInit (MinstrelWifiRemoteStation *station) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
798 |
{ |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
799 |
NS_LOG_FUNCTION (station); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
800 |
|
6337 | 801 |
for (uint32_t i = 0; i < m_nsupported; i++) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
802 |
{ |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
803 |
NS_LOG_DEBUG ("Initializing rate index " << i << " " << GetSupported (station, i)); |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
804 |
station->m_minstrelTable[i].numRateAttempt = 0; |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
805 |
station->m_minstrelTable[i].numRateSuccess = 0; |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
806 |
station->m_minstrelTable[i].prob = 0; |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
807 |
station->m_minstrelTable[i].ewmaProb = 0; |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
808 |
station->m_minstrelTable[i].throughput = 0; |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
809 |
station->m_minstrelTable[i].perfectTxTime = GetCalcTxTime (GetSupported (station, i)); |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
810 |
NS_LOG_DEBUG (" perfectTxTime = " << station->m_minstrelTable[i].perfectTxTime); |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
811 |
station->m_minstrelTable[i].retryCount = 1; |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
812 |
station->m_minstrelTable[i].adjustedRetryCount = 1; |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
813 |
//Emulating minstrel.c::ath_rate_ctl_reset |
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
814 |
//We only check from 2 to 10 retries. This guarantee that |
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
815 |
//at least one retry is permitter. |
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
816 |
Time totalTxTimeWithGivenRetries = Seconds (0.0); //tx_time in minstrel.c |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
817 |
NS_LOG_DEBUG (" Calculating the number of retries"); |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
818 |
for (uint32_t retries = 2; retries < 11; retries++) |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
819 |
{ |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
820 |
NS_LOG_DEBUG (" Checking " << retries << " retries"); |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
821 |
totalTxTimeWithGivenRetries = CalculateTimeUnicastPacket (station->m_minstrelTable[i].perfectTxTime, 0, retries); |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
822 |
NS_LOG_DEBUG (" totalTxTimeWithGivenRetries = " << totalTxTimeWithGivenRetries); |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
823 |
if (totalTxTimeWithGivenRetries > MilliSeconds (6)) |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
824 |
{ |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
825 |
break; |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
826 |
} |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
827 |
station->m_minstrelTable[i].retryCount = retries; |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
828 |
station->m_minstrelTable[i].adjustedRetryCount = retries; |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
829 |
} |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
830 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
831 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
832 |
|
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
833 |
Time |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
834 |
MinstrelWifiManager::CalculateTimeUnicastPacket (Time dataTransmissionTime, uint32_t shortRetries, uint32_t longRetries) |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
835 |
{ |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
836 |
NS_LOG_FUNCTION (this << dataTransmissionTime << shortRetries << longRetries); |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
837 |
//See rc80211_minstrel.c |
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
838 |
|
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
839 |
//First transmission (DATA + ACK timeout) |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
840 |
Time tt = dataTransmissionTime + GetMac ()->GetAckTimeout (); |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
841 |
|
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
842 |
uint32_t cwMax = 1023; |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
843 |
uint32_t cw = 31; |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
844 |
for (uint32_t retry = 0; retry < longRetries; retry++) |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
845 |
{ |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
846 |
//Add one re-transmission (DATA + ACK timeout) |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
847 |
tt += dataTransmissionTime + GetMac ()->GetAckTimeout (); |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
848 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
849 |
//Add average back off (half the current contention window) |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
850 |
tt += NanoSeconds ((cw / 2) * GetMac ()->GetSlot ()); |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
851 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
852 |
//Update contention window |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
853 |
cw = std::min (cwMax, (cw + 1) * 2); |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
854 |
} |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
855 |
|
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
856 |
return tt; |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
857 |
} |
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
858 |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
859 |
void |
6065 | 860 |
MinstrelWifiManager::InitSampleTable (MinstrelWifiRemoteStation *station) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
861 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
862 |
NS_LOG_DEBUG ("InitSampleTable=" << this); |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
863 |
|
6065 | 864 |
station->m_col = station->m_index = 0; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
865 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
866 |
//for off-seting to make rates fall between 0 and numrates |
6337 | 867 |
uint32_t numSampleRates = m_nsupported; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
868 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
869 |
uint32_t newIndex; |
6065 | 870 |
for (uint32_t col = 0; col < m_sampleCol; col++) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
871 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
872 |
for (uint32_t i = 0; i < numSampleRates; i++ ) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
873 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
874 |
/** |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
875 |
* The next two lines basically tries to generate a random number |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
876 |
* between 0 and the number of available rates |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
877 |
*/ |
8981
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
878 |
int uv = m_uniformRandomVariable->GetInteger (0, numSampleRates); |
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
879 |
newIndex = (i + uv) % numSampleRates; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
880 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
881 |
//this loop is used for filling in other uninitilized places |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
882 |
while (station->m_sampleTable[newIndex][col] != 0) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
883 |
{ |
6337 | 884 |
newIndex = (newIndex + 1) % m_nsupported; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
885 |
} |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
886 |
station->m_sampleTable[newIndex][col] = i; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
887 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
888 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
889 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
890 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
891 |
void |
6065 | 892 |
MinstrelWifiManager::PrintSampleTable (MinstrelWifiRemoteStation *station) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
893 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
894 |
NS_LOG_DEBUG ("PrintSampleTable=" << station); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
895 |
|
6337 | 896 |
uint32_t numSampleRates = m_nsupported; |
11154
305803f4125c
bug 1726: avoid segmentation fault when logging; code cleanup
Matias Richart <mrichart@fing.edu.uy>
parents:
11100
diff
changeset
|
897 |
std::stringstream table; |
6065 | 898 |
for (uint32_t i = 0; i < numSampleRates; i++) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
899 |
{ |
6065 | 900 |
for (uint32_t j = 0; j < m_sampleCol; j++) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
901 |
{ |
11154
305803f4125c
bug 1726: avoid segmentation fault when logging; code cleanup
Matias Richart <mrichart@fing.edu.uy>
parents:
11100
diff
changeset
|
902 |
table << station->m_sampleTable[i][j] << "\t"; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
903 |
} |
11154
305803f4125c
bug 1726: avoid segmentation fault when logging; code cleanup
Matias Richart <mrichart@fing.edu.uy>
parents:
11100
diff
changeset
|
904 |
table << std::endl; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
905 |
} |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
906 |
NS_LOG_DEBUG (table.str ()); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
907 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
908 |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
909 |
void |
6065 | 910 |
MinstrelWifiManager::PrintTable (MinstrelWifiRemoteStation *station) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
911 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
912 |
NS_LOG_DEBUG ("PrintTable=" << station); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
913 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
914 |
for (uint32_t i = 0; i < m_nsupported; i++) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
915 |
{ |
11059
2fe905238013
bug 1726: minstrel rate manager doesn't save state (patch contributions also due to Jonathan Ling and Matías Richart)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
11041
diff
changeset
|
916 |
NS_LOG_DEBUG (i << " (" << GetSupported (station, i) << "): " << station->m_minstrelTable[i].perfectTxTime << ", retryCount = " << station->m_minstrelTable[i].retryCount << ", adjustedRetryCount = " << station->m_minstrelTable[i].adjustedRetryCount); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
917 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
918 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
919 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
920 |
} //namespace ns3 |