Date: Tue, 30 Jun 2009 13:53:54 +0000 (UTC) From: Lawrence Stewart <lstewart@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r195192 - projects/tcp_cc_8.x/sys/netinet Message-ID: <200906301353.n5UDrsH0082531@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: lstewart Date: Tue Jun 30 13:53:54 2009 New Revision: 195192 URL: http://svn.freebsd.org/changeset/base/195192 Log: - conn_init/conn_destroy are misleadingly named in terms of where they are actually called from. Rename to cb_init/cb_destroy. - Don't require a module to implement cb_init as was the case previously. Modified: projects/tcp_cc_8.x/sys/netinet/cc.c 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_subr.c projects/tcp_cc_8.x/sys/netinet/tcp_usrreq.c Modified: projects/tcp_cc_8.x/sys/netinet/cc.c ============================================================================== --- projects/tcp_cc_8.x/sys/netinet/cc.c Tue Jun 30 13:38:49 2009 (r195191) +++ projects/tcp_cc_8.x/sys/netinet/cc.c Tue Jun 30 13:53:54 2009 (r195192) @@ -222,8 +222,8 @@ cc_deregister_algo(struct cc_algo *remov tmpfuncs = CC_ALGO(tp); /* Newreno does not require any init. */ CC_ALGO(tp) = &newreno_cc_algo; - if (tmpfuncs->conn_destroy != NULL) - tmpfuncs->conn_destroy(tp); + if (tmpfuncs->cb_destroy != NULL) + tmpfuncs->cb_destroy(tp); } } INP_WUNLOCK(inp); Modified: projects/tcp_cc_8.x/sys/netinet/cc.h ============================================================================== --- projects/tcp_cc_8.x/sys/netinet/cc.h Tue Jun 30 13:38:49 2009 (r195191) +++ projects/tcp_cc_8.x/sys/netinet/cc.h Tue Jun 30 13:53:54 2009 (r195192) @@ -72,14 +72,14 @@ struct cc_algo { /* Cleanup global module state on kldunload. */ int (*mod_destroy) (void); - /* Init CC state for a new connection. */ - int (*conn_init) (struct tcpcb *tp); + /* Init CC state for a new control block. */ + int (*cb_init) (struct tcpcb *tp); - /* Cleanup CC state for a terminating connection. */ - void (*conn_destroy) (struct tcpcb *tp); + /* Cleanup CC state for a terminating control block. */ + void (*cb_destroy) (struct tcpcb *tp); /* Init cwnd for a new connection. */ - /* XXXLS: could this be folded into conn_init? */ + /* XXXLS: could this be renamed conn_init or conn_established? */ void (*cwnd_init) (struct tcpcb *tp); /* Called on receipt of a regular, valid ack. */ Modified: projects/tcp_cc_8.x/sys/netinet/cc_cubic.c ============================================================================== --- projects/tcp_cc_8.x/sys/netinet/cc_cubic.c Tue Jun 30 13:38:49 2009 (r195191) +++ projects/tcp_cc_8.x/sys/netinet/cc_cubic.c Tue Jun 30 13:53:54 2009 (r195192) @@ -62,8 +62,8 @@ __FBSDID("$FreeBSD$"); #include <netinet/vinet.h> /* function prototypes */ -int cubic_conn_init(struct tcpcb *tp); -void cubic_conn_destroy(struct tcpcb *tp); +int cubic_cb_init(struct tcpcb *tp); +void cubic_cb_destroy(struct tcpcb *tp); void cubic_pre_fr(struct tcpcb *tp, struct tcphdr *th); void cubic_post_fr(struct tcpcb *tp, struct tcphdr *th); void cubic_ack_received(struct tcpcb *tp, struct tcphdr *th); @@ -95,8 +95,8 @@ struct cc_algo cubic_cc_algo = { .name = "cubic", .mod_init = NULL, .mod_destroy = NULL, - .conn_init = cubic_conn_init, - .conn_destroy = cubic_conn_destroy, + .cb_init = cubic_cb_init, + .cb_destroy = cubic_cb_destroy, .cwnd_init = cubic_cwnd_init, .ack_received = cubic_ack_received, .pre_fr = cubic_pre_fr, @@ -126,7 +126,7 @@ cubic_cwnd_init(struct tcpcb *tp) * in the control block */ int -cubic_conn_init(struct tcpcb *tp) +cubic_cb_init(struct tcpcb *tp) { struct cubic *cubic_data; @@ -152,7 +152,7 @@ cubic_conn_init(struct tcpcb *tp) * TCP control block. */ void -cubic_conn_destroy(struct tcpcb *tp) +cubic_cb_destroy(struct tcpcb *tp) { if (CC_DATA(tp) != NULL) free(CC_DATA(tp), M_CUBIC); Modified: projects/tcp_cc_8.x/sys/netinet/cc_htcp.c ============================================================================== --- projects/tcp_cc_8.x/sys/netinet/cc_htcp.c Tue Jun 30 13:38:49 2009 (r195191) +++ projects/tcp_cc_8.x/sys/netinet/cc_htcp.c Tue Jun 30 13:53:54 2009 (r195192) @@ -132,8 +132,8 @@ __FBSDID("$FreeBSD$"); /* function prototypes */ int htcp_mod_init(void); -int htcp_conn_init(struct tcpcb *tp); -void htcp_conn_destroy(struct tcpcb *tp); +int htcp_cb_init(struct tcpcb *tp); +void htcp_cb_destroy(struct tcpcb *tp); void htcp_recalc_alpha(struct tcpcb *tp); void htcp_recalc_beta(struct tcpcb *tp); void htcp_pre_fr(struct tcpcb *tp, struct tcphdr *th); @@ -170,9 +170,8 @@ MALLOC_DEFINE(M_HTCP, "htcp data", "Per struct cc_algo htcp_cc_algo = { .name = "htcp", .mod_init = htcp_mod_init, - .mod_destroy = NULL, - .conn_init = htcp_conn_init, - .conn_destroy = htcp_conn_destroy, + .cb_init = htcp_cb_init, + .cb_destroy = htcp_cb_destroy, .cwnd_init = newreno_cwnd_init, .ack_received = htcp_ack_received, .pre_fr = htcp_pre_fr, @@ -187,7 +186,7 @@ struct cc_algo htcp_cc_algo = { * in the control block */ int -htcp_conn_init(struct tcpcb *tp) +htcp_cb_init(struct tcpcb *tp) { struct htcp *htcp_data; @@ -218,7 +217,7 @@ htcp_conn_init(struct tcpcb *tp) * TCP control block. */ void -htcp_conn_destroy(struct tcpcb *tp) +htcp_cb_destroy(struct tcpcb *tp) { #ifdef HTCP_DEBUG printf("deinitialising tcp connection with htcp congestion control\n"); Modified: projects/tcp_cc_8.x/sys/netinet/cc_module.h ============================================================================== --- projects/tcp_cc_8.x/sys/netinet/cc_module.h Tue Jun 30 13:38:49 2009 (r195191) +++ projects/tcp_cc_8.x/sys/netinet/cc_module.h Tue Jun 30 13:53:54 2009 (r195192) @@ -39,7 +39,7 @@ /* * NewReno CC functions */ -int newreno_conn_init(struct tcpcb *tp); +int newreno_cb_init(struct tcpcb *tp); void newreno_cwnd_init(struct tcpcb *tp); void newreno_ack_received(struct tcpcb *tp, struct tcphdr *th); void newreno_pre_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 Tue Jun 30 13:38:49 2009 (r195191) +++ projects/tcp_cc_8.x/sys/netinet/cc_newreno.c Tue Jun 30 13:53:54 2009 (r195192) @@ -50,10 +50,7 @@ __FBSDID("$FreeBSD$"); /* newreno cc function pointers */ struct cc_algo newreno_cc_algo = { .name = "newreno", - .mod_init = NULL, - .mod_destroy = NULL, - .conn_init = newreno_conn_init, - .conn_destroy = NULL, + .cb_init = newreno_cb_init, .cwnd_init = newreno_cwnd_init, .ack_received = newreno_ack_received, .pre_fr = newreno_pre_fr, @@ -63,7 +60,7 @@ struct cc_algo newreno_cc_algo = { }; int -newreno_conn_init(struct tcpcb *tp) +newreno_cb_init(struct tcpcb *tp) { return 0; } Modified: projects/tcp_cc_8.x/sys/netinet/tcp_subr.c ============================================================================== --- projects/tcp_cc_8.x/sys/netinet/tcp_subr.c Tue Jun 30 13:38:49 2009 (r195191) +++ projects/tcp_cc_8.x/sys/netinet/tcp_subr.c Tue Jun 30 13:53:54 2009 (r195192) @@ -737,11 +737,11 @@ tcp_newtcpcb(struct inpcb *inp) CC_ALGO(tp) = CC_DEFAULT(); CC_LIST_RUNLOCK(); - /* If the CC module fails to init, stop building the control block. */ - if (CC_ALGO(tp)->conn_init(tp) > 0) { - uma_zfree(V_tcpcb_zone, tp); - return NULL; - } + if (CC_ALGO(tp)->cb_init != NULL) + if (CC_ALGO(tp)->cb_init(tp) > 0) { + uma_zfree(V_tcpcb_zone, tp); + return NULL; + } #ifdef VIMAGE tp->t_vnet = inp->inp_vnet; @@ -911,8 +911,8 @@ tcp_discardcb(struct tcpcb *tp) tcp_free_sackholes(tp); /* Allow the CC algorithm to clean up after itself. */ - if (CC_ALGO(tp)->conn_destroy != NULL) - CC_ALGO(tp)->conn_destroy(tp); + if (CC_ALGO(tp)->cb_destroy != NULL) + CC_ALGO(tp)->cb_destroy(tp); CC_ALGO(tp) = NULL; inp->inp_ppcb = NULL; Modified: projects/tcp_cc_8.x/sys/netinet/tcp_usrreq.c ============================================================================== --- projects/tcp_cc_8.x/sys/netinet/tcp_usrreq.c Tue Jun 30 13:38:49 2009 (r195191) +++ projects/tcp_cc_8.x/sys/netinet/tcp_usrreq.c Tue Jun 30 13:53:54 2009 (r195192) @@ -1396,8 +1396,8 @@ tcp_ctloutput(struct socket *so, struct * so it's safe to do these things * without ordering concerns. */ - if (CC_ALGO(tp)->conn_destroy != NULL) - CC_ALGO(tp)->conn_destroy(tp); + if (CC_ALGO(tp)->cb_destroy != NULL) + CC_ALGO(tp)->cb_destroy(tp); CC_ALGO(tp) = algo; /* * If something goes pear shaped @@ -1405,14 +1405,16 @@ tcp_ctloutput(struct socket *so, struct * fall back to newreno (which * does not require initialisation). */ - if (algo->conn_init(tp) > 0) { - CC_ALGO(tp) = &newreno_cc_algo; - /* - * The only reason init should - * fail is because of malloc. - */ - error = ENOMEM; - } + if (algo->cb_init != NULL) + if (algo->cb_init(tp) > 0) { + CC_ALGO(tp) = &newreno_cc_algo; + /* + * The only reason init + * should fail is + * because of malloc. + */ + error = ENOMEM; + } break; /* Break the STAILQ_FOREACH. */ } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906301353.n5UDrsH0082531>