svn commit: r195164 - projects/tcp_cc_8.x/sys/netinet
Lawrence Stewart
lstewart at FreeBSD.org
Mon Jun 29 17:30:53 UTC 2009
Author: lstewart
Date: Mon Jun 29 17:30:51 2009
New Revision: 195164
URL: http://svn.freebsd.org/changeset/base/195164
Log:
Move logic to calc bytes ACKed by an incoming regular data ACK into a handy
macro which will be useful in the near future.
Modified:
projects/tcp_cc_8.x/sys/netinet/tcp_input.c
projects/tcp_cc_8.x/sys/netinet/tcp_sack.c
projects/tcp_cc_8.x/sys/netinet/tcp_var.h
Modified: projects/tcp_cc_8.x/sys/netinet/tcp_input.c
==============================================================================
--- projects/tcp_cc_8.x/sys/netinet/tcp_input.c Mon Jun 29 16:55:57 2009 (r195163)
+++ projects/tcp_cc_8.x/sys/netinet/tcp_input.c Mon Jun 29 17:30:51 2009 (r195164)
@@ -1323,7 +1323,7 @@ tcp_do_segment(struct mbuf *m, struct tc
ticks - tp->t_rtttime);
}
tcp_xmit_bandwidth_limit(tp, th->th_ack);
- acked = th->th_ack - tp->snd_una;
+ acked = BYTES_ACKED(tp, th);
TCPSTAT_INC(tcps_rcvackpack);
TCPSTAT_ADD(tcps_rcvackbyte, acked);
sbdrop(&so->so_snd, acked);
@@ -2220,7 +2220,7 @@ process_ACK:
("tcp_input: process_ACK ti_locked %d", ti_locked));
INP_WLOCK_ASSERT(tp->t_inpcb);
- acked = th->th_ack - tp->snd_una;
+ acked = BYTES_ACKED(tp, th);
TCPSTAT_INC(tcps_rcvackpack);
TCPSTAT_ADD(tcps_rcvackbyte, acked);
@@ -3341,7 +3341,7 @@ tcp_newreno_partial_ack(struct tcpcb *tp
* Set snd_cwnd to one segment beyond acknowledged offset.
* (tp->snd_una has not yet been updated when this function is called.)
*/
- tp->snd_cwnd = tp->t_maxseg + (th->th_ack - tp->snd_una);
+ tp->snd_cwnd = tp->t_maxseg + BYTES_ACKED(tp, th);
tp->t_flags |= TF_ACKNOW;
(void) tcp_output(tp);
tp->snd_cwnd = ocwnd;
@@ -3351,8 +3351,8 @@ tcp_newreno_partial_ack(struct tcpcb *tp
* Partial window deflation. Relies on fact that tp->snd_una
* not updated yet.
*/
- if (tp->snd_cwnd > th->th_ack - tp->snd_una)
- tp->snd_cwnd -= th->th_ack - tp->snd_una;
+ if (tp->snd_cwnd > BYTES_ACKED(tp, th))
+ tp->snd_cwnd -= BYTES_ACKED(tp, th);
else
tp->snd_cwnd = 0;
tp->snd_cwnd += tp->t_maxseg;
Modified: projects/tcp_cc_8.x/sys/netinet/tcp_sack.c
==============================================================================
--- projects/tcp_cc_8.x/sys/netinet/tcp_sack.c Mon Jun 29 16:55:57 2009 (r195163)
+++ projects/tcp_cc_8.x/sys/netinet/tcp_sack.c Mon Jun 29 17:30:51 2009 (r195164)
@@ -576,7 +576,7 @@ tcp_sack_partialack(struct tcpcb *tp, st
tcp_timer_activate(tp, TT_REXMT, 0);
tp->t_rtttime = 0;
/* Send one or 2 segments based on how much new data was acked. */
- if (((th->th_ack - tp->snd_una) / tp->t_maxseg) > 2)
+ if ((BYTES_ACKED(tp, th) / tp->t_maxseg) > 2)
num_segs = 2;
tp->snd_cwnd = (tp->sackhint.sack_bytes_rexmit +
(tp->snd_nxt - tp->sack_newdata) + num_segs * tp->t_maxseg);
Modified: projects/tcp_cc_8.x/sys/netinet/tcp_var.h
==============================================================================
--- projects/tcp_cc_8.x/sys/netinet/tcp_var.h Mon Jun 29 16:55:57 2009 (r195163)
+++ projects/tcp_cc_8.x/sys/netinet/tcp_var.h Mon Jun 29 17:30:51 2009 (r195164)
@@ -232,6 +232,8 @@ struct tcpcb {
#define ENTER_FASTRECOVERY(tp) tp->t_flags |= TF_FASTRECOVERY
#define EXIT_FASTRECOVERY(tp) tp->t_flags &= ~TF_FASTRECOVERY
+#define BYTES_ACKED(tp, th) (th->th_ack - tp->snd_una)
+
/*
* Flags for the t_oobflags field.
*/
More information about the svn-src-projects
mailing list