summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2005-05-24 04:20:27 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2005-05-24 04:20:27 +0000
commit3b1f70a1b16fe7fbb4dd2023fca5a05586074d52 (patch)
tree72f3f02f4df5d3c61cca11a91dd883a2a896d7a4 /sys/net
parent361cb4c97740f40c5cd3808004369134731beb44 (diff)
add net.inet.ip.ifq for monitoring and changing ifqueue; similar to netbsd
ok henning
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if.c25
-rw-r--r--sys/net/if.h20
2 files changed, 43 insertions, 2 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 986d622be58..2cee6ff14ca 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.116 2005/05/24 02:49:34 henning Exp $ */
+/* $OpenBSD: if.c,v 1.117 2005/05/24 04:20:25 markus Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -77,6 +77,7 @@
#include <sys/kernel.h>
#include <sys/ioctl.h>
#include <sys/domain.h>
+#include <sys/sysctl.h>
#include <net/if.h>
#include <net/if_dl.h>
@@ -1743,3 +1744,25 @@ ifpromisc(struct ifnet *ifp, int pswitch)
ifr.ifr_flags = ifp->if_flags;
return ((*ifp->if_ioctl)(ifp, SIOCSIFFLAGS, (caddr_t)&ifr));
}
+
+int
+sysctl_ifq(int *name, u_int namelen, void *oldp, size_t *oldlenp,
+ void *newp, size_t newlen, struct ifqueue *ifq)
+{
+ /* All sysctl names at this level are terminal. */
+ if (namelen != 1)
+ return (ENOTDIR);
+
+ switch (name[0]) {
+ case IFQCTL_LEN:
+ return (sysctl_rdint(oldp, oldlenp, newp, ifq->ifq_len));
+ case IFQCTL_MAXLEN:
+ return (sysctl_int(oldp, oldlenp, newp, newlen,
+ &ifq->ifq_maxlen));
+ case IFQCTL_DROPS:
+ return (sysctl_rdint(oldp, oldlenp, newp, ifq->ifq_drops));
+ default:
+ return (EOPNOTSUPP);
+ }
+ /* NOTREACHED */
+}
diff --git a/sys/net/if.h b/sys/net/if.h
index 20227989e4e..9c8f5018c43 100644
--- a/sys/net/if.h
+++ b/sys/net/if.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.h,v 1.69 2005/05/24 02:45:17 reyk Exp $ */
+/* $OpenBSD: if.h,v 1.70 2005/05/24 04:20:25 markus Exp $ */
/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */
/*
@@ -340,6 +340,22 @@ do { \
#define IFQ_MAXLEN 50
#define IFNET_SLOWHZ 1 /* granularity is 1 second */
+/* symbolic names for terminal (per-protocol) CTL_IFQ_ nodes */
+#define IFQCTL_LEN 1
+#define IFQCTL_MAXLEN 2
+#define IFQCTL_DROPS 3
+#define IFQCTL_CONGESTION 4
+#define IFQCTL_MAXID 5
+
+/* sysctl for ifq (per-protocol packet input queue variant of ifqueue) */
+#define CTL_IFQ_NAMES { \
+ { 0, 0 }, \
+ { "len", CTLTYPE_INT }, \
+ { "maxlen", CTLTYPE_INT }, \
+ { "drops", CTLTYPE_INT }, \
+ { "congestion", CTLTYPE_INT }, \
+}
+
/*
* The ifaddr structure contains information about one address
* of an interface. They are maintained by the different address families,
@@ -690,6 +706,8 @@ int if_clone_create(const char *);
int if_clone_destroy(const char *);
void if_congestion(struct ifqueue *);
+int sysctl_ifq(int *, u_int, void *, size_t *, void *, size_t,
+ struct ifqueue *);
int loioctl(struct ifnet *, u_long, caddr_t);
void loopattach(int);