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

(-)a/src/internet/model/codel-queue.cc (-2 / +24 lines)
 Lines 35-40    Link Here 
35
35
36
NS_LOG_COMPONENT_DEFINE ("CoDelQueue");
36
NS_LOG_COMPONENT_DEFINE ("CoDelQueue");
37
37
38
/**
39
 * Performs a reciprocal divide, similar to the
40
 * Linux kernel reciprocal_divide function
41
 * \param A numerator
42
 * \param R reciprocal of the denominator B
43
 * \return the value of A/B
44
 */
38
/* borrowed from the linux kernel */
45
/* borrowed from the linux kernel */
39
static inline uint32_t ReciprocalDivide (uint32_t A, uint32_t R)
46
static inline uint32_t ReciprocalDivide (uint32_t A, uint32_t R)
40
{
47
{
 Lines 43-48    Link Here 
43
50
44
/* end kernel borrowings */
51
/* end kernel borrowings */
45
52
53
/**
54
 * Returns the current time translated in CoDel time representation
55
 * \return the current time
56
 */
46
static uint32_t CoDelGetTime (void)
57
static uint32_t CoDelGetTime (void)
47
{
58
{
48
  Time time = Simulator::Now ();
59
  Time time = Simulator::Now ();
 Lines 51-60    Link Here 
51
  return ns >> CODEL_SHIFT;
62
  return ns >> CODEL_SHIFT;
52
}
63
}
53
64
65
/**
66
 * CoDel time stamp, used to carry CoDel time informations.
67
 */
54
class CoDelTimestampTag : public Tag
68
class CoDelTimestampTag : public Tag
55
{
69
{
56
public:
70
public:
57
  CoDelTimestampTag ();
71
  CoDelTimestampTag ();
72
  /**
73
   * \brief Get the type ID.
74
   * \return the object TypeId
75
   */
58
  static TypeId GetTypeId (void);
76
  static TypeId GetTypeId (void);
59
  virtual TypeId GetInstanceTypeId (void) const;
77
  virtual TypeId GetInstanceTypeId (void) const;
60
78
 Lines 63-71    Link Here 
63
  virtual void Deserialize (TagBuffer i);
81
  virtual void Deserialize (TagBuffer i);
64
  virtual void Print (std::ostream &os) const;
82
  virtual void Print (std::ostream &os) const;
65
83
84
  /**
85
   * Gets the Tag creation time
86
   * @return the time object stored in the tag
87
   */
66
  Time GetTxTime (void) const;
88
  Time GetTxTime (void) const;
67
private:
89
private:
68
  uint64_t m_creationTime;
90
  uint64_t m_creationTime; //!< Tag creation time
69
};
91
};
70
92
71
CoDelTimestampTag::CoDelTimestampTag ()
93
CoDelTimestampTag::CoDelTimestampTag ()
 Lines 292-298    Link Here 
292
  NS_LOG_FUNCTION (this);
314
  NS_LOG_FUNCTION (this);
293
  CoDelTimestampTag tag;
315
  CoDelTimestampTag tag;
294
  bool okToDrop;
316
  bool okToDrop;
295
  p->FindFirstMatchingByteTag (tag);
317
296
  bool found = p->RemovePacketTag (tag);
318
  bool found = p->RemovePacketTag (tag);
297
  NS_ASSERT_MSG (found, "found a packet without an input timestamp tag");
319
  NS_ASSERT_MSG (found, "found a packet without an input timestamp tag");
298
  NS_UNUSED (found);    //silence compiler warning
320
  NS_UNUSED (found);    //silence compiler warning
(-)a/src/internet/model/codel-queue.h (-2 / +35 lines)
 Lines 42-50    Link Here 
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
 Lines 59-64    Link Here 
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
  /**
 Lines 179-187    Link Here 
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
  /**
 Lines 199-205    Link Here 
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
(-)a/src/internet/model/tcp-header.h (+7 lines)
 Lines 169-174    Link Here 
169
  /**
169
  /**
170
   * \brief Append an option to the TCP header
170
   * \brief Append an option to the TCP header
171
   * \param option The option to append
171
   * \param option The option to append
172
   * \return true if optionhas been appended, false otherwise
172
   */
173
   */
173
  bool AppendOption (Ptr<TcpOption> option);
174
  bool AppendOption (Ptr<TcpOption> option);
174
175
 Lines 259-264    Link Here 
259
   */
260
   */
260
  bool IsChecksumOk (void) const;
261
  bool IsChecksumOk (void) const;
261
262
263
  /**
264
   * Comparison operator
265
   * \param lhs left operand
266
   * \param rhs right operand
267
   * \return true if the operands are equal
268
   */
262
  friend bool operator== (const TcpHeader &lhs, const TcpHeader &rhs);
269
  friend bool operator== (const TcpHeader &lhs, const TcpHeader &rhs);
263
270
264
private:
271
private:
(-)a/src/internet/model/tcp-socket-base.h (-7 / +7 lines)
 Lines 585-591    Link Here 
585
   *
585
   *
586
   * Calculate our factor from the rxBuffer max size
586
   * Calculate our factor from the rxBuffer max size
587
   *
587
   *
588
   * \param header TcpHeader where the method should add the window scale option
588
   * \returns the Window Scale factor
589
   */
589
   */
590
  uint8_t CalculateWScale () const;
590
  uint8_t CalculateWScale () const;
591
591
 Lines 661-673    Link Here 
661
  TracedValue<uint32_t> m_rWnd;        //!< Flow control window at remote side
661
  TracedValue<uint32_t> m_rWnd;        //!< Flow control window at remote side
662
662
663
  // Options
663
  // Options
664
  bool    m_winScalingEnabled;
664
  bool    m_winScalingEnabled;    //!< Window Scale option enabled
665
  uint8_t m_sndScaleFactor;
665
  uint8_t m_sndScaleFactor;       //!< Sent Window Scale (i.e., the one of the node)
666
  uint8_t m_rcvScaleFactor;
666
  uint8_t m_rcvScaleFactor;       //!< Received Window Scale (i.e., the one of the peer)
667
667
668
  bool     m_timestampEnabled;
668
  bool     m_timestampEnabled;    //!< Timestamp option enabled
669
  uint32_t m_timestampToEcho;
669
  uint32_t m_timestampToEcho;     //!< Timestamp to echo
670
  uint32_t m_lastEchoedTime;
670
  uint32_t m_lastEchoedTime;      //!< Last echoed timestamp
671
};
671
};
672
672
673
} // namespace ns3
673
} // namespace ns3

Return to bug 938