|
42 |
|
42 |
|
43 |
namespace ns3 { |
43 |
namespace ns3 { |
44 |
|
44 |
|
|
|
45 |
/** |
46 |
* Number of bits discarded from the time representation. |
47 |
* The time is assumed to be in nanoseconds. |
48 |
*/ |
45 |
static const int CODEL_SHIFT = 10; |
49 |
static const int CODEL_SHIFT = 10; |
46 |
static const int DEFAULT_CODEL_LIMIT = 1000; |
|
|
47 |
|
50 |
|
|
|
51 |
#define DEFAULT_CODEL_LIMIT 1000 |
48 |
#define REC_INV_SQRT_BITS (8 * sizeof(uint16_t)) |
52 |
#define REC_INV_SQRT_BITS (8 * sizeof(uint16_t)) |
49 |
#define REC_INV_SQRT_SHIFT (32 - REC_INV_SQRT_BITS) |
53 |
#define REC_INV_SQRT_SHIFT (32 - REC_INV_SQRT_BITS) |
50 |
|
54 |
|
|
59 |
class CoDelQueue : public Queue |
63 |
class CoDelQueue : public Queue |
60 |
{ |
64 |
{ |
61 |
public: |
65 |
public: |
|
|
66 |
/** |
67 |
* Get the type ID. |
68 |
* \brief Get the type ID. |
69 |
* \return the object TypeId |
70 |
*/ |
62 |
static TypeId GetTypeId (void); |
71 |
static TypeId GetTypeId (void); |
63 |
|
72 |
|
64 |
/** |
73 |
/** |
|
179 |
*/ |
188 |
*/ |
180 |
bool OkToDrop (Ptr<Packet> p, uint32_t now); |
189 |
bool OkToDrop (Ptr<Packet> p, uint32_t now); |
181 |
|
190 |
|
|
|
191 |
/** |
192 |
* Check if CoDel time a is successive to b |
193 |
* @param a left operand |
194 |
* @param b right operand |
195 |
* @return true if a is greater than b |
196 |
*/ |
182 |
bool CoDelTimeAfter (uint32_t a, uint32_t b); |
197 |
bool CoDelTimeAfter (uint32_t a, uint32_t b); |
|
|
198 |
/** |
199 |
* Check if CoDel time a is successive or equal to b |
200 |
* @param a left operand |
201 |
* @param b right operand |
202 |
* @return true if a is greater than or equal to b |
203 |
*/ |
183 |
bool CoDelTimeAfterEq (uint32_t a, uint32_t b); |
204 |
bool CoDelTimeAfterEq (uint32_t a, uint32_t b); |
|
|
205 |
/** |
206 |
* Check if CoDel time a is preceding b |
207 |
* @param a left operand |
208 |
* @param b right operand |
209 |
* @return true if a is less than to b |
210 |
*/ |
184 |
bool CoDelTimeBefore (uint32_t a, uint32_t b); |
211 |
bool CoDelTimeBefore (uint32_t a, uint32_t b); |
|
|
212 |
/** |
213 |
* Check if CoDel time a is preceding or equal to b |
214 |
* @param a left operand |
215 |
* @param b right operand |
216 |
* @return true if a is less than or equal to b |
217 |
*/ |
185 |
bool CoDelTimeBeforeEq (uint32_t a, uint32_t b); |
218 |
bool CoDelTimeBeforeEq (uint32_t a, uint32_t b); |
186 |
|
219 |
|
187 |
/** |
220 |
/** |
|
199 |
Time m_target; //!< 5 ms target queue delay |
232 |
Time m_target; //!< 5 ms target queue delay |
200 |
TracedValue<uint32_t> m_count; //!< Number of packets dropped since entering drop state |
233 |
TracedValue<uint32_t> m_count; //!< Number of packets dropped since entering drop state |
201 |
TracedValue<uint32_t> m_dropCount; //!< Number of dropped packets according CoDel algorithm |
234 |
TracedValue<uint32_t> m_dropCount; //!< Number of dropped packets according CoDel algorithm |
202 |
TracedValue<uint32_t> m_lastCount; //<! Last number of packets dropped since entering drop state |
235 |
TracedValue<uint32_t> m_lastCount; //!< Last number of packets dropped since entering drop state |
203 |
TracedValue<bool> m_dropping; //!< True if in dropping state |
236 |
TracedValue<bool> m_dropping; //!< True if in dropping state |
204 |
uint16_t m_recInvSqrt; //!< Reciprocal inverse square root |
237 |
uint16_t m_recInvSqrt; //!< Reciprocal inverse square root |
205 |
uint32_t m_firstAboveTime; //!< Time to declare sojourn time above target |
238 |
uint32_t m_firstAboveTime; //!< Time to declare sojourn time above target |