diff options
author | Jonathan Matthew <jmatthew@cvs.openbsd.org> | 2018-10-01 11:03:47 +0000 |
---|---|---|
committer | Jonathan Matthew <jmatthew@cvs.openbsd.org> | 2018-10-01 11:03:47 +0000 |
commit | 13d1988b190b33c894f16c039bd0c90dfc1731d6 (patch) | |
tree | bb8064df6811ecfcce3340c13d5ee346b7cfb1c6 /sys/dev | |
parent | 8a17797083cb25f778796323294e512fb3897f9c (diff) |
The sequence number field in the 802.11 frame header includes the sequence
number and the fragment number, so shift it to get just the sequence number
for the tx descriptor. While here, add a #define for the flag in the same
field that enables hardware sequence numbering, and use existing constants
for some R92C_RSV_CTRL writes.
prompted by feedback from kevlo@ on another diff, tested on 8188CE, EE, EU
ok stsp@ kevlo@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ic/r92creg.h | 4 | ||||
-rw-r--r-- | sys/dev/pci/if_rtwn.c | 12 | ||||
-rw-r--r-- | sys/dev/usb/if_urtwn.c | 6 |
3 files changed, 13 insertions, 9 deletions
diff --git a/sys/dev/ic/r92creg.h b/sys/dev/ic/r92creg.h index c7250cdbe3d..cbd944eaa16 100644 --- a/sys/dev/ic/r92creg.h +++ b/sys/dev/ic/r92creg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: r92creg.h,v 1.19 2018/09/28 02:38:38 kevlo Exp $ */ +/* $OpenBSD: r92creg.h,v 1.20 2018/10/01 11:03:46 jmatthew Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> @@ -1372,6 +1372,8 @@ struct r92c_tx_desc_usb { #define R88E_TXDW2_AGGBK 0x00010000 #define R92C_TXDW2_CCX_RPT 0x00080000 +#define R92C_TXDW3_HWSEQEN 0x8000 + #define R92C_TXDW4_RTSRATE_M 0x0000001f #define R92C_TXDW4_RTSRATE_S 0 #define R92C_TXDW4_QOS 0x00000040 diff --git a/sys/dev/pci/if_rtwn.c b/sys/dev/pci/if_rtwn.c index f9a713bb9a4..b583a8dab47 100644 --- a/sys/dev/pci/if_rtwn.c +++ b/sys/dev/pci/if_rtwn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rtwn.c,v 1.33 2018/09/21 01:45:53 jmatthew Exp $ */ +/* $OpenBSD: if_rtwn.c,v 1.34 2018/10/01 11:03:46 jmatthew Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> @@ -1102,12 +1102,12 @@ rtwn_tx(void *cookie, struct mbuf *m, struct ieee80211_node *ni) txd->txdw5 |= htole32(SM(R92C_TXDW5_DATARATE, 0)); } /* Set sequence number (already little endian). */ - txd->txdseq = *(uint16_t *)wh->i_seq; + txd->txdseq = (*(uint16_t *)wh->i_seq) >> IEEE80211_SEQ_SEQ_SHIFT; if (!hasqos) { /* Use HW sequence numbering for non-QoS frames. */ txd->txdw4 |= htole32(R92C_TXDW4_HWSEQ); - txd->txdseq |= htole16(0x8000); /* WTF? */ + txd->txdseq |= htole16(R92C_TXDW3_HWSEQEN); } else txd->txdw4 |= htole32(R92C_TXDW4_QOS); @@ -1335,7 +1335,8 @@ rtwn_pci_88e_stop(struct rtwn_pci_softc *sc) rtwn_pci_write_1(sc, R92C_RSV_CTRL + 1, rtwn_pci_read_1(sc, R92C_RSV_CTRL + 1) | 0x08); - rtwn_pci_write_1(sc, R92C_RSV_CTRL, 0x0e); + rtwn_pci_write_1(sc, R92C_RSV_CTRL, R92C_RSV_CTRL_WLOCK_00 | + R92C_RSV_CTRL_WLOCK_04 | R92C_RSV_CTRL_WLOCK_08); for (i = 0; i < RTWN_NTXQUEUES; i++) rtwn_reset_tx_list(sc, i); @@ -1381,7 +1382,8 @@ rtwn_pci_stop(void *cookie) rtwn_pci_write_2(sc, R92C_AFE_PLL_CTRL, 0x80); /* linux magic number */ rtwn_pci_write_1(sc, R92C_SPS0_CTRL, 0x23); /* ditto */ rtwn_pci_write_1(sc, R92C_AFE_XTAL_CTRL, 0x0e); /* differs in btcoex */ - rtwn_pci_write_1(sc, R92C_RSV_CTRL, 0x0e); + rtwn_pci_write_1(sc, R92C_RSV_CTRL, R92C_RSV_CTRL_WLOCK_00 | + R92C_RSV_CTRL_WLOCK_04 | R92C_RSV_CTRL_WLOCK_08); rtwn_pci_write_1(sc, R92C_APS_FSMCO, R92C_APS_FSMCO_PDN_EN); for (i = 0; i < RTWN_NTXQUEUES; i++) diff --git a/sys/dev/usb/if_urtwn.c b/sys/dev/usb/if_urtwn.c index c90c219762a..325edba3fd9 100644 --- a/sys/dev/usb/if_urtwn.c +++ b/sys/dev/usb/if_urtwn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_urtwn.c,v 1.78 2018/07/19 17:34:22 sthen Exp $ */ +/* $OpenBSD: if_urtwn.c,v 1.79 2018/10/01 11:03:46 jmatthew Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> @@ -1424,12 +1424,12 @@ urtwn_tx(void *cookie, struct mbuf *m, struct ieee80211_node *ni) txd->txdw5 |= htole32(SM(R92C_TXDW5_DATARATE, 0)); } /* Set sequence number (already little endian). */ - txd->txdseq |= *(uint16_t *)wh->i_seq; + txd->txdseq |= (*(uint16_t *)wh->i_seq) >> IEEE80211_SEQ_SEQ_SHIFT; if (!hasqos) { /* Use HW sequence numbering for non-QoS frames. */ txd->txdw4 |= htole32(R92C_TXDW4_HWSEQ); - txd->txdseq |= htole16(0x8000); /* WTF? */ + txd->txdseq |= htole16(R92C_TXDW3_HWSEQEN); } else txd->txdw4 |= htole32(R92C_TXDW4_QOS); |