Source-Changes-HG archive

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

[src/trunk]: src/sys add a per-socket counter for dropped UDP packets when th...



details:   https://anonhg.NetBSD.org/src/rev/45ab2f654ecc
branches:  trunk
changeset: 569748:45ab2f654ecc
user:      darrenr <darrenr%NetBSD.org@localhost>
date:      Fri Sep 03 18:14:09 2004 +0000

description:
add a per-socket counter for dropped UDP packets when the internal buffers
are full.

diffstat:

 sys/kern/uipc_socket.c   |  8 ++++++--
 sys/kern/uipc_usrreq.c   |  5 +++--
 sys/netinet/udp_usrreq.c |  6 ++++--
 sys/sys/socket.h         |  3 ++-
 sys/sys/socketvar.h      |  3 ++-
 5 files changed, 17 insertions(+), 8 deletions(-)

diffs (123 lines):

diff -r 3c89b411452f -r 45ab2f654ecc sys/kern/uipc_socket.c
--- a/sys/kern/uipc_socket.c    Fri Sep 03 14:24:50 2004 +0000
+++ b/sys/kern/uipc_socket.c    Fri Sep 03 18:14:09 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_socket.c,v 1.106 2004/08/25 09:03:23 itojun Exp $ */
+/*     $NetBSD: uipc_socket.c,v 1.107 2004/09/03 18:14:09 darrenr Exp $        */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.106 2004/08/25 09:03:23 itojun Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.107 2004/09/03 18:14:09 darrenr Exp $");
 
 #include "opt_sock_counters.h"
 #include "opt_sosend_loan.h"
@@ -1600,6 +1600,10 @@
                        break;
                    }
 
+               case SO_OVERFLOWED:
+                       *mtod(m, int *) = so->so_rcv.sb_overflowed;
+                       break;
+
                default:
                        (void)m_free(m);
                        return (ENOPROTOOPT);
diff -r 3c89b411452f -r 45ab2f654ecc sys/kern/uipc_usrreq.c
--- a/sys/kern/uipc_usrreq.c    Fri Sep 03 14:24:50 2004 +0000
+++ b/sys/kern/uipc_usrreq.c    Fri Sep 03 18:14:09 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_usrreq.c,v 1.78 2004/05/22 22:52:13 jonathan Exp $        */
+/*     $NetBSD: uipc_usrreq.c,v 1.79 2004/09/03 18:14:09 darrenr Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000, 2004 The NetBSD Foundation, Inc.
@@ -103,7 +103,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.78 2004/05/22 22:52:13 jonathan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.79 2004/09/03 18:14:09 darrenr Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -152,6 +152,7 @@
            control) == 0) {
                m_freem(control);
                m_freem(m);
+               so2->so_rcv.sb_overflowed++;
                return (ENOBUFS);
        } else {
                sorwakeup(so2);
diff -r 3c89b411452f -r 45ab2f654ecc sys/netinet/udp_usrreq.c
--- a/sys/netinet/udp_usrreq.c  Fri Sep 03 14:24:50 2004 +0000
+++ b/sys/netinet/udp_usrreq.c  Fri Sep 03 18:14:09 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: udp_usrreq.c,v 1.123 2004/07/02 18:19:51 heas Exp $    */
+/*     $NetBSD: udp_usrreq.c,v 1.124 2004/09/03 18:14:09 darrenr Exp $ */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.123 2004/07/02 18:19:51 heas Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.124 2004/09/03 18:14:09 darrenr Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
@@ -511,6 +511,7 @@
                        m_freem(n);
                        if (opts)
                                m_freem(opts);
+                       so->so_rcv.sb_overflowed++;
                        udpstat.udps_fullsock++;
                } else
                        sorwakeup(so);
@@ -556,6 +557,7 @@
                        m_freem(n);
                        if (opts)
                                m_freem(opts);
+                       so->so_rcv.sb_overflowed++;
                        udp6stat.udp6s_fullsock++;
                } else
                        sorwakeup(so);
diff -r 3c89b411452f -r 45ab2f654ecc sys/sys/socket.h
--- a/sys/sys/socket.h  Fri Sep 03 14:24:50 2004 +0000
+++ b/sys/sys/socket.h  Fri Sep 03 18:14:09 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: socket.h,v 1.68 2003/08/07 16:34:14 agc Exp $  */
+/*     $NetBSD: socket.h,v 1.69 2004/09/03 18:14:09 darrenr Exp $      */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -133,6 +133,7 @@
 #define SO_RCVTIMEO    0x1006          /* receive timeout */
 #define        SO_ERROR        0x1007          /* get error status and clear */
 #define        SO_TYPE         0x1008          /* get socket type */
+#define        SO_OVERFLOWED   0x1009          /* datagrams: return packets dropped */
 
 /*
  * Structure used for manipulating linger option.
diff -r 3c89b411452f -r 45ab2f654ecc sys/sys/socketvar.h
--- a/sys/sys/socketvar.h       Fri Sep 03 14:24:50 2004 +0000
+++ b/sys/sys/socketvar.h       Fri Sep 03 18:14:09 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: socketvar.h,v 1.79 2004/07/01 12:42:57 yamt Exp $      */
+/*     $NetBSD: socketvar.h,v 1.80 2004/09/03 18:14:09 darrenr Exp $   */
 
 /*-
  * Copyright (c) 1982, 1986, 1990, 1993
@@ -63,6 +63,7 @@
                                           socket buffer */
        int     sb_flags;               /* flags, see below */
        int     sb_timeo;               /* timeout for read/write */
+       u_long  sb_overflowed;          /* # of drops due to full buffer */
 };
 
 #ifndef SB_MAX



Home | Main Index | Thread Index | Old Index