From owner-svn-src-projects@FreeBSD.ORG Mon Jun 29 17:30:52 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B9130106564A; Mon, 29 Jun 2009 17:30:52 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 418F98FC35; Mon, 29 Jun 2009 17:30:52 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5THUqMS050808; Mon, 29 Jun 2009 17:30:52 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5THUqpU050804; Mon, 29 Jun 2009 17:30:52 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <200906291730.n5THUqpU050804@svn.freebsd.org> From: Lawrence Stewart Date: Mon, 29 Jun 2009 17:30:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r195164 - projects/tcp_cc_8.x/sys/netinet X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jun 2009 17:30:53 -0000 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. */