From owner-svn-src-head@freebsd.org Sat Mar 25 02:55:14 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EEBEFD1CE44; Sat, 25 Mar 2017 02:55:14 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C95D416; Sat, 25 Mar 2017 02:55:14 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2P2tD9Y043076; Sat, 25 Mar 2017 02:55:13 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2P2tDKJ043073; Sat, 25 Mar 2017 02:55:13 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201703250255.v2P2tDKJ043073@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 25 Mar 2017 02:55:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r315926 - head/sys/dev/iwm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Mar 2017 02:55:15 -0000 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) {