Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys have tcp6_drain



details:   https://anonhg.NetBSD.org/src/rev/52dd75e6d464
branches:  trunk
changeset: 523746:52dd75e6d464
user:      itojun <itojun%NetBSD.org@localhost>
date:      Fri Mar 15 09:25:41 2002 +0000

description:
have tcp6_drain

diffstat:

 sys/netinet/tcp_subr.c   |  32 ++++++++++++++++++++++++++++++--
 sys/netinet/tcp_var.h    |   5 ++++-
 sys/netinet6/in6_proto.c |   8 ++++----
 3 files changed, 38 insertions(+), 7 deletions(-)

diffs (102 lines):

diff -r 281b4ec116c6 -r 52dd75e6d464 sys/netinet/tcp_subr.c
--- a/sys/netinet/tcp_subr.c    Fri Mar 15 08:54:40 2002 +0000
+++ b/sys/netinet/tcp_subr.c    Fri Mar 15 09:25:41 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_subr.c,v 1.123 2002/03/08 20:48:44 thorpej Exp $   */
+/*     $NetBSD: tcp_subr.c,v 1.124 2002/03/15 09:25:41 itojun Exp $    */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -102,7 +102,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.123 2002/03/08 20:48:44 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.124 2002/03/15 09:25:41 itojun Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
@@ -1105,6 +1105,34 @@
        }
 }
 
+#ifdef INET6
+void
+tcp6_drain()
+{
+       struct in6pcb *in6p;
+       struct tcpcb *tp;
+       struct in6pcb *head = &tcb6;
+
+       /*
+        * Free the sequence queue of all TCP connections.
+        */
+       for (in6p = head->in6p_next; in6p != head; in6p = in6p->in6p_next) {
+               if ((tp = in6totcpcb(in6p)) != NULL) {
+                       /*
+                        * We may be called from a device's interrupt
+                        * context.  If the tcpcb is already busy,
+                        * just bail out now.
+                        */
+                       if (tcp_reass_lock_try(tp) == 0)
+                               continue;
+                       if (tcp_freeq(tp))
+                               tcpstat.tcps_connsdrained++;
+                       TCP_REASS_UNLOCK(tp);
+               }
+       }
+}
+#endif
+
 /*
  * Notify a tcp user of an asynchronous error;
  * store error as soft error, but wake up user
diff -r 281b4ec116c6 -r 52dd75e6d464 sys/netinet/tcp_var.h
--- a/sys/netinet/tcp_var.h     Fri Mar 15 08:54:40 2002 +0000
+++ b/sys/netinet/tcp_var.h     Fri Mar 15 09:25:41 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_var.h,v 1.88 2002/01/24 02:12:30 itojun Exp $      */
+/*     $NetBSD: tcp_var.h,v 1.89 2002/03/15 09:25:42 itojun Exp $      */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -691,6 +691,9 @@
 void    tcp_dooptions __P((struct tcpcb *,
            u_char *, int, struct tcphdr *, struct tcp_opt_info *));
 void    tcp_drain __P((void));
+#ifdef INET6
+void    tcp6_drain __P((void));
+#endif
 void    tcp_established __P((struct tcpcb *));
 void    tcp_init __P((void));
 #ifdef INET6
diff -r 281b4ec116c6 -r 52dd75e6d464 sys/netinet6/in6_proto.c
--- a/sys/netinet6/in6_proto.c  Fri Mar 15 08:54:40 2002 +0000
+++ b/sys/netinet6/in6_proto.c  Fri Mar 15 09:25:41 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in6_proto.c,v 1.38 2001/12/21 08:54:19 itojun Exp $    */
+/*     $NetBSD: in6_proto.c,v 1.39 2002/03/15 09:25:43 itojun Exp $    */
 /*     $KAME: in6_proto.c,v 1.66 2000/10/10 15:35:47 itojun Exp $      */
 
 /*
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6_proto.c,v 1.38 2001/12/21 08:54:19 itojun Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_proto.c,v 1.39 2002/03/15 09:25:43 itojun Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
@@ -148,9 +148,9 @@
   tcp6_input,  0,              tcp6_ctlinput,  tcp_ctloutput,
   tcp_usrreq,
 #ifdef INET    /* don't call initialization and timeout routines twice */
-  0,           0,              0,              tcp_drain,
+  0,           0,              0,              tcp6_drain,
 #else
-  tcp_init,    0,              tcp_slowtimo,   tcp_drain,
+  tcp_init,    0,              tcp_slowtimo,   tcp6_drain,
 #endif
   tcp_sysctl,
 },



Home | Main Index | Thread Index | Old Index