iwlwifi: set correct single/dual stream mask
authorWey-Yi Guy <wey-yi.w.guy@intel.com>
Sat, 3 Apr 2010 23:44:39 +0000 (16:44 -0700)
committerReinette Chatre <reinette.chatre@intel.com>
Fri, 16 Apr 2010 20:46:29 +0000 (13:46 -0700)
Even the initial single/dual stream values will be overridden later when
issue link quality command; but still make sense not to use hard-code
value during initialization. Single/Dual stream mask are used to indicate the
best antenna for SISO/MIMO; different NIC has different tx antenna
configuration; so the parameter need to based on the valid tx antenna.

1x2 device: single tx antenna available, only SISO is valid
configuration, but still need to set up MIMO configuration, so set it up
with antenna A & B as default.
2x2 device: two tx antenna available, dual_stream will use both valid
antenna.

3x3 device: three tx antenna available, skip the first antenna and
choice the second and third antenna for dual_stream.

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
drivers/net/wireless/iwlwifi/iwl-agn-rs.c
drivers/net/wireless/iwlwifi/iwl-sta.c

index 3c1cd417bbc520765cd5b7be2f3b4f1070401413..5bc406c5c7935c1bbb18d98b667cecc35859742c 100644 (file)
@@ -2557,8 +2557,17 @@ void iwl_rs_rate_init(struct iwl_priv *priv, struct ieee80211_sta *sta, u8 sta_i
                     lq_sta->active_mimo3_rate);
 
        /* These values will be overridden later */
-       lq_sta->lq.general_params.single_stream_ant_msk = ANT_A;
-       lq_sta->lq.general_params.dual_stream_ant_msk = ANT_AB;
+       lq_sta->lq.general_params.single_stream_ant_msk =
+               first_antenna(priv->hw_params.valid_tx_ant);
+       lq_sta->lq.general_params.dual_stream_ant_msk =
+               priv->hw_params.valid_tx_ant &
+               ~first_antenna(priv->hw_params.valid_tx_ant);
+       if (!lq_sta->lq.general_params.dual_stream_ant_msk) {
+               lq_sta->lq.general_params.dual_stream_ant_msk = ANT_AB;
+       } else if (num_of_ant(priv->hw_params.valid_tx_ant) == 2) {
+               lq_sta->lq.general_params.dual_stream_ant_msk =
+                       priv->hw_params.valid_tx_ant;
+       }
 
        /* as default allow aggregation for all tids */
        lq_sta->tx_agg_tid_en = IWL_AGG_ALL_TID;
index d86ecd2f9ec2ff96bbb3d2d1dd6a1983cd780642..09d9c4d564508fc4143cd75ad9a305e429eb044f 100644 (file)
@@ -451,7 +451,17 @@ static void iwl_sta_init_lq(struct iwl_priv *priv, const u8 *addr, bool is_ap)
 
        link_cmd.general_params.single_stream_ant_msk =
                                first_antenna(priv->hw_params.valid_tx_ant);
-       link_cmd.general_params.dual_stream_ant_msk = 3;
+
+       link_cmd.general_params.dual_stream_ant_msk =
+               priv->hw_params.valid_tx_ant &
+               ~first_antenna(priv->hw_params.valid_tx_ant);
+       if (!link_cmd.general_params.dual_stream_ant_msk) {
+               link_cmd.general_params.dual_stream_ant_msk = ANT_AB;
+       } else if (num_of_ant(priv->hw_params.valid_tx_ant) == 2) {
+               link_cmd.general_params.dual_stream_ant_msk =
+                       priv->hw_params.valid_tx_ant;
+       }
+
        link_cmd.agg_params.agg_dis_start_th = LINK_QUAL_AGG_DISABLE_START_DEF;
        link_cmd.agg_params.agg_time_limit =
                cpu_to_le16(LINK_QUAL_AGG_TIME_LIMIT_DEF);