summaryrefslogtreecommitdiffstats
path: root/sys/net/if.h
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1996-07-22 20:06:01 +0000
committerwollman <wollman@FreeBSD.org>1996-07-22 20:06:01 +0000
commit1e5c7466fc7a8db3a30171d28edf3e2e14a97f6b (patch)
tree0fae395487d17325b5141bdfa39943caf4d2e8bd /sys/net/if.h
parent5cfba932d68f723c08a7cec9e646b6cdb6e8665d (diff)
downloadFreeBSD-src-1e5c7466fc7a8db3a30171d28edf3e2e14a97f6b.zip
FreeBSD-src-1e5c7466fc7a8db3a30171d28edf3e2e14a97f6b.tar.gz
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).
Diffstat (limited to 'sys/net/if.h')
-rw-r--r--sys/net/if.h31
1 files changed, 30 insertions, 1 deletions
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 */
OpenPOWER on IntegriCloud