svn commit: r229690 - stable/9/sys/net

Gleb Smirnoff glebius at FreeBSD.org
Fri Jan 6 08:46:27 UTC 2012


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)
 


More information about the svn-src-all mailing list