Author: eadler
Date: Thu Mar  1 06:31:07 2018
New Revision: 330198
URL: https://svnweb.freebsd.org/changeset/base/330198

Log:
  MFC r315926:
  
  [iwm] Add the BSS's basic rates to iwm's LQ command, not all the rates.
  
  Makes the firmware use appropriate Tx rates for ACKs.

Modified:
  stable/11/sys/dev/iwm/if_iwm.c
  stable/11/sys/dev/iwm/if_iwm_mac_ctxt.c
  stable/11/sys/dev/iwm/if_iwm_util.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/iwm/if_iwm.c
==============================================================================
--- stable/11/sys/dev/iwm/if_iwm.c      Thu Mar  1 06:29:02 2018        
(r330197)
+++ stable/11/sys/dev/iwm/if_iwm.c      Thu Mar  1 06:31:07 2018        
(r330198)
@@ -4276,6 +4276,21 @@ iwm_node_alloc(struct ieee80211vap *vap, const uint8_t
            M_NOWAIT | M_ZERO);
 }
 
+uint8_t
+iwm_ridx2rate(struct ieee80211_rateset *rs, int ridx)
+{
+       int i;
+       uint8_t rval;
+
+       for (i = 0; i < rs->rs_nrates; i++) {
+               rval = (rs->rs_rates[i] & IEEE80211_RATE_VAL);
+               if (rval == iwm_rates[ridx].rate)
+                       return rs->rs_rates[i];
+       }
+
+       return 0;
+}
+
 static void
 iwm_setrates(struct iwm_softc *sc, struct iwm_node *in)
 {

Modified: stable/11/sys/dev/iwm/if_iwm_mac_ctxt.c
==============================================================================
--- stable/11/sys/dev/iwm/if_iwm_mac_ctxt.c     Thu Mar  1 06:29:02 2018        
(r330197)
+++ stable/11/sys/dev/iwm/if_iwm_mac_ctxt.c     Thu Mar  1 06:31:07 2018        
(r330198)
@@ -162,24 +162,28 @@ __FBSDID("$FreeBSD$");
 
 static void
 iwm_mvm_ack_rates(struct iwm_softc *sc, int is2ghz,
-       int *cck_rates, int *ofdm_rates)
+       int *cck_rates, int *ofdm_rates, struct iwm_node *in)
 {
        int lowest_present_ofdm = 100;
        int lowest_present_cck = 100;
        uint8_t cck = 0;
        uint8_t ofdm = 0;
        int i;
+       struct ieee80211_rateset *rs = &in->in_ni.ni_rates;
 
        if (is2ghz) {
-               for (i = 0; i <= IWM_LAST_CCK_RATE; i++) {
+               for (i = IWM_FIRST_CCK_RATE; i <= IWM_LAST_CCK_RATE; i++) {
+                       if ((iwm_ridx2rate(rs, i) & IEEE80211_RATE_BASIC) == 0)
+                               continue;
                        cck |= (1 << i);
                        if (lowest_present_cck > i)
                                lowest_present_cck = i;
                }
        }
        for (i = IWM_FIRST_OFDM_RATE; i <= IWM_LAST_NON_HT_RATE; i++) {
-               int adj = i - IWM_FIRST_OFDM_RATE;
-               ofdm |= (1 << adj);
+               if ((iwm_ridx2rate(rs, i) & IEEE80211_RATE_BASIC) == 0)
+                       continue;
+               ofdm |= (1 << (i - IWM_FIRST_OFDM_RATE));
                if (lowest_present_ofdm > i)
                        lowest_present_ofdm = i;
        }
@@ -307,7 +311,7 @@ iwm_mvm_mac_ctxt_cmd_common(struct iwm_softc *sc, stru
        } else {
                is2ghz = 1;
        }
-       iwm_mvm_ack_rates(sc, is2ghz, &cck_ack_rates, &ofdm_ack_rates);
+       iwm_mvm_ack_rates(sc, is2ghz, &cck_ack_rates, &ofdm_ack_rates, in);
        cmd->cck_rates = htole32(cck_ack_rates);
        cmd->ofdm_rates = htole32(ofdm_ack_rates);
 
@@ -446,12 +450,10 @@ iwm_mvm_mac_ctxt_cmd_station(struct iwm_softc *sc, str
 {
        struct ieee80211_node *ni = vap->iv_bss;
        struct iwm_node *in = IWM_NODE(ni);
-       struct iwm_mac_ctx_cmd cmd;
+       struct iwm_mac_ctx_cmd cmd = {};
 
        IWM_DPRINTF(sc, IWM_DEBUG_RESET,
            "%s: called; action=%d\n", __func__, action);
-
-       memset(&cmd, 0, sizeof(cmd));
 
        /* Fill the common data for all mac context types */
        iwm_mvm_mac_ctxt_cmd_common(sc, in, &cmd, action);

Modified: stable/11/sys/dev/iwm/if_iwm_util.h
==============================================================================
--- stable/11/sys/dev/iwm/if_iwm_util.h Thu Mar  1 06:29:02 2018        
(r330197)
+++ stable/11/sys/dev/iwm/if_iwm_util.h Thu Mar  1 06:31:07 2018        
(r330198)
@@ -120,6 +120,8 @@ extern      int iwm_dma_contig_alloc(bus_dma_tag_t tag, str
                                 bus_size_t size, bus_size_t alignment);
 extern void iwm_dma_contig_free(struct iwm_dma_info *);
 
+extern uint8_t iwm_ridx2rate(struct ieee80211_rateset *rs, int ridx);
+
 static inline uint8_t
 iwm_mvm_get_valid_tx_ant(struct iwm_softc *sc)
 {
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to