Index: sys/dev/usb/wlan/if_urtwn.c =================================================================== --- sys/dev/usb/wlan/if_urtwn.c +++ sys/dev/usb/wlan/if_urtwn.c @@ -220,6 +220,8 @@ static void urtwn_read_rom(struct urtwn_softc *); static void urtwn_r88e_read_rom(struct urtwn_softc *); static int urtwn_ra_init(struct urtwn_softc *); +static void urtwn_set_maxretry(struct urtwn_softc *, + struct ieee80211vap *); static void urtwn_tsf_sync_enable(struct urtwn_softc *); static void urtwn_get_tsf(struct urtwn_softc *, uint64_t *); static void urtwn_set_led(struct urtwn_softc *, int, int); @@ -1479,6 +1481,18 @@ } static void +urtwn_set_maxretry(struct urtwn_softc *sc, struct ieee80211vap *vap) +{ + const struct ieee80211_txparam *tp; + struct ieee80211_node *ni = vap->iv_bss; + + tp = &vap->iv_txparms[ieee80211_chan2mode(ni->ni_chan)]; + + urtwn_write_2(sc, R92C_RL, + SM(R92C_RL_SRL, tp->maxretry) | SM(R92C_RL_LRL, tp->maxretry)); +} + +static void urtwn_tsf_sync_enable(struct urtwn_softc *sc) { urtwn_write_1(sc, R92C_BCN_CTRL, @@ -1606,10 +1620,20 @@ break; } + if (ic->ic_bsschan == IEEE80211_CHAN_ANYC || + vap->iv_bss->ni_chan == IEEE80211_CHAN_ANYC) { + URTWN_UNLOCK(sc); + IEEE80211_LOCK(ic); + return EINVAL; + } + ni = ieee80211_ref_node(vap->iv_bss); /* Set media status to 'Associated'. */ urtwn_set_mode(sc, R92C_MSR_INFRA); + /* Set short/long retry limits. */ + urtwn_set_maxretry(sc, vap); + /* Set BSSID. */ urtwn_write_4(sc, R92C_BSSID + 0, LE_READ_4(&ni->ni_bssid[0])); urtwn_write_4(sc, R92C_BSSID + 4, LE_READ_2(&ni->ni_bssid[4])); @@ -3325,10 +3349,6 @@ reg = RW(reg, R92C_RRSR_RATE_BITMAP, R92C_RRSR_RATE_CCK_ONLY_1M); urtwn_write_4(sc, R92C_RRSR, reg); - /* Set short/long retry limits. */ - urtwn_write_2(sc, R92C_RL, - SM(R92C_RL_SRL, 0x30) | SM(R92C_RL_LRL, 0x30)); - /* Initialize EDCA parameters. */ urtwn_edca_init(sc);