Date: Sat, 25 Mar 2017 02:55:13 +0000 (UTC) From: Adrian Chadd <adrian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r315926 - head/sys/dev/iwm Message-ID: <201703250255.v2P2tDKJ043073@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: adrian Date: Sat Mar 25 02:55:13 2017 New Revision: 315926 URL: https://svnweb.freebsd.org/changeset/base/315926 Log: [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. Obtained from: dragonflybsd.git ab1d3efc208e797c1e09759cd506c95c0aeaa06e Modified: head/sys/dev/iwm/if_iwm.c head/sys/dev/iwm/if_iwm_mac_ctxt.c head/sys/dev/iwm/if_iwm_util.h Modified: head/sys/dev/iwm/if_iwm.c ============================================================================== --- head/sys/dev/iwm/if_iwm.c Sat Mar 25 02:49:20 2017 (r315925) +++ head/sys/dev/iwm/if_iwm.c Sat Mar 25 02:55:13 2017 (r315926) @@ -4291,6 +4291,21 @@ iwm_node_alloc(struct ieee80211vap *vap, 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: head/sys/dev/iwm/if_iwm_mac_ctxt.c ============================================================================== --- head/sys/dev/iwm/if_iwm_mac_ctxt.c Sat Mar 25 02:49:20 2017 (r315925) +++ head/sys/dev/iwm/if_iwm_mac_ctxt.c Sat Mar 25 02:55:13 2017 (r315926) @@ -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_s } 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,13 +450,11 @@ iwm_mvm_mac_ctxt_cmd_station(struct iwm_ { 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: head/sys/dev/iwm/if_iwm_util.h ============================================================================== --- head/sys/dev/iwm/if_iwm_util.h Sat Mar 25 02:49:20 2017 (r315925) +++ head/sys/dev/iwm/if_iwm_util.h Sat Mar 25 02:55:13 2017 (r315926) @@ -120,6 +120,8 @@ extern int iwm_dma_contig_alloc(bus_dma_ 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) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703250255.v2P2tDKJ043073>