Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Oct 2011 09:45:13 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r226830 - head/sys/net
Message-ID:  <201110270945.p9R9jDrk095115@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201110270945.p9R9jDrk095115>