diff options
author | Pavel Roskin <proski@gnu.org> | 2007-06-04 21:03:47 -0400 |
---|---|---|
committer | Guido Guenther <agx@sigxcpu.org> | 2007-06-05 08:59:33 +0200 |
commit | 0e88cc2d6c58fc6209ff0d5cdf1329a83b341bbd (patch) | |
tree | 208fddba1acbf8c28d197fc35e6593f4c99dc33b | |
parent | 26541709cddff654b11072f54fa0a0870bf9fe93 (diff) |
[PATCH] Merge at76_handle_mgmt_timeout() and at76_work_mgmt_timeout()
The later was just a trivial wrapper.
Signed-off-by: Pavel Roskin <proski@gnu.org>
-rw-r--r-- | at76_usb.c | 200 |
1 files changed, 97 insertions, 103 deletions
@@ -2169,108 +2169,6 @@ static void at76_handle_mgmt_timeout_scan(struct at76_priv *priv) } -/* the deferred procedure called from at76_devent() */ -static void at76_handle_mgmt_timeout(struct at76_priv *priv) -{ - if ((priv->istate != SCANNING && priv->istate != MONITORING) || - (at76_debug & DBG_MGMT_TIMER)) - /* this is normal behavior in states MONITORING, SCANNING ... */ - at76_dbg(DBG_PROGRESS, "%s: timeout, state %d", priv->netdev->name, - priv->istate); - - switch (priv->istate) { - - case MONITORING: - case SCANNING: - at76_handle_mgmt_timeout_scan(priv); - break; - - case JOINING: - at76_assert(0); - break; - - case CONNECTED: /* we haven't received the beacon of this BSS for - BEACON_TIMEOUT seconds */ - info("%s: lost beacon bssid %s", - priv->netdev->name, mac2str(priv->curr_bss->bssid)); - /* jal: starting mgmt_timer in ad-hoc mode is questionable, - but I'll leave it here to track down another lockup problem */ - if (priv->iw_mode != IW_MODE_ADHOC) { - netif_carrier_off(priv->netdev); - netif_stop_queue(priv->netdev); - at76_iwevent_bss_disconnect(priv->netdev); - priv->istate = SCANNING; - schedule_work(&priv->work_scan); - } - break; - - case AUTHENTICATING: - if (priv->retries-- >= 0) { - at76_auth_req(priv, priv->curr_bss, 1, NULL); - at76_dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ", - __FUNCTION__, __LINE__); - mod_timer(&priv->mgmt_timer, jiffies + HZ); - } else { - /* try to get next matching BSS */ - priv->istate = JOINING; - schedule_work(&priv->work_join); - } - break; - - case ASSOCIATING: - if (priv->retries-- >= 0) { - at76_assoc_req(priv, priv->curr_bss); - at76_dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ", - __FUNCTION__, __LINE__); - mod_timer(&priv->mgmt_timer, jiffies + HZ); - } else { - /* jal: TODO: we may be authenticated to several - BSS and may try to associate to the next of them here - in the future ... */ - - /* try to get next matching BSS */ - priv->istate = JOINING; - schedule_work(&priv->work_join); - } - break; - - case REASSOCIATING: - if (priv->retries-- >= 0) - at76_reassoc_req(priv, priv->curr_bss, priv->new_bss); - else { - /* we disassociate from the curr_bss and - scan again ... */ - priv->istate = DISASSOCIATING; - priv->retries = DISASSOC_RETRIES; - at76_disassoc_req(priv, priv->curr_bss); - } - at76_dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ", - __FUNCTION__, __LINE__); - mod_timer(&priv->mgmt_timer, jiffies + HZ); - break; - - case DISASSOCIATING: - if (priv->retries-- >= 0) { - at76_disassoc_req(priv, priv->curr_bss); - at76_dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ", - __FUNCTION__, __LINE__); - mod_timer(&priv->mgmt_timer, jiffies + HZ); - } else { - /* we scan again ... */ - priv->istate = SCANNING; - schedule_work(&priv->work_scan); - } - break; - - case INIT: - break; - - default: - at76_assert(0); - } -} - - /* Called after successful association */ static void at76_work_assoc_done(struct work_struct *work) { @@ -4542,13 +4440,109 @@ static void at76_work_join(struct work_struct *work) } +/* Process scheduled events */ static void at76_work_mgmt_timeout(struct work_struct *work) { struct at76_priv *priv = container_of(work, struct at76_priv, work_mgmt_timeout); mutex_lock(&priv->mtx); - at76_handle_mgmt_timeout(priv); + if ((priv->istate != SCANNING && priv->istate != MONITORING) || + (at76_debug & DBG_MGMT_TIMER)) + /* this is normal behavior in states MONITORING, SCANNING ... */ + at76_dbg(DBG_PROGRESS, "%s: timeout, state %d", priv->netdev->name, + priv->istate); + + switch (priv->istate) { + + case MONITORING: + case SCANNING: + at76_handle_mgmt_timeout_scan(priv); + break; + + case JOINING: + at76_assert(0); + break; + + case CONNECTED: /* we haven't received the beacon of this BSS for + BEACON_TIMEOUT seconds */ + info("%s: lost beacon bssid %s", + priv->netdev->name, mac2str(priv->curr_bss->bssid)); + /* jal: starting mgmt_timer in ad-hoc mode is questionable, + but I'll leave it here to track down another lockup problem */ + if (priv->iw_mode != IW_MODE_ADHOC) { + netif_carrier_off(priv->netdev); + netif_stop_queue(priv->netdev); + at76_iwevent_bss_disconnect(priv->netdev); + priv->istate = SCANNING; + schedule_work(&priv->work_scan); + } + break; + + case AUTHENTICATING: + if (priv->retries-- >= 0) { + at76_auth_req(priv, priv->curr_bss, 1, NULL); + at76_dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ", + __FUNCTION__, __LINE__); + mod_timer(&priv->mgmt_timer, jiffies + HZ); + } else { + /* try to get next matching BSS */ + priv->istate = JOINING; + schedule_work(&priv->work_join); + } + break; + + case ASSOCIATING: + if (priv->retries-- >= 0) { + at76_assoc_req(priv, priv->curr_bss); + at76_dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ", + __FUNCTION__, __LINE__); + mod_timer(&priv->mgmt_timer, jiffies + HZ); + } else { + /* jal: TODO: we may be authenticated to several + BSS and may try to associate to the next of them here + in the future ... */ + + /* try to get next matching BSS */ + priv->istate = JOINING; + schedule_work(&priv->work_join); + } + break; + + case REASSOCIATING: + if (priv->retries-- >= 0) + at76_reassoc_req(priv, priv->curr_bss, priv->new_bss); + else { + /* we disassociate from the curr_bss and + scan again ... */ + priv->istate = DISASSOCIATING; + priv->retries = DISASSOC_RETRIES; + at76_disassoc_req(priv, priv->curr_bss); + } + at76_dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ", + __FUNCTION__, __LINE__); + mod_timer(&priv->mgmt_timer, jiffies + HZ); + break; + + case DISASSOCIATING: + if (priv->retries-- >= 0) { + at76_disassoc_req(priv, priv->curr_bss); + at76_dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ", + __FUNCTION__, __LINE__); + mod_timer(&priv->mgmt_timer, jiffies + HZ); + } else { + /* we scan again ... */ + priv->istate = SCANNING; + schedule_work(&priv->work_scan); + } + break; + + case INIT: + break; + + default: + at76_assert(0); + } mutex_unlock(&priv->mtx); } |