From owner-svn-src-stable@freebsd.org Thu Mar 1 06:34:49 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F10CBF28FCC; Thu, 1 Mar 2018 06:34:48 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A79A26A09A; Thu, 1 Mar 2018 06:34:48 +0000 (UTC) (envelope-from eadler@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A2A1F24DEF; Thu, 1 Mar 2018 06:34:48 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w216YmJe058067; Thu, 1 Mar 2018 06:34:48 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w216YmmP058064; Thu, 1 Mar 2018 06:34:48 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803010634.w216YmmP058064@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Thu, 1 Mar 2018 06:34:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r330202 - stable/11/sys/dev/iwm X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/dev/iwm X-SVN-Commit-Revision: 330202 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Mar 2018 06:34:49 -0000 Author: eadler Date: Thu Mar 1 06:34:48 2018 New Revision: 330202 URL: https://svnweb.freebsd.org/changeset/base/330202 Log: MFC r318012: [iwm] Allow listening on both chains/atennas to get diversity. This might improve throughput slightly when far from the accesspoint, apparently by allowing the firmware to listen on either of the two antennas (if there are two, i.e. on 7260/7265/8260), whichever has a better reception. Modified: stable/11/sys/dev/iwm/if_iwm_phy_ctxt.c stable/11/sys/dev/iwm/if_iwm_util.c stable/11/sys/dev/iwm/if_iwm_util.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/iwm/if_iwm_phy_ctxt.c ============================================================================== --- stable/11/sys/dev/iwm/if_iwm_phy_ctxt.c Thu Mar 1 06:34:21 2018 (r330201) +++ stable/11/sys/dev/iwm/if_iwm_phy_ctxt.c Thu Mar 1 06:34:48 2018 (r330202) @@ -217,6 +217,18 @@ iwm_mvm_phy_ctxt_cmd_data(struct iwm_softc *sc, idle_cnt = chains_static; active_cnt = chains_dynamic; + /* In scenarios where we only ever use a single-stream rates, + * i.e. legacy 11b/g/a associations, single-stream APs or even + * static SMPS, enable both chains to get diversity, improving + * the case where we're far enough from the AP that attenuation + * between the two antennas is sufficiently different to impact + * performance. + */ + if (active_cnt == 1 && iwm_mvm_rx_diversity_allowed(sc)) { + idle_cnt = 2; + active_cnt = 2; + } + cmd->rxchain_info = htole32(iwm_mvm_get_valid_rx_ant(sc) << IWM_PHY_RX_CHAIN_VALID_POS); cmd->rxchain_info |= htole32(idle_cnt << IWM_PHY_RX_CHAIN_CNT_POS); Modified: stable/11/sys/dev/iwm/if_iwm_util.c ============================================================================== --- stable/11/sys/dev/iwm/if_iwm_util.c Thu Mar 1 06:34:21 2018 (r330201) +++ stable/11/sys/dev/iwm/if_iwm_util.c Thu Mar 1 06:34:48 2018 (r330202) @@ -152,6 +152,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -485,4 +486,18 @@ iwm_dma_contig_free(struct iwm_dma_info *dma) bus_dma_tag_destroy(dma->tag); dma->tag = NULL; } +} + +boolean_t +iwm_mvm_rx_diversity_allowed(struct iwm_softc *sc) +{ + if (num_of_ant(iwm_mvm_get_valid_rx_ant(sc)) == 1) + return FALSE; + + /* + * XXX Also return FALSE when SMPS (Spatial Multiplexing Powersave) + * is used on any vap (in the future). + */ + + return TRUE; } Modified: stable/11/sys/dev/iwm/if_iwm_util.h ============================================================================== --- stable/11/sys/dev/iwm/if_iwm_util.h Thu Mar 1 06:34:21 2018 (r330201) +++ stable/11/sys/dev/iwm/if_iwm_util.h Thu Mar 1 06:34:48 2018 (r330202) @@ -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 boolean_t iwm_mvm_rx_diversity_allowed(struct iwm_softc *sc); + extern uint8_t iwm_ridx2rate(struct ieee80211_rateset *rs, int ridx); static inline uint8_t