summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorStefan Sperling <stsp@cvs.openbsd.org>2022-03-15 09:23:02 +0000
committerStefan Sperling <stsp@cvs.openbsd.org>2022-03-15 09:23:02 +0000
commit850d72d4e8e9d47523041180861f8d3a7432bd80 (patch)
treea4da8e706ddaceab25f807b62a0066ec6cee0f0f /sys
parent7e825979c3224b9fb530755563fb3e663345802a (diff)
Fix Tx rate used by rtwn(4) and urtwn(4) for RTS frames.
Using ni_txrate for RTS is a bad choice since it could go up to 54 Mbit/s. The AP needs to receive our RTS frame reliably. Usually, 1 Mbit/s is used for RTS, but this hurts throughput and does not really make sense on today's wifi networks. Use 1 Mbit/s in 11b mode, and otherwise use 24 Mbit/s, as damien@ already hard-coded in urtwn long ago. ok kevlo@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/if_rtwn.c4
-rw-r--r--sys/dev/usb/if_urtwn.c18
2 files changed, 13 insertions, 9 deletions
diff --git a/sys/dev/pci/if_rtwn.c b/sys/dev/pci/if_rtwn.c
index 449729c000e..ffd1dbe539f 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.38 2021/10/04 01:33:42 kevlo Exp $ */
+/* $OpenBSD: if_rtwn.c,v 1.39 2022/03/15 09:22:56 stsp Exp $ */
/*-
* Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr>
@@ -1095,7 +1095,7 @@ rtwn_tx(void *cookie, struct mbuf *m, struct ieee80211_node *ni)
if (ic->ic_curmode == IEEE80211_MODE_11B)
txd->txdw4 |= htole32(SM(R92C_TXDW4_RTSRATE, 0));
else
- txd->txdw4 |= htole32(SM(R92C_TXDW4_RTSRATE, 3));
+ txd->txdw4 |= htole32(SM(R92C_TXDW4_RTSRATE, 8));
txd->txdw5 |= htole32(SM(R92C_TXDW5_RTSRATE_FBLIMIT, 0xf));
/* Use AMMR rate for data. */
diff --git a/sys/dev/usb/if_urtwn.c b/sys/dev/usb/if_urtwn.c
index 51fc0120f82..8601bf45e72 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.98 2021/10/04 01:33:42 kevlo Exp $ */
+/* $OpenBSD: if_urtwn.c,v 1.99 2022/03/15 09:23:01 stsp Exp $ */
/*-
* Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr>
@@ -1448,7 +1448,7 @@ urtwn_tx_fill_desc(struct urtwn_softc *sc, uint8_t **txdp, struct mbuf *m,
{
struct r92c_tx_desc_usb *txd;
struct ieee80211com *ic = &sc->sc_sc.sc_ic;
- uint8_t raid, type;
+ uint8_t raid, type, rtsrate;
uint32_t pktlen;
txd = (struct r92c_tx_desc_usb *)*txdp;
@@ -1507,16 +1507,20 @@ urtwn_tx_fill_desc(struct urtwn_softc *sc, uint8_t **txdp, struct mbuf *m,
}
txd->txdw5 |= htole32(0x0001ff00);
+ if (ic->ic_curmode == IEEE80211_MODE_11B)
+ rtsrate = 0; /* CCK1 */
+ else
+ rtsrate = 8; /* OFDM24 */
+
if (sc->sc_sc.chip & RTWN_CHIP_88E) {
/* Use AMRR */
txd->txdw4 |= htole32(R92C_TXDW4_DRVRATE);
- txd->txdw4 |= htole32(SM(R92C_TXDW4_RTSRATE,
- ni->ni_txrate));
+ txd->txdw4 |= htole32(SM(R92C_TXDW4_RTSRATE, rtsrate));
txd->txdw5 |= htole32(SM(R92C_TXDW5_DATARATE,
ni->ni_txrate));
} else {
- /* Send RTS at OFDM24 and data at OFDM54. */
- txd->txdw4 |= htole32(SM(R92C_TXDW4_RTSRATE, 8));
+ /* Send data at OFDM54. */
+ txd->txdw4 |= htole32(SM(R92C_TXDW4_RTSRATE, rtsrate));
txd->txdw5 |= htole32(SM(R92C_TXDW5_DATARATE, 11));
}
} else {
@@ -1600,7 +1604,7 @@ urtwn_tx_fill_desc_gen2(struct urtwn_softc *sc, uint8_t **txdp, struct mbuf *m,
/* Use AMRR */
txd->txdw3 |= htole32(R92E_TXDW3_DRVRATE);
- txd->txdw4 |= htole32(SM(R92E_TXDW4_RTSRATE, ni->ni_txrate));
+ txd->txdw4 |= htole32(SM(R92E_TXDW4_RTSRATE, 8));
txd->txdw4 |= htole32(SM(R92E_TXDW4_DATARATE, ni->ni_txrate));
} else {
txd->txdw1 |= htole32(