Author: avos
Date: Sat Dec  5 15:08:01 2015
New Revision: 291858
URL: https://svnweb.freebsd.org/changeset/base/291858

Log:
  urtwn: fix some regressions after r290630
  
  - Restore R92C_TXDW4_HWSEQ_EN bit - it is used by non-8188EU chips.
  - Fix DRVRATE bit usage.
  
  Tested with:
   - RTL8188EU, STA mode.
   - RTL8188CUS, STA mode.
  
  Reviewed by:  kevlo
  Approved by:  adrian (mentor)
  Differential Revision:        https://reviews.freebsd.org/D4352

Modified:
  head/sys/dev/usb/wlan/if_urtwn.c
  head/sys/dev/usb/wlan/if_urtwnreg.h

Modified: head/sys/dev/usb/wlan/if_urtwn.c
==============================================================================
--- head/sys/dev/usb/wlan/if_urtwn.c    Sat Dec  5 12:55:34 2015        
(r291857)
+++ head/sys/dev/usb/wlan/if_urtwn.c    Sat Dec  5 15:08:01 2015        
(r291858)
@@ -1601,14 +1601,16 @@ urtwn_init_beacon(struct urtwn_softc *sc
            SM(R92C_TXDW1_QSEL, R92C_TXDW1_QSEL_BEACON) |
            SM(R92C_TXDW1_RAID, R92C_RAID_11B));
 
-       if (sc->chip & URTWN_CHIP_88E)
+       if (sc->chip & URTWN_CHIP_88E) {
                txd->txdw1 |= htole32(SM(R88E_TXDW1_MACID, URTWN_MACID_BC));
-       else
+               txd->txdseq |= htole16(R88E_TXDSEQ_HWSEQ_EN);
+       } else {
                txd->txdw1 |= htole32(SM(R92C_TXDW1_MACID, URTWN_MACID_BC));
+               txd->txdw4 |= htole32(R92C_TXDW4_HWSEQ_EN);
+       }
 
        txd->txdw4 = htole32(R92C_TXDW4_DRVRATE);
        txd->txdw5 = htole32(SM(R92C_TXDW5_DATARATE, URTWN_RIDX_CCK1));
-       txd->txdseq = htole16(R92C_TXDSEQ_HWSEQ_EN);
 }
 
 static int
@@ -2249,13 +2251,17 @@ urtwn_tx_data(struct urtwn_softc *sc, st
                txd->txdw1 |= htole32(SM(R92C_TXDW1_MACID, macid));
 
        txd->txdw5 |= htole32(SM(R92C_TXDW5_DATARATE, ridx));
-       /* not sure here */
-       if (ridx <= URTWN_RIDX_CCK11)
+       /* Force this rate if needed. */
+       if (ismcast || type != IEEE80211_FC0_TYPE_DATA ||
+           (m->m_flags & M_EAPOL))
                txd->txdw4 |= htole32(R92C_TXDW4_DRVRATE);
 
        if (!IEEE80211_QOS_HAS_SEQ(wh)) {
                /* Use HW sequence numbering for non-QoS frames. */
-               txd->txdseq = htole16(R92C_TXDSEQ_HWSEQ_EN);
+               if (sc->chip & URTWN_CHIP_88E)
+                       txd->txdseq = htole16(R88E_TXDSEQ_HWSEQ_EN);
+               else
+                       txd->txdw4 |= htole32(R92C_TXDW4_HWSEQ_EN);
        } else {
                /* Set sequence number. */
                txd->txdseq = htole16(M_SEQNO_GET(m) % IEEE80211_SEQ_RANGE);

Modified: head/sys/dev/usb/wlan/if_urtwnreg.h
==============================================================================
--- head/sys/dev/usb/wlan/if_urtwnreg.h Sat Dec  5 12:55:34 2015        
(r291857)
+++ head/sys/dev/usb/wlan/if_urtwnreg.h Sat Dec  5 15:08:01 2015        
(r291858)
@@ -1055,12 +1055,13 @@ struct r92c_tx_desc {
 
        uint16_t        txdw3;
        uint16_t        txdseq;
-#define R92C_TXDSEQ_HWSEQ_EN   0x8000
+#define R88E_TXDSEQ_HWSEQ_EN   0x8000
 
        uint32_t        txdw4;
 #define R92C_TXDW4_RTSRATE_M   0x0000003f
 #define R92C_TXDW4_RTSRATE_S   0
 #define R92C_TXDW4_HWSEQ_QOS   0x00000040
+#define R92C_TXDW4_HWSEQ_EN    0x00000080
 #define R92C_TXDW4_DRVRATE     0x00000100
 #define R92C_TXDW4_CTS2SELF    0x00000800
 #define R92C_TXDW4_RTSEN       0x00001000
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to