Below is a patch for sender-side D-SACK. Currently, DragonFlyBSD-current (head?) treats D-SACK segments as normal duplicate ACKs. This behavior reduces TCP performance in some cases. With this patch, D-SACK segments are not treated as duplicate ACKs. This patch improves TCP performance in some cases.
The following page shows one case where TCP performance is improved. http://www.demizu.org/~noritosi/memo/2005/0728/ Thanks. Regards, Noritoshi Demizu Index: netinet/tcp_input.c =================================================================== RCS file: /home/cvsup/DragonFlyBSD/dcvs/src/sys/netinet/tcp_input.c,v retrieving revision 1.60 diff -u -r1.60 tcp_input.c --- netinet/tcp_input.c 10 May 2005 15:48:10 -0000 1.60 +++ netinet/tcp_input.c 28 Jul 2005 08:09:02 -0000 @@ -1895,7 +1895,8 @@ if (SEQ_LEQ(th->th_ack, tp->snd_una)) { if (TCP_DO_SACK(tp)) tcp_sack_update_scoreboard(tp, &to); - if (tlen != 0 || tiwin != tp->snd_wnd) { + if (tlen != 0 || tiwin != tp->snd_wnd || + (to.to_flags & TOF_DSACK)) { tp->t_dupacks = 0; break; } Index: netinet/tcp_sack.c =================================================================== RCS file: /home/cvsup/DragonFlyBSD/dcvs/src/sys/netinet/tcp_sack.c,v retrieving revision 1.2 diff -u -r1.2 tcp_sack.c --- netinet/tcp_sack.c 9 Mar 2005 06:54:34 -0000 1.2 +++ netinet/tcp_sack.c 28 Jul 2005 08:09:02 -0000 @@ -261,9 +261,10 @@ int startblock; int i; - if (tcp_sack_ndsack_blocks(blocks, numblocks, tp->snd_una) > 0) + if (tcp_sack_ndsack_blocks(blocks, numblocks, tp->snd_una) > 0) { startblock = 1; - else + to->to_flags |= TOF_DSACK; + } else startblock = 0; for (i = startblock; i < numblocks; i++) { Index: netinet/tcp_var.h =================================================================== RCS file: /home/cvsup/DragonFlyBSD/dcvs/src/sys/netinet/tcp_var.h,v retrieving revision 1.35 diff -u -r1.35 tcp_var.h --- netinet/tcp_var.h 10 May 2005 15:48:10 -0000 1.35 +++ netinet/tcp_var.h 28 Jul 2005 08:09:02 -0000 @@ -408,6 +408,7 @@ #define TOF_SCALE 0x0020 #define TOF_SACK_PERMITTED 0x0040 #define TOF_SACK 0x0080 +#define TOF_DSACK 0x0100 u_int32_t to_tsval; u_int32_t to_tsecr; tcp_cc to_cc; /* holds CC or CCnew */
