From owner-svn-src-all@FreeBSD.ORG Mon Feb 23 23:46:56 2009 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 D02CD106568D; Mon, 23 Feb 2009 23:46:56 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BDFC28FC1F; Mon, 23 Feb 2009 23:46:56 +0000 (UTC) (envelope-from thompsa@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 n1NNkuYU043276; Mon, 23 Feb 2009 23:46:56 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1NNkuvp043272; Mon, 23 Feb 2009 23:46:56 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200902232346.n1NNkuvp043272@svn.freebsd.org> From: Andrew Thompson Date: Mon, 23 Feb 2009 23:46:56 +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: r188969 - head/sys/dev/usb/wlan 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: Mon, 23 Feb 2009 23:46:57 -0000 Author: thompsa Date: Mon Feb 23 23:46:56 2009 New Revision: 188969 URL: http://svn.freebsd.org/changeset/base/188969 Log: Make sure at least two tx slots are free before sending the mbuf since an additional frame may be sent for 80211 protection. Modified: head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_rumvar.h head/sys/dev/usb/wlan/if_ural.c head/sys/dev/usb/wlan/if_uralvar.h Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Mon Feb 23 23:41:12 2009 (r188968) +++ head/sys/dev/usb/wlan/if_rum.c Mon Feb 23 23:46:56 2009 (r188969) @@ -1167,10 +1167,6 @@ rum_tx_raw(struct rum_softc *sc, struct RUM_LOCK_ASSERT(sc, MA_OWNED); KASSERT(params != NULL, ("no raw xmit params")); - data = STAILQ_FIRST(&sc->tx_free); - STAILQ_REMOVE_HEAD(&sc->tx_free, next); - sc->tx_nfree--; - rate = params->ibp_rate0 & IEEE80211_RATE_VAL; /* XXX validate */ if (rate == 0) { @@ -1185,13 +1181,17 @@ rum_tx_raw(struct rum_softc *sc, struct params->ibp_flags & IEEE80211_BPF_RTS ? IEEE80211_PROT_RTSCTS : IEEE80211_PROT_CTSONLY, rate); - if (error) { + if (error || sc->tx_nfree == 0) { m_freem(m0); - return error; + return ENOBUFS; } flags |= RT2573_TX_LONG_RETRY | RT2573_TX_IFS_SIFS; } + data = STAILQ_FIRST(&sc->tx_free); + STAILQ_REMOVE_HEAD(&sc->tx_free, next); + sc->tx_nfree--; + data->m = m0; data->ni = ni; data->rate = rate; @@ -1254,9 +1254,9 @@ rum_tx_data(struct rum_softc *sc, struct prot = ic->ic_protmode; if (prot != IEEE80211_PROT_NONE) { error = rum_sendprot(sc, m0, ni, prot, rate); - if (error) { + if (error || sc->tx_nfree == 0) { m_freem(m0); - return error; + return ENOBUFS; } flags |= RT2573_TX_LONG_RETRY | RT2573_TX_IFS_SIFS; } @@ -1306,7 +1306,7 @@ rum_start(struct ifnet *ifp) IFQ_DRV_DEQUEUE(&ifp->if_snd, m); if (m == NULL) break; - if (sc->tx_nfree == 0) { + if (sc->tx_nfree < RUM_TX_MINFREE) { IFQ_DRV_PREPEND(&ifp->if_snd, m); ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; @@ -2149,7 +2149,7 @@ rum_raw_xmit(struct ieee80211_node *ni, ieee80211_free_node(ni); return ENETDOWN; } - if (sc->tx_nfree == 0) { + if (sc->tx_nfree < RUM_TX_MINFREE) { ifp->if_drv_flags |= IFF_DRV_OACTIVE; RUM_UNLOCK(sc); m_freem(m); Modified: head/sys/dev/usb/wlan/if_rumvar.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumvar.h Mon Feb 23 23:41:12 2009 (r188968) +++ head/sys/dev/usb/wlan/if_rumvar.h Mon Feb 23 23:46:56 2009 (r188969) @@ -18,6 +18,7 @@ */ #define RUM_TX_LIST_COUNT 8 +#define RUM_TX_MINFREE 2 struct rum_rx_radiotap_header { struct ieee80211_radiotap_header wr_ihdr; Modified: head/sys/dev/usb/wlan/if_ural.c ============================================================================== --- head/sys/dev/usb/wlan/if_ural.c Mon Feb 23 23:41:12 2009 (r188968) +++ head/sys/dev/usb/wlan/if_ural.c Mon Feb 23 23:46:56 2009 (r188969) @@ -1243,10 +1243,6 @@ ural_tx_raw(struct ural_softc *sc, struc RAL_LOCK_ASSERT(sc, MA_OWNED); KASSERT(params != NULL, ("no raw xmit params")); - data = STAILQ_FIRST(&sc->tx_free); - STAILQ_REMOVE_HEAD(&sc->tx_free, next); - sc->tx_nfree--; - rate = params->ibp_rate0 & IEEE80211_RATE_VAL; /* XXX validate */ if (rate == 0) { @@ -1261,13 +1257,17 @@ ural_tx_raw(struct ural_softc *sc, struc params->ibp_flags & IEEE80211_BPF_RTS ? IEEE80211_PROT_RTSCTS : IEEE80211_PROT_CTSONLY, rate); - if (error) { + if (error || sc->tx_nfree == 0) { m_freem(m0); - return error; + return ENOBUFS; } flags |= RAL_TX_IFS_SIFS; } + data = STAILQ_FIRST(&sc->tx_free); + STAILQ_REMOVE_HEAD(&sc->tx_free, next); + sc->tx_nfree--; + data->m = m0; data->ni = ni; data->rate = rate; @@ -1328,9 +1328,9 @@ ural_tx_data(struct ural_softc *sc, stru prot = ic->ic_protmode; if (prot != IEEE80211_PROT_NONE) { error = ural_sendprot(sc, m0, ni, prot, rate); - if (error) { + if (error || sc->tx_nfree == 0) { m_freem(m0); - return error; + return ENOBUFS; } flags |= RAL_TX_IFS_SIFS; } @@ -1380,7 +1380,7 @@ ural_start(struct ifnet *ifp) IFQ_DRV_DEQUEUE(&ifp->if_snd, m); if (m == NULL) break; - if (sc->tx_nfree == 0) { + if (sc->tx_nfree < RAL_TX_MINFREE) { IFQ_DRV_PREPEND(&ifp->if_snd, m); ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; @@ -2235,7 +2235,7 @@ ural_raw_xmit(struct ieee80211_node *ni, ieee80211_free_node(ni); return ENETDOWN; } - if (sc->tx_nfree == 0) { + if (sc->tx_nfree < RAL_TX_MINFREE) { ifp->if_drv_flags |= IFF_DRV_OACTIVE; RAL_UNLOCK(sc); m_freem(m); Modified: head/sys/dev/usb/wlan/if_uralvar.h ============================================================================== --- head/sys/dev/usb/wlan/if_uralvar.h Mon Feb 23 23:41:12 2009 (r188968) +++ head/sys/dev/usb/wlan/if_uralvar.h Mon Feb 23 23:46:56 2009 (r188969) @@ -18,6 +18,7 @@ */ #define RAL_TX_LIST_COUNT 8 +#define RAL_TX_MINFREE 2 #define URAL_SCAN_START 1 #define URAL_SCAN_END 2