Skip to content

Commit

Permalink
ath6kl: fix link speed when using sgi
Browse files Browse the repository at this point in the history
The MSB of rate index from FW is used for sgi. But the ath6kl_wmi_get_rate
doesn't handle it. The access to wmi_rate_tbl array may be out of range
if sgi is 1. This may cause the return value of ath6kl_wmi_get_rate()
function is incorrect link rate. We add sgi adjustment to avoid such case.

kvalo: change patch title

Signed-off-by: Dengke Qiu <dqiu@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
  • Loading branch information
Dengke Qiu authored and Kalle Valo committed Oct 24, 2012
1 parent 3814264 commit 8368509
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 12 additions & 1 deletion drivers/net/wireless/ath/ath6kl/wmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -3263,10 +3263,21 @@ int ath6kl_wmi_set_regdomain_cmd(struct wmi *wmi, const char *alpha2)

s32 ath6kl_wmi_get_rate(s8 rate_index)
{
u8 sgi = 0;

if (rate_index == RATE_AUTO)
return 0;

return wmi_rate_tbl[(u32) rate_index][0];
/* SGI is stored as the MSB of the rate_index */
if (rate_index & RATE_INDEX_MSB) {
rate_index &= RATE_INDEX_WITHOUT_SGI_MASK;
sgi = 1;
}

if (WARN_ON(rate_index > RATE_MCS_7_40))
rate_index = RATE_MCS_7_40;

return wmi_rate_tbl[(u32) rate_index][sgi];
}

static int ath6kl_wmi_get_pmkid_list_event_rx(struct wmi *wmi, u8 *datap,
Expand Down
3 changes: 3 additions & 0 deletions drivers/net/wireless/ath/ath6kl/wmi.h
Original file line number Diff line number Diff line change
Expand Up @@ -1792,6 +1792,9 @@ struct rx_stats {
a_sle32 ucast_rate;
} __packed;

#define RATE_INDEX_WITHOUT_SGI_MASK 0x7f
#define RATE_INDEX_MSB 0x80

struct tkip_ccmp_stats {
__le32 tkip_local_mic_fail;
__le32 tkip_cnter_measures_invoked;
Expand Down

0 comments on commit 8368509

Please sign in to comment.