Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 May 2009 15:06:03 +0000 (UTC)
From:      "George V. Neville-Neil" <gnn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r192584 - head/sys/dev/cxgb
Message-ID:  <200905221506.n4MF63r6010049@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gnn
Date: Fri May 22 15:06:03 2009
New Revision: 192584
URL: http://svn.freebsd.org/changeset/base/192584

Log:
  Fix a possible panic cxgb_controller_attach() routine that would occur
  only if prepping the adapter failed.
  
  Slight adjustment to comments.
  
  Fix a bug whereby downing the interface didn't preven it from
  processing packets.
  
  Submitted by:	Navdeep Parhar
  MFC after:	1 week

Modified:
  head/sys/dev/cxgb/cxgb_main.c

Modified: head/sys/dev/cxgb/cxgb_main.c
==============================================================================
--- head/sys/dev/cxgb/cxgb_main.c	Fri May 22 15:05:05 2009	(r192583)
+++ head/sys/dev/cxgb/cxgb_main.c	Fri May 22 15:06:03 2009	(r192584)
@@ -404,8 +404,9 @@ upgrade_fw(adapter_t *sc)
  *  5. Allocate the BAR for doing MSI-X.
  *  6. Setup the line interrupt iff MSI-X is not supported.
  *  7. Create the driver's taskq.
- *  8. Start the task queue threads.
- *  9. Update the firmware if required.
+ *  8. Start one task queue service thread.
+ *  9. Check if the firmware and SRAM are up-to-date.  They will be
+ *     auto-updated later (before FULL_INIT_DONE), if required.
  * 10. Create a child device for each MAC (port)
  * 11. Initialize T3 private state.
  * 12. Trigger the LED
@@ -665,7 +666,7 @@ out:
 }
 
 /*
- * The cxgb_controlller_detach routine is called with the device is
+ * The cxgb_controller_detach routine is called with the device is
  * unloaded from the system.
  */
 
@@ -685,7 +686,7 @@ cxgb_controller_detach(device_t dev)
  * The cxgb_free() is called by the cxgb_controller_detach() routine
  * to tear down the structures that were built up in
  * cxgb_controller_attach(), and should be the final piece of work
- * done when fullly unloading the driver.
+ * done when fully unloading the driver.
  * 
  *
  *  1. Shutting down the threads started by the cxgb_controller_attach()
@@ -724,7 +725,8 @@ cxgb_free(struct adapter *sc)
 	bus_generic_detach(sc->dev);
 
 	for (i = 0; i < (sc)->params.nports; i++) {
-		if (device_delete_child(sc->dev, sc->portdev[i]) != 0)
+		if (sc->portdev[i] &&
+		    device_delete_child(sc->dev, sc->portdev[i]) != 0)
 			device_printf(sc->dev, "failed to delete child port\n");
 	}
 
@@ -1768,7 +1770,7 @@ out:
 
 
 /*
- * Release resources when all the ports and offloading have been stopped.
+ * Bring down the interface but do not free any resources.
  */
 static void
 cxgb_down_locked(struct adapter *sc)
@@ -1903,6 +1905,7 @@ cxgb_init_locked(struct port_info *p)
  	callout_reset(&sc->cxgb_tick_ch, CXGB_TICKS(sc), cxgb_tick, sc);
 	t3_sge_reset_adapter(sc);
 
+	sc->flags &= ~CXGB_SHUTDOWN;
 	ifp->if_drv_flags |= IFF_DRV_RUNNING;
 	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
 }
@@ -1923,10 +1926,13 @@ static void
 cxgb_stop_locked(struct port_info *pi)
 {
 	struct ifnet *ifp;
+	adapter_t *sc = pi->adapter;
 
 	PORT_LOCK_ASSERT_OWNED(pi);
 	ADAPTER_LOCK_ASSERT_NOTOWNED(pi->adapter);
 	
+	sc->flags |= CXGB_SHUTDOWN;
+
 	ifp = pi->ifp;
 	t3_port_intr_disable(pi->adapter, pi->port_id);
 	ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);



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