Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 May 2015 14:29:40 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r283617 - stable/10/sys/dev/virtio/network
Message-ID:  <201505271429.t4RETebp021847@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Wed May 27 14:29:39 2015
New Revision: 283617
URL: https://svnweb.freebsd.org/changeset/base/283617

Log:
  MFC 282241:
  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.
  
  Sponsored by:	Norse Corp, Inc.

Modified:
  stable/10/sys/dev/virtio/network/if_vtnet.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/virtio/network/if_vtnet.c
==============================================================================
--- stable/10/sys/dev/virtio/network/if_vtnet.c	Wed May 27 14:28:19 2015	(r283616)
+++ stable/10/sys/dev/virtio/network/if_vtnet.c	Wed May 27 14:29:39 2015	(r283617)
@@ -2756,6 +2756,11 @@ vtnet_drain_rxtx_queues(struct vtnet_sof
 	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);



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