svn commit: r226830 - head/sys/net

Gleb Smirnoff glebius at FreeBSD.org
Thu Oct 27 09:45:13 UTC 2011


Author: glebius
Date: Thu Oct 27 09:45:12 2011
New Revision: 226830
URL: http://svn.freebsd.org/changeset/base/226830

Log:
  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:
  head/sys/net/if_var.h

Modified: head/sys/net/if_var.h
==============================================================================
--- head/sys/net/if_var.h	Thu Oct 27 09:43:25 2011	(r226829)
+++ head/sys/net/if_var.h	Thu Oct 27 09:45:12 2011	(r226830)
@@ -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)
 


More information about the svn-src-all mailing list