diff options
author | Fred Chou <fred.chou.nd@gmail.com> | 2015-03-13 04:32:38 -0400 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2015-04-07 13:07:44 -0400 |
commit | 00ca18034f62a6a3f29b8e660198e4ea573f2657 (patch) | |
tree | 8229242bd987d143fe52559ccd4e764db91216ef /drivers/net/wireless/ath/ath9k | |
parent | 6dcaac59d08b77d5730f2ae824bca1c0bf8130dc (diff) |
ath9k_htc: check seq number instead of cmd id for timeout
As the driver may send multiple wmi commands with identical cmd id,
it is more robust to check seq number for timeout instead.
Signed-off-by: Fred Chou <fred.chou.nd@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/wmi.c | 12 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/wmi.h | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/drivers/net/wireless/ath/ath9k/wmi.c b/drivers/net/wireless/ath/ath9k/wmi.c index 67a2f8c88829..ca533b4321bd 100644 --- a/drivers/net/wireless/ath/ath9k/wmi.c +++ b/drivers/net/wireless/ath/ath9k/wmi.c | |||
@@ -227,7 +227,7 @@ static void ath9k_wmi_ctrl_rx(void *priv, struct sk_buff *skb, | |||
227 | 227 | ||
228 | /* Check if there has been a timeout. */ | 228 | /* Check if there has been a timeout. */ |
229 | spin_lock(&wmi->wmi_lock); | 229 | spin_lock(&wmi->wmi_lock); |
230 | if (cmd_id != wmi->last_cmd_id) { | 230 | if (be16_to_cpu(hdr->seq_no) != wmi->last_seq_id) { |
231 | spin_unlock(&wmi->wmi_lock); | 231 | spin_unlock(&wmi->wmi_lock); |
232 | goto free_skb; | 232 | goto free_skb; |
233 | } | 233 | } |
@@ -275,11 +275,16 @@ static int ath9k_wmi_cmd_issue(struct wmi *wmi, | |||
275 | enum wmi_cmd_id cmd, u16 len) | 275 | enum wmi_cmd_id cmd, u16 len) |
276 | { | 276 | { |
277 | struct wmi_cmd_hdr *hdr; | 277 | struct wmi_cmd_hdr *hdr; |
278 | unsigned long flags; | ||
278 | 279 | ||
279 | hdr = (struct wmi_cmd_hdr *) skb_push(skb, sizeof(struct wmi_cmd_hdr)); | 280 | hdr = (struct wmi_cmd_hdr *) skb_push(skb, sizeof(struct wmi_cmd_hdr)); |
280 | hdr->command_id = cpu_to_be16(cmd); | 281 | hdr->command_id = cpu_to_be16(cmd); |
281 | hdr->seq_no = cpu_to_be16(++wmi->tx_seq_id); | 282 | hdr->seq_no = cpu_to_be16(++wmi->tx_seq_id); |
282 | 283 | ||
284 | spin_lock_irqsave(&wmi->wmi_lock, flags); | ||
285 | wmi->last_seq_id = wmi->tx_seq_id; | ||
286 | spin_unlock_irqrestore(&wmi->wmi_lock, flags); | ||
287 | |||
283 | return htc_send_epid(wmi->htc, skb, wmi->ctrl_epid); | 288 | return htc_send_epid(wmi->htc, skb, wmi->ctrl_epid); |
284 | } | 289 | } |
285 | 290 | ||
@@ -295,7 +300,6 @@ int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id, | |||
295 | struct sk_buff *skb; | 300 | struct sk_buff *skb; |
296 | u8 *data; | 301 | u8 *data; |
297 | int time_left, ret = 0; | 302 | int time_left, ret = 0; |
298 | unsigned long flags; | ||
299 | 303 | ||
300 | if (ah->ah_flags & AH_UNPLUGGED) | 304 | if (ah->ah_flags & AH_UNPLUGGED) |
301 | return 0; | 305 | return 0; |
@@ -323,10 +327,6 @@ int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id, | |||
323 | wmi->cmd_rsp_buf = rsp_buf; | 327 | wmi->cmd_rsp_buf = rsp_buf; |
324 | wmi->cmd_rsp_len = rsp_len; | 328 | wmi->cmd_rsp_len = rsp_len; |
325 | 329 | ||
326 | spin_lock_irqsave(&wmi->wmi_lock, flags); | ||
327 | wmi->last_cmd_id = cmd_id; | ||
328 | spin_unlock_irqrestore(&wmi->wmi_lock, flags); | ||
329 | |||
330 | ret = ath9k_wmi_cmd_issue(wmi, skb, cmd_id, cmd_len); | 330 | ret = ath9k_wmi_cmd_issue(wmi, skb, cmd_id, cmd_len); |
331 | if (ret) | 331 | if (ret) |
332 | goto out; | 332 | goto out; |
diff --git a/drivers/net/wireless/ath/ath9k/wmi.h b/drivers/net/wireless/ath/ath9k/wmi.h index aa84a335289a..380175d5ecd7 100644 --- a/drivers/net/wireless/ath/ath9k/wmi.h +++ b/drivers/net/wireless/ath/ath9k/wmi.h | |||
@@ -151,7 +151,7 @@ struct wmi { | |||
151 | enum htc_endpoint_id ctrl_epid; | 151 | enum htc_endpoint_id ctrl_epid; |
152 | struct mutex op_mutex; | 152 | struct mutex op_mutex; |
153 | struct completion cmd_wait; | 153 | struct completion cmd_wait; |
154 | enum wmi_cmd_id last_cmd_id; | 154 | u16 last_seq_id; |
155 | struct sk_buff_head wmi_event_queue; | 155 | struct sk_buff_head wmi_event_queue; |
156 | struct tasklet_struct wmi_event_tasklet; | 156 | struct tasklet_struct wmi_event_tasklet; |
157 | u16 tx_seq_id; | 157 | u16 tx_seq_id; |