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/a25a3fba8ea5
branches:  trunk
changeset: 988365:a25a3fba8ea5
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 ea63349a7398 -r a25a3fba8ea5 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
@@ -323,8 +323,7 @@
 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 *);
@@ -520,11 +519,9 @@
 #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 =
@@ -3688,7 +3685,7 @@
        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);
 } 
 
@@ -3841,8 +3838,7 @@
                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;
@@ -5049,7 +5045,7 @@
                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];
@@ -5059,7 +5055,7 @@
                                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) {
@@ -5096,7 +5092,7 @@
        }
 
        /* 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. */
@@ -5158,7 +5154,7 @@
                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];
@@ -5210,23 +5206,24 @@
        }
 }
 
-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;
        }
 
@@ -5240,7 +5237,7 @@
 
        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,
@@ -5765,7 +5762,7 @@
                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;
@@ -5836,7 +5833,7 @@
        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