View | Details | Raw Unified | Return to bug 3010
Collapse All | Expand All

(-)a/RELEASE_NOTES (+1 lines)
 Lines 80-85   New user-visible features Link Here 
80
  This trace is fired whenever a new path loss value is calculated. It exports pointers
80
  This trace is fired whenever a new path loss value is calculated. It exports pointers
81
  to the mobility model of the transmitter and the receiver, Tx antenna gain, Rx antenna gain,
81
  to the mobility model of the transmitter and the receiver, Tx antenna gain, Rx antenna gain,
82
  propagation gain and the pathloss value.
82
  propagation gain and the pathloss value.
83
- (wifi) It is now possible to transmit A-MPDUs containing up to 256 MPDUs (802.11ax only)
83
84
84
Bugs fixed
85
Bugs fixed
85
----------
86
----------
(-)a/examples/wireless/examples-to-run.py (-3 / +4 lines)
 Lines 41-50   cpp_examples = [ Link Here 
41
    ("ht-wifi-network --simulationTime=0.1 --frequency=5 --useRts=1 --minExpectedThroughput=5 --maxExpectedThroughput=130", "True", "True"),
41
    ("ht-wifi-network --simulationTime=0.1 --frequency=5 --useRts=1 --minExpectedThroughput=5 --maxExpectedThroughput=130", "True", "True"),
42
    ("ht-wifi-network --simulationTime=0.1 --frequency=2.4 --useRts=0 --minExpectedThroughput=5 --maxExpectedThroughput=132", "True", "True"),
42
    ("ht-wifi-network --simulationTime=0.1 --frequency=2.4 --useRts=0 --minExpectedThroughput=5 --maxExpectedThroughput=132", "True", "True"),
43
    ("ht-wifi-network --simulationTime=0.1 --frequency=2.4 --useRts=1 --minExpectedThroughput=4.5 --maxExpectedThroughput=128", "True", "True"),
43
    ("ht-wifi-network --simulationTime=0.1 --frequency=2.4 --useRts=1 --minExpectedThroughput=4.5 --maxExpectedThroughput=128", "True", "True"),
44
    ("vht-wifi-network --simulationTime=0.1 --useRts=0  --minExpectedThroughput=5 --maxExpectedThroughput=555", "True", "True"),
44
    ("vht-wifi-network --simulationTime=0.1 --useRts=0  --minExpectedThroughput=5 --maxExpectedThroughput=607", "True", "True"),
45
    ("vht-wifi-network --simulationTime=0.2 --useRts=1", "True", "True"),
45
    ("vht-wifi-network --simulationTime=0.2 --useRts=1", "True", "True"),
46
    ("he-wifi-network --simulationTime=0.25 --frequency=5 --useRts=0  --minExpectedThroughput=6 --maxExpectedThroughput=754", "True", "True"),
46
    ("he-wifi-network --simulationTime=0.25 --frequency=5 --useRts=0 --minExpectedThroughput=6 --maxExpectedThroughput=844", "True", "True"),
47
    ("he-wifi-network --simulationTime=0.3 --frequency=5 --useRts=1 --minExpectedThroughput=6 --maxExpectedThroughput=639", "True", "True"),
47
    ("he-wifi-network --simulationTime=0.25 --frequency=5 --useRts=0 --useExtendedBlockAck=1 --minExpectedThroughput=6 --maxExpectedThroughput=1033", "True", "True"),
48
    ("he-wifi-network --simulationTime=0.3 --frequency=5 --useRts=1 --minExpectedThroughput=6 --maxExpectedThroughput=745", "True", "True"),
48
    ("he-wifi-network --simulationTime=0.25 --frequency=2.4 --useRts=0 --minExpectedThroughput=6 --maxExpectedThroughput=238", "True", "True"),
49
    ("he-wifi-network --simulationTime=0.25 --frequency=2.4 --useRts=0 --minExpectedThroughput=6 --maxExpectedThroughput=238", "True", "True"),
49
    ("he-wifi-network --simulationTime=0.3 --frequency=2.4 --useRts=1 --minExpectedThroughput=6 --maxExpectedThroughput=224", "True", "True"),
50
    ("he-wifi-network --simulationTime=0.3 --frequency=2.4 --useRts=1 --minExpectedThroughput=6 --maxExpectedThroughput=224", "True", "True"),
50
    ("simple-ht-hidden-stations --simulationTime=1 --enableRts=0 --nMpdus=32 --minExpectedThroughput=59 --maxExpectedThroughput=60", "True", "True"),
51
    ("simple-ht-hidden-stations --simulationTime=1 --enableRts=0 --nMpdus=32 --minExpectedThroughput=59 --maxExpectedThroughput=60", "True", "True"),
(-)a/examples/wireless/he-wifi-network.cc (-1 / +4 lines)
 Lines 62-67   int main (int argc, char *argv[]) Link Here 
62
{
62
{
63
  bool udp = true;
63
  bool udp = true;
64
  bool useRts = false;
64
  bool useRts = false;
65
  bool useExtendedBlockAck = false;
65
  double simulationTime = 10; //seconds
66
  double simulationTime = 10; //seconds
66
  double distance = 1.0; //meters
67
  double distance = 1.0; //meters
67
  double frequency = 5.0; //whether 2.4 or 5.0 GHz
68
  double frequency = 5.0; //whether 2.4 or 5.0 GHz
 Lines 75-80   int main (int argc, char *argv[]) Link Here 
75
  cmd.AddValue ("simulationTime", "Simulation time in seconds", simulationTime);
76
  cmd.AddValue ("simulationTime", "Simulation time in seconds", simulationTime);
76
  cmd.AddValue ("udp", "UDP if set to 1, TCP otherwise", udp);
77
  cmd.AddValue ("udp", "UDP if set to 1, TCP otherwise", udp);
77
  cmd.AddValue ("useRts", "Enable/disable RTS/CTS", useRts);
78
  cmd.AddValue ("useRts", "Enable/disable RTS/CTS", useRts);
79
  cmd.AddValue ("useExtendedBlockAck", "Enable/disable use of extended BACK", useExtendedBlockAck);
78
  cmd.AddValue ("mcs", "if set, limit testing to a specific MCS (0-7)", mcs);
80
  cmd.AddValue ("mcs", "if set, limit testing to a specific MCS (0-7)", mcs);
79
  cmd.AddValue ("minExpectedThroughput", "if set, simulation fails if the lowest throughput is below this value", minExpectedThroughput);
81
  cmd.AddValue ("minExpectedThroughput", "if set, simulation fails if the lowest throughput is below this value", minExpectedThroughput);
80
  cmd.AddValue ("maxExpectedThroughput", "if set, simulation fails if the highest throughput is above this value", maxExpectedThroughput);
82
  cmd.AddValue ("maxExpectedThroughput", "if set, simulation fails if the highest throughput is above this value", maxExpectedThroughput);
 Lines 164-172   int main (int argc, char *argv[]) Link Here 
164
              NetDeviceContainer apDevice;
166
              NetDeviceContainer apDevice;
165
              apDevice = wifi.Install (phy, mac, wifiApNode);
167
              apDevice = wifi.Install (phy, mac, wifiApNode);
166
168
167
              // Set channel width and guard interval
169
              // Set channel width, guard interval and MPDU buffer size
168
              Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (channelWidth));
170
              Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (channelWidth));
169
              Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HeConfiguration/GuardInterval", TimeValue (NanoSeconds (gi)));
171
              Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HeConfiguration/GuardInterval", TimeValue (NanoSeconds (gi)));
172
              Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HeConfiguration/MpduBufferSize", UintegerValue (useExtendedBlockAck ? 256 : 64));
170
173
171
              // mobility.
174
              // mobility.
172
              MobilityHelper mobility;
175
              MobilityHelper mobility;
(-)a/examples/wireless/mixed-network.cc (-2 / +2 lines)
 Lines 193-199   Experiment::Run (Parameters params) Link Here 
193
  NetDeviceContainer nNGFStaDevice, nGFStaDevice;
193
  NetDeviceContainer nNGFStaDevice, nGFStaDevice;
194
  mac.SetType ("ns3::StaWifiMac",
194
  mac.SetType ("ns3::StaWifiMac",
195
               "Ssid", SsidValue (ssid),
195
               "Ssid", SsidValue (ssid),
196
               "BE_MaxAmpduSize", UintegerValue (0),
197
               "BE_BlockAckThreshold", UintegerValue (2),
196
               "BE_BlockAckThreshold", UintegerValue (2),
198
               "ShortSlotTimeSupported", BooleanValue (params.enableShortSlotTime));
197
               "ShortSlotTimeSupported", BooleanValue (params.enableShortSlotTime));
199
  nNGFStaDevice = wifi.Install (phy, mac, wifiNNGFStaNodes);
198
  nNGFStaDevice = wifi.Install (phy, mac, wifiNNGFStaNodes);
 Lines 205-211   Experiment::Run (Parameters params) Link Here 
205
  mac.SetType ("ns3::ApWifiMac",
204
  mac.SetType ("ns3::ApWifiMac",
206
               "Ssid", SsidValue (ssid),
205
               "Ssid", SsidValue (ssid),
207
               "EnableBeaconJitter", BooleanValue (false),
206
               "EnableBeaconJitter", BooleanValue (false),
208
               "BE_MaxAmpduSize", UintegerValue (0),
209
               "BE_BlockAckThreshold", UintegerValue (2),
207
               "BE_BlockAckThreshold", UintegerValue (2),
210
               "RifsMode", BooleanValue (params.rifsMode),
208
               "RifsMode", BooleanValue (params.rifsMode),
211
               "EnableNonErpProtection", BooleanValue (params.enableErpProtection),
209
               "EnableNonErpProtection", BooleanValue (params.enableErpProtection),
 Lines 252-257   Experiment::Run (Parameters params) Link Here 
252
      edca->SetTxopLimit (MicroSeconds (3008));
250
      edca->SetTxopLimit (MicroSeconds (3008));
253
    }
251
    }
254
252
253
  Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/BeMaxAmpduSize", UintegerValue (0)); //Disable A-MPDU
254
255
  // Define mobility model
255
  // Define mobility model
256
  MobilityHelper mobility;
256
  MobilityHelper mobility;
257
  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
257
  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
(-)a/examples/wireless/rate-adaptation-distance.cc (-10 / +10 lines)
 Lines 152-158   int main (int argc, char *argv[]) Link Here 
152
  std::string apManager = "ns3::MinstrelHtWifiManager";
152
  std::string apManager = "ns3::MinstrelHtWifiManager";
153
  std::string standard = "802.11n-5GHz";
153
  std::string standard = "802.11n-5GHz";
154
  std::string outputFileName = "minstrelHT";
154
  std::string outputFileName = "minstrelHT";
155
  uint32_t BE_MaxAmpduSize = 65535;
155
  uint32_t BeMaxAmpduSize = 65535;
156
  bool shortGuardInterval = false;
156
  bool shortGuardInterval = false;
157
  uint32_t chWidth = 20;
157
  uint32_t chWidth = 20;
158
  int ap1_x = 0;
158
  int ap1_x = 0;
 Lines 170-176   int main (int argc, char *argv[]) Link Here 
170
  cmd.AddValue ("shortGuardInterval", "Enable Short Guard Interval in all stations", shortGuardInterval);
170
  cmd.AddValue ("shortGuardInterval", "Enable Short Guard Interval in all stations", shortGuardInterval);
171
  cmd.AddValue ("channelWidth", "Channel width of all the stations", chWidth);
171
  cmd.AddValue ("channelWidth", "Channel width of all the stations", chWidth);
172
  cmd.AddValue ("rtsThreshold", "RTS threshold", rtsThreshold);
172
  cmd.AddValue ("rtsThreshold", "RTS threshold", rtsThreshold);
173
  cmd.AddValue ("BE_MaxAmpduSize", "BE Mac A-MPDU size", BE_MaxAmpduSize);
173
  cmd.AddValue ("BeMaxAmpduSize", "BE Mac A-MPDU size", BeMaxAmpduSize);
174
  cmd.AddValue ("outputFileName", "Output filename", outputFileName);
174
  cmd.AddValue ("outputFileName", "Output filename", outputFileName);
175
  cmd.AddValue ("steps", "How many different distances to try", steps);
175
  cmd.AddValue ("steps", "How many different distances to try", steps);
176
  cmd.AddValue ("stepsTime", "Time on each step", stepsTime);
176
  cmd.AddValue ("stepsTime", "Time on each step", stepsTime);
 Lines 251-258   int main (int argc, char *argv[]) Link Here 
251
251
252
      Ssid ssid = Ssid ("AP");
252
      Ssid ssid = Ssid ("AP");
253
      wifiMac.SetType ("ns3::StaWifiMac",
253
      wifiMac.SetType ("ns3::StaWifiMac",
254
                       "Ssid", SsidValue (ssid),
254
                       "Ssid", SsidValue (ssid));
255
                       "BE_MaxAmpduSize", UintegerValue (BE_MaxAmpduSize));
256
      wifiStaDevices.Add (wifi.Install (wifiPhy, wifiMac, wifiStaNodes.Get (0)));
255
      wifiStaDevices.Add (wifi.Install (wifiPhy, wifiMac, wifiStaNodes.Get (0)));
257
256
258
      //Configure the AP node
257
      //Configure the AP node
 Lines 260-268   int main (int argc, char *argv[]) Link Here 
260
259
261
      ssid = Ssid ("AP");
260
      ssid = Ssid ("AP");
262
      wifiMac.SetType ("ns3::ApWifiMac",
261
      wifiMac.SetType ("ns3::ApWifiMac",
263
                       "Ssid", SsidValue (ssid),
262
                       "Ssid", SsidValue (ssid));
264
                       "BE_MaxAmpduSize", UintegerValue (BE_MaxAmpduSize));
265
      wifiApDevices.Add (wifi.Install (wifiPhy, wifiMac, wifiApNodes.Get (0)));
263
      wifiApDevices.Add (wifi.Install (wifiPhy, wifiMac, wifiApNodes.Get (0)));
264
265
      Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/BeMaxAmpduSize", UintegerValue (BeMaxAmpduSize));
266
    }
266
    }
267
  else if (standard == "802.11ac")
267
  else if (standard == "802.11ac")
268
    {
268
    {
 Lines 274-281   int main (int argc, char *argv[]) Link Here 
274
274
275
      Ssid ssid = Ssid ("AP");
275
      Ssid ssid = Ssid ("AP");
276
      wifiMac.SetType ("ns3::StaWifiMac",
276
      wifiMac.SetType ("ns3::StaWifiMac",
277
                       "Ssid", SsidValue (ssid),
277
                       "Ssid", SsidValue (ssid));
278
                       "BE_MaxAmpduSize", UintegerValue (BE_MaxAmpduSize));
279
      wifiStaDevices.Add (wifi.Install (wifiPhy, wifiMac, wifiStaNodes.Get (0)));
278
      wifiStaDevices.Add (wifi.Install (wifiPhy, wifiMac, wifiStaNodes.Get (0)));
280
279
281
      //Configure the AP node
280
      //Configure the AP node
 Lines 283-291   int main (int argc, char *argv[]) Link Here 
283
282
284
      ssid = Ssid ("AP");
283
      ssid = Ssid ("AP");
285
      wifiMac.SetType ("ns3::ApWifiMac",
284
      wifiMac.SetType ("ns3::ApWifiMac",
286
                       "Ssid", SsidValue (ssid),
285
                       "Ssid", SsidValue (ssid));
287
                       "BE_MaxAmpduSize", UintegerValue (BE_MaxAmpduSize));
288
      wifiApDevices.Add (wifi.Install (wifiPhy, wifiMac, wifiApNodes.Get (0)));
286
      wifiApDevices.Add (wifi.Install (wifiPhy, wifiMac, wifiApNodes.Get (0)));
287
288
      Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/VhtConfiguration/BeMaxAmpduSize", UintegerValue (BeMaxAmpduSize));
289
    }
289
    }
290
290
291
  wifiDevices.Add (wifiStaDevices);
291
  wifiDevices.Add (wifiStaDevices);
(-)a/examples/wireless/simple-ht-hidden-stations.cc (-4 / +4 lines)
 Lines 107-126   int main (int argc, char *argv[]) Link Here 
107
107
108
  Ssid ssid = Ssid ("simple-mpdu-aggregation");
108
  Ssid ssid = Ssid ("simple-mpdu-aggregation");
109
  mac.SetType ("ns3::StaWifiMac",
109
  mac.SetType ("ns3::StaWifiMac",
110
               "Ssid", SsidValue (ssid),
110
               "Ssid", SsidValue (ssid));
111
               "BE_MaxAmpduSize", UintegerValue (maxAmpduSize));
112
111
113
  NetDeviceContainer staDevices;
112
  NetDeviceContainer staDevices;
114
  staDevices = wifi.Install (phy, mac, wifiStaNodes);
113
  staDevices = wifi.Install (phy, mac, wifiStaNodes);
115
114
116
  mac.SetType ("ns3::ApWifiMac",
115
  mac.SetType ("ns3::ApWifiMac",
117
               "Ssid", SsidValue (ssid),
116
               "Ssid", SsidValue (ssid),
118
               "EnableBeaconJitter", BooleanValue (false),
117
               "EnableBeaconJitter", BooleanValue (false));
119
               "BE_MaxAmpduSize", UintegerValue (maxAmpduSize));
120
118
121
  NetDeviceContainer apDevice;
119
  NetDeviceContainer apDevice;
122
  apDevice = wifi.Install (phy, mac, wifiApNode);
120
  apDevice = wifi.Install (phy, mac, wifiApNode);
123
121
122
  Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/BeMaxAmpduSize", UintegerValue (maxAmpduSize));
123
124
  // Setting mobility model
124
  // Setting mobility model
125
  MobilityHelper mobility;
125
  MobilityHelper mobility;
126
  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
126
  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
(-)a/examples/wireless/wifi-aggregation.cc (-19 / +58 lines)
 Lines 32-37    Link Here 
32
#include "ns3/udp-client-server-helper.h"
32
#include "ns3/udp-client-server-helper.h"
33
#include "ns3/packet-sink-helper.h"
33
#include "ns3/packet-sink-helper.h"
34
#include "ns3/yans-wifi-channel.h"
34
#include "ns3/yans-wifi-channel.h"
35
#include "ns3/wifi-net-device.h"
36
#include "ns3/ht-configuration.h"
35
37
36
// This is an example that illustrates how 802.11n aggregation is configured.
38
// This is an example that illustrates how 802.11n aggregation is configured.
37
// It defines 4 independent Wi-Fi networks (working on different channels).
39
// It defines 4 independent Wi-Fi networks (working on different channels).
 Lines 109-115   int main (int argc, char *argv[]) Link Here 
109
  NetDeviceContainer staDeviceA, staDeviceB, staDeviceC, staDeviceD, apDeviceA, apDeviceB, apDeviceC, apDeviceD;
111
  NetDeviceContainer staDeviceA, staDeviceB, staDeviceC, staDeviceD, apDeviceA, apDeviceB, apDeviceC, apDeviceD;
110
  Ssid ssid;
112
  Ssid ssid;
111
113
112
  //Network A
114
  // Network A
113
  ssid = Ssid ("network-A");
115
  ssid = Ssid ("network-A");
114
  phy.Set ("ChannelNumber", UintegerValue (36));
116
  phy.Set ("ChannelNumber", UintegerValue (36));
115
  mac.SetType ("ns3::StaWifiMac",
117
  mac.SetType ("ns3::StaWifiMac",
 Lines 121-181   int main (int argc, char *argv[]) Link Here 
121
               "EnableBeaconJitter", BooleanValue (false));
123
               "EnableBeaconJitter", BooleanValue (false));
122
  apDeviceA = wifi.Install (phy, mac, wifiApNodes.Get (0));
124
  apDeviceA = wifi.Install (phy, mac, wifiApNodes.Get (0));
123
125
124
  //Network B
126
  // Network B
125
  ssid = Ssid ("network-B");
127
  ssid = Ssid ("network-B");
126
  phy.Set ("ChannelNumber", UintegerValue (40));
128
  phy.Set ("ChannelNumber", UintegerValue (40));
127
  mac.SetType ("ns3::StaWifiMac",
129
  mac.SetType ("ns3::StaWifiMac",
128
               "Ssid", SsidValue (ssid),
130
               "Ssid", SsidValue (ssid));
129
               "BE_MaxAmpduSize", UintegerValue (0)); //Disable A-MPDU
130
131
131
  staDeviceB = wifi.Install (phy, mac, wifiStaNodes.Get (1));
132
  staDeviceB = wifi.Install (phy, mac, wifiStaNodes.Get (1));
133
  
134
  // Disable A-MPDU
135
  Ptr<NetDevice> dev = wifiStaNodes.Get (1)->GetDevice (0);
136
  Ptr<WifiNetDevice> wifi_dev = DynamicCast<WifiNetDevice> (dev);
137
  Ptr<HtConfiguration> htConfiguration = wifi_dev->GetHtConfiguration ();
138
  htConfiguration->SetAttribute ("BeMaxAmpduSize", UintegerValue (0));
132
139
133
  mac.SetType ("ns3::ApWifiMac",
140
  mac.SetType ("ns3::ApWifiMac",
134
               "Ssid", SsidValue (ssid),
141
               "Ssid", SsidValue (ssid),
135
               "EnableBeaconJitter", BooleanValue (false));
142
               "EnableBeaconJitter", BooleanValue (false));
136
  apDeviceB = wifi.Install (phy, mac, wifiApNodes.Get (1));
143
  apDeviceB = wifi.Install (phy, mac, wifiApNodes.Get (1));
137
144
  
138
  //Network C
145
  // Disable A-MPDU
146
  dev = wifiApNodes.Get (1)->GetDevice (0);
147
  wifi_dev = DynamicCast<WifiNetDevice> (dev);
148
  htConfiguration = wifi_dev->GetHtConfiguration ();
149
  htConfiguration->SetAttribute ("BeMaxAmpduSize", UintegerValue (0));
150
151
  // Network C
139
  ssid = Ssid ("network-C");
152
  ssid = Ssid ("network-C");
140
  phy.Set ("ChannelNumber", UintegerValue (44));
153
  phy.Set ("ChannelNumber", UintegerValue (44));
141
  mac.SetType ("ns3::StaWifiMac",
154
  mac.SetType ("ns3::StaWifiMac",
142
               "Ssid", SsidValue (ssid),
155
               "Ssid", SsidValue (ssid));
143
               "BE_MaxAmpduSize", UintegerValue (0), //Disable A-MPDU
144
               "BE_MaxAmsduSize", UintegerValue (7935)); //Enable A-MSDU with the highest maximum size allowed by the standard (7935 bytes)
145
156
146
  staDeviceC = wifi.Install (phy, mac, wifiStaNodes.Get (2));
157
  staDeviceC = wifi.Install (phy, mac, wifiStaNodes.Get (2));
147
158
159
  // Disable A-MPDU and enable A-MSDU with the highest maximum size allowed by the standard (7935 bytes)
160
  dev = wifiStaNodes.Get (2)->GetDevice (0);
161
  wifi_dev = DynamicCast<WifiNetDevice> (dev);
162
  htConfiguration = wifi_dev->GetHtConfiguration ();
163
  htConfiguration->SetAttribute ("BeMaxAmpduSize", UintegerValue (0));
164
  htConfiguration->SetAttribute ("BeMaxAmsduSize", UintegerValue (7935));
165
148
  mac.SetType ("ns3::ApWifiMac",
166
  mac.SetType ("ns3::ApWifiMac",
149
               "Ssid", SsidValue (ssid),
167
               "Ssid", SsidValue (ssid),
150
               "EnableBeaconJitter", BooleanValue (false));
168
               "EnableBeaconJitter", BooleanValue (false));
151
  apDeviceC = wifi.Install (phy, mac, wifiApNodes.Get (2));
169
  apDeviceC = wifi.Install (phy, mac, wifiApNodes.Get (2));
152
170
153
  //Network D
171
  // Disable A-MPDU and enable A-MSDU with the highest maximum size allowed by the standard (7935 bytes)
172
  dev = wifiApNodes.Get (2)->GetDevice (0);
173
  wifi_dev = DynamicCast<WifiNetDevice> (dev);
174
  htConfiguration = wifi_dev->GetHtConfiguration ();
175
  htConfiguration->SetAttribute ("BeMaxAmpduSize", UintegerValue (0));
176
  htConfiguration->SetAttribute ("BeMaxAmsduSize", UintegerValue (7935));
177
178
  // Network D
154
  ssid = Ssid ("network-D");
179
  ssid = Ssid ("network-D");
155
  phy.Set ("ChannelNumber", UintegerValue (48));
180
  phy.Set ("ChannelNumber", UintegerValue (48));
156
  mac.SetType ("ns3::StaWifiMac",
181
  mac.SetType ("ns3::StaWifiMac",
157
               "Ssid", SsidValue (ssid),
182
               "Ssid", SsidValue (ssid));
158
               "BE_MaxAmpduSize", UintegerValue (32768), //Enable A-MPDU with a smaller size than the default one
159
               "BE_MaxAmsduSize", UintegerValue (3839)); //Enable A-MSDU with the smallest maximum size allowed by the standard (3839 bytes)
160
183
161
  staDeviceD = wifi.Install (phy, mac, wifiStaNodes.Get (3));
184
  staDeviceD = wifi.Install (phy, mac, wifiStaNodes.Get (3));
162
185
186
  // Enable A-MPDU with a smaller size than the default one and
187
  // enable A-MSDU with the smallest maximum size allowed by the standard (3839 bytes)
188
  dev = wifiStaNodes.Get (3)->GetDevice (0);
189
  wifi_dev = DynamicCast<WifiNetDevice> (dev);
190
  htConfiguration = wifi_dev->GetHtConfiguration ();
191
  htConfiguration->SetAttribute ("BeMaxAmpduSize", UintegerValue (32768));
192
  htConfiguration->SetAttribute ("BeMaxAmsduSize", UintegerValue (3839));
193
163
  mac.SetType ("ns3::ApWifiMac",
194
  mac.SetType ("ns3::ApWifiMac",
164
               "Ssid", SsidValue (ssid),
195
               "Ssid", SsidValue (ssid),
165
               "EnableBeaconJitter", BooleanValue (false));
196
               "EnableBeaconJitter", BooleanValue (false));
166
  apDeviceD = wifi.Install (phy, mac, wifiApNodes.Get (3));
197
  apDeviceD = wifi.Install (phy, mac, wifiApNodes.Get (3));
167
198
168
  /* Setting mobility model */
199
  // Enable A-MPDU with a smaller size than the default one and
200
  // enable A-MSDU with the smallest maximum size allowed by the standard (3839 bytes)
201
  dev = wifiApNodes.Get (3)->GetDevice (0);
202
  wifi_dev = DynamicCast<WifiNetDevice> (dev);
203
  htConfiguration = wifi_dev->GetHtConfiguration ();
204
  htConfiguration->SetAttribute ("BeMaxAmpduSize", UintegerValue (32768));
205
  htConfiguration->SetAttribute ("BeMaxAmsduSize", UintegerValue (3839));
206
207
  // Setting mobility model
169
  MobilityHelper mobility;
208
  MobilityHelper mobility;
170
  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
209
  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
171
  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
210
  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
172
211
173
  //Set position for APs
212
  // Set position for APs
174
  positionAlloc->Add (Vector (0.0, 0.0, 0.0));
213
  positionAlloc->Add (Vector (0.0, 0.0, 0.0));
175
  positionAlloc->Add (Vector (10.0, 0.0, 0.0));
214
  positionAlloc->Add (Vector (10.0, 0.0, 0.0));
176
  positionAlloc->Add (Vector (20.0, 0.0, 0.0));
215
  positionAlloc->Add (Vector (20.0, 0.0, 0.0));
177
  positionAlloc->Add (Vector (30.0, 0.0, 0.0));
216
  positionAlloc->Add (Vector (30.0, 0.0, 0.0));
178
  //Set position for STAs
217
  // Set position for STAs
179
  positionAlloc->Add (Vector (distance, 0.0, 0.0));
218
  positionAlloc->Add (Vector (distance, 0.0, 0.0));
180
  positionAlloc->Add (Vector (10 + distance, 0.0, 0.0));
219
  positionAlloc->Add (Vector (10 + distance, 0.0, 0.0));
181
  positionAlloc->Add (Vector (20 + distance, 0.0, 0.0));
220
  positionAlloc->Add (Vector (20 + distance, 0.0, 0.0));
 Lines 185-191   int main (int argc, char *argv[]) Link Here 
185
  mobility.Install (wifiApNodes);
224
  mobility.Install (wifiApNodes);
186
  mobility.Install (wifiStaNodes);
225
  mobility.Install (wifiStaNodes);
187
226
188
  /* Internet stack */
227
  // Internet stack
189
  InternetStackHelper stack;
228
  InternetStackHelper stack;
190
  stack.Install (wifiApNodes);
229
  stack.Install (wifiApNodes);
191
  stack.Install (wifiStaNodes);
230
  stack.Install (wifiStaNodes);
 Lines 215-221   int main (int argc, char *argv[]) Link Here 
215
  Ipv4InterfaceContainer ApInterfaceD;
254
  Ipv4InterfaceContainer ApInterfaceD;
216
  ApInterfaceD = address.Assign (apDeviceD);
255
  ApInterfaceD = address.Assign (apDeviceD);
217
256
218
  /* Setting applications */
257
  // Setting applications
219
  uint16_t port = 9;
258
  uint16_t port = 9;
220
  UdpServerHelper serverA (port);
259
  UdpServerHelper serverA (port);
221
  ApplicationContainer serverAppA = serverA.Install (wifiStaNodes.Get (0));
260
  ApplicationContainer serverAppA = serverA.Install (wifiStaNodes.Get (0));
 Lines 288-294   int main (int argc, char *argv[]) Link Here 
288
  Simulator::Stop (Seconds (simulationTime + 1));
327
  Simulator::Stop (Seconds (simulationTime + 1));
289
  Simulator::Run ();
328
  Simulator::Run ();
290
329
291
  /* Show results */
330
  // Show results
292
  uint64_t totalPacketsThroughA = DynamicCast<UdpServer> (serverAppA.Get (0))->GetReceived ();
331
  uint64_t totalPacketsThroughA = DynamicCast<UdpServer> (serverAppA.Get (0))->GetReceived ();
293
  uint64_t totalPacketsThroughB = DynamicCast<UdpServer> (serverAppB.Get (0))->GetReceived ();
332
  uint64_t totalPacketsThroughB = DynamicCast<UdpServer> (serverAppB.Get (0))->GetReceived ();
294
  uint64_t totalPacketsThroughC = DynamicCast<UdpServer> (serverAppC.Get (0))->GetReceived ();
333
  uint64_t totalPacketsThroughC = DynamicCast<UdpServer> (serverAppC.Get (0))->GetReceived ();
(-)a/src/wifi/doc/source/wifi-user.rst (+7 lines)
 Lines 790-795   attributes for 802.11ax devices. Link Here 
790
 Ptr<HeConfiguration> heConfiguration = wnd->GetHeConfiguration ();
790
 Ptr<HeConfiguration> heConfiguration = wnd->GetHeConfiguration ();
791
 heConfiguration->SetGuardInterval (NanoSeconds (1600));
791
 heConfiguration->SetGuardInterval (NanoSeconds (1600));
792
792
793
 802.11ax allows extended compressed Block ACKs containing a 256-bits bitmap, making possible transmissions of A-MPDUs containing up to 256 MPDUs,
794
 depending on the negotiated buffer size. In order to configure the buffer size of an 802.11ax device, the following line of code could be used::
795
796
 heConfiguration->SetMpduBufferSize (256);
797
798
 For transmitting large MPDUs, it might also be needed to increase the maximum aggregation size (see above).
799
793
Mobility configuration
800
Mobility configuration
794
======================
801
======================
795
802
(-)a/src/wifi/examples/wifi-manager-example.cc (-6 / +7 lines)
 Lines 357-374   int main (int argc, char *argv[]) Link Here 
357
    {
357
    {
358
      Ssid ssid = Ssid ("ns-3-ssid");
358
      Ssid ssid = Ssid ("ns-3-ssid");
359
      wifiMac.SetType ("ns3::StaWifiMac",
359
      wifiMac.SetType ("ns3::StaWifiMac",
360
                       "Ssid", SsidValue (ssid),
360
                       "Ssid", SsidValue (ssid));
361
                       "BE_MaxAmpduSize", UintegerValue (maxAmpduSize));
362
      serverDevice = wifi.Install (wifiPhy, wifiMac, serverNode);
361
      serverDevice = wifi.Install (wifiPhy, wifiMac, serverNode);
363
      wifiMac.SetType ("ns3::ApWifiMac",
362
      wifiMac.SetType ("ns3::ApWifiMac",
364
                       "Ssid", SsidValue (ssid),
363
                       "Ssid", SsidValue (ssid));
365
                       "BE_MaxAmpduSize", UintegerValue (maxAmpduSize));
366
      clientDevice = wifi.Install (wifiPhy, wifiMac, clientNode);
364
      clientDevice = wifi.Install (wifiPhy, wifiMac, clientNode);
367
    }
365
    }
368
  else
366
  else
369
    {
367
    {
370
      wifiMac.SetType ("ns3::AdhocWifiMac",
368
      wifiMac.SetType ("ns3::AdhocWifiMac");
371
                       "BE_MaxAmpduSize", UintegerValue (maxAmpduSize));
372
      serverDevice = wifi.Install (wifiPhy, wifiMac, serverNode);
369
      serverDevice = wifi.Install (wifiPhy, wifiMac, serverNode);
373
      clientDevice = wifi.Install (wifiPhy, wifiMac, clientNode);
370
      clientDevice = wifi.Install (wifiPhy, wifiMac, clientNode);
374
    }
371
    }
 Lines 378-383   int main (int argc, char *argv[]) Link Here 
378
  wifi.AssignStreams (serverDevice, 100);
375
  wifi.AssignStreams (serverDevice, 100);
379
  wifi.AssignStreams (clientDevice, 100);
376
  wifi.AssignStreams (clientDevice, 100);
380
377
378
  Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/BeMaxAmpduSize", UintegerValue (maxAmpduSize));
379
  Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/VhtConfiguration/BeMaxAmpduSize", UintegerValue (maxAmpduSize));
380
  Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HeConfiguration/BeMaxAmpduSize", UintegerValue (maxAmpduSize));
381
381
  Config::ConnectWithoutContext ("/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/RemoteStationManager/$ns3::" + wifiManager + "WifiManager/Rate", MakeCallback (&RateChange));
382
  Config::ConnectWithoutContext ("/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/RemoteStationManager/$ns3::" + wifiManager + "WifiManager/Rate", MakeCallback (&RateChange));
382
383
383
  // Configure the mobility.
384
  // Configure the mobility.
(-)a/src/wifi/model/ampdu-tag.cc (-1 lines)
 Lines 51-57   AmpduTag::AmpduTag () Link Here 
51
void
51
void
52
AmpduTag::SetRemainingNbOfMpdus (uint8_t nbofmpdus)
52
AmpduTag::SetRemainingNbOfMpdus (uint8_t nbofmpdus)
53
{
53
{
54
  NS_ASSERT (nbofmpdus <= 64);
55
  m_nbOfMpdus = nbofmpdus;
54
  m_nbOfMpdus = nbofmpdus;
56
}
55
}
57
56
(-)a/src/wifi/model/block-ack-agreement.cc (-12 / +4 lines)
 Lines 26-39   namespace ns3 { Link Here 
26
NS_LOG_COMPONENT_DEFINE ("BlockAckAgreement");
26
NS_LOG_COMPONENT_DEFINE ("BlockAckAgreement");
27
27
28
BlockAckAgreement::BlockAckAgreement (Mac48Address peer, uint8_t tid)
28
BlockAckAgreement::BlockAckAgreement (Mac48Address peer, uint8_t tid)
29
  : m_amsduSupported (0),
29
  : m_peer (peer),
30
    m_amsduSupported (0),
30
    m_blockAckPolicy (1),
31
    m_blockAckPolicy (1),
32
    m_tid (tid),
31
    m_htSupported (0),
33
    m_htSupported (0),
32
    m_inactivityEvent ()
34
    m_inactivityEvent ()
33
{
35
{
34
  NS_LOG_FUNCTION (this << peer << +tid);
36
  NS_LOG_FUNCTION (this << peer << +tid);
35
  m_tid = tid;
36
  m_peer = peer;
37
}
37
}
38
38
39
BlockAckAgreement::~BlockAckAgreement ()
39
BlockAckAgreement::~BlockAckAgreement ()
 Lines 46-52   void Link Here 
46
BlockAckAgreement::SetBufferSize (uint16_t bufferSize)
46
BlockAckAgreement::SetBufferSize (uint16_t bufferSize)
47
{
47
{
48
  NS_LOG_FUNCTION (this << bufferSize);
48
  NS_LOG_FUNCTION (this << bufferSize);
49
  NS_ASSERT (bufferSize <= 1024);
49
  NS_ASSERT (bufferSize <= 256);
50
  NS_ASSERT (bufferSize % 16 == 0);
50
  NS_ASSERT (bufferSize % 16 == 0);
51
  m_bufferSize = bufferSize;
51
  m_bufferSize = bufferSize;
52
}
52
}
 Lines 98-104   BlockAckAgreement::SetAmsduSupport (bool supported) Link Here 
98
uint8_t
98
uint8_t
99
BlockAckAgreement::GetTid (void) const
99
BlockAckAgreement::GetTid (void) const
100
{
100
{
101
  NS_LOG_FUNCTION (this);
102
  return m_tid;
101
  return m_tid;
103
}
102
}
104
103
 Lines 112-139   BlockAckAgreement::GetPeer (void) const Link Here 
112
uint16_t
111
uint16_t
113
BlockAckAgreement::GetBufferSize (void) const
112
BlockAckAgreement::GetBufferSize (void) const
114
{
113
{
115
  NS_LOG_FUNCTION (this);
116
  return m_bufferSize;
114
  return m_bufferSize;
117
}
115
}
118
116
119
uint16_t
117
uint16_t
120
BlockAckAgreement::GetTimeout (void) const
118
BlockAckAgreement::GetTimeout (void) const
121
{
119
{
122
  NS_LOG_FUNCTION (this);
123
  return m_timeout;
120
  return m_timeout;
124
}
121
}
125
122
126
uint16_t
123
uint16_t
127
BlockAckAgreement::GetStartingSequence (void) const
124
BlockAckAgreement::GetStartingSequence (void) const
128
{
125
{
129
  NS_LOG_FUNCTION (this);
130
  return m_startingSeq;
126
  return m_startingSeq;
131
}
127
}
132
128
133
uint16_t
129
uint16_t
134
BlockAckAgreement::GetStartingSequenceControl (void) const
130
BlockAckAgreement::GetStartingSequenceControl (void) const
135
{
131
{
136
  NS_LOG_FUNCTION (this);
137
  uint16_t seqControl = (m_startingSeq << 4) & 0xfff0;
132
  uint16_t seqControl = (m_startingSeq << 4) & 0xfff0;
138
  return seqControl;
133
  return seqControl;
139
}
134
}
 Lines 141-154   BlockAckAgreement::GetStartingSequenceControl (void) const Link Here 
141
bool
136
bool
142
BlockAckAgreement::IsImmediateBlockAck (void) const
137
BlockAckAgreement::IsImmediateBlockAck (void) const
143
{
138
{
144
  NS_LOG_FUNCTION (this);
145
  return (m_blockAckPolicy == 1);
139
  return (m_blockAckPolicy == 1);
146
}
140
}
147
141
148
bool
142
bool
149
BlockAckAgreement::IsAmsduSupported (void) const
143
BlockAckAgreement::IsAmsduSupported (void) const
150
{
144
{
151
  NS_LOG_FUNCTION (this);
152
  return (m_amsduSupported == 1) ? true : false;
145
  return (m_amsduSupported == 1) ? true : false;
153
}
146
}
154
147
 Lines 174-180   BlockAckAgreement::SetHtSupported (bool htSupported) Link Here 
174
bool
167
bool
175
BlockAckAgreement::IsHtSupported (void) const
168
BlockAckAgreement::IsHtSupported (void) const
176
{
169
{
177
  NS_LOG_FUNCTION (this);
178
  return (m_htSupported == 1) ? true : false;
170
  return (m_htSupported == 1) ? true : false;
179
}
171
}
180
172
(-)a/src/wifi/model/block-ack-cache.cc (-2 / +2 lines)
 Lines 36-42   BlockAckCache::Init (uint16_t winStart, uint16_t winSize) Link Here 
36
{
36
{
37
  NS_LOG_FUNCTION (this << winStart << winSize);
37
  NS_LOG_FUNCTION (this << winStart << winSize);
38
  m_winStart = winStart;
38
  m_winStart = winStart;
39
  m_winSize = winSize <= 64 ? winSize : 64;
39
  m_winSize = winSize;
40
  m_winEnd = (m_winStart + m_winSize - 1) % 4096;
40
  m_winEnd = (m_winStart + m_winSize - 1) % 4096;
41
  memset (m_bitmap, 0, sizeof (m_bitmap));
41
  memset (m_bitmap, 0, sizeof (m_bitmap));
42
}
42
}
 Lines 119-125   BlockAckCache::FillBlockAckBitmap (CtrlBAckResponseHeader *blockAckHeader) Link Here 
119
    {
119
    {
120
      NS_FATAL_ERROR ("Basic block ack is only partially implemented.");
120
      NS_FATAL_ERROR ("Basic block ack is only partially implemented.");
121
    }
121
    }
122
  else if (blockAckHeader->IsCompressed ())
122
  else if (blockAckHeader->IsCompressed () || blockAckHeader->IsExtendedCompressed ())
123
    {
123
    {
124
      uint16_t i = blockAckHeader->GetStartingSequence ();
124
      uint16_t i = blockAckHeader->GetStartingSequence ();
125
      uint16_t end = (i + m_winSize - 1) % 4096;
125
      uint16_t end = (i + m_winSize - 1) % 4096;
(-)a/src/wifi/model/block-ack-manager.cc (-17 / +18 lines)
 Lines 122-128   BlockAckManager::CreateAgreement (const MgtAddBaRequestHeader *reqHdr, Mac48Addr Link Here 
122
  agreement.SetStartingSequence (reqHdr->GetStartingSequence ());
122
  agreement.SetStartingSequence (reqHdr->GetStartingSequence ());
123
  /* For now we assume that originator doesn't use this field. Use of this field
123
  /* For now we assume that originator doesn't use this field. Use of this field
124
     is mandatory only for recipient */
124
     is mandatory only for recipient */
125
  agreement.SetBufferSize (64);
125
  agreement.SetBufferSize (reqHdr->GetBufferSize());
126
  agreement.SetWinEnd ((agreement.GetStartingSequence () + agreement.GetBufferSize () - 1) % 4096);
126
  agreement.SetWinEnd ((agreement.GetStartingSequence () + agreement.GetBufferSize () - 1) % 4096);
127
  agreement.SetTimeout (reqHdr->GetTimeout ());
127
  agreement.SetTimeout (reqHdr->GetTimeout ());
128
  agreement.SetAmsduSupport (reqHdr->IsAmsduSupported ());
128
  agreement.SetAmsduSupport (reqHdr->IsAmsduSupported ());
 Lines 518-524   BlockAckManager::AlreadyExists (uint16_t currentSeq, Mac48Address recipient, uin Link Here 
518
  std::list<PacketQueueI>::const_iterator it = m_retryPackets.begin ();
518
  std::list<PacketQueueI>::const_iterator it = m_retryPackets.begin ();
519
  while (it != m_retryPackets.end ())
519
  while (it != m_retryPackets.end ())
520
    {
520
    {
521
      NS_LOG_FUNCTION (this << (*it)->hdr.GetType ());
522
      if (!(*it)->hdr.IsQosData ())
521
      if (!(*it)->hdr.IsQosData ())
523
        {
522
        {
524
          NS_FATAL_ERROR ("Packet in blockAck manager retry queue is not Qos Data");
523
          NS_FATAL_ERROR ("Packet in blockAck manager retry queue is not Qos Data");
 Lines 588-594   BlockAckManager::NotifyGotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac4 Link Here 
588
                    }
587
                    }
589
                }
588
                }
590
            }
589
            }
591
          else if (blockAck->IsCompressed ())
590
          else if (blockAck->IsCompressed () || blockAck->IsExtendedCompressed ())
592
            {
591
            {
593
              for (PacketQueueI queueIt = it->second.second.begin (); queueIt != queueEnd; )
592
              for (PacketQueueI queueIt = it->second.second.begin (); queueIt != queueEnd; )
594
                {
593
                {
 Lines 671-690   BlockAckManager::ScheduleBlockAckReqIfNeeded (Mac48Address recipient, uint8_t ti Link Here 
671
      agreement.CompleteExchange ();
670
      agreement.CompleteExchange ();
672
671
673
      CtrlBAckRequestHeader reqHdr;
672
      CtrlBAckRequestHeader reqHdr;
674
      if (m_blockAckType == BASIC_BLOCK_ACK || m_blockAckType == COMPRESSED_BLOCK_ACK)
673
      reqHdr.SetType (m_blockAckType);
675
        {
674
      reqHdr.SetTidInfo (agreement.GetTid ());
676
          reqHdr.SetType (m_blockAckType);
675
      reqHdr.SetStartingSequence (agreement.GetStartingSequence ());
677
          reqHdr.SetTidInfo (agreement.GetTid ());
676
678
          reqHdr.SetStartingSequence (agreement.GetStartingSequence ());
679
        }
680
      else if (m_blockAckType == MULTI_TID_BLOCK_ACK)
681
        {
682
          NS_FATAL_ERROR ("Multi-tid block ack is not supported.");
683
        }
684
      else
685
        {
686
          NS_FATAL_ERROR ("Invalid block ack type.");
687
        }
688
      Ptr<Packet> bar = Create<Packet> ();
677
      Ptr<Packet> bar = Create<Packet> ();
689
      bar->AddHeader (reqHdr);
678
      bar->AddHeader (reqHdr);
690
      return bar;
679
      return bar;
 Lines 951-954   BlockAckManager::InsertInRetryQueue (PacketQueueI item) Link Here 
951
    }
940
    }
952
}
941
}
953
942
943
uint16_t
944
BlockAckManager::GetRecipientBufferSize (Mac48Address recipient, uint8_t tid) const
945
{
946
  uint16_t size = 0;
947
  AgreementsCI it = m_agreements.find (std::make_pair (recipient, tid));
948
  if (it != m_agreements.end ())
949
    {
950
      size = it->second.first.GetBufferSize ();
951
    }
952
  return size;
953
}
954
954
} //namespace ns3
955
} //namespace ns3
(-)a/src/wifi/model/block-ack-manager.h (+9 lines)
 Lines 361-366   public: Link Here 
361
   * \returns true if BAR retransmission needed
361
   * \returns true if BAR retransmission needed
362
   */
362
   */
363
  bool NeedBarRetransmission (uint8_t tid, uint16_t seqNumber, Mac48Address recipient);
363
  bool NeedBarRetransmission (uint8_t tid, uint16_t seqNumber, Mac48Address recipient);
364
  /**
365
   * This function returns the buffer size negociated with the recipient.
366
   *
367
   * \param tid Traffic ID
368
   * \param recipient MAC address
369
   *
370
   * \returns the buffer size negociated with the recipient
371
   */
372
  uint16_t GetRecipientBufferSize (Mac48Address recipient, uint8_t tid) const;
364
373
365
  /**
374
  /**
366
   * typedef for a callback to invoke when a
375
   * typedef for a callback to invoke when a
(-)a/src/wifi/model/block-ack-type.h (-1 / +2 lines)
 Lines 31-37   enum BlockAckType Link Here 
31
{
31
{
32
  BASIC_BLOCK_ACK,
32
  BASIC_BLOCK_ACK,
33
  COMPRESSED_BLOCK_ACK,
33
  COMPRESSED_BLOCK_ACK,
34
  MULTI_TID_BLOCK_ACK
34
  EXTENDED_COMPRESSED_BLOCK_ACK,
35
  MULTI_TID_BLOCK_ACK,
35
};
36
};
36
37
37
} //namespace ns3
38
} //namespace ns3
(-)a/src/wifi/model/ctrl-headers.cc (-230 / +298 lines)
 Lines 31-38   NS_OBJECT_ENSURE_REGISTERED (CtrlBAckRequestHeader); Link Here 
31
31
32
CtrlBAckRequestHeader::CtrlBAckRequestHeader ()
32
CtrlBAckRequestHeader::CtrlBAckRequestHeader ()
33
  : m_barAckPolicy (false),
33
  : m_barAckPolicy (false),
34
    m_multiTid (false),
34
    m_baType (BASIC_BLOCK_ACK)
35
    m_compressed (false)
36
{
35
{
37
}
36
}
38
37
 Lines 68-84   CtrlBAckRequestHeader::GetSerializedSize () const Link Here 
68
{
67
{
69
  uint32_t size = 0;
68
  uint32_t size = 0;
70
  size += 2; //Bar control
69
  size += 2; //Bar control
71
  if (!m_multiTid)
70
  switch (m_baType)
72
    {
71
    {
73
      size += 2; //Starting sequence control
72
      case BASIC_BLOCK_ACK:
74
    }
73
      case COMPRESSED_BLOCK_ACK:
75
  else if (m_compressed)
74
      case EXTENDED_COMPRESSED_BLOCK_ACK:
76
    {
75
        size += 2;
77
      size += (2 + 2) * (m_tidInfo + 1);  //Multi-tid block ack
76
        break;
78
    }
77
      case MULTI_TID_BLOCK_ACK:
79
  else
78
        size += (2 + 2) * (m_tidInfo + 1);
80
    {
79
        break;
81
      NS_FATAL_ERROR ("Reserved configuration.");
80
      default:
81
        NS_FATAL_ERROR ("Invalid BA type");
82
        break;
82
    }
83
    }
83
  return size;
84
  return size;
84
}
85
}
 Lines 88-104   CtrlBAckRequestHeader::Serialize (Buffer::Iterator start) const Link Here 
88
{
89
{
89
  Buffer::Iterator i = start;
90
  Buffer::Iterator i = start;
90
  i.WriteHtolsbU16 (GetBarControl ());
91
  i.WriteHtolsbU16 (GetBarControl ());
91
  if (!m_multiTid)
92
  switch (m_baType)
92
    {
93
      i.WriteHtolsbU16 (GetStartingSequenceControl ());
94
    }
95
  else if (m_compressed)
96
    {
97
      NS_FATAL_ERROR ("Multi-tid block ack is not supported.");
98
    }
99
  else
100
    {
93
    {
101
      NS_FATAL_ERROR ("Reserved configuration.");
94
      case BASIC_BLOCK_ACK:
95
      case COMPRESSED_BLOCK_ACK:
96
      case EXTENDED_COMPRESSED_BLOCK_ACK:
97
        i.WriteHtolsbU16 (GetStartingSequenceControl ());
98
        break;
99
      case MULTI_TID_BLOCK_ACK:
100
        NS_FATAL_ERROR ("Multi-tid block ack is not supported.");
101
        break;
102
      default:
103
        NS_FATAL_ERROR ("Invalid BA type");
104
        break;
102
    }
105
    }
103
}
106
}
104
107
 Lines 107-123   CtrlBAckRequestHeader::Deserialize (Buffer::Iterator start) Link Here 
107
{
110
{
108
  Buffer::Iterator i = start;
111
  Buffer::Iterator i = start;
109
  SetBarControl (i.ReadLsbtohU16 ());
112
  SetBarControl (i.ReadLsbtohU16 ());
110
  if (!m_multiTid)
113
  switch (m_baType)
111
    {
114
    {
112
      SetStartingSequenceControl (i.ReadLsbtohU16 ());
115
      case BASIC_BLOCK_ACK:
113
    }
116
      case COMPRESSED_BLOCK_ACK:
114
  else if (m_compressed)
117
      case EXTENDED_COMPRESSED_BLOCK_ACK:
115
    {
118
        SetStartingSequenceControl (i.ReadLsbtohU16 ());
116
      NS_FATAL_ERROR ("Multi-tid block ack is not supported.");
119
        break;
117
    }
120
      case MULTI_TID_BLOCK_ACK:
118
  else
121
        NS_FATAL_ERROR ("Multi-tid block ack is not supported.");
119
    {
122
        break;
120
      NS_FATAL_ERROR ("Reserved configuration.");
123
      default:
124
        NS_FATAL_ERROR ("Invalid BA type");
125
        break;
121
    }
126
    }
122
  return i.GetDistanceFrom (start);
127
  return i.GetDistanceFrom (start);
123
}
128
}
 Lines 126-142   uint16_t Link Here 
126
CtrlBAckRequestHeader::GetBarControl (void) const
131
CtrlBAckRequestHeader::GetBarControl (void) const
127
{
132
{
128
  uint16_t res = 0;
133
  uint16_t res = 0;
129
  if (m_barAckPolicy)
134
  switch (m_baType)
130
    {
135
    {
131
      res |= 0x1;
136
      case BASIC_BLOCK_ACK:
132
    }
137
        break;
133
  if (m_multiTid)
138
      case COMPRESSED_BLOCK_ACK:
134
    {
139
        res |= (0x02 << 1);
135
      res |= (0x1 << 1);
140
        break;
136
    }
141
      case EXTENDED_COMPRESSED_BLOCK_ACK:
137
  if (m_compressed)
142
        res |= (0x01 << 1);
138
    {
143
        break;
139
      res |= (0x1 << 2);
144
      case MULTI_TID_BLOCK_ACK:
145
        res |= (0x03 << 1);
146
        break;
147
      default:
148
        NS_FATAL_ERROR ("Invalid BA type");
149
        break;
140
    }
150
    }
141
  res |= (m_tidInfo << 12) & (0xf << 12);
151
  res |= (m_tidInfo << 12) & (0xf << 12);
142
  return res;
152
  return res;
 Lines 146-153   void Link Here 
146
CtrlBAckRequestHeader::SetBarControl (uint16_t bar)
156
CtrlBAckRequestHeader::SetBarControl (uint16_t bar)
147
{
157
{
148
  m_barAckPolicy = ((bar & 0x01) == 1) ? true : false;
158
  m_barAckPolicy = ((bar & 0x01) == 1) ? true : false;
149
  m_multiTid = (((bar >> 1) & 0x01) == 1) ? true : false;
159
  if (((bar >> 1) & 0x0f) == 0x03)
150
  m_compressed = (((bar >> 2) & 0x01) == 1) ? true : false;
160
    {
161
      m_baType = MULTI_TID_BLOCK_ACK;
162
    }
163
  else if (((bar >> 1) & 0x0f) == 0x01)
164
    {
165
      m_baType = EXTENDED_COMPRESSED_BLOCK_ACK;
166
    }
167
  else if (((bar >> 1) & 0x0f) == 0x02)
168
    {
169
      m_baType = COMPRESSED_BLOCK_ACK;
170
    }
171
  else
172
    {
173
      m_baType = BASIC_BLOCK_ACK;
174
    }
151
  m_tidInfo = (bar >> 12) & 0x0f;
175
  m_tidInfo = (bar >> 12) & 0x0f;
152
}
176
}
153
177
 Lines 172-195   CtrlBAckRequestHeader::SetHtImmediateAck (bool immediateAck) Link Here 
172
void
196
void
173
CtrlBAckRequestHeader::SetType (BlockAckType type)
197
CtrlBAckRequestHeader::SetType (BlockAckType type)
174
{
198
{
175
  switch (type)
199
  m_baType = type;
176
    {
200
}
177
    case BASIC_BLOCK_ACK:
201
178
      m_multiTid = false;
202
BlockAckType
179
      m_compressed = false;
203
CtrlBAckRequestHeader::GetType (void) const
180
      break;
204
{
181
    case COMPRESSED_BLOCK_ACK:
205
  return m_baType;
182
      m_multiTid = false;
183
      m_compressed = true;
184
      break;
185
    case MULTI_TID_BLOCK_ACK:
186
      m_multiTid = true;
187
      m_compressed = true;
188
      break;
189
    default:
190
      NS_FATAL_ERROR ("Invalid variant type");
191
      break;
192
    }
193
}
206
}
194
207
195
void
208
void
 Lines 226-244   CtrlBAckRequestHeader::GetStartingSequence (void) const Link Here 
226
bool
239
bool
227
CtrlBAckRequestHeader::IsBasic (void) const
240
CtrlBAckRequestHeader::IsBasic (void) const
228
{
241
{
229
  return (!m_multiTid && !m_compressed) ? true : false;
242
  return (m_baType == BASIC_BLOCK_ACK) ? true : false;
230
}
243
}
231
244
232
bool
245
bool
233
CtrlBAckRequestHeader::IsCompressed (void) const
246
CtrlBAckRequestHeader::IsCompressed (void) const
234
{
247
{
235
  return (!m_multiTid && m_compressed) ? true : false;
248
  return (m_baType == COMPRESSED_BLOCK_ACK) ? true : false;
249
}
250
251
bool
252
CtrlBAckRequestHeader::IsExtendedCompressed (void) const
253
{
254
  return (m_baType == EXTENDED_COMPRESSED_BLOCK_ACK) ? true : false;
236
}
255
}
237
256
238
bool
257
bool
239
CtrlBAckRequestHeader::IsMultiTid (void) const
258
CtrlBAckRequestHeader::IsMultiTid (void) const
240
{
259
{
241
  return (m_multiTid && m_compressed) ? true : false;
260
  return (m_baType == MULTI_TID_BLOCK_ACK) ? true : false;
242
}
261
}
243
262
244
263
 Lines 250-257   NS_OBJECT_ENSURE_REGISTERED (CtrlBAckResponseHeader); Link Here 
250
269
251
CtrlBAckResponseHeader::CtrlBAckResponseHeader ()
270
CtrlBAckResponseHeader::CtrlBAckResponseHeader ()
252
  : m_baAckPolicy (false),
271
  : m_baAckPolicy (false),
253
    m_multiTid (false),
272
    m_baType (BASIC_BLOCK_ACK)
254
    m_compressed (false)
255
{
273
{
256
  memset (&bitmap, 0, sizeof (bitmap));
274
  memset (&bitmap, 0, sizeof (bitmap));
257
}
275
}
 Lines 288-314   CtrlBAckResponseHeader::GetSerializedSize (void) const Link Here 
288
{
306
{
289
  uint32_t size = 0;
307
  uint32_t size = 0;
290
  size += 2; //Bar control
308
  size += 2; //Bar control
291
  if (!m_multiTid)
309
  switch (m_baType)
292
    {
310
    {
293
      if (!m_compressed)
311
      case BASIC_BLOCK_ACK:
294
        {
312
        size += (2 + 128);
295
          size += (2 + 128); //Basic block ack
313
        break;
296
        }
314
      case COMPRESSED_BLOCK_ACK:
297
      else
315
        size += (2 + 8);
298
        {
316
        break;
299
          size += (2 + 8); //Compressed block ack
317
      case EXTENDED_COMPRESSED_BLOCK_ACK:
300
        }
318
        size += (2 + 32);
301
    }
319
        break;
302
  else
320
      case MULTI_TID_BLOCK_ACK:
303
    {
321
        size += (2 + 2 + 8) * (m_tidInfo + 1); //Multi-tid block ack
304
      if (m_compressed)
322
        break;
305
        {
323
      default:
306
          size += (2 + 2 + 8) * (m_tidInfo + 1); //Multi-tid block ack
324
        NS_FATAL_ERROR ("Invalid BA type");
307
        }
325
        break;
308
      else
309
        {
310
          NS_FATAL_ERROR ("Reserved configuration.");
311
        }
312
    }
326
    }
313
  return size;
327
  return size;
314
}
328
}
 Lines 318-335   CtrlBAckResponseHeader::Serialize (Buffer::Iterator start) const Link Here 
318
{
332
{
319
  Buffer::Iterator i = start;
333
  Buffer::Iterator i = start;
320
  i.WriteHtolsbU16 (GetBaControl ());
334
  i.WriteHtolsbU16 (GetBaControl ());
321
  if (!m_multiTid)
335
  switch (m_baType)
322
    {
323
      i.WriteHtolsbU16 (GetStartingSequenceControl ());
324
      i = SerializeBitmap (i);
325
    }
326
  else if (m_compressed)
327
    {
328
      NS_FATAL_ERROR ("Multi-tid block ack is not supported.");
329
    }
330
  else
331
    {
336
    {
332
      NS_FATAL_ERROR ("Reserved configuration.");
337
      case BASIC_BLOCK_ACK:
338
      case COMPRESSED_BLOCK_ACK:
339
      case EXTENDED_COMPRESSED_BLOCK_ACK:
340
        i.WriteHtolsbU16 (GetStartingSequenceControl ());
341
        i = SerializeBitmap (i);
342
        break;
343
      case MULTI_TID_BLOCK_ACK:
344
        NS_FATAL_ERROR ("Multi-tid block ack is not supported.");
345
        break;
346
      default:
347
        NS_FATAL_ERROR ("Invalid BA type");
348
        break;
333
    }
349
    }
334
}
350
}
335
351
 Lines 338-355   CtrlBAckResponseHeader::Deserialize (Buffer::Iterator start) Link Here 
338
{
354
{
339
  Buffer::Iterator i = start;
355
  Buffer::Iterator i = start;
340
  SetBaControl (i.ReadLsbtohU16 ());
356
  SetBaControl (i.ReadLsbtohU16 ());
341
  if (!m_multiTid)
357
  switch (m_baType)
342
    {
358
    {
343
      SetStartingSequenceControl (i.ReadLsbtohU16 ());
359
      case BASIC_BLOCK_ACK:
344
      i = DeserializeBitmap (i);
360
      case COMPRESSED_BLOCK_ACK:
345
    }
361
      case EXTENDED_COMPRESSED_BLOCK_ACK:
346
  else if (m_compressed)
362
        SetStartingSequenceControl (i.ReadLsbtohU16 ());
347
    {
363
        i = DeserializeBitmap (i);
348
      NS_FATAL_ERROR ("Multi-tid block ack is not supported.");
364
        break;
349
    }
365
      case MULTI_TID_BLOCK_ACK:
350
  else
366
        NS_FATAL_ERROR ("Multi-tid block ack is not supported.");
351
    {
367
        break;
352
      NS_FATAL_ERROR ("Reserved configuration.");
368
      default:
369
        NS_FATAL_ERROR ("Invalid BA type");
370
        break;
353
    }
371
    }
354
  return i.GetDistanceFrom (start);
372
  return i.GetDistanceFrom (start);
355
}
373
}
 Lines 363-386   CtrlBAckResponseHeader::SetHtImmediateAck (bool immediateAck) Link Here 
363
void
381
void
364
CtrlBAckResponseHeader::SetType (BlockAckType type)
382
CtrlBAckResponseHeader::SetType (BlockAckType type)
365
{
383
{
366
  switch (type)
384
  m_baType = type;
367
    {
385
}
368
    case BASIC_BLOCK_ACK:
386
369
      m_multiTid = false;
387
BlockAckType
370
      m_compressed = false;
388
CtrlBAckResponseHeader::GetType (void) const
371
      break;
389
{
372
    case COMPRESSED_BLOCK_ACK:
390
  return m_baType;
373
      m_multiTid = false;
374
      m_compressed = true;
375
      break;
376
    case MULTI_TID_BLOCK_ACK:
377
      m_multiTid = true;
378
      m_compressed = true;
379
      break;
380
    default:
381
      NS_FATAL_ERROR ("Invalid variant type");
382
      break;
383
    }
384
}
391
}
385
392
386
void
393
void
 Lines 417-435   CtrlBAckResponseHeader::GetStartingSequence (void) const Link Here 
417
bool
424
bool
418
CtrlBAckResponseHeader::IsBasic (void) const
425
CtrlBAckResponseHeader::IsBasic (void) const
419
{
426
{
420
  return (!m_multiTid && !m_compressed) ? true : false;
427
  return (m_baType == BASIC_BLOCK_ACK) ? true : false;
421
}
428
}
422
429
423
bool
430
bool
424
CtrlBAckResponseHeader::IsCompressed (void) const
431
CtrlBAckResponseHeader::IsCompressed (void) const
425
{
432
{
426
  return (!m_multiTid && m_compressed) ? true : false;
433
  return (m_baType == COMPRESSED_BLOCK_ACK) ? true : false;
434
}
435
436
bool
437
CtrlBAckResponseHeader::IsExtendedCompressed (void) const
438
{
439
  return (m_baType == EXTENDED_COMPRESSED_BLOCK_ACK) ? true : false;
427
}
440
}
428
441
429
bool
442
bool
430
CtrlBAckResponseHeader::IsMultiTid (void) const
443
CtrlBAckResponseHeader::IsMultiTid (void) const
431
{
444
{
432
  return (m_multiTid && m_compressed) ? true : false;
445
  return (m_baType == MULTI_TID_BLOCK_ACK) ? true : false;
433
}
446
}
434
447
435
uint16_t
448
uint16_t
 Lines 440-452   CtrlBAckResponseHeader::GetBaControl (void) const Link Here 
440
    {
453
    {
441
      res |= 0x1;
454
      res |= 0x1;
442
    }
455
    }
443
  if (m_multiTid)
456
  switch (m_baType)
444
    {
457
    {
445
      res |= (0x1 << 1);
458
      case BASIC_BLOCK_ACK:
446
    }
459
        break;
447
  if (m_compressed)
460
      case COMPRESSED_BLOCK_ACK:
448
    {
461
        res |= (0x02 << 1);
449
      res |= (0x1 << 2);
462
        break;
463
      case EXTENDED_COMPRESSED_BLOCK_ACK:
464
        res |= (0x01 << 1);
465
        break;
466
      case MULTI_TID_BLOCK_ACK:
467
        res |= (0x03 << 1);
468
        break;
469
      default:
470
        NS_FATAL_ERROR ("Invalid BA type");
471
        break;
450
    }
472
    }
451
  res |= (m_tidInfo << 12) & (0xf << 12);
473
  res |= (m_tidInfo << 12) & (0xf << 12);
452
  return res;
474
  return res;
 Lines 456-463   void Link Here 
456
CtrlBAckResponseHeader::SetBaControl (uint16_t ba)
478
CtrlBAckResponseHeader::SetBaControl (uint16_t ba)
457
{
479
{
458
  m_baAckPolicy = ((ba & 0x01) == 1) ? true : false;
480
  m_baAckPolicy = ((ba & 0x01) == 1) ? true : false;
459
  m_multiTid = (((ba >> 1) & 0x01) == 1) ? true : false;
481
  if (((ba >> 1) & 0x0f) == 0x03)
460
  m_compressed = (((ba >> 2) & 0x01) == 1) ? true : false;
482
    {
483
      m_baType = MULTI_TID_BLOCK_ACK;
484
    }
485
  else if (((ba >> 1) & 0x0f) == 0x01)
486
    {
487
      m_baType = EXTENDED_COMPRESSED_BLOCK_ACK;
488
    }
489
  else if (((ba >> 1) & 0x0f) == 0x02)
490
    {
491
      m_baType = COMPRESSED_BLOCK_ACK;
492
    }
493
  else
494
    {
495
      m_baType = BASIC_BLOCK_ACK;
496
    }
461
  m_tidInfo = (ba >> 12) & 0x0f;
497
  m_tidInfo = (ba >> 12) & 0x0f;
462
}
498
}
463
499
 Lines 477-506   Buffer::Iterator Link Here 
477
CtrlBAckResponseHeader::SerializeBitmap (Buffer::Iterator start) const
513
CtrlBAckResponseHeader::SerializeBitmap (Buffer::Iterator start) const
478
{
514
{
479
  Buffer::Iterator i = start;
515
  Buffer::Iterator i = start;
480
  if (!m_multiTid)
516
  switch (m_baType)
481
    {
517
    {
482
      if (!m_compressed)
518
      case BASIC_BLOCK_ACK:
483
        {
484
          for (uint8_t j = 0; j < 64; j++)
519
          for (uint8_t j = 0; j < 64; j++)
485
            {
520
            {
486
              i.WriteHtolsbU16 (bitmap.m_bitmap[j]);
521
              i.WriteHtolsbU16 (bitmap.m_bitmap[j]);
487
            }
522
            }
488
        }
523
          break;
489
      else
524
      case COMPRESSED_BLOCK_ACK:
490
        {
491
          i.WriteHtolsbU64 (bitmap.m_compressedBitmap);
525
          i.WriteHtolsbU64 (bitmap.m_compressedBitmap);
492
        }
526
          break;
493
    }
527
      case EXTENDED_COMPRESSED_BLOCK_ACK:
494
  else
528
          i.WriteHtolsbU64 (bitmap.m_extendedCompressedBitmap[0]);
495
    {
529
          i.WriteHtolsbU64 (bitmap.m_extendedCompressedBitmap[1]);
496
      if (m_compressed)
530
          i.WriteHtolsbU64 (bitmap.m_extendedCompressedBitmap[2]);
497
        {
531
          i.WriteHtolsbU64 (bitmap.m_extendedCompressedBitmap[3]);
498
          NS_FATAL_ERROR ("Multi-tid block ack is not supported.");
532
          break;
499
        }
533
      case MULTI_TID_BLOCK_ACK:
500
      else
534
        NS_FATAL_ERROR ("Multi-tid block ack is not supported.");
501
        {
535
        break;
502
          NS_FATAL_ERROR ("Reserved configuration.");
536
      default:
503
        }
537
        NS_FATAL_ERROR ("Invalid BA type");
538
        break;
504
    }
539
    }
505
  return i;
540
  return i;
506
}
541
}
 Lines 509-538   Buffer::Iterator Link Here 
509
CtrlBAckResponseHeader::DeserializeBitmap (Buffer::Iterator start)
544
CtrlBAckResponseHeader::DeserializeBitmap (Buffer::Iterator start)
510
{
545
{
511
  Buffer::Iterator i = start;
546
  Buffer::Iterator i = start;
512
  if (!m_multiTid)
547
  switch (m_baType)
513
    {
548
    {
514
      if (!m_compressed)
549
      case BASIC_BLOCK_ACK:
515
        {
516
          for (uint8_t j = 0; j < 64; j++)
550
          for (uint8_t j = 0; j < 64; j++)
517
            {
551
            {
518
              bitmap.m_bitmap[j] = i.ReadLsbtohU16 ();
552
              bitmap.m_bitmap[j] = i.ReadLsbtohU16 ();
519
            }
553
            }
520
        }
554
          break;
521
      else
555
      case COMPRESSED_BLOCK_ACK:
522
        {
523
          bitmap.m_compressedBitmap = i.ReadLsbtohU64 ();
556
          bitmap.m_compressedBitmap = i.ReadLsbtohU64 ();
524
        }
557
          break;
525
    }
558
      case EXTENDED_COMPRESSED_BLOCK_ACK:
526
  else
559
          bitmap.m_extendedCompressedBitmap[0] = i.ReadLsbtohU64 ();
527
    {
560
          bitmap.m_extendedCompressedBitmap[1] = i.ReadLsbtohU64 ();
528
      if (m_compressed)
561
          bitmap.m_extendedCompressedBitmap[2] = i.ReadLsbtohU64 ();
529
        {
562
          bitmap.m_extendedCompressedBitmap[3] = i.ReadLsbtohU64 ();
530
          NS_FATAL_ERROR ("Multi-tid block ack is not supported.");
563
          break;
531
        }
564
      case MULTI_TID_BLOCK_ACK:
532
      else
565
        NS_FATAL_ERROR ("Multi-tid block ack is not supported.");
533
        {
566
        break;
534
          NS_FATAL_ERROR ("Reserved configuration.");
567
      default:
535
        }
568
        NS_FATAL_ERROR ("Invalid BA type");
569
        break;
536
    }
570
    }
537
  return i;
571
  return i;
538
}
572
}
 Lines 544-571   CtrlBAckResponseHeader::SetReceivedPacket (uint16_t seq) Link Here 
544
    {
578
    {
545
      return;
579
      return;
546
    }
580
    }
547
  if (!m_multiTid)
581
  switch (m_baType)
548
    {
582
    {
549
      if (!m_compressed)
583
      case BASIC_BLOCK_ACK:
550
        {
584
        {
551
          /* To set correctly basic block ack bitmap we need fragment number too.
585
          /* To set correctly basic block ack bitmap we need fragment number too.
552
             So if it's not specified, we consider packet not fragmented. */
586
             So if it's not specified, we consider packet not fragmented. */
553
          bitmap.m_bitmap[IndexInBitmap (seq)] |= 0x0001;
587
          bitmap.m_bitmap[IndexInBitmap (seq)] |= 0x0001;
588
          break;
554
        }
589
        }
555
      else
590
      case COMPRESSED_BLOCK_ACK:
556
        {
591
        {
557
          bitmap.m_compressedBitmap |= (uint64_t (0x0000000000000001) << IndexInBitmap (seq));
592
          bitmap.m_compressedBitmap |= (uint64_t (0x0000000000000001) << IndexInBitmap (seq));
593
          break;
558
        }
594
        }
559
    }
595
      case EXTENDED_COMPRESSED_BLOCK_ACK:
560
  else
596
        {
561
    {
597
          uint16_t index = IndexInBitmap (seq);
562
      if (m_compressed)
598
          bitmap.m_extendedCompressedBitmap[index/64] |= (uint64_t (0x0000000000000001) << index);
599
          break;
600
        }
601
      case MULTI_TID_BLOCK_ACK:
563
        {
602
        {
564
          NS_FATAL_ERROR ("Multi-tid block ack is not supported.");
603
          NS_FATAL_ERROR ("Multi-tid block ack is not supported.");
604
          break;
565
        }
605
        }
566
      else
606
      default:
567
        {
607
        {
568
          NS_FATAL_ERROR ("Reserved configuration.");
608
          NS_FATAL_ERROR ("Invalid BA type");
609
          break;
569
        }
610
        }
570
    }
611
    }
571
}
612
}
 Lines 578-605   CtrlBAckResponseHeader::SetReceivedFragment (uint16_t seq, uint8_t frag) Link Here 
578
    {
619
    {
579
      return;
620
      return;
580
    }
621
    }
581
  if (!m_multiTid)
622
  switch (m_baType)
582
    {
623
    {
583
      if (!m_compressed)
624
      case BASIC_BLOCK_ACK:
584
        {
625
        bitmap.m_bitmap[IndexInBitmap (seq)] |= (0x0001 << frag);
585
          bitmap.m_bitmap[IndexInBitmap (seq)] |= (0x0001 << frag);
626
        break;
586
        }
627
      case COMPRESSED_BLOCK_ACK:
587
      else
628
      case EXTENDED_COMPRESSED_BLOCK_ACK:
588
        {
629
        /* We can ignore this...compressed block ack doesn't support
589
          /* We can ignore this...compressed block ack doesn't support
630
           acknowledgement of single fragments */
590
             acknowledgement of single fragments */
631
        break;
591
        }
632
      case MULTI_TID_BLOCK_ACK:
592
    }
633
        NS_FATAL_ERROR ("Multi-tid block ack is not supported.");
593
  else
634
        break;
594
    {
635
      default:
595
      if (m_compressed)
636
        NS_FATAL_ERROR ("Invalid BA type");
596
        {
637
        break;
597
          NS_FATAL_ERROR ("Multi-tid block ack is not supported.");
598
        }
599
      else
600
        {
601
          NS_FATAL_ERROR ("Reserved configuration.");
602
        }
603
    }
638
    }
604
}
639
}
605
640
 Lines 610-637   CtrlBAckResponseHeader::IsPacketReceived (uint16_t seq) const Link Here 
610
    {
645
    {
611
      return false;
646
      return false;
612
    }
647
    }
613
  if (!m_multiTid)
648
  switch (m_baType)
614
    {
649
    {
615
      if (!m_compressed)
650
      case BASIC_BLOCK_ACK:
616
        {
651
        {
617
          /*It's impossible to say if an entire packet was correctly received. */
652
          /*It's impossible to say if an entire packet was correctly received. */
618
          return false;
653
          return false;
619
        }
654
        }
620
      else
655
      case COMPRESSED_BLOCK_ACK:
621
        {
656
        {
657
          /* Although this could make no sense, if packet with sequence number
658
             equal to <i>seq</i> was correctly received, also all of its fragments
659
             were correctly received. */
622
          uint64_t mask = uint64_t (0x0000000000000001);
660
          uint64_t mask = uint64_t (0x0000000000000001);
623
          return (((bitmap.m_compressedBitmap >> IndexInBitmap (seq)) & mask) == 1) ? true : false;
661
          return (((bitmap.m_compressedBitmap >> IndexInBitmap (seq)) & mask) == 1) ? true : false;
624
        }
662
        }
625
    }
663
      case EXTENDED_COMPRESSED_BLOCK_ACK:
626
  else
664
        {
627
    {
665
          uint64_t mask = uint64_t (0x0000000000000001);
628
      if (m_compressed)
666
          uint16_t index = IndexInBitmap (seq);
667
          return (((bitmap.m_extendedCompressedBitmap[index/64] >> index) & mask) == 1) ? true : false;
668
        }
669
      case MULTI_TID_BLOCK_ACK:
629
        {
670
        {
630
          NS_FATAL_ERROR ("Multi-tid block ack is not supported.");
671
          NS_FATAL_ERROR ("Multi-tid block ack is not supported.");
672
          break;
631
        }
673
        }
632
      else
674
      default:
633
        {
675
        {
634
          NS_FATAL_ERROR ("Reserved configuration.");
676
          NS_FATAL_ERROR ("Invalid BA type");
677
          break;
635
        }
678
        }
636
    }
679
    }
637
  return false;
680
  return false;
 Lines 645-657   CtrlBAckResponseHeader::IsFragmentReceived (uint16_t seq, uint8_t frag) const Link Here 
645
    {
688
    {
646
      return false;
689
      return false;
647
    }
690
    }
648
  if (!m_multiTid)
691
  switch (m_baType)
649
    {
692
    {
650
      if (!m_compressed)
693
      case BASIC_BLOCK_ACK:
651
        {
694
        {
652
          return ((bitmap.m_bitmap[IndexInBitmap (seq)] & (0x0001 << frag)) != 0x0000) ? true : false;
695
          return ((bitmap.m_bitmap[IndexInBitmap (seq)] & (0x0001 << frag)) != 0x0000) ? true : false;
653
        }
696
        }
654
      else
697
      case COMPRESSED_BLOCK_ACK:
655
        {
698
        {
656
          /* Although this could make no sense, if packet with sequence number
699
          /* Although this could make no sense, if packet with sequence number
657
             equal to <i>seq</i> was correctly received, also all of its fragments
700
             equal to <i>seq</i> was correctly received, also all of its fragments
 Lines 659-674   CtrlBAckResponseHeader::IsFragmentReceived (uint16_t seq, uint8_t frag) const Link Here 
659
          uint64_t mask = uint64_t (0x0000000000000001);
702
          uint64_t mask = uint64_t (0x0000000000000001);
660
          return (((bitmap.m_compressedBitmap >> IndexInBitmap (seq)) & mask) == 1) ? true : false;
703
          return (((bitmap.m_compressedBitmap >> IndexInBitmap (seq)) & mask) == 1) ? true : false;
661
        }
704
        }
662
    }
705
      case EXTENDED_COMPRESSED_BLOCK_ACK:
663
  else
706
        {
664
    {
707
          uint64_t mask = uint64_t (0x0000000000000001);
665
      if (m_compressed)
708
          uint16_t index = IndexInBitmap (seq);
709
          return (((bitmap.m_extendedCompressedBitmap[index/64] >> index) & mask) == 1) ? true : false;
710
        }
711
      case MULTI_TID_BLOCK_ACK:
666
        {
712
        {
667
          NS_FATAL_ERROR ("Multi-tid block ack is not supported.");
713
          NS_FATAL_ERROR ("Multi-tid block ack is not supported.");
714
          break;
668
        }
715
        }
669
      else
716
      default:
670
        {
717
        {
671
          NS_FATAL_ERROR ("Reserved configuration.");
718
          NS_FATAL_ERROR ("Invalid BA type");
719
          break;
672
        }
720
        }
673
    }
721
    }
674
  return false;
722
  return false;
 Lines 686-699   CtrlBAckResponseHeader::IndexInBitmap (uint16_t seq) const Link Here 
686
    {
734
    {
687
      index = 4096 - m_startingSeq + seq;
735
      index = 4096 - m_startingSeq + seq;
688
    }
736
    }
689
  NS_ASSERT (index <= 63);
737
  if (m_baType == EXTENDED_COMPRESSED_BLOCK_ACK)
738
    {
739
      NS_ASSERT (index <= 255);
740
    }
741
  else
742
    {
743
      NS_ASSERT (index <= 63);
744
    }
690
  return index;
745
  return index;
691
}
746
}
692
747
693
bool
748
bool
694
CtrlBAckResponseHeader::IsInBitmap (uint16_t seq) const
749
CtrlBAckResponseHeader::IsInBitmap (uint16_t seq) const
695
{
750
{
696
  return (seq - m_startingSeq + 4096) % 4096 < 64;
751
  if (m_baType == EXTENDED_COMPRESSED_BLOCK_ACK)
752
    {
753
      return (seq - m_startingSeq + 4096) % 4096 < 256;
754
    }
755
  else
756
    {
757
      return (seq - m_startingSeq + 4096) % 4096 < 64;
758
    }
697
}
759
}
698
760
699
const uint16_t*
761
const uint16_t*
 Lines 708-713   CtrlBAckResponseHeader::GetCompressedBitmap (void) const Link Here 
708
  return bitmap.m_compressedBitmap;
770
  return bitmap.m_compressedBitmap;
709
}
771
}
710
772
773
const uint64_t*
774
CtrlBAckResponseHeader::GetExtendedCompressedBitmap (void) const
775
{
776
  return bitmap.m_extendedCompressedBitmap;
777
}
778
711
void
779
void
712
CtrlBAckResponseHeader::ResetBitmap (void)
780
CtrlBAckResponseHeader::ResetBitmap (void)
713
{
781
{
(-)a/src/wifi/model/ctrl-headers.h (-16 / +46 lines)
 Lines 88-93   public: Link Here 
88
   */
88
   */
89
  bool MustSendHtImmediateAck (void) const;
89
  bool MustSendHtImmediateAck (void) const;
90
  /**
90
  /**
91
   * Return the block ACK type ID.
92
   *
93
   * \return type
94
   */
95
  BlockAckType GetType (void) const;
96
  /**
91
   * Return the Traffic ID (TID).
97
   * Return the Traffic ID (TID).
92
   *
98
   *
93
   * \return TID
99
   * \return TID
 Lines 116-121   public: Link Here 
116
   */
122
   */
117
  bool IsCompressed (void) const;
123
  bool IsCompressed (void) const;
118
  /**
124
  /**
125
   * Check if the current BA policy is extended compressed block ACK.
126
   *
127
   * \return true if the current BA policy is extended compressed block ACK,
128
   *         false otherwise
129
   */
130
  bool IsExtendedCompressed (void) const;
131
  /**
119
   * Check if the current ACK policy has multiple TID.
132
   * Check if the current ACK policy has multiple TID.
120
   *
133
   *
121
   * \return true if the current ACK policy has multiple TID,
134
   * \return true if the current ACK policy has multiple TID,
 Lines 158-167   private: Link Here 
158
   * For now only non HT immediate block ack is implemented so this field
171
   * For now only non HT immediate block ack is implemented so this field
159
   * is here only for a future implementation of HT delayed variant.
172
   * is here only for a future implementation of HT delayed variant.
160
   */
173
   */
161
  bool m_barAckPolicy; ///< bar ack policy
174
  bool m_barAckPolicy;    ///< bar ack policy
162
  bool m_multiTid; ///< multi TID
175
  BlockAckType m_baType;  ///< BA type
163
  bool m_compressed; ///< compressed
176
  uint16_t m_tidInfo;     ///< TID info
164
  uint16_t m_tidInfo; ///< TID info
165
  uint16_t m_startingSeq; ///< starting seq
177
  uint16_t m_startingSeq; ///< starting seq
166
};
178
};
167
179
 Lines 228-233   public: Link Here 
228
   */
240
   */
229
  bool MustSendHtImmediateAck (void) const;
241
  bool MustSendHtImmediateAck (void) const;
230
  /**
242
  /**
243
   * Return the block ACK type ID.
244
   *
245
   * \return type
246
   */
247
  BlockAckType GetType (void) const;
248
  /**
231
   * Return the Traffic ID (TID).
249
   * Return the Traffic ID (TID).
232
   *
250
   *
233
   * \return TID
251
   * \return TID
 Lines 240-264   public: Link Here 
240
   */
258
   */
241
  uint16_t GetStartingSequence (void) const;
259
  uint16_t GetStartingSequence (void) const;
242
  /**
260
  /**
243
   * Check if the current ACK policy is basic
261
   * Check if the current BA policy is basic block ACK.
244
   * (i.e. not multiple TID and not compressed ACK).
245
   *
262
   *
246
   * \return true if the current ACK policy is basic,
263
   * \return true if the current BA policy is basic block ACK,
247
   *         false otherwise
264
   *         false otherwise
248
   */
265
   */
249
  bool IsBasic (void) const;
266
  bool IsBasic (void) const;
250
  /**
267
  /**
251
   * Check if the current ACK policy is compressed ACK
268
   * Check if the current BA policy is compressed block ACK.
252
   * and not multiple TID.
253
   *
269
   *
254
   * \return true if the current ACK policy is compressed ACK,
270
   * \return true if the current BA policy is compressed block ACK,
255
   *         false otherwise
271
   *         false otherwise
256
   */
272
   */
257
  bool IsCompressed (void) const;
273
  bool IsCompressed (void) const;
258
  /**
274
  /**
259
   * Check if the current ACK policy has multiple TID.
275
   * Check if the current BA policy is extended compressed block ACK.
260
   *
276
   *
261
   * \return true if the current ACK policy has multiple TID,
277
   * \return true if the current BA policy is extended compressed block ACK,
278
   *         false otherwise
279
   */
280
  bool IsExtendedCompressed (void) const;
281
  /**
282
   * Check if the current BA policy is multi-TID block ACK.
283
   *
284
   * \return true if the current BA policy is multi-TID block ACK,
262
   *         false otherwise
285
   *         false otherwise
263
   */
286
   */
264
  bool IsMultiTid (void) const;
287
  bool IsMultiTid (void) const;
 Lines 317-322   public: Link Here 
317
   *
340
   *
318
   * \return the bitmap from the block ACK response header
341
   * \return the bitmap from the block ACK response header
319
   */
342
   */
343
320
  const uint16_t* GetBitmap (void) const;
344
  const uint16_t* GetBitmap (void) const;
321
  /**
345
  /**
322
   * Return the compressed bitmap from the block ACK response header.
346
   * Return the compressed bitmap from the block ACK response header.
 Lines 324-329   public: Link Here 
324
   * \return the compressed bitmap from the block ACK response header
348
   * \return the compressed bitmap from the block ACK response header
325
   */
349
   */
326
  uint64_t GetCompressedBitmap (void) const;
350
  uint64_t GetCompressedBitmap (void) const;
351
  /**
352
   * Return the extended compressed bitmap from the block ACK response header.
353
   *
354
   * \return the extended compressed bitmap from the block ACK response header
355
   */
356
  const uint64_t* GetExtendedCompressedBitmap (void) const;
327
357
328
  /**
358
  /**
329
   * Reset the bitmap to 0.
359
   * Reset the bitmap to 0.
 Lines 391-406   private: Link Here 
391
   * For now only non HT immediate block ack is implemented so this field
421
   * For now only non HT immediate block ack is implemented so this field
392
   * is here only for a future implementation of HT delayed variant.
422
   * is here only for a future implementation of HT delayed variant.
393
   */
423
   */
394
  bool m_baAckPolicy; ///< BA ack policy
424
  bool m_baAckPolicy;     ///< BA ack policy
395
  bool m_multiTid; ///< multi TID
425
  BlockAckType m_baType;  ///< BA type
396
  bool m_compressed; ///< compressed
426
  uint16_t m_tidInfo;     ///< TID info
397
  uint16_t m_tidInfo; ///< TID info
398
  uint16_t m_startingSeq; ///< starting seq
427
  uint16_t m_startingSeq; ///< starting seq
399
428
400
  union
429
  union
401
  {
430
  {
402
    uint16_t m_bitmap[64]; ///< the block ack bitmap
431
    uint16_t m_bitmap[64]; ///< the block ack bitmap
403
    uint64_t m_compressedBitmap; ///< the compressed block ack bitmap
432
    uint64_t m_compressedBitmap; ///< the compressed block ack bitmap
433
    uint64_t m_extendedCompressedBitmap[4]; ///< the extended compressed block ack bitmap
404
  } bitmap; ///< bitmap union type
434
  } bitmap; ///< bitmap union type
405
};
435
};
406
436
(-)a/src/wifi/model/he-configuration.cc (-1 / +69 lines)
 Lines 46-55   HeConfiguration::GetTypeId (void) Link Here 
46
                   MakeTimeAccessor (&HeConfiguration::GetGuardInterval,
46
                   MakeTimeAccessor (&HeConfiguration::GetGuardInterval,
47
                                     &HeConfiguration::SetGuardInterval),
47
                                     &HeConfiguration::SetGuardInterval),
48
                   MakeTimeChecker (NanoSeconds (800), NanoSeconds (3200)))
48
                   MakeTimeChecker (NanoSeconds (800), NanoSeconds (3200)))
49
    .AddAttribute ("BssColor", "BSS color",
49
    .AddAttribute ("BssColor",
50
                   "The BSS color",
50
                   UintegerValue (0),
51
                   UintegerValue (0),
51
                   MakeUintegerAccessor (&HeConfiguration::m_bssColor),
52
                   MakeUintegerAccessor (&HeConfiguration::m_bssColor),
52
                   MakeUintegerChecker<uint8_t> ())
53
                   MakeUintegerChecker<uint8_t> ())
54
    .AddAttribute ("MpduBufferSize",
55
                   "The MPDU buffer size for receiving A-MPDUs",
56
                   UintegerValue (64),
57
                   MakeUintegerAccessor (&HeConfiguration::GetMpduBufferSize,
58
                                         &HeConfiguration::SetMpduBufferSize),
59
                   MakeUintegerChecker<uint16_t> (64, 256))
60
    .AddAttribute ("VoMaxAmsduSize",
61
                   "Maximum length in bytes of an A-MSDU for AC_VO access class. "
62
                   "Value 0 means A-MSDU is disabled for that AC.",
63
                   UintegerValue (0),
64
                   MakeUintegerAccessor (&HeConfiguration::m_voMaxAmsduSize),
65
                   MakeUintegerChecker<uint16_t> (0, 11454))
66
    .AddAttribute ("ViMaxAmsduSize",
67
                   "Maximum length in bytes of an A-MSDU for AC_VI access class."
68
                   "Value 0 means A-MSDU is disabled for that AC.",
69
                   UintegerValue (0),
70
                   MakeUintegerAccessor (&HeConfiguration::m_viMaxAmsduSize),
71
                   MakeUintegerChecker<uint16_t> (0, 11454))
72
    .AddAttribute ("BeMaxAmsduSize",
73
                   "Maximum length in bytes of an A-MSDU for AC_BE access class."
74
                   "Value 0 means A-MSDU is disabled for that AC.",
75
                   UintegerValue (0),
76
                   MakeUintegerAccessor (&HeConfiguration::m_beMaxAmsduSize),
77
                   MakeUintegerChecker<uint16_t> (0, 11454))
78
    .AddAttribute ("BkMaxAmsduSize",
79
                   "Maximum length in bytes of an A-MSDU for AC_BK access class."
80
                   "Value 0 means A-MSDU is disabled for that AC.",
81
                   UintegerValue (0),
82
                   MakeUintegerAccessor (&HeConfiguration::m_bkMaxAmsduSize),
83
                   MakeUintegerChecker<uint16_t> (0, 11454))
84
    .AddAttribute ("VoMaxAmpduSize",
85
                   "Maximum length in bytes of an A-MPDU for AC_VO access class."
86
                   "Value 0 means A-MPDU is disabled for that AC.",
87
                   UintegerValue (0),
88
                   MakeUintegerAccessor (&HeConfiguration::m_voMaxAmpduSize),
89
                   MakeUintegerChecker<uint32_t> (0, 4194303))
90
    .AddAttribute ("ViMaxAmpduSize",
91
                   "Maximum length in bytes of an A-MPDU for AC_VI access class."
92
                   "Value 0 means A-MPDU is disabled for that AC.",
93
                   UintegerValue (4194303),
94
                   MakeUintegerAccessor (&HeConfiguration::m_viMaxAmpduSize),
95
                   MakeUintegerChecker<uint32_t> (0, 4194303))
96
    .AddAttribute ("BeMaxAmpduSize",
97
                   "Maximum length in bytes of an A-MPDU for AC_BE access class."
98
                   "Value 0 means A-MPDU is disabled for that AC.",
99
                   UintegerValue (4194303),
100
                   MakeUintegerAccessor (&HeConfiguration::m_beMaxAmpduSize),
101
                   MakeUintegerChecker<uint32_t> (0, 4194303))
102
    .AddAttribute ("BkMaxAmpduSize",
103
                   "Maximum length in bytes of an A-MPDU for AC_BK access class."
104
                   "Value 0 means A-MPDU is disabled for that AC.",
105
                   UintegerValue (0),
106
                   MakeUintegerAccessor (&HeConfiguration::m_bkMaxAmpduSize),
107
                   MakeUintegerChecker<uint32_t> (0, 4194303))
53
    ;
108
    ;
54
    return tid;
109
    return tid;
55
}
110
}
 Lines 68-71   HeConfiguration::GetGuardInterval (void) const Link Here 
68
  return m_guardInterval;
123
  return m_guardInterval;
69
}
124
}
70
125
126
void
127
HeConfiguration::SetMpduBufferSize (uint16_t size)
128
{
129
  NS_LOG_FUNCTION (this << size);
130
  m_mpduBufferSize = size;
131
}
132
133
uint16_t
134
HeConfiguration::GetMpduBufferSize (void) const
135
{
136
  return m_mpduBufferSize;
137
}
138
71
} //namespace ns3
139
} //namespace ns3
(-)a/src/wifi/model/he-configuration.h (-2 / +21 lines)
 Lines 46-56   public: Link Here 
46
   * \return the supported HE guard interval
46
   * \return the supported HE guard interval
47
   */
47
   */
48
  Time GetGuardInterval (void) const;
48
  Time GetGuardInterval (void) const;
49
  /**
50
   * \param size the MPDU buffer size to receive A-MPDUs
51
   */
52
  void SetMpduBufferSize (uint16_t size);
53
  /**
54
   * \return the MPDU buffer size to receive A-MPDUs
55
   */
56
  uint16_t GetMpduBufferSize (void) const;
49
57
50
58
51
private:
59
private:
52
  Time m_guardInterval; //!< Supported HE guard interval
60
  Time m_guardInterval;      //!< Supported HE guard interval
53
  uint8_t m_bssColor;   //!< BSS color
61
  uint8_t m_bssColor;        //!< BSS color
62
  uint16_t m_mpduBufferSize; //!< MPDU buffer size
63
64
  uint16_t m_voMaxAmsduSize; ///< maximum A-MSDU size for AC_VO
65
  uint16_t m_viMaxAmsduSize; ///< maximum A-MSDU size for AC_VI
66
  uint16_t m_beMaxAmsduSize; ///< maximum A-MSDU size for AC_BE
67
  uint16_t m_bkMaxAmsduSize; ///< maximum A-MSDU size for AC_BK
68
69
  uint32_t m_voMaxAmpduSize; ///< maximum A-MPDU size for AC_VO
70
  uint32_t m_viMaxAmpduSize; ///< maximum A-MPDU size for AC_VI
71
  uint32_t m_beMaxAmpduSize; ///< maximum A-MPDU size for AC_BE
72
  uint32_t m_bkMaxAmpduSize; ///< maximum A-MPDU size for AC_BK
54
};
73
};
55
74
56
} //namespace ns3
75
} //namespace ns3
(-)a/src/wifi/model/ht-configuration.cc (+49 lines)
 Lines 20-25    Link Here 
20
20
21
#include "ns3/log.h"
21
#include "ns3/log.h"
22
#include "ns3/boolean.h"
22
#include "ns3/boolean.h"
23
#include "ns3/uinteger.h"
23
#include "ht-configuration.h"
24
#include "ht-configuration.h"
24
25
25
namespace ns3 {
26
namespace ns3 {
 Lines 63-68   HtConfiguration::GetTypeId (void) Link Here 
63
                   MakeBooleanAccessor (&HtConfiguration::SetRifsSupported,
64
                   MakeBooleanAccessor (&HtConfiguration::SetRifsSupported,
64
                                        &HtConfiguration::GetRifsSupported),
65
                                        &HtConfiguration::GetRifsSupported),
65
                   MakeBooleanChecker ())
66
                   MakeBooleanChecker ())
67
    .AddAttribute ("VoMaxAmsduSize",
68
                   "Maximum length in bytes of an A-MSDU for AC_VO access class. "
69
                   "Value 0 means A-MSDU is disabled for that AC.",
70
                   UintegerValue (0),
71
                   MakeUintegerAccessor (&HtConfiguration::m_voMaxAmsduSize),
72
                   MakeUintegerChecker<uint16_t> (0, 7935))
73
    .AddAttribute ("ViMaxAmsduSize",
74
                   "Maximum length in bytes of an A-MSDU for AC_VI access class."
75
                   "Value 0 means A-MSDU is disabled for that AC.",
76
                   UintegerValue (0),
77
                   MakeUintegerAccessor (&HtConfiguration::m_viMaxAmsduSize),
78
                   MakeUintegerChecker<uint16_t> (0, 7935))
79
    .AddAttribute ("BeMaxAmsduSize",
80
                   "Maximum length in bytes of an A-MSDU for AC_BE access class."
81
                   "Value 0 means A-MSDU is disabled for that AC.",
82
                   UintegerValue (0),
83
                   MakeUintegerAccessor (&HtConfiguration::m_beMaxAmsduSize),
84
                   MakeUintegerChecker<uint16_t> (0, 7935))
85
    .AddAttribute ("BkMaxAmsduSize",
86
                   "Maximum length in bytes of an A-MSDU for AC_BK access class."
87
                   "Value 0 means A-MSDU is disabled for that AC.",
88
                   UintegerValue (0),
89
                   MakeUintegerAccessor (&HtConfiguration::m_bkMaxAmsduSize),
90
                   MakeUintegerChecker<uint16_t> (0, 7935))
91
    .AddAttribute ("VoMaxAmpduSize",
92
                   "Maximum length in bytes of an A-MPDU for AC_VO access class."
93
                   "Value 0 means A-MPDU is disabled for that AC.",
94
                   UintegerValue (0),
95
                   MakeUintegerAccessor (&HtConfiguration::m_voMaxAmpduSize),
96
                   MakeUintegerChecker<uint32_t> (0, 65535))
97
    .AddAttribute ("ViMaxAmpduSize",
98
                   "Maximum length in bytes of an A-MPDU for AC_VI access class."
99
                   "Value 0 means A-MPDU is disabled for that AC.",
100
                   UintegerValue (65535),
101
                   MakeUintegerAccessor (&HtConfiguration::m_viMaxAmpduSize),
102
                   MakeUintegerChecker<uint32_t> (0, 65535))
103
    .AddAttribute ("BeMaxAmpduSize",
104
                   "Maximum length in bytes of an A-MPDU for AC_BE access class."
105
                   "Value 0 means A-MPDU is disabled for that AC.",
106
                   UintegerValue (65535),
107
                   MakeUintegerAccessor (&HtConfiguration::m_beMaxAmpduSize),
108
                   MakeUintegerChecker<uint32_t> (0, 65535))
109
    .AddAttribute ("BkMaxAmpduSize",
110
                   "Maximum length in bytes of an A-MPDU for AC_BK access class."
111
                   "Value 0 means A-MPDU is disabled for that AC.",
112
                   UintegerValue (0),
113
                   MakeUintegerAccessor (&HtConfiguration::m_bkMaxAmpduSize),
114
                   MakeUintegerChecker<uint32_t> (0, 65535))
66
    ;
115
    ;
67
    return tid;
116
    return tid;
68
}
117
}
(-)a/src/wifi/model/ht-configuration.h (-4 / +12 lines)
 Lines 55-61   public: Link Here 
55
   *         false otherwise.
55
   *         false otherwise.
56
   */
56
   */
57
  bool GetShortGuardIntervalSupported (void) const;
57
  bool GetShortGuardIntervalSupported (void) const;
58
59
  /**
58
  /**
60
   * Enable or disable Greenfield support.
59
   * Enable or disable Greenfield support.
61
   *
60
   *
 Lines 70-76   public: Link Here 
70
   *         false otherwise.
69
   *         false otherwise.
71
   */
70
   */
72
  bool GetGreenfieldSupported (void) const;
71
  bool GetGreenfieldSupported (void) const;
73
74
  /**
72
  /**
75
   * Enable or disable RIFS support.
73
   * Enable or disable RIFS support.
76
   *
74
   *
 Lines 88-96   public: Link Here 
88
86
89
87
90
private:
88
private:
91
  bool m_sgiSupported; ///< flag whether short guard interval is supported
89
  bool m_sgiSupported;        ///< flag whether short guard interval is supported
92
  bool m_rifsSupported; ///< flag whether RIFS is supported
90
  bool m_rifsSupported;       ///< flag whether RIFS is supported
93
  bool m_greenfieldSupported; ///< flag whether Greenfield is supported
91
  bool m_greenfieldSupported; ///< flag whether Greenfield is supported
92
93
  uint16_t m_voMaxAmsduSize; ///< maximum A-MSDU size for AC_VO
94
  uint16_t m_viMaxAmsduSize; ///< maximum A-MSDU size for AC_VI
95
  uint16_t m_beMaxAmsduSize; ///< maximum A-MSDU size for AC_BE
96
  uint16_t m_bkMaxAmsduSize; ///< maximum A-MSDU size for AC_BK
97
98
  uint32_t m_voMaxAmpduSize; ///< maximum A-MPDU size for AC_VO
99
  uint32_t m_viMaxAmpduSize; ///< maximum A-MPDU size for AC_VI
100
  uint32_t m_beMaxAmpduSize; ///< maximum A-MPDU size for AC_BE
101
  uint32_t m_bkMaxAmpduSize; ///< maximum A-MPDU size for AC_BK
94
};
102
};
95
103
96
} //namespace ns3
104
} //namespace ns3
(-)a/src/wifi/model/mac-low-transmission-parameters.cc (+15 lines)
 Lines 56-61   MacLowTransmissionParameters::EnableCompressedBlockAck (void) Link Here 
56
}
56
}
57
57
58
void
58
void
59
MacLowTransmissionParameters::EnableExtendedCompressedBlockAck (void)
60
{
61
  m_waitAck = EXTENDED_BLOCK_ACK_COMPRESSED;
62
}
63
64
void
59
MacLowTransmissionParameters::EnableMultiTidBlockAck (void)
65
MacLowTransmissionParameters::EnableMultiTidBlockAck (void)
60
{
66
{
61
  m_waitAck = BLOCK_ACK_MULTI_TID;
67
  m_waitAck = BLOCK_ACK_MULTI_TID;
 Lines 104-109   MacLowTransmissionParameters::MustWaitCompressedBlockAck (void) const Link Here 
104
}
110
}
105
111
106
bool
112
bool
113
MacLowTransmissionParameters::MustWaitExtendedCompressedBlockAck (void) const
114
{
115
  return (m_waitAck == EXTENDED_BLOCK_ACK_COMPRESSED) ? true : false;
116
}
117
118
bool
107
MacLowTransmissionParameters::MustWaitMultiTidBlockAck (void) const
119
MacLowTransmissionParameters::MustWaitMultiTidBlockAck (void) const
108
{
120
{
109
  return (m_waitAck == BLOCK_ACK_MULTI_TID) ? true : false;
121
  return (m_waitAck == BLOCK_ACK_MULTI_TID) ? true : false;
 Lines 148-153   std::ostream &operator << (std::ostream &os, const MacLowTransmissionParameters Link Here 
148
    case MacLowTransmissionParameters::BLOCK_ACK_COMPRESSED:
160
    case MacLowTransmissionParameters::BLOCK_ACK_COMPRESSED:
149
      os << "compressed-block-ack";
161
      os << "compressed-block-ack";
150
      break;
162
      break;
163
    case MacLowTransmissionParameters::EXTENDED_BLOCK_ACK_COMPRESSED:
164
      os << "extended-compressed-block-ack";
165
      break;
151
    case MacLowTransmissionParameters::BLOCK_ACK_MULTI_TID:
166
    case MacLowTransmissionParameters::BLOCK_ACK_MULTI_TID:
152
      os << "multi-tid-block-ack";
167
      os << "multi-tid-block-ack";
153
      break;
168
      break;
(-)a/src/wifi/model/mac-low-transmission-parameters.h (+11 lines)
 Lines 55-60   public: Link Here 
55
   */
55
   */
56
  void EnableCompressedBlockAck (void);
56
  void EnableCompressedBlockAck (void);
57
  /**
57
  /**
58
   * Wait COMPRESSEDBLOCKACKTimeout for an Extended Compressed Block Ack Response frame.
59
   */
60
  void EnableExtendedCompressedBlockAck (void);
61
  /**
58
   * NOT IMPLEMENTED FOR NOW
62
   * NOT IMPLEMENTED FOR NOW
59
   */
63
   */
60
  void EnableMultiTidBlockAck (void);
64
  void EnableMultiTidBlockAck (void);
 Lines 108-113   public: Link Here 
108
   */
112
   */
109
  bool MustWaitCompressedBlockAck (void) const;
113
  bool MustWaitCompressedBlockAck (void) const;
110
  /**
114
  /**
115
   * \returns true if extended compressed block ack mechanism is used, false otherwise.
116
   *
117
   * \sa EnableExtendedCompressedBlockAck
118
   */
119
  bool MustWaitExtendedCompressedBlockAck (void) const;
120
  /**
111
   * \returns true if multi-tid block ack mechanism is used, false otherwise.
121
   * \returns true if multi-tid block ack mechanism is used, false otherwise.
112
   *
122
   *
113
   * \sa EnableMultiTidBlockAck
123
   * \sa EnableMultiTidBlockAck
 Lines 137-142   private: Link Here 
137
    ACK_NORMAL,
147
    ACK_NORMAL,
138
    BLOCK_ACK_BASIC,
148
    BLOCK_ACK_BASIC,
139
    BLOCK_ACK_COMPRESSED,
149
    BLOCK_ACK_COMPRESSED,
150
    EXTENDED_BLOCK_ACK_COMPRESSED,
140
    BLOCK_ACK_MULTI_TID
151
    BLOCK_ACK_MULTI_TID
141
  } m_waitAck; //!< wait ack
152
  } m_waitAck; //!< wait ack
142
  bool m_sendRts; //!< send an RTS?
153
  bool m_sendRts; //!< send an RTS?
(-)a/src/wifi/model/mac-low.cc (-46 / +273 lines)
 Lines 39-44    Link Here 
39
#include "wifi-mac-trailer.h"
39
#include "wifi-mac-trailer.h"
40
#include "wifi-phy.h"
40
#include "wifi-phy.h"
41
#include "wifi-net-device.h"
41
#include "wifi-net-device.h"
42
#include "wifi-mac.h"
43
#include "ht-configuration.h"
44
#include "vht-configuration.h"
45
#include "he-configuration.h"
42
46
43
#undef NS_LOG_APPEND_CONTEXT
47
#undef NS_LOG_APPEND_CONTEXT
44
#define NS_LOG_APPEND_CONTEXT std::clog << "[mac=" << m_self << "] "
48
#define NS_LOG_APPEND_CONTEXT std::clog << "[mac=" << m_self << "] "
 Lines 271-276   MacLow::ResetPhy (void) Link Here 
271
}
275
}
272
276
273
void
277
void
278
MacLow::SetMac (const Ptr<WifiMac> mac)
279
{
280
  m_mac = mac;
281
}
282
283
void
274
MacLow::SetWifiRemoteStationManager (const Ptr<WifiRemoteStationManager> manager)
284
MacLow::SetWifiRemoteStationManager (const Ptr<WifiRemoteStationManager> manager)
275
{
285
{
276
  m_stationManager = manager;
286
  m_stationManager = manager;
 Lines 536-542   MacLow::StartTransmission (Ptr<const Packet> packet, Link Here 
536
      m_ampdu = true;
546
      m_ampdu = true;
537
      if (sentMpdus > 1)
547
      if (sentMpdus > 1)
538
        {
548
        {
539
          m_txParams.EnableCompressedBlockAck ();
549
          AcIndex ac = QosUtilsMapTidToAc (GetTid (packet, *hdr));
550
          std::map<AcIndex, Ptr<QosTxop> >::const_iterator edcaIt = m_edca.find (ac);
551
          if (edcaIt->second->GetBaBufferSize (m_currentHdr.GetAddr1 (), m_currentHdr.GetQosTid ()) > 64)
552
            {
553
              m_txParams.EnableExtendedCompressedBlockAck ();
554
            }
555
          else
556
            {
557
              m_txParams.EnableCompressedBlockAck ();
558
            }
540
        }
559
        }
541
      else if (m_currentHdr.IsQosData ())
560
      else if (m_currentHdr.IsQosData ())
542
        {
561
        {
 Lines 551-557   MacLow::StartTransmission (Ptr<const Packet> packet, Link Here 
551
          Ptr<Packet> newPacket = (m_txPackets[GetTid (packet, *hdr)].at (i).packet)->Copy ();
570
          Ptr<Packet> newPacket = (m_txPackets[GetTid (packet, *hdr)].at (i).packet)->Copy ();
552
          newPacket->AddHeader (m_txPackets[GetTid (packet, *hdr)].at (i).hdr);
571
          newPacket->AddHeader (m_txPackets[GetTid (packet, *hdr)].at (i).hdr);
553
          AddWifiMacTrailer (newPacket);
572
          AddWifiMacTrailer (newPacket);
554
          edcaIt->second->GetMpduAggregator ()->Aggregate (newPacket, aggregatedPacket);
573
          edcaIt->second->GetMpduAggregator ()->Aggregate (newPacket, aggregatedPacket, GetMaxAmpduSize (ac));
555
        }
574
        }
556
      m_currentPacket = aggregatedPacket;
575
      m_currentPacket = aggregatedPacket;
557
      m_currentHdr = (m_txPackets[GetTid (packet, *hdr)].at (0).hdr);
576
      m_currentHdr = (m_txPackets[GetTid (packet, *hdr)].at (0).hdr);
 Lines 567-573   MacLow::StartTransmission (Ptr<const Packet> packet, Link Here 
567
          m_currentPacket->PeekPacketTag (ampdu);
586
          m_currentPacket->PeekPacketTag (ampdu);
568
          if (ampdu.GetRemainingNbOfMpdus () > 0)
587
          if (ampdu.GetRemainingNbOfMpdus () > 0)
569
            {
588
            {
570
              m_txParams.EnableCompressedBlockAck ();
589
              AcIndex ac = QosUtilsMapTidToAc (GetTid (packet, *hdr));
590
              std::map<AcIndex, Ptr<QosTxop> >::const_iterator edcaIt = m_edca.find (ac);
591
              if (edcaIt->second->GetBaBufferSize (m_currentHdr.GetAddr1 (), m_currentHdr.GetQosTid ()) > 64)
592
                {
593
                  m_txParams.EnableExtendedCompressedBlockAck ();
594
                }
595
              else 
596
                {
597
                  m_txParams.EnableCompressedBlockAck ();
598
                }
571
            }
599
            }
572
          else if (m_currentHdr.IsQosData ())
600
          else if (m_currentHdr.IsQosData ())
573
            {
601
            {
 Lines 815-821   MacLow::ReceiveOk (Ptr<Packet> packet, double rxSnr, WifiTxVector txVector, bool Link Here 
815
        }
843
        }
816
    }
844
    }
817
  else if (hdr.IsBlockAck () && hdr.GetAddr1 () == m_self
845
  else if (hdr.IsBlockAck () && hdr.GetAddr1 () == m_self
818
           && (m_txParams.MustWaitBasicBlockAck () || m_txParams.MustWaitCompressedBlockAck ())
846
           && (m_txParams.MustWaitBasicBlockAck () || m_txParams.MustWaitCompressedBlockAck () || m_txParams.MustWaitExtendedCompressedBlockAck ())
819
           && m_blockAckTimeoutEvent.IsRunning ())
847
           && m_blockAckTimeoutEvent.IsRunning ())
820
    {
848
    {
821
      NS_LOG_DEBUG ("got block ack from " << hdr.GetAddr2 ());
849
      NS_LOG_DEBUG ("got block ack from " << hdr.GetAddr2 ());
 Lines 1573-1582   MacLow::SendRtsForPacket (void) Link Here 
1573
      WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ());
1601
      WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ());
1574
      duration += GetBlockAckDuration (blockAckReqTxVector, BASIC_BLOCK_ACK);
1602
      duration += GetBlockAckDuration (blockAckReqTxVector, BASIC_BLOCK_ACK);
1575
    }
1603
    }
1576
  else if (m_txParams.MustWaitCompressedBlockAck ())
1604
  else if (m_txParams.MustWaitCompressedBlockAck () || m_txParams.MustWaitExtendedCompressedBlockAck ())
1577
    {
1605
    {
1578
      WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ());
1606
      WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ());
1579
      duration += GetBlockAckDuration (blockAckReqTxVector, COMPRESSED_BLOCK_ACK);
1607
        if (m_txParams.MustWaitExtendedCompressedBlockAck ())
1608
          {
1609
            duration += GetBlockAckDuration (blockAckReqTxVector, EXTENDED_COMPRESSED_BLOCK_ACK);
1610
          }
1611
        else
1612
          {
1613
            duration += GetBlockAckDuration (blockAckReqTxVector, COMPRESSED_BLOCK_ACK);
1614
          }
1580
    }
1615
    }
1581
  else if (m_txParams.MustWaitNormalAck ())
1616
  else if (m_txParams.MustWaitNormalAck ())
1582
    {
1617
    {
 Lines 1626-1632   MacLow::StartDataTxTimers (WifiTxVector dataTxVector) Link Here 
1626
      NotifyAckTimeoutStartNow (timerDelay);
1661
      NotifyAckTimeoutStartNow (timerDelay);
1627
      m_blockAckTimeoutEvent = Simulator::Schedule (timerDelay, &MacLow::BlockAckTimeout, this);
1662
      m_blockAckTimeoutEvent = Simulator::Schedule (timerDelay, &MacLow::BlockAckTimeout, this);
1628
    }
1663
    }
1629
  else if (m_txParams.MustWaitCompressedBlockAck ())
1664
  else if (m_txParams.MustWaitCompressedBlockAck () || m_txParams.MustWaitExtendedCompressedBlockAck ())
1630
    {
1665
    {
1631
      Time timerDelay = txDuration + GetCompressedBlockAckTimeout ();
1666
      Time timerDelay = txDuration + GetCompressedBlockAckTimeout ();
1632
      NS_ASSERT (m_blockAckTimeoutEvent.IsExpired ());
1667
      NS_ASSERT (m_blockAckTimeoutEvent.IsExpired ());
 Lines 1683-1693   MacLow::SendDataPacket (void) Link Here 
1683
          WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ());
1718
          WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ());
1684
          duration += GetBlockAckDuration (blockAckReqTxVector, BASIC_BLOCK_ACK);
1719
          duration += GetBlockAckDuration (blockAckReqTxVector, BASIC_BLOCK_ACK);
1685
        }
1720
        }
1686
      else if (m_txParams.MustWaitCompressedBlockAck ())
1721
      else if (m_txParams.MustWaitCompressedBlockAck () || m_txParams.MustWaitExtendedCompressedBlockAck ())
1687
        {
1722
        {
1688
          duration += GetSifs ();
1723
          duration += GetSifs ();
1689
          WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ());
1724
          WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ());
1690
          duration += GetBlockAckDuration (blockAckReqTxVector, COMPRESSED_BLOCK_ACK);
1725
          if (m_txParams.MustWaitExtendedCompressedBlockAck ())
1726
            {
1727
              duration += GetBlockAckDuration (blockAckReqTxVector, EXTENDED_COMPRESSED_BLOCK_ACK);
1728
            }
1729
          else
1730
            {
1731
              duration += GetBlockAckDuration (blockAckReqTxVector, COMPRESSED_BLOCK_ACK);
1732
            }
1691
        }
1733
        }
1692
      else if (m_txParams.MustWaitNormalAck ())
1734
      else if (m_txParams.MustWaitNormalAck ())
1693
        {
1735
        {
 Lines 1807-1817   MacLow::SendCtsToSelf (void) Link Here 
1807
      WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ());
1849
      WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ());
1808
      duration += GetBlockAckDuration (blockAckReqTxVector, BASIC_BLOCK_ACK);
1850
      duration += GetBlockAckDuration (blockAckReqTxVector, BASIC_BLOCK_ACK);
1809
    }
1851
    }
1810
  else if (m_txParams.MustWaitCompressedBlockAck ())
1852
  else if (m_txParams.MustWaitCompressedBlockAck () || m_txParams.MustWaitExtendedCompressedBlockAck ())
1811
    {
1853
    {
1812
      duration += GetSifs ();
1854
      duration += GetSifs ();
1813
      WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ());
1855
      WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ());
1814
      duration += GetBlockAckDuration (blockAckReqTxVector, COMPRESSED_BLOCK_ACK);
1856
      if (m_txParams.MustWaitExtendedCompressedBlockAck ())
1857
        {
1858
          duration += GetBlockAckDuration (blockAckReqTxVector, EXTENDED_COMPRESSED_BLOCK_ACK);
1859
        }
1860
      else
1861
        {
1862
          duration += GetBlockAckDuration (blockAckReqTxVector, COMPRESSED_BLOCK_ACK);
1863
        }
1815
    }
1864
    }
1816
  else if (m_txParams.MustWaitNormalAck ())
1865
  else if (m_txParams.MustWaitNormalAck ())
1817
    {
1866
    {
 Lines 1823-1833   MacLow::SendCtsToSelf (void) Link Here 
1823
      duration += GetSifs ();
1872
      duration += GetSifs ();
1824
      duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (),
1873
      duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (),
1825
                                              m_currentTxVector, m_phy->GetFrequency ());
1874
                                              m_currentTxVector, m_phy->GetFrequency ());
1826
      if (m_txParams.MustWaitCompressedBlockAck ())
1875
      if (m_txParams.MustWaitCompressedBlockAck () || m_txParams.MustWaitExtendedCompressedBlockAck ())
1827
        {
1876
        {
1828
          duration += GetSifs ();
1877
          duration += GetSifs ();
1829
          WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ());
1878
          WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ());
1830
          duration += GetBlockAckDuration (blockAckReqTxVector, COMPRESSED_BLOCK_ACK);
1879
          if (m_txParams.MustWaitExtendedCompressedBlockAck ())
1880
            {
1881
              duration += GetBlockAckDuration (blockAckReqTxVector, EXTENDED_COMPRESSED_BLOCK_ACK);
1882
            }
1883
          else
1884
            {
1885
              duration += GetBlockAckDuration (blockAckReqTxVector, COMPRESSED_BLOCK_ACK);
1886
            }
1831
        }
1887
        }
1832
      else if (m_txParams.MustWaitNormalAck ())
1888
      else if (m_txParams.MustWaitNormalAck ())
1833
        {
1889
        {
 Lines 1916-1926   MacLow::SendDataAfterCts (Time duration) Link Here 
1916
      WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ());
1972
      WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ());
1917
      newDuration += GetBlockAckDuration (blockAckReqTxVector, BASIC_BLOCK_ACK);
1973
      newDuration += GetBlockAckDuration (blockAckReqTxVector, BASIC_BLOCK_ACK);
1918
    }
1974
    }
1919
  else if (m_txParams.MustWaitCompressedBlockAck ())
1975
  else if (m_txParams.MustWaitCompressedBlockAck () || m_txParams.MustWaitExtendedCompressedBlockAck ())
1920
    {
1976
    {
1921
      newDuration += GetSifs ();
1977
      newDuration += GetSifs ();
1922
      WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ());
1978
      WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ());
1923
      newDuration += GetBlockAckDuration (blockAckReqTxVector, COMPRESSED_BLOCK_ACK);
1979
      if (m_txParams.MustWaitExtendedCompressedBlockAck ())
1980
        {
1981
          newDuration += GetBlockAckDuration (blockAckReqTxVector, EXTENDED_COMPRESSED_BLOCK_ACK);
1982
        }
1983
      else
1984
        {
1985
          newDuration += GetBlockAckDuration (blockAckReqTxVector, COMPRESSED_BLOCK_ACK);
1986
        }
1924
    }
1987
    }
1925
  else if (m_txParams.MustWaitNormalAck ())
1988
  else if (m_txParams.MustWaitNormalAck ())
1926
    {
1989
    {
 Lines 1938-1948   MacLow::SendDataAfterCts (Time duration) Link Here 
1938
          newDuration += GetSifs ();
2001
          newDuration += GetSifs ();
1939
        }
2002
        }
1940
      newDuration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), m_currentTxVector, m_phy->GetFrequency ());
2003
      newDuration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), m_currentTxVector, m_phy->GetFrequency ());
1941
      if (m_txParams.MustWaitCompressedBlockAck ())
2004
      if (m_txParams.MustWaitCompressedBlockAck () || m_txParams.MustWaitExtendedCompressedBlockAck ())
1942
        {
2005
        {
1943
          newDuration += GetSifs ();
2006
          newDuration += GetSifs ();
1944
          WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ());
2007
          WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ());
1945
          newDuration += GetBlockAckDuration (blockAckReqTxVector, COMPRESSED_BLOCK_ACK);
2008
          if (m_txParams.MustWaitExtendedCompressedBlockAck ())
2009
            {
2010
              newDuration += GetBlockAckDuration (blockAckReqTxVector, EXTENDED_COMPRESSED_BLOCK_ACK);
2011
            }
2012
          else
2013
            {
2014
              newDuration += GetBlockAckDuration (blockAckReqTxVector, COMPRESSED_BLOCK_ACK);
2015
            }
1946
        }
2016
        }
1947
      else if (m_txParams.MustWaitNormalAck ())
2017
      else if (m_txParams.MustWaitNormalAck ())
1948
        {
2018
        {
 Lines 2259-2264   MacLow::RxCompleteBufferedPacketsUntilFirstLost (Mac48Address originator, uint8_ Link Here 
2259
      (*it).second.second.erase ((*it).second.second.begin (), lastComplete);
2329
      (*it).second.second.erase ((*it).second.second.begin (), lastComplete);
2260
    }
2330
    }
2261
}
2331
}
2332
2262
void
2333
void
2263
MacLow::SendBlockAckResponse (const CtrlBAckResponseHeader* blockAck, Mac48Address originator, bool immediate,
2334
MacLow::SendBlockAckResponse (const CtrlBAckResponseHeader* blockAck, Mac48Address originator, bool immediate,
2264
                              Time duration, WifiMode blockAckReqTxMode, double rxSnr)
2335
                              Time duration, WifiMode blockAckReqTxMode, double rxSnr)
 Lines 2282-2299   MacLow::SendBlockAckResponse (const CtrlBAckResponseHeader* blockAck, Mac48Addre Link Here 
2282
    {
2353
    {
2283
      m_txParams.DisableAck ();
2354
      m_txParams.DisableAck ();
2284
      duration -= GetSifs ();
2355
      duration -= GetSifs ();
2285
      if (blockAck->IsBasic ())
2356
      duration -= GetBlockAckDuration (blockAckReqTxVector, blockAck->GetType ());
2286
        {
2287
          duration -= GetBlockAckDuration (blockAckReqTxVector, BASIC_BLOCK_ACK);
2288
        }
2289
      else if (blockAck->IsCompressed ())
2290
        {
2291
          duration -= GetBlockAckDuration (blockAckReqTxVector, COMPRESSED_BLOCK_ACK);
2292
        }
2293
      else if (blockAck->IsMultiTid ())
2294
        {
2295
          NS_FATAL_ERROR ("Multi-tid block ack is not supported.");
2296
        }
2297
    }
2357
    }
2298
  else
2358
  else
2299
    {
2359
    {
 Lines 2338-2348   MacLow::SendBlockAckAfterAmpdu (uint8_t tid, Mac48Address originator, Time durat Link Here 
2338
      blockAck.SetStartingSequence (seqNumber);
2398
      blockAck.SetStartingSequence (seqNumber);
2339
      blockAck.SetTidInfo (tid);
2399
      blockAck.SetTidInfo (tid);
2340
      immediate = (*it).second.first.IsImmediateBlockAck ();
2400
      immediate = (*it).second.first.IsImmediateBlockAck ();
2341
      blockAck.SetType (COMPRESSED_BLOCK_ACK);
2401
      if ((*it).second.first.GetBufferSize () > 64)
2402
        {
2403
          blockAck.SetType (EXTENDED_COMPRESSED_BLOCK_ACK);
2404
        }
2405
      else
2406
        {
2407
          blockAck.SetType (COMPRESSED_BLOCK_ACK);
2408
        }
2342
      NS_LOG_DEBUG ("Got Implicit block Ack Req with seq " << seqNumber);
2409
      NS_LOG_DEBUG ("Got Implicit block Ack Req with seq " << seqNumber);
2343
      (*i).second.FillBlockAckBitmap (&blockAck);
2410
      (*i).second.FillBlockAckBitmap (&blockAck);
2344
2411
2345
      SendBlockAckResponse (&blockAck, originator, immediate, duration, blockAckReqTxVector.GetMode (), rxSnr);
2412
      WifiTxVector blockAckTxVector = GetBlockAckTxVector (originator, blockAckReqTxVector.GetMode ());
2413
2414
      SendBlockAckResponse (&blockAck, originator, immediate, duration, blockAckTxVector.GetMode (), rxSnr);
2346
    }
2415
    }
2347
  else
2416
  else
2348
    {
2417
    {
 Lines 2375-2380   MacLow::SendBlockAckAfterBlockAckRequest (const CtrlBAckRequestHeader reqHdr, Ma Link Here 
2375
            {
2444
            {
2376
              blockAck.SetType (COMPRESSED_BLOCK_ACK);
2445
              blockAck.SetType (COMPRESSED_BLOCK_ACK);
2377
            }
2446
            }
2447
          else if (reqHdr.IsExtendedCompressed ())
2448
            {
2449
              blockAck.SetType (EXTENDED_COMPRESSED_BLOCK_ACK);
2450
            }
2378
          BlockAckCachesI i = m_bAckCaches.find (std::make_pair (originator, tid));
2451
          BlockAckCachesI i = m_bAckCaches.find (std::make_pair (originator, tid));
2379
          NS_ASSERT (i != m_bAckCaches.end ());
2452
          NS_ASSERT (i != m_bAckCaches.end ());
2380
          (*i).second.FillBlockAckBitmap (&blockAck);
2453
          (*i).second.FillBlockAckBitmap (&blockAck);
 Lines 2470-2477   MacLow::DeaggregateAmpduAndReceive (Ptr<Packet> aggregatedPacket, double rxSnr, Link Here 
2470
                                                    firsthdr.GetQosTid (),
2543
                                                    firsthdr.GetQosTid (),
2471
                                                    firsthdr.GetAddr2 (),
2544
                                                    firsthdr.GetAddr2 (),
2472
                                                    firsthdr.GetDuration (),
2545
                                                    firsthdr.GetDuration (),
2473
                                                    txVector,
2546
                                                    txVector, rxSnr);
2474
                                                    rxSnr);
2475
            }
2547
            }
2476
2548
2477
          if (firsthdr.IsAck () || firsthdr.IsBlockAck () || firsthdr.IsBlockAckReq ())
2549
          if (firsthdr.IsAck () || firsthdr.IsBlockAck () || firsthdr.IsBlockAckReq ())
 Lines 2551-2557   MacLow::StopMpduAggregation (Ptr<const Packet> peekedPacket, WifiMacHeader peeke Link Here 
2551
      return true;
2623
      return true;
2552
    }
2624
    }
2553
2625
2554
  if (!edcaIt->second->GetMpduAggregator ()->CanBeAggregated (peekedPacket->GetSize () + peekedHdr.GetSize () + WIFI_MAC_FCS_LENGTH, aggregatedPacket, blockAckSize))
2626
  if (!edcaIt->second->GetMpduAggregator ()->CanBeAggregated (peekedPacket->GetSize () + peekedHdr.GetSize () + WIFI_MAC_FCS_LENGTH, aggregatedPacket, blockAckSize, GetMaxAmpduSize (ac)))
2555
    {
2627
    {
2556
      NS_LOG_DEBUG ("no more packets can be aggregated because the maximum A-MPDU size has been reached");
2628
      NS_LOG_DEBUG ("no more packets can be aggregated because the maximum A-MPDU size has been reached");
2557
      return true;
2629
      return true;
 Lines 2594-2600   MacLow::AggregateToAmpdu (Ptr<const Packet> packet, const WifiMacHeader hdr) Link Here 
2594
2666
2595
      if (!hdr.GetAddr1 ().IsBroadcast () && edcaIt->second->GetMpduAggregator () != 0)
2667
      if (!hdr.GetAddr1 ().IsBroadcast () && edcaIt->second->GetMpduAggregator () != 0)
2596
        {
2668
        {
2597
          //Have to make sure that their exist a block Ack agreement before sending an AMPDU (BlockAck Manager)
2669
          //Have to make sure that their exist a block Ack agreement before sending an A-MPDU
2598
          if (edcaIt->second->GetBaAgreementExists (hdr.GetAddr1 (), tid))
2670
          if (edcaIt->second->GetBaAgreementExists (hdr.GetAddr1 (), tid))
2599
            {
2671
            {
2600
              /* here is performed mpdu aggregation */
2672
              /* here is performed mpdu aggregation */
 Lines 2606-2612   MacLow::AggregateToAmpdu (Ptr<const Packet> packet, const WifiMacHeader hdr) Link Here 
2606
              uint8_t qosPolicy = 0;
2678
              uint8_t qosPolicy = 0;
2607
              uint8_t blockAckSize = 0;
2679
              uint8_t blockAckSize = 0;
2608
              bool aggregated = false;
2680
              bool aggregated = false;
2609
              uint8_t i = 0;
2681
              uint16_t i = 0;
2610
              aggPacket = newPacket->Copy ();
2682
              aggPacket = newPacket->Copy ();
2611
2683
2612
              if (!hdr.IsBlockAckReq ())
2684
              if (!hdr.IsBlockAckReq ())
 Lines 2620-2626   MacLow::AggregateToAmpdu (Ptr<const Packet> packet, const WifiMacHeader hdr) Link Here 
2620
                  newPacket->AddHeader (peekedHdr);
2692
                  newPacket->AddHeader (peekedHdr);
2621
                  AddWifiMacTrailer (newPacket);
2693
                  AddWifiMacTrailer (newPacket);
2622
2694
2623
                  aggregated = edcaIt->second->GetMpduAggregator ()->Aggregate (newPacket, currentAggregatedPacket);
2695
                  aggregated = edcaIt->second->GetMpduAggregator ()->Aggregate (newPacket, currentAggregatedPacket, GetMaxAmpduSize (ac));
2624
2696
2625
                  if (aggregated)
2697
                  if (aggregated)
2626
                    {
2698
                    {
 Lines 2668-2674   MacLow::AggregateToAmpdu (Ptr<const Packet> packet, const WifiMacHeader hdr) Link Here 
2668
                  currentSequenceNumber = peekedHdr.GetSequenceNumber ();
2740
                  currentSequenceNumber = peekedHdr.GetSequenceNumber ();
2669
                }
2741
                }
2670
2742
2671
              while (IsInWindow (currentSequenceNumber, startingSequenceNumber, 64) && !StopMpduAggregation (peekedPacket, peekedHdr, currentAggregatedPacket, blockAckSize))
2743
              uint16_t maxMpdus = edcaIt->second->GetBaBufferSize (hdr.GetAddr1 (), tid);
2744
              while (IsInWindow (currentSequenceNumber, startingSequenceNumber, maxMpdus) && !StopMpduAggregation (peekedPacket, peekedHdr, currentAggregatedPacket, blockAckSize))
2672
                {
2745
                {
2673
                  //for now always send AMPDU with normal ACK
2746
                  //for now always send AMPDU with normal ACK
2674
                  if (retry == false)
2747
                  if (retry == false)
 Lines 2693-2699   MacLow::AggregateToAmpdu (Ptr<const Packet> packet, const WifiMacHeader hdr) Link Here 
2693
2766
2694
                  newPacket->AddHeader (peekedHdr);
2767
                  newPacket->AddHeader (peekedHdr);
2695
                  AddWifiMacTrailer (newPacket);
2768
                  AddWifiMacTrailer (newPacket);
2696
                  aggregated = edcaIt->second->GetMpduAggregator ()->Aggregate (newPacket, currentAggregatedPacket);
2769
                  aggregated = edcaIt->second->GetMpduAggregator ()->Aggregate (newPacket, currentAggregatedPacket, GetMaxAmpduSize (ac));
2697
                  if (aggregated)
2770
                  if (aggregated)
2698
                    {
2771
                    {
2699
                      m_aggregateQueue[tid]->Enqueue (Create<WifiMacQueueItem> (aggPacket, peekedHdr));
2772
                      m_aggregateQueue[tid]->Enqueue (Create<WifiMacQueueItem> (aggPacket, peekedHdr));
 Lines 2747-2753   MacLow::AggregateToAmpdu (Ptr<const Packet> packet, const WifiMacHeader hdr) Link Here 
2747
                              peekedPacket = item->GetPacket ();
2820
                              peekedPacket = item->GetPacket ();
2748
                              peekedHdr = item->GetHeader ();
2821
                              peekedHdr = item->GetHeader ();
2749
                              tstamp = item->GetTimeStamp ();
2822
                              tstamp = item->GetTimeStamp ();
2750
                              //find what will the sequence number be so that we don't send more than 64 packets apart
2751
                              currentSequenceNumber = edcaIt->second->PeekNextSequenceNumberFor (&peekedHdr);
2823
                              currentSequenceNumber = edcaIt->second->PeekNextSequenceNumberFor (&peekedHdr);
2752
2824
2753
                              if (edcaIt->second->GetMsduAggregator () != 0)
2825
                              if (edcaIt->second->GetMsduAggregator () != 0)
 Lines 2774-2783   MacLow::AggregateToAmpdu (Ptr<const Packet> packet, const WifiMacHeader hdr) Link Here 
2774
                          peekedPacket = item->GetPacket ();
2846
                          peekedPacket = item->GetPacket ();
2775
                          peekedHdr = item->GetHeader ();
2847
                          peekedHdr = item->GetHeader ();
2776
                          tstamp = item->GetTimeStamp ();
2848
                          tstamp = item->GetTimeStamp ();
2777
                          //find what will the sequence number be so that we don't send more than 64 packets apart
2778
                          currentSequenceNumber = edcaIt->second->PeekNextSequenceNumberFor (&peekedHdr);
2849
                          currentSequenceNumber = edcaIt->second->PeekNextSequenceNumberFor (&peekedHdr);
2779
2850
2780
                          if (edcaIt->second->GetMsduAggregator () != 0 && IsInWindow (currentSequenceNumber, startingSequenceNumber, 64))
2851
                          if (edcaIt->second->GetMsduAggregator () != 0 && IsInWindow (currentSequenceNumber, startingSequenceNumber, maxMpdus))
2781
                            {
2852
                            {
2782
                              tempPacket = PerformMsduAggregation (peekedPacket, &peekedHdr, &tstamp, currentAggregatedPacket, blockAckSize);
2853
                              tempPacket = PerformMsduAggregation (peekedPacket, &peekedHdr, &tstamp, currentAggregatedPacket, blockAckSize);
2783
                              if (tempPacket != 0) //MSDU aggregation
2854
                              if (tempPacket != 0) //MSDU aggregation
 Lines 2803-2809   MacLow::AggregateToAmpdu (Ptr<const Packet> packet, const WifiMacHeader hdr) Link Here 
2803
                      m_aggregateQueue[tid]->Enqueue (Create<WifiMacQueueItem> (aggPacket, peekedHdr));
2874
                      m_aggregateQueue[tid]->Enqueue (Create<WifiMacQueueItem> (aggPacket, peekedHdr));
2804
                      newPacket->AddHeader (peekedHdr);
2875
                      newPacket->AddHeader (peekedHdr);
2805
                      AddWifiMacTrailer (newPacket);
2876
                      AddWifiMacTrailer (newPacket);
2806
                      edcaIt->second->GetMpduAggregator ()->Aggregate (newPacket, currentAggregatedPacket);
2877
                      edcaIt->second->GetMpduAggregator ()->Aggregate (newPacket, currentAggregatedPacket, GetMaxAmpduSize (ac));
2807
                      currentAggregatedPacket->AddHeader (blockAckReq);
2878
                      currentAggregatedPacket->AddHeader (blockAckReq);
2808
                    }
2879
                    }
2809
2880
 Lines 2818-2824   MacLow::AggregateToAmpdu (Ptr<const Packet> packet, const WifiMacHeader hdr) Link Here 
2818
                  newPacket = currentAggregatedPacket;
2889
                  newPacket = currentAggregatedPacket;
2819
                  newPacket->AddPacketTag (ampdutag);
2890
                  newPacket->AddPacketTag (ampdutag);
2820
2891
2821
                  NS_LOG_DEBUG ("tx unicast A-MPDU");
2892
                  NS_LOG_DEBUG ("tx unicast A-MPDU containing " << +i << " MPDUs");
2822
                  edcaIt->second->SetAmpduExist (hdr.GetAddr1 (), true);
2893
                  edcaIt->second->SetAmpduExist (hdr.GetAddr1 (), true);
2823
                }
2894
                }
2824
              else
2895
              else
 Lines 2914-2920   MacLow::PerformMsduAggregation (Ptr<const Packet> packet, WifiMacHeader *hdr, Ti Link Here 
2914
2985
2915
  edcaIt->second->GetMsduAggregator ()->Aggregate (packet, currentAmsduPacket,
2986
  edcaIt->second->GetMsduAggregator ()->Aggregate (packet, currentAmsduPacket,
2916
                                                   edcaIt->second->MapSrcAddressForAggregation (*hdr),
2987
                                                   edcaIt->second->MapSrcAddressForAggregation (*hdr),
2917
                                                   edcaIt->second->MapDestAddressForAggregation (*hdr));
2988
                                                   edcaIt->second->MapDestAddressForAggregation (*hdr),
2989
                                                   GetMaxAmsduSize (ac));
2918
2990
2919
  peekedItem = queue->PeekByTidAndAddress (hdr->GetQosTid (), hdr->GetAddr1 ());
2991
  peekedItem = queue->PeekByTidAndAddress (hdr->GetQosTid (), hdr->GetAddr1 ());
2920
  while (peekedItem != 0)
2992
  while (peekedItem != 0)
 Lines 2925-2931   MacLow::PerformMsduAggregation (Ptr<const Packet> packet, WifiMacHeader *hdr, Ti Link Here 
2925
2997
2926
      msduAggregation = edcaIt->second->GetMsduAggregator ()->Aggregate (peekedItem->GetPacket (), tempPacket,
2998
      msduAggregation = edcaIt->second->GetMsduAggregator ()->Aggregate (peekedItem->GetPacket (), tempPacket,
2927
                                                                         edcaIt->second->MapSrcAddressForAggregation (*hdr),
2999
                                                                         edcaIt->second->MapSrcAddressForAggregation (*hdr),
2928
                                                                         edcaIt->second->MapDestAddressForAggregation (*hdr));
3000
                                                                         edcaIt->second->MapDestAddressForAggregation (*hdr),
3001
                                                                         GetMaxAmsduSize (ac));
2929
3002
2930
      if (msduAggregation && !StopMpduAggregation (tempPacket, *hdr, currentAmpduPacket, blockAckSize))
3003
      if (msduAggregation && !StopMpduAggregation (tempPacket, *hdr, currentAmpduPacket, blockAckSize))
2931
        {
3004
        {
 Lines 2986-2989   MacLow::CanTransmitNextCfFrame (void) const Link Here 
2986
  return ((GetRemainingCfpDuration () - nextTransmission).IsPositive ());
3059
  return ((GetRemainingCfpDuration () - nextTransmission).IsPositive ());
2987
}
3060
}
2988
3061
3062
uint16_t
3063
MacLow::GetMaxAmsduSize (AcIndex ac) const
3064
{
3065
  UintegerValue size;
3066
  WifiModulationClass modulation = GetDataTxVector (m_currentPacket, &m_currentHdr).GetMode ().GetModulationClass ();
3067
  if (modulation == WIFI_MOD_CLASS_HT)
3068
    {
3069
      Ptr<HtConfiguration> htConfiguration = m_mac->GetHtConfiguration ();
3070
      NS_ASSERT (htConfiguration); //If modulation to transmit A-MSDU is HT, we should have a HT configuration attached
3071
      switch (ac)
3072
        {
3073
          case AC_BE:
3074
            htConfiguration->GetAttribute ("BeMaxAmsduSize", size);
3075
            break;
3076
          case AC_BK:
3077
            htConfiguration->GetAttribute ("BkMaxAmsduSize", size);
3078
            break;
3079
          case AC_VI:
3080
            htConfiguration->GetAttribute ("ViMaxAmsduSize", size);
3081
            break;
3082
          case AC_VO:
3083
            htConfiguration->GetAttribute ("VoMaxAmsduSize", size);
3084
            break;
3085
          default:
3086
            NS_ASSERT (false);
3087
            return 0;
3088
        }
3089
    }
3090
  else if (modulation == WIFI_MOD_CLASS_VHT)
3091
    {
3092
      Ptr<VhtConfiguration> vhtConfiguration = m_mac->GetVhtConfiguration ();
3093
      NS_ASSERT (vhtConfiguration); //If modulation to transmit A-MSDU is VHT, we should have a VHT configuration attached
3094
      switch (ac)
3095
        {
3096
          case AC_BE:
3097
            vhtConfiguration->GetAttribute ("BeMaxAmsduSize", size);
3098
            break;
3099
          case AC_BK:
3100
            vhtConfiguration->GetAttribute ("BkMaxAmsduSize", size);
3101
            break;
3102
          case AC_VI:
3103
            vhtConfiguration->GetAttribute ("ViMaxAmsduSize", size);
3104
            break;
3105
          case AC_VO:
3106
            vhtConfiguration->GetAttribute ("VoMaxAmsduSize", size);
3107
            break;
3108
          default:
3109
            NS_ASSERT (false);
3110
            return 0;
3111
        }
3112
    }
3113
  else if (modulation == WIFI_MOD_CLASS_HE)
3114
    {
3115
      Ptr<HeConfiguration> heConfiguration = m_mac->GetHeConfiguration ();
3116
      NS_ASSERT (heConfiguration); //If modulation to transmit A-MSDU is HE, we should have a HE configuration attached
3117
      switch (ac)
3118
        {
3119
          case AC_BE:
3120
            heConfiguration->GetAttribute ("BeMaxAmsduSize", size);
3121
            break;
3122
          case AC_BK:
3123
            heConfiguration->GetAttribute ("BkMaxAmsduSize", size);
3124
            break;
3125
          case AC_VI:
3126
            heConfiguration->GetAttribute ("ViMaxAmsduSize", size);
3127
            break;
3128
          case AC_VO:
3129
            heConfiguration->GetAttribute ("VoMaxAmsduSize", size);
3130
            break;
3131
          default:
3132
            NS_ASSERT (false);
3133
            return 0;
3134
        }
3135
    }
3136
  return size.Get ();
3137
}
3138
3139
uint32_t
3140
MacLow::GetMaxAmpduSize (AcIndex ac) const
3141
{
3142
  UintegerValue size;
3143
  WifiModulationClass modulation = GetDataTxVector (m_currentPacket, &m_currentHdr).GetMode ().GetModulationClass ();
3144
  if (modulation == WIFI_MOD_CLASS_HT)
3145
    {
3146
      Ptr<HtConfiguration> htConfiguration = m_mac->GetHtConfiguration ();
3147
      NS_ASSERT (htConfiguration); //If modulation to transmit A-MPDU is HT, we should have a HT configuration attached
3148
      switch (ac)
3149
        {
3150
          case AC_BE:
3151
            htConfiguration->GetAttribute ("BeMaxAmpduSize", size);
3152
            break;
3153
          case AC_BK:
3154
            htConfiguration->GetAttribute ("BkMaxAmpduSize", size);
3155
            break;
3156
          case AC_VI:
3157
            htConfiguration->GetAttribute ("ViMaxAmpduSize", size);
3158
            break;
3159
          case AC_VO:
3160
            htConfiguration->GetAttribute ("VoMaxAmpduSize", size);
3161
            break;
3162
          default:
3163
            NS_ASSERT (false);
3164
            return 0;
3165
        }
3166
    }
3167
  else if (modulation == WIFI_MOD_CLASS_VHT)
3168
    {
3169
      Ptr<VhtConfiguration> vhtConfiguration = m_mac->GetVhtConfiguration ();
3170
      NS_ASSERT (vhtConfiguration); //If modulation to transmit A-MPDU is VHT, we should have a VHT configuration attached
3171
      switch (ac)
3172
        {
3173
          case AC_BE:
3174
            vhtConfiguration->GetAttribute ("BeMaxAmpduSize", size);
3175
            break;
3176
          case AC_BK:
3177
            vhtConfiguration->GetAttribute ("BkMaxAmpduSize", size);
3178
            break;
3179
          case AC_VI:
3180
            vhtConfiguration->GetAttribute ("ViMaxAmpduSize", size);
3181
            break;
3182
          case AC_VO:
3183
            vhtConfiguration->GetAttribute ("VoMaxAmpduSize", size);
3184
            break;
3185
          default:
3186
            NS_ASSERT (false);
3187
            return 0;
3188
        }
3189
    }
3190
  else if (modulation == WIFI_MOD_CLASS_HE)
3191
    {
3192
      Ptr<HeConfiguration> heConfiguration = m_mac->GetHeConfiguration ();
3193
      NS_ASSERT (heConfiguration); //If modulation to transmit A-MPDU is HE, we should have a HE configuration attached
3194
      switch (ac)
3195
        {
3196
          case AC_BE:
3197
            heConfiguration->GetAttribute ("BeMaxAmpduSize", size);
3198
            break;
3199
          case AC_BK:
3200
            heConfiguration->GetAttribute ("BkMaxAmpduSize", size);
3201
            break;
3202
          case AC_VI:
3203
            heConfiguration->GetAttribute ("ViMaxAmpduSize", size);
3204
            break;
3205
          case AC_VO:
3206
            heConfiguration->GetAttribute ("VoMaxAmpduSize", size);
3207
            break;
3208
          default:
3209
            NS_ASSERT (false);
3210
            return 0;
3211
        }
3212
    }
3213
  return size.Get ();
3214
}
3215
2989
} //namespace ns3
3216
} //namespace ns3
(-)a/src/wifi/model/mac-low.h (-14 / +28 lines)
 Lines 37-45    Link Here 
37
37
38
class TwoLevelAggregationTest;
38
class TwoLevelAggregationTest;
39
class AmpduAggregationTest;
39
class AmpduAggregationTest;
40
class HeAggregationTest;
40
41
41
namespace ns3 {
42
namespace ns3 {
42
43
44
class WifiMac;
43
class WifiPhy;
45
class WifiPhy;
44
class Txop;
46
class Txop;
45
class QosTxop;
47
class QosTxop;
 Lines 60-67   class MacLow : public Object Link Here 
60
public:
62
public:
61
  /// Allow test cases to access private members
63
  /// Allow test cases to access private members
62
  friend class ::TwoLevelAggregationTest;
64
  friend class ::TwoLevelAggregationTest;
63
  /// Allow test cases to access private members
64
  friend class ::AmpduAggregationTest;
65
  friend class ::AmpduAggregationTest;
66
  friend class ::HeAggregationTest;
67
65
  /**
68
  /**
66
   * typedef for a callback for MacLowRx
69
   * typedef for a callback for MacLowRx
67
   */
70
   */
 Lines 91-96   public: Link Here 
91
   */
94
   */
92
  void ResetPhy (void);
95
  void ResetPhy (void);
93
  /**
96
  /**
97
   * Set up WifiMac associated with this MacLow.
98
   *
99
   * \param mac WifiMac associated with this MacLow
100
   */
101
  void SetMac (const Ptr<WifiMac> mac);
102
  /**
94
   * Set up WifiRemoteStationManager associated with this MacLow.
103
   * Set up WifiRemoteStationManager associated with this MacLow.
95
   *
104
   *
96
   * \param manager WifiRemoteStationManager associated with this MacLow
105
   * \param manager WifiRemoteStationManager associated with this MacLow
 Lines 403-419   public: Link Here 
403
   */
412
   */
404
  void DeaggregateAmpduAndReceive (Ptr<Packet> aggregatedPacket, double rxSnr, WifiTxVector txVector);
413
  void DeaggregateAmpduAndReceive (Ptr<Packet> aggregatedPacket, double rxSnr, WifiTxVector txVector);
405
  /**
414
  /**
406
   * \param peekedPacket the packet to be aggregated
407
   * \param peekedHdr the WifiMacHeader for the packet.
408
   * \param aggregatedPacket the current A-MPDU
409
   * \param blockAckSize the size of a piggybacked block ack request
410
   * \return false if the given packet can be added to an A-MPDU, true otherwise
411
   *
412
   * This function decides if a given packet can be added to an A-MPDU or not
413
   *
414
   */
415
  bool StopMpduAggregation (Ptr<const Packet> peekedPacket, WifiMacHeader peekedHdr, Ptr<Packet> aggregatedPacket, uint8_t blockAckSize) const;
416
  /**
417
   *
415
   *
418
   * This function is called to flush the aggregate queue, which is used for A-MPDU
416
   * This function is called to flush the aggregate queue, which is used for A-MPDU
419
   * \param tid the Traffic ID
417
   * \param tid the Traffic ID
 Lines 446-451   public: Link Here 
446
   * This function decides if a CF frame can be transmitted in the current CFP.
444
   * This function decides if a CF frame can be transmitted in the current CFP.
447
   */
445
   */
448
  bool CanTransmitNextCfFrame (void) const;
446
  bool CanTransmitNextCfFrame (void) const;
447
  //TODO
448
  uint16_t GetMaxAmsduSize (AcIndex ac) const;
449
  //TODO
450
  uint32_t GetMaxAmpduSize (AcIndex ac) const;
449
451
450
452
451
private:
453
private:
 Lines 477-482   private: Link Here 
477
   */
479
   */
478
  void SendMpdu (Ptr<const Packet> packet, WifiTxVector txVector, MpduType mpdutype);
480
  void SendMpdu (Ptr<const Packet> packet, WifiTxVector txVector, MpduType mpdutype);
479
  /**
481
  /**
482
   * \param peekedPacket the packet to be aggregated
483
   * \param peekedHdr the WifiMacHeader for the packet.
484
   * \param aggregatedPacket the current A-MPDU
485
   * \param blockAckSize the size of a piggybacked block ack request
486
   * \return false if the given packet can be added to an A-MPDU, true otherwise
487
   *
488
   * This function decides if a given packet can be added to an A-MPDU or not
489
   *
490
   */
491
  bool StopMpduAggregation (Ptr<const Packet> peekedPacket, WifiMacHeader peekedHdr, Ptr<Packet> aggregatedPacket, uint8_t blockAckSize) const;
492
  /**
480
   * Return a TXVECTOR for the RTS frame given the destination.
493
   * Return a TXVECTOR for the RTS frame given the destination.
481
   * The function consults WifiRemoteStationManager, which controls the rate
494
   * The function consults WifiRemoteStationManager, which controls the rate
482
   * to different destinations.
495
   * to different destinations.
 Lines 789-796   private: Link Here 
789
   * \param blockAckReqTxVector the transmit vector
802
   * \param blockAckReqTxVector the transmit vector
790
   * \param rxSnr the receive SNR
803
   * \param rxSnr the receive SNR
791
   */
804
   */
792
  void SendBlockAckAfterAmpdu (uint8_t tid, Mac48Address originator,
805
  void SendBlockAckAfterAmpdu (uint8_t tid, Mac48Address originator, Time duration,
793
                               Time duration, WifiTxVector blockAckReqTxVector, double rxSnr);
806
                               WifiTxVector blockAckReqTxVector, double rxSnr);
794
  /**
807
  /**
795
   * This method creates block ack frame with header equals to <i>blockAck</i> and start its transmission.
808
   * This method creates block ack frame with header equals to <i>blockAck</i> and start its transmission.
796
   *
809
   *
 Lines 857-862   private: Link Here 
857
  Ptr<Packet> PerformMsduAggregation (Ptr<const Packet> packet, WifiMacHeader *hdr, Time *tstamp, Ptr<Packet> currentAmpduPacket, uint8_t blockAckSize);
870
  Ptr<Packet> PerformMsduAggregation (Ptr<const Packet> packet, WifiMacHeader *hdr, Time *tstamp, Ptr<Packet> currentAmpduPacket, uint8_t blockAckSize);
858
871
859
  Ptr<WifiPhy> m_phy; //!< Pointer to WifiPhy (actually send/receives frames)
872
  Ptr<WifiPhy> m_phy; //!< Pointer to WifiPhy (actually send/receives frames)
873
  Ptr<WifiMac> m_mac; //!< Pointer to WifiMac (to fetch configuration)
860
  Ptr<WifiRemoteStationManager> m_stationManager; //!< Pointer to WifiRemoteStationManager (rate control)
874
  Ptr<WifiRemoteStationManager> m_stationManager; //!< Pointer to WifiRemoteStationManager (rate control)
861
  MacLowRxCallback m_rxCallback; //!< Callback to pass packet up
875
  MacLowRxCallback m_rxCallback; //!< Callback to pass packet up
862
876
(-)a/src/wifi/model/mpdu-aggregator.cc (-16 / +4 lines)
 Lines 48-67   MpduAggregator::~MpduAggregator () Link Here 
48
{
48
{
49
}
49
}
50
50
51
void
52
MpduAggregator::SetMaxAmpduSize (uint16_t maxSize)
53
{
54
  m_maxAmpduLength = maxSize;
55
}
56
57
uint16_t
58
MpduAggregator::GetMaxAmpduSize (void) const
59
{
60
  return m_maxAmpduLength;
61
}
62
63
bool
51
bool
64
MpduAggregator::Aggregate (Ptr<const Packet> packet, Ptr<Packet> aggregatedPacket) const
52
MpduAggregator::Aggregate (Ptr<const Packet> packet, Ptr<Packet> aggregatedPacket, uint32_t maxAmpduSize) const
65
{
53
{
66
  NS_LOG_FUNCTION (this);
54
  NS_LOG_FUNCTION (this);
67
  Ptr<Packet> currentPacket;
55
  Ptr<Packet> currentPacket;
 Lines 70-76   MpduAggregator::Aggregate (Ptr<const Packet> packet, Ptr<Packet> aggregatedPacke Link Here 
70
  uint8_t padding = CalculatePadding (aggregatedPacket);
58
  uint8_t padding = CalculatePadding (aggregatedPacket);
71
  uint32_t actualSize = aggregatedPacket->GetSize ();
59
  uint32_t actualSize = aggregatedPacket->GetSize ();
72
60
73
  if ((4 + packet->GetSize () + actualSize + padding) <= GetMaxAmpduSize ())
61
  if ((4 + packet->GetSize () + actualSize + padding) <= maxAmpduSize)
74
    {
62
    {
75
      if (padding)
63
      if (padding)
76
        {
64
        {
 Lines 134-140   MpduAggregator::AddHeaderAndPad (Ptr<Packet> packet, bool last, bool isSingleMpd Link Here 
134
}
122
}
135
123
136
bool
124
bool
137
MpduAggregator::CanBeAggregated (uint32_t packetSize, Ptr<Packet> aggregatedPacket, uint8_t blockAckSize) const
125
MpduAggregator::CanBeAggregated (uint32_t packetSize, Ptr<Packet> aggregatedPacket, uint8_t blockAckSize, uint32_t maxAmpduSize) const
138
{
126
{
139
  uint8_t padding = CalculatePadding (aggregatedPacket);
127
  uint8_t padding = CalculatePadding (aggregatedPacket);
140
  uint32_t actualSize = aggregatedPacket->GetSize ();
128
  uint32_t actualSize = aggregatedPacket->GetSize ();
 Lines 142-148   MpduAggregator::CanBeAggregated (uint32_t packetSize, Ptr<Packet> aggregatedPack Link Here 
142
    {
130
    {
143
      blockAckSize = blockAckSize + 4 + padding;
131
      blockAckSize = blockAckSize + 4 + padding;
144
    }
132
    }
145
  if ((4 + packetSize + actualSize + padding + blockAckSize) <= GetMaxAmpduSize ())
133
  if ((4 + packetSize + actualSize + padding + blockAckSize) <= maxAmpduSize)
146
    {
134
    {
147
      return true;
135
      return true;
148
    }
136
    }
(-)a/src/wifi/model/mpdu-aggregator.h (-19 / +4 lines)
 Lines 55-84   public: Link Here 
55
  virtual ~MpduAggregator ();
55
  virtual ~MpduAggregator ();
56
56
57
  /**
57
  /**
58
   * Sets the maximum A-MPDU size in bytes.
59
   * Value 0 means that MPDU aggregation is disabled.
60
   *
61
   * \param maxSize the maximum A-MPDU size in bytes.
62
   */
63
  void SetMaxAmpduSize (uint16_t maxSize);
64
  /**
65
   * Returns the maximum A-MPDU size in bytes.
66
   * Value 0 means that MPDU aggregation is disabled.
67
   *
68
   * \return the maximum A-MPDU size in bytes.
69
   */
70
  uint16_t GetMaxAmpduSize (void) const;
71
72
  /**
73
   * \param packet Packet we have to insert into <i>aggregatedPacket</i>.
58
   * \param packet Packet we have to insert into <i>aggregatedPacket</i>.
74
   * \param aggregatedPacket Packet that will contain <i>packet</i>, if aggregation is possible.
59
   * \param aggregatedPacket Packet that will contain <i>packet</i>, if aggregation is possible.
60
   * \param maxAmpduSize the maximum A-MPDU size.
75
   *
61
   *
76
   * \return true if <i>packet</i> can be aggregated to <i>aggregatedPacket</i>, false otherwise.
62
   * \return true if <i>packet</i> can be aggregated to <i>aggregatedPacket</i>, false otherwise.
77
   *
63
   *
78
   * Adds <i>packet</i> to <i>aggregatedPacket</i>. In concrete aggregator's implementation is
64
   * Adds <i>packet</i> to <i>aggregatedPacket</i>. In concrete aggregator's implementation is
79
   * specified how and if <i>packet</i> can be added to <i>aggregatedPacket</i>.
65
   * specified how and if <i>packet</i> can be added to <i>aggregatedPacket</i>.
80
   */
66
   */
81
  bool Aggregate (Ptr<const Packet> packet, Ptr<Packet> aggregatedPacket) const;
67
  bool Aggregate (Ptr<const Packet> packet, Ptr<Packet> aggregatedPacket, uint32_t maxAmpduSize) const;
82
  /**
68
  /**
83
   * \param packet the packet we want to insert into <i>aggregatedPacket</i>.
69
   * \param packet the packet we want to insert into <i>aggregatedPacket</i>.
84
   * \param aggregatedPacket packet that will contain the packet of size <i>packetSize</i>, if aggregation is possible.
70
   * \param aggregatedPacket packet that will contain the packet of size <i>packetSize</i>, if aggregation is possible.
 Lines 98-109   public: Link Here 
98
   * \param packetSize size of the packet we want to insert into <i>aggregatedPacket</i>.
84
   * \param packetSize size of the packet we want to insert into <i>aggregatedPacket</i>.
99
   * \param aggregatedPacket packet that will contain the packet of size <i>packetSize</i>, if aggregation is possible.
85
   * \param aggregatedPacket packet that will contain the packet of size <i>packetSize</i>, if aggregation is possible.
100
   * \param blockAckSize size of the piggybacked block ack request
86
   * \param blockAckSize size of the piggybacked block ack request
87
   * \param maxAmpduSize the maximum A-MPDU size.
101
   *
88
   *
102
   * \return true if the packet of size <i>packetSize</i> can be aggregated to <i>aggregatedPacket</i>, false otherwise.
89
   * \return true if the packet of size <i>packetSize</i> can be aggregated to <i>aggregatedPacket</i>, false otherwise.
103
   *
90
   *
104
   * This method is used to determine if a packet could be aggregated to an A-MPDU without exceeding the maximum packet size.
91
   * This method is used to determine if a packet could be aggregated to an A-MPDU without exceeding the maximum packet size.
105
   */
92
   */
106
  bool CanBeAggregated (uint32_t packetSize, Ptr<Packet> aggregatedPacket, uint8_t blockAckSize) const;
93
  bool CanBeAggregated (uint32_t packetSize, Ptr<Packet> aggregatedPacket, uint8_t blockAckSize, uint32_t maxAmpduSize) const;
107
94
108
  /**
95
  /**
109
   * Deaggregates an A-MPDU by removing the A-MPDU subframe header and padding.
96
   * Deaggregates an A-MPDU by removing the A-MPDU subframe header and padding.
 Lines 123-130   private: Link Here 
123
   * Each A-MPDU subframe is padded so that its length is multiple of 4 octets.
110
   * Each A-MPDU subframe is padded so that its length is multiple of 4 octets.
124
   */
111
   */
125
  uint8_t CalculatePadding (Ptr<const Packet> packet) const;
112
  uint8_t CalculatePadding (Ptr<const Packet> packet) const;
126
127
  uint16_t m_maxAmpduLength; //!< Maximum length in bytes of A-MPDUs
128
};
113
};
129
114
130
}  //namespace ns3
115
}  //namespace ns3
(-)a/src/wifi/model/msdu-aggregator.cc (-14 / +2 lines)
 Lines 48-68   MsduAggregator::~MsduAggregator () Link Here 
48
{
48
{
49
}
49
}
50
50
51
void
52
MsduAggregator::SetMaxAmsduSize (uint16_t maxSize)
53
{
54
  m_maxAmsduLength = maxSize;
55
}
56
57
uint16_t
58
MsduAggregator::GetMaxAmsduSize (void) const
59
{
60
  return m_maxAmsduLength;
61
}
62
63
bool
51
bool
64
MsduAggregator::Aggregate (Ptr<const Packet> packet, Ptr<Packet> aggregatedPacket,
52
MsduAggregator::Aggregate (Ptr<const Packet> packet, Ptr<Packet> aggregatedPacket,
65
                           Mac48Address src, Mac48Address dest) const
53
                           Mac48Address src, Mac48Address dest, uint16_t maxAmsduSize) const
66
{
54
{
67
  NS_LOG_FUNCTION (this);
55
  NS_LOG_FUNCTION (this);
68
  Ptr<Packet> currentPacket;
56
  Ptr<Packet> currentPacket;
 Lines 71-77   MsduAggregator::Aggregate (Ptr<const Packet> packet, Ptr<Packet> aggregatedPacke Link Here 
71
  uint8_t padding = CalculatePadding (aggregatedPacket);
59
  uint8_t padding = CalculatePadding (aggregatedPacket);
72
  uint32_t actualSize = aggregatedPacket->GetSize ();
60
  uint32_t actualSize = aggregatedPacket->GetSize ();
73
61
74
  if ((14 + packet->GetSize () + actualSize + padding) <= GetMaxAmsduSize ())
62
  if ((14 + packet->GetSize () + actualSize + padding) <= maxAmsduSize)
75
    {
63
    {
76
      if (padding)
64
      if (padding)
77
        {
65
        {
(-)a/src/wifi/model/msdu-aggregator.h (-18 / +2 lines)
 Lines 51-71   public: Link Here 
51
  virtual ~MsduAggregator ();
51
  virtual ~MsduAggregator ();
52
52
53
  /**
53
  /**
54
   * Sets the maximum A-MSDU size in bytes.
55
   * Value 0 means that MSDU aggregation is disabled.
56
   *
57
   * \param maxSize the maximum A-MSDU size in bytes.
58
   */
59
  void SetMaxAmsduSize (uint16_t maxSize);
60
  /**
61
   * Returns the maximum A-MSDU size in bytes.
62
   * Value 0 means that MSDU aggregation is disabled.
63
   *
64
   * \return the maximum A-MSDU size in bytes.
65
   */
66
  uint16_t GetMaxAmsduSize (void) const;
67
68
  /**
69
   * Adds <i>packet</i> to <i>aggregatedPacket</i>. In concrete aggregator's implementation is
54
   * Adds <i>packet</i> to <i>aggregatedPacket</i>. In concrete aggregator's implementation is
70
   * specified how and if <i>packet</i> can be added to <i>aggregatedPacket</i>. If <i>packet</i>
55
   * specified how and if <i>packet</i> can be added to <i>aggregatedPacket</i>. If <i>packet</i>
71
   * can be added returns true, false otherwise.
56
   * can be added returns true, false otherwise.
 Lines 74-83   public: Link Here 
74
   * \param aggregatedPacket the aggregated packet.
59
   * \param aggregatedPacket the aggregated packet.
75
   * \param src the source address.
60
   * \param src the source address.
76
   * \param dest the destination address
61
   * \param dest the destination address
62
   * \param maxAmsduSize the maximum A-MSDU size.
77
   * \return true if successful.
63
   * \return true if successful.
78
   */
64
   */
79
  bool Aggregate (Ptr<const Packet> packet, Ptr<Packet> aggregatedPacket,
65
  bool Aggregate (Ptr<const Packet> packet, Ptr<Packet> aggregatedPacket,
80
                  Mac48Address src, Mac48Address dest) const;
66
                  Mac48Address src, Mac48Address dest, uint16_t maxAmsduSize) const;
81
67
82
  /**
68
  /**
83
   *
69
   *
 Lines 98-105   private: Link Here 
98
   * \return the number of octets required for padding
84
   * \return the number of octets required for padding
99
   */
85
   */
100
  uint8_t CalculatePadding (Ptr<const Packet> packet) const;
86
  uint8_t CalculatePadding (Ptr<const Packet> packet) const;
101
102
  uint16_t m_maxAmsduLength; ///< maximum AMSDU length
103
};
87
};
104
88
105
} //namespace ns3
89
} //namespace ns3
(-)a/src/wifi/model/originator-block-ack-agreement.cc (-2 / +1 lines)
 Lines 76-83   OriginatorBlockAckAgreement::NotifyMpduTransmission (uint16_t nextSeqNumber) Link Here 
76
  NS_ASSERT (m_sentMpdus < m_bufferSize);
76
  NS_ASSERT (m_sentMpdus < m_bufferSize);
77
  m_sentMpdus++;
77
  m_sentMpdus++;
78
  uint16_t delta = (nextSeqNumber - m_startingSeq + 4096) % 4096;
78
  uint16_t delta = (nextSeqNumber - m_startingSeq + 4096) % 4096;
79
  uint16_t min = m_bufferSize < 64 ? m_bufferSize : 64;
79
  if (delta >= m_bufferSize || m_sentMpdus == m_bufferSize)
80
  if (delta >= min || m_sentMpdus == m_bufferSize)
81
    {
80
    {
82
      m_needBlockAckReq = true;
81
      m_needBlockAckReq = true;
83
    }
82
    }
(-)a/src/wifi/model/qos-txop.cc (-9 / +24 lines)
 Lines 117-122   QosTxop::CompleteAmpduTransfer (Mac48Address recipient, uint8_t tid) Link Here 
117
  m_baManager->CompleteAmpduExchange (recipient, tid);
117
  m_baManager->CompleteAmpduExchange (recipient, tid);
118
}
118
}
119
119
120
uint16_t
121
QosTxop::GetBaBufferSize (Mac48Address address, uint8_t tid) const
122
{
123
  return m_baManager->GetRecipientBufferSize (address, tid);
124
}
125
120
void
126
void
121
QosTxop::SetWifiRemoteStationManager (const Ptr<WifiRemoteStationManager> remoteManager)
127
QosTxop::SetWifiRemoteStationManager (const Ptr<WifiRemoteStationManager> remoteManager)
122
{
128
{
 Lines 283-289   QosTxop::NotifyAccessGranted (void) Link Here 
283
              Ptr<Packet> currentAggregatedPacket = Create<Packet> ();
289
              Ptr<Packet> currentAggregatedPacket = Create<Packet> ();
284
              m_msduAggregator->Aggregate (m_currentPacket, currentAggregatedPacket,
290
              m_msduAggregator->Aggregate (m_currentPacket, currentAggregatedPacket,
285
                                           MapSrcAddressForAggregation (peekedHdr),
291
                                           MapSrcAddressForAggregation (peekedHdr),
286
                                           MapDestAddressForAggregation (peekedHdr));
292
                                           MapDestAddressForAggregation (peekedHdr),
293
                                           GetLow ()->GetMaxAmsduSize (QosUtilsMapTidToAc (m_currentHdr.GetQosTid ())));
287
              bool aggregated = false;
294
              bool aggregated = false;
288
              bool isAmsdu = false;
295
              bool isAmsdu = false;
289
              Ptr<const WifiMacQueueItem> peekedItem = m_queue->PeekByTidAndAddress (m_currentHdr.GetQosTid (),
296
              Ptr<const WifiMacQueueItem> peekedItem = m_queue->PeekByTidAndAddress (m_currentHdr.GetQosTid (),
 Lines 293-299   QosTxop::NotifyAccessGranted (void) Link Here 
293
                  peekedHdr = peekedItem->GetHeader ();
300
                  peekedHdr = peekedItem->GetHeader ();
294
                  aggregated = m_msduAggregator->Aggregate (peekedItem->GetPacket (), currentAggregatedPacket,
301
                  aggregated = m_msduAggregator->Aggregate (peekedItem->GetPacket (), currentAggregatedPacket,
295
                                                            MapSrcAddressForAggregation (peekedHdr),
302
                                                            MapSrcAddressForAggregation (peekedHdr),
296
                                                            MapDestAddressForAggregation (peekedHdr));
303
                                                            MapDestAddressForAggregation (peekedHdr),
304
                                                            GetLow ()->GetMaxAmsduSize (QosUtilsMapTidToAc (m_currentHdr.GetQosTid ())));
297
                  if (aggregated)
305
                  if (aggregated)
298
                    {
306
                    {
299
                      isAmsdu = true;
307
                      isAmsdu = true;
 Lines 446-452   QosTxop::MissedCts (void) Link Here 
446
            {
454
            {
447
              NS_LOG_DEBUG ("Transmit Block Ack Request");
455
              NS_LOG_DEBUG ("Transmit Block Ack Request");
448
              CtrlBAckRequestHeader reqHdr;
456
              CtrlBAckRequestHeader reqHdr;
449
              reqHdr.SetType (COMPRESSED_BLOCK_ACK);
457
              reqHdr.SetType (GetBaBufferSize (m_currentHdr.GetAddr1 (), tid) > 64 ? EXTENDED_COMPRESSED_BLOCK_ACK : COMPRESSED_BLOCK_ACK);
450
              reqHdr.SetStartingSequence (m_txMiddle->PeekNextSequenceNumberFor (&m_currentHdr));
458
              reqHdr.SetStartingSequence (m_txMiddle->PeekNextSequenceNumberFor (&m_currentHdr));
451
              reqHdr.SetTidInfo (tid);
459
              reqHdr.SetTidInfo (tid);
452
              reqHdr.SetHtImmediateAck (true);
460
              reqHdr.SetHtImmediateAck (true);
 Lines 576-582   QosTxop::MissedAck (void) Link Here 
576
              //send Block ACK Request in order to shift WinStart at the receiver
584
              //send Block ACK Request in order to shift WinStart at the receiver
577
              NS_LOG_DEBUG ("Transmit Block Ack Request");
585
              NS_LOG_DEBUG ("Transmit Block Ack Request");
578
              CtrlBAckRequestHeader reqHdr;
586
              CtrlBAckRequestHeader reqHdr;
579
              reqHdr.SetType (COMPRESSED_BLOCK_ACK);
587
              reqHdr.SetType (GetBaBufferSize (m_currentHdr.GetAddr1 (), tid) > 64 ? EXTENDED_COMPRESSED_BLOCK_ACK : COMPRESSED_BLOCK_ACK);
580
              reqHdr.SetStartingSequence (m_txMiddle->PeekNextSequenceNumberFor (&m_currentHdr));
588
              reqHdr.SetStartingSequence (m_txMiddle->PeekNextSequenceNumberFor (&m_currentHdr));
581
              reqHdr.SetTidInfo (tid);
589
              reqHdr.SetTidInfo (tid);
582
              reqHdr.SetHtImmediateAck (true);
590
              reqHdr.SetHtImmediateAck (true);
 Lines 640-646   QosTxop::MissedBlockAck (uint8_t nMpdus) Link Here 
640
          //standard says when losing a BlockAck originator may send a BAR page 139
648
          //standard says when losing a BlockAck originator may send a BAR page 139
641
          NS_LOG_DEBUG ("Transmit Block Ack Request");
649
          NS_LOG_DEBUG ("Transmit Block Ack Request");
642
          CtrlBAckRequestHeader reqHdr;
650
          CtrlBAckRequestHeader reqHdr;
643
          reqHdr.SetType (COMPRESSED_BLOCK_ACK);
651
          reqHdr.SetType (GetBaBufferSize (m_currentHdr.GetAddr1 (), tid) > 64 ? EXTENDED_COMPRESSED_BLOCK_ACK : COMPRESSED_BLOCK_ACK);
644
          if (m_currentHdr.IsQosData ())
652
          if (m_currentHdr.IsQosData ())
645
            {
653
            {
646
              reqHdr.SetStartingSequence (m_currentHdr.GetSequenceNumber ());
654
              reqHdr.SetStartingSequence (m_currentHdr.GetSequenceNumber ());
 Lines 956-962   QosTxop::NeedFragmentation (void) const Link Here 
956
      || (m_stationManager->GetHtSupported ()
964
      || (m_stationManager->GetHtSupported ()
957
          && m_currentHdr.IsQosData ()
965
          && m_currentHdr.IsQosData ()
958
          && GetBaAgreementExists (m_currentHdr.GetAddr1 (), GetTid (m_currentPacket, m_currentHdr))
966
          && GetBaAgreementExists (m_currentHdr.GetAddr1 (), GetTid (m_currentPacket, m_currentHdr))
959
          && GetMpduAggregator ()->GetMaxAmpduSize () >= m_currentPacket->GetSize ()))
967
          && GetLow ()->GetMaxAmpduSize (QosUtilsMapTidToAc (GetTid (m_currentPacket, m_currentHdr))) >= m_currentPacket->GetSize ()))
960
    {
968
    {
961
      //MSDU is not fragmented when it is transmitted using an HT-immediate or
969
      //MSDU is not fragmented when it is transmitted using an HT-immediate or
962
      //HT-delayed Block Ack agreement or when it is carried in an A-MPDU.
970
      //HT-delayed Block Ack agreement or when it is carried in an A-MPDU.
 Lines 1289-1295   QosTxop::VerifyBlockAck (void) Link Here 
1289
      m_baManager->SwitchToBlockAckIfNeeded (recipient, tid, sequence);
1297
      m_baManager->SwitchToBlockAckIfNeeded (recipient, tid, sequence);
1290
    }
1298
    }
1291
  if ((m_baManager->ExistsAgreementInState (recipient, tid, OriginatorBlockAckAgreement::ESTABLISHED))
1299
  if ((m_baManager->ExistsAgreementInState (recipient, tid, OriginatorBlockAckAgreement::ESTABLISHED))
1292
      && (GetMpduAggregator () == 0 || GetMpduAggregator ()->GetMaxAmpduSize () == 0))
1300
      && (GetMpduAggregator () == 0 || GetLow ()->GetMaxAmpduSize (QosUtilsMapTidToAc (tid)) == 0))
1293
    {
1301
    {
1294
      m_currentHdr.SetQosAckPolicy (WifiMacHeader::BLOCK_ACK);
1302
      m_currentHdr.SetQosAckPolicy (WifiMacHeader::BLOCK_ACK);
1295
    }
1303
    }
 Lines 1346-1352   QosTxop::SetupBlockAckIfNeeded (void) Link Here 
1346
  Mac48Address recipient = m_currentHdr.GetAddr1 ();
1354
  Mac48Address recipient = m_currentHdr.GetAddr1 ();
1347
  uint32_t packets = m_queue->GetNPacketsByTidAndAddress (tid, recipient);
1355
  uint32_t packets = m_queue->GetNPacketsByTidAndAddress (tid, recipient);
1348
  if ((GetBlockAckThreshold () > 0 && packets >= GetBlockAckThreshold ())
1356
  if ((GetBlockAckThreshold () > 0 && packets >= GetBlockAckThreshold ())
1349
      || (m_mpduAggregator != 0 && m_mpduAggregator->GetMaxAmpduSize () > 0 && packets > 1)
1357
      || (m_mpduAggregator != 0 && GetLow ()->GetMaxAmpduSize (QosUtilsMapTidToAc (tid)) > 0 && packets > 1)
1350
      || m_stationManager->GetVhtSupported ()
1358
      || m_stationManager->GetVhtSupported ()
1351
      || m_stationManager->GetHeSupported ())
1359
      || m_stationManager->GetHeSupported ())
1352
    {
1360
    {
 Lines 1385-1391   QosTxop::SendBlockAckRequest (const Bar &bar) Link Here 
1385
        }
1393
        }
1386
      else if (m_blockAckType == COMPRESSED_BLOCK_ACK)
1394
      else if (m_blockAckType == COMPRESSED_BLOCK_ACK)
1387
        {
1395
        {
1388
          m_currentParams.EnableCompressedBlockAck ();
1396
          if (GetBaBufferSize (m_currentHdr.GetAddr1 (), GetTid (m_currentPacket, m_currentHdr)) > 64)
1397
            {
1398
              m_currentParams.EnableExtendedCompressedBlockAck ();
1399
            }
1400
          else
1401
            {
1402
              m_currentParams.EnableCompressedBlockAck ();
1403
            }
1389
        }
1404
        }
1390
      else if (m_blockAckType == MULTI_TID_BLOCK_ACK)
1405
      else if (m_blockAckType == MULTI_TID_BLOCK_ACK)
1391
        {
1406
        {
(-)a/src/wifi/model/qos-txop.h (+12 lines)
 Lines 29-34    Link Here 
29
#include "qos-utils.h"
29
#include "qos-utils.h"
30
30
31
class AmpduAggregationTest;
31
class AmpduAggregationTest;
32
class HeAggregationTest;
32
33
33
namespace ns3 {
34
namespace ns3 {
34
35
 Lines 92-97   class QosTxop : public Txop Link Here 
92
public:
93
public:
93
  /// Allow test cases to access private members
94
  /// Allow test cases to access private members
94
  friend class ::AmpduAggregationTest;
95
  friend class ::AmpduAggregationTest;
96
  friend class ::HeAggregationTest;
95
97
96
  std::map<Mac48Address, bool> m_aMpduEnabled; //!< list containing flags whether A-MPDU is enabled for a given destination address
98
  std::map<Mac48Address, bool> m_aMpduEnabled; //!< list containing flags whether A-MPDU is enabled for a given destination address
97
99
 Lines 161-166   public: Link Here 
161
   * of an A-MPDU with ImmediateBlockAck policy (i.e. no BAR is scheduled).
163
   * of an A-MPDU with ImmediateBlockAck policy (i.e. no BAR is scheduled).
162
   */
164
   */
163
  void CompleteAmpduTransfer (Mac48Address recipient, uint8_t tid);
165
  void CompleteAmpduTransfer (Mac48Address recipient, uint8_t tid);
166
  /**
167
   * \param address recipient address of the peer station
168
   * \param tid traffic ID.
169
   *
170
   * \return the negociated buffer size during ADDBA handshake.
171
   *
172
   * Returns the negociated buffer size during ADDBA handshake with station addressed by
173
   * <i>recipient</i> for tid <i>tid</i>.
174
   */
175
  uint16_t GetBaBufferSize (Mac48Address address, uint8_t tid) const;
164
176
165
  /* dcf notifications forwarded here */
177
  /* dcf notifications forwarded here */
166
  /**
178
  /**
(-)a/src/wifi/model/regular-wifi-mac.cc (-83 / +136 lines)
 Lines 55-60   RegularWifiMac::RegularWifiMac () Link Here 
55
55
56
  m_low = CreateObject<MacLow> ();
56
  m_low = CreateObject<MacLow> ();
57
  m_low->SetRxCallback (MakeCallback (&MacRxMiddle::Receive, m_rxMiddle));
57
  m_low->SetRxCallback (MakeCallback (&MacRxMiddle::Receive, m_rxMiddle));
58
  m_low->SetMac (this);
58
59
59
  m_channelAccessManager = CreateObject<ChannelAccessManager> ();
60
  m_channelAccessManager = CreateObject<ChannelAccessManager> ();
60
  m_channelAccessManager->SetupLow (m_low);
61
  m_channelAccessManager->SetupLow (m_low);
 Lines 159-166   RegularWifiMac::GetHtCapabilities (void) const Link Here 
159
  HtCapabilities capabilities;
160
  HtCapabilities capabilities;
160
  if (GetHtSupported ())
161
  if (GetHtSupported ())
161
    {
162
    {
162
      Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
163
      Ptr<HtConfiguration> htConfiguration = GetHtConfiguration ();
163
      Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
164
      bool greenfieldSupported = htConfiguration->GetGreenfieldSupported ();
164
      bool greenfieldSupported = htConfiguration->GetGreenfieldSupported ();
165
      bool sgiSupported = htConfiguration->GetShortGuardIntervalSupported ();
165
      bool sgiSupported = htConfiguration->GetShortGuardIntervalSupported ();
166
      capabilities.SetHtSupported (1);
166
      capabilities.SetHtSupported (1);
 Lines 172-178   RegularWifiMac::GetHtCapabilities (void) const Link Here 
172
      uint32_t maxAmsduLength = std::max (std::max (m_beMaxAmsduSize, m_bkMaxAmsduSize), std::max (m_voMaxAmsduSize, m_viMaxAmsduSize));
172
      uint32_t maxAmsduLength = std::max (std::max (m_beMaxAmsduSize, m_bkMaxAmsduSize), std::max (m_voMaxAmsduSize, m_viMaxAmsduSize));
173
      capabilities.SetMaxAmsduLength (maxAmsduLength > 3839); //0 if 3839 and 1 if 7935
173
      capabilities.SetMaxAmsduLength (maxAmsduLength > 3839); //0 if 3839 and 1 if 7935
174
      capabilities.SetLSigProtectionSupport (!greenfieldSupported);
174
      capabilities.SetLSigProtectionSupport (!greenfieldSupported);
175
      double maxAmpduLengthExponent = std::max (std::ceil ((std::log (std::max (std::max (m_beMaxAmpduSize, m_bkMaxAmpduSize), std::max (m_voMaxAmpduSize, m_viMaxAmpduSize))
175
      UintegerValue beMaxAmpduSize, bkMaxAmpduSize, voMaxAmpduSize, viMaxAmpduSize;
176
      htConfiguration->GetAttribute ("BeMaxAmpduSize", beMaxAmpduSize);
177
      htConfiguration->GetAttribute ("BkMaxAmpduSize", bkMaxAmpduSize);
178
      htConfiguration->GetAttribute ("ViMaxAmpduSize", voMaxAmpduSize);
179
      htConfiguration->GetAttribute ("VoMaxAmpduSize", viMaxAmpduSize);
180
      double maxAmpduLengthExponent = std::max (std::ceil ((std::log (std::max (std::max (beMaxAmpduSize.Get (), bkMaxAmpduSize.Get ()), std::max (voMaxAmpduSize.Get (), viMaxAmpduSize.Get ()))
176
                                                                      + 1.0)
181
                                                                      + 1.0)
177
                                                            / std::log (2.0))
182
                                                            / std::log (2.0))
178
                                                           - 13.0),
183
                                                           - 13.0),
 Lines 214-221   RegularWifiMac::GetVhtCapabilities (void) const Link Here 
214
  VhtCapabilities capabilities;
219
  VhtCapabilities capabilities;
215
  if (GetVhtSupported ())
220
  if (GetVhtSupported ())
216
    {
221
    {
217
      Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
222
      Ptr<HtConfiguration> htConfiguration = GetHtConfiguration ();
218
      Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
223
      Ptr<VhtConfiguration> vhtConfiguration = GetVhtConfiguration ();
219
      bool sgiSupported = htConfiguration->GetShortGuardIntervalSupported ();
224
      bool sgiSupported = htConfiguration->GetShortGuardIntervalSupported ();
220
      capabilities.SetVhtSupported (1);
225
      capabilities.SetVhtSupported (1);
221
      if (m_phy->GetChannelWidth () == 160)
226
      if (m_phy->GetChannelWidth () == 160)
 Lines 231-237   RegularWifiMac::GetVhtCapabilities (void) const Link Here 
231
      capabilities.SetRxLdpc (0);
236
      capabilities.SetRxLdpc (0);
232
      capabilities.SetShortGuardIntervalFor80Mhz ((m_phy->GetChannelWidth () == 80) && sgiSupported);
237
      capabilities.SetShortGuardIntervalFor80Mhz ((m_phy->GetChannelWidth () == 80) && sgiSupported);
233
      capabilities.SetShortGuardIntervalFor160Mhz ((m_phy->GetChannelWidth () == 160) && sgiSupported);
238
      capabilities.SetShortGuardIntervalFor160Mhz ((m_phy->GetChannelWidth () == 160) && sgiSupported);
234
      double maxAmpduLengthExponent = std::max (std::ceil ((std::log (std::max (std::max (m_beMaxAmpduSize, m_bkMaxAmpduSize), std::max (m_voMaxAmpduSize, m_viMaxAmpduSize)) + 1.0) / std::log (2.0)) - 13.0), 0.0);
239
      UintegerValue beMaxAmpduSize, bkMaxAmpduSize, voMaxAmpduSize, viMaxAmpduSize;
240
      vhtConfiguration->GetAttribute ("BeMaxAmpduSize", beMaxAmpduSize);
241
      vhtConfiguration->GetAttribute ("BkMaxAmpduSize", bkMaxAmpduSize);
242
      vhtConfiguration->GetAttribute ("ViMaxAmpduSize", voMaxAmpduSize);
243
      vhtConfiguration->GetAttribute ("VoMaxAmpduSize", viMaxAmpduSize);
244
      double maxAmpduLengthExponent = std::max (std::ceil ((std::log (std::max (std::max (beMaxAmpduSize.Get (), bkMaxAmpduSize.Get ()), std::max (voMaxAmpduSize.Get (), viMaxAmpduSize.Get ())) + 1.0) / std::log (2.0)) - 13.0), 0.0);
235
      NS_ASSERT (maxAmpduLengthExponent >= 0 && maxAmpduLengthExponent <= 255);
245
      NS_ASSERT (maxAmpduLengthExponent >= 0 && maxAmpduLengthExponent <= 255);
236
      capabilities.SetMaxAmpduLengthExponent (std::max<uint8_t> (7, static_cast<uint8_t> (maxAmpduLengthExponent))); //0 to 7 for VHT
246
      capabilities.SetMaxAmpduLengthExponent (std::max<uint8_t> (7, static_cast<uint8_t> (maxAmpduLengthExponent))); //0 to 7 for VHT
237
      uint8_t maxMcs = 0;
247
      uint8_t maxMcs = 0;
 Lines 283-290   RegularWifiMac::GetHeCapabilities (void) const Link Here 
283
  HeCapabilities capabilities;
293
  HeCapabilities capabilities;
284
  if (GetHeSupported ())
294
  if (GetHeSupported ())
285
    {
295
    {
286
      Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
296
      Ptr<HeConfiguration> heConfiguration = GetHeConfiguration ();
287
      Ptr<HeConfiguration> heConfiguration = device->GetHeConfiguration ();
288
      capabilities.SetHeSupported (1);
297
      capabilities.SetHeSupported (1);
289
      uint8_t channelWidthSet = 0;
298
      uint8_t channelWidthSet = 0;
290
      if (m_phy->GetChannelWidth () >= 40 && Is2_4Ghz (m_phy->GetFrequency ()))
299
      if (m_phy->GetChannelWidth () >= 40 && Is2_4Ghz (m_phy->GetFrequency ()))
 Lines 311-320   RegularWifiMac::GetHeCapabilities (void) const Link Here 
311
          gi |= 0x02;
320
          gi |= 0x02;
312
        }
321
        }
313
      capabilities.SetHeLtfAndGiForHePpdus (gi);
322
      capabilities.SetHeLtfAndGiForHePpdus (gi);
314
      double maxAmpduLengthExponent = std::max (std::ceil ((std::log (std::max (std::max (m_beMaxAmpduSize, m_bkMaxAmpduSize), std::max (m_voMaxAmpduSize, m_viMaxAmpduSize))
323
      UintegerValue beMaxAmpduSize, bkMaxAmpduSize, voMaxAmpduSize, viMaxAmpduSize;
324
      heConfiguration->GetAttribute ("BeMaxAmpduSize", beMaxAmpduSize);
325
      heConfiguration->GetAttribute ("BkMaxAmpduSize", bkMaxAmpduSize);
326
      heConfiguration->GetAttribute ("ViMaxAmpduSize", voMaxAmpduSize);
327
      heConfiguration->GetAttribute ("VoMaxAmpduSize", viMaxAmpduSize);
328
      double maxAmpduLengthExponent = std::max (std::ceil ((std::log (std::max (std::max (beMaxAmpduSize.Get (), bkMaxAmpduSize.Get ()), std::max (voMaxAmpduSize.Get (), viMaxAmpduSize.Get ()))
315
                                                                      + 1.0)
329
                                                                      + 1.0)
316
                                                            / std::log (2.0))
330
                                                            / std::log (2.0))
317
                                                           - 13.0),
331
                                                           - 20.0),
318
                                                0.0);
332
                                                0.0);
319
      NS_ASSERT (maxAmpduLengthExponent >= 0 && maxAmpduLengthExponent <= 255);
333
      NS_ASSERT (maxAmpduLengthExponent >= 0 && maxAmpduLengthExponent <= 255);
320
      capabilities.SetMaxAmpduLengthExponent (std::max<uint8_t> (7, static_cast<uint8_t> (maxAmpduLengthExponent))); //assume 0 to 7 for HE
334
      capabilities.SetMaxAmpduLengthExponent (std::max<uint8_t> (7, static_cast<uint8_t> (maxAmpduLengthExponent))); //assume 0 to 7 for HE
 Lines 338-401   void Link Here 
338
RegularWifiMac::SetVoMaxAmsduSize (uint16_t size)
352
RegularWifiMac::SetVoMaxAmsduSize (uint16_t size)
339
{
353
{
340
  NS_LOG_FUNCTION (this << size);
354
  NS_LOG_FUNCTION (this << size);
355
  Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
356
  if (device)
357
    {
358
      Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
359
      if (htConfiguration)
360
        {
361
          htConfiguration->SetAttribute ("VoMaxAmsduSize", UintegerValue (size));
362
        }
363
    }
341
  m_voMaxAmsduSize = size;
364
  m_voMaxAmsduSize = size;
342
  ConfigureAggregation ();
343
}
365
}
344
366
345
void
367
void
346
RegularWifiMac::SetViMaxAmsduSize (uint16_t size)
368
RegularWifiMac::SetViMaxAmsduSize (uint16_t size)
347
{
369
{
348
  NS_LOG_FUNCTION (this << size);
370
  NS_LOG_FUNCTION (this << size);
371
  Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
372
  if (device)
373
    {
374
      Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
375
      if (htConfiguration)
376
        {
377
          htConfiguration->SetAttribute ("ViMaxAmsduSize", UintegerValue (size));
378
        }
379
    }
349
  m_viMaxAmsduSize = size;
380
  m_viMaxAmsduSize = size;
350
  ConfigureAggregation ();
351
}
381
}
352
382
353
void
383
void
354
RegularWifiMac::SetBeMaxAmsduSize (uint16_t size)
384
RegularWifiMac::SetBeMaxAmsduSize (uint16_t size)
355
{
385
{
356
  NS_LOG_FUNCTION (this << size);
386
  NS_LOG_FUNCTION (this << size);
387
  Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
388
  if (device)
389
    {
390
      Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
391
      if (htConfiguration)
392
        {
393
          htConfiguration->SetAttribute ("BeMaxAmsduSize", UintegerValue (size));
394
        }
395
    }
357
  m_beMaxAmsduSize = size;
396
  m_beMaxAmsduSize = size;
358
  ConfigureAggregation ();
359
}
397
}
360
398
361
void
399
void
362
RegularWifiMac::SetBkMaxAmsduSize (uint16_t size)
400
RegularWifiMac::SetBkMaxAmsduSize (uint16_t size)
363
{
401
{
364
  NS_LOG_FUNCTION (this << size);
402
  NS_LOG_FUNCTION (this << size);
403
  Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
404
  if (device)
405
    {
406
      Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
407
      if (htConfiguration)
408
        {
409
          htConfiguration->SetAttribute ("BkMaxAmsduSize", UintegerValue (size));
410
        }
411
    }
365
  m_bkMaxAmsduSize = size;
412
  m_bkMaxAmsduSize = size;
366
  ConfigureAggregation ();
367
}
413
}
368
414
369
void
415
void
370
RegularWifiMac::SetVoMaxAmpduSize (uint16_t size)
416
RegularWifiMac::SetVoMaxAmpduSize (uint32_t size)
371
{
417
{
372
  NS_LOG_FUNCTION (this << size);
418
  NS_LOG_FUNCTION (this << size);
419
  Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
420
  if (device)
421
    {
422
      Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
423
      if (htConfiguration)
424
        {
425
          htConfiguration->SetAttribute ("VoMaxAmpduSize", UintegerValue (size));
426
        }
427
    }
373
  m_voMaxAmpduSize = size;
428
  m_voMaxAmpduSize = size;
374
  ConfigureAggregation ();
375
}
429
}
376
430
377
void
431
void
378
RegularWifiMac::SetViMaxAmpduSize (uint16_t size)
432
RegularWifiMac::SetViMaxAmpduSize (uint32_t size)
379
{
433
{
380
  NS_LOG_FUNCTION (this << size);
434
  NS_LOG_FUNCTION (this << size);
435
  Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
436
  if (device)
437
    {
438
      Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
439
      if (htConfiguration)
440
        {
441
          htConfiguration->SetAttribute ("ViMaxAmpduSize", UintegerValue (size));
442
        }
443
    }
381
  m_viMaxAmpduSize = size;
444
  m_viMaxAmpduSize = size;
382
  ConfigureAggregation ();
383
}
445
}
384
446
385
void
447
void
386
RegularWifiMac::SetBeMaxAmpduSize (uint16_t size)
448
RegularWifiMac::SetBeMaxAmpduSize (uint32_t size)
387
{
449
{
388
  NS_LOG_FUNCTION (this << size);
450
  NS_LOG_FUNCTION (this << size);
451
  Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
452
  if (device)
453
    {
454
      Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
455
      if (htConfiguration)
456
        {
457
          htConfiguration->SetAttribute ("BeMaxAmpduSize", UintegerValue (size));
458
        }
459
    }
389
  m_beMaxAmpduSize = size;
460
  m_beMaxAmpduSize = size;
390
  ConfigureAggregation ();
391
}
461
}
392
462
393
void
463
void
394
RegularWifiMac::SetBkMaxAmpduSize (uint16_t size)
464
RegularWifiMac::SetBkMaxAmpduSize (uint32_t size)
395
{
465
{
396
  NS_LOG_FUNCTION (this << size);
466
  NS_LOG_FUNCTION (this << size);
467
  Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
468
  if (device)
469
    {
470
      Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
471
      if (htConfiguration)
472
        {
473
          htConfiguration->SetAttribute ("BkMaxAmpduSize", UintegerValue (size));
474
        }
475
    }
397
  m_bkMaxAmpduSize = size;
476
  m_bkMaxAmpduSize = size;
398
  ConfigureAggregation ();
399
}
477
}
400
478
401
void
479
void
 Lines 596-603   RegularWifiMac::SetHeSupported (bool enable) Link Here 
596
bool
674
bool
597
RegularWifiMac::GetHtSupported () const
675
RegularWifiMac::GetHtSupported () const
598
{
676
{
599
  Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
677
  if (GetHtConfiguration ())
600
  if (device->GetHtConfiguration ())
601
    {
678
    {
602
      return true;
679
      return true;
603
    }
680
    }
 Lines 607-614   RegularWifiMac::GetHtSupported () const Link Here 
607
bool
684
bool
608
RegularWifiMac::GetVhtSupported () const
685
RegularWifiMac::GetVhtSupported () const
609
{
686
{
610
  Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
687
  if (GetVhtConfiguration ())
611
  if (device->GetVhtConfiguration ())
612
    {
688
    {
613
      return true;
689
      return true;
614
    }
690
    }
 Lines 618-625   RegularWifiMac::GetVhtSupported () const Link Here 
618
bool
694
bool
619
RegularWifiMac::GetHeSupported () const
695
RegularWifiMac::GetHeSupported () const
620
{
696
{
621
  Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
697
  if (GetHeConfiguration ())
622
  if (device->GetHeConfiguration ())
623
    {
698
    {
624
      return true;
699
      return true;
625
    }
700
    }
 Lines 1036-1048   RegularWifiMac::SendAddBaResponse (const MgtAddBaRequestHeader *reqHdr, Link Here 
1036
      respHdr.SetDelayedBlockAck ();
1111
      respHdr.SetDelayedBlockAck ();
1037
    }
1112
    }
1038
  respHdr.SetTid (reqHdr->GetTid ());
1113
  respHdr.SetTid (reqHdr->GetTid ());
1039
  //For now there's not no control about limit of reception. We
1114
1040
  //assume that receiver has no limit on reception. However we assume
1115
  Ptr<HeConfiguration> heConfiguration = GetHeConfiguration ();
1041
  //that a receiver sets a bufferSize in order to satisfy next
1116
  if (heConfiguration && heConfiguration->GetMpduBufferSize () > 64)
1042
  //equation: (bufferSize + 1) % 16 = 0 So if a recipient is able to
1117
    {
1043
  //buffer a packet, it should be also able to buffer all possible
1118
      respHdr.SetBufferSize (255);
1044
  //packet's fragments. See section 7.3.1.14 in IEEE802.11e for more details.
1119
    }
1045
  respHdr.SetBufferSize (1023);
1120
  else
1121
    {
1122
      respHdr.SetBufferSize (63);
1123
    }
1046
  respHdr.SetTimeout (reqHdr->GetTimeout ());
1124
  respHdr.SetTimeout (reqHdr->GetTimeout ());
1047
1125
1048
  WifiActionHeader actionHdr;
1126
  WifiActionHeader actionHdr;
 Lines 1132-1156   RegularWifiMac::GetTypeId (void) Link Here 
1132
                   "Value 0 means A-MPDU is disabled for that AC.",
1210
                   "Value 0 means A-MPDU is disabled for that AC.",
1133
                   UintegerValue (0),
1211
                   UintegerValue (0),
1134
                   MakeUintegerAccessor (&RegularWifiMac::SetVoMaxAmpduSize),
1212
                   MakeUintegerAccessor (&RegularWifiMac::SetVoMaxAmpduSize),
1135
                   MakeUintegerChecker<uint16_t> ())
1213
                   MakeUintegerChecker<uint32_t> ())
1136
    .AddAttribute ("VI_MaxAmpduSize",
1214
    .AddAttribute ("VI_MaxAmpduSize",
1137
                   "Maximum length in bytes of an A-MPDU for AC_VI access class."
1215
                   "Maximum length in bytes of an A-MPDU for AC_VI access class."
1138
                   "Value 0 means A-MPDU is disabled for that AC.",
1216
                   "Value 0 means A-MPDU is disabled for that AC.",
1139
                   UintegerValue (65535),
1217
                   UintegerValue (65535),
1140
                   MakeUintegerAccessor (&RegularWifiMac::SetViMaxAmpduSize),
1218
                   MakeUintegerAccessor (&RegularWifiMac::SetViMaxAmpduSize),
1141
                   MakeUintegerChecker<uint16_t> ())
1219
                   MakeUintegerChecker<uint32_t> ())
1142
    .AddAttribute ("BE_MaxAmpduSize",
1220
    .AddAttribute ("BE_MaxAmpduSize",
1143
                   "Maximum length in bytes of an A-MPDU for AC_BE access class."
1221
                   "Maximum length in bytes of an A-MPDU for AC_BE access class."
1144
                   "Value 0 means A-MPDU is disabled for that AC.",
1222
                   "Value 0 means A-MPDU is disabled for that AC.",
1145
                   UintegerValue (65535),
1223
                   UintegerValue (65535),
1146
                   MakeUintegerAccessor (&RegularWifiMac::SetBeMaxAmpduSize),
1224
                   MakeUintegerAccessor (&RegularWifiMac::SetBeMaxAmpduSize),
1147
                   MakeUintegerChecker<uint16_t> ())
1225
                   MakeUintegerChecker<uint32_t> ())
1148
    .AddAttribute ("BK_MaxAmpduSize",
1226
    .AddAttribute ("BK_MaxAmpduSize",
1149
                   "Maximum length in bytes of an A-MPDU for AC_BK access class."
1227
                   "Maximum length in bytes of an A-MPDU for AC_BK access class."
1150
                   "Value 0 means A-MPDU is disabled for that AC.",
1228
                   "Value 0 means A-MPDU is disabled for that AC.",
1151
                   UintegerValue (0),
1229
                   UintegerValue (0),
1152
                   MakeUintegerAccessor (&RegularWifiMac::SetBkMaxAmpduSize),
1230
                   MakeUintegerAccessor (&RegularWifiMac::SetBkMaxAmpduSize),
1153
                   MakeUintegerChecker<uint16_t> ())
1231
                   MakeUintegerChecker<uint32_t> ())
1154
    .AddAttribute ("VO_BlockAckThreshold",
1232
    .AddAttribute ("VO_BlockAckThreshold",
1155
                   "If number of packets in VO queue reaches this value, "
1233
                   "If number of packets in VO queue reaches this value, "
1156
                   "block ack mechanism is used. If this value is 0, block ack is never used."
1234
                   "block ack mechanism is used. If this value is 0, block ack is never used."
 Lines 1274-1284   RegularWifiMac::FinishConfigureStandard (WifiPhyStandard standard) Link Here 
1274
    case WIFI_PHY_STANDARD_80211n_5GHZ:
1352
    case WIFI_PHY_STANDARD_80211n_5GHZ:
1275
      {
1353
      {
1276
        EnableAggregation ();
1354
        EnableAggregation ();
1277
        //To be removed once deprecated RifsSupported attribute is removed
1355
        //To be removed once deprecated attributes are removed
1278
        Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
1356
        Ptr<HtConfiguration> htConfiguration = GetHtConfiguration ();
1279
        Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
1280
        NS_ASSERT (htConfiguration);
1357
        NS_ASSERT (htConfiguration);
1281
        htConfiguration->SetRifsSupported (m_rifsSupported);
1358
        htConfiguration->SetRifsSupported (m_rifsSupported);
1359
        htConfiguration->SetAttribute ("BeMaxAmpduSize", UintegerValue (m_beMaxAmpduSize));
1360
        htConfiguration->SetAttribute ("BkMaxAmpduSize", UintegerValue (m_bkMaxAmpduSize));
1361
        htConfiguration->SetAttribute ("ViMaxAmpduSize", UintegerValue (m_viMaxAmpduSize));
1362
        htConfiguration->SetAttribute ("VoMaxAmpduSize", UintegerValue (m_voMaxAmpduSize));
1363
        htConfiguration->SetAttribute ("BeMaxAmsduSize", UintegerValue (m_beMaxAmsduSize));
1364
        htConfiguration->SetAttribute ("BkMaxAmsduSize", UintegerValue (m_bkMaxAmsduSize));
1365
        htConfiguration->SetAttribute ("ViMaxAmsduSize", UintegerValue (m_viMaxAmsduSize));
1366
        htConfiguration->SetAttribute ("VoMaxAmsduSize", UintegerValue (m_voMaxAmsduSize));
1282
        SetQosSupported (true);
1367
        SetQosSupported (true);
1283
        cwmin = 15;
1368
        cwmin = 15;
1284
        cwmax = 1023;
1369
        cwmax = 1023;
 Lines 1289-1298   RegularWifiMac::FinishConfigureStandard (WifiPhyStandard standard) Link Here 
1289
      {
1374
      {
1290
        EnableAggregation ();
1375
        EnableAggregation ();
1291
        //To be removed once deprecated RifsSupported attribute is removed
1376
        //To be removed once deprecated RifsSupported attribute is removed
1292
        Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
1377
        Ptr<HtConfiguration> htConfiguration = GetHtConfiguration ();
1293
        Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
1294
        NS_ASSERT (htConfiguration);
1378
        NS_ASSERT (htConfiguration);
1295
        htConfiguration->SetRifsSupported (m_rifsSupported);
1379
        htConfiguration->SetRifsSupported (m_rifsSupported);
1380
        htConfiguration->SetAttribute ("BeMaxAmpduSize", UintegerValue (m_beMaxAmpduSize));
1381
        htConfiguration->SetAttribute ("BkMaxAmpduSize", UintegerValue (m_bkMaxAmpduSize));
1382
        htConfiguration->SetAttribute ("ViMaxAmpduSize", UintegerValue (m_viMaxAmpduSize));
1383
        htConfiguration->SetAttribute ("VoMaxAmpduSize", UintegerValue (m_voMaxAmpduSize));
1384
        htConfiguration->SetAttribute ("BeMaxAmsduSize", UintegerValue (m_beMaxAmsduSize));
1385
        htConfiguration->SetAttribute ("BkMaxAmsduSize", UintegerValue (m_bkMaxAmsduSize));
1386
        htConfiguration->SetAttribute ("ViMaxAmsduSize", UintegerValue (m_viMaxAmsduSize));
1387
        htConfiguration->SetAttribute ("VoMaxAmsduSize", UintegerValue (m_voMaxAmsduSize));
1296
        SetQosSupported (true);
1388
        SetQosSupported (true);
1297
      }
1389
      }
1298
    case WIFI_PHY_STANDARD_80211g:
1390
    case WIFI_PHY_STANDARD_80211g:
 Lines 1346-1389   RegularWifiMac::TxFailed (const WifiMacHeader &hdr) Link Here 
1346
}
1438
}
1347
1439
1348
void
1440
void
1349
RegularWifiMac::ConfigureAggregation (void)
1350
{
1351
  NS_LOG_FUNCTION (this);
1352
  if (GetVOQueue ()->GetMsduAggregator () != 0)
1353
    {
1354
      GetVOQueue ()->GetMsduAggregator ()->SetMaxAmsduSize (m_voMaxAmsduSize);
1355
    }
1356
  if (GetVIQueue ()->GetMsduAggregator () != 0)
1357
    {
1358
      GetVIQueue ()->GetMsduAggregator ()->SetMaxAmsduSize (m_viMaxAmsduSize);
1359
    }
1360
  if (GetBEQueue ()->GetMsduAggregator () != 0)
1361
    {
1362
      GetBEQueue ()->GetMsduAggregator ()->SetMaxAmsduSize (m_beMaxAmsduSize);
1363
    }
1364
  if (GetBKQueue ()->GetMsduAggregator () != 0)
1365
    {
1366
      GetBKQueue ()->GetMsduAggregator ()->SetMaxAmsduSize (m_bkMaxAmsduSize);
1367
    }
1368
  if (GetVOQueue ()->GetMpduAggregator () != 0)
1369
    {
1370
      GetVOQueue ()->GetMpduAggregator ()->SetMaxAmpduSize (m_voMaxAmpduSize);
1371
    }
1372
  if (GetVIQueue ()->GetMpduAggregator () != 0)
1373
    {
1374
      GetVIQueue ()->GetMpduAggregator ()->SetMaxAmpduSize (m_viMaxAmpduSize);
1375
    }
1376
  if (GetBEQueue ()->GetMpduAggregator () != 0)
1377
    {
1378
      GetBEQueue ()->GetMpduAggregator ()->SetMaxAmpduSize (m_beMaxAmpduSize);
1379
    }
1380
  if (GetBKQueue ()->GetMpduAggregator () != 0)
1381
    {
1382
      GetBKQueue ()->GetMpduAggregator ()->SetMaxAmpduSize (m_bkMaxAmpduSize);
1383
    }
1384
}
1385
1386
void
1387
RegularWifiMac::EnableAggregation (void)
1441
RegularWifiMac::EnableAggregation (void)
1388
{
1442
{
1389
  NS_LOG_FUNCTION (this);
1443
  NS_LOG_FUNCTION (this);
 Lines 1400-1406   RegularWifiMac::EnableAggregation (void) Link Here 
1400
          i->second->SetMpduAggregator (mpduAggregator);
1454
          i->second->SetMpduAggregator (mpduAggregator);
1401
        }
1455
        }
1402
    }
1456
    }
1403
  ConfigureAggregation ();
1404
}
1457
}
1405
1458
1406
void
1459
void
(-)a/src/wifi/model/regular-wifi-mac.h (-10 / +8 lines)
 Lines 565-589   private: Link Here 
565
   *
565
   *
566
   * \param size the maximum A-MPDU size for AC_VO.
566
   * \param size the maximum A-MPDU size for AC_VO.
567
   */
567
   */
568
  void SetVoMaxAmpduSize (uint16_t size);
568
  void SetVoMaxAmpduSize (uint32_t size);
569
  /**
569
  /**
570
   * Set the maximum A-MPDU size for AC_VI.
570
   * Set the maximum A-MPDU size for AC_VI.
571
   *
571
   *
572
   * \param size the maximum A-MPDU size for AC_VI.
572
   * \param size the maximum A-MPDU size for AC_VI.
573
   */
573
   */
574
  void SetViMaxAmpduSize (uint16_t size);
574
  void SetViMaxAmpduSize (uint32_t size);
575
  /**
575
  /**
576
   * Set the maximum A-MPDU size for AC_BE.
576
   * Set the maximum A-MPDU size for AC_BE.
577
   *
577
   *
578
   * \param size the maximum A-MPDU size for AC_BE.
578
   * \param size the maximum A-MPDU size for AC_BE.
579
   */
579
   */
580
  void SetBeMaxAmpduSize (uint16_t size);
580
  void SetBeMaxAmpduSize (uint32_t size);
581
  /**
581
  /**
582
   * Set the maximum A-MPDU size for AC_BK.
582
   * Set the maximum A-MPDU size for AC_BK.
583
   *
583
   *
584
   * \param size the maximum A-MPDU size for AC_BK.
584
   * \param size the maximum A-MPDU size for AC_BK.
585
   */
585
   */
586
  void SetBkMaxAmpduSize (uint16_t size);
586
  void SetBkMaxAmpduSize (uint32_t size);
587
587
588
  /**
588
  /**
589
   * Set the Block ACK threshold for AC_VO.
589
   * Set the Block ACK threshold for AC_VO.
 Lines 660-667   private: Link Here 
660
   */
660
   */
661
  bool m_dsssSupported;
661
  bool m_dsssSupported;
662
662
663
  /// Configure aggregation function
664
  void ConfigureAggregation (void);
665
  /// Enable aggregation function
663
  /// Enable aggregation function
666
  void EnableAggregation (void);
664
  void EnableAggregation (void);
667
  /// Disable aggregation function
665
  /// Disable aggregation function
 Lines 672-681   private: Link Here 
672
  uint16_t m_beMaxAmsduSize; ///< maximum A-MSDU size for AC_BE
670
  uint16_t m_beMaxAmsduSize; ///< maximum A-MSDU size for AC_BE
673
  uint16_t m_bkMaxAmsduSize; ///< maximum A-MSDU size for AC_BK
671
  uint16_t m_bkMaxAmsduSize; ///< maximum A-MSDU size for AC_BK
674
672
675
  uint16_t m_voMaxAmpduSize; ///< maximum A-MPDU size for AC_VO
673
  uint32_t m_voMaxAmpduSize; ///< maximum A-MPDU size for AC_VO
676
  uint16_t m_viMaxAmpduSize; ///< maximum A-MPDU size for AC_VI
674
  uint32_t m_viMaxAmpduSize; ///< maximum A-MPDU size for AC_VI
677
  uint16_t m_beMaxAmpduSize; ///< maximum A-MPDU size for AC_BE
675
  uint32_t m_beMaxAmpduSize; ///< maximum A-MPDU size for AC_BE
678
  uint16_t m_bkMaxAmpduSize; ///< maximum A-MPDU size for AC_BK
676
  uint32_t m_bkMaxAmpduSize; ///< maximum A-MPDU size for AC_BK
679
677
680
  TracedCallback<const WifiMacHeader &> m_txOkCallback; ///< transmit OK callback
678
  TracedCallback<const WifiMacHeader &> m_txOkCallback; ///< transmit OK callback
681
  TracedCallback<const WifiMacHeader &> m_txErrCallback; ///< transmit error callback
679
  TracedCallback<const WifiMacHeader &> m_txErrCallback; ///< transmit error callback
(-)a/src/wifi/model/sta-wifi-mac.h (-1 / +3 lines)
 Lines 28-33    Link Here 
28
28
29
class TwoLevelAggregationTest;
29
class TwoLevelAggregationTest;
30
class AmpduAggregationTest;
30
class AmpduAggregationTest;
31
class HeAggregationTest;
31
32
32
namespace ns3  {
33
namespace ns3  {
33
34
 Lines 109-115   public: Link Here 
109
  friend class ::TwoLevelAggregationTest;
110
  friend class ::TwoLevelAggregationTest;
110
  /// Allow test cases to access private members
111
  /// Allow test cases to access private members
111
  friend class ::AmpduAggregationTest;
112
  friend class ::AmpduAggregationTest;
112
113
  /// Allow test cases to access private members
114
  friend class ::HeAggregationTest;
113
  /**
115
  /**
114
   * \brief Get the type ID.
116
   * \brief Get the type ID.
115
   * \return the object TypeId
117
   * \return the object TypeId
(-)a/src/wifi/model/vht-configuration.cc (+49 lines)
 Lines 19-24    Link Here 
19
 */
19
 */
20
20
21
#include "ns3/log.h"
21
#include "ns3/log.h"
22
#include "ns3/uinteger.h"
22
#include "vht-configuration.h"
23
#include "vht-configuration.h"
23
24
24
namespace ns3 {
25
namespace ns3 {
 Lines 44-49   VhtConfiguration::GetTypeId (void) Link Here 
44
    .SetParent<Object> ()
45
    .SetParent<Object> ()
45
    .SetGroupName ("Wifi")
46
    .SetGroupName ("Wifi")
46
    .AddConstructor<VhtConfiguration> ()
47
    .AddConstructor<VhtConfiguration> ()
48
    .AddAttribute ("VoMaxAmsduSize",
49
                   "Maximum length in bytes of an A-MSDU for AC_VO access class. "
50
                   "Value 0 means A-MSDU is disabled for that AC.",
51
                   UintegerValue (0),
52
                   MakeUintegerAccessor (&VhtConfiguration::m_voMaxAmsduSize),
53
                   MakeUintegerChecker<uint16_t> (0, 11454))
54
    .AddAttribute ("ViMaxAmsduSize",
55
                   "Maximum length in bytes of an A-MSDU for AC_VI access class."
56
                   "Value 0 means A-MSDU is disabled for that AC.",
57
                   UintegerValue (0),
58
                   MakeUintegerAccessor (&VhtConfiguration::m_viMaxAmsduSize),
59
                   MakeUintegerChecker<uint16_t> (0, 11454))
60
    .AddAttribute ("BeMaxAmsduSize",
61
                   "Maximum length in bytes of an A-MSDU for AC_BE access class."
62
                   "Value 0 means A-MSDU is disabled for that AC.",
63
                   UintegerValue (0),
64
                   MakeUintegerAccessor (&VhtConfiguration::m_beMaxAmsduSize),
65
                   MakeUintegerChecker<uint16_t> (0, 11454))
66
    .AddAttribute ("BkMaxAmsduSize",
67
                   "Maximum length in bytes of an A-MSDU for AC_BK access class."
68
                   "Value 0 means A-MSDU is disabled for that AC.",
69
                   UintegerValue (0),
70
                   MakeUintegerAccessor (&VhtConfiguration::m_bkMaxAmsduSize),
71
                   MakeUintegerChecker<uint16_t> (0, 11454))
72
    .AddAttribute ("VoMaxAmpduSize",
73
                   "Maximum length in bytes of an A-MPDU for AC_VO access class."
74
                   "Value 0 means A-MPDU is disabled for that AC.",
75
                   UintegerValue (0),
76
                   MakeUintegerAccessor (&VhtConfiguration::m_voMaxAmpduSize),
77
                   MakeUintegerChecker<uint32_t> (0, 1048575))
78
    .AddAttribute ("ViMaxAmpduSize",
79
                   "Maximum length in bytes of an A-MPDU for AC_VI access class."
80
                   "Value 0 means A-MPDU is disabled for that AC.",
81
                   UintegerValue (1048575),
82
                   MakeUintegerAccessor (&VhtConfiguration::m_viMaxAmpduSize),
83
                   MakeUintegerChecker<uint32_t> (0, 1048575))
84
    .AddAttribute ("BeMaxAmpduSize",
85
                   "Maximum length in bytes of an A-MPDU for AC_BE access class."
86
                   "Value 0 means A-MPDU is disabled for that AC.",
87
                   UintegerValue (1048575),
88
                   MakeUintegerAccessor (&VhtConfiguration::m_beMaxAmpduSize),
89
                   MakeUintegerChecker<uint32_t> (0, 1048575))
90
    .AddAttribute ("BkMaxAmpduSize",
91
                   "Maximum length in bytes of an A-MPDU for AC_BK access class."
92
                   "Value 0 means A-MPDU is disabled for that AC.",
93
                   UintegerValue (0),
94
                   MakeUintegerAccessor (&VhtConfiguration::m_bkMaxAmpduSize),
95
                   MakeUintegerChecker<uint32_t> (0, 1048575))
47
    ;
96
    ;
48
    return tid;
97
    return tid;
49
}
98
}
(-)a/src/wifi/model/vht-configuration.h (+12 lines)
 Lines 40-45   public: Link Here 
40
  virtual ~VhtConfiguration ();
40
  virtual ~VhtConfiguration ();
41
41
42
  static TypeId GetTypeId (void);
42
  static TypeId GetTypeId (void);
43
44
45
private:
46
  uint16_t m_voMaxAmsduSize; ///< maximum A-MSDU size for AC_VO
47
  uint16_t m_viMaxAmsduSize; ///< maximum A-MSDU size for AC_VI
48
  uint16_t m_beMaxAmsduSize; ///< maximum A-MSDU size for AC_BE
49
  uint16_t m_bkMaxAmsduSize; ///< maximum A-MSDU size for AC_BK
50
51
  uint32_t m_voMaxAmpduSize; ///< maximum A-MPDU size for AC_VO
52
  uint32_t m_viMaxAmpduSize; ///< maximum A-MPDU size for AC_VI
53
  uint32_t m_beMaxAmpduSize; ///< maximum A-MPDU size for AC_BE
54
  uint32_t m_bkMaxAmpduSize; ///< maximum A-MPDU size for AC_BK
43
};
55
};
44
56
45
} //namespace ns3
57
} //namespace ns3
(-)a/src/wifi/model/wifi-mac-queue.cc (+22 lines)
 Lines 38-43   WifiMacQueue::GetTypeId (void) Link Here 
38
    .SetParent<Queue<WifiMacQueueItem> > ()
38
    .SetParent<Queue<WifiMacQueueItem> > ()
39
    .SetGroupName ("Wifi")
39
    .SetGroupName ("Wifi")
40
    .AddConstructor<WifiMacQueue> ()
40
    .AddConstructor<WifiMacQueue> ()
41
    .AddAttribute ("MaxQueueSize",
42
                   "The max queue size",
43
                   QueueSizeValue (QueueSize ("500p")),
44
                   MakeQueueSizeAccessor (&WifiMacQueue::SetMaxQueueSize),
45
                   MakeQueueSizeChecker ())
41
    .AddAttribute ("MaxDelay", "If a packet stays longer than this delay in the queue, it is dropped.",
46
    .AddAttribute ("MaxDelay", "If a packet stays longer than this delay in the queue, it is dropped.",
42
                   TimeValue (MilliSeconds (500)),
47
                   TimeValue (MilliSeconds (500)),
43
                   MakeTimeAccessor (&WifiMacQueue::SetMaxDelay),
48
                   MakeTimeAccessor (&WifiMacQueue::SetMaxDelay),
 Lines 62-67   WifiMacQueue::~WifiMacQueue () Link Here 
62
}
67
}
63
68
64
void
69
void
70
WifiMacQueue::SetMaxQueueSize (QueueSize size)
71
{
72
  NS_LOG_FUNCTION (this << size);
73
  m_maxSize = size;
74
}
75
76
QueueSize
77
WifiMacQueue::GetMaxQueueSize (void) const
78
{
79
  return m_maxSize;
80
}
81
82
void
65
WifiMacQueue::SetMaxDelay (Time delay)
83
WifiMacQueue::SetMaxDelay (Time delay)
66
{
84
{
67
  NS_LOG_FUNCTION (this << delay);
85
  NS_LOG_FUNCTION (this << delay);
 Lines 97-102   WifiMacQueue::Enqueue (Ptr<WifiMacQueueItem> item) Link Here 
97
  NS_ASSERT_MSG (GetMaxSize ().GetUnit () == QueueSizeUnit::PACKETS,
115
  NS_ASSERT_MSG (GetMaxSize ().GetUnit () == QueueSizeUnit::PACKETS,
98
                 "WifiMacQueues must be in packet mode");
116
                 "WifiMacQueues must be in packet mode");
99
117
118
  QueueBase::SetMaxSize (GetMaxQueueSize ()); //Make sure QueueBase has the same maximum queue size
119
100
  // if the queue is full, remove the first stale packet (if any) encountered
120
  // if the queue is full, remove the first stale packet (if any) encountered
101
  // starting from the head of the queue, in order to make room for the new packet.
121
  // starting from the head of the queue, in order to make room for the new packet.
102
  if (QueueBase::GetNPackets () == GetMaxSize ().GetValue ())
122
  if (QueueBase::GetNPackets () == GetMaxSize ().GetValue ())
 Lines 124-129   WifiMacQueue::PushFront (Ptr<WifiMacQueueItem> item) Link Here 
124
  NS_ASSERT_MSG (GetMaxSize ().GetUnit () == QueueSizeUnit::PACKETS,
144
  NS_ASSERT_MSG (GetMaxSize ().GetUnit () == QueueSizeUnit::PACKETS,
125
                 "WifiMacQueues must be in packet mode");
145
                 "WifiMacQueues must be in packet mode");
126
146
147
  QueueBase::SetMaxSize (GetMaxQueueSize ()); //Make sure QueueBase has the same maximum queue size
148
127
  // if the queue is full, remove the first stale packet (if any) encountered
149
  // if the queue is full, remove the first stale packet (if any) encountered
128
  // starting from the head of the queue, in order to make room for the new packet.
150
  // starting from the head of the queue, in order to make room for the new packet.
129
  if (QueueBase::GetNPackets () == GetMaxSize ().GetValue ())
151
  if (QueueBase::GetNPackets () == GetMaxSize ().GetValue ())
(-)a/src/wifi/model/wifi-mac-queue.h (+13 lines)
 Lines 64-69   public: Link Here 
64
  };
64
  };
65
65
66
  /**
66
  /**
67
   * \brief Set the maximum size of this queue
68
   *
69
   * Trying to set a null size has no effect.
70
   *
71
   * \param size the maximum size
72
   */
73
  void SetMaxQueueSize (QueueSize size);
74
  /**
75
   * \return the maximum size of this queue
76
   */
77
  QueueSize GetMaxQueueSize (void) const;
78
  /**
67
   * Set the maximum delay before the packet is discarded.
79
   * Set the maximum delay before the packet is discarded.
68
   *
80
   *
69
   * \param delay the maximum delay
81
   * \param delay the maximum delay
 Lines 229-234   private: Link Here 
229
   */
241
   */
230
  bool TtlExceeded (ConstIterator &it);
242
  bool TtlExceeded (ConstIterator &it);
231
243
244
  QueueSize m_maxSize;                      //!< max queue size
232
  Time m_maxDelay;                          //!< Time to live for packets in the queue
245
  Time m_maxDelay;                          //!< Time to live for packets in the queue
233
  DropPolicy m_dropPolicy;                  //!< Drop behavior of queue
246
  DropPolicy m_dropPolicy;                  //!< Drop behavior of queue
234
247
(-)a/src/wifi/model/wifi-mac.cc (+9 lines)
 Lines 25-30    Link Here 
25
#include "ssid.h"
25
#include "ssid.h"
26
#include "wifi-net-device.h"
26
#include "wifi-net-device.h"
27
#include "ht-configuration.h"
27
#include "ht-configuration.h"
28
#include "vht-configuration.h"
28
#include "he-configuration.h"
29
#include "he-configuration.h"
29
30
30
namespace ns3 {
31
namespace ns3 {
 Lines 414-419   WifiMac::Configure80211ax_5Ghz (void) Link Here 
414
{
415
{
415
  NS_LOG_FUNCTION (this);
416
  NS_LOG_FUNCTION (this);
416
  Configure80211ac ();
417
  Configure80211ac ();
418
  SetCompressedBlockAckTimeout (GetSifs () + GetSlot () + MicroSeconds (85) + GetDefaultMaxPropagationDelay () * 2);
417
}
419
}
418
420
419
void
421
void
 Lines 480-485   WifiMac::GetHtConfiguration (void) const Link Here 
480
      return device->GetHtConfiguration ();
482
      return device->GetHtConfiguration ();
481
}
483
}
482
484
485
Ptr<VhtConfiguration>
486
WifiMac::GetVhtConfiguration (void) const
487
{
488
      Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
489
      return device->GetVhtConfiguration ();
490
}
491
483
Ptr<HeConfiguration>
492
Ptr<HeConfiguration>
484
WifiMac::GetHeConfiguration (void) const
493
WifiMac::GetHeConfiguration (void) const
485
{
494
{
(-)a/src/wifi/model/wifi-mac.h (-9 / +14 lines)
 Lines 31-36   namespace ns3 { Link Here 
31
class Ssid;
31
class Ssid;
32
class Txop;
32
class Txop;
33
class HtConfiguration;
33
class HtConfiguration;
34
class VhtConfiguration;
34
class HeConfiguration;
35
class HeConfiguration;
35
36
36
/**
37
/**
 Lines 312-317   public: Link Here 
312
   */
313
   */
313
  void ConfigureStandard (WifiPhyStandard standard);
314
  void ConfigureStandard (WifiPhyStandard standard);
314
315
316
  /**
317
   * \return pointer to HtConfiguration if it exists
318
   */
319
  Ptr<HtConfiguration> GetHtConfiguration (void) const;
320
  /**
321
   * \return pointer to VhtConfiguration if it exists
322
   */
323
  Ptr<VhtConfiguration> GetVhtConfiguration (void) const;
324
  /**
325
   * \return pointer to HeConfiguration if it exists
326
   */
327
  Ptr<HeConfiguration> GetHeConfiguration (void) const;
328
315
329
316
protected:
330
protected:
317
  /**
331
  /**
 Lines 325-339   protected: Link Here 
325
   */
339
   */
326
  void ConfigureDcf (Ptr<Txop> dcf, uint32_t cwmin, uint32_t cwmax, bool isDsss, AcIndex ac);
340
  void ConfigureDcf (Ptr<Txop> dcf, uint32_t cwmin, uint32_t cwmax, bool isDsss, AcIndex ac);
327
341
328
  /**
329
   * \return pointer to HtConfiguration if it exists
330
   */
331
  Ptr<HtConfiguration> GetHtConfiguration (void) const;
332
  /**
333
   * \return pointer to HeConfiguration if it exists
334
   */
335
  Ptr<HeConfiguration> GetHeConfiguration (void) const;
336
337
342
338
private:
343
private:
339
  /**
344
  /**
(-)a/src/wifi/model/wifi-utils.cc (-13 / +1 lines)
 Lines 118-136   GetBlockAckSize (BlockAckType type) Link Here 
118
  WifiMacHeader hdr;
118
  WifiMacHeader hdr;
119
  hdr.SetType (WIFI_MAC_CTL_BACKRESP);
119
  hdr.SetType (WIFI_MAC_CTL_BACKRESP);
120
  CtrlBAckResponseHeader blockAck;
120
  CtrlBAckResponseHeader blockAck;
121
  if (type == BASIC_BLOCK_ACK)
121
  blockAck.SetType (type);
122
    {
123
      blockAck.SetType (BASIC_BLOCK_ACK);
124
    }
125
  else if (type == COMPRESSED_BLOCK_ACK)
126
    {
127
      blockAck.SetType (COMPRESSED_BLOCK_ACK);
128
    }
129
  else if (type == MULTI_TID_BLOCK_ACK)
130
    {
131
      //Not implemented
132
      NS_ASSERT (false);
133
    }
134
  return hdr.GetSize () + blockAck.GetSerializedSize () + 4;
122
  return hdr.GetSize () + blockAck.GetSerializedSize () + 4;
135
}
123
}
136
124
(-)a/src/wifi/model/wifi-utils.h (-1 / +1 lines)
 Lines 120-126   uint32_t GetCtsSize (void); Link Here 
120
/**
120
/**
121
 * \param seq MPDU sequence number
121
 * \param seq MPDU sequence number
122
 * \param winstart sequence number window start
122
 * \param winstart sequence number window start
123
 * \param winsize the size of the sequence number window (currently default is 64)
123
 * \param winsize the size of the sequence number window
124
 * \returns true if in the window
124
 * \returns true if in the window
125
 *
125
 *
126
 * This method checks if the MPDU's sequence number is inside the scoreboard boundaries or not
126
 * This method checks if the MPDU's sequence number is inside the scoreboard boundaries or not
(-)a/src/wifi/test/wifi-aggregation-test.cc (-6 / +155 lines)
 Lines 30-35    Link Here 
30
#include "ns3/mpdu-aggregator.h"
30
#include "ns3/mpdu-aggregator.h"
31
#include "ns3/wifi-net-device.h"
31
#include "ns3/wifi-net-device.h"
32
#include "ns3/ht-configuration.h"
32
#include "ns3/ht-configuration.h"
33
#include "ns3/vht-configuration.h"
34
#include "ns3/he-configuration.h"
33
35
34
using namespace ns3;
36
using namespace ns3;
35
37
 Lines 100-106   AmpduAggregationTest::DoRun (void) Link Here 
100
  /*
102
  /*
101
   * Configure MPDU aggregation.
103
   * Configure MPDU aggregation.
102
   */
104
   */
103
  m_mac->GetBEQueue ()->GetMpduAggregator ()->SetMaxAmpduSize (65535);
105
  htConfiguration->SetAttribute ("BeMaxAmpduSize", UintegerValue (65535));
104
106
105
  /*
107
  /*
106
   * Create a dummy packet of 1500 bytes and fill mac header fields.
108
   * Create a dummy packet of 1500 bytes and fill mac header fields.
 Lines 124-130   AmpduAggregationTest::DoRun (void) Link Here 
124
  MgtAddBaRequestHeader reqHdr;
126
  MgtAddBaRequestHeader reqHdr;
125
  reqHdr.SetImmediateBlockAck ();
127
  reqHdr.SetImmediateBlockAck ();
126
  reqHdr.SetTid (0);
128
  reqHdr.SetTid (0);
127
  reqHdr.SetBufferSize (0);
129
  reqHdr.SetBufferSize (64);
128
  reqHdr.SetTimeout (0);
130
  reqHdr.SetTimeout (0);
129
  reqHdr.SetStartingSequence (0);
131
  reqHdr.SetStartingSequence (0);
130
  m_mac->GetBEQueue ()->m_baManager->CreateAgreement (&reqHdr, hdr.GetAddr1 ());
132
  m_mac->GetBEQueue ()->m_baManager->CreateAgreement (&reqHdr, hdr.GetAddr1 ());
 Lines 305-312   TwoLevelAggregationTest::DoRun (void) Link Here 
305
  /*
307
  /*
306
   * Configure aggregation.
308
   * Configure aggregation.
307
   */
309
   */
308
  m_mac->GetBEQueue ()->GetMsduAggregator ()->SetMaxAmsduSize (4095);
310
  htConfiguration->SetAttribute ("BeMaxAmsduSize", UintegerValue (4095));
309
  m_mac->GetBEQueue ()->GetMpduAggregator ()->SetMaxAmpduSize (65535);
311
  htConfiguration->SetAttribute ("BeMaxAmpduSize", UintegerValue (65535));
310
312
311
  /*
313
  /*
312
   * Create dummy packets of 1500 bytes and fill mac header fields that will be used for the tests.
314
   * Create dummy packets of 1500 bytes and fill mac header fields that will be used for the tests.
 Lines 354-360   TwoLevelAggregationTest::DoRun (void) Link Here 
354
   * It checks whether MSDU aggregation has been rejected because the maximum MPDU size is set to 0 (returned packet should be equal to 0).
356
   * It checks whether MSDU aggregation has been rejected because the maximum MPDU size is set to 0 (returned packet should be equal to 0).
355
   * This test is needed to ensure that no packets are removed from the queue in MacLow::PerformMsduAggregation, since aggregation will no occur in MacLow::AggregateToAmpdu.
357
   * This test is needed to ensure that no packets are removed from the queue in MacLow::PerformMsduAggregation, since aggregation will no occur in MacLow::AggregateToAmpdu.
356
   */
358
   */
357
  m_mac->GetBEQueue ()->GetMpduAggregator ()->SetMaxAmpduSize (65535);
359
  htConfiguration->SetAttribute ("BeMaxAmpduSize", UintegerValue (65535));
358
360
359
  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt, hdr));
361
  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt, hdr));
360
  packet = m_mac->GetBEQueue ()->GetLow ()->PerformMsduAggregation (peekedPacket, &peekedHdr, &tstamp, currentAggregatedPacket, 0);
362
  packet = m_mac->GetBEQueue ()->GetLow ()->PerformMsduAggregation (peekedPacket, &peekedHdr, &tstamp, currentAggregatedPacket, 0);
 Lines 369-375   TwoLevelAggregationTest::DoRun (void) Link Here 
369
   * It checks whether MSDU aggregation has been rejected because there is no packets ready in the queue (returned packet should be equal to 0).
371
   * It checks whether MSDU aggregation has been rejected because there is no packets ready in the queue (returned packet should be equal to 0).
370
   * This test is needed to ensure that there is no issue when the queue is empty.
372
   * This test is needed to ensure that there is no issue when the queue is empty.
371
   */
373
   */
372
  m_mac->GetBEQueue ()->GetMpduAggregator ()->SetMaxAmpduSize (4095);
374
  htConfiguration->SetAttribute ("BeMaxAmpduSize", UintegerValue (4095));
373
375
374
  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Remove (pkt);
376
  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Remove (pkt);
375
  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Remove (pkt);
377
  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Remove (pkt);
 Lines 388-393   TwoLevelAggregationTest::DoRun (void) Link Here 
388
 * \ingroup wifi-test
390
 * \ingroup wifi-test
389
 * \ingroup tests
391
 * \ingroup tests
390
 *
392
 *
393
 * \brief 802.11ax aggregation test which permits 64 or 256 MPDUs in A-MPDU according to the negociated buffer size.
394
 */
395
class HeAggregationTest : public TestCase
396
{
397
public:
398
  HeAggregationTest ();
399
400
private:
401
  void DoRun (void);
402
  void DoRunSubTest (uint16_t bufferSize);
403
  Ptr<WifiNetDevice> m_device; ///<WifiNetDevice
404
  Ptr<StaWifiMac> m_mac; ///< Mac
405
  Ptr<YansWifiPhy> m_phy; ///< Phy
406
  Ptr<WifiRemoteStationManager> m_manager; ///< remote station manager
407
  ObjectFactory m_factory; ///< factory
408
};
409
410
HeAggregationTest::HeAggregationTest ()
411
  : TestCase ("Check the correctness of 802.11ax aggregation operations")
412
{
413
}
414
415
void
416
HeAggregationTest::DoRunSubTest (uint16_t bufferSize)
417
{
418
  /*
419
   * Create device and attach configurations.
420
   */
421
  m_device = CreateObject<WifiNetDevice> ();
422
  Ptr<HtConfiguration> htConfiguration = CreateObject<HtConfiguration> ();
423
  m_device->SetHtConfiguration (htConfiguration);
424
  Ptr<VhtConfiguration> vhtConfiguration = CreateObject<VhtConfiguration> ();
425
  m_device->SetVhtConfiguration (vhtConfiguration);
426
  Ptr<HeConfiguration> heConfiguration = CreateObject<HeConfiguration> ();
427
  m_device->SetHeConfiguration (heConfiguration);
428
429
  /*
430
   * Create and configure phy layer.
431
   */
432
  m_phy = CreateObject<YansWifiPhy> ();
433
  m_phy->SetDevice (m_device);
434
  m_phy->ConfigureStandard (WIFI_PHY_STANDARD_80211ax_5GHZ);
435
  m_device->SetPhy (m_phy);
436
437
  /*
438
   * Create and configure manager.
439
   */
440
  m_factory = ObjectFactory ();
441
  m_factory.SetTypeId ("ns3::ConstantRateWifiManager");
442
  m_factory.Set ("DataMode", StringValue ("HeMcs11"));
443
  m_manager = m_factory.Create<WifiRemoteStationManager> ();
444
  m_manager->SetupPhy (m_phy);
445
  m_device->SetRemoteStationManager (m_manager);
446
447
  /*
448
   * Create and configure mac layer.
449
   */
450
  m_mac = CreateObject<StaWifiMac> ();
451
  m_mac->SetDevice (m_device);
452
  m_mac->SetWifiPhy (m_phy);
453
  m_mac->SetWifiRemoteStationManager (m_manager);
454
  m_mac->SetAddress (Mac48Address ("00:00:00:00:00:01"));
455
  m_mac->ConfigureStandard (WIFI_PHY_STANDARD_80211ax_5GHZ);
456
  m_device->SetMac (m_mac);
457
458
  /*
459
   * Create a dummy packet of 100 bytes and fill mac header fields.
460
   */
461
  Ptr<const Packet> pkt = Create<Packet> (100);
462
  Ptr<Packet> currentAggregatedPacket = Create<Packet> ();
463
  WifiMacHeader hdr;
464
  hdr.SetAddr1 (Mac48Address ("00:00:00:00:00:02"));
465
  hdr.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
466
  hdr.SetType (WIFI_MAC_QOSDATA);
467
  hdr.SetQosTid (0);
468
  uint16_t sequence = m_mac->m_txMiddle->GetNextSequenceNumberFor (&hdr);
469
  hdr.SetSequenceNumber (sequence);
470
  hdr.SetFragmentNumber (0);
471
  hdr.SetNoMoreFragments ();
472
  hdr.SetNoRetry ();
473
474
  /*
475
   * Establish agreement.
476
   */
477
  MgtAddBaRequestHeader reqHdr;
478
  reqHdr.SetImmediateBlockAck ();
479
  reqHdr.SetTid (0);
480
  reqHdr.SetBufferSize (bufferSize);
481
  reqHdr.SetTimeout (0);
482
  reqHdr.SetStartingSequence (0);
483
  m_mac->GetBEQueue ()->m_baManager->CreateAgreement (&reqHdr, hdr.GetAddr1 ());
484
485
  /*
486
   * Prepare MacLow for transmission
487
   */
488
  m_mac->GetBEQueue ()->GetLow ()->m_currentHdr = hdr;
489
  m_mac->GetBEQueue ()->GetLow ()->m_currentPacket = pkt->Copy ();
490
  m_mac->GetBEQueue ()->GetLow ()->m_currentTxVector = m_mac->GetBEQueue ()->GetLow ()->GetDataTxVector (m_mac->GetBEQueue ()->GetLow ()->m_currentPacket, &m_mac->GetBEQueue ()->GetLow ()->m_currentHdr);
491
492
  /*
493
   * Test behavior when 300 packets are ready for transmission but negociated buffer size is 64
494
   */
495
  for (uint16_t i = 0; i < 300; i++)
496
    {
497
      Ptr<const Packet> pkt = Create<Packet> (100);
498
      WifiMacHeader hdr;
499
500
      hdr.SetAddr1 (Mac48Address ("00:00:00:00:00:02"));
501
      hdr.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
502
      hdr.SetType (WIFI_MAC_QOSDATA);
503
      hdr.SetQosTid (0);
504
505
      m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt, hdr));
506
  }
507
508
  bool isAmpdu = m_mac->GetBEQueue ()->GetLow ()->IsAmpdu (pkt, hdr);
509
  NS_TEST_EXPECT_MSG_EQ (isAmpdu, true, "MPDU aggregation failed");
510
  uint32_t aggregationQueueSize = m_mac->GetBEQueue ()->GetLow ()->m_aggregateQueue[0]->GetNPackets ();
511
  NS_TEST_EXPECT_MSG_EQ (aggregationQueueSize, bufferSize, "aggregation queue should countain " << bufferSize << " MPDUs");
512
  uint16_t expectedRemainingPacketsInQueue = 300 - bufferSize + 1;
513
  NS_TEST_EXPECT_MSG_EQ (m_mac->GetBEQueue ()->GetWifiMacQueue ()->GetNPackets (), expectedRemainingPacketsInQueue, "queue should contain 300 - "<< bufferSize - 1 << " = "<< expectedRemainingPacketsInQueue << " packets");
514
515
  Simulator::Destroy ();
516
517
  m_manager->Dispose ();
518
  m_manager = 0;
519
520
  m_device->Dispose ();
521
  m_device = 0;
522
523
  htConfiguration = 0;
524
  vhtConfiguration = 0;
525
  heConfiguration = 0;
526
}
527
528
void
529
HeAggregationTest::DoRun ()
530
{
531
  DoRunSubTest (64);
532
  DoRunSubTest (256);
533
}
534
535
/**
536
 * \ingroup wifi-test
537
 * \ingroup tests
538
 *
391
 * \brief Wifi Aggregation Test Suite
539
 * \brief Wifi Aggregation Test Suite
392
 */
540
 */
393
class WifiAggregationTestSuite : public TestSuite
541
class WifiAggregationTestSuite : public TestSuite
 Lines 401-406   WifiAggregationTestSuite::WifiAggregationTestSuite () Link Here 
401
{
549
{
402
  AddTestCase (new AmpduAggregationTest, TestCase::QUICK);
550
  AddTestCase (new AmpduAggregationTest, TestCase::QUICK);
403
  AddTestCase (new TwoLevelAggregationTest, TestCase::QUICK);
551
  AddTestCase (new TwoLevelAggregationTest, TestCase::QUICK);
552
  AddTestCase (new HeAggregationTest, TestCase::QUICK);
404
}
553
}
405
554
406
static WifiAggregationTestSuite g_wifiAggregationTestSuite; ///< the test suite
555
static WifiAggregationTestSuite g_wifiAggregationTestSuite; ///< the test suite

Return to bug 3010