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/f65acf4aed6c
branches:  trunk
changeset: 946897:f65acf4aed6c
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 0263f24ca677 -r f65acf4aed6c 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
@@ -321,8 +321,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 *);
@@ -518,11 +517,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 =
@@ -3659,7 +3656,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);
 } 
 
@@ -3812,8 +3809,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;
@@ -5020,7 +5016,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];
@@ -5030,7 +5026,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) {
@@ -5067,7 +5063,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. */
@@ -5129,7 +5125,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];
@@ -5181,23 +5177,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;
        }
 
@@ -5211,7 +5208,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,
@@ -5736,7 +5733,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;
@@ -5807,7 +5804,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