Source-Changes-HG archive

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

[src/trunk]: src/sys Rename TCPDEBUG to TCP_DEBUG, defopt TCP_DEBUG and TCP_N...



details:   https://anonhg.NetBSD.org/src/rev/58b208f278a8
branches:  trunk
changeset: 512255:58b208f278a8
user:      abs <abs%NetBSD.org@localhost>
date:      Sun Jul 08 16:18:56 2001 +0000

description:
Rename TCPDEBUG to TCP_DEBUG, defopt TCP_DEBUG and TCP_NDEBUG, and
make all usage of tcp_trace dependent on TCP_DEBUG - resulting in
a 31K saving on an INET enabled i386 kernel.

diffstat:

 sys/conf/files           |   3 ++-
 sys/netinet/tcp_debug.c  |  21 ++++++---------------
 sys/netinet/tcp_debug.h  |   8 +++++---
 sys/netinet/tcp_input.c  |  10 +++++++---
 sys/netinet/tcp_output.c |   5 ++++-
 sys/netinet/tcp_usrreq.c |   5 ++++-
 6 files changed, 28 insertions(+), 24 deletions(-)

diffs (240 lines):

diff -r 42505ebb1eb5 -r 58b208f278a8 sys/conf/files
--- a/sys/conf/files    Sun Jul 08 16:14:22 2001 +0000
+++ b/sys/conf/files    Sun Jul 08 16:18:56 2001 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files,v 1.450 2001/07/02 17:17:23 uch Exp $
+#      $NetBSD: files,v 1.451 2001/07/08 16:18:56 abs Exp $
 
 #      @(#)files.newconf       7.5 (Berkeley) 5/10/93
 
@@ -56,6 +56,7 @@
                                COMPAT_13 COMPAT_14 COMPAT_15 COMPAT_NOMID
 
 # networking protocols
+defopt opt_tcp_debug.h TCP_DEBUG TCP_NDEBUG
 defopt opt_inet.h      INET INET6 INET6_MD_CKSUM
 defopt opt_ipsec.h     IPSEC IPSEC_ESP
 defopt opt_inet_conf.h SUBNETSARELOCAL HOSTZEROBROADCAST
diff -r 42505ebb1eb5 -r 58b208f278a8 sys/netinet/tcp_debug.c
--- a/sys/netinet/tcp_debug.c   Sun Jul 08 16:14:22 2001 +0000
+++ b/sys/netinet/tcp_debug.c   Sun Jul 08 16:18:56 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_debug.c,v 1.15 2001/07/08 15:59:18 abs Exp $       */
+/*     $NetBSD: tcp_debug.c,v 1.16 2001/07/08 16:18:57 abs Exp $       */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -65,14 +65,14 @@
  */
 
 #include "opt_inet.h"
+#include "opt_tcp_debug.h"
 
-#ifdef TCPDEBUG
+#ifdef TCP_DEBUG
 /* load symbolic names */
 #define        PRUREQUESTS
 #define        TCPSTATES
 #define        TCPTIMERS
 #define        TANAMES
-#endif
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -106,9 +106,9 @@
 #include <netinet/tcpip.h>
 #include <netinet/tcp_debug.h>
 
-#ifdef TCPDEBUG
+struct tcp_debug tcp_debug[TCP_NDEBUG];
+int    tcp_debx;
 int    tcpconsdebug = 0;
-#endif
 /*
  * Tcp debug routines
  */
@@ -119,11 +119,9 @@
        struct mbuf *m;
        int req;
 {
-#ifdef TCPDEBUG
        tcp_seq seq, ack;
        int len, flags;
        struct tcphdr *th;
-#endif
        struct tcp_debug *td = &tcp_debug[tcp_debx++];
 
        if (tcp_debx == TCP_NDEBUG)
@@ -141,9 +139,7 @@
 #ifdef INET6
        bzero((caddr_t)&td->td_ti6, sizeof (td->td_ti6));
 #endif
-#ifdef TCPDEBUG
        th = NULL;
-#endif
        if (m) {
                struct ip *ip;
                ip = mtod(m, struct ip *);
@@ -152,9 +148,7 @@
                        if (m->m_len < sizeof(td->td_ti))
                                break;
                        bcopy(mtod(m, caddr_t), &td->td_ti, sizeof(td->td_ti));
-#ifdef TCPDEBUG
                        th = (struct tcphdr *)((caddr_t)&td->td_ti + sizeof(struct ip));
-#endif
                        break;
 #ifdef INET6
                case 6:
@@ -162,15 +156,12 @@
                                break;
                        bcopy(mtod(m, caddr_t), &td->td_ti6,
                                sizeof(td->td_ti6));
-#ifdef TCPDEBUG
                        th = (struct tcphdr *)((caddr_t)&td->td_ti6 + sizeof(struct ip6_hdr));
-#endif
                        break;
 #endif
                }
        }
        td->td_req = req;
-#ifdef TCPDEBUG
        if (tcpconsdebug == 0)
                return;
        if (tp)
@@ -228,5 +219,5 @@
            tp->snd_max);
        printf("\tsnd_(wl1,wl2,wnd) (%x,%x,%lx)\n",
            tp->snd_wl1, tp->snd_wl2, tp->snd_wnd);
-#endif /* TCPDEBUG */
 }
+#endif /* TCP_DEBUG */
diff -r 42505ebb1eb5 -r 58b208f278a8 sys/netinet/tcp_debug.h
--- a/sys/netinet/tcp_debug.h   Sun Jul 08 16:14:22 2001 +0000
+++ b/sys/netinet/tcp_debug.h   Sun Jul 08 16:18:56 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_debug.h,v 1.11 2001/05/30 12:04:54 mrg Exp $       */
+/*     $NetBSD: tcp_debug.h,v 1.12 2001/07/08 16:18:57 abs Exp $       */
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -42,6 +42,8 @@
 #include "opt_inet.h"
 #endif
 
+#ifdef TCP_DEBUG
+
 struct tcp_debug {
        n_time  td_time;
        short   td_act;
@@ -75,7 +77,7 @@
 #ifndef TCP_NDEBUG
 #define        TCP_NDEBUG 100
 #endif
-struct tcp_debug tcp_debug[TCP_NDEBUG];
-int    tcp_debx;
+
+#endif /* TCP_DEBUG */
 
 #endif /* _NETINET_TCP_DEBUG_H_ */
diff -r 42505ebb1eb5 -r 58b208f278a8 sys/netinet/tcp_input.c
--- a/sys/netinet/tcp_input.c   Sun Jul 08 16:14:22 2001 +0000
+++ b/sys/netinet/tcp_input.c   Sun Jul 08 16:18:56 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_input.c,v 1.126 2001/06/19 13:42:19 wiz Exp $      */
+/*     $NetBSD: tcp_input.c,v 1.127 2001/07/08 16:18:57 abs Exp $      */
 
 /*
 %%% portions-copyright-nrl-95
@@ -127,6 +127,7 @@
 #include "opt_inet.h"
 #include "opt_ipsec.h"
 #include "opt_inet_csum.h"
+#include "opt_tcp_debug.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -2150,9 +2151,10 @@
                        break;
                }
        }
-       if (so->so_options & SO_DEBUG) {
+#ifdef TCP_DEBUG
+       if (so->so_options & SO_DEBUG)
                tcp_trace(TA_INPUT, ostate, tp, tcp_saveti, 0);
-       }
+#endif
 
        /*
         * Return any desired output.
@@ -2253,8 +2255,10 @@
 #endif
                else
                        so = NULL;
+#ifdef TCP_DEBUG
                if (so && (so->so_options & SO_DEBUG) != 0)
                        tcp_trace(TA_DROP, ostate, tp, tcp_saveti, 0);
+#endif
        }
        if (tcp_saveti)
                m_freem(tcp_saveti);
diff -r 42505ebb1eb5 -r 58b208f278a8 sys/netinet/tcp_output.c
--- a/sys/netinet/tcp_output.c  Sun Jul 08 16:14:22 2001 +0000
+++ b/sys/netinet/tcp_output.c  Sun Jul 08 16:18:56 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_output.c,v 1.66 2001/06/02 16:17:10 thorpej Exp $  */
+/*     $NetBSD: tcp_output.c,v 1.67 2001/07/08 16:18:59 abs Exp $      */
 
 /*
 %%% portions-copyright-nrl-95
@@ -116,6 +116,7 @@
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
+#include "opt_tcp_debug.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -950,6 +951,7 @@
                if (SEQ_GT(tp->snd_nxt + len, tp->snd_max))
                        tp->snd_max = tp->snd_nxt + len;
 
+#ifdef TCP_DEBUG
        /*
         * Trace.
         */
@@ -974,6 +976,7 @@
                }
                tcp_trace(TA_OUTPUT, tp->t_state, tp, m, 0);
        }
+#endif
 
        /*
         * Fill in IP length and desired time to live and
diff -r 42505ebb1eb5 -r 58b208f278a8 sys/netinet/tcp_usrreq.c
--- a/sys/netinet/tcp_usrreq.c  Sun Jul 08 16:14:22 2001 +0000
+++ b/sys/netinet/tcp_usrreq.c  Sun Jul 08 16:18:56 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_usrreq.c,v 1.62 2001/07/03 08:06:19 itojun Exp $   */
+/*     $NetBSD: tcp_usrreq.c,v 1.63 2001/07/08 16:18:59 abs Exp $      */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -103,6 +103,7 @@
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
+#include "opt_tcp_debug.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -605,8 +606,10 @@
        default:
                panic("tcp_usrreq");
        }
+#ifdef TCP_DEBUG
        if (tp && (so->so_options & SO_DEBUG))
                tcp_trace(TA_USER, ostate, tp, NULL, req);
+#endif
 
 release:
        splx(s);



Home | Main Index | Thread Index | Old Index