The rtwn driver never tells hardware about the short slot time
and short preamble features enabled by most APs (since 11g).

Not sure if not doing so hurts but the linux driver does it.

Tested on:
8188CE (PCI)
8192CU (USB)
8188EU (USB)
8188CUS (USB)

ok?

Index: rtwn.c
===================================================================
RCS file: /cvs/src/sys/dev/ic/rtwn.c,v
retrieving revision 1.13
diff -u -p -r1.13 rtwn.c
--- rtwn.c      30 Jan 2017 16:25:50 -0000      1.13
+++ rtwn.c      30 Jan 2017 16:52:32 -0000
@@ -89,6 +89,8 @@ int           rtwn_r88e_ra_init(struct rtwn_softc
                    int, uint32_t, int);
 void           rtwn_tsf_sync_enable(struct rtwn_softc *);
 void           rtwn_set_led(struct rtwn_softc *, int, int);
+void           rtwn_update_short_preamble(struct ieee80211com *);
+void           rtwn_updateslot(struct ieee80211com *);
 void           rtwn_updateedca(struct ieee80211com *);
 void           rtwn_update_avgrssi(struct rtwn_softc *, int, int8_t);
 int8_t         rtwn_r88e_get_rssi(struct rtwn_softc *, int, void *);
@@ -238,6 +240,7 @@ rtwn_attach(struct device *pdev, struct 
 
        if_attach(ifp);
        ieee80211_ifattach(ifp);
+       ic->ic_updateslot = rtwn_updateslot;
        ic->ic_updateedca = rtwn_updateedca;
 #ifdef notyet
        ic->ic_set_key = rtwn_set_key;
@@ -905,6 +908,9 @@ rtwn_newstate(struct ieee80211com *ic, e
                rtwn_write_4(sc, R92C_EDCA_BE_PARAM, 0x00105320);
                rtwn_write_4(sc, R92C_EDCA_BK_PARAM, 0x0000a444);
 
+               rtwn_updateslot(ic);
+               rtwn_update_short_preamble(ic);
+
                /* Disable 11b-only AP workaround (see rtwn_r88e_ra_init). */
                sc->sc_flags &= ~RTWN_FLAG_FORCE_RAID_11B;
        }
@@ -986,6 +992,9 @@ rtwn_newstate(struct ieee80211com *ic, e
                else    /* 802.11b/g */
                        rtwn_write_1(sc, R92C_INIRTS_RATE_SEL, 3);
 
+               rtwn_updateslot(ic);
+               rtwn_update_short_preamble(ic);
+
                /* Enable Rx of data frames. */
                rtwn_write_2(sc, R92C_RXFLTMAP2, 0xffff);
 
@@ -1028,6 +1037,34 @@ rtwn_newstate(struct ieee80211com *ic, e
        splx(s);
  
        return (error);
+}
+
+void
+rtwn_update_short_preamble(struct ieee80211com *ic)
+{
+       struct rtwn_softc *sc = ic->ic_softc;
+       uint32_t reg;
+
+       reg = rtwn_read_4(sc, R92C_RRSR);
+       if (ic->ic_flags & IEEE80211_F_SHPREAMBLE)
+               reg |= R92C_RRSR_SHORT;
+       else
+               reg &= ~R92C_RRSR_SHORT;
+       rtwn_write_4(sc, R92C_RRSR, reg);
+}
+
+void
+rtwn_updateslot(struct ieee80211com *ic)
+{
+       struct rtwn_softc *sc = ic->ic_softc;
+       int s;
+       
+       s = splnet();
+       if (ic->ic_flags & IEEE80211_F_SHSLOT)
+               rtwn_write_1(sc, R92C_SLOT, 9);
+       else
+               rtwn_write_1(sc, R92C_SLOT, IEEE80211_DUR_DS_SLOT);
+       splx(s);
 }
 
 void

Reply via email to