From 1e5c7466fc7a8db3a30171d28edf3e2e14a97f6b Mon Sep 17 00:00:00 2001 From: wollman Date: Mon, 22 Jul 1996 20:06:01 +0000 Subject: Add a new, better mechanism for sticking packets onto ifqueues. The old system had the misfeature that the only policy it could implement was tail-drop; the new IF_ENQ_DROP macro/function makes it possible to implement more sophisticated queueing policies on a system-wide basis. No code actually uses this yet (although on my machine I have converted the ethernet and (polled) loopback to use it). --- sys/net/if.h | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'sys/net/if.h') diff --git a/sys/net/if.h b/sys/net/if.h index 0827f50..3df1979 100644 --- a/sys/net/if.h +++ b/sys/net/if.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)if.h 8.1 (Berkeley) 6/10/93 - * $Id: if.h,v 1.28 1996/02/06 18:51:10 wollman Exp $ + * $Id: if.h,v 1.29 1996/06/10 23:07:28 gpalmer Exp $ */ #ifndef _NET_IF_H_ @@ -252,6 +252,35 @@ struct ifnet { } \ } +#ifdef KERNEL +#define IF_ENQ_DROP(ifq, m) if_enq_drop(ifq, m) + +#if defined(__GNUC__) && defined(MT_HEADER) +static inline int +if_queue_drop(struct ifqueue *ifq, struct mbuf *m) +{ + IF_QDROP(ifq); + return 0; +} + +static inline int +if_enq_drop(struct ifqueue *ifq, struct mbuf *m) +{ + if (IF_QFULL(ifq) && + !if_queue_drop(ifq, m)) + return 0; + IF_ENQUEUE(ifq, m); + return 1; +} +#else + +#ifdef MT_HEADER +int if_enq_drop __P((struct ifqueue *, struct mbuf *)); +#endif + +#endif +#endif /* KERNEL */ + #define IFQ_MAXLEN 50 #define IFNET_SLOWHZ 1 /* granularity is 1 second */ -- cgit v1.1