From c54115d548403a18776fc113c093f02b9b1b7cd6 Mon Sep 17 00:00:00 2001 From: ps Date: Thu, 17 Feb 2005 23:04:56 +0000 Subject: [PATCH] Remove 2 (SACK) fields from the tcpcb. These are only used by a function that is called from tcp_input(), so they oughta be passed on the stack instead of stuck in the tcpcb. Submitted by: Mohan Srinivasan --- sys/netinet/tcp_input.c | 7 ++----- sys/netinet/tcp_reass.c | 7 ++----- sys/netinet/tcp_sack.c | 15 ++++++++------- sys/netinet/tcp_var.h | 4 +--- 4 files changed, 13 insertions(+), 20 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index c10a94c4b8b1..6255042a55b6 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -2295,11 +2295,8 @@ dodata: /* XXX */ thflags = tcp_reass(tp, th, &tlen, m); tp->t_flags |= TF_ACKNOW; } - if (tp->sack_enable) { - tp->rcv_laststart = th->th_seq; /* last recv'd segment*/ - tp->rcv_lastend = th->th_seq + tlen; - tcp_update_sack_list(tp); - } + if (tp->sack_enable) + tcp_update_sack_list(tp, th->th_seq, th->th_seq + tlen); /* * Note the amount of data that peer has sent into * our window, in order to estimate the sender's diff --git a/sys/netinet/tcp_reass.c b/sys/netinet/tcp_reass.c index c10a94c4b8b1..6255042a55b6 100644 --- a/sys/netinet/tcp_reass.c +++ b/sys/netinet/tcp_reass.c @@ -2295,11 +2295,8 @@ dodata: /* XXX */ thflags = tcp_reass(tp, th, &tlen, m); tp->t_flags |= TF_ACKNOW; } - if (tp->sack_enable) { - tp->rcv_laststart = th->th_seq; /* last recv'd segment*/ - tp->rcv_lastend = th->th_seq + tlen; - tcp_update_sack_list(tp); - } + if (tp->sack_enable) + tcp_update_sack_list(tp, th->th_seq, th->th_seq + tlen); /* * Note the amount of data that peer has sent into * our window, in order to estimate the sender's diff --git a/sys/netinet/tcp_sack.c b/sys/netinet/tcp_sack.c index 8637fa29e53b..afedbdf3bf38 100644 --- a/sys/netinet/tcp_sack.c +++ b/sys/netinet/tcp_sack.c @@ -175,8 +175,9 @@ TUNABLE_INT("net.inet.tcp.sack.enable", &tcp_do_sack); * prediction mode), and it updates the ordered list of sacks. */ void -tcp_update_sack_list(tp) +tcp_update_sack_list(tp, rcv_laststart, rcv_lastend) struct tcpcb *tp; + tcp_seq rcv_laststart, rcv_lastend; { /* * First reported block MUST be the most recent one. Subsequent @@ -206,10 +207,10 @@ tcp_update_sack_list(tp) tp->rcv_numsacks -= count; if (tp->rcv_numsacks == 0) { /* no sack blocks currently (fast path) */ tcp_clean_sackreport(tp); - if (SEQ_LT(tp->rcv_nxt, tp->rcv_laststart)) { + if (SEQ_LT(tp->rcv_nxt, rcv_laststart)) { /* ==> need first sack block */ - tp->sackblks[0].start = tp->rcv_laststart; - tp->sackblks[0].end = tp->rcv_lastend; + tp->sackblks[0].start = rcv_laststart; + tp->sackblks[0].end = rcv_lastend; tp->rcv_numsacks = 1; } return; @@ -217,14 +218,14 @@ tcp_update_sack_list(tp) /* Otherwise, sack blocks are already present. */ for (i = 0; i < tp->rcv_numsacks; i++) tp->sackblks[i] = temp[i]; /* first copy back sack list */ - if (SEQ_GEQ(tp->rcv_nxt, tp->rcv_lastend)) + if (SEQ_GEQ(tp->rcv_nxt, rcv_lastend)) return; /* sack list remains unchanged */ /* * From here, segment just received should be (part of) the 1st sack. * Go through list, possibly coalescing sack block entries. */ - firstsack.start = tp->rcv_laststart; - firstsack.end = tp->rcv_lastend; + firstsack.start = rcv_laststart; + firstsack.end = rcv_lastend; for (i = 0; i < tp->rcv_numsacks; i++) { sack = tp->sackblks[i]; if (SEQ_LT(sack.end, firstsack.start) || diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index f6473467c812..9047809bc4f0 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -187,8 +187,6 @@ struct tcpcb { int sack_enable; /* enable SACK for this connection */ int snd_numholes; /* number of holes seen by sender */ struct sackhole *snd_holes; /* linked list of holes (sorted) */ - tcp_seq rcv_laststart; /* start of last segment recd. */ - tcp_seq rcv_lastend; /* end of ... */ tcp_seq rcv_lastsack; /* last seq number(+1) sack'd by rcv'r*/ int rcv_numsacks; /* # distinct sack blks present */ struct sackblk sackblks[MAX_SACK_BLKS]; /* seq nos. of sack blocks */ @@ -575,7 +573,7 @@ extern u_long tcp_recvspace; tcp_seq tcp_new_isn(struct tcpcb *); int tcp_sack_option(struct tcpcb *,struct tcphdr *,u_char *,int); -void tcp_update_sack_list(struct tcpcb *tp); +void tcp_update_sack_list(struct tcpcb *tp, tcp_seq rcv_laststart, tcp_seq rcv_lastend); void tcp_del_sackholes(struct tcpcb *, struct tcphdr *); void tcp_clean_sackreport(struct tcpcb *tp); void tcp_sack_adjust(struct tcpcb *tp);