Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 291476
b: refs/heads/master
c: 390a8c8
h: refs/heads/master
v: v3
  • Loading branch information
Raja Mani authored and Kalle Valo committed Mar 7, 2012
1 parent c4525cc commit 70324b6
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1e9a905d9afd289bf19f02092a56660c2bcc50db
refs/heads/master: 390a8c8fae2e7072579198414e631984a61c485e
30 changes: 27 additions & 3 deletions trunk/drivers/net/wireless/ath/ath6kl/cfg80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -1948,6 +1948,10 @@ static int ath6kl_wow_suspend(struct ath6kl *ar, struct cfg80211_wowlan *wow)
if (ret)
return ret;

netif_stop_queue(vif->ndev);

ar->state = ATH6KL_STATE_SUSPENDING;

/* Setup own IP addr for ARP agent. */
in_dev = __in_dev_get_rtnl(vif->ndev);
if (!in_dev)
Expand Down Expand Up @@ -2026,15 +2030,29 @@ static int ath6kl_wow_resume(struct ath6kl *ar)
if (!vif)
return -EIO;

ar->state = ATH6KL_STATE_RESUMING;

ret = ath6kl_wmi_set_host_sleep_mode_cmd(ar->wmi, vif->fw_vif_idx,
ATH6KL_HOST_MODE_AWAKE);
return ret;
if (ret) {
ath6kl_warn("Failed to configure host sleep mode for "
"wow resume: %d\n", ret);
ar->state = ATH6KL_STATE_WOW;
return ret;
}

ar->state = ATH6KL_STATE_ON;

netif_wake_queue(vif->ndev);

return 0;
}

int ath6kl_cfg80211_suspend(struct ath6kl *ar,
enum ath6kl_cfg_suspend_mode mode,
struct cfg80211_wowlan *wow)
{
enum ath6kl_state prev_state;
int ret;

switch (mode) {
Expand All @@ -2045,9 +2063,13 @@ int ath6kl_cfg80211_suspend(struct ath6kl *ar,
/* Flush all non control pkts in TX path */
ath6kl_tx_data_cleanup(ar);

prev_state = ar->state;

ret = ath6kl_wow_suspend(ar, wow);
if (ret)
if (ret) {
ar->state = prev_state;
return ret;
}

ar->state = ATH6KL_STATE_WOW;
break;
Expand Down Expand Up @@ -2120,7 +2142,6 @@ int ath6kl_cfg80211_resume(struct ath6kl *ar)
return ret;
}

ar->state = ATH6KL_STATE_ON;
break;

case ATH6KL_STATE_DEEPSLEEP:
Expand Down Expand Up @@ -2194,6 +2215,9 @@ static int __ath6kl_cfg80211_resume(struct wiphy *wiphy)
*/
void ath6kl_check_wow_status(struct ath6kl *ar)
{
if (ar->state == ATH6KL_STATE_SUSPENDING)
return;

if (ar->state == ATH6KL_STATE_WOW)
ath6kl_cfg80211_resume(ar);
}
Expand Down
2 changes: 2 additions & 0 deletions trunk/drivers/net/wireless/ath/ath6kl/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,8 @@ enum ath6kl_dev_state {
enum ath6kl_state {
ATH6KL_STATE_OFF,
ATH6KL_STATE_ON,
ATH6KL_STATE_SUSPENDING,
ATH6KL_STATE_RESUMING,
ATH6KL_STATE_DEEPSLEEP,
ATH6KL_STATE_CUTPOWER,
ATH6KL_STATE_WOW,
Expand Down
7 changes: 7 additions & 0 deletions trunk/drivers/net/wireless/ath/ath6kl/sdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -932,8 +932,15 @@ static int ath6kl_sdio_resume(struct ath6kl *ar)

case ATH6KL_STATE_WOW:
break;

case ATH6KL_STATE_SCHED_SCAN:
break;

case ATH6KL_STATE_SUSPENDING:
break;

case ATH6KL_STATE_RESUMING:
break;
}

ath6kl_cfg80211_resume(ar);
Expand Down
8 changes: 8 additions & 0 deletions trunk/drivers/net/wireless/ath/ath6kl/txrx.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,9 @@ int ath6kl_control_tx(void *devt, struct sk_buff *skb,
int status = 0;
struct ath6kl_cookie *cookie = NULL;

if (WARN_ON_ONCE(ar->state == ATH6KL_STATE_WOW))
return -EACCES;

spin_lock_bh(&ar->lock);

ath6kl_dbg(ATH6KL_DBG_WLAN_TX,
Expand Down Expand Up @@ -360,6 +363,11 @@ int ath6kl_data_tx(struct sk_buff *skb, struct net_device *dev)
return 0;
}

if (WARN_ON_ONCE(ar->state != ATH6KL_STATE_ON)) {
dev_kfree_skb(skb);
return 0;
}

if (!test_bit(WMI_READY, &ar->flag))
goto fail_tx;

Expand Down

0 comments on commit 70324b6

Please sign in to comment.