svn commit: r193472 - user/kmacy/releng_7_2_fcs/sys/net
Kip Macy
kmacy at FreeBSD.org
Thu Jun 4 22:41:37 UTC 2009
Author: kmacy
Date: Thu Jun 4 22:41:36 2009
New Revision: 193472
URL: http://svn.freebsd.org/changeset/base/193472
Log:
add routine to conditionally dequeue from the buf_ring
Modified:
user/kmacy/releng_7_2_fcs/sys/net/if_var.h
Modified: user/kmacy/releng_7_2_fcs/sys/net/if_var.h
==============================================================================
--- user/kmacy/releng_7_2_fcs/sys/net/if_var.h Thu Jun 4 22:34:37 2009 (r193471)
+++ user/kmacy/releng_7_2_fcs/sys/net/if_var.h Thu Jun 4 22:41:36 2009 (r193472)
@@ -613,6 +613,27 @@ drbr_dequeue(struct ifnet *ifp, struct b
return (buf_ring_dequeue_sc(br));
}
+static __inline struct mbuf *
+drbr_dequeue_cond(struct ifnet *ifp, struct buf_ring *br,
+ int (*func) (struct mbuf *, void *), void *arg)
+{
+ struct mbuf *m;
+#ifdef ALTQ
+ /*
+ * XXX need to evaluate / requeue
+ */
+ if (ALTQ_IS_ENABLED(&ifp->if_snd)) {
+ IFQ_DRV_DEQUEUE(&ifp->if_snd, m);
+ return (m);
+ }
+#endif
+ m = buf_ring_peek(br);
+ if (m == NULL || func(m, arg) == 0)
+ return (NULL);
+
+ return (buf_ring_dequeue_sc(br));
+}
+
static __inline int
drbr_empty(struct ifnet *ifp, struct buf_ring *br)
{
More information about the svn-src-user
mailing list