From owner-svn-src-all@FreeBSD.ORG Sun Aug 24 19:31:27 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 19F1CA7A; Sun, 24 Aug 2014 19:31:27 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DF7DC3CB7; Sun, 24 Aug 2014 19:31:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7OJVQTu089374; Sun, 24 Aug 2014 19:31:26 GMT (envelope-from bryanv@FreeBSD.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7OJVQve089373; Sun, 24 Aug 2014 19:31:26 GMT (envelope-from bryanv@FreeBSD.org) Message-Id: <201408241931.s7OJVQve089373@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bryanv set sender to bryanv@FreeBSD.org using -f From: Bryan Venteicher Date: Sun, 24 Aug 2014 19:31:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r270509 - stable/10/sys/dev/virtio/network X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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: Sun, 24 Aug 2014 19:31:27 -0000 Author: bryanv Date: Sun Aug 24 19:31:26 2014 New Revision: 270509 URL: http://svnweb.freebsd.org/changeset/base/270509 Log: MFC r270063 (vtnet) The vtnet changes were not originally merged in r270252 since r268480 and r268481 had not been MFC'ed. Modified: stable/10/sys/dev/virtio/network/if_vtnet.c Modified: stable/10/sys/dev/virtio/network/if_vtnet.c ============================================================================== --- stable/10/sys/dev/virtio/network/if_vtnet.c Sun Aug 24 17:10:47 2014 (r270508) +++ stable/10/sys/dev/virtio/network/if_vtnet.c Sun Aug 24 19:31:26 2014 (r270509) @@ -287,6 +287,10 @@ static device_method_t vtnet_methods[] = DEVMETHOD_END }; +#ifdef DEV_NETMAP +#include +#endif /* DEV_NETMAP */ + static driver_t vtnet_driver = { "vtnet", vtnet_methods, @@ -393,6 +397,10 @@ vtnet_attach(device_t dev) goto fail; } +#ifdef DEV_NETMAP + vtnet_netmap_attach(sc); +#endif /* DEV_NETMAP */ + vtnet_start_taskqueues(sc); fail: @@ -422,6 +430,10 @@ vtnet_detach(device_t dev) ether_ifdetach(ifp); } +#ifdef DEV_NETMAP + netmap_detach(ifp); +#endif /* DEV_NETMAP */ + vtnet_free_taskqueues(sc); if (sc->vtnet_vlan_attach != NULL) { @@ -1733,6 +1745,12 @@ vtnet_rxq_eof(struct vtnet_rxq *rxq) VTNET_RXQ_LOCK_ASSERT(rxq); +#ifdef DEV_NETMAP + if (netmap_rx_irq(ifp, 0, &deq)) { + return (FALSE); + } +#endif /* DEV_NETMAP */ + while (count-- > 0) { m = virtqueue_dequeue(vq, &len); if (m == NULL) @@ -2419,6 +2437,13 @@ vtnet_txq_eof(struct vtnet_txq *txq) deq = 0; VTNET_TXQ_LOCK_ASSERT(txq); +#ifdef DEV_NETMAP + if (netmap_tx_irq(txq->vtntx_sc->vtnet_ifp, txq->vtntx_id)) { + virtqueue_disable_intr(vq); // XXX luigi + return 0; // XXX or 1 ? + } +#endif /* DEV_NETMAP */ + while ((txhdr = virtqueue_dequeue(vq, NULL)) != NULL) { m = txhdr->vth_mbuf; deq++; @@ -2893,6 +2918,11 @@ vtnet_init_rx_queues(struct vtnet_softc ("%s: too many rx mbufs %d for %d segments", __func__, sc->vtnet_rx_nmbufs, sc->vtnet_rx_nsegs)); +#ifdef DEV_NETMAP + if (vtnet_netmap_init_rx_buffers(sc)) + return 0; +#endif /* DEV_NETMAP */ + for (i = 0; i < sc->vtnet_act_vq_pairs; i++) { rxq = &sc->vtnet_rxqs[i]; @@ -3045,6 +3075,13 @@ vtnet_init(void *xsc) sc = xsc; +#ifdef DEV_NETMAP + if (!NA(sc->vtnet_ifp)) { + D("try to attach again"); + vtnet_netmap_attach(sc); + } +#endif /* DEV_NETMAP */ + VTNET_CORE_LOCK(sc); vtnet_init_locked(sc); VTNET_CORE_UNLOCK(sc);