author | Ghada Badawy <gbadawy@gmail.com> |
Tue, 13 Aug 2013 22:05:25 -0700 | |
changeset 10139 | 17a71cd49da3 |
parent 9870 | 6543f3876ff5 |
child 10207 | 4c42c64f7ea8 |
permissions | -rw-r--r-- |
7385
10beb0e53130
standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents:
7227
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
1893
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
2 |
/* |
1912
028e1945d5b2
fix copyright statement
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1911
diff
changeset
|
3 |
* Copyright (c) 2005,2006,2007 INRIA |
1893
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
4 |
* |
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
1893
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
8 |
* |
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
13 |
* |
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
17 |
* |
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
18 |
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
19 |
*/ |
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
20 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
21 |
#include "wifi-remote-station-manager.h" |
6069
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
22 |
#include "ns3/simulator.h" |
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
23 |
#include "ns3/assert.h" |
1980
3fa3bac40b5b
add asserts and some debug log
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1975
diff
changeset
|
24 |
#include "ns3/log.h" |
3041
a624276a897b
mtag -> tag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3040
diff
changeset
|
25 |
#include "ns3/tag.h" |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
26 |
#include "ns3/boolean.h" |
6065 | 27 |
#include "ns3/double.h" |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
28 |
#include "ns3/uinteger.h" |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
29 |
#include "ns3/wifi-phy.h" |
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
30 |
#include "ns3/trace-source-accessor.h" |
6065 | 31 |
#include "wifi-mac-header.h" |
6473 | 32 |
#include "wifi-mac-trailer.h" |
1980
3fa3bac40b5b
add asserts and some debug log
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1975
diff
changeset
|
33 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
34 |
NS_LOG_COMPONENT_DEFINE ("WifiRemoteStationManager"); |
1893
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
35 |
|
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
36 |
|
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
37 |
/*************************************************************** |
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
38 |
* Packet Mode Tagger |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
39 |
***************************************************************/ |
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
40 |
|
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
41 |
namespace ns3 { |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
42 |
|
10139 | 43 |
class HighLatencyDataTxVectorTag : public Tag |
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
44 |
{ |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
45 |
public: |
10139 | 46 |
HighLatencyDataTxVectorTag (); |
47 |
HighLatencyDataTxVectorTag (WifiTxVector dataTxVector); |
|
48 |
WifiTxVector GetDataTxVector (void) const; |
|
49 |
||
50 |
static TypeId GetTypeId (void); |
|
51 |
virtual TypeId GetInstanceTypeId (void) const; |
|
52 |
virtual uint32_t GetSerializedSize (void) const; |
|
53 |
virtual void Serialize (TagBuffer i) const; |
|
54 |
virtual void Deserialize (TagBuffer i); |
|
55 |
virtual void Print (std::ostream &os) const; |
|
56 |
private: |
|
57 |
WifiTxVector m_dataTxVector; |
|
58 |
}; |
|
59 |
||
60 |
HighLatencyDataTxVectorTag::HighLatencyDataTxVectorTag () |
|
61 |
{ |
|
62 |
} |
|
63 |
HighLatencyDataTxVectorTag::HighLatencyDataTxVectorTag ( WifiTxVector dataTxVector) |
|
64 |
: m_dataTxVector (dataTxVector) |
|
65 |
{ |
|
66 |
} |
|
67 |
||
68 |
WifiTxVector |
|
69 |
HighLatencyDataTxVectorTag::GetDataTxVector (void) const |
|
70 |
{ |
|
71 |
return m_dataTxVector; |
|
72 |
} |
|
73 |
TypeId |
|
74 |
HighLatencyDataTxVectorTag::GetTypeId (void) |
|
75 |
{ |
|
76 |
static TypeId tid = TypeId ("ns3::HighLatencyDataTxVectorTag") |
|
77 |
.SetParent<Tag> () |
|
78 |
.AddConstructor<HighLatencyDataTxVectorTag> () |
|
79 |
; |
|
80 |
return tid; |
|
81 |
} |
|
82 |
TypeId |
|
83 |
HighLatencyDataTxVectorTag::GetInstanceTypeId (void) const |
|
84 |
{ |
|
85 |
return GetTypeId (); |
|
86 |
} |
|
87 |
uint32_t |
|
88 |
HighLatencyDataTxVectorTag::GetSerializedSize (void) const |
|
89 |
{ |
|
90 |
return sizeof (WifiTxVector); |
|
91 |
} |
|
92 |
void |
|
93 |
HighLatencyDataTxVectorTag::Serialize (TagBuffer i) const |
|
94 |
{ |
|
95 |
i.Write ((uint8_t *)&m_dataTxVector, sizeof (WifiTxVector)); |
|
96 |
} |
|
97 |
void |
|
98 |
HighLatencyDataTxVectorTag::Deserialize (TagBuffer i) |
|
99 |
{ |
|
100 |
i.Read ((uint8_t *)&m_dataTxVector, sizeof (WifiTxVector)); |
|
101 |
} |
|
102 |
void |
|
103 |
HighLatencyDataTxVectorTag::Print (std::ostream &os) const |
|
104 |
{ |
|
105 |
os << "Data=" << m_dataTxVector; |
|
106 |
} |
|
107 |
||
108 |
class HighLatencyRtsTxVectorTag : public Tag |
|
109 |
{ |
|
110 |
public: |
|
111 |
HighLatencyRtsTxVectorTag (); |
|
112 |
HighLatencyRtsTxVectorTag (WifiTxVector rtsTxVector); |
|
113 |
WifiTxVector GetRtsTxVector (void) const; |
|
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
114 |
|
3038
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
115 |
static TypeId GetTypeId (void); |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
116 |
virtual TypeId GetInstanceTypeId (void) const; |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
117 |
virtual uint32_t GetSerializedSize (void) const; |
3040
e11e106c7c19
Mtag -> Tag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3038
diff
changeset
|
118 |
virtual void Serialize (TagBuffer i) const; |
e11e106c7c19
Mtag -> Tag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3038
diff
changeset
|
119 |
virtual void Deserialize (TagBuffer i); |
3208
1a754d09c4ba
bug 200: Packet::PrintTags is not implemented.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3041
diff
changeset
|
120 |
virtual void Print (std::ostream &os) const; |
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
121 |
private: |
10139 | 122 |
WifiTxVector m_rtsTxVector; |
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
123 |
}; |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
124 |
|
10139 | 125 |
HighLatencyRtsTxVectorTag::HighLatencyRtsTxVectorTag () |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
126 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
127 |
} |
10139 | 128 |
HighLatencyRtsTxVectorTag::HighLatencyRtsTxVectorTag ( WifiTxVector rtsTxVector) |
129 |
: m_rtsTxVector (rtsTxVector) |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
130 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
131 |
} |
10139 | 132 |
|
133 |
WifiTxVector |
|
134 |
HighLatencyRtsTxVectorTag::GetRtsTxVector (void) const |
|
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
135 |
{ |
10139 | 136 |
return m_rtsTxVector; |
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
137 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
138 |
TypeId |
10139 | 139 |
HighLatencyRtsTxVectorTag::GetTypeId (void) |
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
140 |
{ |
10139 | 141 |
static TypeId tid = TypeId ("ns3::HighLatencyRtsTxVectorTag") |
3040
e11e106c7c19
Mtag -> Tag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3038
diff
changeset
|
142 |
.SetParent<Tag> () |
10139 | 143 |
.AddConstructor<HighLatencyRtsTxVectorTag> () |
144 |
; |
|
3038
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
145 |
return tid; |
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
146 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
147 |
TypeId |
10139 | 148 |
HighLatencyRtsTxVectorTag::GetInstanceTypeId (void) const |
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
149 |
{ |
3038
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
150 |
return GetTypeId (); |
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
151 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
152 |
uint32_t |
10139 | 153 |
HighLatencyRtsTxVectorTag::GetSerializedSize (void) const |
154 |
{ |
|
155 |
return sizeof (WifiTxVector); |
|
156 |
} |
|
157 |
void |
|
158 |
HighLatencyRtsTxVectorTag::Serialize (TagBuffer i) const |
|
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
159 |
{ |
10139 | 160 |
i.Write ((uint8_t *)&m_rtsTxVector, sizeof (WifiTxVector)); |
161 |
} |
|
162 |
void |
|
163 |
HighLatencyRtsTxVectorTag::Deserialize (TagBuffer i) |
|
164 |
{ |
|
165 |
i.Read ((uint8_t *)&m_rtsTxVector, sizeof (WifiTxVector)); |
|
3038
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
166 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
167 |
void |
10139 | 168 |
HighLatencyRtsTxVectorTag::Print (std::ostream &os) const |
169 |
{ |
|
170 |
os << "Rts=" << m_rtsTxVector; |
|
171 |
} |
|
172 |
||
173 |
class HighLatencyCtsToSelfTxVectorTag : public Tag |
|
174 |
{ |
|
175 |
public: |
|
176 |
HighLatencyCtsToSelfTxVectorTag (); |
|
177 |
HighLatencyCtsToSelfTxVectorTag (WifiTxVector ctsToSelfTxVector); |
|
178 |
WifiTxVector GetCtsToSelfTxVector (void) const; |
|
179 |
||
180 |
static TypeId GetTypeId (void); |
|
181 |
virtual TypeId GetInstanceTypeId (void) const; |
|
182 |
virtual uint32_t GetSerializedSize (void) const; |
|
183 |
virtual void Serialize (TagBuffer i) const; |
|
184 |
virtual void Deserialize (TagBuffer i); |
|
185 |
virtual void Print (std::ostream &os) const; |
|
186 |
private: |
|
187 |
WifiTxVector m_ctsToSelfTxVector; |
|
188 |
}; |
|
189 |
||
190 |
HighLatencyCtsToSelfTxVectorTag::HighLatencyCtsToSelfTxVectorTag () |
|
3038
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
191 |
{ |
10139 | 192 |
} |
193 |
HighLatencyCtsToSelfTxVectorTag::HighLatencyCtsToSelfTxVectorTag ( WifiTxVector ctsToSelfTxVector) |
|
194 |
: m_ctsToSelfTxVector (ctsToSelfTxVector) |
|
195 |
{ |
|
196 |
} |
|
197 |
||
198 |
WifiTxVector |
|
199 |
HighLatencyCtsToSelfTxVectorTag::GetCtsToSelfTxVector (void) const |
|
200 |
{ |
|
201 |
return m_ctsToSelfTxVector; |
|
202 |
} |
|
203 |
TypeId |
|
204 |
HighLatencyCtsToSelfTxVectorTag::GetTypeId (void) |
|
205 |
{ |
|
206 |
static TypeId tid = TypeId ("ns3::HighLatencyCtsToSelfTxVectorTag") |
|
207 |
.SetParent<Tag> () |
|
208 |
.AddConstructor<HighLatencyCtsToSelfTxVectorTag> () |
|
209 |
; |
|
210 |
return tid; |
|
211 |
} |
|
212 |
TypeId |
|
213 |
HighLatencyCtsToSelfTxVectorTag::GetInstanceTypeId (void) const |
|
214 |
{ |
|
215 |
return GetTypeId (); |
|
216 |
} |
|
217 |
uint32_t |
|
218 |
HighLatencyCtsToSelfTxVectorTag::GetSerializedSize (void) const |
|
219 |
{ |
|
220 |
return sizeof (WifiTxVector); |
|
3038
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
221 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
222 |
void |
10139 | 223 |
HighLatencyCtsToSelfTxVectorTag::Serialize (TagBuffer i) const |
3038
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
224 |
{ |
10139 | 225 |
i.Write ((uint8_t *)&m_ctsToSelfTxVector, sizeof (WifiTxVector)); |
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
226 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
227 |
void |
10139 | 228 |
HighLatencyCtsToSelfTxVectorTag::Deserialize (TagBuffer i) |
3208
1a754d09c4ba
bug 200: Packet::PrintTags is not implemented.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3041
diff
changeset
|
229 |
{ |
10139 | 230 |
i.Read ((uint8_t *)&m_ctsToSelfTxVector, sizeof (WifiTxVector)); |
231 |
} |
|
232 |
void |
|
233 |
HighLatencyCtsToSelfTxVectorTag::Print (std::ostream &os) const |
|
234 |
{ |
|
235 |
os << "Cts To Self=" << m_ctsToSelfTxVector; |
|
3208
1a754d09c4ba
bug 200: Packet::PrintTags is not implemented.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3041
diff
changeset
|
236 |
} |
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
237 |
|
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
238 |
} // namespace ns3 |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
239 |
|
6065 | 240 |
namespace ns3 { |
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
241 |
|
6065 | 242 |
NS_OBJECT_ENSURE_REGISTERED (WifiRemoteStationManager); |
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
243 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
244 |
TypeId |
6065 | 245 |
WifiRemoteStationManager::GetTypeId (void) |
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
246 |
{ |
6065 | 247 |
static TypeId tid = TypeId ("ns3::WifiRemoteStationManager") |
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
248 |
.SetParent<Object> () |
6065 | 249 |
.AddAttribute ("IsLowLatency", "If true, we attempt to modelize a so-called low-latency device: a device" |
250 |
" where decisions about tx parameters can be made on a per-packet basis and feedback about the" |
|
251 |
" transmission of each packet is obtained before sending the next. Otherwise, we modelize a " |
|
252 |
" high-latency device, that is a device where we cannot update our decision about tx parameters" |
|
253 |
" after every packet transmission.", |
|
6241
d9a65be745f0
Bug 802 - Minstrel, Onoe and Amrr not working
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6087
diff
changeset
|
254 |
BooleanValue (true), // this value is ignored because there is no setter |
6065 | 255 |
MakeBooleanAccessor (&WifiRemoteStationManager::IsLowLatency), |
256 |
MakeBooleanChecker ()) |
|
257 |
.AddAttribute ("MaxSsrc", "The maximum number of retransmission attempts for an RTS. This value" |
|
258 |
" will not have any effect on some rate control algorithms.", |
|
259 |
UintegerValue (7), |
|
260 |
MakeUintegerAccessor (&WifiRemoteStationManager::m_maxSsrc), |
|
261 |
MakeUintegerChecker<uint32_t> ()) |
|
262 |
.AddAttribute ("MaxSlrc", "The maximum number of retransmission attempts for a DATA packet. This value" |
|
263 |
" will not have any effect on some rate control algorithms.", |
|
264 |
UintegerValue (7), |
|
265 |
MakeUintegerAccessor (&WifiRemoteStationManager::m_maxSlrc), |
|
266 |
MakeUintegerChecker<uint32_t> ()) |
|
6473 | 267 |
.AddAttribute ("RtsCtsThreshold", "If the size of the data packet + LLC header + MAC header + FCS trailer is bigger than " |
268 |
"this value, we use an RTS/CTS handshake before sending the data, as per IEEE Std. 802.11-2007, Section 9.2.6. " |
|
269 |
"This value will not have any effect on some rate control algorithms.", |
|
270 |
UintegerValue (2346), |
|
6065 | 271 |
MakeUintegerAccessor (&WifiRemoteStationManager::m_rtsCtsThreshold), |
272 |
MakeUintegerChecker<uint32_t> ()) |
|
6473 | 273 |
.AddAttribute ("FragmentationThreshold", "If the size of the data packet + LLC header + MAC header + FCS trailer is bigger" |
274 |
"than this value, we fragment it such that the size of the fragments are equal or smaller " |
|
275 |
"than this value, as per IEEE Std. 802.11-2007, Section 9.4. " |
|
276 |
"This value will not have any effect on some rate control algorithms.", |
|
277 |
UintegerValue (2346), |
|
9165
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
278 |
MakeUintegerAccessor (&WifiRemoteStationManager::DoSetFragmentationThreshold, |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
279 |
&WifiRemoteStationManager::DoGetFragmentationThreshold), |
6065 | 280 |
MakeUintegerChecker<uint32_t> ()) |
281 |
.AddAttribute ("NonUnicastMode", "Wifi mode used for non-unicast transmissions.", |
|
282 |
WifiModeValue (), |
|
283 |
MakeWifiModeAccessor (&WifiRemoteStationManager::m_nonUnicastMode), |
|
284 |
MakeWifiModeChecker ()) |
|
10139 | 285 |
.AddAttribute ("DefaultTxPowerLevel", "Default power level to be used for transmissions. " |
286 |
"This is the power level that is used by all those WifiManagers that do not" |
|
287 |
"implement TX power control.", |
|
288 |
UintegerValue (0), |
|
289 |
MakeUintegerAccessor (&WifiRemoteStationManager::m_defaultTxPowerLevel), |
|
290 |
MakeUintegerChecker<uint8_t> ()) |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
291 |
.AddTraceSource ("MacTxRtsFailed", |
6065 | 292 |
"The transmission of a RTS by the MAC layer has failed", |
293 |
MakeTraceSourceAccessor (&WifiRemoteStationManager::m_macTxRtsFailed)) |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
294 |
.AddTraceSource ("MacTxDataFailed", |
6065 | 295 |
"The transmission of a data packet by the MAC layer has failed", |
296 |
MakeTraceSourceAccessor (&WifiRemoteStationManager::m_macTxDataFailed)) |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
297 |
.AddTraceSource ("MacTxFinalRtsFailed", |
6065 | 298 |
"The transmission of a RTS has exceeded the maximum number of attempts", |
299 |
MakeTraceSourceAccessor (&WifiRemoteStationManager::m_macTxFinalRtsFailed)) |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
300 |
.AddTraceSource ("MacTxFinalDataFailed", |
6065 | 301 |
"The transmission of a data packet has exceeded the maximum number of attempts", |
302 |
MakeTraceSourceAccessor (&WifiRemoteStationManager::m_macTxFinalDataFailed)) |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
303 |
; |
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
304 |
return tid; |
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
305 |
} |
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
306 |
|
6065 | 307 |
WifiRemoteStationManager::WifiRemoteStationManager () |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
308 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
309 |
} |
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
310 |
|
6065 | 311 |
WifiRemoteStationManager::~WifiRemoteStationManager () |
312 |
{ |
|
313 |
} |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
314 |
void |
6065 | 315 |
WifiRemoteStationManager::DoDispose (void) |
2003
335dc094e52a
support BRAND_NEW station in adhoc code. initialize the supported rates.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1989
diff
changeset
|
316 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
317 |
for (StationStates::const_iterator i = m_states.begin (); i != m_states.end (); i++) |
6065 | 318 |
{ |
319 |
delete (*i); |
|
320 |
} |
|
321 |
m_states.clear (); |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
322 |
for (Stations::const_iterator i = m_stations.begin (); i != m_stations.end (); i++) |
6065 | 323 |
{ |
324 |
delete (*i); |
|
325 |
} |
|
326 |
m_stations.clear (); |
|
327 |
} |
|
328 |
void |
|
329 |
WifiRemoteStationManager::SetupPhy (Ptr<WifiPhy> phy) |
|
330 |
{ |
|
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
331 |
// We need to track our PHY because it is the object that knows the |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
332 |
// full set of transmit rates that are supported. We need to know |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
333 |
// this in order to find the relevant mandatory rates when chosing a |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
334 |
// transmit rate for automatic control responses like |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
335 |
// acknowledgements. |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
336 |
m_wifiPhy = phy; |
6065 | 337 |
m_defaultTxMode = phy->GetMode (0); |
10139 | 338 |
if(HasHtSupported()) |
339 |
{ |
|
340 |
m_defaultTxMcs = phy->GetMcs (0); |
|
341 |
} |
|
342 |
else |
|
343 |
{ |
|
344 |
m_defaultTxMcs = 0; |
|
345 |
} |
|
6065 | 346 |
Reset (); |
2003
335dc094e52a
support BRAND_NEW station in adhoc code. initialize the supported rates.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1989
diff
changeset
|
347 |
} |
10139 | 348 |
void |
349 |
WifiRemoteStationManager::SetHtSupported (bool enable) |
|
350 |
{ |
|
351 |
m_htSupported=enable; |
|
352 |
} |
|
2003
335dc094e52a
support BRAND_NEW station in adhoc code. initialize the supported rates.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1989
diff
changeset
|
353 |
|
10139 | 354 |
bool |
355 |
WifiRemoteStationManager::HasHtSupported (void) const |
|
356 |
{ |
|
357 |
return m_htSupported; |
|
358 |
} |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
359 |
uint32_t |
6065 | 360 |
WifiRemoteStationManager::GetMaxSsrc (void) const |
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
361 |
{ |
6065 | 362 |
return m_maxSsrc; |
363 |
} |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
364 |
uint32_t |
6065 | 365 |
WifiRemoteStationManager::GetMaxSlrc (void) const |
366 |
{ |
|
367 |
return m_maxSlrc; |
|
368 |
} |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
369 |
uint32_t |
6065 | 370 |
WifiRemoteStationManager::GetRtsCtsThreshold (void) const |
371 |
{ |
|
372 |
return m_rtsCtsThreshold; |
|
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
373 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
374 |
uint32_t |
6065 | 375 |
WifiRemoteStationManager::GetFragmentationThreshold (void) const |
376 |
{ |
|
9165
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
377 |
return DoGetFragmentationThreshold (); |
6065 | 378 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
379 |
void |
6065 | 380 |
WifiRemoteStationManager::SetMaxSsrc (uint32_t maxSsrc) |
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
381 |
{ |
6065 | 382 |
m_maxSsrc = maxSsrc; |
383 |
} |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
384 |
void |
6065 | 385 |
WifiRemoteStationManager::SetMaxSlrc (uint32_t maxSlrc) |
386 |
{ |
|
387 |
m_maxSlrc = maxSlrc; |
|
388 |
} |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
389 |
void |
6065 | 390 |
WifiRemoteStationManager::SetRtsCtsThreshold (uint32_t threshold) |
391 |
{ |
|
392 |
m_rtsCtsThreshold = threshold; |
|
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
393 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
394 |
void |
6065 | 395 |
WifiRemoteStationManager::SetFragmentationThreshold (uint32_t threshold) |
396 |
{ |
|
9165
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
397 |
DoSetFragmentationThreshold (threshold); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
398 |
} |
6065 | 399 |
|
400 |
void |
|
401 |
WifiRemoteStationManager::Reset (Mac48Address address) |
|
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
402 |
{ |
6065 | 403 |
NS_ASSERT (!address.IsGroup ()); |
404 |
WifiRemoteStationState *state = LookupState (address); |
|
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
405 |
state->m_operationalRateSet.clear (); |
10139 | 406 |
state->m_operationalMcsSet.clear (); |
6065 | 407 |
AddSupportedMode (address, GetDefaultMode ()); |
10139 | 408 |
AddSupportedMcs(address,GetDefaultMcs()); |
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
409 |
} |
6065 | 410 |
void |
411 |
WifiRemoteStationManager::AddSupportedMode (Mac48Address address, WifiMode mode) |
|
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
412 |
{ |
6065 | 413 |
NS_ASSERT (!address.IsGroup ()); |
414 |
WifiRemoteStationState *state = LookupState (address); |
|
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
415 |
for (WifiModeListIterator i = state->m_operationalRateSet.begin (); i != state->m_operationalRateSet.end (); i++) |
6065 | 416 |
{ |
417 |
if ((*i) == mode) |
|
418 |
{ |
|
419 |
// already in. |
|
420 |
return; |
|
421 |
} |
|
422 |
} |
|
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
423 |
state->m_operationalRateSet.push_back (mode); |
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
424 |
} |
10139 | 425 |
/*void |
426 |
WifiRemoteStationManager::AddBssMembershipParameters(Mac48Address address, uint32_t selector) |
|
427 |
{ |
|
428 |
NS_ASSERT (!address.IsGroup ()); |
|
429 |
WifiRemoteStationState *state = LookupState (address); |
|
430 |
WifiMode mode; |
|
431 |
WifiModeList membershipselectormodes = m_wifiPhy->GetMembershipSelectorModes(selector); |
|
432 |
for (WifiModeListIterator j = membershipselectormodes.begin (); j != membershipselectormodes.end (); j++) |
|
433 |
{ |
|
434 |
mode=(*j); |
|
435 |
for (WifiModeListIterator i = state->m_operationalRateSet.begin (); i != state->m_operationalRateSet.end (); i++) |
|
436 |
{ |
|
437 |
if ((*i) == mode) |
|
438 |
{ |
|
439 |
// already in. |
|
440 |
break; |
|
441 |
} |
|
442 |
} |
|
443 |
state->m_operationalRateSet.push_back (mode); |
|
444 |
} |
|
445 |
}*/ |
|
446 |
void |
|
447 |
WifiRemoteStationManager::AddSupportedMcs (Mac48Address address, uint8_t mcs) |
|
448 |
{ |
|
449 |
NS_ASSERT (!address.IsGroup ()); |
|
450 |
WifiRemoteStationState *state = LookupState (address); |
|
451 |
for (WifiMcsListIterator i = state->m_operationalMcsSet.begin (); i != state->m_operationalMcsSet.end (); i++) |
|
452 |
{ |
|
453 |
if ((*i) == mcs) |
|
454 |
{ |
|
455 |
// already in. |
|
456 |
return; |
|
457 |
} |
|
458 |
} |
|
459 |
state->m_operationalMcsSet.push_back (mcs); |
|
460 |
} |
|
6065 | 461 |
bool |
462 |
WifiRemoteStationManager::IsBrandNew (Mac48Address address) const |
|
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
463 |
{ |
6065 | 464 |
if (address.IsGroup ()) |
465 |
{ |
|
466 |
return false; |
|
467 |
} |
|
468 |
return LookupState (address)->m_state == WifiRemoteStationState::BRAND_NEW; |
|
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
469 |
} |
6065 | 470 |
bool |
471 |
WifiRemoteStationManager::IsAssociated (Mac48Address address) const |
|
472 |
{ |
|
473 |
if (address.IsGroup ()) |
|
474 |
{ |
|
475 |
return true; |
|
476 |
} |
|
477 |
return LookupState (address)->m_state == WifiRemoteStationState::GOT_ASSOC_TX_OK; |
|
478 |
} |
|
479 |
bool |
|
480 |
WifiRemoteStationManager::IsWaitAssocTxOk (Mac48Address address) const |
|
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
481 |
{ |
6065 | 482 |
if (address.IsGroup ()) |
483 |
{ |
|
484 |
return false; |
|
485 |
} |
|
486 |
return LookupState (address)->m_state == WifiRemoteStationState::WAIT_ASSOC_TX_OK; |
|
487 |
} |
|
488 |
void |
|
489 |
WifiRemoteStationManager::RecordWaitAssocTxOk (Mac48Address address) |
|
490 |
{ |
|
491 |
NS_ASSERT (!address.IsGroup ()); |
|
492 |
LookupState (address)->m_state = WifiRemoteStationState::WAIT_ASSOC_TX_OK; |
|
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
493 |
} |
6065 | 494 |
void |
495 |
WifiRemoteStationManager::RecordGotAssocTxOk (Mac48Address address) |
|
496 |
{ |
|
497 |
NS_ASSERT (!address.IsGroup ()); |
|
498 |
LookupState (address)->m_state = WifiRemoteStationState::GOT_ASSOC_TX_OK; |
|
499 |
} |
|
500 |
void |
|
501 |
WifiRemoteStationManager::RecordGotAssocTxFailed (Mac48Address address) |
|
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
502 |
{ |
6065 | 503 |
NS_ASSERT (!address.IsGroup ()); |
504 |
LookupState (address)->m_state = WifiRemoteStationState::DISASSOC; |
|
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
505 |
} |
6065 | 506 |
void |
507 |
WifiRemoteStationManager::RecordDisassociated (Mac48Address address) |
|
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
508 |
{ |
6065 | 509 |
NS_ASSERT (!address.IsGroup ()); |
510 |
LookupState (address)->m_state = WifiRemoteStationState::DISASSOC; |
|
511 |
} |
|
512 |
void |
|
513 |
WifiRemoteStationManager::PrepareForQueue (Mac48Address address, const WifiMacHeader *header, |
|
514 |
Ptr<const Packet> packet, uint32_t fullPacketSize) |
|
515 |
{ |
|
516 |
if (IsLowLatency () || address.IsGroup ()) |
|
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
517 |
{ |
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
518 |
return; |
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
519 |
} |
6241
d9a65be745f0
Bug 802 - Minstrel, Onoe and Amrr not working
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6087
diff
changeset
|
520 |
WifiRemoteStation *station = Lookup (address, header); |
10139 | 521 |
WifiTxVector rts = DoGetRtsTxVector (station); |
522 |
WifiTxVector data = DoGetDataTxVector (station, fullPacketSize); |
|
523 |
WifiTxVector ctstoself = DoGetCtsToSelfTxVector (); |
|
524 |
HighLatencyDataTxVectorTag datatag; |
|
525 |
HighLatencyRtsTxVectorTag rtstag; |
|
526 |
HighLatencyCtsToSelfTxVectorTag ctstoselftag; |
|
6241
d9a65be745f0
Bug 802 - Minstrel, Onoe and Amrr not working
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6087
diff
changeset
|
527 |
// first, make sure that the tag is not here anymore. |
10139 | 528 |
ConstCast<Packet> (packet)->RemovePacketTag (datatag); |
529 |
ConstCast<Packet> (packet)->RemovePacketTag (rtstag); |
|
530 |
ConstCast<Packet> (packet)->RemovePacketTag (ctstoselftag); |
|
531 |
datatag = HighLatencyDataTxVectorTag (data); |
|
532 |
rtstag = HighLatencyRtsTxVectorTag (rts); |
|
533 |
ctstoselftag = HighLatencyCtsToSelfTxVectorTag (ctstoself); |
|
6241
d9a65be745f0
Bug 802 - Minstrel, Onoe and Amrr not working
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6087
diff
changeset
|
534 |
// and then, add it back |
10139 | 535 |
packet->AddPacketTag (datatag); |
536 |
packet->AddPacketTag (rtstag); |
|
537 |
packet->AddPacketTag (ctstoselftag); |
|
6065 | 538 |
} |
10139 | 539 |
WifiTxVector |
540 |
WifiRemoteStationManager::GetDataTxVector (Mac48Address address, const WifiMacHeader *header, |
|
6065 | 541 |
Ptr<const Packet> packet, uint32_t fullPacketSize) |
542 |
{ |
|
543 |
if (address.IsGroup ()) |
|
544 |
{ |
|
10139 | 545 |
WifiTxVector v; |
546 |
v.SetMode (GetNonUnicastMode ()); |
|
547 |
v.SetTxPowerLevel (m_defaultTxPowerLevel); |
|
548 |
v.SetShortGuardInterval (false); |
|
549 |
v.SetNss (1); |
|
550 |
v.SetNess (0); |
|
551 |
v.SetStbc (false); |
|
552 |
return v; |
|
6065 | 553 |
} |
554 |
if (!IsLowLatency ()) |
|
555 |
{ |
|
10139 | 556 |
HighLatencyDataTxVectorTag datatag; |
6065 | 557 |
bool found; |
10139 | 558 |
found = ConstCast<Packet> (packet)->PeekPacketTag (datatag); |
6065 | 559 |
NS_ASSERT (found); |
10139 | 560 |
// cast found to void, to suppress 'found' set but not used |
561 |
// compiler warning |
|
562 |
(void) found; |
|
563 |
return datatag.GetDataTxVector (); |
|
6065 | 564 |
} |
10139 | 565 |
return DoGetDataTxVector (Lookup (address, header), fullPacketSize); |
6065 | 566 |
} |
10139 | 567 |
WifiTxVector |
568 |
WifiRemoteStationManager::GetCtsToSelfTxVector(const WifiMacHeader *header, |
|
569 |
Ptr<const Packet> packet) |
|
570 |
{ |
|
571 |
||
572 |
if (!IsLowLatency ()) |
|
573 |
{ |
|
574 |
HighLatencyCtsToSelfTxVectorTag ctstoselftag; |
|
575 |
bool found; |
|
576 |
found = ConstCast<Packet> (packet)->PeekPacketTag (ctstoselftag); |
|
577 |
NS_ASSERT (found); |
|
578 |
// cast found to void, to suppress 'found' set but not used |
|
579 |
// compiler warning |
|
580 |
(void) found; |
|
581 |
return ctstoselftag.GetCtsToSelfTxVector (); |
|
582 |
} |
|
583 |
return DoGetCtsToSelfTxVector (); |
|
584 |
} |
|
585 |
||
586 |
WifiTxVector |
|
587 |
WifiRemoteStationManager::DoGetCtsToSelfTxVector (void) |
|
588 |
{ |
|
589 |
return WifiTxVector (GetDefaultMode(), GetDefaultTxPowerLevel (),0,m_wifiPhy->GetGuardInterval(),GetNumberOfTransmitAntennas(), GetNumberOfTransmitAntennas(), false); |
|
590 |
} |
|
591 |
||
592 |
WifiTxVector |
|
593 |
WifiRemoteStationManager::GetRtsTxVector (Mac48Address address, const WifiMacHeader *header, |
|
6065 | 594 |
Ptr<const Packet> packet) |
595 |
{ |
|
596 |
NS_ASSERT (!address.IsGroup ()); |
|
597 |
if (!IsLowLatency ()) |
|
598 |
{ |
|
10139 | 599 |
HighLatencyRtsTxVectorTag rtstag; |
6065 | 600 |
bool found; |
10139 | 601 |
found = ConstCast<Packet> (packet)->PeekPacketTag (rtstag); |
6065 | 602 |
NS_ASSERT (found); |
10139 | 603 |
// cast found to void, to suppress 'found' set but not used |
604 |
// compiler warning |
|
605 |
(void) found; |
|
606 |
return rtstag.GetRtsTxVector (); |
|
6065 | 607 |
} |
10139 | 608 |
return DoGetRtsTxVector (Lookup (address, header)); |
6065 | 609 |
} |
610 |
void |
|
611 |
WifiRemoteStationManager::ReportRtsFailed (Mac48Address address, const WifiMacHeader *header) |
|
612 |
{ |
|
613 |
NS_ASSERT (!address.IsGroup ()); |
|
614 |
WifiRemoteStation *station = Lookup (address, header); |
|
615 |
station->m_ssrc++; |
|
616 |
m_macTxRtsFailed (address); |
|
617 |
DoReportRtsFailed (station); |
|
618 |
} |
|
619 |
void |
|
620 |
WifiRemoteStationManager::ReportDataFailed (Mac48Address address, const WifiMacHeader *header) |
|
621 |
{ |
|
622 |
NS_ASSERT (!address.IsGroup ()); |
|
623 |
WifiRemoteStation *station = Lookup (address, header); |
|
624 |
station->m_slrc++; |
|
625 |
m_macTxDataFailed (address); |
|
626 |
DoReportDataFailed (station); |
|
627 |
} |
|
628 |
void |
|
629 |
WifiRemoteStationManager::ReportRtsOk (Mac48Address address, const WifiMacHeader *header, |
|
630 |
double ctsSnr, WifiMode ctsMode, double rtsSnr) |
|
631 |
{ |
|
632 |
NS_ASSERT (!address.IsGroup ()); |
|
633 |
WifiRemoteStation *station = Lookup (address, header); |
|
6069
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
634 |
station->m_state->m_info.NotifyTxSuccess (station->m_ssrc); |
6065 | 635 |
station->m_ssrc = 0; |
636 |
DoReportRtsOk (station, ctsSnr, ctsMode, rtsSnr); |
|
637 |
} |
|
638 |
void |
|
639 |
WifiRemoteStationManager::ReportDataOk (Mac48Address address, const WifiMacHeader *header, |
|
640 |
double ackSnr, WifiMode ackMode, double dataSnr) |
|
641 |
{ |
|
642 |
NS_ASSERT (!address.IsGroup ()); |
|
643 |
WifiRemoteStation *station = Lookup (address, header); |
|
6069
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
644 |
station->m_state->m_info.NotifyTxSuccess (station->m_slrc); |
6065 | 645 |
station->m_slrc = 0; |
646 |
DoReportDataOk (station, ackSnr, ackMode, dataSnr); |
|
647 |
} |
|
648 |
void |
|
649 |
WifiRemoteStationManager::ReportFinalRtsFailed (Mac48Address address, const WifiMacHeader *header) |
|
650 |
{ |
|
651 |
NS_ASSERT (!address.IsGroup ()); |
|
652 |
WifiRemoteStation *station = Lookup (address, header); |
|
6069
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
653 |
station->m_state->m_info.NotifyTxFailed (); |
6065 | 654 |
station->m_ssrc = 0; |
655 |
m_macTxFinalRtsFailed (address); |
|
656 |
DoReportFinalRtsFailed (station); |
|
657 |
} |
|
658 |
void |
|
659 |
WifiRemoteStationManager::ReportFinalDataFailed (Mac48Address address, const WifiMacHeader *header) |
|
660 |
{ |
|
661 |
NS_ASSERT (!address.IsGroup ()); |
|
662 |
WifiRemoteStation *station = Lookup (address, header); |
|
6069
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
663 |
station->m_state->m_info.NotifyTxFailed (); |
6065 | 664 |
station->m_slrc = 0; |
665 |
m_macTxFinalDataFailed (address); |
|
666 |
DoReportFinalDataFailed (station); |
|
667 |
} |
|
668 |
void |
|
669 |
WifiRemoteStationManager::ReportRxOk (Mac48Address address, const WifiMacHeader *header, |
|
670 |
double rxSnr, WifiMode txMode) |
|
671 |
{ |
|
672 |
if (address.IsGroup ()) |
|
673 |
{ |
|
674 |
return; |
|
675 |
} |
|
676 |
WifiRemoteStation *station = Lookup (address, header); |
|
677 |
DoReportRxOk (station, rxSnr, txMode); |
|
678 |
} |
|
679 |
bool |
|
680 |
WifiRemoteStationManager::NeedRts (Mac48Address address, const WifiMacHeader *header, |
|
681 |
Ptr<const Packet> packet) |
|
682 |
{ |
|
683 |
if (address.IsGroup ()) |
|
684 |
{ |
|
685 |
return false; |
|
686 |
} |
|
6473 | 687 |
bool normally = (packet->GetSize () + header->GetSize () + WIFI_MAC_FCS_LENGTH) > GetRtsCtsThreshold (); |
6065 | 688 |
return DoNeedRts (Lookup (address, header), packet, normally); |
689 |
} |
|
690 |
bool |
|
10139 | 691 |
WifiRemoteStationManager::NeedCtsToSelf (WifiTxVector txVector) |
692 |
{ |
|
693 |
WifiMode mode = txVector.GetMode(); |
|
694 |
||
695 |
// search the BSS Basic Rate set if the used mode in the basic set then no need for Cts to self |
|
696 |
for (WifiModeListIterator i = m_bssBasicRateSet.begin (); |
|
697 |
i != m_bssBasicRateSet.end (); i++) |
|
698 |
{ |
|
699 |
if (mode == *i) |
|
700 |
{ |
|
701 |
return false; |
|
702 |
} |
|
703 |
} |
|
704 |
if (HasHtSupported()) |
|
705 |
{ |
|
706 |
uint8_t mcs = m_wifiPhy->WifiModeToMcs (mode); |
|
707 |
for (WifiMcsListIterator i = m_bssBasicMcsSet.begin (); |
|
708 |
i != m_bssBasicMcsSet.end (); i++) |
|
709 |
{ |
|
710 |
if (mcs == *i) |
|
711 |
{ |
|
712 |
return false; |
|
713 |
} |
|
714 |
} |
|
715 |
} |
|
716 |
return true; |
|
717 |
} |
|
718 |
bool |
|
6065 | 719 |
WifiRemoteStationManager::NeedRtsRetransmission (Mac48Address address, const WifiMacHeader *header, |
720 |
Ptr<const Packet> packet) |
|
721 |
{ |
|
722 |
NS_ASSERT (!address.IsGroup ()); |
|
723 |
WifiRemoteStation *station = Lookup (address, header); |
|
724 |
bool normally = station->m_ssrc < GetMaxSsrc (); |
|
725 |
return DoNeedRtsRetransmission (station, packet, normally); |
|
726 |
} |
|
727 |
bool |
|
728 |
WifiRemoteStationManager::NeedDataRetransmission (Mac48Address address, const WifiMacHeader *header, |
|
729 |
Ptr<const Packet> packet) |
|
730 |
{ |
|
731 |
NS_ASSERT (!address.IsGroup ()); |
|
732 |
WifiRemoteStation *station = Lookup (address, header); |
|
733 |
bool normally = station->m_slrc < GetMaxSlrc (); |
|
734 |
return DoNeedDataRetransmission (station, packet, normally); |
|
735 |
} |
|
736 |
bool |
|
737 |
WifiRemoteStationManager::NeedFragmentation (Mac48Address address, const WifiMacHeader *header, |
|
738 |
Ptr<const Packet> packet) |
|
739 |
{ |
|
740 |
if (address.IsGroup ()) |
|
741 |
{ |
|
742 |
return false; |
|
743 |
} |
|
744 |
WifiRemoteStation *station = Lookup (address, header); |
|
6473 | 745 |
bool normally = (packet->GetSize () + header->GetSize () + WIFI_MAC_FCS_LENGTH) > GetFragmentationThreshold (); |
6065 | 746 |
return DoNeedFragmentation (station, packet, normally); |
747 |
} |
|
9165
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
748 |
|
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
749 |
void |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
750 |
WifiRemoteStationManager::DoSetFragmentationThreshold (uint32_t threshold) |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
751 |
{ |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
752 |
if (threshold < 256) |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
753 |
{ |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
754 |
/* |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
755 |
* ASN.1 encoding of the MAC and PHY MIB (256 ... 8000) |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
756 |
*/ |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
757 |
NS_LOG_WARN ("Fragmentation threshold should be larger than 256. Setting to 256."); |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
758 |
m_fragmentationThreshold = 256; |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
759 |
} |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
760 |
else |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
761 |
{ |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
762 |
/* |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
763 |
* The length of each fragment shall be an even number of octets, except for the last fragment if an MSDU or |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
764 |
* MMPDU, which may be either an even or an odd number of octets. |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
765 |
*/ |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
766 |
if (threshold % 2 != 0) |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
767 |
{ |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
768 |
NS_LOG_WARN ("Fragmentation threshold should be an even number. Setting to " << threshold - 1); |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
769 |
m_fragmentationThreshold = threshold - 1; |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
770 |
} |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
771 |
else |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
772 |
{ |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
773 |
m_fragmentationThreshold = threshold; |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
774 |
} |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
775 |
} |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
776 |
} |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
777 |
|
6065 | 778 |
uint32_t |
9165
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
779 |
WifiRemoteStationManager::DoGetFragmentationThreshold (void) const |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
780 |
{ |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
781 |
return m_fragmentationThreshold; |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
782 |
} |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
783 |
|
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
784 |
uint32_t |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
785 |
WifiRemoteStationManager::GetNFragments (const WifiMacHeader *header, Ptr<const Packet> packet) |
6065 | 786 |
{ |
9165
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
787 |
//The number of bytes a fragment can support is (Threshold - WIFI_HEADER_SIZE - WIFI_FCS). |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
788 |
uint32_t nFragments = (packet->GetSize () / (GetFragmentationThreshold () - header->GetSize () - WIFI_MAC_FCS_LENGTH)); |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
789 |
|
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
790 |
//If the size of the last fragment is not 0. |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
791 |
if ((packet->GetSize () % (GetFragmentationThreshold () - header->GetSize () - WIFI_MAC_FCS_LENGTH)) > 0) |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
792 |
{ |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
793 |
nFragments++; |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
794 |
} |
6065 | 795 |
return nFragments; |
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
796 |
} |
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
797 |
|
6065 | 798 |
uint32_t |
799 |
WifiRemoteStationManager::GetFragmentSize (Mac48Address address, const WifiMacHeader *header, |
|
800 |
Ptr<const Packet> packet, uint32_t fragmentNumber) |
|
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
801 |
{ |
6065 | 802 |
NS_ASSERT (!address.IsGroup ()); |
9165
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
803 |
uint32_t nFragment = GetNFragments (header, packet); |
6065 | 804 |
if (fragmentNumber >= nFragment) |
805 |
{ |
|
806 |
return 0; |
|
807 |
} |
|
9165
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
808 |
//Last fragment |
6065 | 809 |
if (fragmentNumber == nFragment - 1) |
810 |
{ |
|
9165
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
811 |
uint32_t lastFragmentSize = packet->GetSize () - (fragmentNumber * (GetFragmentationThreshold () - header->GetSize () - WIFI_MAC_FCS_LENGTH)); |
6065 | 812 |
return lastFragmentSize; |
813 |
} |
|
9165
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
814 |
//All fragments but the last, the number of bytes is (Threshold - WIFI_HEADER_SIZE - WIFI_FCS). |
6065 | 815 |
else |
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
816 |
{ |
9165
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
817 |
return GetFragmentationThreshold () - header->GetSize () - WIFI_MAC_FCS_LENGTH; |
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
818 |
} |
6065 | 819 |
} |
820 |
uint32_t |
|
821 |
WifiRemoteStationManager::GetFragmentOffset (Mac48Address address, const WifiMacHeader *header, |
|
822 |
Ptr<const Packet> packet, uint32_t fragmentNumber) |
|
823 |
{ |
|
824 |
NS_ASSERT (!address.IsGroup ()); |
|
9165
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
825 |
NS_ASSERT (fragmentNumber < GetNFragments (header, packet)); |
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
826 |
uint32_t fragmentOffset = fragmentNumber * (GetFragmentationThreshold () - header->GetSize () - WIFI_MAC_FCS_LENGTH); |
6065 | 827 |
return fragmentOffset; |
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
828 |
} |
6065 | 829 |
bool |
830 |
WifiRemoteStationManager::IsLastFragment (Mac48Address address, const WifiMacHeader *header, |
|
831 |
Ptr<const Packet> packet, uint32_t fragmentNumber) |
|
832 |
{ |
|
833 |
NS_ASSERT (!address.IsGroup ()); |
|
9165
7b219a73b844
Bug 1524 - WiFi fragmentation issue
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9063
diff
changeset
|
834 |
bool isLast = fragmentNumber == (GetNFragments (header, packet) - 1); |
6065 | 835 |
return isLast; |
836 |
} |
|
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
837 |
WifiMode |
6065 | 838 |
WifiRemoteStationManager::GetControlAnswerMode (Mac48Address address, WifiMode reqMode) |
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
839 |
{ |
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
840 |
/** |
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
841 |
* The standard has relatively unambiguous rules for selecting a |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
842 |
* control response rate (the below is quoted from IEEE 802.11-2007, |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
843 |
* Section 9.6): |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
844 |
* |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
845 |
* To allow the transmitting STA to calculate the contents of the |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
846 |
* Duration/ID field, a STA responding to a received frame shall |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
847 |
* transmit its Control Response frame (either CTS or ACK), other |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
848 |
* than the BlockAck control frame, at the highest rate in the |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
849 |
* BSSBasicRateSet parameter that is less than or equal to the |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
850 |
* rate of the immediately previous frame in the frame exchange |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
851 |
* sequence (as defined in 9.12) and that is of the same |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
852 |
* modulation class (see 9.6.1) as the received frame... |
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
853 |
*/ |
6065 | 854 |
WifiMode mode = GetDefaultMode (); |
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
855 |
bool found = false; |
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
856 |
|
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
857 |
// First, search the BSS Basic Rate set |
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
858 |
for (WifiModeListIterator i = m_bssBasicRateSet.begin (); |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
859 |
i != m_bssBasicRateSet.end (); i++) |
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
860 |
{ |
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
861 |
if ((!found || i->GetPhyRate () > mode.GetPhyRate ()) |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
862 |
&& i->GetPhyRate () <= reqMode.GetPhyRate () |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
863 |
&& i->GetModulationClass () == reqMode.GetModulationClass ()) |
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
864 |
{ |
1930
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1913
diff
changeset
|
865 |
mode = *i; |
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
866 |
// We've found a potentially-suitable transmit rate, but we |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
867 |
// need to continue and consider all the basic rates before |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
868 |
// we can be sure we've got the right one. |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
869 |
found = true; |
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
870 |
} |
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
871 |
} |
10139 | 872 |
if(HasHtSupported()) |
873 |
{ |
|
874 |
if (!found) |
|
875 |
{ |
|
876 |
uint8_t mcs = GetDefaultMcs (); |
|
877 |
mode= m_wifiPhy->McsToWifiMode (mcs); |
|
878 |
} |
|
879 |
for (WifiMcsListIterator i = m_bssBasicMcsSet.begin (); |
|
880 |
i != m_bssBasicMcsSet.end (); i++) |
|
881 |
{ |
|
882 |
WifiMode thismode= m_wifiPhy->McsToWifiMode (*i); |
|
883 |
if ((!found || thismode.GetPhyRate () > mode.GetPhyRate ()) |
|
884 |
&& thismode.GetPhyRate () <= reqMode.GetPhyRate () |
|
885 |
&& thismode.GetModulationClass () == reqMode.GetModulationClass ()) |
|
886 |
{ |
|
887 |
mode = thismode; |
|
888 |
// We've found a potentially-suitable transmit rate, but we |
|
889 |
// need to continue and consider all the basic rates before |
|
890 |
// we can be sure we've got the right one. |
|
891 |
found = true; |
|
892 |
} |
|
893 |
} |
|
894 |
} |
|
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
895 |
// If we found a suitable rate in the BSSBasicRateSet, then we are |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
896 |
// done and can return that mode. |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
897 |
if (found) |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
898 |
{ |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
899 |
return mode; |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
900 |
} |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
901 |
|
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
902 |
/** |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
903 |
* If no suitable basic rate was found, we search the mandatory |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
904 |
* rates. The standard (IEEE 802.11-2007, Section 9.6) says: |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
905 |
* |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
906 |
* ...If no rate contained in the BSSBasicRateSet parameter meets |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
907 |
* these conditions, then the control frame sent in response to a |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
908 |
* received frame shall be transmitted at the highest mandatory |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
909 |
* rate of the PHY that is less than or equal to the rate of the |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
910 |
* received frame, and that is of the same modulation class as the |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
911 |
* received frame. In addition, the Control Response frame shall |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
912 |
* be sent using the same PHY options as the received frame, |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
913 |
* unless they conflict with the requirement to use the |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
914 |
* BSSBasicRateSet parameter. |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
915 |
* |
9870
6543f3876ff5
[Doxygen] use \todo
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9165
diff
changeset
|
916 |
* \todo Note that we're ignoring the last sentence for now, because |
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
917 |
* there is not yet any manipulation here of PHY options. |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
918 |
*/ |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
919 |
for (uint32_t idx = 0; idx < m_wifiPhy->GetNModes (); idx++) |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
920 |
{ |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
921 |
WifiMode thismode = m_wifiPhy->GetMode (idx); |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
922 |
|
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
923 |
/* If the rate: |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
924 |
* |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
925 |
* - is a mandatory rate for the PHY, and |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
926 |
* - is equal to or faster than our current best choice, and |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
927 |
* - is less than or equal to the rate of the received frame, and |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
928 |
* - is of the same modulation class as the received frame |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
929 |
* |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
930 |
* ...then it's our best choice so far. |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
931 |
*/ |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
932 |
if (thismode.IsMandatory () |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
933 |
&& (!found || thismode.GetPhyRate () > mode.GetPhyRate ()) |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
934 |
&& thismode.GetPhyRate () <= reqMode.GetPhyRate () |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
935 |
&& thismode.GetModulationClass () == reqMode.GetModulationClass ()) |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
936 |
{ |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
937 |
mode = thismode; |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
938 |
// As above; we've found a potentially-suitable transmit |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
939 |
// rate, but we need to continue and consider all the |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
940 |
// mandatory rates before we can be sure we've got the right |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
941 |
// one. |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
942 |
found = true; |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
943 |
} |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
944 |
} |
10139 | 945 |
if(HasHtSupported()) |
946 |
{ |
|
947 |
for (uint32_t idx = 0; idx < m_wifiPhy->GetNMcs (); idx++) |
|
948 |
{ |
|
949 |
uint8_t thismcs = m_wifiPhy->GetMcs (idx); |
|
950 |
WifiMode thismode= m_wifiPhy->McsToWifiMode (thismcs); |
|
951 |
if (thismode.IsMandatory () |
|
952 |
&& (!found || thismode.GetPhyRate () > mode.GetPhyRate ()) |
|
953 |
&& thismode.GetPhyRate () <= reqMode.GetPhyRate () |
|
954 |
&& thismode.GetModulationClass () == reqMode.GetModulationClass ()) |
|
955 |
{ |
|
956 |
mode = thismode; |
|
957 |
// As above; we've found a potentially-suitable transmit |
|
958 |
// rate, but we need to continue and consider all the |
|
959 |
// mandatory rates before we can be sure we've got the right |
|
960 |
// one. |
|
961 |
found = true; |
|
962 |
} |
|
963 |
||
964 |
} |
|
965 |
} |
|
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
966 |
|
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
967 |
/** |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
968 |
* If we still haven't found a suitable rate for the response then |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
969 |
* someone has messed up the simulation config. This probably means |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
970 |
* that the WifiPhyStandard is not set correctly, or that a rate that |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
971 |
* is not supported by the PHY has been explicitly requested in a |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
972 |
* WifiRemoteStationManager (or descendant) configuration. |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
973 |
* |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
974 |
* Either way, it is serious - we can either disobey the standard or |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
975 |
* fail, and I have chosen to do the latter... |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
976 |
*/ |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
977 |
if (!found) |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
978 |
{ |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
979 |
NS_FATAL_ERROR ("Can't find response rate for " << reqMode |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
980 |
<< ". Check standard and selected rates match."); |
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
981 |
} |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
982 |
|
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
983 |
return mode; |
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
984 |
} |
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
985 |
|
10139 | 986 |
WifiTxVector |
987 |
WifiRemoteStationManager::GetCtsTxVector (Mac48Address address, WifiMode rtsMode) |
|
988 |
{ |
|
989 |
NS_ASSERT (!address.IsGroup ()); |
|
990 |
WifiTxVector v; |
|
991 |
v.SetMode (GetControlAnswerMode (address, rtsMode)); |
|
992 |
v.SetTxPowerLevel (DoGetCtsTxPowerLevel (address, v.GetMode())); |
|
993 |
v.SetShortGuardInterval (DoGetCtsTxGuardInterval(address, v.GetMode())); |
|
994 |
v.SetNss (DoGetCtsTxNss(address, v.GetMode())); |
|
995 |
v.SetNess (DoGetCtsTxNess(address, v.GetMode())); |
|
996 |
v.SetStbc (DoGetCtsTxStbc(address, v.GetMode())); |
|
997 |
return v; |
|
998 |
} |
|
999 |
WifiTxVector |
|
1000 |
WifiRemoteStationManager::GetAckTxVector (Mac48Address address, WifiMode dataMode) |
|
1001 |
{ |
|
1002 |
NS_ASSERT (!address.IsGroup ()); |
|
1003 |
WifiTxVector v; |
|
1004 |
v.SetMode (GetControlAnswerMode (address, dataMode)); |
|
1005 |
v.SetTxPowerLevel (DoGetAckTxPowerLevel (address, v.GetMode())); |
|
1006 |
v.SetShortGuardInterval(DoGetAckTxGuardInterval(address, v.GetMode())); |
|
1007 |
v.SetNss(DoGetAckTxNss(address, v.GetMode())); |
|
1008 |
v.SetNess(DoGetAckTxNess(address, v.GetMode())); |
|
1009 |
v.SetStbc(DoGetAckTxStbc(address, v.GetMode())); |
|
1010 |
return v; |
|
1011 |
} |
|
1012 |
WifiTxVector |
|
1013 |
WifiRemoteStationManager::GetBlockAckTxVector (Mac48Address address, WifiMode blockAckReqMode) |
|
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
1014 |
{ |
6065 | 1015 |
NS_ASSERT (!address.IsGroup ()); |
10139 | 1016 |
WifiTxVector v; |
1017 |
v.SetMode (GetControlAnswerMode (address, blockAckReqMode)); |
|
1018 |
v.SetTxPowerLevel (DoGetBlockAckTxPowerLevel (address, v.GetMode())); |
|
1019 |
v.SetShortGuardInterval (DoGetBlockAckTxGuardInterval(address, v.GetMode())); |
|
1020 |
v.SetNss (DoGetBlockAckTxNss(address, v.GetMode())); |
|
1021 |
v.SetNess (DoGetBlockAckTxNess(address, v.GetMode())); |
|
1022 |
v.SetStbc (DoGetBlockAckTxStbc(address, v.GetMode())); |
|
1023 |
return v; |
|
1024 |
} |
|
1025 |
||
1026 |
uint8_t |
|
1027 |
WifiRemoteStationManager::DoGetCtsTxPowerLevel (Mac48Address address, WifiMode ctsMode) |
|
1028 |
{ |
|
1029 |
return m_defaultTxPowerLevel; |
|
1030 |
} |
|
1031 |
||
1032 |
bool |
|
1033 |
WifiRemoteStationManager::DoGetCtsTxGuardInterval(Mac48Address address, WifiMode ctsMode) |
|
1034 |
{ |
|
1035 |
return m_wifiPhy->GetGuardInterval(); |
|
1036 |
} |
|
1037 |
||
1038 |
uint8_t |
|
1039 |
WifiRemoteStationManager::DoGetCtsTxNss(Mac48Address address, WifiMode ctsMode) |
|
1040 |
{ |
|
1041 |
return 1; |
|
1042 |
} |
|
1043 |
uint8_t |
|
1044 |
WifiRemoteStationManager::DoGetCtsTxNess(Mac48Address address, WifiMode ctsMode) |
|
1045 |
{ |
|
1046 |
return 0; |
|
1047 |
} |
|
1048 |
bool |
|
1049 |
WifiRemoteStationManager::DoGetCtsTxStbc(Mac48Address address, WifiMode ctsMode) |
|
1050 |
{ |
|
1051 |
return m_wifiPhy->GetStbc(); |
|
1052 |
} |
|
1053 |
||
1054 |
uint8_t |
|
1055 |
WifiRemoteStationManager::DoGetAckTxPowerLevel (Mac48Address address, WifiMode ackMode) |
|
1056 |
{ |
|
1057 |
return m_defaultTxPowerLevel; |
|
1058 |
} |
|
1059 |
||
1060 |
bool |
|
1061 |
WifiRemoteStationManager::DoGetAckTxGuardInterval(Mac48Address address, WifiMode ackMode) |
|
1062 |
{ |
|
1063 |
return m_wifiPhy->GetGuardInterval(); |
|
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
1064 |
} |
10139 | 1065 |
|
1066 |
uint8_t |
|
1067 |
WifiRemoteStationManager::DoGetAckTxNss(Mac48Address address, WifiMode ackMode) |
|
1068 |
{ |
|
1069 |
return 1; |
|
1070 |
} |
|
1071 |
uint8_t |
|
1072 |
WifiRemoteStationManager::DoGetAckTxNess(Mac48Address address, WifiMode ackMode) |
|
1073 |
{ |
|
1074 |
return 0; |
|
1075 |
} |
|
1076 |
bool |
|
1077 |
WifiRemoteStationManager::DoGetAckTxStbc(Mac48Address address, WifiMode ackMode) |
|
1078 |
{ |
|
1079 |
return m_wifiPhy->GetStbc(); |
|
1080 |
} |
|
1081 |
||
1082 |
uint8_t |
|
1083 |
WifiRemoteStationManager::DoGetBlockAckTxPowerLevel (Mac48Address address, WifiMode blockAckMode) |
|
1084 |
{ |
|
1085 |
return m_defaultTxPowerLevel; |
|
1086 |
} |
|
1087 |
||
1088 |
bool |
|
1089 |
WifiRemoteStationManager::DoGetBlockAckTxGuardInterval(Mac48Address address, WifiMode blockAckMode) |
|
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
1090 |
{ |
10139 | 1091 |
return m_wifiPhy->GetGuardInterval(); |
1092 |
} |
|
1093 |
||
1094 |
uint8_t |
|
1095 |
WifiRemoteStationManager::DoGetBlockAckTxNss(Mac48Address address, WifiMode blockAckMode) |
|
1096 |
{ |
|
1097 |
return 1; |
|
1098 |
} |
|
1099 |
uint8_t |
|
1100 |
WifiRemoteStationManager::DoGetBlockAckTxNess(Mac48Address address, WifiMode blockAckMode) |
|
1101 |
{ |
|
1102 |
return 0; |
|
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
1103 |
} |
10139 | 1104 |
bool |
1105 |
WifiRemoteStationManager::DoGetBlockAckTxStbc(Mac48Address address, WifiMode blockAckMode) |
|
1106 |
{ |
|
1107 |
return m_wifiPhy->GetStbc(); |
|
1108 |
} |
|
1109 |
||
1110 |
||
1111 |
uint8_t |
|
1112 |
WifiRemoteStationManager::GetDefaultTxPowerLevel (void) const |
|
1113 |
{ |
|
1114 |
return m_defaultTxPowerLevel; |
|
1115 |
} |
|
1116 |
||
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
1117 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
1118 |
WifiRemoteStationInfo |
6071
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
1119 |
WifiRemoteStationManager::GetInfo (Mac48Address address) |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
1120 |
{ |
6339 | 1121 |
WifiRemoteStationState *state = LookupState (address); |
6071
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
1122 |
return state->m_info; |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
1123 |
} |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
1124 |
|
6065 | 1125 |
WifiRemoteStationState * |
1126 |
WifiRemoteStationManager::LookupState (Mac48Address address) const |
|
2349
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
1127 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
1128 |
for (StationStates::const_iterator i = m_states.begin (); i != m_states.end (); i++) |
2349
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
1129 |
{ |
6065 | 1130 |
if ((*i)->m_address == address) |
1131 |
{ |
|
1132 |
return (*i); |
|
1133 |
} |
|
2349
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
1134 |
} |
6065 | 1135 |
WifiRemoteStationState *state = new WifiRemoteStationState (); |
1136 |
state->m_state = WifiRemoteStationState::BRAND_NEW; |
|
1137 |
state->m_address = address; |
|
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
1138 |
state->m_operationalRateSet.push_back (GetDefaultMode ()); |
10139 | 1139 |
state->m_operationalMcsSet.push_back(GetDefaultMcs()); |
1140 |
state->m_shortGuardInterval=m_wifiPhy->GetGuardInterval(); |
|
1141 |
state->m_greenfield=m_wifiPhy->GetGreenfield(); |
|
1142 |
state->m_rx=1; |
|
1143 |
state->m_tx=1; |
|
1144 |
state->m_stbc=false; |
|
6067
ccbdc2b19ea5
add newly-created state to state list.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6065
diff
changeset
|
1145 |
const_cast<WifiRemoteStationManager *> (this)->m_states.push_back (state); |
6065 | 1146 |
return state; |
2349
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
1147 |
} |
6065 | 1148 |
WifiRemoteStation * |
1149 |
WifiRemoteStationManager::Lookup (Mac48Address address, const WifiMacHeader *header) const |
|
2349
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
1150 |
{ |
6065 | 1151 |
uint8_t tid; |
1152 |
if (header->IsQosData ()) |
|
2349
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
1153 |
{ |
6065 | 1154 |
tid = header->GetQosTid (); |
2349
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
1155 |
} |
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
1156 |
else |
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
1157 |
{ |
6065 | 1158 |
tid = 0; |
2349
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
1159 |
} |
6065 | 1160 |
return Lookup (address, tid); |
2349
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
1161 |
} |
6065 | 1162 |
WifiRemoteStation * |
1163 |
WifiRemoteStationManager::Lookup (Mac48Address address, uint8_t tid) const |
|
3745
73e7bb607014
bug 372: fragmentation is broken
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3212
diff
changeset
|
1164 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
1165 |
for (Stations::const_iterator i = m_stations.begin (); i != m_stations.end (); i++) |
6065 | 1166 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
1167 |
if ((*i)->m_tid == tid |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
1168 |
&& (*i)->m_state->m_address == address) |
6065 | 1169 |
{ |
1170 |
return (*i); |
|
1171 |
} |
|
1172 |
} |
|
1173 |
WifiRemoteStationState *state = LookupState (address); |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
1174 |
|
6065 | 1175 |
WifiRemoteStation *station = DoCreateStation (); |
1176 |
station->m_state = state; |
|
6087
2c4e9171497e
Simple bug of WifiRemoteStationManager: station's tid is not initialized.
Kirill Andreev <andreev@iitp.ru>
parents:
6071
diff
changeset
|
1177 |
station->m_tid = tid; |
6065 | 1178 |
station->m_ssrc = 0; |
1179 |
station->m_slrc = 0; |
|
1180 |
// XXX |
|
1181 |
const_cast<WifiRemoteStationManager *> (this)->m_stations.push_back (station); |
|
1182 |
return station; |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
1183 |
|
3745
73e7bb607014
bug 372: fragmentation is broken
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3212
diff
changeset
|
1184 |
} |
10139 | 1185 |
//Used by all stations to record HT capabilities of remote stations |
1186 |
void |
|
1187 |
WifiRemoteStationManager::AddStationHtCapabilities (Mac48Address from, HtCapabilities htcapabilities) |
|
1188 |
{ |
|
1189 |
WifiRemoteStationState *state; |
|
1190 |
state=LookupState (from); |
|
1191 |
state->m_shortGuardInterval=htcapabilities.GetShortGuardInterval20(); |
|
1192 |
state->m_greenfield=htcapabilities.GetGreenfield(); |
|
1193 |
||
1194 |
} |
|
1195 |
//Used by mac low to choose format used GF, MF or Non HT |
|
1196 |
bool |
|
1197 |
WifiRemoteStationManager::GetGreenfieldSupported (Mac48Address address) const |
|
1198 |
{ |
|
1199 |
return LookupState(address)->m_greenfield; |
|
1200 |
} |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
1201 |
WifiMode |
6065 | 1202 |
WifiRemoteStationManager::GetDefaultMode (void) const |
1203 |
{ |
|
1204 |
return m_defaultTxMode; |
|
1205 |
} |
|
10139 | 1206 |
uint8_t |
1207 |
WifiRemoteStationManager::GetDefaultMcs (void) const |
|
1208 |
{ |
|
1209 |
return m_defaultTxMcs; |
|
1210 |
} |
|
6065 | 1211 |
void |
1212 |
WifiRemoteStationManager::Reset (void) |
|
2349
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
1213 |
{ |
6065 | 1214 |
for (Stations::const_iterator i = m_stations.begin (); i != m_stations.end (); i++) |
1215 |
{ |
|
1216 |
delete (*i); |
|
1217 |
} |
|
1218 |
m_stations.clear (); |
|
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
1219 |
m_bssBasicRateSet.clear (); |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
1220 |
m_bssBasicRateSet.push_back (m_defaultTxMode); |
10139 | 1221 |
m_bssBasicMcsSet.clear(); |
1222 |
m_bssBasicMcsSet.push_back (m_defaultTxMcs); |
|
6065 | 1223 |
NS_ASSERT (m_defaultTxMode.IsMandatory ()); |
1224 |
} |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
1225 |
void |
6065 | 1226 |
WifiRemoteStationManager::AddBasicMode (WifiMode mode) |
1227 |
{ |
|
1228 |
for (uint32_t i = 0; i < GetNBasicModes (); i++) |
|
2349
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
1229 |
{ |
6065 | 1230 |
if (GetBasicMode (i) == mode) |
1231 |
{ |
|
1232 |
return; |
|
1233 |
} |
|
1234 |
} |
|
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
1235 |
m_bssBasicRateSet.push_back (mode); |
6065 | 1236 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
1237 |
uint32_t |
6065 | 1238 |
WifiRemoteStationManager::GetNBasicModes (void) const |
1239 |
{ |
|
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
1240 |
return m_bssBasicRateSet.size (); |
6065 | 1241 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
1242 |
WifiMode |
6065 | 1243 |
WifiRemoteStationManager::GetBasicMode (uint32_t i) const |
1244 |
{ |
|
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
1245 |
NS_ASSERT (i < m_bssBasicRateSet.size ()); |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
1246 |
return m_bssBasicRateSet[i]; |
6065 | 1247 |
} |
10139 | 1248 |
|
1249 |
void |
|
1250 |
WifiRemoteStationManager::AddBasicMcs (uint8_t mcs) |
|
1251 |
{ |
|
1252 |
for (uint32_t i = 0; i < GetNBasicMcs (); i++) |
|
1253 |
{ |
|
1254 |
if (GetBasicMcs (i) == mcs) |
|
1255 |
{ |
|
1256 |
return; |
|
1257 |
} |
|
1258 |
} |
|
1259 |
m_bssBasicMcsSet.push_back (mcs); |
|
1260 |
} |
|
1261 |
||
1262 |
uint32_t |
|
1263 |
WifiRemoteStationManager::GetNBasicMcs (void) const |
|
1264 |
{ |
|
1265 |
return m_bssBasicMcsSet.size (); |
|
1266 |
} |
|
1267 |
uint8_t |
|
1268 |
WifiRemoteStationManager::GetBasicMcs (uint32_t i) const |
|
1269 |
{ |
|
1270 |
NS_ASSERT (i < m_bssBasicMcsSet.size ()); |
|
1271 |
return m_bssBasicMcsSet[i]; |
|
1272 |
} |
|
1273 |
||
6065 | 1274 |
WifiMode |
1275 |
WifiRemoteStationManager::GetNonUnicastMode (void) const |
|
1276 |
{ |
|
1277 |
if (m_nonUnicastMode == WifiMode ()) |
|
2349
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
1278 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
1279 |
return GetBasicMode (0); |
6065 | 1280 |
} |
1281 |
else |
|
1282 |
{ |
|
1283 |
return m_nonUnicastMode; |
|
2349
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
1284 |
} |
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
1285 |
} |
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
1286 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
1287 |
bool |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
1288 |
WifiRemoteStationManager::DoNeedRts (WifiRemoteStation *station, |
6065 | 1289 |
Ptr<const Packet> packet, bool normally) |
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
1290 |
{ |
6065 | 1291 |
return normally; |
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
1292 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
1293 |
bool |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
1294 |
WifiRemoteStationManager::DoNeedRtsRetransmission (WifiRemoteStation *station, |
6065 | 1295 |
Ptr<const Packet> packet, bool normally) |
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
1296 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
1297 |
return normally; |
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
1298 |
} |
6065 | 1299 |
bool |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
1300 |
WifiRemoteStationManager::DoNeedDataRetransmission (WifiRemoteStation *station, |
6065 | 1301 |
Ptr<const Packet> packet, bool normally) |
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
1302 |
{ |
6065 | 1303 |
return normally; |
1304 |
} |
|
1305 |
bool |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
1306 |
WifiRemoteStationManager::DoNeedFragmentation (WifiRemoteStation *station, |
6065 | 1307 |
Ptr<const Packet> packet, bool normally) |
1308 |
{ |
|
1309 |
return normally; |
|
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
1310 |
} |
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
1311 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
1312 |
WifiMode |
6065 | 1313 |
WifiRemoteStationManager::GetSupported (const WifiRemoteStation *station, uint32_t i) const |
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
1314 |
{ |
6065 | 1315 |
NS_ASSERT (i < GetNSupported (station)); |
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
1316 |
return station->m_state->m_operationalRateSet[i]; |
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
1317 |
} |
10139 | 1318 |
uint8_t |
1319 |
WifiRemoteStationManager::GetMcsSupported (const WifiRemoteStation *station, uint32_t i) const |
|
1320 |
{ |
|
1321 |
NS_ASSERT (i < GetNMcsSupported (station)); |
|
1322 |
return station->m_state->m_operationalMcsSet[i]; |
|
1323 |
} |
|
1324 |
bool |
|
1325 |
WifiRemoteStationManager::GetShortGuardInterval (const WifiRemoteStation *station) const |
|
1326 |
{ |
|
1327 |
return station->m_state->m_shortGuardInterval; |
|
1328 |
} |
|
1329 |
bool |
|
1330 |
WifiRemoteStationManager::GetGreenfield (const WifiRemoteStation *station) const |
|
1331 |
{ |
|
1332 |
return station->m_state->m_greenfield; |
|
1333 |
} |
|
1334 |
bool |
|
1335 |
WifiRemoteStationManager::GetStbc (const WifiRemoteStation *station) const |
|
1336 |
{ |
|
1337 |
return station->m_state->m_stbc; |
|
1338 |
} |
|
1339 |
uint32_t |
|
1340 |
WifiRemoteStationManager::GetNumberOfReceiveAntennas (const WifiRemoteStation *station) const |
|
1341 |
{ |
|
1342 |
return station->m_state->m_rx; |
|
1343 |
} |
|
1344 |
uint32_t |
|
1345 |
WifiRemoteStationManager::GetNumberOfTransmitAntennas (const WifiRemoteStation *station) const |
|
1346 |
{ |
|
1347 |
return station->m_state->m_tx; |
|
1348 |
} |
|
1349 |
uint32_t |
|
1350 |
WifiRemoteStationManager::GetShortRetryCount (const WifiRemoteStation *station) const |
|
1351 |
{ |
|
1352 |
return station->m_ssrc; |
|
1353 |
} |
|
1354 |
uint32_t |
|
1355 |
WifiRemoteStationManager::GetLongRetryCount (const WifiRemoteStation *station) const |
|
1356 |
{ |
|
1357 |
return station->m_slrc; |
|
1358 |
} |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
1359 |
uint32_t |
6065 | 1360 |
WifiRemoteStationManager::GetNSupported (const WifiRemoteStation *station) const |
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
1361 |
{ |
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
1362 |
return station->m_state->m_operationalRateSet.size (); |
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
1363 |
} |
10139 | 1364 |
uint32_t |
1365 |
WifiRemoteStationManager::GetNMcsSupported (const WifiRemoteStation *station) const |
|
1366 |
{ |
|
1367 |
return station->m_state->m_operationalMcsSet.size (); |
|
1368 |
} |
|
1369 |
void |
|
1370 |
WifiRemoteStationManager::SetDefaultTxPowerLevel (uint8_t txPower) |
|
1371 |
{ |
|
1372 |
m_defaultTxPowerLevel = txPower; |
|
1373 |
} |
|
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
1374 |
|
10139 | 1375 |
//support 11n |
1376 |
uint32_t |
|
1377 |
WifiRemoteStationManager::GetNumberOfTransmitAntennas (void) |
|
1378 |
{ |
|
1379 |
return m_wifiPhy->GetNumberOfTransmitAntennas(); |
|
1380 |
} |
|
6069
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
1381 |
//WifiRemoteStationInfo constructor |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
1382 |
WifiRemoteStationInfo::WifiRemoteStationInfo () |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
1383 |
: m_memoryTime (Seconds (1.0)), |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
1384 |
m_lastUpdate (Seconds (0.0)), |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
1385 |
m_failAvg (0.0) |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
1386 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
1387 |
} |
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
1388 |
|
6069
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
1389 |
double |
6070 | 1390 |
WifiRemoteStationInfo::CalculateAveragingCoefficient () |
6069
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
1391 |
{ |
9063
32755d0516f4
Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents:
7704
diff
changeset
|
1392 |
double retval = std::exp ((double)(m_lastUpdate.GetMicroSeconds () - Simulator::Now ().GetMicroSeconds ()) |
32755d0516f4
Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents:
7704
diff
changeset
|
1393 |
/ (double)m_memoryTime.GetMicroSeconds ()); |
6069
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
1394 |
m_lastUpdate = Simulator::Now (); |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
1395 |
return retval; |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
1396 |
} |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
1397 |
|
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
1398 |
void |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
1399 |
WifiRemoteStationInfo::NotifyTxSuccess (uint32_t retryCounter) |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
1400 |
{ |
6071
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
1401 |
double coefficient = CalculateAveragingCoefficient (); |
6069
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
1402 |
m_failAvg = (double)retryCounter / (1 + (double) retryCounter) * (1.0 - coefficient) + coefficient * m_failAvg; |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
1403 |
} |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
1404 |
|
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
1405 |
void |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
1406 |
WifiRemoteStationInfo::NotifyTxFailed () |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
1407 |
{ |
6071
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
1408 |
double coefficient = CalculateAveragingCoefficient (); |
6069
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
1409 |
m_failAvg = (1.0 - coefficient) + coefficient * m_failAvg; |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
1410 |
} |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
1411 |
|
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
1412 |
double |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
1413 |
WifiRemoteStationInfo::GetFrameErrorRate () const |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
1414 |
{ |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
1415 |
return m_failAvg; |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
1416 |
} |
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
1417 |
} // namespace ns3 |