rum(4): set short/long retry limits

Now device will use retry limit, which is set via 'ifconfig <interface>
maxretry <number>'.

Tested:

* Tested on WUSB54GC, STA mode.

Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3689
This commit is contained in:
adrian 2015-10-03 22:22:26 +00:00
parent 46ca1c7093
commit 812c6ab44f
3 changed files with 25 additions and 1 deletions

View File

@ -207,6 +207,8 @@ static void rum_select_band(struct rum_softc *,
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, enum ieee80211_state nstate, int arg)
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, enum ieee80211_state nstate, int arg)
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, struct ieee80211_channel *c)
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.

View File

@ -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)

View File

@ -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);