rsi: Changed rate handling.

Changed rate handling.

Signed-off-by: Jahnavi Meher <jahnavi.meher@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Jahnavi Meher 2014-06-16 19:43:09 +05:30 committed by John W. Linville
parent 8701d03128
commit 0d59f5267d

View File

@ -942,7 +942,7 @@ static int rsi_send_auto_rate_request(struct rsi_common *common)
struct ieee80211_hw *hw = common->priv->hw; struct ieee80211_hw *hw = common->priv->hw;
u8 band = hw->conf.chandef.chan->band; u8 band = hw->conf.chandef.chan->band;
u8 num_supported_rates = 0; u8 num_supported_rates = 0;
u8 rate_offset = 0; u8 rate_table_offset, rate_offset = 0;
u32 rate_bitmap = common->bitrate_mask[band]; u32 rate_bitmap = common->bitrate_mask[band];
u16 *selected_rates, min_rate; u16 *selected_rates, min_rate;
@ -978,14 +978,18 @@ static int rsi_send_auto_rate_request(struct rsi_common *common)
if (common->channel_width == BW_40MHZ) if (common->channel_width == BW_40MHZ)
auto_rate->desc_word[7] |= cpu_to_le16(1); auto_rate->desc_word[7] |= cpu_to_le16(1);
if (band == IEEE80211_BAND_2GHZ) if (band == IEEE80211_BAND_2GHZ) {
min_rate = STD_RATE_01; min_rate = RSI_RATE_1;
else rate_table_offset = 0;
min_rate = STD_RATE_06; } else {
min_rate = RSI_RATE_6;
rate_table_offset = 4;
}
for (ii = 0, jj = 0; ii < ARRAY_SIZE(rsi_rates); ii++) { for (ii = 0, jj = 0; ii < ARRAY_SIZE(rsi_rates); ii++) {
if (rate_bitmap & BIT(ii)) { if (rate_bitmap & BIT(ii)) {
selected_rates[jj++] = (rsi_rates[ii].bitrate / 5); selected_rates[jj++] =
(rsi_rates[ii + rate_table_offset].bitrate / 5);
rate_offset++; rate_offset++;
} }
} }
@ -998,13 +1002,6 @@ static int rsi_send_auto_rate_request(struct rsi_common *common)
rate_offset += ARRAY_SIZE(mcs); rate_offset += ARRAY_SIZE(mcs);
} }
if (rate_offset < (RSI_TBL_SZ / 2) - 1) {
for (ii = jj; ii < (RSI_TBL_SZ / 2); ii++) {
selected_rates[jj++] = min_rate;
rate_offset++;
}
}
sort(selected_rates, jj, sizeof(u16), &rsi_compare, NULL); sort(selected_rates, jj, sizeof(u16), &rsi_compare, NULL);
/* mapping the rates to RSI rates */ /* mapping the rates to RSI rates */
@ -1020,25 +1017,25 @@ static int rsi_send_auto_rate_request(struct rsi_common *common)
/* loading HT rates in the bottom half of the auto rate table */ /* loading HT rates in the bottom half of the auto rate table */
if (common->vif_info[0].is_ht) { if (common->vif_info[0].is_ht) {
if (common->vif_info[0].sgi)
auto_rate->supported_rates[rate_offset++] =
cpu_to_le16(RSI_RATE_MCS7_SG);
for (ii = rate_offset, kk = ARRAY_SIZE(rsi_mcsrates) - 1; for (ii = rate_offset, kk = ARRAY_SIZE(rsi_mcsrates) - 1;
ii < rate_offset + 2 * ARRAY_SIZE(rsi_mcsrates); ii++) { ii < rate_offset + 2 * ARRAY_SIZE(rsi_mcsrates); ii++) {
if (common->vif_info[0].sgi) if (common->vif_info[0].sgi ||
conf_is_ht40(&common->priv->hw->conf))
auto_rate->supported_rates[ii++] = auto_rate->supported_rates[ii++] =
cpu_to_le16(rsi_mcsrates[kk] | BIT(9)); cpu_to_le16(rsi_mcsrates[kk] | BIT(9));
auto_rate->supported_rates[ii] = auto_rate->supported_rates[ii] =
cpu_to_le16(rsi_mcsrates[kk--]); cpu_to_le16(rsi_mcsrates[kk--]);
} }
for (; ii < RSI_TBL_SZ; ii++) { for (; ii < (RSI_TBL_SZ - 1); ii++) {
auto_rate->supported_rates[ii] = auto_rate->supported_rates[ii] =
cpu_to_le16(rsi_mcsrates[0]); cpu_to_le16(rsi_mcsrates[0]);
} }
} }
for (; ii < RSI_TBL_SZ; ii++)
auto_rate->supported_rates[ii] = min_rate;
auto_rate->num_supported_rates = cpu_to_le16(num_supported_rates * 2); auto_rate->num_supported_rates = cpu_to_le16(num_supported_rates * 2);
auto_rate->moderate_rate_inx = cpu_to_le16(num_supported_rates / 2); auto_rate->moderate_rate_inx = cpu_to_le16(num_supported_rates / 2);
auto_rate->desc_word[7] |= cpu_to_le16(0 << 8); auto_rate->desc_word[7] |= cpu_to_le16(0 << 8);