From owner-svn-src-head@FreeBSD.ORG Sat Jan 25 20:12:08 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E1D3AA95; Sat, 25 Jan 2014 20:12:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B483B11D4; Sat, 25 Jan 2014 20:12:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0PJthpW071464; Sat, 25 Jan 2014 19:55:43 GMT (envelope-from bryanv@svn.freebsd.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0PJthUY071463; Sat, 25 Jan 2014 19:55:43 GMT (envelope-from bryanv@svn.freebsd.org) Message-Id: <201401251955.s0PJthUY071463@svn.freebsd.org> From: Bryan Venteicher Date: Sat, 25 Jan 2014 19:55:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r261166 - head/sys/dev/virtio/network X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jan 2014 20:12:09 -0000 Author: bryanv Date: Sat Jan 25 19:55:42 2014 New Revision: 261166 URL: http://svnweb.freebsd.org/changeset/base/261166 Log: Move duplicated transmit start code into a single function Modified: head/sys/dev/virtio/network/if_vtnet.c Modified: head/sys/dev/virtio/network/if_vtnet.c ============================================================================== --- head/sys/dev/virtio/network/if_vtnet.c Sat Jan 25 19:36:27 2014 (r261165) +++ head/sys/dev/virtio/network/if_vtnet.c Sat Jan 25 19:55:42 2014 (r261166) @@ -147,6 +147,7 @@ static int vtnet_txq_mq_start_locked(str static int vtnet_txq_mq_start(struct ifnet *, struct mbuf *); static void vtnet_txq_tq_deferred(void *, int); #endif +static void vtnet_txq_start(struct vtnet_txq *); static void vtnet_txq_tq_intr(void *, int); static void vtnet_txq_eof(struct vtnet_txq *); static void vtnet_tx_vq_intr(void *); @@ -2309,6 +2310,24 @@ vtnet_txq_tq_deferred(void *xtxq, int pe #endif /* VTNET_LEGACY_TX */ static void +vtnet_txq_start(struct vtnet_txq *txq) +{ + struct vtnet_softc *sc; + struct ifnet *ifp; + + sc = txq->vtntx_sc; + ifp = sc->vtnet_ifp; + +#ifdef VTNET_LEGACY_TX + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + vtnet_start_locked(txq, ifp); +#else + if (!drbr_empty(ifp, txq->vtntx_br)) + vtnet_txq_mq_start_locked(txq, NULL); +#endif +} + +static void vtnet_txq_tq_intr(void *xtxq, int pending) { struct vtnet_softc *sc; @@ -2328,13 +2347,7 @@ vtnet_txq_tq_intr(void *xtxq, int pendin vtnet_txq_eof(txq); -#ifdef VTNET_LEGACY_TX - if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) - vtnet_start_locked(txq, ifp); -#else - if (!drbr_empty(ifp, txq->vtntx_br)) - vtnet_txq_mq_start_locked(txq, NULL); -#endif + vtnet_txq_start(txq); if (vtnet_txq_enable_intr(txq) != 0) { vtnet_txq_disable_intr(txq); @@ -2405,13 +2418,7 @@ again: vtnet_txq_eof(txq); -#ifdef VTNET_LEGACY_TX - if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) - vtnet_start_locked(txq, ifp); -#else - if (!drbr_empty(ifp, txq->vtntx_br)) - vtnet_txq_mq_start_locked(txq, NULL); -#endif + vtnet_txq_start(txq); if (vtnet_txq_enable_intr(txq) != 0) { vtnet_txq_disable_intr(txq); @@ -2431,24 +2438,16 @@ again: static void vtnet_tx_start_all(struct vtnet_softc *sc) { - struct ifnet *ifp; struct vtnet_txq *txq; int i; - ifp = sc->vtnet_ifp; VTNET_CORE_LOCK_ASSERT(sc); for (i = 0; i < sc->vtnet_act_vq_pairs; i++) { txq = &sc->vtnet_txqs[i]; VTNET_TXQ_LOCK(txq); -#ifdef VTNET_LEGACY_TX - if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) - vtnet_start_locked(txq, ifp); -#else - if (!drbr_empty(ifp, txq->vtntx_br)) - vtnet_txq_mq_start_locked(txq, NULL); -#endif + vtnet_txq_start(txq); VTNET_TXQ_UNLOCK(txq); } }