From owner-svn-src-head@FreeBSD.ORG Fri May 22 15:06:04 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 224391065670; Fri, 22 May 2009 15:06:04 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 06E778FC19; Fri, 22 May 2009 15:06:04 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4MF634L010050; Fri, 22 May 2009 15:06:03 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4MF63r6010049; Fri, 22 May 2009 15:06:03 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <200905221506.n4MF63r6010049@svn.freebsd.org> From: "George V. Neville-Neil" Date: Fri, 22 May 2009 15:06:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192584 - head/sys/dev/cxgb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 May 2009 15:06:04 -0000 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);