Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 May 2017 05:31:39 +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: r318012 - head/sys/dev/iwm
Message-ID:  <201705090531.v495Vdw3057411@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Tue May  9 05:31:38 2017
New Revision: 318012
URL: https://svnweb.freebsd.org/changeset/base/318012

Log:
  [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.
  
  Obtained from:	dragonflybsd.git 3b7fc5aac51f81062da0a2c8fdac23e683fbd548

Modified:
  head/sys/dev/iwm/if_iwm_phy_ctxt.c
  head/sys/dev/iwm/if_iwm_util.c
  head/sys/dev/iwm/if_iwm_util.h

Modified: head/sys/dev/iwm/if_iwm_phy_ctxt.c
==============================================================================
--- head/sys/dev/iwm/if_iwm_phy_ctxt.c	Tue May  9 05:22:51 2017	(r318011)
+++ head/sys/dev/iwm/if_iwm_phy_ctxt.c	Tue May  9 05:31:38 2017	(r318012)
@@ -218,6 +218,18 @@ iwm_mvm_phy_ctxt_cmd_data(struct iwm_sof
 	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: head/sys/dev/iwm/if_iwm_util.c
==============================================================================
--- head/sys/dev/iwm/if_iwm_util.c	Tue May  9 05:22:51 2017	(r318011)
+++ head/sys/dev/iwm/if_iwm_util.c	Tue May  9 05:31:38 2017	(r318012)
@@ -153,6 +153,7 @@ __FBSDID("$FreeBSD$");
 
 #include <dev/iwm/if_iwmreg.h>
 #include <dev/iwm/if_iwmvar.h>
+#include <dev/iwm/if_iwm_config.h>
 #include <dev/iwm/if_iwm_debug.h>
 #include <dev/iwm/if_iwm_binding.h>
 #include <dev/iwm/if_iwm_util.h>
@@ -487,3 +488,17 @@ iwm_dma_contig_free(struct iwm_dma_info 
 		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: head/sys/dev/iwm/if_iwm_util.h
==============================================================================
--- head/sys/dev/iwm/if_iwm_util.h	Tue May  9 05:22:51 2017	(r318011)
+++ head/sys/dev/iwm/if_iwm_util.h	Tue May  9 05:31:38 2017	(r318012)
@@ -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	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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201705090531.v495Vdw3057411>