Calculation of inflight data

Andre Oppermann andre at freebsd.org
Sat May 4 11:25:33 UTC 2013


On 03.05.2013 09:28, Aris Angelo wrote:
> Hi,
>
> I am trying to implement an extension to the FreeBSD TCP stack. In order to
> do that, I have a question regarding the calculation of the "pipe"
> variable, the amount of data that the sender calculates as being inflight.
> I am puzzled for the case when no SACK is negotiated and used.
>
> My idea would be that in this case the following is correct (during a
> partial ack):
>
> pipe = tp->snd_max - th->th_ack;

Actually pipe would decrease by one MSS for every duplicate ACK received,
though we can't be sure that it really represents a full MSS due to smaller
segments being possible with TCP_NODELAY.

> But when looking at the tcp_output code, I can see that the off variable,
> which is used as pipe to determine later how much data to send ( len =
> snd_cwnd- off); ), is calculated as:
>
> off = tp->snd_nxt - tp->snd_una;

off specifies the offset to send from in the send socket buffer and is not
equal to pipe.

> Obviously snd_una is used since there is no info on tcp_output for the ack
> header, but I think using more up to date information is better (although
> less data would be injected to the network).
>
> But why is snd_nxt instead of snd_max used? In case of a partial ack,
> snd_nxt is readjusted for retransmit, that means, that it's closer to
> snd_una. What is your opinion, how should this variable be calculated?

Unfortunately the pipe value isn't really calculated at the moment.

-- 
Andre



More information about the freebsd-net mailing list