From 5098e9a8bc705acede48947dddce273b7f8be4e7 Mon Sep 17 00:00:00 2001 From: stsp Date: Thu, 21 Jul 2016 08:38:33 +0000 Subject: [PATCH] Make rtwn(4) and urtwn(4) respect the RTS threshold set by net80211. ok mpi@ --- sys/dev/pci/if_rtwn.c | 7 +++++-- sys/dev/usb/if_urtwn.c | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/sys/dev/pci/if_rtwn.c b/sys/dev/pci/if_rtwn.c index 9836bde7c90..a50eec59b52 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.22 2016/06/17 10:53:55 stsp Exp $ */ +/* $OpenBSD: if_rtwn.c,v 1.23 2016/07/21 08:38:33 stsp Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini @@ -985,7 +985,10 @@ rtwn_tx(void *cookie, struct mbuf *m, struct ieee80211_node *ni) SM(R92C_TXDW1_RAID, raid) | R92C_TXDW1_AGGBK); - if (ic->ic_flags & IEEE80211_F_USEPROT) { + if (m->m_pkthdr.len + IEEE80211_CRC_LEN > ic->ic_rtsthreshold) { + txd->txdw4 |= htole32(R92C_TXDW4_RTSEN | + R92C_TXDW4_HWRTSEN); + } else if (ic->ic_flags & IEEE80211_F_USEPROT) { if (ic->ic_protmode == IEEE80211_PROT_CTSONLY) { txd->txdw4 |= htole32(R92C_TXDW4_CTS2SELF | R92C_TXDW4_HWRTSEN); diff --git a/sys/dev/usb/if_urtwn.c b/sys/dev/usb/if_urtwn.c index 5ef068006b7..cc00ea9365b 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.65 2016/06/17 10:53:55 stsp Exp $ */ +/* $OpenBSD: if_urtwn.c,v 1.66 2016/07/21 08:38:33 stsp Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini @@ -1299,7 +1299,10 @@ urtwn_tx(void *cookie, struct mbuf *m, struct ieee80211_node *ni) SM(R92C_TXDW1_RAID, raid) | R92C_TXDW1_AGGBK); } - if (ic->ic_flags & IEEE80211_F_USEPROT) { + if (m->m_pkthdr.len + IEEE80211_CRC_LEN > ic->ic_rtsthreshold) { + txd->txdw4 |= htole32(R92C_TXDW4_RTSEN | + R92C_TXDW4_HWRTSEN); + } else if (ic->ic_flags & IEEE80211_F_USEPROT) { if (ic->ic_protmode == IEEE80211_PROT_CTSONLY) { txd->txdw4 |= htole32(R92C_TXDW4_CTS2SELF | R92C_TXDW4_HWRTSEN); -- 2.20.1