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

(-)a/src/internet/model/tcp-socket-base.cc (-4 / +31 lines)
 Lines 299-304   TcpSocketBase::TcpSocketBase (void) Link Here 
299
    m_recover (0), // Set to the initial sequence number
299
    m_recover (0), // Set to the initial sequence number
300
    m_retxThresh (3),
300
    m_retxThresh (3),
301
    m_limitedTx (false),
301
    m_limitedTx (false),
302
    m_retransOut (0),
302
    m_congestionControl (0),
303
    m_congestionControl (0),
303
    m_isFirstPartialAck (true)
304
    m_isFirstPartialAck (true)
304
{
305
{
 Lines 368-373   TcpSocketBase::TcpSocketBase (const TcpSocketBase& sock) Link Here 
368
    m_recover (sock.m_recover),
369
    m_recover (sock.m_recover),
369
    m_retxThresh (sock.m_retxThresh),
370
    m_retxThresh (sock.m_retxThresh),
370
    m_limitedTx (sock.m_limitedTx),
371
    m_limitedTx (sock.m_limitedTx),
372
    m_retransOut (sock.m_retransOut),
371
    m_isFirstPartialAck (sock.m_isFirstPartialAck),
373
    m_isFirstPartialAck (sock.m_isFirstPartialAck),
372
    m_txTrace (sock.m_txTrace),
374
    m_txTrace (sock.m_txTrace),
373
    m_rxTrace (sock.m_rxTrace)
375
    m_rxTrace (sock.m_rxTrace)
 Lines 1511-1516   TcpSocketBase::ReceivedAck (Ptr<Packet> packet, const TcpHeader& tcpHeader) Link Here 
1511
          m_tcb->m_congState = TcpSocketState::CA_OPEN;
1513
          m_tcb->m_congState = TcpSocketState::CA_OPEN;
1512
          m_congestionControl->PktsAcked (m_tcb, segsAcked, m_lastRtt);
1514
          m_congestionControl->PktsAcked (m_tcb, segsAcked, m_lastRtt);
1513
          m_dupAckCount = 0;
1515
          m_dupAckCount = 0;
1516
          m_retransOut = 0;
1514
1517
1515
          NS_LOG_DEBUG ("DISORDER -> OPEN");
1518
          NS_LOG_DEBUG ("DISORDER -> OPEN");
1516
        }
1519
        }
 Lines 1544-1549   TcpSocketBase::ReceivedAck (Ptr<Packet> packet, const TcpHeader& tcpHeader) Link Here 
1544
1547
1545
              callCongestionControl = false; // No congestion control on cWnd show be invoked
1548
              callCongestionControl = false; // No congestion control on cWnd show be invoked
1546
              m_dupAckCount -= segsAcked;    // Update the dupAckCount
1549
              m_dupAckCount -= segsAcked;    // Update the dupAckCount
1550
              m_retransOut--;  // at least one retransmission has reached the other side
1547
              m_txBuffer->DiscardUpTo (ackNumber);  //Bug 1850:  retransmit before newack
1551
              m_txBuffer->DiscardUpTo (ackNumber);  //Bug 1850:  retransmit before newack
1548
              DoRetransmit (); // Assume the next seq is lost. Retransmit lost packet
1552
              DoRetransmit (); // Assume the next seq is lost. Retransmit lost packet
1549
1553
 Lines 1573-1578   TcpSocketBase::ReceivedAck (Ptr<Packet> packet, const TcpHeader& tcpHeader) Link Here 
1573
                                        BytesInFlight () + m_tcb->m_segmentSize);
1577
                                        BytesInFlight () + m_tcb->m_segmentSize);
1574
              m_isFirstPartialAck = true;
1578
              m_isFirstPartialAck = true;
1575
              m_dupAckCount = 0;
1579
              m_dupAckCount = 0;
1580
              m_retransOut = 0;
1576
1581
1577
              /* This FULL ACK acknowledge the fact that one segment has been
1582
              /* This FULL ACK acknowledge the fact that one segment has been
1578
               * previously lost and now successfully received. All others have
1583
               * previously lost and now successfully received. All others have
 Lines 1594-1599   TcpSocketBase::ReceivedAck (Ptr<Packet> packet, const TcpHeader& tcpHeader) Link Here 
1594
          m_isFirstPartialAck = true;
1599
          m_isFirstPartialAck = true;
1595
          m_congestionControl->PktsAcked (m_tcb, segsAcked, m_lastRtt);
1600
          m_congestionControl->PktsAcked (m_tcb, segsAcked, m_lastRtt);
1596
          m_dupAckCount = 0;
1601
          m_dupAckCount = 0;
1602
          m_retransOut = 0;
1597
          m_tcb->m_congState = TcpSocketState::CA_OPEN;
1603
          m_tcb->m_congState = TcpSocketState::CA_OPEN;
1598
          NS_LOG_DEBUG ("LOSS -> OPEN");
1604
          NS_LOG_DEBUG ("LOSS -> OPEN");
1599
        }
1605
        }
 Lines 2555-2561   uint32_t Link Here 
2555
TcpSocketBase::BytesInFlight ()
2561
TcpSocketBase::BytesInFlight ()
2556
{
2562
{
2557
  NS_LOG_FUNCTION (this);
2563
  NS_LOG_FUNCTION (this);
2558
  uint32_t bytesInFlight = m_highTxMark.Get () - m_txBuffer->HeadSequence ();
2564
  // Previous (see bug 1783):
2565
  // uint32_t bytesInFlight = m_highTxMark.Get () - m_txBuffer->HeadSequence ();
2566
  // RFC 4898 page 23
2567
  // PipeSize=SND.NXT-SND.UNA+(retransmits-dupacks)*CurMSS
2568
2569
  // flightSize == UnAckDataCount (), but we avoid the call to save log lines
2570
  uint32_t flightSize = m_nextTxSequence.Get () - m_txBuffer->HeadSequence ();
2571
  uint32_t duplicatedSize;
2572
  uint32_t bytesInFlight;
2573
2574
  if (m_retransOut > m_dupAckCount)
2575
    {
2576
      duplicatedSize = (m_retransOut - m_dupAckCount)*m_tcb->m_segmentSize;
2577
      bytesInFlight = flightSize + duplicatedSize;
2578
    }
2579
  else
2580
    {
2581
      duplicatedSize = (m_dupAckCount - m_retransOut)*m_tcb->m_segmentSize;
2582
      bytesInFlight = duplicatedSize > flightSize ? 0 : flightSize - duplicatedSize;
2583
    }
2559
2584
2560
  // m_bytesInFlight is traced; avoid useless assignments which would fire
2585
  // m_bytesInFlight is traced; avoid useless assignments which would fire
2561
  // fruitlessly the callback
2586
  // fruitlessly the callback
 Lines 2889-2897   TcpSocketBase::Retransmit () Link Here 
2889
   * are not able to retransmit anything because of local congestion.
2914
   * are not able to retransmit anything because of local congestion.
2890
   */
2915
   */
2891
2916
2892
  m_nextTxSequence = m_txBuffer->HeadSequence (); // Restart from highest Ack
2893
  m_dupAckCount = 0;
2894
2895
  if (m_tcb->m_congState != TcpSocketState::CA_LOSS)
2917
  if (m_tcb->m_congState != TcpSocketState::CA_LOSS)
2896
    {
2918
    {
2897
      m_tcb->m_congState = TcpSocketState::CA_LOSS;
2919
      m_tcb->m_congState = TcpSocketState::CA_LOSS;
 Lines 2899-2904   TcpSocketBase::Retransmit () Link Here 
2899
      m_tcb->m_cWnd = m_tcb->m_segmentSize;
2921
      m_tcb->m_cWnd = m_tcb->m_segmentSize;
2900
    }
2922
    }
2901
2923
2924
  m_nextTxSequence = m_txBuffer->HeadSequence (); // Restart from highest Ack
2925
  m_dupAckCount = 0;
2926
2902
  NS_LOG_DEBUG ("RTO. Reset cwnd to " <<  m_tcb->m_cWnd << ", ssthresh to " <<
2927
  NS_LOG_DEBUG ("RTO. Reset cwnd to " <<  m_tcb->m_cWnd << ", ssthresh to " <<
2903
                m_tcb->m_ssThresh << ", restart from seqnum " << m_nextTxSequence);
2928
                m_tcb->m_ssThresh << ", restart from seqnum " << m_nextTxSequence);
2904
  DoRetransmit ();                          // Retransmit the packet
2929
  DoRetransmit ();                          // Retransmit the packet
 Lines 2946-2951   TcpSocketBase::DoRetransmit () Link Here 
2946
2971
2947
  // Retransmit a data packet: Call SendDataPacket
2972
  // Retransmit a data packet: Call SendDataPacket
2948
  uint32_t sz = SendDataPacket (m_txBuffer->HeadSequence (), m_tcb->m_segmentSize, true);
2973
  uint32_t sz = SendDataPacket (m_txBuffer->HeadSequence (), m_tcb->m_segmentSize, true);
2974
  ++m_retransOut;
2975
2949
  // In case of RTO, advance m_nextTxSequence
2976
  // In case of RTO, advance m_nextTxSequence
2950
  m_nextTxSequence = std::max (m_nextTxSequence.Get (), m_txBuffer->HeadSequence () + sz);
2977
  m_nextTxSequence = std::max (m_nextTxSequence.Get (), m_txBuffer->HeadSequence () + sz);
2951
2978
(-)a/src/internet/model/tcp-socket-base.h (+1 lines)
 Lines 956-961   protected: Link Here 
956
  SequenceNumber32       m_recover;      //!< Previous highest Tx seqnum for fast recovery
956
  SequenceNumber32       m_recover;      //!< Previous highest Tx seqnum for fast recovery
957
  uint32_t               m_retxThresh;   //!< Fast Retransmit threshold
957
  uint32_t               m_retxThresh;   //!< Fast Retransmit threshold
958
  bool                   m_limitedTx;    //!< perform limited transmit
958
  bool                   m_limitedTx;    //!< perform limited transmit
959
  uint32_t               m_retransOut;   //!< Number of retransmission in this window
959
960
960
  // Transmission Control Block
961
  // Transmission Control Block
961
  Ptr<TcpSocketState>    m_tcb;               //!< Congestion control informations
962
  Ptr<TcpSocketState>    m_tcb;               //!< Congestion control informations

Return to bug 1783