32 #include "ns3/packet.h"
33 #include "ns3/queue.h"
34 #include "ns3/nstime.h"
35 #include "ns3/simulator.h"
36 #include "ns3/string.h"
37 #include "ns3/traced-value.h"
38 #include "ns3/trace-source-accessor.h"
48 #define REC_INV_SQRT_BITS (8 * sizeof(uint16_t))
49 #define REC_INV_SQRT_SHIFT (32 - REC_INV_SQRT_BITS)
131 friend class::CoDelQueueNewtonStepTest;
132 friend class::CoDelQueueControlLawTest;
uint32_t GetDropOverLimit(void)
Get the number of packets dropped when packets arrive at a full queue and cannot be enqueued...
bool CoDelTimeAfter(uint32_t a, uint32_t b)
Simulation virtual time values and global simulation resolution.
bool CoDelTimeAfterEq(uint32_t a, uint32_t b)
virtual bool DoEnqueue(Ptr< Packet > p)
Add a packet to the queue.
uint32_t m_state1
Number of times packet sojourn goes above target for interval.
uint32_t m_minBytes
Minimum bytes in queue to allow a packet drop.
std::queue< Ptr< Packet > > m_packets
The packet queue.
TracedValue< uint32_t > m_dropNext
Time to drop next packet.
TracedValue< uint32_t > m_lastCount
TracedValue< bool > m_dropping
True if in dropping state.
uint32_t m_states
Total number of times we are in state 1, state 2, or state 3.
uint32_t GetDropCount(void)
Get the number of packets dropped according to CoDel algorithm.
uint32_t ControlLaw(uint32_t t)
Determine the time for next drop CoDel control law is t + m_interval/sqrt(m_count).
uint32_t m_state2
Number of times we perform next drop while in dropping state.
Abstract base class for packet Queues.
uint16_t m_recInvSqrt
Reciprocal inverse square root.
Time m_interval
100 ms sliding minimum time window width
Time GetTarget(void)
Get the target queue delay.
CoDelQueue::QueueMode GetMode(void)
Get the encapsulation mode of this device.
bool OkToDrop(Ptr< Packet > p, uint32_t now)
Determine whether a packet is OK to be dropped.
uint32_t GetQueueSize(void)
Get the current value of the queue in bytes or packets.
TracedValue< uint32_t > m_dropCount
Number of dropped packets according CoDel algorithm.
bool CoDelTimeBefore(uint32_t a, uint32_t b)
uint32_t m_dropOverLimit
The number of packets dropped due to full queue.
uint32_t m_maxBytes
Max # of bytes accepted by the queue.
CoDelQueue()
CoDelQueue Constructor.
uint32_t m_firstAboveTime
Time to declare sojourn time above target.
Time m_target
5 ms target queue delay
uint32_t m_maxPackets
Max # of packets accepted by the queue.
bool CoDelTimeBeforeEq(uint32_t a, uint32_t b)
uint32_t GetDropNext(void)
Get the time for next packet drop while in the dropping state.
static const int CODEL_SHIFT
static TypeId GetTypeId(void)
QueueMode m_mode
The operating mode (Bytes or packets)
QueueMode
Enumeration of the modes supported in the class.
void NewtonStep(void)
Calculate the reciprocal square root of m_count by using Newton's method http://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Iterative_methods_for_reciprocal_square_roots m_recInvSqrt (new) = (m_recInvSqrt (old) / 2) * (3 - m_count * m_recInvSqrt^2)
void SetMode(CoDelQueue::QueueMode mode)
Set the operating mode of this device.
uint32_t Time2CoDel(Time t)
returned unsigned 32-bit integer representation of the input Time object units are microseconds ...
virtual Ptr< const Packet > DoPeek(void) const
Peek the front packet in the queue.
Time GetInterval(void)
Get the interval.
uint32_t m_state3
Number of times we enter drop state and drop the fist packet.
TracedValue< uint32_t > m_bytesInQueue
The total number of bytes in queue.
static const int DEFAULT_CODEL_LIMIT
TracedValue< uint32_t > m_count
Number of packets dropped since entering drop state.
virtual Ptr< Packet > DoDequeue(void)
Remove a packet from queue based on the current state If we are in dropping state, check if we could leave the dropping state or if we should perform next drop If we are not currently in dropping state, check if we need to enter the state and drop the first packet.
a unique identifier for an interface.
TracedValue< Time > m_sojourn
Time in queue.