svn commit: r195241 - projects/tcp_cc_8.x/sys/netinet

Lawrence Stewart lstewart at FreeBSD.org
Wed Jul 1 15:11:28 UTC 2009


Author: lstewart
Date: Wed Jul  1 15:11:23 2009
New Revision: 195241
URL: http://svn.freebsd.org/changeset/base/195241

Log:
  Checkpoint commit part way through rename of cwnd_init hook to conn_init, which
  will now cover cwnd initialisation along with other bits and pieces. I think the
  newly named newreno_conn_init function can now be removed and all the code that's in
  it placed in the cc_conn_init() wrapper function.

Modified:
  projects/tcp_cc_8.x/sys/netinet/cc.h
  projects/tcp_cc_8.x/sys/netinet/cc_cubic.c
  projects/tcp_cc_8.x/sys/netinet/cc_htcp.c
  projects/tcp_cc_8.x/sys/netinet/cc_module.h
  projects/tcp_cc_8.x/sys/netinet/cc_newreno.c
  projects/tcp_cc_8.x/sys/netinet/tcp_input.c

Modified: projects/tcp_cc_8.x/sys/netinet/cc.h
==============================================================================
--- projects/tcp_cc_8.x/sys/netinet/cc.h	Wed Jul  1 14:43:06 2009	(r195240)
+++ projects/tcp_cc_8.x/sys/netinet/cc.h	Wed Jul  1 15:11:23 2009	(r195241)
@@ -78,9 +78,8 @@ struct cc_algo {
 	/* Cleanup CC state for a terminating control block. */
 	void (*cb_destroy) (struct tcpcb *tp);
 
-	/* Init cwnd for a new connection. */
-	/* XXXLS: could this be renamed conn_init or conn_established? */
-	void (*cwnd_init) (struct tcpcb *tp);
+	/* Init variables for a newly established connection. */
+	void (*conn_init) (struct tcpcb *tp);
 
 	/* Called on receipt of a regular, valid ack. */
 	void (*ack_received) (struct tcpcb *tp, struct tcphdr *th);

Modified: projects/tcp_cc_8.x/sys/netinet/cc_cubic.c
==============================================================================
--- projects/tcp_cc_8.x/sys/netinet/cc_cubic.c	Wed Jul  1 14:43:06 2009	(r195240)
+++ projects/tcp_cc_8.x/sys/netinet/cc_cubic.c	Wed Jul  1 15:11:23 2009	(r195241)
@@ -70,7 +70,7 @@ void cubic_ack_received(struct tcpcb *tp
 void cubic_after_timeout(struct tcpcb *tp);
 void cubic_after_idle(struct tcpcb *tp);
 void cubic_ssthresh_update(struct tcpcb *tp);
-void cubic_cwnd_init(struct tcpcb *tp);
+void cubic_conn_init(struct tcpcb *tp);
 void cubic_record_rtt(struct tcpcb *tp);
 
 struct cubic {
@@ -93,11 +93,9 @@ MALLOC_DEFINE(M_CUBIC, "cubic data",
 /* function pointers for various hooks into the TCP stack */
 struct cc_algo cubic_cc_algo = {
 	.name = "cubic",
-	.mod_init = NULL,
-	.mod_destroy = NULL,
 	.cb_init = cubic_cb_init,
 	.cb_destroy = cubic_cb_destroy,
-	.cwnd_init = cubic_cwnd_init,
+	.conn_init = cubic_conn_init,
 	.ack_received = cubic_ack_received,
 	.pre_fr = cubic_pre_fr,
 	.post_fr = cubic_post_fr,
@@ -106,11 +104,11 @@ struct cc_algo cubic_cc_algo = {
 };
 
 void
-cubic_cwnd_init(struct tcpcb *tp)
+cubic_conn_init(struct tcpcb *tp)
 {
 	struct cubic *cubic_data = CC_DATA(tp);
 
-	newreno_cwnd_init(tp);
+	newreno_conn_init(tp);
 
 	/*
 	 * Ensure we have a sane initial value for max_cwnd recorded.

Modified: projects/tcp_cc_8.x/sys/netinet/cc_htcp.c
==============================================================================
--- projects/tcp_cc_8.x/sys/netinet/cc_htcp.c	Wed Jul  1 14:43:06 2009	(r195240)
+++ projects/tcp_cc_8.x/sys/netinet/cc_htcp.c	Wed Jul  1 15:11:23 2009	(r195241)
@@ -172,7 +172,7 @@ struct cc_algo htcp_cc_algo = {
 	.mod_init = htcp_mod_init,
 	.cb_init = htcp_cb_init,
 	.cb_destroy = htcp_cb_destroy,
-	.cwnd_init = newreno_cwnd_init,
+	.conn_init = newreno_conn_init,
 	.ack_received = htcp_ack_received,
 	.pre_fr = htcp_pre_fr,
 	.post_fr = htcp_post_fr,

Modified: projects/tcp_cc_8.x/sys/netinet/cc_module.h
==============================================================================
--- projects/tcp_cc_8.x/sys/netinet/cc_module.h	Wed Jul  1 14:43:06 2009	(r195240)
+++ projects/tcp_cc_8.x/sys/netinet/cc_module.h	Wed Jul  1 15:11:23 2009	(r195241)
@@ -40,7 +40,7 @@
  * NewReno CC functions
  */
 int	newreno_cb_init(struct tcpcb *tp);
-void	newreno_cwnd_init(struct tcpcb *tp);
+void	newreno_conn_init(struct tcpcb *tp);
 void	newreno_ack_received(struct tcpcb *tp, struct tcphdr *th);
 void	newreno_pre_fr(struct tcpcb *tp, struct tcphdr *th);
 void	newreno_post_fr(struct tcpcb *tp, struct tcphdr *th);

Modified: projects/tcp_cc_8.x/sys/netinet/cc_newreno.c
==============================================================================
--- projects/tcp_cc_8.x/sys/netinet/cc_newreno.c	Wed Jul  1 14:43:06 2009	(r195240)
+++ projects/tcp_cc_8.x/sys/netinet/cc_newreno.c	Wed Jul  1 15:11:23 2009	(r195241)
@@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$");
 struct cc_algo newreno_cc_algo = {
 	.name = "newreno",
 	.cb_init = newreno_cb_init,
-	.cwnd_init = newreno_cwnd_init,
+	.conn_init = newreno_conn_init,
 	.ack_received = newreno_ack_received,
 	.pre_fr = newreno_pre_fr,
 	.post_fr = newreno_post_fr,
@@ -89,7 +89,7 @@ newreno_ssthresh_update(struct tcpcb *tp
  * otherwise use the sysctl variables configured by the administrator
  */
 void
-newreno_cwnd_init(struct tcpcb *tp)
+newreno_conn_init(struct tcpcb *tp)
 {
 	struct hc_metrics_lite metrics;
 	struct inpcb *inp = tp->t_inpcb;

Modified: projects/tcp_cc_8.x/sys/netinet/tcp_input.c
==============================================================================
--- projects/tcp_cc_8.x/sys/netinet/tcp_input.c	Wed Jul  1 14:43:06 2009	(r195240)
+++ projects/tcp_cc_8.x/sys/netinet/tcp_input.c	Wed Jul  1 15:11:23 2009	(r195241)
@@ -215,7 +215,7 @@ static void	 tcp_pulloutofband(struct so
 static void	 tcp_xmit_timer(struct tcpcb *, int);
 static void	 tcp_newreno_partial_ack(struct tcpcb *, struct tcphdr *);
 static void inline	cc_ack_received(struct tcpcb *tp, struct tcphdr *th);
-static void inline	cc_cwnd_init(struct tcpcb *tp);
+static void inline	cc_conn_init(struct tcpcb *tp);
 static void inline	cc_pre_fr(struct tcpcb *tp, struct tcphdr *th);
 static void inline	cc_post_fr(struct tcpcb *tp, struct tcphdr *th);
 
@@ -232,17 +232,16 @@ cc_ack_received(struct tcpcb *tp, struct
 }
 
 static void inline
-cc_cwnd_init(struct tcpcb *tp)
+cc_conn_init(struct tcpcb *tp)
 {
 	INP_WLOCK_ASSERT(tp->t_inpcb);
 
 	/*
-	 * XXXLS: Should rename this hook and do
-	 * ssthresh init in there as well
+	 * XXXLS: Should do ssthresh init in there as well
 	 */
 
-	if (CC_ALGO(tp)->cwnd_init != NULL)
-		CC_ALGO(tp)->cwnd_init(tp);
+	if (CC_ALGO(tp)->conn_init != NULL)
+		CC_ALGO(tp)->conn_init(tp);
 }
 
 static void inline
@@ -1632,6 +1631,7 @@ tcp_do_segment(struct mbuf *m, struct tc
 				thflags &= ~TH_SYN;
 			} else {
 				tp->t_state = TCPS_ESTABLISHED;
+				cc_conn_init(tp);
 				tcp_timer_activate(tp, TT_KEEP, tcp_keepidle);
 			}
 		} else {
@@ -2035,6 +2035,7 @@ tcp_do_segment(struct mbuf *m, struct tc
 			tp->t_flags &= ~TF_NEEDFIN;
 		} else {
 			tp->t_state = TCPS_ESTABLISHED;
+			cc_conn_init(tp);
 			tcp_timer_activate(tp, TT_KEEP, tcp_keepidle);
 		}
 		/*
@@ -3303,8 +3304,6 @@ tcp_mss(struct tcpcb *tp, int offer)
 	if (metrics.rmx_bandwidth)
 		tp->snd_bandwidth = metrics.rmx_bandwidth;
 
-	cc_cwnd_init(tp);
-
 	/* Check the interface for TSO capabilities. */
 	if (mtuflags & CSUM_TSO)
 		tp->t_flags |= TF_TSO;


More information about the svn-src-projects mailing list