]> Pileus Git - ~andy/linux/blobdiff - drivers/net/wireless/iwlwifi/mvm/rs.c
Merge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi...
[~andy/linux] / drivers / net / wireless / iwlwifi / mvm / rs.c
index ba078a3322b8014a7d9f31fcd443a0fb572b37ce..6abf74e1351f0d97ab8a5161e4d2d81199f67c1b 100644 (file)
@@ -356,7 +356,7 @@ static int iwl_hwrate_to_plcp_idx(u32 rate_n_flags)
                                return idx;
        }
 
-       return -1;
+       return IWL_RATE_INVALID;
 }
 
 static void rs_rate_scale_perform(struct iwl_mvm *mvm,
@@ -702,10 +702,8 @@ static int rs_rate_from_ucode_rate(const u32 ucode_rate,
        memset(rate, 0, sizeof(*rate));
        rate->index = iwl_hwrate_to_plcp_idx(ucode_rate);
 
-       if (rate->index == IWL_RATE_INVALID) {
-               rate->index = -1;
+       if (rate->index == IWL_RATE_INVALID)
                return -EINVAL;
-       }
 
        rate->ant = (ant_msk >> RATE_MCS_ANT_POS);
 
@@ -1590,6 +1588,8 @@ static int rs_switch_to_column(struct iwl_mvm *mvm,
        search_tbl->column = col_id;
        rs_set_expected_tpt_table(lq_sta, search_tbl);
 
+       lq_sta->visited_columns |= BIT(col_id);
+
        /* Get the best matching rate if we're changing modes. e.g.
         * SISO->MIMO, LEGACY->SISO, MIMO->SISO
         */
@@ -1613,7 +1613,6 @@ static int rs_switch_to_column(struct iwl_mvm *mvm,
        IWL_DEBUG_RATE(mvm, "Switched to column %d: Index %d\n",
                       col_id, rate->index);
 
-       lq_sta->visited_columns |= BIT(col_id);
        return 0;
 
 err:
@@ -2560,7 +2559,9 @@ static int rs_pretty_print_rate(char *buf, const u32 rate)
                int index = iwl_hwrate_to_plcp_idx(rate);
 
                return sprintf(buf, "Legacy | ANT: %s Rate: %s Mbps\n",
-                              rs_pretty_ant(ant), iwl_rate_mcs[index].mbps);
+                              rs_pretty_ant(ant),
+                              index == IWL_RATE_INVALID ? "BAD" :
+                              iwl_rate_mcs[index].mbps);
        }
 
        if (rate & RATE_MCS_VHT_MSK) {