Currently, if running in 11n mode, iwm always enables RTS/CTS to protect
frames it is sending.

To recap what the various HT protection modes are:

/*
 * HT protection modes (see 802.11-2012 8.4.2.59)
 */
enum ieee80211_htprot {
        IEEE80211_HTPROT_NONE = 0,      /* only 20/40MHz HT STAs exist */
        IEEE80211_HTPROT_NONMEMBER,     /* non-HT STA overlaps our channel */ 
        IEEE80211_HTPROT_20MHZ,         /* 20MHz HT STA on a 40MHz channel */
        IEEE80211_HTPROT_NONHT_MIXED    /* non-HT STA associated to our BSS */
};

If HT protection is 'none' or '20 MHz', we should not have to protect frames.
Frame protection adds some overhead, so in theory not using protection
should make Tx faster.

This is an experimental change, and is not targeting 6.0.

Still, it would be nice to get some test reports, especially where there are
no 11a/b/g networks in the neighbourhood and all devices are capable of 11n.

Index: if_iwm.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_iwm.c,v
retrieving revision 1.95
diff -u -p -r1.95 if_iwm.c
--- if_iwm.c    18 Jul 2016 13:10:35 -0000      1.95
+++ if_iwm.c    20 Jul 2016 12:15:54 -0000
@@ -2799,6 +2799,9 @@ iwm_htprot_task(void *arg)
        if (error != 0)
                printf("%s: could not change HT protection: error %d\n",
                    DEVNAME(sc), error);
+
+       /* Also update RTS/CTS config via LQ command. */
+       iwm_setrates(in);
 }
 
 /*
@@ -6093,9 +6096,14 @@ iwm_setrates(struct iwm_node *in)
        memset(lq, 0, sizeof(*lq));
        lq->sta_id = IWM_STATION_ID;
 
-       /* For HT, always enable RTS/CTS to avoid excessive retries. */
-       if (ni->ni_flags & IEEE80211_NODE_HT)
-               lq->flags |= IWM_LQ_FLAG_USE_RTS_MSK;
+       /* Enable RTS/CTS for HT protection. */
+       if (ni->ni_flags & IEEE80211_NODE_HT) {
+               enum ieee80211_htprot htprot =
+                   (ni->ni_htop1 & IEEE80211_HTOP1_PROT_MASK);
+               if (htprot == IEEE80211_HTPROT_NONMEMBER ||
+                   htprot == IEEE80211_HTPROT_NONHT_MIXED)
+                       lq->flags |= IWM_LQ_FLAG_USE_RTS_MSK;
+       }
 
        /*
         * Fill the LQ rate selection table with legacy and/or HT rates

Reply via email to