author | Dean Armstrong <deanarm@gmail.com> |
Wed, 23 Jun 2010 08:47:29 +0100 | |
changeset 6372 | 0fafd9716f44 |
parent 6360 | d8975477ff6a |
child 6473 | 86a4a149eb0f |
permissions | -rw-r--r-- |
1893
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
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 |
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
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" |
1980
3fa3bac40b5b
add asserts and some debug log
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1975
diff
changeset
|
32 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
33 |
NS_LOG_COMPONENT_DEFINE ("WifiRemoteStationManager"); |
1893
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
34 |
|
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
35 |
|
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
36 |
/*************************************************************** |
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
37 |
* Packet Mode Tagger |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
38 |
***************************************************************/ |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
39 |
|
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
40 |
namespace ns3 { |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
41 |
|
3040
e11e106c7c19
Mtag -> Tag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3038
diff
changeset
|
42 |
class TxModeTag : public Tag |
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
43 |
{ |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
44 |
public: |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
45 |
TxModeTag (); |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
46 |
TxModeTag (WifiMode rtsMode, WifiMode dataMode); |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
47 |
WifiMode GetRtsMode (void) const; |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
48 |
WifiMode GetDataMode (void) const; |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
49 |
|
3038
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
50 |
static TypeId GetTypeId (void); |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
51 |
virtual TypeId GetInstanceTypeId (void) const; |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
52 |
virtual uint32_t GetSerializedSize (void) const; |
3040
e11e106c7c19
Mtag -> Tag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3038
diff
changeset
|
53 |
virtual void Serialize (TagBuffer i) const; |
e11e106c7c19
Mtag -> Tag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3038
diff
changeset
|
54 |
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
|
55 |
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
|
56 |
private: |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
57 |
WifiMode m_rtsMode; |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
58 |
WifiMode m_dataMode; |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
59 |
}; |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
60 |
|
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
61 |
TxModeTag::TxModeTag () |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
62 |
{} |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
63 |
TxModeTag::TxModeTag (WifiMode rtsMode, WifiMode dataMode) |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
64 |
: m_rtsMode (rtsMode), |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
65 |
m_dataMode (dataMode) |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
66 |
{} |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
67 |
WifiMode |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
68 |
TxModeTag::GetRtsMode (void) const |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
69 |
{ |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
70 |
return m_rtsMode; |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
71 |
} |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
72 |
WifiMode |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
73 |
TxModeTag::GetDataMode (void) const |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
74 |
{ |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
75 |
return m_dataMode; |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
76 |
} |
3038
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
77 |
TypeId |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
78 |
TxModeTag::GetTypeId (void) |
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
79 |
{ |
3038
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
80 |
static TypeId tid = TypeId ("ns3::TxModeTag") |
3040
e11e106c7c19
Mtag -> Tag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3038
diff
changeset
|
81 |
.SetParent<Tag> () |
3038
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
82 |
.AddConstructor<TxModeTag> () |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
83 |
.AddAttribute ("RtsTxMode", |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
84 |
"Tx mode of rts to use later", |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
85 |
EmptyAttributeValue (), |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
86 |
MakeWifiModeAccessor (&TxModeTag::GetRtsMode), |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
87 |
MakeWifiModeChecker ()) |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
88 |
.AddAttribute ("DataTxMode", |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
89 |
"Tx mode of data to use later", |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
90 |
EmptyAttributeValue (), |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
91 |
MakeWifiModeAccessor (&TxModeTag::GetDataMode), |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
92 |
MakeWifiModeChecker ()) |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
93 |
; |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
94 |
return tid; |
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
95 |
} |
3038
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
96 |
TypeId |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
97 |
TxModeTag::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
|
98 |
{ |
3038
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
99 |
return GetTypeId (); |
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
100 |
} |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
101 |
uint32_t |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
102 |
TxModeTag::GetSerializedSize (void) const |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
103 |
{ |
3038
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
104 |
return sizeof (WifiMode) * 2; |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
105 |
} |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
106 |
void |
3040
e11e106c7c19
Mtag -> Tag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3038
diff
changeset
|
107 |
TxModeTag::Serialize (TagBuffer i) const |
3038
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
108 |
{ |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
109 |
i.Write ((uint8_t *)&m_rtsMode, sizeof (WifiMode)); |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
110 |
i.Write ((uint8_t *)&m_dataMode, sizeof (WifiMode)); |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
111 |
} |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
112 |
void |
3040
e11e106c7c19
Mtag -> Tag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3038
diff
changeset
|
113 |
TxModeTag::Deserialize (TagBuffer i) |
3038
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
114 |
{ |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
115 |
i.Read ((uint8_t *)&m_rtsMode, sizeof (WifiMode)); |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
116 |
i.Read ((uint8_t *)&m_dataMode, sizeof (WifiMode)); |
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
117 |
} |
3208
1a754d09c4ba
bug 200: Packet::PrintTags is not implemented.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3041
diff
changeset
|
118 |
void |
1a754d09c4ba
bug 200: Packet::PrintTags is not implemented.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3041
diff
changeset
|
119 |
TxModeTag::Print (std::ostream &os) const |
1a754d09c4ba
bug 200: Packet::PrintTags is not implemented.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3041
diff
changeset
|
120 |
{ |
1a754d09c4ba
bug 200: Packet::PrintTags is not implemented.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3041
diff
changeset
|
121 |
os << "Rts=" << m_rtsMode << ", Data=" << m_dataMode; |
1a754d09c4ba
bug 200: Packet::PrintTags is not implemented.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3041
diff
changeset
|
122 |
} |
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 |
} // namespace ns3 |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
125 |
|
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
126 |
|
6065 | 127 |
namespace ns3 { |
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
128 |
|
6065 | 129 |
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
|
130 |
|
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
131 |
TypeId |
6065 | 132 |
WifiRemoteStationManager::GetTypeId (void) |
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
133 |
{ |
6065 | 134 |
static TypeId tid = TypeId ("ns3::WifiRemoteStationManager") |
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
135 |
.SetParent<Object> () |
6065 | 136 |
.AddAttribute ("IsLowLatency", "If true, we attempt to modelize a so-called low-latency device: a device" |
137 |
" where decisions about tx parameters can be made on a per-packet basis and feedback about the" |
|
138 |
" transmission of each packet is obtained before sending the next. Otherwise, we modelize a " |
|
139 |
" high-latency device, that is a device where we cannot update our decision about tx parameters" |
|
140 |
" 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
|
141 |
BooleanValue (true), // this value is ignored because there is no setter |
6065 | 142 |
MakeBooleanAccessor (&WifiRemoteStationManager::IsLowLatency), |
143 |
MakeBooleanChecker ()) |
|
144 |
.AddAttribute ("MaxSsrc", "The maximum number of retransmission attempts for an RTS. This value" |
|
145 |
" will not have any effect on some rate control algorithms.", |
|
146 |
UintegerValue (7), |
|
147 |
MakeUintegerAccessor (&WifiRemoteStationManager::m_maxSsrc), |
|
148 |
MakeUintegerChecker<uint32_t> ()) |
|
149 |
.AddAttribute ("MaxSlrc", "The maximum number of retransmission attempts for a DATA packet. This value" |
|
150 |
" will not have any effect on some rate control algorithms.", |
|
151 |
UintegerValue (7), |
|
152 |
MakeUintegerAccessor (&WifiRemoteStationManager::m_maxSlrc), |
|
153 |
MakeUintegerChecker<uint32_t> ()) |
|
154 |
.AddAttribute ("RtsCtsThreshold", "If a data packet is bigger than this value, we use an RTS/CTS handshake" |
|
155 |
" before sending the data. This value will not have any effect on some rate control algorithms.", |
|
156 |
UintegerValue (1500), |
|
157 |
MakeUintegerAccessor (&WifiRemoteStationManager::m_rtsCtsThreshold), |
|
158 |
MakeUintegerChecker<uint32_t> ()) |
|
159 |
.AddAttribute ("FragmentationThreshold", "If a data packet is bigger than this value, we fragment it such that" |
|
160 |
" the size of the fragments are equal or smaller than this value. This value will not have any effect" |
|
161 |
" on some rate control algorithms.", |
|
162 |
UintegerValue (1500), |
|
163 |
MakeUintegerAccessor (&WifiRemoteStationManager::m_fragmentationThreshold), |
|
164 |
MakeUintegerChecker<uint32_t> ()) |
|
165 |
.AddAttribute ("NonUnicastMode", "Wifi mode used for non-unicast transmissions.", |
|
166 |
WifiModeValue (), |
|
167 |
MakeWifiModeAccessor (&WifiRemoteStationManager::m_nonUnicastMode), |
|
168 |
MakeWifiModeChecker ()) |
|
169 |
.AddTraceSource ("MacTxRtsFailed", |
|
170 |
"The transmission of a RTS by the MAC layer has failed", |
|
171 |
MakeTraceSourceAccessor (&WifiRemoteStationManager::m_macTxRtsFailed)) |
|
172 |
.AddTraceSource ("MacTxDataFailed", |
|
173 |
"The transmission of a data packet by the MAC layer has failed", |
|
174 |
MakeTraceSourceAccessor (&WifiRemoteStationManager::m_macTxDataFailed)) |
|
175 |
.AddTraceSource ("MacTxFinalRtsFailed", |
|
176 |
"The transmission of a RTS has exceeded the maximum number of attempts", |
|
177 |
MakeTraceSourceAccessor (&WifiRemoteStationManager::m_macTxFinalRtsFailed)) |
|
178 |
.AddTraceSource ("MacTxFinalDataFailed", |
|
179 |
"The transmission of a data packet has exceeded the maximum number of attempts", |
|
180 |
MakeTraceSourceAccessor (&WifiRemoteStationManager::m_macTxFinalDataFailed)) |
|
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
181 |
; |
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
182 |
return tid; |
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
183 |
} |
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
184 |
|
6065 | 185 |
WifiRemoteStationManager::WifiRemoteStationManager () |
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
186 |
{} |
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
187 |
|
6065 | 188 |
WifiRemoteStationManager::~WifiRemoteStationManager () |
189 |
{ |
|
190 |
} |
|
191 |
void |
|
192 |
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
|
193 |
{ |
6065 | 194 |
for (StationStates::const_iterator i = m_states.begin (); i != m_states.end (); i++) |
195 |
{ |
|
196 |
delete (*i); |
|
197 |
} |
|
198 |
m_states.clear (); |
|
199 |
for (Stations::const_iterator i = m_stations.begin (); i != m_stations.end (); i++) |
|
200 |
{ |
|
201 |
delete (*i); |
|
202 |
} |
|
203 |
m_stations.clear (); |
|
204 |
} |
|
205 |
void |
|
206 |
WifiRemoteStationManager::SetupPhy (Ptr<WifiPhy> phy) |
|
207 |
{ |
|
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
208 |
// 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
|
209 |
// 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
|
210 |
// 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
|
211 |
// 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
|
212 |
// acknowledgements. |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
213 |
m_wifiPhy = phy; |
6065 | 214 |
m_defaultTxMode = phy->GetMode (0); |
215 |
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
|
216 |
} |
335dc094e52a
support BRAND_NEW station in adhoc code. initialize the supported rates.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1989
diff
changeset
|
217 |
|
6065 | 218 |
uint32_t |
219 |
WifiRemoteStationManager::GetMaxSsrc (void) const |
|
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
220 |
{ |
6065 | 221 |
return m_maxSsrc; |
222 |
} |
|
223 |
uint32_t |
|
224 |
WifiRemoteStationManager::GetMaxSlrc (void) const |
|
225 |
{ |
|
226 |
return m_maxSlrc; |
|
227 |
} |
|
228 |
uint32_t |
|
229 |
WifiRemoteStationManager::GetRtsCtsThreshold (void) const |
|
230 |
{ |
|
231 |
return m_rtsCtsThreshold; |
|
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
232 |
} |
6065 | 233 |
uint32_t |
234 |
WifiRemoteStationManager::GetFragmentationThreshold (void) const |
|
235 |
{ |
|
236 |
return m_fragmentationThreshold; |
|
237 |
} |
|
238 |
void |
|
239 |
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
|
240 |
{ |
6065 | 241 |
m_maxSsrc = maxSsrc; |
242 |
} |
|
243 |
void |
|
244 |
WifiRemoteStationManager::SetMaxSlrc (uint32_t maxSlrc) |
|
245 |
{ |
|
246 |
m_maxSlrc = maxSlrc; |
|
247 |
} |
|
248 |
void |
|
249 |
WifiRemoteStationManager::SetRtsCtsThreshold (uint32_t threshold) |
|
250 |
{ |
|
251 |
m_rtsCtsThreshold = threshold; |
|
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
252 |
} |
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
253 |
void |
6065 | 254 |
WifiRemoteStationManager::SetFragmentationThreshold (uint32_t threshold) |
255 |
{ |
|
256 |
m_fragmentationThreshold = threshold; |
|
257 |
} |
|
258 |
||
259 |
void |
|
260 |
WifiRemoteStationManager::Reset (Mac48Address address) |
|
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
261 |
{ |
6065 | 262 |
NS_ASSERT (!address.IsGroup ()); |
263 |
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
|
264 |
state->m_operationalRateSet.clear (); |
6065 | 265 |
AddSupportedMode (address, GetDefaultMode ()); |
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
266 |
} |
6065 | 267 |
void |
268 |
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
|
269 |
{ |
6065 | 270 |
NS_ASSERT (!address.IsGroup ()); |
271 |
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
|
272 |
for (WifiModeListIterator i = state->m_operationalRateSet.begin (); i != state->m_operationalRateSet.end (); i++) |
6065 | 273 |
{ |
274 |
if ((*i) == mode) |
|
275 |
{ |
|
276 |
// already in. |
|
277 |
return; |
|
278 |
} |
|
279 |
} |
|
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
280 |
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
|
281 |
} |
6065 | 282 |
bool |
283 |
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
|
284 |
{ |
6065 | 285 |
if (address.IsGroup ()) |
286 |
{ |
|
287 |
return false; |
|
288 |
} |
|
289 |
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
|
290 |
} |
6065 | 291 |
bool |
292 |
WifiRemoteStationManager::IsAssociated (Mac48Address address) const |
|
293 |
{ |
|
294 |
if (address.IsGroup ()) |
|
295 |
{ |
|
296 |
return true; |
|
297 |
} |
|
298 |
return LookupState (address)->m_state == WifiRemoteStationState::GOT_ASSOC_TX_OK; |
|
299 |
} |
|
300 |
bool |
|
301 |
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
|
302 |
{ |
6065 | 303 |
if (address.IsGroup ()) |
304 |
{ |
|
305 |
return false; |
|
306 |
} |
|
307 |
return LookupState (address)->m_state == WifiRemoteStationState::WAIT_ASSOC_TX_OK; |
|
308 |
} |
|
309 |
void |
|
310 |
WifiRemoteStationManager::RecordWaitAssocTxOk (Mac48Address address) |
|
311 |
{ |
|
312 |
NS_ASSERT (!address.IsGroup ()); |
|
313 |
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
|
314 |
} |
6065 | 315 |
void |
316 |
WifiRemoteStationManager::RecordGotAssocTxOk (Mac48Address address) |
|
317 |
{ |
|
318 |
NS_ASSERT (!address.IsGroup ()); |
|
319 |
LookupState (address)->m_state = WifiRemoteStationState::GOT_ASSOC_TX_OK; |
|
320 |
} |
|
321 |
void |
|
322 |
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
|
323 |
{ |
6065 | 324 |
NS_ASSERT (!address.IsGroup ()); |
325 |
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
|
326 |
} |
6065 | 327 |
void |
328 |
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
|
329 |
{ |
6065 | 330 |
NS_ASSERT (!address.IsGroup ()); |
331 |
LookupState (address)->m_state = WifiRemoteStationState::DISASSOC; |
|
332 |
} |
|
333 |
void |
|
334 |
WifiRemoteStationManager::PrepareForQueue (Mac48Address address, const WifiMacHeader *header, |
|
335 |
Ptr<const Packet> packet, uint32_t fullPacketSize) |
|
336 |
{ |
|
337 |
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
|
338 |
{ |
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
339 |
return; |
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
340 |
} |
6241
d9a65be745f0
Bug 802 - Minstrel, Onoe and Amrr not working
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6087
diff
changeset
|
341 |
WifiRemoteStation *station = Lookup (address, header); |
d9a65be745f0
Bug 802 - Minstrel, Onoe and Amrr not working
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6087
diff
changeset
|
342 |
WifiMode rts = DoGetRtsMode (station); |
d9a65be745f0
Bug 802 - Minstrel, Onoe and Amrr not working
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6087
diff
changeset
|
343 |
WifiMode data = DoGetDataMode (station, fullPacketSize); |
d9a65be745f0
Bug 802 - Minstrel, Onoe and Amrr not working
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6087
diff
changeset
|
344 |
TxModeTag tag; |
d9a65be745f0
Bug 802 - Minstrel, Onoe and Amrr not working
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6087
diff
changeset
|
345 |
// first, make sure that the tag is not here anymore. |
d9a65be745f0
Bug 802 - Minstrel, Onoe and Amrr not working
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6087
diff
changeset
|
346 |
ConstCast<Packet> (packet)->RemovePacketTag (tag); |
d9a65be745f0
Bug 802 - Minstrel, Onoe and Amrr not working
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6087
diff
changeset
|
347 |
tag = TxModeTag (rts, data); |
d9a65be745f0
Bug 802 - Minstrel, Onoe and Amrr not working
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6087
diff
changeset
|
348 |
// and then, add it back |
6065 | 349 |
packet->AddPacketTag (tag); |
350 |
} |
|
351 |
WifiMode |
|
352 |
WifiRemoteStationManager::GetDataMode (Mac48Address address, const WifiMacHeader *header, |
|
353 |
Ptr<const Packet> packet, uint32_t fullPacketSize) |
|
354 |
{ |
|
355 |
if (address.IsGroup ()) |
|
356 |
{ |
|
357 |
return GetNonUnicastMode (); |
|
358 |
} |
|
359 |
if (!IsLowLatency ()) |
|
360 |
{ |
|
361 |
TxModeTag tag; |
|
362 |
bool found; |
|
6241
d9a65be745f0
Bug 802 - Minstrel, Onoe and Amrr not working
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6087
diff
changeset
|
363 |
found = ConstCast<Packet> (packet)->PeekPacketTag (tag); |
6065 | 364 |
NS_ASSERT (found); |
365 |
return tag.GetDataMode (); |
|
366 |
} |
|
367 |
return DoGetDataMode (Lookup (address, header), fullPacketSize); |
|
368 |
} |
|
369 |
WifiMode |
|
370 |
WifiRemoteStationManager::GetRtsMode (Mac48Address address, const WifiMacHeader *header, |
|
371 |
Ptr<const Packet> packet) |
|
372 |
{ |
|
373 |
NS_ASSERT (!address.IsGroup ()); |
|
374 |
if (!IsLowLatency ()) |
|
375 |
{ |
|
376 |
TxModeTag tag; |
|
377 |
bool found; |
|
6241
d9a65be745f0
Bug 802 - Minstrel, Onoe and Amrr not working
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6087
diff
changeset
|
378 |
found = ConstCast<Packet> (packet)->PeekPacketTag (tag); |
6065 | 379 |
NS_ASSERT (found); |
380 |
return tag.GetRtsMode (); |
|
381 |
} |
|
382 |
return DoGetRtsMode (Lookup (address, header)); |
|
383 |
} |
|
384 |
void |
|
385 |
WifiRemoteStationManager::ReportRtsFailed (Mac48Address address, const WifiMacHeader *header) |
|
386 |
{ |
|
387 |
NS_ASSERT (!address.IsGroup ()); |
|
388 |
WifiRemoteStation *station = Lookup (address, header); |
|
389 |
station->m_ssrc++; |
|
390 |
m_macTxRtsFailed (address); |
|
391 |
DoReportRtsFailed (station); |
|
392 |
} |
|
393 |
void |
|
394 |
WifiRemoteStationManager::ReportDataFailed (Mac48Address address, const WifiMacHeader *header) |
|
395 |
{ |
|
396 |
NS_ASSERT (!address.IsGroup ()); |
|
397 |
WifiRemoteStation *station = Lookup (address, header); |
|
398 |
station->m_slrc++; |
|
399 |
m_macTxDataFailed (address); |
|
400 |
DoReportDataFailed (station); |
|
401 |
} |
|
402 |
void |
|
403 |
WifiRemoteStationManager::ReportRtsOk (Mac48Address address, const WifiMacHeader *header, |
|
404 |
double ctsSnr, WifiMode ctsMode, double rtsSnr) |
|
405 |
{ |
|
406 |
NS_ASSERT (!address.IsGroup ()); |
|
407 |
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
|
408 |
station->m_state->m_info.NotifyTxSuccess (station->m_ssrc); |
6065 | 409 |
station->m_ssrc = 0; |
410 |
DoReportRtsOk (station, ctsSnr, ctsMode, rtsSnr); |
|
411 |
} |
|
412 |
void |
|
413 |
WifiRemoteStationManager::ReportDataOk (Mac48Address address, const WifiMacHeader *header, |
|
414 |
double ackSnr, WifiMode ackMode, double dataSnr) |
|
415 |
{ |
|
416 |
NS_ASSERT (!address.IsGroup ()); |
|
417 |
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
|
418 |
station->m_state->m_info.NotifyTxSuccess (station->m_slrc); |
6065 | 419 |
station->m_slrc = 0; |
420 |
DoReportDataOk (station, ackSnr, ackMode, dataSnr); |
|
421 |
} |
|
422 |
void |
|
423 |
WifiRemoteStationManager::ReportFinalRtsFailed (Mac48Address address, const WifiMacHeader *header) |
|
424 |
{ |
|
425 |
NS_ASSERT (!address.IsGroup ()); |
|
426 |
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
|
427 |
station->m_state->m_info.NotifyTxFailed (); |
6065 | 428 |
station->m_ssrc = 0; |
429 |
m_macTxFinalRtsFailed (address); |
|
430 |
DoReportFinalRtsFailed (station); |
|
431 |
} |
|
432 |
void |
|
433 |
WifiRemoteStationManager::ReportFinalDataFailed (Mac48Address address, const WifiMacHeader *header) |
|
434 |
{ |
|
435 |
NS_ASSERT (!address.IsGroup ()); |
|
436 |
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
|
437 |
station->m_state->m_info.NotifyTxFailed (); |
6065 | 438 |
station->m_slrc = 0; |
439 |
m_macTxFinalDataFailed (address); |
|
440 |
DoReportFinalDataFailed (station); |
|
441 |
} |
|
442 |
void |
|
443 |
WifiRemoteStationManager::ReportRxOk (Mac48Address address, const WifiMacHeader *header, |
|
444 |
double rxSnr, WifiMode txMode) |
|
445 |
{ |
|
446 |
if (address.IsGroup ()) |
|
447 |
{ |
|
448 |
return; |
|
449 |
} |
|
450 |
WifiRemoteStation *station = Lookup (address, header); |
|
451 |
DoReportRxOk (station, rxSnr, txMode); |
|
452 |
} |
|
453 |
bool |
|
454 |
WifiRemoteStationManager::NeedRts (Mac48Address address, const WifiMacHeader *header, |
|
455 |
Ptr<const Packet> packet) |
|
456 |
{ |
|
457 |
if (address.IsGroup ()) |
|
458 |
{ |
|
459 |
return false; |
|
460 |
} |
|
461 |
bool normally = packet->GetSize () > GetRtsCtsThreshold (); |
|
462 |
return DoNeedRts (Lookup (address, header), packet, normally); |
|
463 |
} |
|
464 |
bool |
|
465 |
WifiRemoteStationManager::NeedRtsRetransmission (Mac48Address address, const WifiMacHeader *header, |
|
466 |
Ptr<const Packet> packet) |
|
467 |
{ |
|
468 |
NS_ASSERT (!address.IsGroup ()); |
|
469 |
WifiRemoteStation *station = Lookup (address, header); |
|
470 |
bool normally = station->m_ssrc < GetMaxSsrc (); |
|
471 |
return DoNeedRtsRetransmission (station, packet, normally); |
|
472 |
} |
|
473 |
bool |
|
474 |
WifiRemoteStationManager::NeedDataRetransmission (Mac48Address address, const WifiMacHeader *header, |
|
475 |
Ptr<const Packet> packet) |
|
476 |
{ |
|
477 |
NS_ASSERT (!address.IsGroup ()); |
|
478 |
WifiRemoteStation *station = Lookup (address, header); |
|
479 |
bool normally = station->m_slrc < GetMaxSlrc (); |
|
480 |
return DoNeedDataRetransmission (station, packet, normally); |
|
481 |
} |
|
482 |
bool |
|
483 |
WifiRemoteStationManager::NeedFragmentation (Mac48Address address, const WifiMacHeader *header, |
|
484 |
Ptr<const Packet> packet) |
|
485 |
{ |
|
486 |
if (address.IsGroup ()) |
|
487 |
{ |
|
488 |
return false; |
|
489 |
} |
|
490 |
WifiRemoteStation *station = Lookup (address, header); |
|
491 |
bool normally = packet->GetSize () > GetFragmentationThreshold (); |
|
492 |
return DoNeedFragmentation (station, packet, normally); |
|
493 |
} |
|
494 |
uint32_t |
|
495 |
WifiRemoteStationManager::GetNFragments (Ptr<const Packet> packet) |
|
496 |
{ |
|
497 |
uint32_t nFragments = packet->GetSize () / GetFragmentationThreshold () + 1; |
|
498 |
return nFragments; |
|
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
499 |
} |
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
500 |
|
6065 | 501 |
uint32_t |
502 |
WifiRemoteStationManager::GetFragmentSize (Mac48Address address, const WifiMacHeader *header, |
|
503 |
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
|
504 |
{ |
6065 | 505 |
NS_ASSERT (!address.IsGroup ()); |
506 |
uint32_t nFragment = GetNFragments (packet); |
|
507 |
if (fragmentNumber >= nFragment) |
|
508 |
{ |
|
509 |
return 0; |
|
510 |
} |
|
511 |
if (fragmentNumber == nFragment - 1) |
|
512 |
{ |
|
513 |
uint32_t lastFragmentSize = packet->GetSize () % GetFragmentationThreshold (); |
|
514 |
return lastFragmentSize; |
|
515 |
} |
|
516 |
else |
|
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
517 |
{ |
6065 | 518 |
return GetFragmentationThreshold (); |
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
519 |
} |
6065 | 520 |
} |
521 |
uint32_t |
|
522 |
WifiRemoteStationManager::GetFragmentOffset (Mac48Address address, const WifiMacHeader *header, |
|
523 |
Ptr<const Packet> packet, uint32_t fragmentNumber) |
|
524 |
{ |
|
525 |
NS_ASSERT (!address.IsGroup ()); |
|
526 |
NS_ASSERT (fragmentNumber < GetNFragments (packet)); |
|
527 |
uint32_t fragmentOffset = fragmentNumber * GetFragmentationThreshold (); |
|
528 |
return fragmentOffset; |
|
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
529 |
} |
6065 | 530 |
bool |
531 |
WifiRemoteStationManager::IsLastFragment (Mac48Address address, const WifiMacHeader *header, |
|
532 |
Ptr<const Packet> packet, uint32_t fragmentNumber) |
|
533 |
{ |
|
534 |
NS_ASSERT (!address.IsGroup ()); |
|
535 |
bool isLast = fragmentNumber == (GetNFragments (packet) - 1); |
|
536 |
return isLast; |
|
537 |
} |
|
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
538 |
WifiMode |
6065 | 539 |
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
|
540 |
{ |
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
541 |
/** |
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
542 |
* 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
|
543 |
* 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
|
544 |
* Section 9.6): |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
545 |
* |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
546 |
* 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
|
547 |
* 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
|
548 |
* 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
|
549 |
* 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
|
550 |
* 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
|
551 |
* 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
|
552 |
* 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
|
553 |
* 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
|
554 |
*/ |
6065 | 555 |
WifiMode mode = GetDefaultMode (); |
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
556 |
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
|
557 |
|
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
558 |
// 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
|
559 |
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
|
560 |
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
|
561 |
{ |
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
562 |
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
|
563 |
&& i->GetPhyRate () <= reqMode.GetPhyRate () |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
564 |
&& 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
|
565 |
{ |
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
|
566 |
mode = *i; |
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
567 |
// 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
|
568 |
// 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
|
569 |
// 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
|
570 |
found = true; |
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
571 |
} |
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
572 |
} |
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
573 |
|
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
574 |
// 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
|
575 |
// 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
|
576 |
if (found) |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
577 |
{ |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
578 |
return mode; |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
579 |
} |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
580 |
|
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
581 |
/** |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
582 |
* 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
|
583 |
* 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
|
584 |
* |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
585 |
* ...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
|
586 |
* 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
|
587 |
* 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
|
588 |
* 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
|
589 |
* 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
|
590 |
* 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
|
591 |
* 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
|
592 |
* 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
|
593 |
* BSSBasicRateSet parameter. |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
594 |
* |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
595 |
* TODO: Note that we're ignoring the last sentence for now, because |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
596 |
* 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
|
597 |
*/ |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
598 |
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
|
599 |
{ |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
600 |
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
|
601 |
|
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
602 |
/* If the rate: |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
603 |
* |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
604 |
* - 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
|
605 |
* - 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
|
606 |
* - 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
|
607 |
* - 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
|
608 |
* |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
609 |
* ...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
|
610 |
*/ |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
611 |
if (thismode.IsMandatory () |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
612 |
&& (!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
|
613 |
&& thismode.GetPhyRate () <= reqMode.GetPhyRate () |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
614 |
&& thismode.GetModulationClass () == reqMode.GetModulationClass ()) |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
615 |
{ |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
616 |
mode = thismode; |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
617 |
// 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
|
618 |
// 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
|
619 |
// 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
|
620 |
// one. |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
621 |
found = true; |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
622 |
} |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
623 |
} |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
624 |
|
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
625 |
/** |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
626 |
* 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
|
627 |
* 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
|
628 |
* 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
|
629 |
* 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
|
630 |
* WifiRemoteStationManager (or descendant) configuration. |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
631 |
* |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
632 |
* 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
|
633 |
* 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
|
634 |
*/ |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
635 |
if (!found) |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
636 |
{ |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
637 |
NS_FATAL_ERROR ("Can't find response rate for " << reqMode |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
638 |
<< ". Check standard and selected rates match."); |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
639 |
} |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
640 |
|
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
641 |
return mode; |
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
642 |
} |
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
643 |
|
6065 | 644 |
WifiMode |
645 |
WifiRemoteStationManager::GetCtsMode (Mac48Address address, WifiMode rtsMode) |
|
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
646 |
{ |
6065 | 647 |
NS_ASSERT (!address.IsGroup ()); |
648 |
return GetControlAnswerMode (address, rtsMode); |
|
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
649 |
} |
6065 | 650 |
WifiMode |
651 |
WifiRemoteStationManager::GetAckMode (Mac48Address address, WifiMode dataMode) |
|
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
652 |
{ |
6065 | 653 |
NS_ASSERT (!address.IsGroup ()); |
654 |
return GetControlAnswerMode (address, dataMode); |
|
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
655 |
} |
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
656 |
|
6071
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
657 |
WifiRemoteStationInfo |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
658 |
WifiRemoteStationManager::GetInfo (Mac48Address address) |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
659 |
{ |
6339 | 660 |
WifiRemoteStationState *state = LookupState (address); |
6071
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
661 |
return state->m_info; |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
662 |
} |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
663 |
|
6065 | 664 |
WifiRemoteStationState * |
665 |
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
|
666 |
{ |
6065 | 667 |
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
|
668 |
{ |
6065 | 669 |
if ((*i)->m_address == address) |
670 |
{ |
|
671 |
return (*i); |
|
672 |
} |
|
2349
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
673 |
} |
6065 | 674 |
WifiRemoteStationState *state = new WifiRemoteStationState (); |
675 |
state->m_state = WifiRemoteStationState::BRAND_NEW; |
|
676 |
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
|
677 |
state->m_operationalRateSet.push_back (GetDefaultMode ()); |
6067
ccbdc2b19ea5
add newly-created state to state list.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6065
diff
changeset
|
678 |
const_cast<WifiRemoteStationManager *> (this)->m_states.push_back (state); |
6065 | 679 |
return state; |
2349
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
680 |
} |
6065 | 681 |
WifiRemoteStation * |
682 |
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
|
683 |
{ |
6065 | 684 |
uint8_t tid; |
685 |
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
|
686 |
{ |
6065 | 687 |
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
|
688 |
} |
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
689 |
else |
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
690 |
{ |
6065 | 691 |
tid = 0; |
2349
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
692 |
} |
6065 | 693 |
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
|
694 |
} |
6065 | 695 |
WifiRemoteStation * |
696 |
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
|
697 |
{ |
6065 | 698 |
for (Stations::const_iterator i = m_stations.begin (); i != m_stations.end (); i++) |
699 |
{ |
|
700 |
if ((*i)->m_tid == tid && |
|
701 |
(*i)->m_state->m_address == address) |
|
702 |
{ |
|
703 |
return (*i); |
|
704 |
} |
|
705 |
} |
|
706 |
WifiRemoteStationState *state = LookupState (address); |
|
707 |
||
708 |
WifiRemoteStation *station = DoCreateStation (); |
|
709 |
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
|
710 |
station->m_tid = tid; |
6065 | 711 |
station->m_ssrc = 0; |
712 |
station->m_slrc = 0; |
|
713 |
// XXX |
|
714 |
const_cast<WifiRemoteStationManager *> (this)->m_stations.push_back (station); |
|
715 |
return station; |
|
716 |
||
3745
73e7bb607014
bug 372: fragmentation is broken
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3212
diff
changeset
|
717 |
} |
2349
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
718 |
|
6065 | 719 |
WifiMode |
720 |
WifiRemoteStationManager::GetDefaultMode (void) const |
|
721 |
{ |
|
722 |
return m_defaultTxMode; |
|
723 |
} |
|
724 |
void |
|
725 |
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
|
726 |
{ |
6065 | 727 |
for (Stations::const_iterator i = m_stations.begin (); i != m_stations.end (); i++) |
728 |
{ |
|
729 |
delete (*i); |
|
730 |
} |
|
731 |
m_stations.clear (); |
|
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
732 |
m_bssBasicRateSet.clear (); |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
733 |
m_bssBasicRateSet.push_back (m_defaultTxMode); |
6065 | 734 |
NS_ASSERT (m_defaultTxMode.IsMandatory ()); |
735 |
} |
|
736 |
void |
|
737 |
WifiRemoteStationManager::AddBasicMode (WifiMode mode) |
|
738 |
{ |
|
739 |
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
|
740 |
{ |
6065 | 741 |
if (GetBasicMode (i) == mode) |
742 |
{ |
|
743 |
return; |
|
744 |
} |
|
745 |
} |
|
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
746 |
m_bssBasicRateSet.push_back (mode); |
6065 | 747 |
} |
748 |
uint32_t |
|
749 |
WifiRemoteStationManager::GetNBasicModes (void) const |
|
750 |
{ |
|
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
751 |
return m_bssBasicRateSet.size (); |
6065 | 752 |
} |
753 |
WifiMode |
|
754 |
WifiRemoteStationManager::GetBasicMode (uint32_t i) const |
|
755 |
{ |
|
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
756 |
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
|
757 |
return m_bssBasicRateSet[i]; |
6065 | 758 |
} |
759 |
WifiMode |
|
760 |
WifiRemoteStationManager::GetNonUnicastMode (void) const |
|
761 |
{ |
|
762 |
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
|
763 |
{ |
6065 | 764 |
return GetBasicMode(0); |
765 |
} |
|
766 |
else |
|
767 |
{ |
|
768 |
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
|
769 |
} |
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
770 |
} |
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
771 |
|
6065 | 772 |
bool |
773 |
WifiRemoteStationManager::DoNeedRts (WifiRemoteStation *station, |
|
774 |
Ptr<const Packet> packet, bool normally) |
|
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
775 |
{ |
6065 | 776 |
return normally; |
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
777 |
} |
6065 | 778 |
bool |
779 |
WifiRemoteStationManager::DoNeedRtsRetransmission (WifiRemoteStation *station, |
|
780 |
Ptr<const Packet> packet, bool normally) |
|
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
781 |
{ |
6065 | 782 |
return normally; |
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
783 |
} |
6065 | 784 |
bool |
785 |
WifiRemoteStationManager::DoNeedDataRetransmission (WifiRemoteStation *station, |
|
786 |
Ptr<const Packet> packet, bool normally) |
|
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
787 |
{ |
6065 | 788 |
return normally; |
789 |
} |
|
790 |
bool |
|
791 |
WifiRemoteStationManager::DoNeedFragmentation (WifiRemoteStation *station, |
|
792 |
Ptr<const Packet> packet, bool normally) |
|
793 |
{ |
|
794 |
return normally; |
|
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
795 |
} |
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
796 |
|
6065 | 797 |
WifiMode |
798 |
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
|
799 |
{ |
6065 | 800 |
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
|
801 |
return station->m_state->m_operationalRateSet[i]; |
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
802 |
} |
6065 | 803 |
uint32_t |
804 |
WifiRemoteStationManager::GetNSupported (const WifiRemoteStation *station) const |
|
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
805 |
{ |
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
806 |
return station->m_state->m_operationalRateSet.size (); |
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
807 |
} |
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
808 |
|
6069
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
809 |
//WifiRemoteStationInfo constructor |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
810 |
WifiRemoteStationInfo::WifiRemoteStationInfo () : |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
811 |
m_memoryTime (Seconds (1.0)), |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
812 |
m_lastUpdate (Seconds (0.0)), |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
813 |
m_failAvg (0.0) |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
814 |
{} |
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
815 |
|
6069
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
816 |
double |
6070 | 817 |
WifiRemoteStationInfo::CalculateAveragingCoefficient () |
6069
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
818 |
{ |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
819 |
double retval = exp((double) |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
820 |
(m_lastUpdate.GetMicroSeconds () - Simulator::Now ().GetMicroSeconds()) / (double)m_memoryTime.GetMicroSeconds () |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
821 |
); |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
822 |
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
|
823 |
return retval; |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
824 |
} |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
825 |
|
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
826 |
void |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
827 |
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
|
828 |
{ |
6071
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
829 |
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
|
830 |
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
|
831 |
} |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
832 |
|
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
833 |
void |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
834 |
WifiRemoteStationInfo::NotifyTxFailed () |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
835 |
{ |
6071
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
836 |
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
|
837 |
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
|
838 |
} |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
839 |
|
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
840 |
double |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
841 |
WifiRemoteStationInfo::GetFrameErrorRate () const |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
842 |
{ |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
843 |
return m_failAvg; |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
844 |
} |
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
845 |
} // namespace ns3 |