Removed TcpReno from ns-3 mainline
TcpNewReno is introduced in RFC 2582. The most recent RFC on this is the RFC 6582. Since its introduction, Tcp NewReno is the RECOMMENDED algorithm by the Internet Engineering Task Force. The main difference between Reno and New Reno is in the Fast retransmit algorithm, in order to recover more quickly when multiple packet losses occur in a single window. NewReno introduces the concept of Partial acknowledgments. Since the intention is to merge fast retransmit and fast recovery into TcpSocketBase, there isn't the possibility to maintain TcpReno as separate class. However, its behavior could be introduced again with one conditional attribute in TcpSocketBase itself.
This commit is contained in:
@@ -176,7 +176,7 @@ int main (int argc, char *argv[])
|
||||
|
||||
|
||||
CommandLine cmd;
|
||||
cmd.AddValue ("transport_prot", "Transport protocol to use: TcpTahoe, TcpReno,"
|
||||
cmd.AddValue ("transport_prot", "Transport protocol to use: TcpTahoe, "
|
||||
" TcpNewReno, TcpWestwood, TcpWestwoodPlus ", transport_prot);
|
||||
cmd.AddValue ("error_p", "Packet error rate", error_p);
|
||||
cmd.AddValue ("bandwidth", "Bottleneck bandwidth", bandwidth);
|
||||
@@ -228,10 +228,6 @@ int main (int argc, char *argv[])
|
||||
{
|
||||
Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpTahoe::GetTypeId ()));
|
||||
}
|
||||
else if (transport_prot.compare ("TcpReno") == 0)
|
||||
{
|
||||
Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpReno::GetTypeId ()));
|
||||
}
|
||||
else if (transport_prot.compare ("TcpNewReno") == 0)
|
||||
{
|
||||
Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpNewReno::GetTypeId ()));
|
||||
@@ -364,7 +360,6 @@ int main (int argc, char *argv[])
|
||||
AddressValue remoteAddress (InetSocketAddress (sink_interfaces.GetAddress (i, 0), port));
|
||||
|
||||
if (transport_prot.compare ("TcpTahoe") == 0
|
||||
|| transport_prot.compare ("TcpReno") == 0
|
||||
|| transport_prot.compare ("TcpNewReno") == 0
|
||||
|| transport_prot.compare ("TcpWestwood") == 0
|
||||
|| transport_prot.compare ("TcpWestwoodPlus") == 0
|
||||
|
||||
@@ -1,160 +0,0 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2010 Adrian Sai-wah Tam
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Adrian Sai-wah Tam <adrian.sw.tam@gmail.com>
|
||||
*/
|
||||
|
||||
#define NS_LOG_APPEND_CONTEXT \
|
||||
if (m_node) { std::clog << Simulator::Now ().GetSeconds () << " [node " << m_node->GetId () << "] "; }
|
||||
|
||||
#include "tcp-reno.h"
|
||||
#include "ns3/log.h"
|
||||
#include "ns3/trace-source-accessor.h"
|
||||
#include "ns3/simulator.h"
|
||||
#include "ns3/abort.h"
|
||||
#include "ns3/node.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("TcpReno");
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (TcpReno);
|
||||
|
||||
TypeId
|
||||
TcpReno::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::TcpReno")
|
||||
.SetParent<TcpSocketBase> ()
|
||||
.SetGroupName ("Internet")
|
||||
.AddConstructor<TcpReno> ()
|
||||
.AddAttribute ("ReTxThreshold", "Threshold for fast retransmit",
|
||||
UintegerValue (3),
|
||||
MakeUintegerAccessor (&TcpReno::m_retxThresh),
|
||||
MakeUintegerChecker<uint32_t> ())
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
|
||||
TcpReno::TcpReno (void) : m_retxThresh (3), m_inFastRec (false)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
|
||||
TcpReno::TcpReno (const TcpReno& sock)
|
||||
: TcpSocketBase (sock),
|
||||
m_retxThresh (sock.m_retxThresh),
|
||||
m_inFastRec (false)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
NS_LOG_LOGIC ("Invoked the copy constructor");
|
||||
}
|
||||
|
||||
TcpReno::~TcpReno (void)
|
||||
{
|
||||
}
|
||||
|
||||
Ptr<TcpSocketBase>
|
||||
TcpReno::Fork (void)
|
||||
{
|
||||
return CopyObject<TcpReno> (this);
|
||||
}
|
||||
|
||||
/* New ACK (up to seqnum seq) received. Increase cwnd and call TcpSocketBase::NewAck() */
|
||||
void
|
||||
TcpReno::NewAck (const SequenceNumber32& seq)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << seq);
|
||||
NS_LOG_LOGIC ("TcpReno receieved ACK for seq " << seq <<
|
||||
" cwnd " << m_cWnd <<
|
||||
" ssthresh " << m_ssThresh);
|
||||
|
||||
// Check for exit condition of fast recovery
|
||||
if (m_inFastRec)
|
||||
{ // RFC2001, sec.4; RFC2581, sec.3.2
|
||||
// First new ACK after fast recovery: reset cwnd
|
||||
m_cWnd = m_ssThresh;
|
||||
m_inFastRec = false;
|
||||
NS_LOG_INFO ("Reset cwnd to " << m_cWnd);
|
||||
};
|
||||
|
||||
// Increase of cwnd based on current phase (slow start or congestion avoidance)
|
||||
if (m_cWnd < m_ssThresh)
|
||||
{ // Slow start mode, add one segSize to cWnd. Default m_ssThresh is 65535. (RFC2001, sec.1)
|
||||
m_cWnd += m_segmentSize;
|
||||
NS_LOG_INFO ("In SlowStart, updated to cwnd " << m_cWnd << " ssthresh " << m_ssThresh);
|
||||
}
|
||||
else
|
||||
{ // Congestion avoidance mode, increase by (segSize*segSize)/cwnd. (RFC2581, sec.3.1)
|
||||
// To increase cwnd for one segSize per RTT, it should be (ackBytes*segSize)/cwnd
|
||||
double adder = static_cast<double> (m_segmentSize * m_segmentSize) / m_cWnd.Get ();
|
||||
adder = std::max (1.0, adder);
|
||||
m_cWnd += static_cast<uint32_t> (adder);
|
||||
NS_LOG_INFO ("In CongAvoid, updated to cwnd " << m_cWnd << " ssthresh " << m_ssThresh);
|
||||
}
|
||||
|
||||
// Complete newAck processing
|
||||
TcpSocketBase::NewAck (seq);
|
||||
}
|
||||
|
||||
// Fast recovery and fast retransmit
|
||||
void
|
||||
TcpReno::DupAck (const TcpHeader& t, uint32_t count)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << "t " << count);
|
||||
if (count == m_retxThresh && !m_inFastRec)
|
||||
{ // triple duplicate ack triggers fast retransmit (RFC2581, sec.3.2)
|
||||
m_ssThresh = std::max (2 * m_segmentSize, BytesInFlight () / 2);
|
||||
m_cWnd = m_ssThresh + 3 * m_segmentSize;
|
||||
m_inFastRec = true;
|
||||
NS_LOG_INFO ("Triple dupack. Reset cwnd to " << m_cWnd << ", ssthresh to " << m_ssThresh);
|
||||
DoRetransmit ();
|
||||
}
|
||||
else if (m_inFastRec)
|
||||
{ // In fast recovery, inc cwnd for every additional dupack (RFC2581, sec.3.2)
|
||||
m_cWnd += m_segmentSize;
|
||||
NS_LOG_INFO ("Increased cwnd to " << m_cWnd);
|
||||
if (!m_sendPendingDataEvent.IsRunning ())
|
||||
{
|
||||
SendPendingData (m_connected);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Retransmit timeout
|
||||
void TcpReno::Retransmit (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
NS_LOG_LOGIC (this << " ReTxTimeout Expired at time " << Simulator::Now ().GetSeconds ());
|
||||
m_inFastRec = false;
|
||||
|
||||
// If erroneous timeout in closed/timed-wait state, just return
|
||||
if (m_state == CLOSED || m_state == TIME_WAIT) return;
|
||||
// If all data are received (non-closing socket and nothing to send), just return
|
||||
if (m_state <= ESTABLISHED && m_txBuffer->HeadSequence () >= m_highTxMark) return;
|
||||
|
||||
// According to RFC2581 sec.3.1, upon RTO, ssthresh is set to half of flight
|
||||
// size and cwnd is set to 1*MSS, then the lost packet is retransmitted and
|
||||
// TCP back to slow start
|
||||
m_ssThresh = std::max (2 * m_segmentSize, BytesInFlight () / 2);
|
||||
m_cWnd = m_segmentSize;
|
||||
m_nextTxSequence = m_txBuffer->HeadSequence (); // Restart from highest Ack
|
||||
NS_LOG_INFO ("RTO. Reset cwnd to " << m_cWnd <<
|
||||
", ssthresh to " << m_ssThresh << ", restart from seqnum " << m_nextTxSequence);
|
||||
DoRetransmit (); // Retransmit the packet
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
@@ -1,70 +0,0 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2010 Adrian Sai-wah Tam
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Adrian Sai-wah Tam <adrian.sw.tam@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef TCP_RENO_H
|
||||
#define TCP_RENO_H
|
||||
|
||||
#include "tcp-socket-base.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
/**
|
||||
* \ingroup socket
|
||||
* \ingroup tcp
|
||||
*
|
||||
* \brief An implementation of a stream socket using TCP.
|
||||
*
|
||||
* This class contains the Reno implementation of TCP, according to \RFC{2581},
|
||||
* except sec.4.1 "re-starting idle connections", which we do not detect for
|
||||
* idleness and thus no slow start upon resumption.
|
||||
*/
|
||||
class TcpReno : public TcpSocketBase
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* \brief Get the type ID.
|
||||
* \return the object TypeId
|
||||
*/
|
||||
static TypeId GetTypeId (void);
|
||||
/**
|
||||
* Create an unbound tcp socket.
|
||||
*/
|
||||
TcpReno (void);
|
||||
/**
|
||||
* \brief Copy constructor
|
||||
* \param sock the object to copy
|
||||
*/
|
||||
TcpReno (const TcpReno& sock);
|
||||
virtual ~TcpReno (void);
|
||||
|
||||
protected:
|
||||
virtual Ptr<TcpSocketBase> Fork (void); // Call CopyObject<TcpReno> to clone me
|
||||
virtual void NewAck (const SequenceNumber32& seq); // Inc cwnd and call NewAck() of parent
|
||||
virtual void DupAck (const TcpHeader& t, uint32_t count); // Fast retransmit
|
||||
virtual void Retransmit (void); // Retransmit timeout
|
||||
|
||||
protected:
|
||||
uint32_t m_retxThresh; //!< Fast Retransmit threshold
|
||||
bool m_inFastRec; //!< currently in fast recovery
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
#endif /* TCP_RENO_H */
|
||||
@@ -147,7 +147,6 @@ def build(bld):
|
||||
'model/tcp-socket-base.cc',
|
||||
'model/tcp-rfc793.cc',
|
||||
'model/tcp-tahoe.cc',
|
||||
'model/tcp-reno.cc',
|
||||
'model/tcp-newreno.cc',
|
||||
'model/tcp-westwood.cc',
|
||||
'model/tcp-rx-buffer.cc',
|
||||
@@ -326,7 +325,6 @@ def build(bld):
|
||||
'model/ipv6-address-generator.h',
|
||||
'model/tcp-rfc793.h',
|
||||
'model/tcp-tahoe.h',
|
||||
'model/tcp-reno.h',
|
||||
'model/tcp-newreno.h',
|
||||
'model/tcp-westwood.h',
|
||||
'model/tcp-socket-base.h',
|
||||
|
||||
@@ -308,7 +308,7 @@ main (int argc, char *argv[])
|
||||
n3n4 = NodeContainer (c.Get (3), c.Get (4));
|
||||
n3n5 = NodeContainer (c.Get (3), c.Get (5));
|
||||
|
||||
Config::SetDefault ("ns3::TcpL4Protocol::SocketType", StringValue ("ns3::TcpReno"));
|
||||
Config::SetDefault ("ns3::TcpL4Protocol::SocketType", StringValue ("ns3::TcpNewReno"));
|
||||
// 42 = headers size
|
||||
Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (1000 - 42));
|
||||
Config::SetDefault ("ns3::TcpSocket::DelAckCount", UintegerValue (1));
|
||||
|
||||
@@ -465,12 +465,6 @@ Ns3TcpLossTestSuite::Ns3TcpLossTestSuite ()
|
||||
AddTestCase (new Ns3TcpLossTestCase ("Tahoe", 3), TestCase::QUICK);
|
||||
AddTestCase (new Ns3TcpLossTestCase ("Tahoe", 4), TestCase::QUICK);
|
||||
|
||||
AddTestCase (new Ns3TcpLossTestCase ("Reno", 0), TestCase::QUICK);
|
||||
AddTestCase (new Ns3TcpLossTestCase ("Reno", 1), TestCase::QUICK);
|
||||
AddTestCase (new Ns3TcpLossTestCase ("Reno", 2), TestCase::QUICK);
|
||||
AddTestCase (new Ns3TcpLossTestCase ("Reno", 3), TestCase::QUICK);
|
||||
AddTestCase (new Ns3TcpLossTestCase ("Reno", 4), TestCase::QUICK);
|
||||
|
||||
AddTestCase (new Ns3TcpLossTestCase ("NewReno", 0), TestCase::QUICK);
|
||||
AddTestCase (new Ns3TcpLossTestCase ("NewReno", 1), TestCase::QUICK);
|
||||
AddTestCase (new Ns3TcpLossTestCase ("NewReno", 2), TestCase::QUICK);
|
||||
|
||||
@@ -287,7 +287,6 @@ Ns3TcpStateTestCase::DoRun (void)
|
||||
LogComponentEnable ("ErrorModel", LOG_LEVEL_DEBUG);
|
||||
LogComponentEnable ("Ns3TcpStateTest", LOG_LEVEL_DEBUG);
|
||||
LogComponentEnable ("TcpNewReno", LOG_LEVEL_INFO);
|
||||
LogComponentEnable ("TcpReno", LOG_LEVEL_INFO);
|
||||
LogComponentEnable ("TcpTahoe", LOG_LEVEL_INFO);
|
||||
LogComponentEnable ("TcpSocketBase", LOG_LEVEL_INFO);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user