Calculation of inflight data

Aris Angelo arisangelo33 at gmail.com
Fri May 3 07:28:09 UTC 2013


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;

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;

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?

Thank you,
Aris Angelogiannopoulos


More information about the freebsd-net mailing list