1
votes

I am playing with various TCP algorithms using Netkit.

There are two machines, c1 and c2, connected by a router with forced 200ms delay. Program on c1 is sending 100-byte packets to c2 each 1ms (TCP_NODELAY is turned on). Reno is used as congestion control on both machines.

According to tcpdump, only first 2 packets are sent immediately (200 bytes), then c1 stops sending and waits for ACK. Receiver's window is about 2MSS (MSS=1460), so I guess it's CWND that prevents c1 from sending further packets.

According to Reno specification, initial CWND is 1MSS. Am i missing something there?.. Even sending 1-byte packets gives same picture, 2 packets are sent and then sender waits for ACK. May it be that initial CWND size is determined by initial segment size, not MSS?

ip route show cache shows something like

cache mtu 1500 rtt 361ms rttvar 360ms cwnd 5 advmss 1460 hoplimit 64

I wonder if it means that CWND=5MSS?

3

3 Answers

1
votes

From the RFC 2581

IW, the initial value of cwnd, MUST be less than or equal to 2*SMSS bytes and MUST NOT be more than 2 segments.

We note that a non-standard, experimental TCP extension allows that a TCP MAY use a larger initial window (IW), as defined in equation 1 [AFP98]:

  IW = min (4*SMSS, max (2*SMSS, 4380 bytes))           (1)

With this extension, a TCP sender MAY use a 3 or 4 segment initial
window, provided the combined size of the segments does not exceed 4380 bytes. We do NOT allow this change as part of the standard defined by this document. However, we include discussion of (1) in the remainder of this document as a guideline for those experimenting with the change, rather than conforming to the present standards for TCP congestion control.

SENDER MAXIMUM SEGMENT SIZE (SMSS): The SMSS is the size of the largest segment that the sender can transmit. This value can be based on the maximum transmission unit of the network, the path MTU discovery [MD90] algorithm, RMSS (see next item), or other factors. The size does not include the TCP/IP headers and options.

You might want to check how your implementation is calculating SMSS.

0
votes

As far as I know, Linux measures cwnd in "segments" in this case - so as soon as you have sent two segments to flight, then your cwnd is closed for new data.

0
votes

The initial window is 2. The reason why it is not 1 has to do with delayed acks. The receiver usually waits for two data packets before sending an ack. If the initial window is 1 the ack will be sent after a default time often much larger than necessary. This adds unnecessary delay and messes with ack-clocking.