diff --git a/examples/tcp/tcp-variants-comparison.cc b/examples/tcp/tcp-variants-comparison.cc index 6c939aa98..c085f2f01 100644 --- a/examples/tcp/tcp-variants-comparison.cc +++ b/examples/tcp/tcp-variants-comparison.cc @@ -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 diff --git a/src/internet/model/tcp-reno.cc b/src/internet/model/tcp-reno.cc deleted file mode 100644 index a3d92151b..000000000 --- a/src/internet/model/tcp-reno.cc +++ /dev/null @@ -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 - */ - -#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 () - .SetGroupName ("Internet") - .AddConstructor () - .AddAttribute ("ReTxThreshold", "Threshold for fast retransmit", - UintegerValue (3), - MakeUintegerAccessor (&TcpReno::m_retxThresh), - MakeUintegerChecker ()) - ; - 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 -TcpReno::Fork (void) -{ - return CopyObject (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 (m_segmentSize * m_segmentSize) / m_cWnd.Get (); - adder = std::max (1.0, adder); - m_cWnd += static_cast (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 diff --git a/src/internet/model/tcp-reno.h b/src/internet/model/tcp-reno.h deleted file mode 100644 index cc3ba345c..000000000 --- a/src/internet/model/tcp-reno.h +++ /dev/null @@ -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 - */ - -#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 Fork (void); // Call CopyObject 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 */ diff --git a/src/internet/wscript b/src/internet/wscript index 23e7a4be1..ac9628d9b 100644 --- a/src/internet/wscript +++ b/src/internet/wscript @@ -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', diff --git a/src/network/examples/red-tests.cc b/src/network/examples/red-tests.cc index 7ea045bc3..36f123caa 100644 --- a/src/network/examples/red-tests.cc +++ b/src/network/examples/red-tests.cc @@ -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)); diff --git a/src/test/ns3tcp/ns3tcp-loss-test-suite.cc b/src/test/ns3tcp/ns3tcp-loss-test-suite.cc index f5d78dad2..22c1498aa 100644 --- a/src/test/ns3tcp/ns3tcp-loss-test-suite.cc +++ b/src/test/ns3tcp/ns3tcp-loss-test-suite.cc @@ -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); diff --git a/src/test/ns3tcp/ns3tcp-state-test-suite.cc b/src/test/ns3tcp/ns3tcp-state-test-suite.cc index bfa76dbb5..1e8f7f657 100644 --- a/src/test/ns3tcp/ns3tcp-state-test-suite.cc +++ b/src/test/ns3tcp/ns3tcp-state-test-suite.cc @@ -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); }