LEFT | RIGHT |
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 * This program is free software; you can redistribute it and/or modify | 3 * This program is free software; you can redistribute it and/or modify |
4 * it under the terms of the GNU General Public License version 2 as | 4 * it under the terms of the GNU General Public License version 2 as |
5 * published by the Free Software Foundation; | 5 * published by the Free Software Foundation; |
6 * | 6 * |
7 * This program is distributed in the hope that it will be useful, | 7 * This program is distributed in the hope that it will be useful, |
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
10 * GNU General Public License for more details. | 10 * GNU General Public License for more details. |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 Config::SetDefault ("ns3::TcpL4Protocol::SocketType", StringValue ("ns3::TcpNe
wReno")); | 310 Config::SetDefault ("ns3::TcpL4Protocol::SocketType", StringValue ("ns3::TcpNe
wReno")); |
311 // 42 = headers size | 311 // 42 = headers size |
312 Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (1000 - 42)); | 312 Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (1000 - 42)); |
313 Config::SetDefault ("ns3::TcpSocket::DelAckCount", UintegerValue (1)); | 313 Config::SetDefault ("ns3::TcpSocket::DelAckCount", UintegerValue (1)); |
314 GlobalValue::Bind ("ChecksumEnabled", BooleanValue (false)); | 314 GlobalValue::Bind ("ChecksumEnabled", BooleanValue (false)); |
315 | 315 |
316 uint32_t meanPktSize = 500; | 316 uint32_t meanPktSize = 500; |
317 | 317 |
318 // RED params | 318 // RED params |
319 NS_LOG_INFO ("Set RED params"); | 319 NS_LOG_INFO ("Set RED params"); |
320 Config::SetDefault ("ns3::RedQueueDisc::Mode", StringValue ("QUEUE_MODE_PACKET
S")); | 320 Config::SetDefault ("ns3::RedQueueDisc::Mode", StringValue ("QUEUE_DISC_MODE_P
ACKETS")); |
321 Config::SetDefault ("ns3::RedQueueDisc::MeanPktSize", UintegerValue (meanPktSi
ze)); | 321 Config::SetDefault ("ns3::RedQueueDisc::MeanPktSize", UintegerValue (meanPktSi
ze)); |
322 Config::SetDefault ("ns3::RedQueueDisc::Wait", BooleanValue (true)); | 322 Config::SetDefault ("ns3::RedQueueDisc::Wait", BooleanValue (true)); |
323 Config::SetDefault ("ns3::RedQueueDisc::Gentle", BooleanValue (true)); | 323 Config::SetDefault ("ns3::RedQueueDisc::Gentle", BooleanValue (true)); |
324 Config::SetDefault ("ns3::RedQueueDisc::QW", DoubleValue (0.002)); | 324 Config::SetDefault ("ns3::RedQueueDisc::QW", DoubleValue (0.002)); |
325 Config::SetDefault ("ns3::RedQueueDisc::MinTh", DoubleValue (5)); | 325 Config::SetDefault ("ns3::RedQueueDisc::MinTh", DoubleValue (5)); |
326 Config::SetDefault ("ns3::RedQueueDisc::MaxTh", DoubleValue (15)); | 326 Config::SetDefault ("ns3::RedQueueDisc::MaxTh", DoubleValue (15)); |
327 Config::SetDefault ("ns3::RedQueueDisc::QueueLimit", UintegerValue (1000)); | 327 Config::SetDefault ("ns3::RedQueueDisc::QueueLimit", UintegerValue (1000)); |
328 | 328 |
329 if (redTest == 2) // test like 1, but with ecn | 329 if (redTest == 2) // test like 1, but with ecn |
330 { | 330 { |
331 Config::SetDefault ("ns3::TcpSocketBase::UseEcn", BooleanValue (true)); | 331 Config::SetDefault ("ns3::TcpSocketBase::UseEcn", BooleanValue (true)); |
| 332 Config::SetDefault ("ns3::RedQueueDisc::UseEcn", BooleanValue (true)); |
332 } | 333 } |
333 else if (redTest == 3) // test like 1, but with bad params | 334 else if (redTest == 3) // test like 1, but with bad params |
334 { | 335 { |
335 Config::SetDefault ("ns3::RedQueueDisc::MaxTh", DoubleValue (10)); | 336 Config::SetDefault ("ns3::RedQueueDisc::MaxTh", DoubleValue (10)); |
336 Config::SetDefault ("ns3::RedQueueDisc::QW", DoubleValue (0.003)); | 337 Config::SetDefault ("ns3::RedQueueDisc::QW", DoubleValue (0.003)); |
337 } | 338 } |
338 else if (redTest == 5) // test 5, same of test 4, but in byte mode | 339 else if (redTest == 5) // test 5, same of test 4, but in byte mode |
339 { | 340 { |
340 Config::SetDefault ("ns3::RedQueueDisc::Mode", StringValue ("QUEUE_MODE_BY
TES")); | 341 Config::SetDefault ("ns3::RedQueueDisc::Mode", StringValue ("QUEUE_DISC_MO
DE_BYTES")); |
341 Config::SetDefault ("ns3::RedQueueDisc::Ns1Compat", BooleanValue (true)); | 342 Config::SetDefault ("ns3::RedQueueDisc::Ns1Compat", BooleanValue (true)); |
342 Config::SetDefault ("ns3::RedQueueDisc::MinTh", DoubleValue (5 * meanPktSi
ze)); | 343 Config::SetDefault ("ns3::RedQueueDisc::MinTh", DoubleValue (5 * meanPktSi
ze)); |
343 Config::SetDefault ("ns3::RedQueueDisc::MaxTh", DoubleValue (15 * meanPktS
ize)); | 344 Config::SetDefault ("ns3::RedQueueDisc::MaxTh", DoubleValue (15 * meanPktS
ize)); |
344 Config::SetDefault ("ns3::RedQueueDisc::QueueLimit", UintegerValue (1000 *
meanPktSize)); | 345 Config::SetDefault ("ns3::RedQueueDisc::QueueLimit", UintegerValue (1000 *
meanPktSize)); |
345 } | 346 } |
346 | 347 |
347 NS_LOG_INFO ("Install internet stack on all nodes."); | 348 NS_LOG_INFO ("Install internet stack on all nodes."); |
348 InternetStackHelper internet; | 349 InternetStackHelper internet; |
349 internet.Install (c); | 350 internet.Install (c); |
350 | 351 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 i3i5 = ipv4.Assign (devn3n5); | 410 i3i5 = ipv4.Assign (devn3n5); |
410 | 411 |
411 // Set up the routing | 412 // Set up the routing |
412 Ipv4GlobalRoutingHelper::PopulateRoutingTables (); | 413 Ipv4GlobalRoutingHelper::PopulateRoutingTables (); |
413 | 414 |
414 if (redTest == 5)· | 415 if (redTest == 5)· |
415 { | 416 { |
416 // like in ns2 test, r2 -> r1, have a queue in packet mode | 417 // like in ns2 test, r2 -> r1, have a queue in packet mode |
417 Ptr<QueueDisc> queue = queueDiscs.Get (1); | 418 Ptr<QueueDisc> queue = queueDiscs.Get (1); |
418 | 419 |
419 StaticCast<RedQueueDisc> (queue)->SetMode (Queue::QUEUE_MODE_PACKETS); | 420 StaticCast<RedQueueDisc> (queue)->SetMode (RedQueueDisc::QUEUE_DISC_MODE_P
ACKETS); |
420 StaticCast<RedQueueDisc> (queue)->SetTh (5, 15); | 421 StaticCast<RedQueueDisc> (queue)->SetTh (5, 15); |
421 StaticCast<RedQueueDisc> (queue)->SetQueueLimit (1000); | 422 StaticCast<RedQueueDisc> (queue)->SetQueueLimit (1000); |
422 } | 423 } |
423 | 424 |
424 BuildAppsTest (redTest); | 425 BuildAppsTest (redTest); |
425 | 426 |
426 if (writePcap) | 427 if (writePcap) |
427 { | 428 { |
428 PointToPointHelper ptp; | 429 PointToPointHelper ptp; |
429 std::stringstream stmp; | 430 std::stringstream stmp; |
(...skipping 30 matching lines...) Expand all Loading... |
460 flowmon->SerializeToXmlFile (stmp.str ().c_str (), false, false); | 461 flowmon->SerializeToXmlFile (stmp.str ().c_str (), false, false); |
461 } | 462 } |
462 | 463 |
463 if (printRedStats) | 464 if (printRedStats) |
464 { | 465 { |
465 RedQueueDisc::Stats st = StaticCast<RedQueueDisc> (queueDiscs.Get (0))->Ge
tStats (); | 466 RedQueueDisc::Stats st = StaticCast<RedQueueDisc> (queueDiscs.Get (0))->Ge
tStats (); |
466 std::cout << "*** RED stats from Node 2 queue ***" << std::endl; | 467 std::cout << "*** RED stats from Node 2 queue ***" << std::endl; |
467 std::cout << "\t " << st.unforcedDrop << " drops due prob mark" << std::en
dl; | 468 std::cout << "\t " << st.unforcedDrop << " drops due prob mark" << std::en
dl; |
468 std::cout << "\t " << st.unforcedMark << " marks due prob mark" << std::en
dl; | 469 std::cout << "\t " << st.unforcedMark << " marks due prob mark" << std::en
dl; |
469 std::cout << "\t " << st.forcedDrop << " drops due hard mark" << std::endl
; | 470 std::cout << "\t " << st.forcedDrop << " drops due hard mark" << std::endl
; |
| 471 std::cout << "\t " << st.forcedMark << " drops due hard mark" << std::endl
; |
470 std::cout << "\t " << st.qLimDrop << " drops due queue full" << std::endl; | 472 std::cout << "\t " << st.qLimDrop << " drops due queue full" << std::endl; |
471 | 473 |
472 st = StaticCast<RedQueueDisc> (queueDiscs.Get (1))->GetStats (); | 474 st = StaticCast<RedQueueDisc> (queueDiscs.Get (1))->GetStats (); |
473 std::cout << "*** RED stats from Node 3 queue ***" << std::endl; | 475 std::cout << "*** RED stats from Node 3 queue ***" << std::endl; |
474 std::cout << "\t " << st.unforcedDrop << " drops due prob mark" << std::en
dl; | 476 std::cout << "\t " << st.unforcedDrop << " drops due prob mark" << std::en
dl; |
475 std::cout << "\t " << st.unforcedMark << " marks due prob mark" << std::en
dl; | 477 std::cout << "\t " << st.unforcedMark << " marks due prob mark" << std::en
dl; |
476 std::cout << "\t " << st.forcedDrop << " drops due hard mark" << std::endl
; | 478 std::cout << "\t " << st.forcedDrop << " drops due hard mark" << std::endl
; |
| 479 std::cout << "\t " << st.forcedMark << " drops due hard mark" << std::endl
; |
477 std::cout << "\t " << st.qLimDrop << " drops due queue full" << std::endl; | 480 std::cout << "\t " << st.qLimDrop << " drops due queue full" << std::endl; |
478 } | 481 } |
479 | 482 |
480 Simulator::Destroy (); | 483 Simulator::Destroy (); |
481 | 484 |
482 return 0; | 485 return 0; |
483 } | 486 } |
LEFT | RIGHT |