author | Ghada Badawy <gbadawy@gmail.com> |
Wed, 28 Jan 2015 10:11:32 -0800 | |
changeset 11174 | 780a43e4980c |
parent 11154 | 305803f4125c |
child 11245 | 5c781d7e5a25 |
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; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
64 |
uint32_t m_maxTpRate; ///< the current throughput rate |
6065 | 65 |
uint32_t m_maxTpRate2; ///< second highest throughput rate |
66 |
uint32_t m_maxProbRate; ///< rate with highest prob of success |
|
67 |
||
68 |
int m_packetCount; ///< total number of packets as of now |
|
69 |
int m_sampleCount; ///< how many packets we have sample so far |
|
70 |
||
71 |
bool m_isSampling; ///< a flag to indicate we are currently sampling |
|
72 |
uint32_t m_sampleRate; ///< current sample rate |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
73 |
bool m_sampleRateSlower; ///< a flag to indicate sample rate is slower |
6065 | 74 |
|
75 |
uint32_t m_shortRetry; ///< short retries such as control packts |
|
76 |
uint32_t m_longRetry; ///< long retries such as data packets |
|
77 |
uint32_t m_retry; ///< total retries short + long |
|
78 |
uint32_t m_err; ///< retry errors |
|
79 |
uint32_t m_txrate; ///< current transmit rate |
|
80 |
||
81 |
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
|
82 |
|
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
|
83 |
MinstrelRate m_minstrelTable; ///< minstrel table |
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
|
84 |
SampleRate m_sampleTable; ///< sample table |
6065 | 85 |
}; |
86 |
||
10652
dc18deba4502
[doxygen] Revert r10410, r10411, r10412
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10483
diff
changeset
|
87 |
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
|
88 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
89 |
TypeId |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
90 |
MinstrelWifiManager::GetTypeId (void) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
91 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
92 |
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
|
93 |
.SetParent<WifiRemoteStationManager> () |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
94 |
.AddConstructor<MinstrelWifiManager> () |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
95 |
.AddAttribute ("UpdateStatistics", |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
96 |
"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
|
97 |
TimeValue (Seconds (0.1)), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
98 |
MakeTimeAccessor (&MinstrelWifiManager::m_updateStats), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
99 |
MakeTimeChecker ()) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
100 |
.AddAttribute ("LookAroundRate", |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
101 |
"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
|
102 |
DoubleValue (10), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
103 |
MakeDoubleAccessor (&MinstrelWifiManager::m_lookAroundRate), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
104 |
MakeDoubleChecker<double> ()) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
105 |
.AddAttribute ("EWMA", |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
106 |
"EWMA level", |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
107 |
DoubleValue (75), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
108 |
MakeDoubleAccessor (&MinstrelWifiManager::m_ewmaLevel), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
109 |
MakeDoubleChecker<double> ()) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
110 |
.AddAttribute ("SampleColumn", |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
111 |
"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
|
112 |
DoubleValue (10), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
113 |
MakeDoubleAccessor (&MinstrelWifiManager::m_sampleCol), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
114 |
MakeDoubleChecker <double> ()) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
115 |
.AddAttribute ("PacketLength", |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
116 |
"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
|
117 |
DoubleValue (1200), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
118 |
MakeDoubleAccessor (&MinstrelWifiManager::m_pktLen), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
119 |
MakeDoubleChecker <double> ()) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
120 |
; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
121 |
return tid; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
122 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
123 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
124 |
MinstrelWifiManager::MinstrelWifiManager () |
6337 | 125 |
{ |
8981
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
126 |
m_uniformRandomVariable = CreateObject<UniformRandomVariable> (); |
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
127 |
|
6337 | 128 |
m_nsupported = 0; |
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 |
MinstrelWifiManager::~MinstrelWifiManager () |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
132 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
133 |
} |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
134 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
135 |
void |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
136 |
MinstrelWifiManager::SetupPhy (Ptr<WifiPhy> phy) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
137 |
{ |
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
|
138 |
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
|
139 |
uint32_t nModes = phy->GetNModes (); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
140 |
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
|
141 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
142 |
WifiMode mode = phy->GetMode (i); |
10139 | 143 |
WifiTxVector txVector; |
144 |
txVector.SetMode(mode); |
|
11174
780a43e4980c
add MPDU aggregation (with contributions from Sebastien Deronne and Ioannis Selinis)
Ghada Badawy <gbadawy@gmail.com>
parents:
11154
diff
changeset
|
145 |
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
|
146 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
147 |
WifiRemoteStationManager::SetupPhy (phy); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
148 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
149 |
|
8981
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
150 |
int64_t |
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
151 |
MinstrelWifiManager::AssignStreams (int64_t stream) |
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 |
NS_LOG_FUNCTION (this << stream); |
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
154 |
m_uniformRandomVariable->SetStream (stream); |
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
155 |
return 1; |
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
156 |
} |
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
157 |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
158 |
Time |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
159 |
MinstrelWifiManager::GetCalcTxTime (WifiMode mode) const |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
160 |
{ |
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 |
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
|
163 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
164 |
if (mode == i->second) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
165 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
166 |
return i->first; |
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 |
NS_ASSERT (false); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
170 |
return Seconds (0); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
171 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
172 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
173 |
void |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
174 |
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
|
175 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
176 |
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
|
177 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
178 |
|
6065 | 179 |
WifiRemoteStation * |
180 |
MinstrelWifiManager::DoCreateStation (void) const |
|
181 |
{ |
|
182 |
MinstrelWifiRemoteStation *station = new MinstrelWifiRemoteStation (); |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
183 |
|
6065 | 184 |
station->m_nextStatsUpdate = Simulator::Now () + m_updateStats; |
185 |
station->m_col = 0; |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
186 |
station->m_index = 0; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
187 |
station->m_maxTpRate = 0; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
188 |
station->m_maxTpRate2 = 0; |
6065 | 189 |
station->m_maxProbRate = 0; |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
190 |
station->m_packetCount = 0; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
191 |
station->m_sampleCount = 0; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
192 |
station->m_isSampling = false; |
6065 | 193 |
station->m_sampleRate = 0; |
194 |
station->m_sampleRateSlower = false; |
|
195 |
station->m_shortRetry = 0; |
|
196 |
station->m_longRetry = 0; |
|
197 |
station->m_retry = 0; |
|
198 |
station->m_err = 0; |
|
199 |
station->m_txrate = 0; |
|
200 |
station->m_initialized = false; |
|
201 |
||
202 |
return station; |
|
203 |
} |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
204 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
205 |
void |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
206 |
MinstrelWifiManager::CheckInit (MinstrelWifiRemoteStation *station) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
207 |
{ |
6337 | 208 |
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
|
209 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
210 |
// Note: we appear to be doing late initialization of the table |
6065 | 211 |
// to make sure that the set of supported rates has been initialized |
212 |
// before we perform our own initialization. |
|
6337 | 213 |
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
|
214 |
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
|
215 |
station->m_sampleTable = SampleRate (m_nsupported, std::vector<uint32_t> (m_sampleCol)); |
6065 | 216 |
InitSampleTable (station); |
217 |
RateInit (station); |
|
218 |
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
|
219 |
|
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
|
220 |
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
|
221 |
PrintSampleTable (station); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
222 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
223 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
224 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
225 |
void |
6065 | 226 |
MinstrelWifiManager::DoReportRxOk (WifiRemoteStation *st, |
227 |
double rxSnr, WifiMode txMode) |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
228 |
{ |
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
|
229 |
NS_LOG_FUNCTION (this); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
230 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
231 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
232 |
void |
6065 | 233 |
MinstrelWifiManager::DoReportRtsFailed (WifiRemoteStation *st) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
234 |
{ |
6065 | 235 |
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *)st; |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
236 |
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
|
237 |
|
6065 | 238 |
station->m_shortRetry++; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
239 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
240 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
241 |
void |
6065 | 242 |
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
|
243 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
244 |
NS_LOG_DEBUG ("self=" << st << " rts ok"); |
6065 | 245 |
} |
246 |
||
247 |
void |
|
248 |
MinstrelWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *st) |
|
249 |
{ |
|
250 |
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *)st; |
|
251 |
UpdateRetry (station); |
|
252 |
station->m_err++; |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
253 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
254 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
255 |
void |
6065 | 256 |
MinstrelWifiManager::DoReportDataFailed (WifiRemoteStation *st) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
257 |
{ |
6065 | 258 |
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *)st; |
259 |
/** |
|
260 |
* |
|
261 |
* Retry Chain table is implemented here |
|
262 |
* |
|
263 |
* Try | LOOKAROUND RATE | NORMAL RATE |
|
264 |
* | random < best | random > best | |
|
265 |
* -------------------------------------------------------------- |
|
266 |
* 1 | Best throughput | Random rate | Best throughput |
|
267 |
* 2 | Random rate | Best throughput | Next best throughput |
|
268 |
* 3 | Best probability | Best probability | Best probability |
|
269 |
* 4 | Lowest Baserate | Lowest baserate | Lowest baserate |
|
270 |
* |
|
271 |
* Note: For clarity, multiple blocks of if's and else's are used |
|
272 |
* After a failing 7 times, DoReportFinalDataFailed will be called |
|
273 |
*/ |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
274 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
275 |
CheckInit (station); |
6337 | 276 |
if (!station->m_initialized) |
277 |
{ |
|
278 |
return; |
|
279 |
} |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
280 |
|
6065 | 281 |
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
|
282 |
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
|
283 |
|
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
|
284 |
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
|
285 |
|
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
|
286 |
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
|
287 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
288 |
/// for normal rate, we're not currently sampling random rates |
6065 | 289 |
if (!station->m_isSampling) |
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 ("Failed with normal rate: current=" << station->m_txrate << ", sample=" << station->m_sampleRate << ", maxTp=" << station->m_maxTpRate << ", maxTp2=" << station->m_maxTpRate2 << ", maxProb=" << station->m_maxProbRate); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
292 |
/// 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
|
293 |
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
|
294 |
{ |
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
|
295 |
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
|
296 |
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
|
297 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
298 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
299 |
/// 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
|
300 |
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
|
301 |
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
|
302 |
{ |
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
|
303 |
NS_LOG_DEBUG (" More retries left for the second maximum throughput rate."); |
6065 | 304 |
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
|
305 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
306 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
307 |
/// 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
|
308 |
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
|
309 |
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
|
310 |
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
|
311 |
{ |
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
|
312 |
NS_LOG_DEBUG (" More retries left for the maximum probability rate."); |
6065 | 313 |
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
|
314 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
315 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
316 |
/// 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
|
317 |
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
|
318 |
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
|
319 |
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
|
320 |
{ |
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
|
321 |
NS_LOG_DEBUG (" More retries left for the base rate."); |
6065 | 322 |
station->m_txrate = 0; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
323 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
324 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
325 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
326 |
/// for look-around rate, we're currently sampling random rates |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
327 |
else |
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 ("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); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
330 |
/// current sampling rate is slower than the current best rate |
6065 | 331 |
if (station->m_sampleRateSlower) |
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 ("Look around rate is slower than the maximum throughput rate."); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
334 |
/// 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
|
335 |
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
|
336 |
{ |
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
|
337 |
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
|
338 |
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
|
339 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
340 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
341 |
/// 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
|
342 |
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
|
343 |
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
|
344 |
{ |
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
|
345 |
NS_LOG_DEBUG (" More retries left for the sampling rate."); |
6065 | 346 |
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
|
347 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
348 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
349 |
/// 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
|
350 |
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
|
351 |
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
|
352 |
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
|
353 |
{ |
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
|
354 |
NS_LOG_DEBUG (" More retries left for the maximum probability rate."); |
6065 | 355 |
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
|
356 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
357 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
358 |
/// 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
|
359 |
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
|
360 |
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
|
361 |
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
|
362 |
{ |
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
|
363 |
NS_LOG_DEBUG (" More retries left for the base rate."); |
6065 | 364 |
station->m_txrate = 0; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
365 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
366 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
367 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
368 |
/// current sampling rate is better than current best rate |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
369 |
else |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
370 |
{ |
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
|
371 |
NS_LOG_DEBUG ("Look around rate is faster than the maximum throughput rate."); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
372 |
/// 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
|
373 |
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
|
374 |
{ |
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 |
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
|
376 |
station->m_txrate = station->m_sampleRate; |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
377 |
} |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
378 |
|
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
|
379 |
/// use the best 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
|
380 |
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
|
381 |
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
|
382 |
{ |
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 |
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
|
384 |
station->m_txrate = station->m_maxTpRate; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
385 |
} |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
386 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
387 |
/// 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
|
388 |
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
|
389 |
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
|
390 |
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
|
391 |
{ |
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 |
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
|
393 |
station->m_txrate = station->m_maxProbRate; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
394 |
} |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
395 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
396 |
/// 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
|
397 |
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
|
398 |
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
|
399 |
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
|
400 |
{ |
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
|
401 |
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
|
402 |
station->m_txrate = 0; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
403 |
} |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
404 |
} |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
405 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
406 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
407 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
408 |
void |
6065 | 409 |
MinstrelWifiManager::DoReportDataOk (WifiRemoteStation *st, |
410 |
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
|
411 |
{ |
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
|
412 |
NS_LOG_FUNCTION (st << ackSnr << ackMode << dataSnr); |
6065 | 413 |
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *) st; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
414 |
|
6065 | 415 |
station->m_isSampling = false; |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
416 |
station->m_sampleRateSlower = false; |
6065 | 417 |
|
418 |
CheckInit (station); |
|
6337 | 419 |
if (!station->m_initialized) |
420 |
{ |
|
421 |
return; |
|
422 |
} |
|
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
|
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 << " (before update)."); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
424 |
|
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
|
425 |
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
|
426 |
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
|
427 |
|
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
|
428 |
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
|
429 |
|
6065 | 430 |
UpdateRetry (station); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
431 |
|
6065 | 432 |
station->m_packetCount++; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
433 |
|
6337 | 434 |
if (m_nsupported >= 1) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
435 |
{ |
6065 | 436 |
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
|
437 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
438 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
439 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
440 |
void |
6065 | 441 |
MinstrelWifiManager::DoReportFinalDataFailed (WifiRemoteStation *st) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
442 |
{ |
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
|
443 |
NS_LOG_FUNCTION (st); |
6065 | 444 |
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
|
445 |
|
305803f4125c
bug 1726: avoid segmentation fault when logging; code cleanup
Matias Richart <mrichart@fing.edu.uy>
parents:
11100
diff
changeset
|
446 |
CheckInit (station); |
305803f4125c
bug 1726: avoid segmentation fault when logging; code cleanup
Matias Richart <mrichart@fing.edu.uy>
parents:
11100
diff
changeset
|
447 |
if (!station->m_initialized) |
305803f4125c
bug 1726: avoid segmentation fault when logging; code cleanup
Matias Richart <mrichart@fing.edu.uy>
parents:
11100
diff
changeset
|
448 |
{ |
305803f4125c
bug 1726: avoid segmentation fault when logging; code cleanup
Matias Richart <mrichart@fing.edu.uy>
parents:
11100
diff
changeset
|
449 |
return; |
305803f4125c
bug 1726: avoid segmentation fault when logging; code cleanup
Matias Richart <mrichart@fing.edu.uy>
parents:
11100
diff
changeset
|
450 |
} |
305803f4125c
bug 1726: avoid segmentation fault when logging; code cleanup
Matias Richart <mrichart@fing.edu.uy>
parents:
11100
diff
changeset
|
451 |
|
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
|
452 |
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
|
453 |
|
6065 | 454 |
station->m_isSampling = false; |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
455 |
station->m_sampleRateSlower = false; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
456 |
|
6065 | 457 |
UpdateRetry (station); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
458 |
|
6065 | 459 |
station->m_err++; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
460 |
|
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
|
461 |
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
|
462 |
|
6337 | 463 |
if (m_nsupported >= 1) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
464 |
{ |
6065 | 465 |
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
|
466 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
467 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
468 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
469 |
void |
6065 | 470 |
MinstrelWifiManager::UpdateRetry (MinstrelWifiRemoteStation *station) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
471 |
{ |
6065 | 472 |
station->m_retry = station->m_shortRetry + station->m_longRetry; |
473 |
station->m_shortRetry = 0; |
|
474 |
station->m_longRetry = 0; |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
475 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
476 |
|
10139 | 477 |
WifiTxVector |
478 |
MinstrelWifiManager::DoGetDataTxVector (WifiRemoteStation *st, |
|
6065 | 479 |
uint32_t size) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
480 |
{ |
6065 | 481 |
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *) st; |
482 |
if (!station->m_initialized) |
|
483 |
{ |
|
484 |
CheckInit (station); |
|
485 |
||
486 |
/// start the rate at half way |
|
6337 | 487 |
station->m_txrate = m_nsupported / 2; |
6065 | 488 |
} |
489 |
UpdateStats (station); |
|
11100
86e53d8a4cfe
bug 2026: 802.11n Ness parameter badly set for data frames
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11059
diff
changeset
|
490 |
return WifiTxVector (GetSupported (station, station->m_txrate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas()), GetNess (station), GetStbc (station)); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
491 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
492 |
|
10139 | 493 |
WifiTxVector |
494 |
MinstrelWifiManager::DoGetRtsTxVector (WifiRemoteStation *st) |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
495 |
{ |
6065 | 496 |
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *) st; |
497 |
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
|
498 |
|
11100
86e53d8a4cfe
bug 2026: 802.11n Ness parameter badly set for data frames
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11059
diff
changeset
|
499 |
return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas()), GetNess (station), GetStbc (station)); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
500 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
501 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
502 |
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
|
503 |
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
|
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 |
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
|
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 |
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
|
508 |
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
|
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 |
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
|
511 |
} |
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 |
|
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 |
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
|
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 |
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
|
516 |
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
|
517 |
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
|
518 |
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
|
519 |
{ |
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 |
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
|
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 |
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
|
525 |
} |
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 |
} |
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 |
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
|
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 |
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
|
530 |
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
|
531 |
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
|
532 |
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
|
533 |
{ |
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 |
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
|
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 |
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
|
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 |
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
|
539 |
} |
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
|
540 |
} |
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
|
541 |
} |
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
|
542 |
|
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
|
543 |
bool |
6065 | 544 |
MinstrelWifiManager::IsLowLatency (void) const |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
545 |
{ |
6268
84e114d34b89
Bug 802 - Minstrel algorithm causes segmentation fault
Duy Nguyen <dnlove@gmail.com>
parents:
6079
diff
changeset
|
546 |
return true; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
547 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
548 |
uint32_t |
6065 | 549 |
MinstrelWifiManager::GetNextSample (MinstrelWifiRemoteStation *station) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
550 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
551 |
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
|
552 |
bitrate = station->m_sampleTable[station->m_index][station->m_col]; |
6065 | 553 |
station->m_index++; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
554 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
555 |
/// 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
|
556 |
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
|
557 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
558 |
station->m_index = 0; |
6065 | 559 |
station->m_col++; |
560 |
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
|
561 |
{ |
6065 | 562 |
station->m_col = 0; |
4703
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 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
565 |
return bitrate; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
566 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
567 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
568 |
uint32_t |
6065 | 569 |
MinstrelWifiManager::FindRate (MinstrelWifiRemoteStation *station) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
570 |
{ |
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
|
571 |
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
|
572 |
|
6065 | 573 |
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
|
574 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
575 |
return 0; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
576 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
577 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
578 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
579 |
uint32_t idx; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
580 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
581 |
/// for determining when to try a sample rate |
8981
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
582 |
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
|
583 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
584 |
/** |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
585 |
* 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
|
586 |
* 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
|
587 |
* 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
|
588 |
*/ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
589 |
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
|
590 |
&& (coinFlip == 1) ) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
591 |
{ |
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
|
592 |
NS_LOG_DEBUG ("Using look around rate"); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
593 |
/// 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
|
594 |
idx = GetNextSample (station); |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
595 |
|
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
596 |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
597 |
/** |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
598 |
* 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
|
599 |
* 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
|
600 |
*/ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
601 |
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
|
602 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
603 |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
604 |
/// start sample count |
6065 | 605 |
station->m_sampleCount++; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
606 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
607 |
/// set flag that we are currently sampling |
6065 | 608 |
station->m_isSampling = true; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
609 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
610 |
/// bookeeping for resetting stuff |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
611 |
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
|
612 |
{ |
6065 | 613 |
station->m_sampleCount = 0; |
614 |
station->m_packetCount = 0; |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
615 |
} |
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 |
/// error check |
6645 | 618 |
if (idx >= m_nsupported) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
619 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
620 |
NS_LOG_DEBUG ("ALERT!!! ERROR"); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
621 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
622 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
623 |
/// set the rate that we're currently sampling |
6065 | 624 |
station->m_sampleRate = idx; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
625 |
|
6065 | 626 |
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
|
627 |
{ |
6065 | 628 |
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
|
629 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
630 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
631 |
/// 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
|
632 |
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
|
633 |
(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
|
634 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
635 |
/// using the best rate instead |
6065 | 636 |
if (station->m_sampleRateSlower) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
637 |
{ |
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
|
638 |
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 | 639 |
idx = station->m_maxTpRate; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
640 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
641 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
642 |
} |
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 |
/// continue using the best rate |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
645 |
else |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
646 |
{ |
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
|
647 |
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
|
648 |
idx = station->m_maxTpRate; |
4703
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 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
651 |
|
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
|
652 |
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
|
653 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
654 |
return idx; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
655 |
} |
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 |
void |
6065 | 658 |
MinstrelWifiManager::UpdateStats (MinstrelWifiRemoteStation *station) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
659 |
{ |
6065 | 660 |
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
|
661 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
662 |
return; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
663 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
664 |
|
6337 | 665 |
if (!station->m_initialized) |
666 |
{ |
|
667 |
return; |
|
668 |
} |
|
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
|
669 |
NS_LOG_FUNCTION (this); |
6065 | 670 |
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
|
671 |
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
|
672 |
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
|
673 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
674 |
Time txTime; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
675 |
uint32_t tempProb; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
676 |
|
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
|
677 |
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
|
678 |
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
|
679 |
{ |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
680 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
681 |
/// 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
|
682 |
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
|
683 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
684 |
/// just for initialization |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
685 |
if (txTime.GetMicroSeconds () == 0) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
686 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
687 |
txTime = Seconds (1); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
688 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
689 |
|
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
|
690 |
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
|
691 |
"\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
|
692 |
"\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
|
693 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
694 |
/// 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
|
695 |
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
|
696 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
697 |
/** |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
698 |
* calculate the probability of success |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
699 |
* 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
|
700 |
*/ |
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
|
701 |
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
|
702 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
703 |
/// 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
|
704 |
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
|
705 |
|
4725
4e068296f09f
fix build for gcc 3.4
Craig Dowell <craigdo@ee.washington.edu>
parents:
4703
diff
changeset
|
706 |
/// 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
|
707 |
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
|
708 |
|
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
|
709 |
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
|
710 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
711 |
/// 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
|
712 |
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
|
713 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
714 |
} |
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 |
/// 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
|
717 |
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
|
718 |
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
|
719 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
720 |
/// 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
|
721 |
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
|
722 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
723 |
/** |
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
|
724 |
* 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
|
725 |
* |
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 |
* 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
|
727 |
* For those rates that never work (54mb, 500m range) there is no point in sending 10 sample packets (< 6 ms 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
|
728 |
* 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
|
729 |
*/ |
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
|
730 |
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
|
731 |
{ |
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
|
732 |
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
|
733 |
} |
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 |
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
|
735 |
{ |
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
|
736 |
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
|
737 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
738 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
739 |
else |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
740 |
{ |
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
|
741 |
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
|
742 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
743 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
744 |
/// 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
|
745 |
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
|
746 |
{ |
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
|
747 |
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
|
748 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
749 |
} |
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
|
750 |
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
|
751 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
752 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
753 |
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
|
754 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
755 |
/// 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
|
756 |
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
|
757 |
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
|
758 |
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
|
759 |
{ |
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 |
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
|
761 |
"\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
|
762 |
"\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
|
763 |
|
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
|
764 |
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
|
765 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
766 |
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
|
767 |
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
|
768 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
769 |
|
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
|
770 |
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
|
771 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
772 |
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
|
773 |
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
|
774 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
775 |
} |
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 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
778 |
max_tp = 0; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
779 |
/// find the second highest max |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
780 |
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
|
781 |
{ |
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
|
782 |
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
|
783 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
784 |
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
|
785 |
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
|
786 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
787 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
788 |
|
6065 | 789 |
station->m_maxTpRate = index_max_tp; |
790 |
station->m_maxTpRate2 = index_max_tp2; |
|
791 |
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
|
792 |
|
6065 | 793 |
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
|
794 |
{ |
6065 | 795 |
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
|
796 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
797 |
|
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
|
798 |
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
|
799 |
")\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
|
800 |
")\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
|
801 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
802 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
803 |
void |
6065 | 804 |
MinstrelWifiManager::RateInit (MinstrelWifiRemoteStation *station) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
805 |
{ |
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
|
806 |
NS_LOG_FUNCTION (station); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
807 |
|
6337 | 808 |
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
|
809 |
{ |
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
|
810 |
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
|
811 |
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
|
812 |
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
|
813 |
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
|
814 |
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
|
815 |
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
|
816 |
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
|
817 |
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
|
818 |
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
|
819 |
station->m_minstrelTable[i].adjustedRetryCount = 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
|
820 |
// Emulating minstrel.c::ath_rate_ctl_reset |
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 |
// We only check from 2 to 10 retries. This guarantee that |
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 |
// at least one retry is permitter. |
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 |
Time totalTxTimeWithGivenRetries = Seconds (0.0); // tx_time in minstrel.c |
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 |
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
|
825 |
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
|
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 |
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
|
828 |
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
|
829 |
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
|
830 |
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
|
831 |
{ |
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
|
832 |
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
|
833 |
} |
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 |
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
|
835 |
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
|
836 |
} |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
837 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
838 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
839 |
|
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
|
840 |
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
|
841 |
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
|
842 |
{ |
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 |
NS_LOG_FUNCTION (this << dataTransmissionTime << shortRetries << 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
|
844 |
// See rc80211_minstrel.c |
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 |
|
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
|
846 |
//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
|
847 |
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
|
848 |
|
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
|
849 |
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
|
850 |
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
|
851 |
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
|
852 |
{ |
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 |
// Add one re-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
|
854 |
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
|
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 |
// Add average back off (half the current contention window) |
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 |
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
|
858 |
|
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
|
859 |
// Update contention window |
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
|
860 |
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
|
861 |
} |
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
|
862 |
|
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
|
863 |
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
|
864 |
} |
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
|
865 |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
866 |
void |
6065 | 867 |
MinstrelWifiManager::InitSampleTable (MinstrelWifiRemoteStation *station) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
868 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
869 |
NS_LOG_DEBUG ("InitSampleTable=" << this); |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
870 |
|
6065 | 871 |
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
|
872 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
873 |
/// for off-seting to make rates fall between 0 and numrates |
6337 | 874 |
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
|
875 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
876 |
uint32_t newIndex; |
6065 | 877 |
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
|
878 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
879 |
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
|
880 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
881 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
882 |
/** |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
883 |
* 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
|
884 |
* 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
|
885 |
*/ |
8981
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
886 |
int uv = m_uniformRandomVariable->GetInteger (0, numSampleRates); |
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
887 |
newIndex = (i + uv) % numSampleRates; |
4703
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 |
/// 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
|
890 |
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
|
891 |
{ |
6337 | 892 |
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
|
893 |
} |
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
|
894 |
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
|
895 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
896 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
897 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
898 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
899 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
900 |
void |
6065 | 901 |
MinstrelWifiManager::PrintSampleTable (MinstrelWifiRemoteStation *station) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
902 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
903 |
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
|
904 |
|
6337 | 905 |
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
|
906 |
std::stringstream table; |
6065 | 907 |
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
|
908 |
{ |
6065 | 909 |
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
|
910 |
{ |
11154
305803f4125c
bug 1726: avoid segmentation fault when logging; code cleanup
Matias Richart <mrichart@fing.edu.uy>
parents:
11100
diff
changeset
|
911 |
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
|
912 |
} |
11154
305803f4125c
bug 1726: avoid segmentation fault when logging; code cleanup
Matias Richart <mrichart@fing.edu.uy>
parents:
11100
diff
changeset
|
913 |
table << std::endl; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
914 |
} |
11154
305803f4125c
bug 1726: avoid segmentation fault when logging; code cleanup
Matias Richart <mrichart@fing.edu.uy>
parents:
11100
diff
changeset
|
915 |
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
|
916 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
917 |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
918 |
void |
6065 | 919 |
MinstrelWifiManager::PrintTable (MinstrelWifiRemoteStation *station) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
920 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
921 |
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
|
922 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
923 |
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
|
924 |
{ |
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
|
925 |
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
|
926 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
927 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
928 |
|
7386
2310ed220a61
standardize ns-3 namespace declaration format
Vedran Miletić <rivanvx@gmail.com>
parents:
7252
diff
changeset
|
929 |
} // namespace ns3 |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
930 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
931 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
932 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
933 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
934 |