Help me understand this SACK code in tcp_output()

hiren panchasara hiren at strugglingcoder.info
Wed Oct 21 01:32:02 UTC 2015


tcp_output() starts out with following two vars set to zero:

sack_rxmit = 0;
sack_bytes_rxmt = 0;

And if we are in recovery and trying to send from holes, i.e.
if ((tp->t_flags & TF_SACK_PERMIT) && IN_FASTRECOVERY(tp->t_flags) &&
    (p = tcp_sack_output(tp, &sack_bytes_rxmt))) {

And if we end up with if (len > 0), we set sack_rxmit = 1;

A little below is following code which I do not understand:

/* If sack_rxmit is true we are retransmitting from the scoreboard
 * in which case len is already set.
 */
  if (sack_rxmit == 0) {
	if (sack_bytes_rxmt == 0)
	    ......
	else {



	}

 }

What I do not understand is how can we get into the 'else' part.

AFAICT,
sack_rxmit: when TRUE, we are retransmitting from the scoreboard
sack_bytes_rxmt: number of retransmitted bytes from the scoreboard.

Now, if sack_rxmit is false, how can sack_bytes_rxmt be > 0?

OR is there something I am missing in the code OR how SACK works?

Cheers,
Hiren
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 603 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-transport/attachments/20151020/bd50cdd6/attachment.bin>


More information about the freebsd-transport mailing list