author | Daniel Lertpratchya <nikkipui@gmail.com> |
Sun, 19 Jan 2014 12:08:50 -0500 | |
changeset 10580 | 2a29a9bd6fd6 |
parent 10507 | 2081aa152526 |
child 10883 | d919e7194e23 |
permissions | -rw-r--r-- |
7385
10beb0e53130
standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents:
7141
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
4325
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4217
diff
changeset
|
2 |
/* |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4217
diff
changeset
|
3 |
* Copyright (c) 2005,2006 INRIA |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4217
diff
changeset
|
4 |
* |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4217
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:
7061
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
4325
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4217
diff
changeset
|
7 |
* published by the Free Software Foundation; |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4217
diff
changeset
|
8 |
* |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4217
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4217
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4217
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4217
diff
changeset
|
12 |
* GNU General Public License for more details. |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4217
diff
changeset
|
13 |
* |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4217
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4217
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4217
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4217
diff
changeset
|
17 |
* |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4217
diff
changeset
|
18 |
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4217
diff
changeset
|
19 |
*/ |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
20 |
|
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
21 |
#include "ns3/assert.h" |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
22 |
#include "ns3/log.h" |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
23 |
#include "ns3/simulator.h" |
9063
32755d0516f4
Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents:
7385
diff
changeset
|
24 |
#include <cmath> |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
25 |
|
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
26 |
#include "dcf-manager.h" |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
27 |
#include "wifi-phy.h" |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
28 |
#include "wifi-mac.h" |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
29 |
#include "mac-low.h" |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
30 |
|
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
31 |
NS_LOG_COMPONENT_DEFINE ("DcfManager"); |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
32 |
|
2107
9adb9e6d7bc7
improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2105
diff
changeset
|
33 |
#define MY_DEBUG(x) \ |
2140
acfd79fc8d65
debugging output is more verbose.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2130
diff
changeset
|
34 |
NS_LOG_DEBUG (Simulator::Now () << " " << this << " " << x) |
2107
9adb9e6d7bc7
improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2105
diff
changeset
|
35 |
|
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
36 |
namespace ns3 { |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
37 |
|
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
38 |
/**************************************************************** |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
39 |
* Implement the DCF state holder |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
40 |
****************************************************************/ |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
41 |
|
2100
1b8cc486edd9
initialize more state variables
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2099
diff
changeset
|
42 |
DcfState::DcfState () |
1b8cc486edd9
initialize more state variables
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2099
diff
changeset
|
43 |
: m_backoffSlots (0), |
2145
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2144
diff
changeset
|
44 |
m_backoffStart (Seconds (0.0)), |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
45 |
m_cwMin (0), |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
46 |
m_cwMax (0), |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
47 |
m_cw (0), |
2145
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2144
diff
changeset
|
48 |
m_accessRequested (false) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
49 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
50 |
} |
2100
1b8cc486edd9
initialize more state variables
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2099
diff
changeset
|
51 |
|
2096 | 52 |
DcfState::~DcfState () |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
53 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
54 |
} |
2096 | 55 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
56 |
void |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
57 |
DcfState::SetAifsn (uint32_t aifsn) |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
58 |
{ |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
59 |
m_aifsn = aifsn; |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
60 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
61 |
void |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
62 |
DcfState::SetCwMin (uint32_t minCw) |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
63 |
{ |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
64 |
m_cwMin = minCw; |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
65 |
ResetCw (); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
66 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
67 |
void |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
68 |
DcfState::SetCwMax (uint32_t maxCw) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
69 |
{ |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
70 |
m_cwMax = maxCw; |
2100
1b8cc486edd9
initialize more state variables
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2099
diff
changeset
|
71 |
ResetCw (); |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
72 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
73 |
uint32_t |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
74 |
DcfState::GetAifsn (void) const |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
75 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
76 |
return m_aifsn; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
77 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
78 |
uint32_t |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
79 |
DcfState::GetCwMin (void) const |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
80 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
81 |
return m_cwMin; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
82 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
83 |
uint32_t |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
84 |
DcfState::GetCwMax (void) const |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
85 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
86 |
return m_cwMax; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
87 |
} |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
88 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
89 |
void |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
90 |
DcfState::ResetCw (void) |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
91 |
{ |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
92 |
m_cw = m_cwMin; |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
93 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
94 |
void |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
95 |
DcfState::UpdateFailedCw (void) |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
96 |
{ |
10580
2a29a9bd6fd6
Update (most of) IEEE Std 802.11-2007 to IEEE Std 802.11-2012
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10507
diff
changeset
|
97 |
// see 802.11-2012, section 9.19.2.5 |
4217
9494663cf1c9
bug 509: backoff CW growth is invalid
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3905
diff
changeset
|
98 |
m_cw = std::min ( 2 * (m_cw + 1) - 1, m_cwMax); |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
99 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
100 |
void |
2122
ee136bc4f214
keep track of the last time a backoff was updated.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2120
diff
changeset
|
101 |
DcfState::UpdateBackoffSlotsNow (uint32_t nSlots, Time backoffUpdateBound) |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
102 |
{ |
2142
63c08450a4da
avoid decrementing by too many backoff slots
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2140
diff
changeset
|
103 |
m_backoffSlots -= nSlots; |
2122
ee136bc4f214
keep track of the last time a backoff was updated.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2120
diff
changeset
|
104 |
m_backoffStart = backoffUpdateBound; |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
105 |
MY_DEBUG ("update slots=" << nSlots << " slots, backoff=" << m_backoffSlots); |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
106 |
} |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
107 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
108 |
void |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
109 |
DcfState::StartBackoffNow (uint32_t nSlots) |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
110 |
{ |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
111 |
NS_ASSERT (m_backoffSlots == 0); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
112 |
MY_DEBUG ("start backoff=" << nSlots << " slots"); |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
113 |
m_backoffSlots = nSlots; |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
114 |
m_backoffStart = Simulator::Now (); |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
115 |
} |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
116 |
|
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
117 |
uint32_t |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
118 |
DcfState::GetCw (void) const |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
119 |
{ |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
120 |
return m_cw; |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
121 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
122 |
uint32_t |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
123 |
DcfState::GetBackoffSlots (void) const |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
124 |
{ |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
125 |
return m_backoffSlots; |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
126 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
127 |
Time |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
128 |
DcfState::GetBackoffStart (void) const |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
129 |
{ |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
130 |
return m_backoffStart; |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
131 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
132 |
bool |
2145
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2144
diff
changeset
|
133 |
DcfState::IsAccessRequested (void) const |
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2144
diff
changeset
|
134 |
{ |
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2144
diff
changeset
|
135 |
return m_accessRequested; |
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2144
diff
changeset
|
136 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
137 |
void |
2145
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2144
diff
changeset
|
138 |
DcfState::NotifyAccessRequested (void) |
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2144
diff
changeset
|
139 |
{ |
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2144
diff
changeset
|
140 |
m_accessRequested = true; |
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2144
diff
changeset
|
141 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
142 |
void |
2145
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2144
diff
changeset
|
143 |
DcfState::NotifyAccessGranted (void) |
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2144
diff
changeset
|
144 |
{ |
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2144
diff
changeset
|
145 |
NS_ASSERT (m_accessRequested); |
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2144
diff
changeset
|
146 |
m_accessRequested = false; |
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2144
diff
changeset
|
147 |
DoNotifyAccessGranted (); |
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2144
diff
changeset
|
148 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
149 |
void |
2145
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2144
diff
changeset
|
150 |
DcfState::NotifyCollision (void) |
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2144
diff
changeset
|
151 |
{ |
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2144
diff
changeset
|
152 |
DoNotifyCollision (); |
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2144
diff
changeset
|
153 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
154 |
void |
2145
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2144
diff
changeset
|
155 |
DcfState::NotifyInternalCollision (void) |
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2144
diff
changeset
|
156 |
{ |
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2144
diff
changeset
|
157 |
DoNotifyInternalCollision (); |
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2144
diff
changeset
|
158 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
159 |
void |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
160 |
DcfState::NotifyChannelSwitching (void) |
5189 | 161 |
{ |
162 |
DoNotifyChannelSwitching (); |
|
163 |
} |
|
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
164 |
|
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
165 |
|
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10211
diff
changeset
|
166 |
/** |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10211
diff
changeset
|
167 |
* Listener for NAV events. Forwards to DcfManager |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10211
diff
changeset
|
168 |
*/ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
169 |
class LowDcfListener : public ns3::MacLowDcfListener |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
170 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
171 |
public: |
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10211
diff
changeset
|
172 |
/** |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10211
diff
changeset
|
173 |
* Create a LowDcfListener for the given DcfManager. |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10211
diff
changeset
|
174 |
* |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10211
diff
changeset
|
175 |
* \param dcf |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10211
diff
changeset
|
176 |
*/ |
4509
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
177 |
LowDcfListener (ns3::DcfManager *dcf) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
178 |
: m_dcf (dcf) |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
179 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
180 |
} |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
181 |
virtual ~LowDcfListener () |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
182 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
183 |
} |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
184 |
virtual void NavStart (Time duration) |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
185 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
186 |
m_dcf->NotifyNavStartNow (duration); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
187 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
188 |
virtual void NavReset (Time duration) |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
189 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
190 |
m_dcf->NotifyNavResetNow (duration); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
191 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
192 |
virtual void AckTimeoutStart (Time duration) |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
193 |
{ |
4509
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
194 |
m_dcf->NotifyAckTimeoutStartNow (duration); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
195 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
196 |
virtual void AckTimeoutReset () |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
197 |
{ |
4509
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
198 |
m_dcf->NotifyAckTimeoutResetNow (); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
199 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
200 |
virtual void CtsTimeoutStart (Time duration) |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
201 |
{ |
4509
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
202 |
m_dcf->NotifyCtsTimeoutStartNow (duration); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
203 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
204 |
virtual void CtsTimeoutReset () |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
205 |
{ |
4509
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
206 |
m_dcf->NotifyCtsTimeoutResetNow (); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
207 |
} |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
208 |
private: |
10507
2081aa152526
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10483
diff
changeset
|
209 |
ns3::DcfManager *m_dcf; //!< DcfManager to forward events to |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
210 |
}; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
211 |
|
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10211
diff
changeset
|
212 |
/** |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10211
diff
changeset
|
213 |
* Listener for PHY events. Forwards to DcfManager |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10211
diff
changeset
|
214 |
*/ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
215 |
class PhyListener : public ns3::WifiPhyListener |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
216 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
217 |
public: |
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10211
diff
changeset
|
218 |
/** |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10211
diff
changeset
|
219 |
* Create a PhyListener for the given DcfManager. |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10211
diff
changeset
|
220 |
* |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10211
diff
changeset
|
221 |
* \param dcf |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10211
diff
changeset
|
222 |
*/ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
223 |
PhyListener (ns3::DcfManager *dcf) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
224 |
: m_dcf (dcf) |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
225 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
226 |
} |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
227 |
virtual ~PhyListener () |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
228 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
229 |
} |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
230 |
virtual void NotifyRxStart (Time duration) |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
231 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
232 |
m_dcf->NotifyRxStartNow (duration); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
233 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
234 |
virtual void NotifyRxEndOk (void) |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
235 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
236 |
m_dcf->NotifyRxEndOkNow (); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
237 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
238 |
virtual void NotifyRxEndError (void) |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
239 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
240 |
m_dcf->NotifyRxEndErrorNow (); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
241 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
242 |
virtual void NotifyTxStart (Time duration) |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
243 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
244 |
m_dcf->NotifyTxStartNow (duration); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
245 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
246 |
virtual void NotifyMaybeCcaBusyStart (Time duration) |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
247 |
{ |
3905
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
248 |
m_dcf->NotifyMaybeCcaBusyStartNow (duration); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
249 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
250 |
virtual void NotifySwitchingStart (Time duration) |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
251 |
{ |
5189 | 252 |
m_dcf->NotifySwitchingStartNow (duration); |
253 |
} |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
254 |
private: |
10507
2081aa152526
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10483
diff
changeset
|
255 |
ns3::DcfManager *m_dcf; //!< DcfManager to forward events to |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
256 |
}; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
257 |
|
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
258 |
/**************************************************************** |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
259 |
* Implement the DCF manager of all DCF state holders |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
260 |
****************************************************************/ |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
261 |
|
2099
de25c6d81572
initialize state variables
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2096
diff
changeset
|
262 |
DcfManager::DcfManager () |
4509
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
263 |
: m_lastAckTimeoutEnd (MicroSeconds (0)), |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
264 |
m_lastCtsTimeoutEnd (MicroSeconds (0)), |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
265 |
m_lastNavStart (MicroSeconds (0)), |
2099
de25c6d81572
initialize state variables
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2096
diff
changeset
|
266 |
m_lastNavDuration (MicroSeconds (0)), |
de25c6d81572
initialize state variables
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2096
diff
changeset
|
267 |
m_lastRxStart (MicroSeconds (0)), |
de25c6d81572
initialize state variables
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2096
diff
changeset
|
268 |
m_lastRxDuration (MicroSeconds (0)), |
de25c6d81572
initialize state variables
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2096
diff
changeset
|
269 |
m_lastRxReceivedOk (true), |
de25c6d81572
initialize state variables
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2096
diff
changeset
|
270 |
m_lastRxEnd (MicroSeconds (0)), |
de25c6d81572
initialize state variables
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2096
diff
changeset
|
271 |
m_lastTxStart (MicroSeconds (0)), |
de25c6d81572
initialize state variables
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2096
diff
changeset
|
272 |
m_lastTxDuration (MicroSeconds (0)), |
de25c6d81572
initialize state variables
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2096
diff
changeset
|
273 |
m_lastBusyStart (MicroSeconds (0)), |
de25c6d81572
initialize state variables
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2096
diff
changeset
|
274 |
m_lastBusyDuration (MicroSeconds (0)), |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
275 |
m_lastSwitchingStart (MicroSeconds (0)), |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
276 |
m_lastSwitchingDuration (MicroSeconds (0)), |
2105
e883a100109a
get rid of MacParameters from DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2104
diff
changeset
|
277 |
m_rxing (false), |
5816
d3fdc15b065f
Bug 695 - DcfManager::UpdateBackoff () uses slow HighPrecision::Div()
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
5815
diff
changeset
|
278 |
m_slotTimeUs (0), |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
279 |
m_sifs (Seconds (0.0)), |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
280 |
m_phyListener (0), |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
281 |
m_lowListener (0) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
282 |
{ |
9711
7f4c6aa52b52
Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9063
diff
changeset
|
283 |
NS_LOG_FUNCTION (this); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
284 |
} |
2099
de25c6d81572
initialize state variables
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2096
diff
changeset
|
285 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
286 |
DcfManager::~DcfManager () |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
287 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
288 |
delete m_phyListener; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
289 |
delete m_lowListener; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
290 |
m_phyListener = 0; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
291 |
m_lowListener = 0; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
292 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
293 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
294 |
void |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
295 |
DcfManager::SetupPhyListener (Ptr<WifiPhy> phy) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
296 |
{ |
9711
7f4c6aa52b52
Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9063
diff
changeset
|
297 |
NS_LOG_FUNCTION (this << phy); |
10200
17e79c1772cd
avoid memory leak if called multiple times
Junling Bu <linlinjavaer@gmail.com>
parents:
9711
diff
changeset
|
298 |
if (m_phyListener != 0) |
17e79c1772cd
avoid memory leak if called multiple times
Junling Bu <linlinjavaer@gmail.com>
parents:
9711
diff
changeset
|
299 |
{ |
17e79c1772cd
avoid memory leak if called multiple times
Junling Bu <linlinjavaer@gmail.com>
parents:
9711
diff
changeset
|
300 |
delete m_phyListener; |
17e79c1772cd
avoid memory leak if called multiple times
Junling Bu <linlinjavaer@gmail.com>
parents:
9711
diff
changeset
|
301 |
} |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
302 |
m_phyListener = new PhyListener (this); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
303 |
phy->RegisterListener (m_phyListener); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
304 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
305 |
void |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
306 |
DcfManager::SetupLowListener (Ptr<MacLow> low) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
307 |
{ |
9711
7f4c6aa52b52
Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9063
diff
changeset
|
308 |
NS_LOG_FUNCTION (this << low); |
10200
17e79c1772cd
avoid memory leak if called multiple times
Junling Bu <linlinjavaer@gmail.com>
parents:
9711
diff
changeset
|
309 |
if (m_lowListener != 0) |
17e79c1772cd
avoid memory leak if called multiple times
Junling Bu <linlinjavaer@gmail.com>
parents:
9711
diff
changeset
|
310 |
{ |
17e79c1772cd
avoid memory leak if called multiple times
Junling Bu <linlinjavaer@gmail.com>
parents:
9711
diff
changeset
|
311 |
delete m_lowListener; |
17e79c1772cd
avoid memory leak if called multiple times
Junling Bu <linlinjavaer@gmail.com>
parents:
9711
diff
changeset
|
312 |
} |
4509
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
313 |
m_lowListener = new LowDcfListener (this); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
314 |
low->RegisterDcfListener (m_lowListener); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
315 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
316 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
317 |
void |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
318 |
DcfManager::SetSlot (Time slotTime) |
2096 | 319 |
{ |
9711
7f4c6aa52b52
Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9063
diff
changeset
|
320 |
NS_LOG_FUNCTION (this << slotTime); |
5816
d3fdc15b065f
Bug 695 - DcfManager::UpdateBackoff () uses slow HighPrecision::Div()
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
5815
diff
changeset
|
321 |
m_slotTimeUs = slotTime.GetMicroSeconds (); |
2105
e883a100109a
get rid of MacParameters from DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2104
diff
changeset
|
322 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
323 |
void |
2105
e883a100109a
get rid of MacParameters from DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2104
diff
changeset
|
324 |
DcfManager::SetSifs (Time sifs) |
e883a100109a
get rid of MacParameters from DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2104
diff
changeset
|
325 |
{ |
9711
7f4c6aa52b52
Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9063
diff
changeset
|
326 |
NS_LOG_FUNCTION (this << sifs); |
2105
e883a100109a
get rid of MacParameters from DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2104
diff
changeset
|
327 |
m_sifs = sifs; |
2096 | 328 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
329 |
void |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
330 |
DcfManager::SetEifsNoDifs (Time eifsNoDifs) |
2096 | 331 |
{ |
9711
7f4c6aa52b52
Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9063
diff
changeset
|
332 |
NS_LOG_FUNCTION (this << eifsNoDifs); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
333 |
m_eifsNoDifs = eifsNoDifs; |
2096 | 334 |
} |
4460
d7ad6e210086
move GetEifsNoDifs to DcfManager
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4325
diff
changeset
|
335 |
Time |
d7ad6e210086
move GetEifsNoDifs to DcfManager
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4325
diff
changeset
|
336 |
DcfManager::GetEifsNoDifs () const |
d7ad6e210086
move GetEifsNoDifs to DcfManager
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4325
diff
changeset
|
337 |
{ |
9711
7f4c6aa52b52
Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9063
diff
changeset
|
338 |
NS_LOG_FUNCTION (this); |
4460
d7ad6e210086
move GetEifsNoDifs to DcfManager
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4325
diff
changeset
|
339 |
return m_eifsNoDifs; |
d7ad6e210086
move GetEifsNoDifs to DcfManager
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4325
diff
changeset
|
340 |
} |
2096 | 341 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
342 |
void |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
343 |
DcfManager::Add (DcfState *dcf) |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
344 |
{ |
9711
7f4c6aa52b52
Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9063
diff
changeset
|
345 |
NS_LOG_FUNCTION (this << dcf); |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
346 |
m_states.push_back (dcf); |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
347 |
} |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
348 |
|
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
349 |
Time |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
350 |
DcfManager::MostRecent (Time a, Time b) const |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
351 |
{ |
9711
7f4c6aa52b52
Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9063
diff
changeset
|
352 |
NS_LOG_FUNCTION (this << a << b); |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
353 |
return Max (a, b); |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
354 |
} |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
355 |
Time |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
356 |
DcfManager::MostRecent (Time a, Time b, Time c) const |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
357 |
{ |
9711
7f4c6aa52b52
Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9063
diff
changeset
|
358 |
NS_LOG_FUNCTION (this << a << b << c); |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
359 |
Time retval; |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
360 |
retval = Max (a, b); |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
361 |
retval = Max (retval, c); |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
362 |
return retval; |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
363 |
} |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
364 |
Time |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
365 |
DcfManager::MostRecent (Time a, Time b, Time c, Time d) const |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
366 |
{ |
9711
7f4c6aa52b52
Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9063
diff
changeset
|
367 |
NS_LOG_FUNCTION (this << a << b << c << d); |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
368 |
Time e = Max (a, b); |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
369 |
Time f = Max (c, d); |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
370 |
Time retval = Max (e, f); |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
371 |
return retval; |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
372 |
} |
4509
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
373 |
Time |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
374 |
DcfManager::MostRecent (Time a, Time b, Time c, Time d, Time e, Time f) const |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
375 |
{ |
9711
7f4c6aa52b52
Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9063
diff
changeset
|
376 |
NS_LOG_FUNCTION (this << a << b << c << d << e << f); |
4509
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
377 |
Time g = Max (a, b); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
378 |
Time h = Max (c, d); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
379 |
Time i = Max (e, f); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
380 |
Time k = Max (g, h); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
381 |
Time retval = Max (k, i); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
382 |
return retval; |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
383 |
} |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
384 |
|
5189 | 385 |
Time |
386 |
DcfManager::MostRecent (Time a, Time b, Time c, Time d, Time e, Time f, Time g) const |
|
387 |
{ |
|
9711
7f4c6aa52b52
Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9063
diff
changeset
|
388 |
NS_LOG_FUNCTION (this << a << b << c << d << e << f << g); |
5189 | 389 |
Time h = Max (a, b); |
390 |
Time i = Max (c, d); |
|
391 |
Time j = Max (e, f); |
|
392 |
Time k = Max (h, i); |
|
393 |
Time l = Max (j, g); |
|
394 |
Time retval = Max (k, l); |
|
395 |
return retval; |
|
396 |
} |
|
397 |
||
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
398 |
bool |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
399 |
DcfManager::IsBusy (void) const |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
400 |
{ |
9711
7f4c6aa52b52
Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9063
diff
changeset
|
401 |
NS_LOG_FUNCTION (this); |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
402 |
// PHY busy |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
403 |
if (m_rxing) |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
404 |
{ |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
405 |
return true; |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
406 |
} |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
407 |
Time lastTxEnd = m_lastTxStart + m_lastTxDuration; |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
408 |
if (lastTxEnd > Simulator::Now ()) |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
409 |
{ |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
410 |
return true; |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
411 |
} |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
412 |
// NAV busy |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
413 |
Time lastNavEnd = m_lastNavStart + m_lastNavDuration; |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
414 |
if (lastNavEnd > Simulator::Now ()) |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
415 |
{ |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
416 |
return true; |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
417 |
} |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
418 |
return false; |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
419 |
} |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
420 |
|
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
421 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
422 |
void |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
423 |
DcfManager::RequestAccess (DcfState *state) |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
424 |
{ |
9711
7f4c6aa52b52
Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9063
diff
changeset
|
425 |
NS_LOG_FUNCTION (this << state); |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
426 |
UpdateBackoff (); |
2145
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2144
diff
changeset
|
427 |
NS_ASSERT (!state->IsAccessRequested ()); |
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2144
diff
changeset
|
428 |
state->NotifyAccessRequested (); |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
429 |
/** |
2127
2707cb71f6dc
even if an access timer is running, we need to start a backoff if needed
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2122
diff
changeset
|
430 |
* If there is a collision, generate a backoff |
2707cb71f6dc
even if an access timer is running, we need to start a backoff if needed
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2122
diff
changeset
|
431 |
* by notifying the collision to the user. |
2707cb71f6dc
even if an access timer is running, we need to start a backoff if needed
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2122
diff
changeset
|
432 |
*/ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
433 |
if (state->GetBackoffSlots () == 0 |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
434 |
&& IsBusy ()) |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
435 |
{ |
2107
9adb9e6d7bc7
improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2105
diff
changeset
|
436 |
MY_DEBUG ("medium is busy: collision"); |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
437 |
/* someone else has accessed the medium. |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
438 |
* generate a backoff. |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
439 |
*/ |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
440 |
state->NotifyCollision (); |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
441 |
} |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
442 |
DoGrantAccess (); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
443 |
DoRestartAccessTimeoutIfNeeded (); |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
444 |
} |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
445 |
|
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
446 |
void |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
447 |
DcfManager::DoGrantAccess (void) |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
448 |
{ |
9711
7f4c6aa52b52
Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9063
diff
changeset
|
449 |
NS_LOG_FUNCTION (this); |
2103
ae7144199052
add debugging output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2100
diff
changeset
|
450 |
uint32_t k = 0; |
ae7144199052
add debugging output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2100
diff
changeset
|
451 |
for (States::const_iterator i = m_states.begin (); i != m_states.end (); k++) |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
452 |
{ |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
453 |
DcfState *state = *i; |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
454 |
if (state->IsAccessRequested () |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
455 |
&& GetBackoffEndFor (state) <= Simulator::Now () ) |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
456 |
{ |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
457 |
/** |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
458 |
* This is the first dcf we find with an expired backoff and which |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
459 |
* needs access to the medium. i.e., it has data to send. |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
460 |
*/ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
461 |
MY_DEBUG ("dcf " << k << " needs access. backoff expired. access granted. slots=" << state->GetBackoffSlots ()); |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
462 |
i++; // go to the next item in the list. |
2103
ae7144199052
add debugging output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2100
diff
changeset
|
463 |
k++; |
2130
741d0b976a78
we need to accumulate a record of all changes before applying them in one go.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2129
diff
changeset
|
464 |
std::vector<DcfState *> internalCollisionStates; |
2103
ae7144199052
add debugging output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2100
diff
changeset
|
465 |
for (States::const_iterator j = i; j != m_states.end (); j++, k++) |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
466 |
{ |
2130
741d0b976a78
we need to accumulate a record of all changes before applying them in one go.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2129
diff
changeset
|
467 |
DcfState *otherState = *j; |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
468 |
if (otherState->IsAccessRequested () |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
469 |
&& GetBackoffEndFor (otherState) <= Simulator::Now ()) |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
470 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
471 |
MY_DEBUG ("dcf " << k << " needs access. backoff expired. internal collision. slots=" << |
2142
63c08450a4da
avoid decrementing by too many backoff slots
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2140
diff
changeset
|
472 |
otherState->GetBackoffSlots ()); |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
473 |
/** |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
474 |
* all other dcfs with a lower priority whose backoff |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
475 |
* has expired and which needed access to the medium |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
476 |
* must be notified that we did get an internal collision. |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
477 |
*/ |
2130
741d0b976a78
we need to accumulate a record of all changes before applying them in one go.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2129
diff
changeset
|
478 |
internalCollisionStates.push_back (otherState); |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
479 |
} |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
480 |
} |
2130
741d0b976a78
we need to accumulate a record of all changes before applying them in one go.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2129
diff
changeset
|
481 |
|
741d0b976a78
we need to accumulate a record of all changes before applying them in one go.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2129
diff
changeset
|
482 |
/** |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
483 |
* Now, we notify all of these changes in one go. It is necessary to |
2130
741d0b976a78
we need to accumulate a record of all changes before applying them in one go.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2129
diff
changeset
|
484 |
* perform first the calculations of which states are colliding and then |
741d0b976a78
we need to accumulate a record of all changes before applying them in one go.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2129
diff
changeset
|
485 |
* only apply the changes because applying the changes through notification |
741d0b976a78
we need to accumulate a record of all changes before applying them in one go.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2129
diff
changeset
|
486 |
* could change the global state of the manager, and, thus, could change |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
487 |
* the result of the calculations. |
2130
741d0b976a78
we need to accumulate a record of all changes before applying them in one go.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2129
diff
changeset
|
488 |
*/ |
741d0b976a78
we need to accumulate a record of all changes before applying them in one go.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2129
diff
changeset
|
489 |
state->NotifyAccessGranted (); |
741d0b976a78
we need to accumulate a record of all changes before applying them in one go.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2129
diff
changeset
|
490 |
for (std::vector<DcfState *>::const_iterator k = internalCollisionStates.begin (); |
741d0b976a78
we need to accumulate a record of all changes before applying them in one go.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2129
diff
changeset
|
491 |
k != internalCollisionStates.end (); k++) |
741d0b976a78
we need to accumulate a record of all changes before applying them in one go.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2129
diff
changeset
|
492 |
{ |
741d0b976a78
we need to accumulate a record of all changes before applying them in one go.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2129
diff
changeset
|
493 |
(*k)->NotifyInternalCollision (); |
741d0b976a78
we need to accumulate a record of all changes before applying them in one go.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2129
diff
changeset
|
494 |
} |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
495 |
break; |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
496 |
} |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
497 |
i++; |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
498 |
} |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
499 |
} |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
500 |
|
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
501 |
void |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
502 |
DcfManager::AccessTimeout (void) |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
503 |
{ |
9711
7f4c6aa52b52
Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9063
diff
changeset
|
504 |
NS_LOG_FUNCTION (this); |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
505 |
UpdateBackoff (); |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
506 |
DoGrantAccess (); |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
507 |
DoRestartAccessTimeoutIfNeeded (); |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
508 |
} |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
509 |
|
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
510 |
Time |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
511 |
DcfManager::GetAccessGrantStart (void) const |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
512 |
{ |
9711
7f4c6aa52b52
Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9063
diff
changeset
|
513 |
NS_LOG_FUNCTION (this); |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
514 |
Time rxAccessStart; |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
515 |
if (!m_rxing) |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
516 |
{ |
5815
5629104d7747
Bug 674 - EIFS is not handled correctly in DcfManager::GetAccessGrantStart
Kirill Andreev <andreev@iitp.ru>
parents:
5189
diff
changeset
|
517 |
rxAccessStart = m_lastRxEnd + m_sifs; |
2099
de25c6d81572
initialize state variables
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2096
diff
changeset
|
518 |
if (!m_lastRxReceivedOk) |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
519 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
520 |
rxAccessStart += m_eifsNoDifs; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
521 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
522 |
} |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
523 |
else |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
524 |
{ |
2105
e883a100109a
get rid of MacParameters from DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2104
diff
changeset
|
525 |
rxAccessStart = m_lastRxStart + m_lastRxDuration + m_sifs; |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
526 |
} |
2105
e883a100109a
get rid of MacParameters from DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2104
diff
changeset
|
527 |
Time busyAccessStart = m_lastBusyStart + m_lastBusyDuration + m_sifs; |
e883a100109a
get rid of MacParameters from DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2104
diff
changeset
|
528 |
Time txAccessStart = m_lastTxStart + m_lastTxDuration + m_sifs; |
e883a100109a
get rid of MacParameters from DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2104
diff
changeset
|
529 |
Time navAccessStart = m_lastNavStart + m_lastNavDuration + m_sifs; |
4509
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
530 |
Time ackTimeoutAccessStart = m_lastAckTimeoutEnd + m_sifs; |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
531 |
Time ctsTimeoutAccessStart = m_lastCtsTimeoutEnd + m_sifs; |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
532 |
Time switchingAccessStart = m_lastSwitchingStart + m_lastSwitchingDuration + m_sifs; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
533 |
Time accessGrantedStart = MostRecent (rxAccessStart, |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
534 |
busyAccessStart, |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
535 |
txAccessStart, |
4509
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
536 |
navAccessStart, |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
537 |
ackTimeoutAccessStart, |
5189 | 538 |
ctsTimeoutAccessStart, |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
539 |
switchingAccessStart |
4509
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
540 |
); |
2109
345491373a45
do not use GetBackoffSlots directly anymore
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2108
diff
changeset
|
541 |
NS_LOG_INFO ("access grant start=" << accessGrantedStart << |
345491373a45
do not use GetBackoffSlots directly anymore
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2108
diff
changeset
|
542 |
", rx access start=" << rxAccessStart << |
345491373a45
do not use GetBackoffSlots directly anymore
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2108
diff
changeset
|
543 |
", busy access start=" << busyAccessStart << |
345491373a45
do not use GetBackoffSlots directly anymore
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2108
diff
changeset
|
544 |
", tx access start=" << txAccessStart << |
345491373a45
do not use GetBackoffSlots directly anymore
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2108
diff
changeset
|
545 |
", nav access start=" << navAccessStart); |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
546 |
return accessGrantedStart; |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
547 |
} |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
548 |
|
2107
9adb9e6d7bc7
improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2105
diff
changeset
|
549 |
Time |
9adb9e6d7bc7
improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2105
diff
changeset
|
550 |
DcfManager::GetBackoffStartFor (DcfState *state) |
9adb9e6d7bc7
improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2105
diff
changeset
|
551 |
{ |
9711
7f4c6aa52b52
Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9063
diff
changeset
|
552 |
NS_LOG_FUNCTION (this << state); |
2107
9adb9e6d7bc7
improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2105
diff
changeset
|
553 |
Time mostRecentEvent = MostRecent (state->GetBackoffStart (), |
5816
d3fdc15b065f
Bug 695 - DcfManager::UpdateBackoff () uses slow HighPrecision::Div()
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
5815
diff
changeset
|
554 |
GetAccessGrantStart () + MicroSeconds (state->GetAifsn () * m_slotTimeUs)); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
555 |
|
2107
9adb9e6d7bc7
improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2105
diff
changeset
|
556 |
return mostRecentEvent; |
9adb9e6d7bc7
improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2105
diff
changeset
|
557 |
} |
9adb9e6d7bc7
improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2105
diff
changeset
|
558 |
|
9adb9e6d7bc7
improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2105
diff
changeset
|
559 |
Time |
9adb9e6d7bc7
improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2105
diff
changeset
|
560 |
DcfManager::GetBackoffEndFor (DcfState *state) |
9adb9e6d7bc7
improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2105
diff
changeset
|
561 |
{ |
5816
d3fdc15b065f
Bug 695 - DcfManager::UpdateBackoff () uses slow HighPrecision::Div()
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
5815
diff
changeset
|
562 |
return GetBackoffStartFor (state) + MicroSeconds (state->GetBackoffSlots () * m_slotTimeUs); |
2107
9adb9e6d7bc7
improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2105
diff
changeset
|
563 |
} |
9adb9e6d7bc7
improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2105
diff
changeset
|
564 |
|
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
565 |
void |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
566 |
DcfManager::UpdateBackoff (void) |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
567 |
{ |
9711
7f4c6aa52b52
Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9063
diff
changeset
|
568 |
NS_LOG_FUNCTION (this); |
2103
ae7144199052
add debugging output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2100
diff
changeset
|
569 |
uint32_t k = 0; |
ae7144199052
add debugging output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2100
diff
changeset
|
570 |
for (States::const_iterator i = m_states.begin (); i != m_states.end (); i++, k++) |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
571 |
{ |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
572 |
DcfState *state = *i; |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
573 |
|
2107
9adb9e6d7bc7
improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2105
diff
changeset
|
574 |
Time backoffStart = GetBackoffStartFor (state); |
9adb9e6d7bc7
improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2105
diff
changeset
|
575 |
if (backoffStart <= Simulator::Now ()) |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
576 |
{ |
5816
d3fdc15b065f
Bug 695 - DcfManager::UpdateBackoff () uses slow HighPrecision::Div()
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
5815
diff
changeset
|
577 |
uint32_t nus = (Simulator::Now () - backoffStart).GetMicroSeconds (); |
d3fdc15b065f
Bug 695 - DcfManager::UpdateBackoff () uses slow HighPrecision::Div()
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
5815
diff
changeset
|
578 |
uint32_t nIntSlots = nus / m_slotTimeUs; |
2144
415546638869
The AIFSN has been taken into account in GetBackoffStartFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2142
diff
changeset
|
579 |
uint32_t n = std::min (nIntSlots, state->GetBackoffSlots ()); |
415546638869
The AIFSN has been taken into account in GetBackoffStartFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2142
diff
changeset
|
580 |
MY_DEBUG ("dcf " << k << " dec backoff slots=" << n); |
5816
d3fdc15b065f
Bug 695 - DcfManager::UpdateBackoff () uses slow HighPrecision::Div()
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
5815
diff
changeset
|
581 |
Time backoffUpdateBound = backoffStart + MicroSeconds (n * m_slotTimeUs); |
2144
415546638869
The AIFSN has been taken into account in GetBackoffStartFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2142
diff
changeset
|
582 |
state->UpdateBackoffSlotsNow (n, backoffUpdateBound); |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
583 |
} |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
584 |
} |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
585 |
} |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
586 |
|
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
587 |
void |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
588 |
DcfManager::DoRestartAccessTimeoutIfNeeded (void) |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
589 |
{ |
9711
7f4c6aa52b52
Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9063
diff
changeset
|
590 |
NS_LOG_FUNCTION (this); |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
591 |
/** |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
592 |
* Is there a DcfState which needs to access the medium, and, |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
593 |
* if there is one, how many slots for AIFS+backoff does it require ? |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
594 |
*/ |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
595 |
bool accessTimeoutNeeded = false; |
2170
b24ae0343c4f
MaxSeconds -> Simulator::GetMaximumSimulationTime
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2145
diff
changeset
|
596 |
Time expectedBackoffEnd = Simulator::GetMaximumSimulationTime (); |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
597 |
for (States::const_iterator i = m_states.begin (); i != m_states.end (); i++) |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
598 |
{ |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
599 |
DcfState *state = *i; |
2145
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2144
diff
changeset
|
600 |
if (state->IsAccessRequested ()) |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
601 |
{ |
2129
32f0e5c1a4d6
backoff end time is never in the past.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2128
diff
changeset
|
602 |
Time tmp = GetBackoffEndFor (state); |
32f0e5c1a4d6
backoff end time is never in the past.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2128
diff
changeset
|
603 |
if (tmp > Simulator::Now ()) |
32f0e5c1a4d6
backoff end time is never in the past.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2128
diff
changeset
|
604 |
{ |
32f0e5c1a4d6
backoff end time is never in the past.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2128
diff
changeset
|
605 |
accessTimeoutNeeded = true; |
32f0e5c1a4d6
backoff end time is never in the past.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2128
diff
changeset
|
606 |
expectedBackoffEnd = std::min (expectedBackoffEnd, tmp); |
32f0e5c1a4d6
backoff end time is never in the past.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2128
diff
changeset
|
607 |
} |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
608 |
} |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
609 |
} |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
610 |
if (accessTimeoutNeeded) |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
611 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
612 |
MY_DEBUG ("expected backoff end=" << expectedBackoffEnd); |
2129
32f0e5c1a4d6
backoff end time is never in the past.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2128
diff
changeset
|
613 |
Time expectedBackoffDelay = expectedBackoffEnd - Simulator::Now (); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
614 |
if (m_accessTimeout.IsRunning () |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
615 |
&& Simulator::GetDelayLeft (m_accessTimeout) > expectedBackoffDelay) |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
616 |
{ |
2129
32f0e5c1a4d6
backoff end time is never in the past.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2128
diff
changeset
|
617 |
m_accessTimeout.Cancel (); |
32f0e5c1a4d6
backoff end time is never in the past.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2128
diff
changeset
|
618 |
} |
32f0e5c1a4d6
backoff end time is never in the past.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2128
diff
changeset
|
619 |
if (m_accessTimeout.IsExpired ()) |
32f0e5c1a4d6
backoff end time is never in the past.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2128
diff
changeset
|
620 |
{ |
32f0e5c1a4d6
backoff end time is never in the past.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2128
diff
changeset
|
621 |
m_accessTimeout = Simulator::Schedule (expectedBackoffDelay, |
32f0e5c1a4d6
backoff end time is never in the past.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2128
diff
changeset
|
622 |
&DcfManager::AccessTimeout, this); |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
623 |
} |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
624 |
} |
2140
acfd79fc8d65
debugging output is more verbose.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2130
diff
changeset
|
625 |
} |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
626 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
627 |
void |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
628 |
DcfManager::NotifyRxStartNow (Time duration) |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
629 |
{ |
9711
7f4c6aa52b52
Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9063
diff
changeset
|
630 |
NS_LOG_FUNCTION (this << duration); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
631 |
MY_DEBUG ("rx start for=" << duration); |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
632 |
UpdateBackoff (); |
2107
9adb9e6d7bc7
improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2105
diff
changeset
|
633 |
m_lastRxStart = Simulator::Now (); |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
634 |
m_lastRxDuration = duration; |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
635 |
m_rxing = true; |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
636 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
637 |
void |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
638 |
DcfManager::NotifyRxEndOkNow (void) |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
639 |
{ |
9711
7f4c6aa52b52
Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9063
diff
changeset
|
640 |
NS_LOG_FUNCTION (this); |
2107
9adb9e6d7bc7
improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2105
diff
changeset
|
641 |
MY_DEBUG ("rx end ok"); |
9adb9e6d7bc7
improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2105
diff
changeset
|
642 |
m_lastRxEnd = Simulator::Now (); |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
643 |
m_lastRxReceivedOk = true; |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
644 |
m_rxing = false; |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
645 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
646 |
void |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
647 |
DcfManager::NotifyRxEndErrorNow (void) |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
648 |
{ |
9711
7f4c6aa52b52
Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9063
diff
changeset
|
649 |
NS_LOG_FUNCTION (this); |
2107
9adb9e6d7bc7
improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2105
diff
changeset
|
650 |
MY_DEBUG ("rx end error"); |
9adb9e6d7bc7
improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2105
diff
changeset
|
651 |
m_lastRxEnd = Simulator::Now (); |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
652 |
m_lastRxReceivedOk = false; |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
653 |
m_rxing = false; |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
654 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
655 |
void |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
656 |
DcfManager::NotifyTxStartNow (Time duration) |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
657 |
{ |
9711
7f4c6aa52b52
Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9063
diff
changeset
|
658 |
NS_LOG_FUNCTION (this << duration); |
4598
9b07308116ed
bug 595: PHY may start receive packet inside SIFS
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4509
diff
changeset
|
659 |
if (m_rxing) |
6063
d9163d8a18c5
Wifi:Fixes in coding style
Kirill Andreev <andreev@iitp.ru>
parents:
5816
diff
changeset
|
660 |
{ |
d9163d8a18c5
Wifi:Fixes in coding style
Kirill Andreev <andreev@iitp.ru>
parents:
5816
diff
changeset
|
661 |
//this may be caused only if PHY has started to receive a packet |
d9163d8a18c5
Wifi:Fixes in coding style
Kirill Andreev <andreev@iitp.ru>
parents:
5816
diff
changeset
|
662 |
//inside SIFS, so, we check that lastRxStart was maximum a SIFS |
d9163d8a18c5
Wifi:Fixes in coding style
Kirill Andreev <andreev@iitp.ru>
parents:
5816
diff
changeset
|
663 |
//ago |
d9163d8a18c5
Wifi:Fixes in coding style
Kirill Andreev <andreev@iitp.ru>
parents:
5816
diff
changeset
|
664 |
NS_ASSERT (Simulator::Now () - m_lastRxStart <= m_sifs); |
d9163d8a18c5
Wifi:Fixes in coding style
Kirill Andreev <andreev@iitp.ru>
parents:
5816
diff
changeset
|
665 |
m_lastRxEnd = Simulator::Now (); |
d9163d8a18c5
Wifi:Fixes in coding style
Kirill Andreev <andreev@iitp.ru>
parents:
5816
diff
changeset
|
666 |
m_lastRxDuration = m_lastRxEnd - m_lastRxStart; |
d9163d8a18c5
Wifi:Fixes in coding style
Kirill Andreev <andreev@iitp.ru>
parents:
5816
diff
changeset
|
667 |
m_lastRxReceivedOk = true; |
d9163d8a18c5
Wifi:Fixes in coding style
Kirill Andreev <andreev@iitp.ru>
parents:
5816
diff
changeset
|
668 |
m_rxing = false; |
d9163d8a18c5
Wifi:Fixes in coding style
Kirill Andreev <andreev@iitp.ru>
parents:
5816
diff
changeset
|
669 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
670 |
MY_DEBUG ("tx start for " << duration); |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
671 |
UpdateBackoff (); |
2107
9adb9e6d7bc7
improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2105
diff
changeset
|
672 |
m_lastTxStart = Simulator::Now (); |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
673 |
m_lastTxDuration = duration; |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
674 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
675 |
void |
3905
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
676 |
DcfManager::NotifyMaybeCcaBusyStartNow (Time duration) |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
677 |
{ |
9711
7f4c6aa52b52
Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9063
diff
changeset
|
678 |
NS_LOG_FUNCTION (this << duration); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
679 |
MY_DEBUG ("busy start for " << duration); |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
680 |
UpdateBackoff (); |
2107
9adb9e6d7bc7
improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2105
diff
changeset
|
681 |
m_lastBusyStart = Simulator::Now (); |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
682 |
m_lastBusyDuration = duration; |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
683 |
} |
5189 | 684 |
|
685 |
||
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
686 |
void |
5189 | 687 |
DcfManager::NotifySwitchingStartNow (Time duration) |
688 |
{ |
|
9711
7f4c6aa52b52
Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9063
diff
changeset
|
689 |
NS_LOG_FUNCTION (this << duration); |
5189 | 690 |
Time now = Simulator::Now (); |
691 |
NS_ASSERT (m_lastTxStart + m_lastTxDuration <= now); |
|
692 |
NS_ASSERT (m_lastSwitchingStart + m_lastSwitchingDuration <= now); |
|
693 |
||
694 |
if (m_rxing) |
|
695 |
{ |
|
696 |
// channel switching during packet reception |
|
697 |
m_lastRxEnd = Simulator::Now (); |
|
698 |
m_lastRxDuration = m_lastRxEnd - m_lastRxStart; |
|
699 |
m_lastRxReceivedOk = true; |
|
700 |
m_rxing = false; |
|
701 |
} |
|
702 |
if (m_lastNavStart + m_lastNavDuration > now) |
|
703 |
{ |
|
704 |
m_lastNavDuration = now - m_lastNavStart; |
|
705 |
} |
|
706 |
if (m_lastBusyStart + m_lastBusyDuration > now) |
|
707 |
{ |
|
708 |
m_lastBusyDuration = now - m_lastBusyStart; |
|
709 |
} |
|
710 |
if (m_lastAckTimeoutEnd > now) |
|
711 |
{ |
|
712 |
m_lastAckTimeoutEnd = now; |
|
713 |
} |
|
714 |
if (m_lastCtsTimeoutEnd > now) |
|
715 |
{ |
|
716 |
m_lastCtsTimeoutEnd = now; |
|
717 |
} |
|
718 |
||
719 |
// Cancel timeout |
|
720 |
if (m_accessTimeout.IsRunning ()) |
|
721 |
{ |
|
722 |
m_accessTimeout.Cancel (); |
|
723 |
} |
|
724 |
||
725 |
// Reset backoffs |
|
726 |
for (States::iterator i = m_states.begin (); i != m_states.end (); i++) |
|
727 |
{ |
|
728 |
DcfState *state = *i; |
|
729 |
uint32_t remainingSlots = state->GetBackoffSlots (); |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
730 |
if (remainingSlots > 0) |
5189 | 731 |
{ |
732 |
state->UpdateBackoffSlotsNow (remainingSlots, now); |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
733 |
NS_ASSERT (state->GetBackoffSlots () == 0); |
5189 | 734 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
735 |
state->ResetCw (); |
5189 | 736 |
state->m_accessRequested = false; |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
737 |
state->NotifyChannelSwitching (); |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
738 |
} |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
739 |
|
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
740 |
MY_DEBUG ("switching start for " << duration); |
5189 | 741 |
m_lastSwitchingStart = Simulator::Now (); |
742 |
m_lastSwitchingDuration = duration; |
|
743 |
||
744 |
} |
|
745 |
||
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
746 |
void |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
747 |
DcfManager::NotifyNavResetNow (Time duration) |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
748 |
{ |
9711
7f4c6aa52b52
Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9063
diff
changeset
|
749 |
NS_LOG_FUNCTION (this << duration); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
750 |
MY_DEBUG ("nav reset for=" << duration); |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
751 |
UpdateBackoff (); |
2107
9adb9e6d7bc7
improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2105
diff
changeset
|
752 |
m_lastNavStart = Simulator::Now (); |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
753 |
m_lastNavDuration = duration; |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
754 |
UpdateBackoff (); |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
755 |
/** |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
756 |
* If the nav reset indicates an end-of-nav which is earlier |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
757 |
* than the previous end-of-nav, the expected end of backoff |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
758 |
* might be later than previously thought so, we might need |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
759 |
* to restart a new access timeout. |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
760 |
*/ |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
761 |
DoRestartAccessTimeoutIfNeeded (); |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
762 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
763 |
void |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
764 |
DcfManager::NotifyNavStartNow (Time duration) |
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
765 |
{ |
9711
7f4c6aa52b52
Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9063
diff
changeset
|
766 |
NS_LOG_FUNCTION (this << duration); |
10211
1af765ed27c8
Bug 1011 - assert failed. file=../src/devices/wifi/dcf-manager.cc
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10200
diff
changeset
|
767 |
NS_ASSERT (m_lastNavStart <= Simulator::Now ()); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
768 |
MY_DEBUG ("nav start for=" << duration); |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
769 |
UpdateBackoff (); |
2111
54617d2770c8
handle NAV correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2109
diff
changeset
|
770 |
Time newNavEnd = Simulator::Now () + duration; |
54617d2770c8
handle NAV correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2109
diff
changeset
|
771 |
Time lastNavEnd = m_lastNavStart + m_lastNavDuration; |
54617d2770c8
handle NAV correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2109
diff
changeset
|
772 |
if (newNavEnd > lastNavEnd) |
54617d2770c8
handle NAV correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2109
diff
changeset
|
773 |
{ |
54617d2770c8
handle NAV correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2109
diff
changeset
|
774 |
m_lastNavStart = Simulator::Now (); |
54617d2770c8
handle NAV correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2109
diff
changeset
|
775 |
m_lastNavDuration = duration; |
54617d2770c8
handle NAV correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2109
diff
changeset
|
776 |
} |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
777 |
} |
4509
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
778 |
void |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
779 |
DcfManager::NotifyAckTimeoutStartNow (Time duration) |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
780 |
{ |
9711
7f4c6aa52b52
Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9063
diff
changeset
|
781 |
NS_LOG_FUNCTION (this << duration); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
782 |
NS_ASSERT (m_lastAckTimeoutEnd < Simulator::Now ()); |
4509
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
783 |
m_lastAckTimeoutEnd = Simulator::Now () + duration; |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
784 |
} |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
785 |
void |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
786 |
DcfManager::NotifyAckTimeoutResetNow () |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
787 |
{ |
9711
7f4c6aa52b52
Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9063
diff
changeset
|
788 |
NS_LOG_FUNCTION (this); |
4509
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
789 |
m_lastAckTimeoutEnd = Simulator::Now (); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
790 |
DoRestartAccessTimeoutIfNeeded (); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
791 |
} |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
792 |
void |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
793 |
DcfManager::NotifyCtsTimeoutStartNow (Time duration) |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
794 |
{ |
9711
7f4c6aa52b52
Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9063
diff
changeset
|
795 |
NS_LOG_FUNCTION (this << duration); |
4509
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
796 |
m_lastCtsTimeoutEnd = Simulator::Now () + duration; |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
797 |
} |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
798 |
void |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
799 |
DcfManager::NotifyCtsTimeoutResetNow () |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
800 |
{ |
9711
7f4c6aa52b52
Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9063
diff
changeset
|
801 |
NS_LOG_FUNCTION (this); |
4509
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
802 |
m_lastCtsTimeoutEnd = Simulator::Now (); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
803 |
DoRestartAccessTimeoutIfNeeded (); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4460
diff
changeset
|
804 |
} |
2095
f6ec39e97e4b
a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff
changeset
|
805 |
} // namespace ns3 |