From owner-svn-src-all@FreeBSD.ORG Tue Apr 17 04:52:58 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37EA61065740; Tue, 17 Apr 2012 04:52:58 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 23B638FC08; Tue, 17 Apr 2012 04:52:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q3H4qvoB066249; Tue, 17 Apr 2012 04:52:57 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q3H4qvml066247; Tue, 17 Apr 2012 04:52:57 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201204170452.q3H4qvml066247@svn.freebsd.org> From: Adrian Chadd Date: Tue, 17 Apr 2012 04:52:57 +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: r234368 - head/sys/dev/mwl X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Apr 2012 04:52:58 -0000 Author: adrian Date: Tue Apr 17 04:52:57 2012 New Revision: 234368 URL: http://svn.freebsd.org/changeset/base/234368 Log: Fix the RX free list locking creation and destruction to be consistent even in the face of errors. If the RX descriptor list fails, the RX lock won't be initialised, but then the DMA free path wil try freeing it. This commit is brought to you by a working mwl(4). Modified: head/sys/dev/mwl/if_mwl.c Modified: head/sys/dev/mwl/if_mwl.c ============================================================================== --- head/sys/dev/mwl/if_mwl.c Tue Apr 17 04:31:50 2012 (r234367) +++ head/sys/dev/mwl/if_mwl.c Tue Apr 17 04:52:57 2012 (r234368) @@ -310,6 +310,12 @@ mwl_attach(uint16_t devid, struct mwl_so } ic = ifp->if_l2com; + /* + * Setup the RX free list lock early, so it can be consistently + * removed. + */ + MWL_RXFREE_INIT(sc); + /* set these up early for if_printf use */ if_initname(ifp, device_get_name(sc->sc_dev), device_get_unit(sc->sc_dev)); @@ -531,6 +537,7 @@ bad2: bad1: mwl_hal_detach(mh); bad: + MWL_RXFREE_DESTROY(sc); if_free(ifp); sc->sc_invalid = 1; return error; @@ -561,6 +568,7 @@ mwl_detach(struct mwl_softc *sc) ieee80211_ifdetach(ic); callout_drain(&sc->sc_watchdog); mwl_dma_cleanup(sc); + MWL_RXFREE_DESTROY(sc); mwl_tx_cleanup(sc); mwl_hal_detach(sc->sc_mh); if_free(ifp); @@ -2274,7 +2282,6 @@ mwl_rxdma_setup(struct mwl_softc *sc) SLIST_INSERT_HEAD(&sc->sc_rxfree, rbuf, next); sc->sc_nrxfree++; } - MWL_RXFREE_INIT(sc); return 0; } #undef DS2PHYS @@ -2298,7 +2305,6 @@ mwl_rxdma_cleanup(struct mwl_softc *sc) } if (sc->sc_rxdma.dd_desc_len != 0) mwl_desc_cleanup(sc, &sc->sc_rxdma); - MWL_RXFREE_DESTROY(sc); } static int