diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2015-03-25 11:49:03 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2015-03-25 11:49:03 +0000 |
commit | 30c37c09fd2268eb453123f618b54f8bd08a09bd (patch) | |
tree | 4c2d0f2ccd8443eeb5f1e181f430419eafb6d628 /sys/net/if_var.h | |
parent | 25f64aa8a945b4a2689ef7d8abe56b6fb59694fd (diff) |
introduce code for network input queues. these are to replace the
use of struct ifqueue for things handled by softnet. they instead
use an mbuf_queue (yay mpsafe) and wrap up the schednetisr and
if_congestion handling.
ok mpi@
Diffstat (limited to 'sys/net/if_var.h')
-rw-r--r-- | sys/net/if_var.h | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/sys/net/if_var.h b/sys/net/if_var.h index 00ffcedfec5..101a53b1f18 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_var.h,v 1.21 2015/03/18 12:23:15 dlg Exp $ */ +/* $OpenBSD: if_var.h,v 1.22 2015/03/25 11:49:02 dlg Exp $ */ /* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */ /* @@ -37,6 +37,7 @@ #define _NET_IF_VAR_H_ #include <sys/queue.h> +#include <sys/mbuf.h> #ifdef _KERNEL #include <net/hfsc.h> #endif @@ -68,8 +69,6 @@ #include <sys/time.h> -struct mbuf; -struct mbuf_list; struct proc; struct rtentry; struct socket; @@ -391,6 +390,28 @@ do { \ #define IF_WIRED_DEFAULT_PRIORITY 0 #define IF_WIRELESS_DEFAULT_PRIORITY 4 +/* + * Network stack input queues. + */ +struct niqueue { + struct mbuf_queue ni_q; + u_int ni_isr; +}; + +#define NIQUEUE_INITIALIZER(_len, _isr) \ + { MBUF_QUEUE_INITIALIZER((_len), IPL_NET), (_isr) } + +void niq_init(struct niqueue *, u_int, u_int); +int niq_enqueue(struct niqueue *, struct mbuf *); +int niq_enlist(struct niqueue *, struct mbuf_list *); + +#define niq_dequeue(_q) mq_dequeue(&(_q)->ni_q) +#define niq_dechain(_q) mq_dechain(&(_q)->ni_q) +#define niq_delist(_q, _ml) mq_delist(&(_q)->ni_q, (_ml)) +#define niq_filter(_q, _f, _c) mq_filter(&(_q)->ni_q, (_f), (_c)) +#define niq_len(_q) mq_len(&(_q)->ni_q) +#define niq_drops(_q) mq_drops(&(_q)->ni_q) + extern struct ifnet_head ifnet; extern struct ifnet *lo0ifp; @@ -423,6 +444,8 @@ int if_clone_destroy(const char *); int sysctl_ifq(int *, u_int, void *, size_t *, void *, size_t, struct ifqueue *); +int sysctl_niq(int *, u_int, void *, size_t *, void *, size_t, + struct niqueue *); int loioctl(struct ifnet *, u_long, caddr_t); void loopattach(int); |