From owner-svn-src-all@FreeBSD.ORG Fri Jun 19 23:11:20 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 95F4B106564A; Fri, 19 Jun 2009 23:11:20 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 840368FC13; Fri, 19 Jun 2009 23:11:20 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5JNBKxc057919; Fri, 19 Jun 2009 23:11:20 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5JNBKev057917; Fri, 19 Jun 2009 23:11:20 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906192311.n5JNBKev057917@svn.freebsd.org> From: Kip Macy Date: Fri, 19 Jun 2009 23:11:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194518 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Jun 2009 23:11:21 -0000 Author: kmacy Date: Fri Jun 19 23:11:20 2009 New Revision: 194518 URL: http://svn.freebsd.org/changeset/base/194518 Log: add helper function for flushing software queues Modified: head/sys/net/if_var.h Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Fri Jun 19 22:15:59 2009 (r194517) +++ head/sys/net/if_var.h Fri Jun 19 23:11:20 2009 (r194518) @@ -586,13 +586,27 @@ drbr_enqueue(struct ifnet *ifp, struct b } static __inline void -drbr_free(struct buf_ring *br, struct malloc_type *type) +drbr_flush(struct ifnet *ifp, struct buf_ring *br) { struct mbuf *m; +#ifdef ALTQ + if (ifp != NULL && ALTQ_IS_ENABLED(&ifp->if_snd)) { + while (!IFQ_IS_EMPTY(&ifp->if_snd)) { + IFQ_DRV_DEQUEUE(&ifp->if_snd, m); + m_freem(m); + } + } +#endif while ((m = buf_ring_dequeue_sc(br)) != NULL) m_freem(m); +} + +static __inline void +drbr_free(struct buf_ring *br, struct malloc_type *type) +{ + drbr_flush(NULL, br); buf_ring_free(br, type); }