author | Ghada Badawy <gbadawy@gmail.com> |
Tue, 13 Aug 2013 22:05:25 -0700 | |
changeset 10139 | 17a71cd49da3 |
parent 8981 | 7e1c95c4d1a7 |
child 10218 | 97da49da2d6c |
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 |
||
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
43 |
NS_LOG_COMPONENT_DEFINE ("MinstrelWifiManager"); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
44 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
45 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
46 |
namespace ns3 { |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
47 |
|
6065 | 48 |
|
49 |
struct MinstrelWifiRemoteStation : public WifiRemoteStation |
|
50 |
{ |
|
51 |
Time m_nextStatsUpdate; ///< 10 times every second |
|
52 |
||
53 |
/** |
|
54 |
* To keep track of the current position in the our random sample table |
|
55 |
* going row by row from 1st column until the 10th column(Minstrel defines 10) |
|
56 |
* then we wrap back to the row 1 col 1. |
|
57 |
* note: there are many other ways to do this. |
|
58 |
*/ |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
59 |
uint32_t m_col, m_index; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
60 |
uint32_t m_maxTpRate; ///< the current throughput rate |
6065 | 61 |
uint32_t m_maxTpRate2; ///< second highest throughput rate |
62 |
uint32_t m_maxProbRate; ///< rate with highest prob of success |
|
63 |
||
64 |
int m_packetCount; ///< total number of packets as of now |
|
65 |
int m_sampleCount; ///< how many packets we have sample so far |
|
66 |
||
67 |
bool m_isSampling; ///< a flag to indicate we are currently sampling |
|
68 |
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
|
69 |
bool m_sampleRateSlower; ///< a flag to indicate sample rate is slower |
6065 | 70 |
uint32_t m_currentRate; ///< current rate we are using |
71 |
||
72 |
uint32_t m_shortRetry; ///< short retries such as control packts |
|
73 |
uint32_t m_longRetry; ///< long retries such as data packets |
|
74 |
uint32_t m_retry; ///< total retries short + long |
|
75 |
uint32_t m_err; ///< retry errors |
|
76 |
uint32_t m_txrate; ///< current transmit rate |
|
77 |
||
78 |
bool m_initialized; ///< for initializing tables |
|
79 |
}; |
|
80 |
||
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
81 |
NS_OBJECT_ENSURE_REGISTERED (MinstrelWifiManager); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
82 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
83 |
TypeId |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
84 |
MinstrelWifiManager::GetTypeId (void) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
85 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
86 |
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
|
87 |
.SetParent<WifiRemoteStationManager> () |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
88 |
.AddConstructor<MinstrelWifiManager> () |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
89 |
.AddAttribute ("UpdateStatistics", |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
90 |
"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
|
91 |
TimeValue (Seconds (0.1)), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
92 |
MakeTimeAccessor (&MinstrelWifiManager::m_updateStats), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
93 |
MakeTimeChecker ()) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
94 |
.AddAttribute ("LookAroundRate", |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
95 |
"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
|
96 |
DoubleValue (10), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
97 |
MakeDoubleAccessor (&MinstrelWifiManager::m_lookAroundRate), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
98 |
MakeDoubleChecker<double> ()) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
99 |
.AddAttribute ("EWMA", |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
100 |
"EWMA level", |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
101 |
DoubleValue (75), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
102 |
MakeDoubleAccessor (&MinstrelWifiManager::m_ewmaLevel), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
103 |
MakeDoubleChecker<double> ()) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
104 |
.AddAttribute ("SegmentSize", |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
105 |
"The largest allowable segment size packet", |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
106 |
DoubleValue (6000), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
107 |
MakeDoubleAccessor (&MinstrelWifiManager::m_segmentSize), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
108 |
MakeDoubleChecker <double> ()) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
109 |
.AddAttribute ("SampleColumn", |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
110 |
"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
|
111 |
DoubleValue (10), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
112 |
MakeDoubleAccessor (&MinstrelWifiManager::m_sampleCol), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
113 |
MakeDoubleChecker <double> ()) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
114 |
.AddAttribute ("PacketLength", |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
115 |
"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
|
116 |
DoubleValue (1200), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
117 |
MakeDoubleAccessor (&MinstrelWifiManager::m_pktLen), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
118 |
MakeDoubleChecker <double> ()) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
119 |
; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
120 |
return tid; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
121 |
} |
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 |
MinstrelWifiManager::MinstrelWifiManager () |
6337 | 124 |
{ |
8981
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
125 |
m_uniformRandomVariable = CreateObject<UniformRandomVariable> (); |
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
126 |
|
6337 | 127 |
m_nsupported = 0; |
128 |
} |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
129 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
130 |
MinstrelWifiManager::~MinstrelWifiManager () |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
131 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
132 |
} |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
133 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
134 |
void |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
135 |
MinstrelWifiManager::SetupPhy (Ptr<WifiPhy> phy) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
136 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
137 |
uint32_t nModes = phy->GetNModes (); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
138 |
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
|
139 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
140 |
WifiMode mode = phy->GetMode (i); |
10139 | 141 |
WifiTxVector txVector; |
142 |
txVector.SetMode(mode); |
|
143 |
AddCalcTxTime (mode, phy->CalculateTxDuration (m_pktLen, txVector, WIFI_PREAMBLE_LONG)); |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
144 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
145 |
WifiRemoteStationManager::SetupPhy (phy); |
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 |
|
8981
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
148 |
int64_t |
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
149 |
MinstrelWifiManager::AssignStreams (int64_t stream) |
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
150 |
{ |
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
151 |
NS_LOG_FUNCTION (this << stream); |
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
152 |
m_uniformRandomVariable->SetStream (stream); |
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
153 |
return 1; |
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
154 |
} |
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
155 |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
156 |
Time |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
157 |
MinstrelWifiManager::GetCalcTxTime (WifiMode mode) const |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
158 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
159 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
160 |
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
|
161 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
162 |
if (mode == i->second) |
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 |
return i->first; |
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 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
167 |
NS_ASSERT (false); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
168 |
return Seconds (0); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
169 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
170 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
171 |
void |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
172 |
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
|
173 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
174 |
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
|
175 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
176 |
|
6065 | 177 |
WifiRemoteStation * |
178 |
MinstrelWifiManager::DoCreateStation (void) const |
|
179 |
{ |
|
180 |
MinstrelWifiRemoteStation *station = new MinstrelWifiRemoteStation (); |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
181 |
|
6065 | 182 |
station->m_nextStatsUpdate = Simulator::Now () + m_updateStats; |
183 |
station->m_col = 0; |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
184 |
station->m_index = 0; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
185 |
station->m_maxTpRate = 0; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
186 |
station->m_maxTpRate2 = 0; |
6065 | 187 |
station->m_maxProbRate = 0; |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
188 |
station->m_packetCount = 0; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
189 |
station->m_sampleCount = 0; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
190 |
station->m_isSampling = false; |
6065 | 191 |
station->m_sampleRate = 0; |
192 |
station->m_sampleRateSlower = false; |
|
193 |
station->m_currentRate = 0; |
|
194 |
station->m_shortRetry = 0; |
|
195 |
station->m_longRetry = 0; |
|
196 |
station->m_retry = 0; |
|
197 |
station->m_err = 0; |
|
198 |
station->m_txrate = 0; |
|
199 |
station->m_initialized = false; |
|
200 |
||
201 |
return station; |
|
202 |
} |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
203 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
204 |
void |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
205 |
MinstrelWifiManager::CheckInit (MinstrelWifiRemoteStation *station) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
206 |
{ |
6337 | 207 |
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
|
208 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
209 |
// Note: we appear to be doing late initialization of the table |
6065 | 210 |
// to make sure that the set of supported rates has been initialized |
211 |
// before we perform our own initialization. |
|
6337 | 212 |
m_nsupported = GetNSupported (station); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
213 |
m_minstrelTable = MinstrelRate (m_nsupported); |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
214 |
m_sampleTable = SampleRate (m_nsupported, std::vector<uint32_t> (m_sampleCol)); |
6065 | 215 |
InitSampleTable (station); |
216 |
RateInit (station); |
|
217 |
station->m_initialized = true; |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
218 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
219 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
220 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
221 |
void |
6065 | 222 |
MinstrelWifiManager::DoReportRxOk (WifiRemoteStation *st, |
223 |
double rxSnr, WifiMode txMode) |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
224 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
225 |
NS_LOG_DEBUG ("DoReportRxOk m_txrate=" << ((MinstrelWifiRemoteStation *)st)->m_txrate); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
226 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
227 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
228 |
void |
6065 | 229 |
MinstrelWifiManager::DoReportRtsFailed (WifiRemoteStation *st) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
230 |
{ |
6065 | 231 |
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *)st; |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
232 |
NS_LOG_DEBUG ("DoReportRtsFailed m_txrate=" << station->m_txrate); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
233 |
|
6065 | 234 |
station->m_shortRetry++; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
235 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
236 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
237 |
void |
6065 | 238 |
MinstrelWifiManager::DoReportRtsOk (WifiRemoteStation *st, double ctsSnr, WifiMode ctsMode, double rtsSnr) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
239 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
240 |
NS_LOG_DEBUG ("self=" << st << " rts ok"); |
6065 | 241 |
} |
242 |
||
243 |
void |
|
244 |
MinstrelWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *st) |
|
245 |
{ |
|
246 |
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *)st; |
|
247 |
UpdateRetry (station); |
|
248 |
station->m_err++; |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
249 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
250 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
251 |
void |
6065 | 252 |
MinstrelWifiManager::DoReportDataFailed (WifiRemoteStation *st) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
253 |
{ |
6065 | 254 |
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *)st; |
255 |
/** |
|
256 |
* |
|
257 |
* Retry Chain table is implemented here |
|
258 |
* |
|
259 |
* Try | LOOKAROUND RATE | NORMAL RATE |
|
260 |
* | random < best | random > best | |
|
261 |
* -------------------------------------------------------------- |
|
262 |
* 1 | Best throughput | Random rate | Best throughput |
|
263 |
* 2 | Random rate | Best throughput | Next best throughput |
|
264 |
* 3 | Best probability | Best probability | Best probability |
|
265 |
* 4 | Lowest Baserate | Lowest baserate | Lowest baserate |
|
266 |
* |
|
267 |
* Note: For clarity, multiple blocks of if's and else's are used |
|
268 |
* After a failing 7 times, DoReportFinalDataFailed will be called |
|
269 |
*/ |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
270 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
271 |
CheckInit (station); |
6337 | 272 |
if (!station->m_initialized) |
273 |
{ |
|
274 |
return; |
|
275 |
} |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
276 |
|
6065 | 277 |
station->m_longRetry++; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
278 |
|
6065 | 279 |
NS_LOG_DEBUG ("DoReportDataFailed " << station << "\t rate " << station->m_txrate << "\tlongRetry \t" << station->m_longRetry); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
280 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
281 |
/// for normal rate, we're not currently sampling random rates |
6065 | 282 |
if (!station->m_isSampling) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
283 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
284 |
/// use best throughput rate |
6337 | 285 |
if (station->m_longRetry < m_minstrelTable[station->m_txrate].adjustedRetryCount) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
286 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
287 |
; ///< there's still a few retries left |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
288 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
289 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
290 |
/// use second best throughput rate |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
291 |
else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount + |
6337 | 292 |
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
|
293 |
{ |
6065 | 294 |
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
|
295 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
296 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
297 |
/// use best probability rate |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
298 |
else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount + |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
299 |
m_minstrelTable[station->m_maxTpRate2].adjustedRetryCount + |
6337 | 300 |
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
|
301 |
{ |
6065 | 302 |
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
|
303 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
304 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
305 |
/// use lowest base rate |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
306 |
else if (station->m_longRetry > (m_minstrelTable[station->m_txrate].adjustedRetryCount + |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
307 |
m_minstrelTable[station->m_maxTpRate2].adjustedRetryCount + |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
308 |
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
|
309 |
{ |
6065 | 310 |
station->m_txrate = 0; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
311 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
312 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
313 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
314 |
/// 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
|
315 |
else |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
316 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
317 |
/// current sampling rate is slower than the current best rate |
6065 | 318 |
if (station->m_sampleRateSlower) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
319 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
320 |
/// use best throughput rate |
6337 | 321 |
if (station->m_longRetry < m_minstrelTable[station->m_txrate].adjustedRetryCount) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
322 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
323 |
; ///< there are a few retries left |
4703
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 |
/// use random rate |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
327 |
else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount + |
6337 | 328 |
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
|
329 |
{ |
6065 | 330 |
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
|
331 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
332 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
333 |
/// use max probability rate |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
334 |
else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount + |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
335 |
m_minstrelTable[station->m_sampleRate].adjustedRetryCount + |
6337 | 336 |
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
|
337 |
{ |
6065 | 338 |
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
|
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 lowest base rate |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
342 |
else if (station->m_longRetry > (m_minstrelTable[station->m_txrate].adjustedRetryCount + |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
343 |
m_minstrelTable[station->m_sampleRate].adjustedRetryCount + |
6337 | 344 |
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
|
345 |
{ |
6065 | 346 |
station->m_txrate = 0; |
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 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
350 |
/// 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
|
351 |
else |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
352 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
353 |
/// use random rate |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
354 |
if (station->m_longRetry < m_minstrelTable[station->m_txrate].adjustedRetryCount) |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
355 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
356 |
; ///< keep using it |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
357 |
} |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
358 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
359 |
/// use the best rate |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
360 |
else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount + |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
361 |
m_minstrelTable[station->m_sampleRate].adjustedRetryCount)) |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
362 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
363 |
station->m_txrate = station->m_maxTpRate; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
364 |
} |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
365 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
366 |
/// use the best probability rate |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
367 |
else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount + |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
368 |
m_minstrelTable[station->m_maxTpRate].adjustedRetryCount + |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
369 |
m_minstrelTable[station->m_sampleRate].adjustedRetryCount)) |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
370 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
371 |
station->m_txrate = station->m_maxProbRate; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
372 |
} |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
373 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
374 |
/// use the lowest base rate |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
375 |
else if (station->m_longRetry > (m_minstrelTable[station->m_txrate].adjustedRetryCount + |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
376 |
m_minstrelTable[station->m_maxTpRate].adjustedRetryCount + |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
377 |
m_minstrelTable[station->m_sampleRate].adjustedRetryCount)) |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
378 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
379 |
station->m_txrate = 0; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
380 |
} |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
381 |
} |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
382 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
383 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
384 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
385 |
void |
6065 | 386 |
MinstrelWifiManager::DoReportDataOk (WifiRemoteStation *st, |
387 |
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
|
388 |
{ |
6065 | 389 |
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *) st; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
390 |
|
6065 | 391 |
station->m_isSampling = false; |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
392 |
station->m_sampleRateSlower = false; |
6065 | 393 |
|
394 |
CheckInit (station); |
|
6337 | 395 |
if (!station->m_initialized) |
396 |
{ |
|
397 |
return; |
|
398 |
} |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
399 |
|
6337 | 400 |
m_minstrelTable[station->m_txrate].numRateSuccess++; |
401 |
m_minstrelTable[station->m_txrate].numRateAttempt++; |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
402 |
|
6065 | 403 |
UpdateRetry (station); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
404 |
|
6337 | 405 |
m_minstrelTable[station->m_txrate].numRateAttempt += station->m_retry; |
6065 | 406 |
station->m_packetCount++; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
407 |
|
6337 | 408 |
if (m_nsupported >= 1) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
409 |
{ |
6065 | 410 |
station->m_txrate = FindRate (station); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
411 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
412 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
413 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
414 |
void |
6065 | 415 |
MinstrelWifiManager::DoReportFinalDataFailed (WifiRemoteStation *st) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
416 |
{ |
6065 | 417 |
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *) st; |
418 |
NS_LOG_DEBUG ("DoReportFinalDataFailed 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
|
419 |
|
6065 | 420 |
station->m_isSampling = false; |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
421 |
station->m_sampleRateSlower = false; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
422 |
|
6065 | 423 |
UpdateRetry (station); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
424 |
|
6337 | 425 |
m_minstrelTable[station->m_txrate].numRateAttempt += station->m_retry; |
6065 | 426 |
station->m_err++; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
427 |
|
6337 | 428 |
if (m_nsupported >= 1) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
429 |
{ |
6065 | 430 |
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
|
431 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
432 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
433 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
434 |
void |
6065 | 435 |
MinstrelWifiManager::UpdateRetry (MinstrelWifiRemoteStation *station) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
436 |
{ |
6065 | 437 |
station->m_retry = station->m_shortRetry + station->m_longRetry; |
438 |
station->m_shortRetry = 0; |
|
439 |
station->m_longRetry = 0; |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
440 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
441 |
|
10139 | 442 |
WifiTxVector |
443 |
MinstrelWifiManager::DoGetDataTxVector (WifiRemoteStation *st, |
|
6065 | 444 |
uint32_t size) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
445 |
{ |
6065 | 446 |
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *) st; |
447 |
if (!station->m_initialized) |
|
448 |
{ |
|
449 |
CheckInit (station); |
|
450 |
||
451 |
/// start the rate at half way |
|
6337 | 452 |
station->m_txrate = m_nsupported / 2; |
6065 | 453 |
} |
454 |
UpdateStats (station); |
|
10139 | 455 |
return WifiTxVector (GetSupported (station, station->m_txrate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas()), GetNumberOfTransmitAntennas (station), GetStbc (station)); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
456 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
457 |
|
10139 | 458 |
WifiTxVector |
459 |
MinstrelWifiManager::DoGetRtsTxVector (WifiRemoteStation *st) |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
460 |
{ |
6065 | 461 |
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *) st; |
462 |
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
|
463 |
|
10139 | 464 |
return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas()), GetNumberOfTransmitAntennas (station), GetStbc (station)); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
465 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
466 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
467 |
bool |
6065 | 468 |
MinstrelWifiManager::IsLowLatency (void) const |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
469 |
{ |
6268
84e114d34b89
Bug 802 - Minstrel algorithm causes segmentation fault
Duy Nguyen <dnlove@gmail.com>
parents:
6079
diff
changeset
|
470 |
return true; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
471 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
472 |
uint32_t |
6065 | 473 |
MinstrelWifiManager::GetNextSample (MinstrelWifiRemoteStation *station) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
474 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
475 |
uint32_t bitrate; |
6337 | 476 |
bitrate = m_sampleTable[station->m_index][station->m_col]; |
6065 | 477 |
station->m_index++; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
478 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
479 |
/// 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
|
480 |
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
|
481 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
482 |
station->m_index = 0; |
6065 | 483 |
station->m_col++; |
484 |
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
|
485 |
{ |
6065 | 486 |
station->m_col = 0; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
487 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
488 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
489 |
return bitrate; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
490 |
} |
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 |
uint32_t |
6065 | 493 |
MinstrelWifiManager::FindRate (MinstrelWifiRemoteStation *station) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
494 |
{ |
6065 | 495 |
NS_LOG_DEBUG ("FindRate " << "packet=" << station->m_packetCount ); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
496 |
|
6065 | 497 |
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
|
498 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
499 |
return 0; |
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 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
502 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
503 |
uint32_t idx; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
504 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
505 |
/// for determining when to try a sample rate |
8981
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
506 |
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
|
507 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
508 |
/** |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
509 |
* 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
|
510 |
* 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
|
511 |
* 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
|
512 |
*/ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
513 |
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
|
514 |
&& (coinFlip == 1) ) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
515 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
516 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
517 |
/// 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
|
518 |
idx = GetNextSample (station); |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
519 |
|
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
520 |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
521 |
/** |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
522 |
* 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
|
523 |
* 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
|
524 |
*/ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
525 |
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
|
526 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
527 |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
528 |
/// start sample count |
6065 | 529 |
station->m_sampleCount++; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
530 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
531 |
/// set flag that we are currently sampling |
6065 | 532 |
station->m_isSampling = true; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
533 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
534 |
/// bookeeping for resetting stuff |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
535 |
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
|
536 |
{ |
6065 | 537 |
station->m_sampleCount = 0; |
538 |
station->m_packetCount = 0; |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
539 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
540 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
541 |
/// error check |
6645 | 542 |
if (idx >= m_nsupported) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
543 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
544 |
NS_LOG_DEBUG ("ALERT!!! ERROR"); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
545 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
546 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
547 |
/// set the rate that we're currently sampling |
6065 | 548 |
station->m_sampleRate = idx; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
549 |
|
6065 | 550 |
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
|
551 |
{ |
6065 | 552 |
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
|
553 |
} |
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 |
/// 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
|
556 |
station->m_sampleRateSlower = |
6337 | 557 |
(m_minstrelTable[idx].perfectTxTime > 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
|
558 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
559 |
/// using the best rate instead |
6065 | 560 |
if (station->m_sampleRateSlower) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
561 |
{ |
6065 | 562 |
idx = station->m_maxTpRate; |
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 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
565 |
|
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
566 |
} |
4703
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 |
/// continue using the best rate |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
569 |
else |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
570 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
571 |
idx = station->m_maxTpRate; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
572 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
573 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
574 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
575 |
NS_LOG_DEBUG ("FindRate " << "sample rate=" << idx); |
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 |
return idx; |
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 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
580 |
void |
6065 | 581 |
MinstrelWifiManager::UpdateStats (MinstrelWifiRemoteStation *station) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
582 |
{ |
6065 | 583 |
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
|
584 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
585 |
return; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
586 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
587 |
|
6337 | 588 |
if (!station->m_initialized) |
589 |
{ |
|
590 |
return; |
|
591 |
} |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
592 |
NS_LOG_DEBUG ("Updating stats=" << this); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
593 |
|
6065 | 594 |
station->m_nextStatsUpdate = Simulator::Now () + m_updateStats; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
595 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
596 |
Time txTime; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
597 |
uint32_t tempProb; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
598 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
599 |
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
|
600 |
{ |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
601 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
602 |
/// calculate the perfect tx time for this rate |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
603 |
txTime = m_minstrelTable[i].perfectTxTime; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
604 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
605 |
/// just for initialization |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
606 |
if (txTime.GetMicroSeconds () == 0) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
607 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
608 |
txTime = Seconds (1); |
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 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
611 |
NS_LOG_DEBUG ("m_txrate=" << station->m_txrate << |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
612 |
"\t attempt=" << m_minstrelTable[i].numRateAttempt << |
6337 | 613 |
"\t success=" << m_minstrelTable[i].numRateSuccess); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
614 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
615 |
/// if we've attempted something |
6337 | 616 |
if (m_minstrelTable[i].numRateAttempt) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
617 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
618 |
/** |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
619 |
* calculate the probability of success |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
620 |
* 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
|
621 |
*/ |
6337 | 622 |
tempProb = (m_minstrelTable[i].numRateSuccess * 18000) / m_minstrelTable[i].numRateAttempt; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
623 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
624 |
/// bookeeping |
6337 | 625 |
m_minstrelTable[i].successHist += m_minstrelTable[i].numRateSuccess; |
626 |
m_minstrelTable[i].attemptHist += m_minstrelTable[i].numRateAttempt; |
|
627 |
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
|
628 |
|
4725
4e068296f09f
fix build for gcc 3.4
Craig Dowell <craigdo@ee.washington.edu>
parents:
4703
diff
changeset
|
629 |
/// ewma probability (cast for gcc 3.4 compatibility) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
630 |
tempProb = static_cast<uint32_t> (((tempProb * (100 - m_ewmaLevel)) + (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
|
631 |
|
6337 | 632 |
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
|
633 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
634 |
/// calculating throughput |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
635 |
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
|
636 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
637 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
638 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
639 |
/// bookeeping |
6337 | 640 |
m_minstrelTable[i].prevNumRateAttempt = m_minstrelTable[i].numRateAttempt; |
641 |
m_minstrelTable[i].prevNumRateSuccess = m_minstrelTable[i].numRateSuccess; |
|
642 |
m_minstrelTable[i].numRateSuccess = 0; |
|
643 |
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
|
644 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
645 |
/// Sample less often below 10% and above 95% of success |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
646 |
if ((m_minstrelTable[i].ewmaProb > 17100) || (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
|
647 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
648 |
/** |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
649 |
* retry count denotes the number of retries permitted for each rate |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
650 |
* # retry_count/2 |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
651 |
*/ |
6337 | 652 |
m_minstrelTable[i].adjustedRetryCount = m_minstrelTable[i].retryCount >> 1; |
653 |
if (m_minstrelTable[i].adjustedRetryCount > 2) |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
654 |
{ |
7252
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7141
diff
changeset
|
655 |
m_minstrelTable[i].adjustedRetryCount = 2; |
4703
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 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
658 |
else |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
659 |
{ |
6337 | 660 |
m_minstrelTable[i].adjustedRetryCount = m_minstrelTable[i].retryCount; |
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 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
663 |
/// if it's 0 allow one retry limit |
6337 | 664 |
if (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
|
665 |
{ |
6337 | 666 |
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
|
667 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
668 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
669 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
670 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
671 |
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
|
672 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
673 |
/// go find max throughput, second maximum throughput, high probability succ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
674 |
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
|
675 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
676 |
NS_LOG_DEBUG ("throughput" << m_minstrelTable[i].throughput << |
6337 | 677 |
"\n ewma" << m_minstrelTable[i].ewmaProb); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
678 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
679 |
if (max_tp < m_minstrelTable[i].throughput) |
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 |
index_max_tp = i; |
6337 | 682 |
max_tp = m_minstrelTable[i].throughput; |
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 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
685 |
if (max_prob < m_minstrelTable[i].ewmaProb) |
4703
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 |
index_max_prob = i; |
6337 | 688 |
max_prob = m_minstrelTable[i].ewmaProb; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
689 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
690 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
691 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
692 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
693 |
max_tp = 0; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
694 |
/// find the second highest max |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
695 |
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
|
696 |
{ |
6337 | 697 |
if ((i != index_max_tp) && (max_tp < m_minstrelTable[i].throughput)) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
698 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
699 |
index_max_tp2 = i; |
6337 | 700 |
max_tp = m_minstrelTable[i].throughput; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
701 |
} |
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 |
|
6065 | 704 |
station->m_maxTpRate = index_max_tp; |
705 |
station->m_maxTpRate2 = index_max_tp2; |
|
706 |
station->m_maxProbRate = index_max_prob; |
|
707 |
station->m_currentRate = index_max_tp; |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
708 |
|
6065 | 709 |
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
|
710 |
{ |
6065 | 711 |
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
|
712 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
713 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
714 |
NS_LOG_DEBUG ("max tp=" << index_max_tp << "\nmax tp2=" << index_max_tp2 << "\nmax prob=" << index_max_prob); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
715 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
716 |
/// reset it |
6065 | 717 |
RateInit (station); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
718 |
} |
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 |
void |
6065 | 721 |
MinstrelWifiManager::RateInit (MinstrelWifiRemoteStation *station) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
722 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
723 |
NS_LOG_DEBUG ("RateInit=" << station); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
724 |
|
6337 | 725 |
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
|
726 |
{ |
6337 | 727 |
m_minstrelTable[i].numRateAttempt = 0; |
728 |
m_minstrelTable[i].numRateSuccess = 0; |
|
729 |
m_minstrelTable[i].prob = 0; |
|
730 |
m_minstrelTable[i].ewmaProb = 0; |
|
731 |
m_minstrelTable[i].prevNumRateAttempt = 0; |
|
732 |
m_minstrelTable[i].prevNumRateSuccess = 0; |
|
733 |
m_minstrelTable[i].successHist = 0; |
|
734 |
m_minstrelTable[i].attemptHist = 0; |
|
735 |
m_minstrelTable[i].throughput = 0; |
|
736 |
m_minstrelTable[i].perfectTxTime = GetCalcTxTime (GetSupported (station, i)); |
|
737 |
m_minstrelTable[i].retryCount = 1; |
|
738 |
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
|
739 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
740 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
741 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
742 |
void |
6065 | 743 |
MinstrelWifiManager::InitSampleTable (MinstrelWifiRemoteStation *station) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
744 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
745 |
NS_LOG_DEBUG ("InitSampleTable=" << this); |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
746 |
|
6065 | 747 |
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
|
748 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
749 |
/// for off-seting to make rates fall between 0 and numrates |
6337 | 750 |
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
|
751 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
752 |
uint32_t newIndex; |
6065 | 753 |
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
|
754 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
755 |
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
|
756 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
757 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
758 |
/** |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
759 |
* 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
|
760 |
* 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
|
761 |
*/ |
8981
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
762 |
int uv = m_uniformRandomVariable->GetInteger (0, numSampleRates); |
7e1c95c4d1a7
Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7386
diff
changeset
|
763 |
newIndex = (i + uv) % numSampleRates; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
764 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
765 |
/// this loop is used for filling in other uninitilized places |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
766 |
while (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
|
767 |
{ |
6337 | 768 |
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
|
769 |
} |
6337 | 770 |
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
|
771 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
772 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
773 |
} |
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 |
void |
6065 | 777 |
MinstrelWifiManager::PrintSampleTable (MinstrelWifiRemoteStation *station) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
778 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
779 |
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
|
780 |
|
6337 | 781 |
uint32_t numSampleRates = m_nsupported; |
6065 | 782 |
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
|
783 |
{ |
6065 | 784 |
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
|
785 |
{ |
6337 | 786 |
std::cout << 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
|
787 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
788 |
std::cout << std::endl; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
789 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
790 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
791 |
|
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
792 |
void |
6065 | 793 |
MinstrelWifiManager::PrintTable (MinstrelWifiRemoteStation *station) |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
794 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
795 |
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
|
796 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
797 |
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
|
798 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
799 |
std::cout << "index(" << i << ") = " << m_minstrelTable[i].perfectTxTime << "\n"; |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
800 |
} |
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 |
|
7386
2310ed220a61
standardize ns-3 namespace declaration format
Vedran Miletić <rivanvx@gmail.com>
parents:
7252
diff
changeset
|
803 |
} // namespace ns3 |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
804 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
805 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
806 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
807 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
808 |