From owner-svn-src-head@FreeBSD.ORG Wed May 21 06:23:53 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1328CBB0; Wed, 21 May 2014 06:23:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E852A2F10; Wed, 21 May 2014 06:23:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s4L6NqLt030952; Wed, 21 May 2014 06:23:52 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s4L6NqGl030951; Wed, 21 May 2014 06:23:52 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201405210623.s4L6NqGl030951@svn.freebsd.org> From: Hans Petter Selasky Date: Wed, 21 May 2014 06:23:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r266484 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18 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: Wed, 21 May 2014 06:23:53 -0000 Author: hselasky Date: Wed May 21 06:23:52 2014 New Revision: 266484 URL: http://svnweb.freebsd.org/changeset/base/266484 Log: Avoid starting a USB transfer inside the callback function, right after its been submitted. MFC after: 3 days Modified: head/sys/dev/usb/wlan/if_rsu.c Modified: head/sys/dev/usb/wlan/if_rsu.c ============================================================================== --- head/sys/dev/usb/wlan/if_rsu.c Wed May 21 05:27:57 2014 (r266483) +++ head/sys/dev/usb/wlan/if_rsu.c Wed May 21 06:23:52 2014 (r266484) @@ -189,9 +189,9 @@ static void rsu_init(void *); static void rsu_init_locked(struct rsu_softc *); static void rsu_watchdog(void *); static int rsu_tx_start(struct rsu_softc *, struct ieee80211_node *, - struct mbuf *, struct rsu_data *); + struct mbuf *, struct rsu_data *, struct usb_xfer *); static void rsu_start(struct ifnet *); -static void rsu_start_locked(struct ifnet *); +static void rsu_start_locked(struct ifnet *, struct usb_xfer *); static int rsu_ioctl(struct ifnet *, u_long, caddr_t); static void rsu_stop(struct ifnet *, int); static void rsu_stop_locked(struct ifnet *, int); @@ -1610,7 +1610,7 @@ tr_setup: usbd_xfer_set_frame_data(xfer, 0, data->buf, data->buflen); DPRINTF("submitting transfer %p\n", data); usbd_transfer_submit(xfer); - rsu_start_locked(ifp); + rsu_start_locked(ifp, xfer); break; default: data = STAILQ_FIRST(&sc->sc_tx_active); @@ -1631,7 +1631,7 @@ tr_setup: static int rsu_tx_start(struct rsu_softc *sc, struct ieee80211_node *ni, - struct mbuf *m0, struct rsu_data *data) + struct mbuf *m0, struct rsu_data *data, struct usb_xfer *xfer_self) { struct ifnet *ifp = sc->sc_ifp; struct ieee80211com *ic = ifp->if_l2com; @@ -1736,8 +1736,9 @@ rsu_tx_start(struct rsu_softc *sc, struc data->ni = ni; data->m = m0; STAILQ_INSERT_TAIL(&sc->sc_tx_pending, data, next); - usbd_transfer_start(xfer); + if (xfer != xfer_self) + usbd_transfer_start(xfer); return (0); } @@ -1750,12 +1751,12 @@ rsu_start(struct ifnet *ifp) return; RSU_LOCK(sc); - rsu_start_locked(ifp); + rsu_start_locked(ifp, NULL); RSU_UNLOCK(sc); } static void -rsu_start_locked(struct ifnet *ifp) +rsu_start_locked(struct ifnet *ifp, struct usb_xfer *xfer_self) { struct rsu_softc *sc = ifp->if_softc; struct ieee80211_node *ni; @@ -1776,7 +1777,7 @@ rsu_start_locked(struct ifnet *ifp) ni = (struct ieee80211_node *)m->m_pkthdr.rcvif; m->m_pkthdr.rcvif = NULL; - if (rsu_tx_start(sc, ni, m, bf) != 0) { + if (rsu_tx_start(sc, ni, m, bf, xfer_self) != 0) { ifp->if_oerrors++; STAILQ_INSERT_HEAD(&sc->sc_tx_inactive, bf, next); ieee80211_free_node(ni); @@ -2303,7 +2304,7 @@ rsu_raw_xmit(struct ieee80211_node *ni, return (ENOBUFS); } ifp->if_opackets++; - if (rsu_tx_start(sc, ni, m, bf) != 0) { + if (rsu_tx_start(sc, ni, m, bf, NULL) != 0) { ieee80211_free_node(ni); ifp->if_oerrors++; STAILQ_INSERT_HEAD(&sc->sc_tx_inactive, bf, next);