svn commit: r191033 - head/sys/net
Kip Macy
kmacy at FreeBSD.org
Tue Apr 14 00:28:00 UTC 2009
Author: kmacy
Date: Tue Apr 14 00:27:59 2009
New Revision: 191033
URL: http://svn.freebsd.org/changeset/base/191033
Log:
Adapt buf_ring abstraction interface to allow consumers to interoperate with ALTQ
Modified:
head/sys/net/if_var.h
Modified: head/sys/net/if_var.h
==============================================================================
--- head/sys/net/if_var.h Tue Apr 14 00:27:05 2009 (r191032)
+++ head/sys/net/if_var.h Tue Apr 14 00:27:59 2009 (r191033)
@@ -560,6 +560,12 @@ drbr_enqueue(struct ifnet *ifp, struct b
int len = m->m_pkthdr.len;
int mflags = m->m_flags;
+#ifdef ALTQ
+ if (ALTQ_IS_ENABLED(&ifp->if_snd)) {
+ IFQ_ENQUEUE(&ifp->if_snd, m, error);
+ return (error);
+ }
+#endif
if ((error = buf_ring_enqueue(br, m)) == ENOBUFS) {
br->br_drops++;
_IF_DROP(&ifp->if_snd);
@@ -580,8 +586,31 @@ drbr_free(struct buf_ring *br, struct ma
buf_ring_free(br, type);
}
+
+static __inline struct mbuf *
+drbr_dequeue(struct ifnet *ifp, struct buf_ring *br)
+{
+#ifdef ALTQ
+ struct mbuf *m;
+
+ if (ALTQ_IS_ENABLED(&ifp->if_snd)) {
+ IFQ_DRV_DEQUEUE(&ifp->if_snd, m);
+ return (m);
+ }
#endif
+ return (buf_ring_dequeue_sc(br));
+}
+static __inline int
+drbr_empty(struct ifnet *ifp, struct buf_ring *br)
+{
+#ifdef ALTQ
+ if (ALTQ_IS_ENABLED(&ifp->if_snd))
+ return (IFQ_DRV_IS_EMPTY(&ifp->if_snd));
+#endif
+ return (buf_ring_empty(br));
+}
+#endif
/*
* 72 was chosen below because it is the size of a TCP/IP
* header (40) + the minimum mss (32).
More information about the svn-src-head
mailing list