new stats
authorMike Karels <karels@ucbvax.Berkeley.EDU>
Fri, 20 Feb 1987 09:01:37 +0000 (01:01 -0800)
committerMike Karels <karels@ucbvax.Berkeley.EDU>
Fri, 20 Feb 1987 09:01:37 +0000 (01:01 -0800)
SCCS-vsn: sys/netinet/tcp_output.c 7.3
SCCS-vsn: sys/netinet/tcp_usrreq.c 7.2
SCCS-vsn: sys/netinet/tcp_var.h 7.2

usr/src/sys/netinet/tcp_output.c
usr/src/sys/netinet/tcp_usrreq.c
usr/src/sys/netinet/tcp_var.h

index 15c6798..ad99fa8 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)tcp_output.c        7.2 (Berkeley) %G%
+ *     @(#)tcp_output.c        7.3 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -216,10 +216,27 @@ send:
        m->m_off = MMAXOFF - sizeof (struct tcpiphdr);
        m->m_len = sizeof (struct tcpiphdr);
        if (len) {
        m->m_off = MMAXOFF - sizeof (struct tcpiphdr);
        m->m_len = sizeof (struct tcpiphdr);
        if (len) {
+               if (tp->t_force && len == 1)
+                       tcpstat.tcps_sndprobe++;
+               else if (SEQ_LT(tp->snd_nxt, tp->snd_max)) {
+                       tcpstat.tcps_sndrexmitpack++;
+                       tcpstat.tcps_sndrexmitbyte += len;
+               } else {
+                       tcpstat.tcps_sndpack++;
+                       tcpstat.tcps_sndbyte += len;
+               }
                m->m_next = m_copy(so->so_snd.sb_mb, off, len);
                if (m->m_next == 0)
                        len = 0;
                m->m_next = m_copy(so->so_snd.sb_mb, off, len);
                if (m->m_next == 0)
                        len = 0;
-       }
+       } else if (tp->t_flags & TF_ACKNOW)
+               tcpstat.tcps_sndacks++;
+       else if (flags & (TH_SYN|TH_FIN|TH_RST))
+               tcpstat.tcps_sndctrl++;
+       else if (SEQ_GT(tp->snd_up, tp->snd_una))
+               tcpstat.tcps_sndurg++;
+       else
+               tcpstat.tcps_sndwinup++;
+
        ti = mtod(m, struct tcpiphdr *);
        if (tp->t_template == 0)
                panic("tcp_output");
        ti = mtod(m, struct tcpiphdr *);
        if (tp->t_template == 0)
                panic("tcp_output");
@@ -335,6 +352,7 @@ send:
                        if (tp->t_rtt == 0) {
                                tp->t_rtt = 1;
                                tp->t_rtseq = tp->snd_nxt - len;
                        if (tp->t_rtt == 0) {
                                tp->t_rtt = 1;
                                tp->t_rtseq = tp->snd_nxt - len;
+                               tcpstat.tcps_segstimed++;
                        }
                }
 
                        }
                }
 
@@ -373,6 +391,7 @@ send:
            so->so_options & SO_DONTROUTE);
        if (error)
                return (error);
            so->so_options & SO_DONTROUTE);
        if (error)
                return (error);
+       tcpstat.tcps_sndtotal++;
 
        /*
         * Data sent (as far as we can tell).
 
        /*
         * Data sent (as far as we can tell).
index aa4edd8..b1b5848 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)tcp_usrreq.c        7.1 (Berkeley) %G%
+ *     @(#)tcp_usrreq.c        7.2 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -155,6 +155,7 @@ tcp_usrreq(so, req, m, nam, rights)
                        break;
                }
                soisconnecting(so);
                        break;
                }
                soisconnecting(so);
+               tcpstat.tcps_connattempt++;
                tp->t_state = TCPS_SYN_SENT;
                tp->t_timer[TCPT_KEEP] = TCPTV_KEEP;
                tp->iss = tcp_iss; tcp_iss += TCP_ISSINCR/2;
                tp->t_state = TCPS_SYN_SENT;
                tp->t_timer[TCPT_KEEP] = TCPTV_KEEP;
                tp->iss = tcp_iss; tcp_iss += TCP_ISSINCR/2;
index f7ffb6b..44c3672 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)tcp_var.h   7.1 (Berkeley) %G%
+ *     @(#)tcp_var.h   7.2 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -75,12 +75,60 @@ struct tcpcb {
 #define        intotcpcb(ip)   ((struct tcpcb *)(ip)->inp_ppcb)
 #define        sototcpcb(so)   (intotcpcb(sotoinpcb(so)))
 
 #define        intotcpcb(ip)   ((struct tcpcb *)(ip)->inp_ppcb)
 #define        sototcpcb(so)   (intotcpcb(sotoinpcb(so)))
 
+/*
+ * TCP statistics.
+ * Many of these should be kept per connection,
+ * but that's inconvenient at the moment.
+ */
 struct tcpstat {
 struct tcpstat {
-       int     tcps_badsum;
-       int     tcps_badoff;
-       int     tcps_hdrops;
-       int     tcps_badsegs;
-       int     tcps_unack;
+       u_long  tcps_connattempt;       /* connections initiated */
+       u_long  tcps_accepts;           /* connections accepted */
+       u_long  tcps_connects;          /* connections established */
+       u_long  tcps_drops;             /* connections dropped */
+       u_long  tcps_conndrops;         /* embryonic connections dropped */
+       u_long  tcps_closed;            /* conn. closed (includes drops) */
+       u_long  tcps_segstimed;         /* segs where we tried to get rtt */
+       u_long  tcps_rttupdated;        /* times we succeeded */
+       u_long  tcps_delack;            /* delayed acks sent */
+       u_long  tcps_timeoutdrop;       /* conn. dropped in rxmt timeout */
+       u_long  tcps_rexmttimeo;        /* retransmit timeouts */
+       u_long  tcps_persisttimeo;      /* persist timeouts */
+       u_long  tcps_keeptimeo;         /* keepalive timeouts */
+       u_long  tcps_keepprobe;         /* keepalive probes sent */
+       u_long  tcps_keepdrops;         /* connections dropped in keepalive */
+
+       u_long  tcps_sndtotal;          /* total packets sent */
+       u_long  tcps_sndpack;           /* data packets sent */
+       u_long  tcps_sndbyte;           /* data bytes sent */
+       u_long  tcps_sndrexmitpack;     /* data packets retransmitted */
+       u_long  tcps_sndrexmitbyte;     /* data bytes retransmitted */
+       u_long  tcps_sndacks;           /* ack-only packets sent */
+       u_long  tcps_sndprobe;          /* window probes sent */
+       u_long  tcps_sndurg;            /* packets sent with URG only */
+       u_long  tcps_sndwinup;          /* window update-only packets sent */
+       u_long  tcps_sndctrl;           /* control (SYN|FIN|RST) packets sent */
+
+       u_long  tcps_rcvtotal;          /* total packets received */
+       u_long  tcps_rcvpack;           /* packets received in sequence */
+       u_long  tcps_rcvbyte;           /* bytes received in sequence */
+       u_long  tcps_rcvbadsum;         /* packets received with ccksum errs */
+       u_long  tcps_rcvbadoff;         /* packets received with bad offset */
+       u_long  tcps_rcvshort;          /* packets received too short */
+       u_long  tcps_rcvduppack;        /* duplicate-only packets received */
+       u_long  tcps_rcvdupbyte;        /* duplicate-only bytes received */
+       u_long  tcps_rcvpartduppack;    /* packets with some duplicate data */
+       u_long  tcps_rcvpartdupbyte;    /* dup. bytes in part-dup. packets */
+       u_long  tcps_rcvoopack;         /* out-of-order packets received */
+       u_long  tcps_rcvoobyte;         /* out-of-order bytes received */
+       u_long  tcps_rcvpackafterwin;   /* packets with data after window */
+       u_long  tcps_rcvbyteafterwin;   /* bytes rcvd after window */
+       u_long  tcps_rcvafterclose;     /* packets rcvd after "close" */
+       u_long  tcps_rcvwinprobe;       /* rcvd window probe packets */
+       u_long  tcps_rcvdupack;         /* rcvd duplicate acks */
+       u_long  tcps_rcvacktoomuch;     /* rcvd acks for unsent data */
+       u_long  tcps_rcvackpack;        /* rcvd ack packets */
+       u_long  tcps_rcvackbyte;        /* bytes acked by rcvd acks */
+       u_long  tcps_rcvwinupd;         /* rcvd window update packets */
 };
 
 #ifdef KERNEL
 };
 
 #ifdef KERNEL