Tenusha Guruge
Tenusha Guruge

Reputation: 2310

At where TCP New Reno set the threshold value once a packet is dropped in NS3

In TCP New Reno it set the threshold value to half of the current CWND once a packet drop is identified. I need to find the method, that does the task.

In tcp-l4-protocol.h it uses TcpClassicRecovery as the recovery method. In TcpClassicRecovery entering phase, it uses the following code segment to set the current CWND,

void
TcpClassicRecovery::EnterRecovery (Ptr<TcpSocketState> tcb, uint32_t dupAckCount,
                                uint32_t unAckDataCount, uint32_t lastSackedBytes)
{
  NS_LOG_FUNCTION (this << tcb << dupAckCount << unAckDataCount << lastSackedBytes);
  NS_UNUSED (unAckDataCount);
  NS_UNUSED (lastSackedBytes);
  tcb->m_cWnd = tcb->m_ssThresh;
  tcb->m_cWndInfl = tcb->m_ssThresh + (dupAckCount * tcb->m_segmentSize);
}

Then I assume before calling the EnterRecovery method, the cwnd is already updated. I need to find the place that cwnd is updated.

I also updated TcpNewReno::GetSsThresh and analyzed the output. But it's also not the method I need as it doesn't cut the cwnd to half.

NOTE: I'm using seventh.cc to inspect cwnd. It always drops the cwnd to 1072. The graph I'm getting is also included. What I need to do is drop the cwnd to half of the value once a packet is dropped. Maybe the seventh.cc is not using the default tcp-l4-protocol.h. If so how I can change it?

enter image description here

Upvotes: 2

Views: 545

Answers (2)

Sagar
Sagar

Reputation: 1870

I just wanted to add a quick note: the code to change cwnd is in the very snippet in your question. Specifically, it is this line:

tcb->m_cWnd = tcb->m_ssThresh;

Much of the state of a TCP Socket is actually stored in the the tcb which is a Ptr<TcpSocketState>.

Upvotes: 0

Tenusha Guruge
Tenusha Guruge

Reputation: 2310

I found the answer. The problem was with the seventh.cc. It does not use the default layer 4 TCP protocol.

To run the default layer 4 TCP protocol (TCP New Reno), I found an example, which is tcp-large-transfer.cc. It's located in ns-3.30/examples/tcp/tcp-large-transfer.cc.

Upvotes: 1

Related Questions