aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Roskin <proski@gnu.org>2007-06-20 23:56:04 -0400
committerGuido Guenther <agx@sigxcpu.org>2007-06-26 09:53:12 -0400
commite32456af0cfcddbb4a2a54f9455aed3f78b3037c (patch)
treea2b459a936e14ff09668e6cff24b65a61ab037e4
parent344846539037f1c05a3bcefd0f6274c77252a3f1 (diff)
[PATCH] Replace a work/timer combination for restarts with a delayed work
Decrease the delay to half second. It's enough to cover all requests from one iwconfig command, and improves the response time. Cancel the delayed work in at76_stop(). We don't need any restarts if the interface is down. Signed-off-by: Pavel Roskin <proski@gnu.org>
-rw-r--r--at76_usb.c26
-rw-r--r--at76_usb.h4
2 files changed, 8 insertions, 22 deletions
diff --git a/at76_usb.c b/at76_usb.c
index 9cfe3bb..686777c 100644
--- a/at76_usb.c
+++ b/at76_usb.c
@@ -1930,13 +1930,6 @@ static int at76_disassoc_req(struct at76_priv *priv, struct bss_info *bss)
return at76_send_mgmt_bulk(priv, tx_buffer);
}
-/* the restart timer timed out */
-static void at76_restart_timeout(unsigned long par)
-{
- struct at76_priv *priv = (struct at76_priv *)par;
- schedule_work(&priv->work_restart);
-}
-
/* we got to check the bss_list for old entries */
static void at76_bss_list_timeout(unsigned long par)
{
@@ -2182,7 +2175,6 @@ static void at76_delete_device(struct at76_priv *priv)
at76_free_bss_list(priv);
del_timer_sync(&priv->bss_list_timer);
del_timer_sync(&priv->mgmt_timer);
- del_timer_sync(&priv->restart_timer);
if (priv->istate == CONNECTED) {
at76_iwevent_bss_disconnect(priv->netdev);
@@ -2343,10 +2335,9 @@ static int at76_iw_handler_commit(struct net_device *netdev,
netif_stop_queue(priv->netdev);
}
- /* do the restart after two seconds to catch
- * following ioctl's (from more params of iwconfig)
- * in _one_ restart */
- mod_timer(&priv->restart_timer, jiffies + 2 * HZ);
+ /* Wait half second before the restart to process subsequent
+ * requests from the same iwconfig in a single restart */
+ schedule_delayed_work(&priv->dwork_restart, HZ / 2);
return 0;
}
@@ -3898,7 +3889,7 @@ static int at76_open(struct net_device *netdev)
priv->open_count++;
- schedule_work(&priv->work_restart);
+ schedule_delayed_work(&priv->dwork_restart, 0);
at76_dbg(DBG_PROC_ENTRY, "at76_open end");
err:
@@ -3932,6 +3923,7 @@ static int at76_stop(struct net_device *netdev)
}
del_timer_sync(&priv->mgmt_timer);
+ cancel_delayed_work(&priv->dwork_restart);
spin_lock_irqsave(&priv->mgmt_spinlock, flags);
if (priv->next_mgmt_bulk) {
@@ -4646,7 +4638,7 @@ static int at76_startup_device(struct at76_priv *priv)
static void at76_work_restart(struct work_struct *work)
{
struct at76_priv *priv = container_of(work, struct at76_priv,
- work_restart);
+ dwork_restart.work);
mutex_lock(&priv->mtx);
@@ -5854,17 +5846,13 @@ static struct at76_priv *at76_alloc_new_device(struct usb_device *udev)
INIT_WORK(&priv->work_join, at76_work_join);
INIT_WORK(&priv->work_mgmt_timeout, at76_work_mgmt_timeout);
INIT_WORK(&priv->work_new_bss, at76_work_new_bss);
- INIT_WORK(&priv->work_restart, at76_work_restart);
INIT_WORK(&priv->work_scan, at76_work_scan);
INIT_WORK(&priv->work_set_promisc, at76_work_set_promisc);
INIT_WORK(&priv->work_submit_rx, at76_work_submit_rx);
+ INIT_DELAYED_WORK(&priv->dwork_restart, at76_work_restart);
priv->open_count = 0;
- init_timer(&priv->restart_timer);
- priv->restart_timer.data = (unsigned long)priv;
- priv->restart_timer.function = at76_restart_timeout;
-
init_timer(&priv->mgmt_timer);
priv->mgmt_timer.data = (unsigned long)priv;
priv->mgmt_timer.function = at76_mgmt_timeout;
diff --git a/at76_usb.h b/at76_usb.h
index 0854ad7..67ab610 100644
--- a/at76_usb.h
+++ b/at76_usb.h
@@ -470,10 +470,10 @@ struct at76_priv {
struct work_struct work_join;
struct work_struct work_mgmt_timeout;
struct work_struct work_new_bss;
- struct work_struct work_restart;
struct work_struct work_scan;
struct work_struct work_set_promisc;
struct work_struct work_submit_rx;
+ struct delayed_work dwork_restart;
int nr_submit_rx_tries; /* number of tries to submit an rx urb left */
struct tasklet_struct rx_tasklet;
@@ -540,8 +540,6 @@ struct at76_priv {
} scan_state;
time_t last_scan;
- struct timer_list restart_timer; /* the timer we use to delay the restart a bit */
-
struct timer_list mgmt_timer; /* the timer we use to repeat auth_req etc. */
int retries; /* counts backwards while re-trying to send auth/assoc_req's */
u8 pm_mode; /* power management mode: AT76_PM_{OFF, ON, SMART} */