Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Apr 2009 19:29:45 +0000 (UTC)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r191437 - head/sys/dev/nve
Message-ID:  <200904231929.n3NJTj2s097387@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rwatson
Date: Thu Apr 23 19:29:45 2009
New Revision: 191437
URL: http://svn.freebsd.org/changeset/base/191437

Log:
  Two ifnet misuse fixes for if_nve:
  
  (1) Don't manually configure if_output(), ether_ifattach() will do that
      for us as part of link-layer setup.
  
  (2) Call if_detach() before stopping nve in order to prevent calls into
      the device driver after the driver has started shutting down.
  
  Reviewed by:	jhb
  MFC after:	2 weeks

Modified:
  head/sys/dev/nve/if_nve.c

Modified: head/sys/dev/nve/if_nve.c
==============================================================================
--- head/sys/dev/nve/if_nve.c	Thu Apr 23 18:46:03 2009	(r191436)
+++ head/sys/dev/nve/if_nve.c	Thu Apr 23 19:29:45 2009	(r191437)
@@ -539,7 +539,6 @@ nve_attach(device_t dev)
 	if_initname(ifp, device_get_name(dev), device_get_unit(dev));
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 	ifp->if_ioctl = nve_ioctl;
-	ifp->if_output = ether_output;
 	ifp->if_start = nve_ifstart;
 	ifp->if_watchdog = nve_watchdog;
 	ifp->if_timer = 0;
@@ -585,11 +584,11 @@ nve_detach(device_t dev)
 	ifp = sc->ifp;
 
 	if (device_is_attached(dev)) {
+		ether_ifdetach(ifp);
 		NVE_LOCK(sc);
 		nve_stop(sc);
 		NVE_UNLOCK(sc);
 		callout_drain(&sc->stat_callout);
-		ether_ifdetach(ifp);
 	}
 
 	if (sc->miibus)



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