Author: glebius
Date: Fri Jan  6 08:46:26 2012
New Revision: 229690
URL: http://svn.freebsd.org/changeset/base/229690

Log:
  Merge r226830 from head/:
    Add macro IF_DEQUEUE_ALL(ifq, m), that takes the entire mbuf chain off
    the queue. It can be utilized in queue processing to avoid multiple
    locking/unlocking.

Modified:
  stable/9/sys/net/if_var.h
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/net/if_var.h
==============================================================================
--- stable/9/sys/net/if_var.h   Fri Jan  6 05:51:00 2012        (r229689)
+++ stable/9/sys/net/if_var.h   Fri Jan  6 08:46:26 2012        (r229690)
@@ -321,6 +321,18 @@ void       if_maddr_runlock(struct ifnet *ifp)
        IF_UNLOCK(ifq);                                         \
 } while (0)
 
+#define        _IF_DEQUEUE_ALL(ifq, m) do {                            \
+       (m) = (ifq)->ifq_head;                                  \
+       (ifq)->ifq_head = (ifq)->ifq_tail = NULL;               \
+       (ifq)->ifq_len = 0;                                     \
+} while (0)
+
+#define        IF_DEQUEUE_ALL(ifq, m) do {                             \
+       IF_LOCK(ifq);                                           \
+       _IF_DEQUEUE_ALL(ifq, m);                                \
+       IF_UNLOCK(ifq);                                         \
+} while (0)
+
 #define        _IF_POLL(ifq, m)        ((m) = (ifq)->ifq_head)
 #define        IF_POLL(ifq, m)         _IF_POLL(ifq, m)
 
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to