Re: svn commit: r298743 - in head/sys/netinet: . tcp_stacks

2016-05-03 Thread Andrew Thompson
On 29 April 2016 at 01:27, Randall Stewart  wrote:

> Author: rrs
> Date: Thu Apr 28 13:27:12 2016
> New Revision: 298743
> URL: https://svnweb.freebsd.org/changeset/base/298743
>
> Log:
>   This cleans up the timers code in TCP to start using the new
>   async_drain functionality. This as been tested in NF as well as
>   by Verisign. Still to do in here is to remove all the old flags. They
>   are currently left being maintained but probably are no longer needed.
>
>   Sponsored by: Netflix Inc.
>   Differential Revision:http://reviews.freebsd.org/D5924
>
> Modified:
>   head/sys/netinet/tcp_stacks/fastpath.c
>   head/sys/netinet/tcp_subr.c
>   head/sys/netinet/tcp_timer.c
>   head/sys/netinet/tcp_timer.h
>   head/sys/netinet/tcp_var.h
>
> Modified: head/sys/netinet/tcp_stacks/fastpath.c
>
> ==
> --- head/sys/netinet/tcp_stacks/fastpath.c  Thu Apr 28 13:00:40 2016
>   (r298742)
> +++ head/sys/netinet/tcp_stacks/fastpath.c  Thu Apr 28 13:27:12 2016
>   (r298743)
> @@ -2386,7 +2386,6 @@ struct tcp_function_block __tcp_fastslow
> NULL,
> NULL,
> NULL,
> -   NULL,
> 0,
> 0
>
> @@ -2403,7 +2402,6 @@ struct tcp_function_block __tcp_fastack
> NULL,
> NULL,
> NULL,
> -   NULL,
> 0,
> 0
>  };
>


Is there a reason not to use named struct initialisers here? It is
self-describing and also does not require the nulls to be set.  ie {
.tfb_tcp_output
= tcp_output , ... }

cheers,
Andrew
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r298743 - in head/sys/netinet: . tcp_stacks

2016-04-28 Thread Randall Stewart
Author: rrs
Date: Thu Apr 28 13:27:12 2016
New Revision: 298743
URL: https://svnweb.freebsd.org/changeset/base/298743

Log:
  This cleans up the timers code in TCP to start using the new
  async_drain functionality. This as been tested in NF as well as
  by Verisign. Still to do in here is to remove all the old flags. They
  are currently left being maintained but probably are no longer needed.
  
  Sponsored by: Netflix Inc.
  Differential Revision:http://reviews.freebsd.org/D5924

Modified:
  head/sys/netinet/tcp_stacks/fastpath.c
  head/sys/netinet/tcp_subr.c
  head/sys/netinet/tcp_timer.c
  head/sys/netinet/tcp_timer.h
  head/sys/netinet/tcp_var.h

Modified: head/sys/netinet/tcp_stacks/fastpath.c
==
--- head/sys/netinet/tcp_stacks/fastpath.c  Thu Apr 28 13:00:40 2016
(r298742)
+++ head/sys/netinet/tcp_stacks/fastpath.c  Thu Apr 28 13:27:12 2016
(r298743)
@@ -2386,7 +2386,6 @@ struct tcp_function_block __tcp_fastslow
NULL,
NULL,
NULL,
-   NULL,
0,
0
 
@@ -2403,7 +2402,6 @@ struct tcp_function_block __tcp_fastack 
NULL,
NULL,
NULL,
-   NULL,
0,
0
 };

Modified: head/sys/netinet/tcp_subr.c
==
--- head/sys/netinet/tcp_subr.c Thu Apr 28 13:00:40 2016(r298742)
+++ head/sys/netinet/tcp_subr.c Thu Apr 28 13:27:12 2016(r298743)
@@ -244,7 +244,6 @@ static struct inpcb *tcp_mtudisc_notify(
 static void tcp_mtudisc(struct inpcb *, int);
 static char *  tcp_log_addr(struct in_conninfo *inc, struct tcphdr *th,
void *ip4hdr, const void *ip6hdr);
-static voidtcp_timer_discard(struct tcpcb *, uint32_t);
 
 
 static struct tcp_function_block tcp_def_funcblk = {
@@ -258,7 +257,6 @@ static struct tcp_function_block tcp_def
NULL,
NULL,
NULL,
-   NULL,
0,
0
 };
@@ -528,7 +526,6 @@ register_tcp_functions(struct tcp_functi
return (EINVAL);
}
if (blk->tfb_tcp_timer_stop_all ||
-   blk->tfb_tcp_timers_left ||
blk->tfb_tcp_timer_activate ||
blk->tfb_tcp_timer_active ||
blk->tfb_tcp_timer_stop) {
@@ -537,7 +534,6 @@ register_tcp_functions(struct tcp_functi
 * must have them all.
 */
if ((blk->tfb_tcp_timer_stop_all == NULL) ||
-   (blk->tfb_tcp_timers_left  == NULL) ||
(blk->tfb_tcp_timer_activate == NULL) ||
(blk->tfb_tcp_timer_active == NULL) ||
(blk->tfb_tcp_timer_stop == NULL)) {
@@ -1343,13 +1339,21 @@ tcp_discardcb(struct tcpcb *tp)
 * callout, and the last discard function called will take care of
 * deleting the tcpcb.
 */
+   tp->t_timers->tt_draincnt = 0;
tcp_timer_stop(tp, TT_REXMT);
tcp_timer_stop(tp, TT_PERSIST);
tcp_timer_stop(tp, TT_KEEP);
tcp_timer_stop(tp, TT_2MSL);
tcp_timer_stop(tp, TT_DELACK);
if (tp->t_fb->tfb_tcp_timer_stop_all) {
-   /* Call the stop-all function of the methods */
+   /* 
+* Call the stop-all function of the methods, 
+* this function should call the tcp_timer_stop()
+* method with each of the function specific timeouts.
+* That stop will be called via the tfb_tcp_timer_stop()
+* which should use the async drain function of the 
+* callout system (see tcp_var.h).
+*/
tp->t_fb->tfb_tcp_timer_stop_all(tp);
}
 
@@ -1434,13 +1438,8 @@ tcp_discardcb(struct tcpcb *tp)
 
CC_ALGO(tp) = NULL;
inp->inp_ppcb = NULL;
-   if ((tp->t_timers->tt_flags & TT_MASK) == 0) {
+   if (tp->t_timers->tt_draincnt == 0) {
/* We own the last reference on tcpcb, let's free it. */
-   if ((tp->t_fb->tfb_tcp_timers_left) &&
-   (tp->t_fb->tfb_tcp_timers_left(tp))) {
-   /* Some fb timers left running! */
-   return;
-   }
if (tp->t_fb->tfb_tcp_fb_fini)
(*tp->t_fb->tfb_tcp_fb_fini)(tp);
refcount_release(>t_fb->tfb_refcnt);
@@ -1453,45 +1452,12 @@ tcp_discardcb(struct tcpcb *tp)
 }
 
 void
-tcp_timer_2msl_discard(void *xtp)
-{
-
-   tcp_timer_discard((struct tcpcb *)xtp, TT_2MSL);
-}
-
-void
-tcp_timer_keep_discard(void *xtp)
-{
-
-   tcp_timer_discard((struct tcpcb *)xtp, TT_KEEP);
-}
-
-void
-tcp_timer_persist_discard(void *xtp)
-{
-
-   tcp_timer_discard((struct tcpcb *)xtp, TT_PERSIST);
-}
-
-void
-tcp_timer_rexmt_discard(void *xtp)
-{
-
-   tcp_timer_discard((struct tcpcb *)xtp, TT_REXMT);
-}
-
-void
-tcp_timer_delack_discard(void *xtp)
-{
-
-