Make rtwn(4) and urtwn(4) respect the RTS threshold set by net80211.
authorstsp <stsp@openbsd.org>
Thu, 21 Jul 2016 08:38:33 +0000 (08:38 +0000)
committerstsp <stsp@openbsd.org>
Thu, 21 Jul 2016 08:38:33 +0000 (08:38 +0000)
ok mpi@

sys/dev/pci/if_rtwn.c
sys/dev/usb/if_urtwn.c

index 9836bde..a50eec5 100644 (file)
@@ -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 <damien.bergamini@free.fr>
@@ -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);
index 5ef0680..cc00ea9 100644 (file)
@@ -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 <damien.bergamini@free.fr>
@@ -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);