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

(-)a/src/applications/model/bulk-send-application.cc (-1 / +1 lines)
 Lines 224-230    Link Here 
224
224
225
  if (m_connected)
225
  if (m_connected)
226
    { // Only send new data if the connection has completed
226
    { // Only send new data if the connection has completed
227
      Simulator::ScheduleNow (&BulkSendApplication::SendData, this);
227
      SendData ();
228
    }
228
    }
229
}
229
}
230
230
(-)a/src/internet/model/tcp-newreno.cc (-1 / +10 lines)
 Lines 182-188    Link Here 
182
    { // Increase cwnd for every additional dupack (RFC2582, sec.3 bullet #3)
182
    { // Increase cwnd for every additional dupack (RFC2582, sec.3 bullet #3)
183
      m_cWnd += m_segmentSize;
183
      m_cWnd += m_segmentSize;
184
      NS_LOG_INFO ("Dupack in fast recovery mode. Increase cwnd to " << m_cWnd);
184
      NS_LOG_INFO ("Dupack in fast recovery mode. Increase cwnd to " << m_cWnd);
185
      SendPendingData (m_connected);
185
      if (!m_sendPendingDataEvent.IsRunning ())
186
        {
187
          SendPendingData (m_connected);
188
        }
186
    }
189
    }
187
  else if (!m_inFastRec && m_limitedTx && m_txBuffer->SizeFromSequence (m_nextTxSequence) > 0)
190
  else if (!m_inFastRec && m_limitedTx && m_txBuffer->SizeFromSequence (m_nextTxSequence) > 0)
188
    { // RFC3042 Limited transmit: Send a new packet for each duplicated ACK before fast retransmit
191
    { // RFC3042 Limited transmit: Send a new packet for each duplicated ACK before fast retransmit
 Lines 261-264    Link Here 
261
  m_ssThresh = m_initialSsThresh;
264
  m_ssThresh = m_initialSsThresh;
262
}
265
}
263
266
267
void
268
TcpNewReno::ScaleSsThresh (uint8_t scaleFactor)
269
{
270
  m_ssThresh <<= scaleFactor;
271
}
272
264
} // namespace ns3
273
} // namespace ns3
(-)a/src/internet/model/tcp-newreno.h (+2 lines)
 Lines 69-74    Link Here 
69
  virtual uint32_t GetInitialSSThresh (void) const;
69
  virtual uint32_t GetInitialSSThresh (void) const;
70
  virtual void     SetInitialCwnd (uint32_t cwnd);
70
  virtual void     SetInitialCwnd (uint32_t cwnd);
71
  virtual uint32_t GetInitialCwnd (void) const;
71
  virtual uint32_t GetInitialCwnd (void) const;
72
  virtual void ScaleSsThresh (uint8_t scaleFactor);
73
72
private:
74
private:
73
  /**
75
  /**
74
   * \brief Set the congestion window when connection starts
76
   * \brief Set the congestion window when connection starts
(-)a/src/internet/model/tcp-reno.cc (-1 / +11 lines)
 Lines 164-170    Link Here 
164
    { // In fast recovery, inc cwnd for every additional dupack (RFC2581, sec.3.2)
164
    { // In fast recovery, inc cwnd for every additional dupack (RFC2581, sec.3.2)
165
      m_cWnd += m_segmentSize;
165
      m_cWnd += m_segmentSize;
166
      NS_LOG_INFO ("Increased cwnd to " << m_cWnd);
166
      NS_LOG_INFO ("Increased cwnd to " << m_cWnd);
167
      SendPendingData (m_connected);
167
      if (!m_sendPendingDataEvent.IsRunning ())
168
        {
169
          SendPendingData (m_connected);
170
        }
168
    };
171
    };
169
}
172
}
170
173
 Lines 236-239    Link Here 
236
  m_ssThresh = m_initialSsThresh;
239
  m_ssThresh = m_initialSsThresh;
237
}
240
}
238
241
242
void
243
TcpReno::ScaleSsThresh (uint8_t scaleFactor)
244
{
245
  m_ssThresh <<= scaleFactor;
246
}
247
248
239
} // namespace ns3
249
} // namespace ns3
(-)a/src/internet/model/tcp-reno.h (+2 lines)
 Lines 71-76    Link Here 
71
  virtual uint32_t GetInitialSSThresh (void) const;
71
  virtual uint32_t GetInitialSSThresh (void) const;
72
  virtual void     SetInitialCwnd (uint32_t cwnd);
72
  virtual void     SetInitialCwnd (uint32_t cwnd);
73
  virtual uint32_t GetInitialCwnd (void) const;
73
  virtual uint32_t GetInitialCwnd (void) const;
74
  virtual void ScaleSsThresh (uint8_t scaleFactor);
75
74
private:
76
private:
75
  /**
77
  /**
76
   * \brief Set the congestion window when connection starts
78
   * \brief Set the congestion window when connection starts
(-)a/src/internet/model/tcp-rfc793.cc (+15 lines)
 Lines 88-91    Link Here 
88
  return 0;
88
  return 0;
89
}
89
}
90
90
91
uint32_t
92
TcpRfc793::Window ()
93
{
94
  NS_LOG_FUNCTION (this);
95
  return m_rWnd;
96
}
97
98
void
99
TcpRfc793::ScaleSsThresh (uint8_t scaleFactor)
100
{
101
  NS_LOG_WARN ("DoD TCP does not perform slow start");
102
  return;
103
}
104
105
91
} // namespace ns3
106
} // namespace ns3
(-)a/src/internet/model/tcp-rfc793.h (+4 lines)
 Lines 62-67    Link Here 
62
  virtual uint32_t GetInitialSSThresh (void) const;
62
  virtual uint32_t GetInitialSSThresh (void) const;
63
  virtual void     SetInitialCwnd (uint32_t cwnd);
63
  virtual void     SetInitialCwnd (uint32_t cwnd);
64
  virtual uint32_t GetInitialCwnd (void) const;
64
  virtual uint32_t GetInitialCwnd (void) const;
65
66
  virtual uint32_t Window (void);
67
  virtual void ScaleSsThresh (uint8_t scaleFactor);
68
65
};
69
};
66
70
67
} // namespace ns3
71
} // namespace ns3
(-)a/src/internet/model/tcp-socket-base.cc (-22 / +21 lines)
 Lines 600-606    Link Here 
600
      NS_LOG_LOGIC ("txBufSize=" << m_txBuffer->Size () << " state " << TcpStateName[m_state]);
600
      NS_LOG_LOGIC ("txBufSize=" << m_txBuffer->Size () << " state " << TcpStateName[m_state]);
601
      if (m_state == ESTABLISHED || m_state == CLOSE_WAIT)
601
      if (m_state == ESTABLISHED || m_state == CLOSE_WAIT)
602
        { // Try to send the data out
602
        { // Try to send the data out
603
          SendPendingData (m_connected);
603
          if (!m_sendPendingDataEvent.IsRunning ())
604
            {
605
              m_sendPendingDataEvent = Simulator::Schedule ( TimeStep (1), &TcpSocketBase::SendPendingData, this, m_connected);
606
            }
604
        }
607
        }
605
      return p->GetSize ();
608
      return p->GetSize ();
606
    }
609
    }
 Lines 947-954    Link Here 
947
      NS_LOG_LOGIC (this << " Leaving zerowindow persist state");
950
      NS_LOG_LOGIC (this << " Leaving zerowindow persist state");
948
      m_persistEvent.Cancel ();
951
      m_persistEvent.Cancel ();
949
    }
952
    }
950
  m_rWnd = tcpHeader.GetWindowSize ();
953
  m_rWnd = (uint32_t(tcpHeader.GetWindowSize ()) << m_rcvScaleFactor);
951
  m_rWnd <<= m_rcvScaleFactor;
952
954
953
  // Discard fully out of range data packets
955
  // Discard fully out of range data packets
954
  if (packet->GetSize ()
956
  if (packet->GetSize ()
 Lines 1051-1058    Link Here 
1051
      NS_LOG_LOGIC (this << " Leaving zerowindow persist state");
1053
      NS_LOG_LOGIC (this << " Leaving zerowindow persist state");
1052
      m_persistEvent.Cancel ();
1054
      m_persistEvent.Cancel ();
1053
    }
1055
    }
1054
  m_rWnd = tcpHeader.GetWindowSize ();
1056
  m_rWnd = (uint32_t(tcpHeader.GetWindowSize ()) << m_rcvScaleFactor);
1055
  m_rWnd <<= m_rcvScaleFactor;
1056
1057
1057
  // Discard fully out of range packets
1058
  // Discard fully out of range packets
1058
  if (packet->GetSize ()
1059
  if (packet->GetSize ()
 Lines 2063-2069    Link Here 
2063
  if (m_txBuffer->Size () == 0)
2064
  if (m_txBuffer->Size () == 0)
2064
    {
2065
    {
2065
      return false;                           // Nothing to send
2066
      return false;                           // Nothing to send
2066
2067
    }
2067
    }
2068
  if (m_endPoint == 0 && m_endPoint6 == 0)
2068
  if (m_endPoint == 0 && m_endPoint6 == 0)
2069
    {
2069
    {
 Lines 2074-2090    Link Here 
2074
  while (m_txBuffer->SizeFromSequence (m_nextTxSequence))
2074
  while (m_txBuffer->SizeFromSequence (m_nextTxSequence))
2075
    {
2075
    {
2076
      uint32_t w = AvailableWindow (); // Get available window size
2076
      uint32_t w = AvailableWindow (); // Get available window size
2077
      NS_LOG_LOGIC ("TcpSocketBase " << this << " SendPendingData" <<
2078
                    " w " << w <<
2079
                    " rxwin " << m_rWnd <<
2080
                    " segsize " << m_segmentSize <<
2081
                    " nextTxSeq " << m_nextTxSequence <<
2082
                    " highestRxAck " << m_txBuffer->HeadSequence () <<
2083
                    " pd->Size " << m_txBuffer->Size () <<
2084
                    " pd->SFS " << m_txBuffer->SizeFromSequence (m_nextTxSequence));
2085
      // Stop sending if we need to wait for a larger Tx window (prevent silly window syndrome)
2077
      // Stop sending if we need to wait for a larger Tx window (prevent silly window syndrome)
2086
      if (w < m_segmentSize && m_txBuffer->SizeFromSequence (m_nextTxSequence) > w)
2078
      if (w < m_segmentSize && m_txBuffer->SizeFromSequence (m_nextTxSequence) > w)
2087
        {
2079
        {
2080
          NS_LOG_LOGIC ("Preventing Silly Window Syndrome. Wait to send.");
2088
          break; // No more
2081
          break; // No more
2089
        }
2082
        }
2090
      // Nagle's algorithm (RFC896): Hold off sending if there is unacked data
2083
      // Nagle's algorithm (RFC896): Hold off sending if there is unacked data
 Lines 2095-2100    Link Here 
2095
          NS_LOG_LOGIC ("Invoking Nagle's algorithm. Wait to send.");
2088
          NS_LOG_LOGIC ("Invoking Nagle's algorithm. Wait to send.");
2096
          break;
2089
          break;
2097
        }
2090
        }
2091
      NS_LOG_LOGIC ("TcpSocketBase " << this << " SendPendingData" <<
2092
                    " w " << w <<
2093
                    " rxwin " << m_rWnd <<
2094
                    " segsize " << m_segmentSize <<
2095
                    " nextTxSeq " << m_nextTxSequence <<
2096
                    " highestRxAck " << m_txBuffer->HeadSequence () <<
2097
                    " pd->Size " << m_txBuffer->Size () <<
2098
                    " pd->SFS " << m_txBuffer->SizeFromSequence (m_nextTxSequence));
2098
      uint32_t s = std::min (w, m_segmentSize);  // Send no more than window
2099
      uint32_t s = std::min (w, m_segmentSize);  // Send no more than window
2099
      uint32_t sz = SendDataPacket (m_nextTxSequence, s, withAck);
2100
      uint32_t sz = SendDataPacket (m_nextTxSequence, s, withAck);
2100
      nPacketsSent++;                             // Count sent this loop
2101
      nPacketsSent++;                             // Count sent this loop
 Lines 2119-2131    Link Here 
2119
}
2120
}
2120
2121
2121
uint32_t
2122
uint32_t
2122
TcpSocketBase::Window ()
2123
{
2124
  NS_LOG_FUNCTION (this);
2125
  return m_rWnd;
2126
}
2127
2128
uint32_t
2129
TcpSocketBase::AvailableWindow ()
2123
TcpSocketBase::AvailableWindow ()
2130
{
2124
{
2131
  NS_LOG_FUNCTION_NOARGS ();
2125
  NS_LOG_FUNCTION_NOARGS ();
 Lines 2313-2319    Link Here 
2313
      m_retxEvent.Cancel ();
2307
      m_retxEvent.Cancel ();
2314
    }
2308
    }
2315
  // Try to send more data
2309
  // Try to send more data
2316
  SendPendingData (m_connected);
2310
  if (!m_sendPendingDataEvent.IsRunning ())
2311
    {
2312
      m_sendPendingDataEvent = Simulator::Schedule ( TimeStep (1), &TcpSocketBase::SendPendingData, this, m_connected);
2313
    }
2317
}
2314
}
2318
2315
2319
// Retransmit timeout
2316
// Retransmit timeout
 Lines 2450-2455    Link Here 
2450
  m_delAckEvent.Cancel ();
2447
  m_delAckEvent.Cancel ();
2451
  m_lastAckEvent.Cancel ();
2448
  m_lastAckEvent.Cancel ();
2452
  m_timewaitEvent.Cancel ();
2449
  m_timewaitEvent.Cancel ();
2450
  m_sendPendingDataEvent.Cancel ();
2453
}
2451
}
2454
2452
2455
/* Move TCP to Time_Wait state and schedule a transition to Closed state */
2453
/* Move TCP to Time_Wait state and schedule a transition to Closed state */
 Lines 2604-2609    Link Here 
2604
            {
2602
            {
2605
              m_winScalingEnabled = true;
2603
              m_winScalingEnabled = true;
2606
              ProcessOptionWScale (header.GetOption (TcpOption::WINSCALE));
2604
              ProcessOptionWScale (header.GetOption (TcpOption::WINSCALE));
2605
              ScaleSsThresh (m_sndScaleFactor);
2607
            }
2606
            }
2608
        }
2607
        }
2609
    }
2608
    }
(-)a/src/internet/model/tcp-socket-base.h (-1 / +12 lines)
 Lines 518-524    Link Here 
518
   * \brief Return the max possible number of unacked bytes
518
   * \brief Return the max possible number of unacked bytes
519
   * \returns the max possible number of unacked bytes
519
   * \returns the max possible number of unacked bytes
520
   */
520
   */
521
  virtual uint32_t Window (void);
521
  virtual uint32_t Window (void) = 0;
522
522
523
  /**
523
  /**
524
   * \brief Return unfilled portion of window
524
   * \brief Return unfilled portion of window
 Lines 675-680    Link Here 
675
   */
675
   */
676
  void AddOptionTimestamp (TcpHeader& header);
676
  void AddOptionTimestamp (TcpHeader& header);
677
677
678
  /**
679
   * \brief Scale the initial SsThresh value to the correct one
680
   *
681
   * Set the initial SsThresh to the largest possible advertised window
682
   * according to the sender scale factor.
683
   *
684
   * \param scaleFactor the sender scale factor
685
   */
686
  virtual void ScaleSsThresh (uint8_t scaleFactor) = 0;
678
687
679
protected:
688
protected:
680
  // Counters and events
689
  // Counters and events
 Lines 736-741    Link Here 
736
745
737
  bool     m_timestampEnabled;    //!< Timestamp option enabled
746
  bool     m_timestampEnabled;    //!< Timestamp option enabled
738
  uint32_t m_timestampToEcho;     //!< Timestamp to echo
747
  uint32_t m_timestampToEcho;     //!< Timestamp to echo
748
749
  EventId m_sendPendingDataEvent; //!< micro-delay event to send pending data
739
};
750
};
740
751
741
} // namespace ns3
752
} // namespace ns3
(-)a/src/internet/model/tcp-tahoe.cc (+7 lines)
 Lines 214-217    Link Here 
214
  m_ssThresh = m_initialSsThresh;
214
  m_ssThresh = m_initialSsThresh;
215
}
215
}
216
216
217
void
218
TcpTahoe::ScaleSsThresh (uint8_t scaleFactor)
219
{
220
  m_ssThresh <<= scaleFactor;
221
}
222
223
217
} // namespace ns3
224
} // namespace ns3
(-)a/src/internet/model/tcp-tahoe.h (+1 lines)
 Lines 75-80    Link Here 
75
  virtual uint32_t GetInitialSSThresh (void) const;
75
  virtual uint32_t GetInitialSSThresh (void) const;
76
  virtual void     SetInitialCwnd (uint32_t cwnd);
76
  virtual void     SetInitialCwnd (uint32_t cwnd);
77
  virtual uint32_t GetInitialCwnd (void) const;
77
  virtual uint32_t GetInitialCwnd (void) const;
78
  virtual void ScaleSsThresh (uint8_t scaleFactor);
78
private:
79
private:
79
  /**
80
  /**
80
   * \brief Set the congestion window when connection starts
81
   * \brief Set the congestion window when connection starts
(-)a/src/internet/model/tcp-westwood.cc (-1 / +11 lines)
 Lines 292-298    Link Here 
292
    {// Increase cwnd for every additional DUPACK as in Reno
292
    {// Increase cwnd for every additional DUPACK as in Reno
293
      m_cWnd += m_segmentSize;
293
      m_cWnd += m_segmentSize;
294
      NS_LOG_INFO ("Dupack in fast recovery mode. Increase cwnd to " << m_cWnd);
294
      NS_LOG_INFO ("Dupack in fast recovery mode. Increase cwnd to " << m_cWnd);
295
      SendPendingData (m_connected);
295
      if (!m_sendPendingDataEvent.IsRunning ())
296
        {
297
          SendPendingData (m_connected);
298
        }
296
    }
299
    }
297
}
300
}
298
301
 Lines 425-428    Link Here 
425
  m_ssThresh = m_initialSsThresh;
428
  m_ssThresh = m_initialSsThresh;
426
}
429
}
427
430
431
void
432
TcpWestwood::ScaleSsThresh (uint8_t scaleFactor)
433
{
434
  m_ssThresh <<= scaleFactor;
435
}
436
437
428
} // namespace ns3
438
} // namespace ns3
(-)a/src/internet/model/tcp-westwood.h (+1 lines)
 Lines 126-131    Link Here 
126
  virtual uint32_t GetInitialSSThresh (void) const;
126
  virtual uint32_t GetInitialSSThresh (void) const;
127
  virtual void     SetInitialCwnd (uint32_t cwnd);
127
  virtual void     SetInitialCwnd (uint32_t cwnd);
128
  virtual uint32_t GetInitialCwnd (void) const;
128
  virtual uint32_t GetInitialCwnd (void) const;
129
  virtual void ScaleSsThresh (uint8_t scaleFactor);
129
130
130
private:
131
private:
131
  /**
132
  /**

Return to bug 2067