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

(-)a/examples/tcp/tcp-variants-comparison.cc (-120 / +96 lines)
 Lines 1-6    Link Here 
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
2
/*
3
 * Copyright (c) 2013 ResiliNets, ITTC, University of Kansas 
3
 * Copyright (c) 2013 ResiliNets, ITTC, University of Kansas
4
 *
4
 *
5
 * This program is free software; you can redistribute it and/or modify
5
 * This program is free software; you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License version 2 as
6
 * it under the terms of the GNU General Public License version 2 as
 Lines 54-143    Link Here 
54
54
55
NS_LOG_COMPONENT_DEFINE ("TcpVariantsComparison");
55
NS_LOG_COMPONENT_DEFINE ("TcpVariantsComparison");
56
56
57
double old_time = 0.0;
57
bool firstCwnd = true;
58
EventId output;
58
bool firstSshThr = true;
59
Time current = Time::FromInteger(3, Time::S);  //Only record cwnd and ssthresh values every 3 seconds
60
bool first = true;
61
62
static void
63
OutputTrace ()
64
{
65
 // *stream->GetStream() << newtime << " " << newval << std::endl;
66
 // old_time = newval;
67
}
68
59
69
static void
60
static void
70
CwndTracer (Ptr<OutputStreamWrapper>stream, uint32_t oldval, uint32_t newval)
61
CwndTracer (Ptr<OutputStreamWrapper>stream, uint32_t oldval, uint32_t newval)
71
{
62
{
72
  double new_time = Simulator::Now().GetSeconds();
63
  if (firstCwnd)
73
  if (old_time == 0 && first)
74
  {
75
    double mycurrent = current.GetSeconds();
76
    *stream->GetStream() << new_time << " " << mycurrent << " " << newval << std::endl;
77
    first = false;
78
    output = Simulator::Schedule(current,&OutputTrace);
79
  }
80
  else
81
  {
82
    if (output.IsExpired())
83
    {
64
    {
84
      *stream->GetStream() << new_time << " " << newval << std::endl;
65
      *stream->GetStream () << "0.0 " << oldval << std::endl;
85
      output.Cancel();
66
      firstCwnd = false;
86
      output = Simulator::Schedule(current,&OutputTrace);
87
    }
67
    }
88
  }
68
  *stream->GetStream () << Simulator::Now ().GetSeconds () << " " << newval << std::endl;
89
}
69
}
90
70
91
static void
71
static void
92
SsThreshTracer (Ptr<OutputStreamWrapper>stream, uint32_t oldval, uint32_t newval)
72
SsThreshTracer (Ptr<OutputStreamWrapper>stream, uint32_t oldval, uint32_t newval)
93
{
73
{
94
  double new_time = Simulator::Now().GetSeconds();
74
  if (firstCwnd)
95
  if (old_time == 0 && first)
96
  {
97
    double mycurrent = current.GetSeconds();
98
    *stream->GetStream() << new_time << " " << mycurrent << " " << newval << std::endl;
99
    first = false;
100
    output = Simulator::Schedule(current,&OutputTrace);
101
  }
102
  else
103
  {
104
    if (output.IsExpired())
105
    {
75
    {
106
      *stream->GetStream() << new_time << " " << newval << std::endl;
76
      *stream->GetStream () << "0.0 " << oldval << std::endl;
107
      output.Cancel();
77
      firstSshThr = false;
108
      output = Simulator::Schedule(current,&OutputTrace);
109
    }
78
    }
110
  }
79
  *stream->GetStream () << Simulator::Now ().GetSeconds () << " " << newval << std::endl;
111
}
80
}
112
81
82
113
static void
83
static void
114
TraceCwnd (std::string cwnd_tr_file_name)
84
TraceCwnd (std::string cwnd_tr_file_name)
115
{
85
{
116
  AsciiTraceHelper ascii;
86
  AsciiTraceHelper ascii;
117
  if (cwnd_tr_file_name.compare("") == 0)
87
  if (cwnd_tr_file_name.compare ("") == 0)
118
     {
88
    {
119
       NS_LOG_DEBUG ("No trace file for cwnd provided");
89
      NS_LOG_DEBUG ("No trace file for cwnd provided");
120
       return;
90
      return;
121
     }
91
    }
122
  else
92
  else
123
    {
93
    {
124
      Ptr<OutputStreamWrapper> stream = ascii.CreateFileStream(cwnd_tr_file_name.c_str());
94
      Ptr<OutputStreamWrapper> stream = ascii.CreateFileStream (cwnd_tr_file_name.c_str ());
125
      Config::ConnectWithoutContext ("/NodeList/1/$ns3::TcpL4Protocol/SocketList/0/CongestionWindow",MakeBoundCallback (&CwndTracer, stream));
95
      Config::ConnectWithoutContext ("/NodeList/1/$ns3::TcpL4Protocol/SocketList/0/CongestionWindow",MakeBoundCallback (&CwndTracer, stream));
126
    }
96
    }
127
}
97
}
128
98
129
static void
99
static void
130
TraceSsThresh(std::string ssthresh_tr_file_name)
100
TraceSsThresh (std::string ssthresh_tr_file_name)
131
{
101
{
132
  AsciiTraceHelper ascii;
102
  AsciiTraceHelper ascii;
133
  if (ssthresh_tr_file_name.compare("") == 0)
103
  if (ssthresh_tr_file_name.compare ("") == 0)
134
    {
104
    {
135
      NS_LOG_DEBUG ("No trace file for ssthresh provided");
105
      NS_LOG_DEBUG ("No trace file for ssthresh provided");
136
      return;
106
      return;
137
    }
107
    }
138
  else
108
  else
139
    {
109
    {
140
      Ptr<OutputStreamWrapper> stream = ascii.CreateFileStream(ssthresh_tr_file_name.c_str());
110
      Ptr<OutputStreamWrapper> stream = ascii.CreateFileStream (ssthresh_tr_file_name.c_str ());
141
      Config::ConnectWithoutContext ("/NodeList/1/$ns3::TcpL4Protocol/SocketList/0/SlowStartThreshold",MakeBoundCallback (&SsThreshTracer, stream));
111
      Config::ConnectWithoutContext ("/NodeList/1/$ns3::TcpL4Protocol/SocketList/0/SlowStartThreshold",MakeBoundCallback (&SsThreshTracer, stream));
142
    }
112
    }
143
}
113
}
 Lines 162-186    Link Here 
162
132
163
133
164
  CommandLine cmd;
134
  CommandLine cmd;
165
  cmd.AddValue("transport_prot", "Transport protocol to use: TcpTahoe, TcpReno, TcpNewReno, TcpWestwood, TcpWestwoodPlus ", transport_prot);
135
  cmd.AddValue ("transport_prot", "Transport protocol to use: TcpTahoe, TcpReno, TcpNewReno, TcpWestwood, TcpWestwoodPlus ", transport_prot);
166
  cmd.AddValue("error_p", "Packet error rate", error_p);
136
  cmd.AddValue ("error_p", "Packet error rate", error_p);
167
  cmd.AddValue("bandwidth", "Bottleneck bandwidth", bandwidth);
137
  cmd.AddValue ("bandwidth", "Bottleneck bandwidth", bandwidth);
168
  cmd.AddValue("access_bandwidth", "Access link bandwidth", access_bandwidth);
138
  cmd.AddValue ("access_bandwidth", "Access link bandwidth", access_bandwidth);
169
  cmd.AddValue("delay", "Access link delay", access_delay);
139
  cmd.AddValue ("delay", "Access link delay", access_delay);
170
  cmd.AddValue("tracing", "Flag to enable/disable tracing", tracing);
140
  cmd.AddValue ("tracing", "Flag to enable/disable tracing", tracing);
171
  cmd.AddValue("tr_name", "Name of output trace file", tr_file_name);
141
  cmd.AddValue ("tr_name", "Name of output trace file", tr_file_name);
172
  cmd.AddValue("cwnd_tr_name", "Name of output trace file", cwnd_tr_file_name);
142
  cmd.AddValue ("cwnd_tr_name", "Name of output trace file", cwnd_tr_file_name);
173
  cmd.AddValue("ssthresh_tr_name", "Name of output trace file", ssthresh_tr_file_name);
143
  cmd.AddValue ("ssthresh_tr_name", "Name of output trace file", ssthresh_tr_file_name);
174
  cmd.AddValue("data", "Number of Megabytes of data to transmit", data_mbytes);
144
  cmd.AddValue ("data", "Number of Megabytes of data to transmit", data_mbytes);
175
  cmd.AddValue("mtu", "Size of IP packets to send in bytes", mtu_bytes);
145
  cmd.AddValue ("mtu", "Size of IP packets to send in bytes", mtu_bytes);
176
  cmd.AddValue("num_flows", "Number of flows", num_flows);
146
  cmd.AddValue ("num_flows", "Number of flows", num_flows);
177
  cmd.AddValue("duration", "Time to allow flows to run in seconds", duration);
147
  cmd.AddValue ("duration", "Time to allow flows to run in seconds", duration);
178
  cmd.AddValue("run", "Run index (for setting repeatable seeds)", run);
148
  cmd.AddValue ("run", "Run index (for setting repeatable seeds)", run);
179
  cmd.AddValue("flow_monitor", "Enable flow monitor", flow_monitor);
149
  cmd.AddValue ("flow_monitor", "Enable flow monitor", flow_monitor);
180
  cmd.Parse (argc, argv);
150
  cmd.Parse (argc, argv);
181
151
182
  SeedManager::SetSeed(1);
152
  SeedManager::SetSeed (1);
183
  SeedManager::SetRun(run);
153
  SeedManager::SetRun (run);
184
154
185
  // User may find it convenient to enable logging
155
  // User may find it convenient to enable logging
186
  //LogComponentEnable("TcpVariantsComparison", LOG_LEVEL_ALL);
156
  //LogComponentEnable("TcpVariantsComparison", LOG_LEVEL_ALL);
 Lines 188-199    Link Here 
188
  //LogComponentEnable("DropTailQueue", LOG_LEVEL_ALL);
158
  //LogComponentEnable("DropTailQueue", LOG_LEVEL_ALL);
189
159
190
  // Calculate the ADU size
160
  // Calculate the ADU size
191
  Header* temp_header = new Ipv4Header();
161
  Header* temp_header = new Ipv4Header ();
192
  uint32_t ip_header = temp_header->GetSerializedSize();
162
  uint32_t ip_header = temp_header->GetSerializedSize ();
193
  NS_LOG_LOGIC ("IP Header size is: " << ip_header);
163
  NS_LOG_LOGIC ("IP Header size is: " << ip_header);
194
  delete temp_header;
164
  delete temp_header;
195
  temp_header = new TcpHeader();
165
  temp_header = new TcpHeader ();
196
  uint32_t tcp_header = temp_header->GetSerializedSize();
166
  uint32_t tcp_header = temp_header->GetSerializedSize ();
197
  NS_LOG_LOGIC ("TCP Header size is: " << tcp_header);
167
  NS_LOG_LOGIC ("TCP Header size is: " << tcp_header);
198
  delete temp_header;
168
  delete temp_header;
199
  uint32_t tcp_adu_size = mtu_bytes - (ip_header + tcp_header);
169
  uint32_t tcp_adu_size = mtu_bytes - (ip_header + tcp_header);
 Lines 204-225    Link Here 
204
  float stop_time = start_time + duration;
174
  float stop_time = start_time + duration;
205
175
206
  // Select TCP variant
176
  // Select TCP variant
207
  if (transport_prot.compare("TcpTahoe") == 0)
177
  if (transport_prot.compare ("TcpTahoe") == 0)
208
    Config::SetDefault("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpTahoe::GetTypeId()));
178
    {
209
  else if (transport_prot.compare("TcpReno") == 0)
179
      Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpTahoe::GetTypeId ()));
210
    Config::SetDefault("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpReno::GetTypeId()));
211
  else if (transport_prot.compare("TcpNewReno") == 0)
212
    Config::SetDefault("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpNewReno::GetTypeId()));
213
  else if (transport_prot.compare("TcpWestwood") == 0)
214
    {// the default protocol type in ns3::TcpWestwood is WESTWOOD
215
      Config::SetDefault("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpWestwood::GetTypeId()));
216
      Config::SetDefault("ns3::TcpWestwood::FilterType", EnumValue(TcpWestwood::TUSTIN));
217
    }
180
    }
218
  else if (transport_prot.compare("TcpWestwoodPlus") == 0)
181
  else if (transport_prot.compare ("TcpReno") == 0)
219
    {
182
    {
220
      Config::SetDefault("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpWestwood::GetTypeId()));
183
      Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpReno::GetTypeId ()));
221
      Config::SetDefault("ns3::TcpWestwood::ProtocolType", EnumValue(TcpWestwood::WESTWOODPLUS));
184
    }
222
      Config::SetDefault("ns3::TcpWestwood::FilterType", EnumValue(TcpWestwood::TUSTIN));
185
  else if (transport_prot.compare ("TcpNewReno") == 0)
186
    {
187
      Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpNewReno::GetTypeId ()));
188
    }
189
  else if (transport_prot.compare ("TcpWestwood") == 0)
190
    { // the default protocol type in ns3::TcpWestwood is WESTWOOD
191
      Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpWestwood::GetTypeId ()));
192
      Config::SetDefault ("ns3::TcpWestwood::FilterType", EnumValue (TcpWestwood::TUSTIN));
193
    }
194
  else if (transport_prot.compare ("TcpWestwoodPlus") == 0)
195
    {
196
      Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpWestwood::GetTypeId ()));
197
      Config::SetDefault ("ns3::TcpWestwood::ProtocolType", EnumValue (TcpWestwood::WESTWOODPLUS));
198
      Config::SetDefault ("ns3::TcpWestwood::FilterType", EnumValue (TcpWestwood::TUSTIN));
223
    }
199
    }
224
  else
200
  else
225
    {
201
    {
 Lines 231-248    Link Here 
231
  NodeContainer gateways;
207
  NodeContainer gateways;
232
  gateways.Create (1);
208
  gateways.Create (1);
233
  NodeContainer sources;
209
  NodeContainer sources;
234
  sources.Create(num_flows);
210
  sources.Create (num_flows);
235
  NodeContainer sinks;
211
  NodeContainer sinks;
236
  sinks.Create(num_flows);
212
  sinks.Create (num_flows);
237
213
238
  // Configure the error model
214
  // Configure the error model
239
  // Here we use RateErrorModel with packet error rate
215
  // Here we use RateErrorModel with packet error rate
240
  Ptr<UniformRandomVariable> uv = CreateObject<UniformRandomVariable>();
216
  Ptr<UniformRandomVariable> uv = CreateObject<UniformRandomVariable> ();
241
  uv->SetStream (50);
217
  uv->SetStream (50);
242
  RateErrorModel error_model;
218
  RateErrorModel error_model;
243
  error_model.SetRandomVariable(uv);
219
  error_model.SetRandomVariable (uv);
244
  error_model.SetUnit(RateErrorModel::ERROR_UNIT_PACKET);
220
  error_model.SetUnit (RateErrorModel::ERROR_UNIT_PACKET);
245
  error_model.SetRate(error_p);
221
  error_model.SetRate (error_p);
246
222
247
  PointToPointHelper UnReLink;
223
  PointToPointHelper UnReLink;
248
  UnReLink.SetDeviceAttribute ("DataRate", StringValue (bandwidth));
224
  UnReLink.SetDeviceAttribute ("DataRate", StringValue (bandwidth));
 Lines 262-277    Link Here 
262
  LocalLink.SetDeviceAttribute ("DataRate", StringValue (access_bandwidth));
238
  LocalLink.SetDeviceAttribute ("DataRate", StringValue (access_bandwidth));
263
  LocalLink.SetChannelAttribute ("Delay", StringValue (access_delay));
239
  LocalLink.SetChannelAttribute ("Delay", StringValue (access_delay));
264
  Ipv4InterfaceContainer sink_interfaces;
240
  Ipv4InterfaceContainer sink_interfaces;
265
  for (int i=0; i<num_flows; i++)
241
  for (int i = 0; i < num_flows; i++)
266
    {
242
    {
267
      NetDeviceContainer devices;
243
      NetDeviceContainer devices;
268
      devices = LocalLink.Install(sources.Get(i), gateways.Get(0));
244
      devices = LocalLink.Install (sources.Get (i), gateways.Get (0));
269
      address.NewNetwork();
245
      address.NewNetwork ();
270
      Ipv4InterfaceContainer interfaces = address.Assign (devices);
246
      Ipv4InterfaceContainer interfaces = address.Assign (devices);
271
      devices = UnReLink.Install(gateways.Get(0), sinks.Get(i));
247
      devices = UnReLink.Install (gateways.Get (0), sinks.Get (i));
272
      address.NewNetwork();
248
      address.NewNetwork ();
273
      interfaces = address.Assign (devices);
249
      interfaces = address.Assign (devices);
274
      sink_interfaces.Add(interfaces.Get(1));
250
      sink_interfaces.Add (interfaces.Get (1));
275
    }
251
    }
276
252
277
  NS_LOG_INFO ("Initialize Global Routing.");
253
  NS_LOG_INFO ("Initialize Global Routing.");
 Lines 281-309    Link Here 
281
  Address sinkLocalAddress (InetSocketAddress (Ipv4Address::GetAny (), port));
257
  Address sinkLocalAddress (InetSocketAddress (Ipv4Address::GetAny (), port));
282
  PacketSinkHelper sinkHelper ("ns3::TcpSocketFactory", sinkLocalAddress);
258
  PacketSinkHelper sinkHelper ("ns3::TcpSocketFactory", sinkLocalAddress);
283
259
284
  for(uint16_t i=0; i<sources.GetN(); i++)
260
  for (uint16_t i = 0; i < sources.GetN (); i++)
285
    {
261
    {
286
      AddressValue remoteAddress (InetSocketAddress (sink_interfaces.GetAddress(i, 0), port));
262
      AddressValue remoteAddress (InetSocketAddress (sink_interfaces.GetAddress (i, 0), port));
287
263
288
      if (transport_prot.compare("TcpTahoe") == 0
264
      if (transport_prot.compare ("TcpTahoe") == 0
289
          || transport_prot.compare("TcpReno") == 0
265
          || transport_prot.compare ("TcpReno") == 0
290
          || transport_prot.compare("TcpNewReno") == 0
266
          || transport_prot.compare ("TcpNewReno") == 0
291
          || transport_prot.compare("TcpWestwood") == 0
267
          || transport_prot.compare ("TcpWestwood") == 0
292
          || transport_prot.compare("TcpWestwoodPlus") == 0)
268
          || transport_prot.compare ("TcpWestwoodPlus") == 0)
293
        {
269
        {
294
          Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (tcp_adu_size));
270
          Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (tcp_adu_size));
295
          BulkSendHelper ftp("ns3::TcpSocketFactory", Address());
271
          BulkSendHelper ftp ("ns3::TcpSocketFactory", Address ());
296
          ftp.SetAttribute ("Remote", remoteAddress);
272
          ftp.SetAttribute ("Remote", remoteAddress);
297
          ftp.SetAttribute ("SendSize", UintegerValue (tcp_adu_size));
273
          ftp.SetAttribute ("SendSize", UintegerValue (tcp_adu_size));
298
          ftp.SetAttribute ("MaxBytes", UintegerValue (int(data_mbytes*1000000)));
274
          ftp.SetAttribute ("MaxBytes", UintegerValue (int(data_mbytes * 1000000)));
299
275
300
          ApplicationContainer sourceApp = ftp.Install (sources.Get(i));
276
          ApplicationContainer sourceApp = ftp.Install (sources.Get (i));
301
          sourceApp.Start (Seconds (start_time*i));
277
          sourceApp.Start (Seconds (start_time * i));
302
          sourceApp.Stop (Seconds (stop_time - 3));
278
          sourceApp.Stop (Seconds (stop_time - 3));
303
279
304
          sinkHelper.SetAttribute ("Protocol", TypeIdValue (TcpSocketFactory::GetTypeId ()));
280
          sinkHelper.SetAttribute ("Protocol", TypeIdValue (TcpSocketFactory::GetTypeId ()));
305
          ApplicationContainer sinkApp = sinkHelper.Install (sinks);
281
          ApplicationContainer sinkApp = sinkHelper.Install (sinks);
306
          sinkApp.Start (Seconds (start_time*i));
282
          sinkApp.Start (Seconds (start_time * i));
307
          sinkApp.Stop (Seconds (stop_time));
283
          sinkApp.Stop (Seconds (stop_time));
308
        }
284
        }
309
      else
285
      else
 Lines 318-356    Link Here 
318
    {
294
    {
319
      std::ofstream ascii;
295
      std::ofstream ascii;
320
      Ptr<OutputStreamWrapper> ascii_wrap;
296
      Ptr<OutputStreamWrapper> ascii_wrap;
321
      if (tr_file_name.compare("") == 0)
297
      if (tr_file_name.compare ("") == 0)
322
        {
298
        {
323
          NS_LOG_DEBUG ("No trace file provided");
299
          NS_LOG_DEBUG ("No trace file provided");
324
          exit (1);
300
          exit (1);
325
        }
301
        }
326
      else
302
      else
327
        {
303
        {
328
          ascii.open (tr_file_name.c_str());
304
          ascii.open (tr_file_name.c_str ());
329
          ascii_wrap = new OutputStreamWrapper(tr_file_name.c_str(), std::ios::out);
305
          ascii_wrap = new OutputStreamWrapper (tr_file_name.c_str (), std::ios::out);
330
        }
306
        }
331
307
332
      stack.EnableAsciiIpv4All (ascii_wrap);
308
      stack.EnableAsciiIpv4All (ascii_wrap);
333
309
334
      Simulator::Schedule(Seconds(0.00001), &TraceCwnd, cwnd_tr_file_name);
310
      Simulator::Schedule (Seconds (0.00001), &TraceCwnd, cwnd_tr_file_name);
335
      Simulator::Schedule(Seconds(0.00001), &TraceSsThresh, ssthresh_tr_file_name);
311
      Simulator::Schedule (Seconds (0.00001), &TraceSsThresh, ssthresh_tr_file_name);
336
    }
312
    }
337
313
338
  UnReLink.EnablePcapAll("TcpVariantsComparison", true);
314
  UnReLink.EnablePcapAll ("TcpVariantsComparison", true);
339
  LocalLink.EnablePcapAll("TcpVariantsComparison", true);
315
  LocalLink.EnablePcapAll ("TcpVariantsComparison", true);
340
316
341
  // Flow monitor
317
  // Flow monitor
342
  FlowMonitorHelper flowHelper;
318
  FlowMonitorHelper flowHelper;
343
  if (flow_monitor)
319
  if (flow_monitor)
344
    {
320
    {
345
      flowHelper.InstallAll();
321
      flowHelper.InstallAll ();
346
    }
322
    }
347
323
348
  Simulator::Stop (Seconds(stop_time));
324
  Simulator::Stop (Seconds (stop_time));
349
  Simulator::Run ();
325
  Simulator::Run ();
350
326
351
  if (flow_monitor)
327
  if (flow_monitor)
352
    {
328
    {
353
      flowHelper.SerializeToXmlFile("TcpVariantsComparison.flowmonitor", true, true);
329
      flowHelper.SerializeToXmlFile ("TcpVariantsComparison.flowmonitor", true, true);
354
    }
330
    }
355
331
356
  Simulator::Destroy ();
332
  Simulator::Destroy ();
(-)a/src/internet/model/tcp-newreno.cc (-5 / +8 lines)
 Lines 46-58    Link Here 
46
                    MakeUintegerAccessor (&TcpNewReno::m_retxThresh),
46
                    MakeUintegerAccessor (&TcpNewReno::m_retxThresh),
47
                    MakeUintegerChecker<uint32_t> ())
47
                    MakeUintegerChecker<uint32_t> ())
48
    .AddAttribute ("LimitedTransmit", "Enable limited transmit",
48
    .AddAttribute ("LimitedTransmit", "Enable limited transmit",
49
		    BooleanValue (false),
49
                   BooleanValue (false),
50
		    MakeBooleanAccessor (&TcpNewReno::m_limitedTx),
50
                   MakeBooleanAccessor (&TcpNewReno::m_limitedTx),
51
		    MakeBooleanChecker ())
51
                   MakeBooleanChecker ())
52
    .AddTraceSource ("CongestionWindow",
52
    .AddTraceSource ("CongestionWindow",
53
                     "The TCP connection's congestion window",
53
                     "The TCP connection's congestion window",
54
                     MakeTraceSourceAccessor (&TcpNewReno::m_cWnd))
54
                     MakeTraceSourceAccessor (&TcpNewReno::m_cWnd))
55
  ;
55
    .AddTraceSource ("SlowStartThreshold",
56
                     "TCP slow start threshold (bytes)",
57
                     MakeTraceSourceAccessor (&TcpNewReno::m_ssThresh))
58
 ;
56
  return tid;
59
  return tid;
57
}
60
}
58
61
 Lines 134-140    Link Here 
134
    }
137
    }
135
  else if (m_inFastRec && seq >= m_recover)
138
  else if (m_inFastRec && seq >= m_recover)
136
    { // Full ACK (RFC2582 sec.3 bullet #5 paragraph 2, option 1)
139
    { // Full ACK (RFC2582 sec.3 bullet #5 paragraph 2, option 1)
137
      m_cWnd = std::min (m_ssThresh, BytesInFlight () + m_segmentSize);
140
      m_cWnd = std::min (m_ssThresh.Get (), BytesInFlight () + m_segmentSize);
138
      m_inFastRec = false;
141
      m_inFastRec = false;
139
      NS_LOG_INFO ("Received full ACK. Leaving fast recovery with cwnd set to " << m_cWnd);
142
      NS_LOG_INFO ("Received full ACK. Leaving fast recovery with cwnd set to " << m_cWnd);
140
    }
143
    }
(-)a/src/internet/model/tcp-newreno.h (-1 / +1 lines)
 Lines 77-83    Link Here 
77
77
78
protected:
78
protected:
79
  TracedValue<uint32_t>  m_cWnd;         //!< Congestion window
79
  TracedValue<uint32_t>  m_cWnd;         //!< Congestion window
80
  uint32_t               m_ssThresh;     //!< Slow Start Threshold
80
  TracedValue<uint32_t>  m_ssThresh;     //!< Slow Start Threshold
81
  uint32_t               m_initialCWnd;  //!< Initial cWnd value
81
  uint32_t               m_initialCWnd;  //!< Initial cWnd value
82
  SequenceNumber32       m_recover;      //!< Previous highest Tx seqnum for fast recovery
82
  SequenceNumber32       m_recover;      //!< Previous highest Tx seqnum for fast recovery
83
  uint32_t               m_retxThresh;   //!< Fast Retransmit threshold
83
  uint32_t               m_retxThresh;   //!< Fast Retransmit threshold
(-)a/src/internet/model/tcp-reno.cc (+3 lines)
 Lines 48-53    Link Here 
48
    .AddTraceSource ("CongestionWindow",
48
    .AddTraceSource ("CongestionWindow",
49
                     "The TCP connection's congestion window",
49
                     "The TCP connection's congestion window",
50
                     MakeTraceSourceAccessor (&TcpReno::m_cWnd))
50
                     MakeTraceSourceAccessor (&TcpReno::m_cWnd))
51
    .AddTraceSource ("SlowStartThreshold",
52
                     "TCP slow start threshold (bytes)",
53
                     MakeTraceSourceAccessor (&TcpReno::m_ssThresh))
51
  ;
54
  ;
52
  return tid;
55
  return tid;
53
}
56
}
(-)a/src/internet/model/tcp-reno.h (-1 / +1 lines)
 Lines 79-85    Link Here 
79
79
80
protected:
80
protected:
81
  TracedValue<uint32_t>  m_cWnd;         //!< Congestion window
81
  TracedValue<uint32_t>  m_cWnd;         //!< Congestion window
82
  uint32_t               m_ssThresh;     //!< Slow Start Threshold
82
  TracedValue<uint32_t>  m_ssThresh;     //!< Slow Start Threshold
83
  uint32_t               m_initialCWnd;  //!< Initial cWnd value
83
  uint32_t               m_initialCWnd;  //!< Initial cWnd value
84
  uint32_t               m_retxThresh;   //!< Fast Retransmit threshold
84
  uint32_t               m_retxThresh;   //!< Fast Retransmit threshold
85
  bool                   m_inFastRec;    //!< currently in fast recovery
85
  bool                   m_inFastRec;    //!< currently in fast recovery
(-)a/src/internet/model/tcp-tahoe.cc (+3 lines)
 Lines 48-53    Link Here 
48
    .AddTraceSource ("CongestionWindow",
48
    .AddTraceSource ("CongestionWindow",
49
                     "The TCP connection's congestion window",
49
                     "The TCP connection's congestion window",
50
                     MakeTraceSourceAccessor (&TcpTahoe::m_cWnd))
50
                     MakeTraceSourceAccessor (&TcpTahoe::m_cWnd))
51
    .AddTraceSource ("SlowStartThreshold",
52
                     "TCP slow start threshold (bytes)",
53
                     MakeTraceSourceAccessor (&TcpTahoe::m_ssThresh))
51
  ;
54
  ;
52
  return tid;
55
  return tid;
53
}
56
}
(-)a/src/internet/model/tcp-tahoe.h (-1 / +1 lines)
 Lines 83-89    Link Here 
83
83
84
protected:
84
protected:
85
  TracedValue<uint32_t>  m_cWnd;         //!< Congestion window
85
  TracedValue<uint32_t>  m_cWnd;         //!< Congestion window
86
  uint32_t               m_ssThresh;     //!< Slow Start Threshold
86
  TracedValue<uint32_t>  m_ssThresh;     //!< Slow Start Threshold
87
  uint32_t               m_initialCWnd;  //!< Initial cWnd value
87
  uint32_t               m_initialCWnd;  //!< Initial cWnd value
88
  uint32_t               m_retxThresh;   //!< Fast Retransmit threshold
88
  uint32_t               m_retxThresh;   //!< Fast Retransmit threshold
89
};
89
};
(-)a/src/internet/model/tcp-westwood.cc (-1 / +4 lines)
 Lines 57-62    Link Here 
57
      .AddConstructor<TcpWestwood>()
57
      .AddConstructor<TcpWestwood>()
58
      .AddTraceSource("CongestionWindow", "The TCP connection's congestion window",
58
      .AddTraceSource("CongestionWindow", "The TCP connection's congestion window",
59
                      MakeTraceSourceAccessor(&TcpWestwood::m_cWnd))
59
                      MakeTraceSourceAccessor(&TcpWestwood::m_cWnd))
60
      .AddTraceSource ("SlowStartThreshold",
61
                       "TCP slow start threshold (bytes)",
62
                       MakeTraceSourceAccessor (&TcpWestwood::m_ssThresh))
60
      .AddAttribute("FilterType", "Use this to choose no filter or Tustin's approximation filter",
63
      .AddAttribute("FilterType", "Use this to choose no filter or Tustin's approximation filter",
61
                    EnumValue(TcpWestwood::TUSTIN), MakeEnumAccessor(&TcpWestwood::m_fType),
64
                    EnumValue(TcpWestwood::TUSTIN), MakeEnumAccessor(&TcpWestwood::m_fType),
62
                    MakeEnumChecker(TcpWestwood::NONE, "None", TcpWestwood::TUSTIN, "Tustin"))
65
                    MakeEnumChecker(TcpWestwood::NONE, "None", TcpWestwood::TUSTIN, "Tustin"))
 Lines 273-279    Link Here 
273
  if (count == 3 && !m_inFastRec)
276
  if (count == 3 && !m_inFastRec)
274
    {// Triple duplicate ACK triggers fast retransmit
277
    {// Triple duplicate ACK triggers fast retransmit
275
     // Adjust cwnd and ssthresh based on the estimated BW
278
     // Adjust cwnd and ssthresh based on the estimated BW
276
      m_ssThresh = m_currentBW * static_cast<double> (m_minRtt.GetSeconds());
279
      m_ssThresh = uint32_t(m_currentBW * static_cast<double> (m_minRtt.GetSeconds()));
277
      if (m_cWnd > m_ssThresh)
280
      if (m_cWnd > m_ssThresh)
278
        {
281
        {
279
          m_cWnd = m_ssThresh;
282
          m_cWnd = m_ssThresh;
(-)a/src/internet/model/tcp-westwood.h (-1 / +1 lines)
 Lines 164-170    Link Here 
164
164
165
protected:
165
protected:
166
  TracedValue<uint32_t>  m_cWnd;                   //!< Congestion window
166
  TracedValue<uint32_t>  m_cWnd;                   //!< Congestion window
167
  uint32_t               m_ssThresh;               //!< Slow Start Threshold
167
  TracedValue<uint32_t>  m_ssThresh;               //!< Slow Start Threshold
168
  uint32_t               m_initialCWnd;            //!< Initial cWnd value
168
  uint32_t               m_initialCWnd;            //!< Initial cWnd value
169
  bool                   m_inFastRec;              //!< Currently in fast recovery if TRUE
169
  bool                   m_inFastRec;              //!< Currently in fast recovery if TRUE
170
170

Return to bug 1831