From owner-svn-src-head@freebsd.org Sat Oct 3 22:22:27 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 826D9A0ED38; Sat, 3 Oct 2015 22:22:27 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.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 7010911C4; Sat, 3 Oct 2015 22:22:27 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93MMR0T047139; Sat, 3 Oct 2015 22:22:27 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93MMQTE047135; Sat, 3 Oct 2015 22:22:26 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510032222.t93MMQTE047135@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 22:22:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288638 - 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.20 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: Sat, 03 Oct 2015 22:22:27 -0000 Author: adrian Date: Sat Oct 3 22:22:26 2015 New Revision: 288638 URL: https://svnweb.freebsd.org/changeset/base/288638 Log: rum(4): set short/long retry limits Now device will use retry limit, which is set via 'ifconfig maxretry '. Tested: * Tested on WUSB54GC, STA mode. Submitted by: Differential Revision: https://reviews.freebsd.org/D3689 Modified: head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_rumreg.h head/sys/dev/usb/wlan/if_rumvar.h Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 22:15:59 2015 (r288637) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 22:22:26 2015 (r288638) @@ -207,6 +207,8 @@ static void rum_select_band(struct rum_ struct ieee80211_channel *); static void rum_set_chan(struct rum_softc *, struct ieee80211_channel *); +static void rum_set_maxretry(struct rum_softc *, + struct ieee80211vap *); static int rum_enable_tsf_sync(struct rum_softc *); static void rum_enable_tsf(struct rum_softc *); static void rum_abort_tsf_sync(struct rum_softc *); @@ -819,7 +821,8 @@ rum_newstate(struct ieee80211vap *vap, e ni = ieee80211_ref_node(vap->iv_bss); if (vap->iv_opmode != IEEE80211_M_MONITOR) { - if (ic->ic_bsschan == IEEE80211_CHAN_ANYC) { + if (ic->ic_bsschan == IEEE80211_CHAN_ANYC || + ni->ni_chan == IEEE80211_CHAN_ANYC) { ret = EINVAL; goto run_fail; } @@ -827,6 +830,7 @@ rum_newstate(struct ieee80211vap *vap, e rum_enable_mrr(sc); rum_set_txpreamble(sc); rum_set_basicrates(sc); + rum_set_maxretry(sc, vap); IEEE80211_ADDR_COPY(sc->sc_bssid, ni->ni_bssid); rum_set_bssid(sc, sc->sc_bssid); } @@ -1946,6 +1950,21 @@ rum_set_chan(struct rum_softc *sc, struc rum_pause(sc, hz / 100); } +static void +rum_set_maxretry(struct rum_softc *sc, struct ieee80211vap *vap) +{ + const struct ieee80211_txparam *tp; + struct ieee80211_node *ni = vap->iv_bss; + struct rum_vap *rvp = RUM_VAP(vap); + + tp = &vap->iv_txparms[ieee80211_chan2mode(ni->ni_chan)]; + rvp->maxretry = tp->maxretry < 0xf ? tp->maxretry : 0xf; + + rum_modbits(sc, RT2573_TXRX_CSR4, RT2573_SHORT_RETRY(rvp->maxretry) | + RT2573_LONG_RETRY(rvp->maxretry), + RT2573_SHORT_RETRY_MASK | RT2573_LONG_RETRY_MASK); +} + /* * Enable TSF synchronization and tell h/w to start sending beacons for IBSS * and HostAP operating modes. Modified: head/sys/dev/usb/wlan/if_rumreg.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumreg.h Sat Oct 3 22:15:59 2015 (r288637) +++ head/sys/dev/usb/wlan/if_rumreg.h Sat Oct 3 22:22:26 2015 (r288638) @@ -153,6 +153,10 @@ #define RT2573_SHORT_PREAMBLE (1 << 18) #define RT2573_MRR_ENABLED (1 << 19) #define RT2573_MRR_CCK_FALLBACK (1 << 22) +#define RT2573_LONG_RETRY(max) ((max) << 24) +#define RT2573_LONG_RETRY_MASK (0xf << 24) +#define RT2573_SHORT_RETRY(max) ((max) << 28) +#define RT2573_SHORT_RETRY_MASK (0xf << 28) /* possible flags for register TXRX_CSR9 */ #define RT2573_TSF_TIMER_EN (1 << 16) Modified: head/sys/dev/usb/wlan/if_rumvar.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 22:15:59 2015 (r288637) +++ head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 22:22:26 2015 (r288638) @@ -92,6 +92,7 @@ struct rum_vap { struct mbuf *bcn_mbuf; struct usb_callout ratectl_ch; struct task ratectl_task; + uint8_t maxretry; int (*newstate)(struct ieee80211vap *, enum ieee80211_state, int);