summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2015-04-29 17:48:25 +0000
committerjhb <jhb@FreeBSD.org>2015-04-29 17:48:25 +0000
commit4a72d2d59a91fa00b353f5bc67f6c70dcff86b5a (patch)
treeb70f889e3c31af05942fab850cd7c6e4b295621f
parent08d35a248bb3857de924963d71455ad36e3b3664 (diff)
downloadFreeBSD-src-4a72d2d59a91fa00b353f5bc67f6c70dcff86b5a.zip
FreeBSD-src-4a72d2d59a91fa00b353f5bc67f6c70dcff86b5a.tar.gz
Don't free mbufs when stopping an interface in netmap mode.
Currently if you ifconfig down a vtnet interface while it is being used via netmap, the kernel panics due to trying to treat the cookie values in the virtio rings as mbufs to be freed. When netmap is enabled, these cookie values are pointers to something else. Note that other netmap-aware drivers don't seem to need this as they store the mbuf pointers in the software rings that mirror the hardware descriptor rings, and since netmap doesn't touch those, the software state always has NULL mbuf pointers causing the loops to free mbufs to not do anything. However, vtnet reuses the same state area for both netmap and non-netmap mode, so it needs to explicitly avoid looking at the rings and treating the cookie values as mbufs if netmap is enabled. Differential Revision: https://reviews.freebsd.org/D2348 Reviewed by: adrian, bryanv, luigi MFC after: 1 week Sponsored by: Norse Corp, Inc.
-rw-r--r--sys/dev/virtio/network/if_vtnet.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c
index 39fc28d..704a3d9 100644
--- a/sys/dev/virtio/network/if_vtnet.c
+++ b/sys/dev/virtio/network/if_vtnet.c
@@ -2745,6 +2745,11 @@ vtnet_drain_rxtx_queues(struct vtnet_softc *sc)
struct vtnet_txq *txq;
int i;
+#ifdef DEV_NETMAP
+ if (nm_native_on(NA(sc->vtnet_ifp)))
+ return;
+#endif /* DEV_NETMAP */
+
for (i = 0; i < sc->vtnet_act_vq_pairs; i++) {
rxq = &sc->vtnet_rxqs[i];
vtnet_rxq_free_mbufs(rxq);
OpenPOWER on IntegriCloud