Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src-draft/trunk]: src/sys/dev/usb 40MHz support for urtwn.
details: https://anonhg.NetBSD.org/src-all/rev/7c638e15f054
branches: trunk
changeset: 377683:7c638e15f054
user: Nathanial Sloss <nat%netbsd.org@localhost>
date: Thu May 14 20:42:54 2020 +1000
description:
40MHz support for urtwn.
diffstat:
sys/dev/usb/if_urtwn.c | 37 +++++++++++++++++--------------------
1 files changed, 17 insertions(+), 20 deletions(-)
diffs (138 lines):
diff -r 89bac187a6e8 -r 7c638e15f054 sys/dev/usb/if_urtwn.c
--- a/sys/dev/usb/if_urtwn.c Thu May 14 16:22:14 2020 +1000
+++ b/sys/dev/usb/if_urtwn.c Thu May 14 20:42:54 2020 +1000
@@ -325,8 +325,7 @@ static void urtwn_get_txpower(struct urt
static void urtwn_r88e_get_txpower(struct urtwn_softc *, size_t, u_int,
u_int, uint16_t[]);
static void urtwn_set_txpower(struct urtwn_softc *, u_int, u_int);
-static void urtwn_set_chan(struct urtwn_softc *, struct ieee80211_channel *,
- u_int);
+static void urtwn_set_chan(struct urtwn_softc *, struct ieee80211_channel *);
static void urtwn_iq_calib(struct urtwn_softc *, bool);
static void urtwn_lc_calib(struct urtwn_softc *);
static void urtwn_temp_calib(struct urtwn_softc *);
@@ -522,11 +521,9 @@ urtwn_attach(device_t parent, device_t s
#if 0
IEEE80211_HTCAP_MAXAMSDU_3839 | /* max A-MSDU length */
#endif
- IEEE80211_HTCAP_SMPS_OFF; /* SM PS mode disabled */
-#if 0
+ IEEE80211_HTCAP_SMPS_OFF | /* SM PS mode disabled */
IEEE80211_HTCAP_CHWIDTH40 | /* 40 MHz channel width */
IEEE80211_HTCAP_SHORTGI40; /* short GI in 40MHz */
-#endif
#ifdef notyet
ic->ic_cryptocaps =
@@ -3691,7 +3688,7 @@ urtwn_set_channel(struct ieee80211com *i
DPRINTFN(DBG_FN, ("%s: %s\n",device_xname(sc->sc_dev), __func__));
mutex_enter(&sc->sc_write_mtx);
- urtwn_set_chan(sc, ic->ic_curchan, IEEE80211_HTINFO_2NDCHAN_NONE);
+ urtwn_set_chan(sc, ic->ic_curchan);
mutex_exit(&sc->sc_write_mtx);
}
@@ -3844,8 +3841,7 @@ urtwn_ioctl(struct ifnet *ifp, u_long cm
error = ieee80211_ioctl(ifp, cmd, data);
if (error == ENETRESET &&
ic->ic_opmode == IEEE80211_M_MONITOR) {
- urtwn_set_chan(sc, ic->ic_curchan,
- IEEE80211_HTINFO_2NDCHAN_NONE);
+ urtwn_set_chan(sc, ic->ic_curchan);
error = 0;
}
break;
@@ -5052,7 +5048,7 @@ urtwn_get_txpower(struct urtwn_softc *sc
if (sc->regulatory == 3) {
power[ridx] = base->pwr[0][ridx];
/* Apply vendor limits. */
- if (ht40m != IEEE80211_HTINFO_2NDCHAN_NONE) {
+ if (ht40m) {
maxpow = rom->ht40_max_pwr[group];
} else {
maxpow = rom->ht20_max_pwr[group];
@@ -5062,7 +5058,7 @@ urtwn_get_txpower(struct urtwn_softc *sc
power[ridx] = maxpow;
}
} else if (sc->regulatory == 1) {
- if (ht40m == IEEE80211_HTINFO_2NDCHAN_NONE) {
+ if (!ht40m) {
power[ridx] = base->pwr[group][ridx];
}
} else if (sc->regulatory != 2) {
@@ -5099,7 +5095,7 @@ urtwn_get_txpower(struct urtwn_softc *sc
}
/* Compute per-MCS Tx power. */
- if (ht40m == IEEE80211_HTINFO_2NDCHAN_NONE) {
+ if (!ht40m) {
diff = rom->ht20_tx_pwr_diff[group];
diff = (diff >> (chain * 4)) & 0xf;
htpow += diff; /* HT40->HT20 correction. */
@@ -5161,7 +5157,7 @@ urtwn_r88e_get_txpower(struct urtwn_soft
if (sc->regulatory == 3)
power[ridx] = base->pwr[0][ridx];
else if (sc->regulatory == 1) {
- if (ht40m == IEEE80211_HTINFO_2NDCHAN_NONE)
+ if (!ht40m)
power[ridx] = base->pwr[group][ridx];
} else if (sc->regulatory != 2)
power[ridx] = base->pwr[0][ridx];
@@ -5213,23 +5209,24 @@ urtwn_set_txpower(struct urtwn_softc *sc
}
}
-static void __noinline
-urtwn_set_chan(struct urtwn_softc *sc, struct ieee80211_channel *c, u_int ht40m)
+static void
+urtwn_set_chan(struct urtwn_softc *sc, struct ieee80211_channel *c)
{
struct ieee80211com *ic = &sc->sc_ic;
- u_int chan;
+ u_int chan, ht40m;
size_t i;
chan = ieee80211_chan2ieee(ic, c); /* XXX center freq! */
+ ht40m = c->ic_flags & IEEE80211_CHAN_HT40;
DPRINTFN(DBG_FN, ("%s: %s: chan=%d\n", device_xname(sc->sc_dev),
__func__, chan));
KASSERT(mutex_owned(&sc->sc_write_mtx));
- if (ht40m == IEEE80211_HTINFO_2NDCHAN_ABOVE) {
+ if (ht40m == IEEE80211_CHAN_HT40U) {
chan += 2;
- } else if (ht40m == IEEE80211_HTINFO_2NDCHAN_BELOW){
+ } else if (ht40m == IEEE80211_CHAN_HT40D){
chan -= 2;
}
@@ -5243,7 +5240,7 @@ urtwn_set_chan(struct urtwn_softc *sc, s
if (ht40m) {
/* Is secondary channel below or above primary? */
- int prichlo = (ht40m == IEEE80211_HTINFO_2NDCHAN_ABOVE);
+ int prichlo = (ht40m == IEEE80211_CHAN_HT40U);
uint32_t reg;
urtwn_write_1(sc, R92C_BWOPMODE,
@@ -5768,7 +5765,7 @@ urtwn_init(struct ifnet *ifp)
urtwn_write_1(sc, 0x15, 0xe9);
/* Set default channel. */
- urtwn_set_chan(sc, ic->ic_curchan, IEEE80211_HTINFO_2NDCHAN_NONE);
+ urtwn_set_chan(sc, ic->ic_curchan);
/* We're ready to go. */
ifp->if_flags &= ~IFF_OACTIVE;
@@ -5839,7 +5836,7 @@ urtwn_reset(struct ieee80211vap *vap, u_
if (ic->ic_opmode != IEEE80211_M_MONITOR)
return ENETRESET;
- urtwn_set_chan(sc, ic->ic_curchan, IEEE80211_HTINFO_2NDCHAN_NONE);
+ urtwn_set_chan(sc, ic->ic_curchan);
return 0;
}
Home |
Main Index |
Thread Index |
Old Index