A Discrete-Event Network Simulator
API
cobalt-queue-disc.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2019 NITK Surathkal
4  *
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
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Cobalt, the CoDel - BLUE - Alternate Queueing discipline
19  * Based on linux code.
20  *
21  * Ported to ns-3 by: Vignesh Kannan <vignesh2496@gmail.com>
22  * Harsh Lara <harshapplefan@gmail.com>
23  * Jendaipou Palmei <jendaipoupalmei@gmail.com>
24  * Shefali Gupta <shefaligups11@gmail.com>
25  * Mohit P. Tahiliani <tahiliani@nitk.edu.in>
26  */
27 
28 #include "ns3/log.h"
29 #include "ns3/enum.h"
30 #include "ns3/uinteger.h"
31 #include "ns3/abort.h"
32 #include "cobalt-queue-disc.h"
33 #include "ns3/object-factory.h"
34 #include "ns3/drop-tail-queue.h"
35 #include "ns3/net-device-queue-interface.h"
36 #include <climits>
37 
38 
39 namespace ns3 {
40 
41 NS_LOG_COMPONENT_DEFINE ("CobaltQueueDisc");
42 
43 NS_OBJECT_ENSURE_REGISTERED (CobaltQueueDisc);
44 
46 {
47  static TypeId tid = TypeId ("ns3::CobaltQueueDisc")
48  .SetParent<QueueDisc> ()
49  .SetGroupName ("TrafficControl")
50  .AddConstructor<CobaltQueueDisc> ()
51  .AddAttribute ("MaxSize",
52  "The maximum number of packets/bytes accepted by this queue disc.",
57  .AddAttribute ("Interval",
58  "The Cobalt algorithm interval",
59  StringValue ("100ms"),
61  MakeTimeChecker ())
62  .AddAttribute ("Target",
63  "The Cobalt algorithm target queue delay",
64  StringValue ("5ms"),
66  MakeTimeChecker ())
67  .AddAttribute ("UseEcn",
68  "True to use ECN (packets are marked instead of being dropped)",
69  BooleanValue (false),
72  .AddAttribute ("Pdrop",
73  "Marking Probability",
74  DoubleValue (0),
76  MakeDoubleChecker<double> ())
77  .AddAttribute ("Increment",
78  "Pdrop increment value",
79  DoubleValue (1. / 256),
81  MakeDoubleChecker<double> ())
82  .AddAttribute ("Decrement",
83  "Pdrop decrement Value",
84  DoubleValue (1. / 4096),
86  MakeDoubleChecker<double> ())
87  .AddAttribute ("CeThreshold",
88  "The CoDel CE threshold for marking packets",
89  TimeValue (Time::Max ()),
91  MakeTimeChecker ())
92  .AddAttribute ("UseL4s",
93  "True to use L4S (only ECT1 packets are marked at CE threshold)",
94  BooleanValue (false),
97  .AddAttribute ("BlueThreshold",
98  "The Threshold after which Blue is enabled",
99  TimeValue (MilliSeconds (400)),
101  MakeTimeChecker ())
102  .AddTraceSource ("Count",
103  "Cobalt count",
105  "ns3::TracedValueCallback::Uint32")
106  .AddTraceSource ("DropState",
107  "Dropping state",
109  "ns3::TracedValueCallback::Bool")
110  .AddTraceSource ("DropNext",
111  "Time until next packet drop",
113  "ns3::TracedValueCallback::Uint32")
114  ;
115 
116  return tid;
117 }
118 
126 /* borrowed from the linux kernel */
127 static inline uint32_t ReciprocalDivide (uint32_t A, uint32_t R)
128 {
129  return (uint32_t)(((uint64_t)A * R) >> 32);
130 }
131 
132 double min (double x, double y)
133 {
134  return (x < y) ? x : y;
135 }
136 
137 double max (double x, double y)
138 {
139  return (x > y) ? x : y;
140 }
141 
146 static int64_t CoDelGetTime (void)
147 {
148  Time time = Simulator::Now ();
149  int64_t ns = time.GetNanoSeconds ();
150 
151  return ns;
152 }
153 
155  : QueueDisc ()
156 {
157  NS_LOG_FUNCTION (this);
158  InitializeParams ();
159  m_uv = CreateObject<UniformRandomVariable> ();
160 }
161 
163 {
164  return m_pDrop;
165 }
166 
168 {
169  NS_LOG_FUNCTION (this);
170 }
171 
172 int64_t
174 {
175  NS_LOG_FUNCTION (this << stream);
176  m_uv->SetStream (stream);
177  return 1;
178 }
179 
180 void
182 {
183  // Cobalt parameters
184  NS_LOG_FUNCTION (this);
185  m_recInvSqrtCache[0] = ~0;
186  CacheInit ();
187  m_count = 0;
188  m_dropping = false;
189  m_recInvSqrt = ~0U;
191  m_dropNext = 0;
192 }
193 
194 bool
195 CobaltQueueDisc::CoDelTimeAfter (int64_t a, int64_t b)
196 {
197  return ((int64_t)(a) - (int64_t)(b) > 0);
198 }
199 
200 bool
201 CobaltQueueDisc::CoDelTimeAfterEq (int64_t a, int64_t b)
202 {
203  return ((int64_t)(a) - (int64_t)(b) >= 0);
204 }
205 
206 int64_t
208 {
209  return (t.GetNanoSeconds ());
210 }
211 
212 Time
214 {
215  return m_target;
216 }
217 
218 Time
220 {
221  return m_interval;
222 }
223 
224 int64_t
226 {
227  return m_dropNext;
228 }
229 
230 void
232 {
233  NS_LOG_FUNCTION (this);
234  uint32_t invsqrt = ((uint32_t) m_recInvSqrt);
235  uint32_t invsqrt2 = ((uint64_t) invsqrt * invsqrt) >> 32;
236  uint64_t val = (3ll << 32) - ((uint64_t) m_count * invsqrt2);
237 
238  val >>= 2; /* avoid overflow */
239  val = (val * invsqrt) >> (32 - 2 + 1);
240  m_recInvSqrt = val;
241 }
242 
243 void
245 {
246  m_recInvSqrt = ~0U;
248 
249  for (m_count = 1; m_count < (uint32_t)(REC_INV_SQRT_CACHE); m_count++)
250  {
251  NewtonStep ();
252  NewtonStep ();
253  NewtonStep ();
254  NewtonStep ();
256  }
257 }
258 
259 void
261 {
262  if (m_count < (uint32_t)REC_INV_SQRT_CACHE)
263  {
265  }
266  else
267  {
268  NewtonStep ();
269  }
270 }
271 
272 int64_t
274 {
275  NS_LOG_FUNCTION (this);
277 }
278 
279 void
281 {
282  NS_LOG_FUNCTION (this);
283  m_uv = 0;
285 }
286 
289 {
290  NS_LOG_FUNCTION (this);
291  if (GetInternalQueue (0)->IsEmpty ())
292  {
293  NS_LOG_LOGIC ("Queue empty");
294  return 0;
295  }
296 
297  Ptr<const QueueDiscItem> item = GetInternalQueue (0)->Peek ();
298 
299  NS_LOG_LOGIC ("Number packets " << GetInternalQueue (0)->GetNPackets ());
300  NS_LOG_LOGIC ("Number bytes " << GetInternalQueue (0)->GetNBytes ());
301 
302  return item;
303 }
304 
305 bool
307 {
308  NS_LOG_FUNCTION (this);
309  if (GetNQueueDiscClasses () > 0)
310  {
311  NS_LOG_ERROR ("CobaltQueueDisc cannot have classes");
312  return false;
313  }
314 
315  if (GetNPacketFilters () > 0)
316  {
317  NS_LOG_ERROR ("CobaltQueueDisc cannot have packet filters");
318  return false;
319  }
320 
321  if (GetNInternalQueues () == 0)
322  {
323 
325  ("MaxSize", QueueSizeValue (GetMaxSize ())));
326  }
327 
328 
329  if (GetNInternalQueues () != 1)
330  {
331  NS_LOG_ERROR ("CobaltQueueDisc needs 1 internal queue");
332  return false;
333  }
334  return true;
335 }
336 
337 bool
339 {
340  NS_LOG_FUNCTION (this << item);
341  Ptr<Packet> p = item->GetPacket ();
342  if (GetCurrentSize () + item > GetMaxSize ())
343  {
344  NS_LOG_LOGIC ("Queue full -- dropping pkt");
345  int64_t now = CoDelGetTime ();
346  // Call this to update Blue's drop probability
347  CobaltQueueFull (now);
349  return false;
350  }
351 
352  bool retval = GetInternalQueue (0)->Enqueue (item);
353 
354  // If Queue::Enqueue fails, QueueDisc::Drop is called by the internal queue
355  // because QueueDisc::AddInternalQueue sets the drop callback
356 
357  NS_LOG_LOGIC ("Number packets " << GetInternalQueue (0)->GetNPackets ());
358  NS_LOG_LOGIC ("Number bytes " << GetInternalQueue (0)->GetNBytes ());
359 
360  return retval;
361 }
362 
365 {
366  NS_LOG_FUNCTION (this);
367 
368  while (1)
369  {
370  Ptr<QueueDiscItem> item = GetInternalQueue (0)->Dequeue ();
371  if (!item)
372  {
373  // Leave dropping state when queue is empty (derived from Codel)
374  m_dropping = false;
375  NS_LOG_LOGIC ("Queue empty");
376  int64_t now = CoDelGetTime ();
377  // Call this to update Blue's drop probability
378  CobaltQueueEmpty (now);
379  return 0;
380  }
381 
382  int64_t now = CoDelGetTime ();
383 
384  NS_LOG_LOGIC ("Popped " << item);
385  NS_LOG_LOGIC ("Number packets remaining " << GetInternalQueue (0)->GetNPackets ());
386  NS_LOG_LOGIC ("Number bytes remaining " << GetInternalQueue (0)->GetNBytes ());
387 
388  // Determine if item should be dropped
389  // ECN marking happens inside this function, so it need not be done here
390  bool drop = CobaltShouldDrop (item, now);
391 
392  if (drop)
393  {
395  }
396  else
397  {
398  return item;
399  }
400  }
401 }
402 
403 // Call this when a packet had to be dropped due to queue overflow.
405 {
406  NS_LOG_FUNCTION (this);
407  NS_LOG_LOGIC ("Outside IF block");
409  {
410  NS_LOG_LOGIC ("inside IF block");
411  m_pDrop = min (m_pDrop + m_increment, (double)1.0);
412  m_lastUpdateTimeBlue = now;
413  }
414  m_dropping = true;
415  m_dropNext = now;
416  if (!m_count)
417  {
418  m_count = 1;
419  }
420 }
421 
422 // Call this when the queue was serviced but turned out to be empty.
424 {
425  NS_LOG_FUNCTION (this);
427  {
428  m_pDrop = max (m_pDrop - m_decrement, (double)0.0);
429  m_lastUpdateTimeBlue = now;
430  }
431  m_dropping = false;
432 
433  if (m_count && CoDelTimeAfterEq ((now - m_dropNext), 0))
434  {
435  m_count--;
436  InvSqrt ();
438  }
439 }
440 
441 // Determines if Cobalt should drop the packet
443 {
444  NS_LOG_FUNCTION (this);
445  bool drop = false;
446 
447  /* Simplified Codel implementation */
448  Time delta = Simulator::Now () - item->GetTimeStamp ();
449  NS_LOG_INFO ("Sojourn time " << delta.As (Time::S));
450  int64_t sojournTime = Time2CoDel (delta);
451  int64_t schedule = now - m_dropNext;
452  bool over_target = CoDelTimeAfter (sojournTime, Time2CoDel (m_target));
453  bool next_due = m_count && schedule >= 0;
454  bool isMarked = false;
455 
456  // If L4S mode is enabled then check if the packet is ECT1 or CE and
457  // if sojourn time is greater than CE threshold then the packet is marked.
458  // If packet is marked succesfully then the CoDel steps can be skipped.
459  if (item && m_useL4s)
460  {
461  uint8_t tosByte = 0;
462  if (item->GetUint8Value (QueueItem::IP_DSFIELD, tosByte) && (((tosByte & 0x3) == 1) || (tosByte & 0x3) == 3))
463  {
464  if ((tosByte & 0x3) == 1)
465  {
466  NS_LOG_DEBUG ("ECT1 packet " << static_cast<uint16_t> (tosByte & 0x3));
467  }
468  else
469  {
470  NS_LOG_DEBUG ("CE packet " << static_cast<uint16_t> (tosByte & 0x3));
471  }
473  {
474  NS_LOG_LOGIC ("Marking due to CeThreshold " << m_ceThreshold.GetSeconds ());
475  }
476  return false;
477  }
478  }
479 
480  if (over_target)
481  {
482  if (!m_dropping)
483  {
484  m_dropping = true;
485  m_dropNext = ControlLaw (now);
486  }
487  if (!m_count)
488  {
489  m_count = 1;
490  }
491  }
492  else if (m_dropping)
493  {
494  m_dropping = false;
495  }
496 
497  if (next_due && m_dropping)
498  {
499  /* Check for marking possibility only if BLUE decides NOT to drop. */
500  /* Check if router and packet, both have ECN enabled. Only if this is true, mark the packet. */
501  isMarked = (m_useEcn && Mark (item, FORCED_MARK));
502  drop = !isMarked;
503 
504  m_count = max (m_count, m_count + 1);
505 
506  InvSqrt ();
508  schedule = now - m_dropNext;
509  }
510  else
511  {
512  while (next_due)
513  {
514  m_count--;
515  InvSqrt ();
517  schedule = now - m_dropNext;
518  next_due = m_count && schedule >= 0;
519  }
520  }
521 
522  // If CE threshold is enabled then isMarked flag is used to determine whether
523  // packet is marked and if the packet is marked then a second attempt at marking should be suppressed.
524  // If UseL4S attribute is enabled then ECT0 packets should not be marked.
525  if (!isMarked && !m_useL4s && m_useEcn && CoDelTimeAfter (sojournTime, Time2CoDel (m_ceThreshold)) && Mark (item, CE_THRESHOLD_EXCEEDED_MARK))
526  {
527  NS_LOG_LOGIC ("Marking due to CeThreshold " << m_ceThreshold.GetSeconds ());
528  }
529 
530  // Enable Blue Enhancement if sojourn time is greater than blueThreshold and its been m_target time until the last time blue was updated
532  {
533  m_pDrop = min (m_pDrop + m_increment, (double)1.0);
534  m_lastUpdateTimeBlue = now;
535  }
536 
537  /* Simple BLUE implementation. Lack of ECN is deliberate. */
538  if (m_pDrop)
539  {
540  double u = m_uv->GetValue ();
541  drop = drop | (u < m_pDrop);
542  }
543 
544  /* Overload the drop_next field as an activity timeout */
545  if (!m_count)
546  {
547  m_dropNext = now + Time2CoDel (m_interval);
548  }
549  else if (schedule > 0 && !drop)
550  {
551  m_dropNext = now;
552  }
553 
554  return drop;
555 }
556 
557 } // namespace ns3
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
DEFAULT_COBALT_LIMIT
#define DEFAULT_COBALT_LIMIT
Definition: cobalt-queue-disc.h:45
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
ns3::CobaltQueueDisc::GetPdrop
double GetPdrop() const
Get the drop probability of Blue.
Definition: cobalt-queue-disc.cc:162
ns3::MakeTimeChecker
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition: time.cc:533
ns3::CobaltQueueDisc::m_blueThreshold
Time m_blueThreshold
Threshold to enable blue enhancement.
Definition: cobalt-queue-disc.h:237
ns3::BooleanValue
AttributeValue implementation for Boolean.
Definition: boolean.h:37
ns3::CobaltQueueDisc::m_uv
Ptr< UniformRandomVariable > m_uv
Rng stream.
Definition: cobalt-queue-disc.h:241
ns3::Simulator::Now
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:195
ns3::QueueDisc::SetMaxSize
bool SetMaxSize(QueueSize size)
Set the maximum size of the queue disc.
Definition: queue-disc.cc:482
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::CobaltQueueDisc::CacheInit
void CacheInit(void)
There is a big difference in timing between the accurate values placed in the cache and the approxima...
Definition: cobalt-queue-disc.cc:244
ns3::CobaltQueueDisc::DoDispose
virtual void DoDispose(void)
Dispose of the object.
Definition: cobalt-queue-disc.cc:280
ns3::CobaltQueueDisc::FORCED_MARK
static constexpr const char * FORCED_MARK
forced marks by Codel on ECN-enabled
Definition: cobalt-queue-disc.h:105
ns3::CobaltQueueDisc::m_decrement
double m_decrement
decrement value for marking probability
Definition: cobalt-queue-disc.h:246
ns3::QueueDisc
QueueDisc is an abstract base class providing the interface and implementing the operations common to...
Definition: queue-disc.h:181
ns3::QueueDisc::GetMaxSize
QueueSize GetMaxSize(void) const
Get the maximum size of the queue disc.
Definition: queue-disc.cc:454
ns3::CobaltQueueDisc::m_useL4s
bool m_useL4s
True if L4S is used (ECT1 packets are marked at CE threshold)
Definition: cobalt-queue-disc.h:236
ns3::CobaltQueueDisc::DoDequeue
virtual Ptr< QueueDiscItem > DoDequeue(void)
This function actually extracts a packet from the queue disc.
Definition: cobalt-queue-disc.cc:364
ns3::MakeQueueSizeChecker
Ptr< const AttributeChecker > MakeQueueSizeChecker(void)
Definition: queue-size.cc:29
ns3::CobaltQueueDisc::DoPeek
virtual Ptr< const QueueDiscItem > DoPeek(void)
Return a copy of the next packet the queue disc will extract.
Definition: cobalt-queue-disc.cc:288
ns3::CobaltQueueDisc::m_target
Time m_target
target queue delay
Definition: cobalt-queue-disc.h:233
ns3::CobaltQueueDisc::GetTarget
Time GetTarget(void) const
Get the target queue delay.
Definition: cobalt-queue-disc.cc:213
ns3::CobaltQueueDisc::InitializeParams
virtual void InitializeParams(void)
Initialize the queue parameters.
Definition: cobalt-queue-disc.cc:181
ns3::QueueDisc::GetNBytes
uint32_t GetNBytes(void) const
Get the amount of bytes stored by the queue disc.
Definition: queue-disc.cc:447
ns3::Time::As
TimeWithUnit As(const enum Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Definition: time.cc:429
ns3::MakeBooleanAccessor
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: boolean.h:85
ns3::QueueDisc::GetNPacketFilters
std::size_t GetNPacketFilters(void) const
Get the number of packet filters.
Definition: queue-disc.cc:628
ns3::CobaltQueueDisc::m_interval
Time m_interval
sliding minimum time window width
Definition: cobalt-queue-disc.h:232
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923
ns3::DoubleValue
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:41
ns3::QueueDisc::Mark
bool Mark(Ptr< QueueDiscItem > item, const char *reason)
Marks the given packet and, if successful, updates the counters associated with the given reason.
Definition: queue-disc.cc:818
ns3::MakeTraceSourceAccessor
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Definition: trace-source-accessor.h:202
ns3::QueueSizeValue
Definition: queue-size.h:221
ns3::CobaltQueueDisc::m_lastUpdateTimeBlue
uint32_t m_lastUpdateTimeBlue
Blue's last update time for drop probability.
Definition: cobalt-queue-disc.h:242
ns3::CobaltQueueDisc::Time2CoDel
int64_t Time2CoDel(Time t) const
Return the unsigned 32-bit integer representation of the input Time object.
Definition: cobalt-queue-disc.cc:207
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
ns3::QueueDisc::DoDispose
virtual void DoDispose(void)
Dispose of the object.
Definition: queue-disc.cc:383
ns3::min
double min(double x, double y)
Definition: cobalt-queue-disc.cc:132
ns3::CobaltQueueDisc::DoEnqueue
virtual bool DoEnqueue(Ptr< QueueDiscItem > item)
This function actually enqueues a packet into the queue disc.
Definition: cobalt-queue-disc.cc:338
ns3::CobaltQueueDisc::CE_THRESHOLD_EXCEEDED_MARK
static constexpr const char * CE_THRESHOLD_EXCEEDED_MARK
Sojourn time above CE threshold.
Definition: cobalt-queue-disc.h:106
ns3::ReciprocalDivide
static uint32_t ReciprocalDivide(uint32_t A, uint32_t R)
Performs a reciprocal divide, similar to the Linux kernel reciprocal_divide function.
Definition: cobalt-queue-disc.cc:127
ns3::CobaltQueueDisc::m_recInvSqrt
uint32_t m_recInvSqrt
Reciprocal inverse square root.
Definition: cobalt-queue-disc.h:228
ns3::CobaltQueueDisc::m_pDrop
double m_pDrop
Drop Probability.
Definition: cobalt-queue-disc.h:247
ns3::CobaltQueueDisc::CobaltShouldDrop
bool CobaltShouldDrop(Ptr< QueueDiscItem > item, int64_t now)
Called to decide whether the current packet should be dropped based on decisions taken by Blue and Co...
Definition: cobalt-queue-disc.cc:442
ns3::CobaltQueueDisc::m_dropping
TracedValue< bool > m_dropping
True if in dropping state.
Definition: cobalt-queue-disc.h:227
ns3::CobaltQueueDisc::InvSqrt
void InvSqrt(void)
Definition: cobalt-queue-disc.cc:260
NS_LOG_INFO
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:281
ns3::CobaltQueueDisc::GetDropNext
int64_t GetDropNext(void) const
Get the time for next packet drop while in the dropping state.
Definition: cobalt-queue-disc.cc:225
ns3::MilliSeconds
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1297
ns3::CobaltQueueDisc::CobaltQueueEmpty
void CobaltQueueEmpty(int64_t now)
Called when the queue becomes empty to alter the drop probabilities of Blue.
Definition: cobalt-queue-disc.cc:423
ns3::Time::Max
static Time Max()
Maximum representable Time Not to be confused with Max(Time,Time).
Definition: nstime.h:283
ns3::CobaltQueueDisc::CoDelTimeAfter
bool CoDelTimeAfter(int64_t a, int64_t b)
Check if CoDel time a is successive to b.
Definition: cobalt-queue-disc.cc:195
ns3::CobaltQueueDisc::CobaltQueueFull
void CobaltQueueFull(int64_t now)
Called when the queue becomes full to alter the drop probabilities of Blue.
Definition: cobalt-queue-disc.cc:404
ns3::MakeBooleanChecker
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Definition: boolean.cc:121
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
ns3::QueueDisc::AddInternalQueue
void AddInternalQueue(Ptr< InternalQueue > queue)
Add an internal queue to the tail of the list of queues.
Definition: queue-disc.cc:581
ns3::QueueItem::IP_DSFIELD
@ IP_DSFIELD
Definition: queue-item.h:78
ns3::QueueDisc::GetNInternalQueues
std::size_t GetNInternalQueues(void) const
Get the number of internal queues.
Definition: queue-disc.cc:608
ns3::QueueDisc::GetCurrentSize
QueueSize GetCurrentSize(void)
Get the current size of the queue disc in bytes, if operating in bytes mode, or packets,...
Definition: queue-disc.cc:523
ns3::Time::GetNanoSeconds
int64_t GetNanoSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:392
ns3::CobaltQueueDisc
Cobalt packet queue disc.
Definition: cobalt-queue-disc.h:60
DropTailQueue< QueueDiscItem >
Introspection did not find any typical Config paths.
ns3::CreateObjectWithAttributes
Ptr< T > CreateObjectWithAttributes(Args... args)
Allocate an Object on the heap and initialize with a set of attributes.
Definition: object-factory.h:231
NS_LOG_LOGIC
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:289
ns3::StringValue
Hold variables of type string.
Definition: string.h:41
ns3::MakeDoubleAccessor
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: double.h:42
NS_LOG_ERROR
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
Definition: log.h:257
ns3::CobaltQueueDisc::CheckConfig
virtual bool CheckConfig(void)
Check whether the current configuration is correct.
Definition: cobalt-queue-disc.cc:306
ns3::QueueDisc::GetNPackets
uint32_t GetNPackets(void) const
Get the number of packets stored by the queue disc.
Definition: queue-disc.cc:440
ns3::CobaltQueueDisc::~CobaltQueueDisc
virtual ~CobaltQueueDisc()
Destructor.
Definition: cobalt-queue-disc.cc:167
ns3::CobaltQueueDisc::ControlLaw
int64_t ControlLaw(int64_t t)
Determine the time for next drop CoDel control law is t + m_interval/sqrt(m_count).
Definition: cobalt-queue-disc.cc:273
NS_LOG_DEBUG
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
ns3::CobaltQueueDisc::AssignStreams
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: cobalt-queue-disc.cc:173
ns3::QueueDisc::DropAfterDequeue
void DropAfterDequeue(Ptr< const QueueDiscItem > item, const char *reason)
Perform the actions required when the queue disc is notified of a packet dropped after dequeue.
Definition: queue-disc.cc:768
ns3::Time::S
@ S
second
Definition: nstime.h:115
ns3::CoDelGetTime
static int64_t CoDelGetTime(void)
Returns the current time translated in CoDel time representation.
Definition: cobalt-queue-disc.cc:146
ns3::BYTES
@ BYTES
Use number of bytes for queue size.
Definition: queue-size.h:45
ns3::TimeValue
AttributeValue implementation for Time.
Definition: nstime.h:1353
sample-rng-plot.x
list x
Definition: sample-rng-plot.py:34
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition: log-macros-enabled.h:244
ns3::CobaltQueueDisc::CobaltQueueDisc
CobaltQueueDisc()
CobaltQueueDisc Constructor.
Definition: cobalt-queue-disc.cc:154
ns3::CobaltQueueDisc::m_count
TracedValue< uint32_t > m_count
Number of packets dropped since entering drop state.
Definition: cobalt-queue-disc.h:225
ns3::CobaltQueueDisc::m_dropNext
TracedValue< int64_t > m_dropNext
Time to drop next packet.
Definition: cobalt-queue-disc.h:226
REC_INV_SQRT_CACHE
#define REC_INV_SQRT_CACHE
Definition: cobalt-queue-disc.h:44
ns3::CobaltQueueDisc::OVERLIMIT_DROP
static constexpr const char * OVERLIMIT_DROP
Overlimit dropped packet.
Definition: cobalt-queue-disc.h:104
ns3::CobaltQueueDisc::m_recInvSqrtCache
uint32_t m_recInvSqrtCache[REC_INV_SQRT_CACHE]
Cache to maintain some initial values of InvSqrt.
Definition: cobalt-queue-disc.h:229
ns3::MakeQueueSizeAccessor
Ptr< const AttributeAccessor > MakeQueueSizeAccessor(T1 a1)
Definition: queue-size.h:221
ns3::CobaltQueueDisc::m_useEcn
bool m_useEcn
True if ECN is used (packets are marked instead of being dropped)
Definition: cobalt-queue-disc.h:234
ns3::RandomVariableStream::SetStream
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
Definition: random-variable-stream.cc:100
cobalt-queue-disc.h
ns3::max
double max(double x, double y)
Definition: cobalt-queue-disc.cc:137
ns3::QueueDisc::GetNQueueDiscClasses
std::size_t GetNQueueDiscClasses(void) const
Get the number of queue disc classes.
Definition: queue-disc.cc:669
ns3::QueueDisc::DropBeforeEnqueue
void DropBeforeEnqueue(Ptr< const QueueDiscItem > item, const char *reason)
Perform the actions required when the queue disc is notified of a packet dropped before enqueue.
Definition: queue-disc.cc:729
ns3::QueueDisc::GetInternalQueue
Ptr< InternalQueue > GetInternalQueue(std::size_t i) const
Get the i-th internal queue.
Definition: queue-disc.cc:601
ns3::CobaltQueueDisc::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: cobalt-queue-disc.cc:45
ns3::QueueSize
Class for representing queue sizes.
Definition: queue-size.h:95
ns3::CobaltQueueDisc::CoDelTimeAfterEq
bool CoDelTimeAfterEq(int64_t a, int64_t b)
Check if CoDel time a is successive or equal to b.
Definition: cobalt-queue-disc.cc:201
ns3::UniformRandomVariable::GetValue
double GetValue(double min, double max)
Get the next random value, as a double in the specified range .
Definition: random-variable-stream.cc:182
ns3::CobaltQueueDisc::m_increment
double m_increment
increment value for marking probability
Definition: cobalt-queue-disc.h:245
ns3::Time::GetSeconds
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:380
ns3::MakeTimeAccessor
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: nstime.h:1354
ns3::CobaltQueueDisc::GetInterval
Time GetInterval(void) const
Get the interval.
Definition: cobalt-queue-disc.cc:219
ns3::CobaltQueueDisc::TARGET_EXCEEDED_DROP
static constexpr const char * TARGET_EXCEEDED_DROP
Sojourn time above target.
Definition: cobalt-queue-disc.h:103
ns3::CobaltQueueDisc::m_ceThreshold
Time m_ceThreshold
Threshold above which to CE mark.
Definition: cobalt-queue-disc.h:235
ns3::CobaltQueueDisc::NewtonStep
void NewtonStep(void)
Calculate the reciprocal square root of m_count by using Newton's method http://en....
Definition: cobalt-queue-disc.cc:231