diff options
author | Pavel Roskin <proski@gnu.org> | 2007-06-13 03:37:07 -0400 |
---|---|---|
committer | Guido Guenther <agx@sigxcpu.org> | 2007-06-14 10:11:05 +0200 |
commit | 14845416d9db6fa6a94353707e7601478a00ad60 (patch) | |
tree | c86cb7c07bfb8be5ffd795eddb409eee71b78f21 | |
parent | b9a60139fce263beac4571d44e0b322fb1ee2d9d (diff) |
[PATCH] Don't use workqueue to reschedule IBSS creation
Scheduling is done in process context, so it can be avoided. Merge
at76_work_start_ibss() into at76_start_ibss().
Signed-off-by: Pavel Roskin <proski@gnu.org>
-rw-r--r-- | at76_usb.c | 93 | ||||
-rw-r--r-- | at76_usb.h | 1 |
2 files changed, 40 insertions, 54 deletions
@@ -1558,6 +1558,9 @@ static int at76_start_monitor(struct at76_priv *priv) static int at76_start_ibss(struct at76_priv *priv) { struct at76_req_ibss bss; + int ret; + + at76_assert(priv->istate == STARTIBSS); memset(&bss, 0, sizeof(struct at76_req_ibss)); memset(bss.bssid, 0xff, ETH_ALEN); @@ -1566,8 +1569,42 @@ static int at76_start_ibss(struct at76_priv *priv) bss.bss_type = ADHOC_MODE; bss.channel = priv->channel; - return at76_set_card_command(priv->udev, CMD_START_IBSS, &bss, - sizeof(struct at76_req_ibss)); + ret = at76_set_card_command(priv->udev, CMD_START_IBSS, &bss, + sizeof(struct at76_req_ibss)); + if (ret < 0) { + err("%s: start_ibss failed: %d", priv->netdev->name, ret); + return ret; + } + + ret = at76_wait_completion(priv, CMD_START_IBSS); + if (ret != CMD_STATUS_COMPLETE) { + err("%s start_ibss failed to complete,%d", + priv->netdev->name, ret); + return ret; + } + + ret = at76_get_current_bssid(priv); + if (ret < 0) + return ret; + + ret = at76_get_current_channel(priv); + if (ret < 0) + return ret; + + /* not sure what this is good for ??? */ + memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer)); + priv->mib_buf.type = MIB_MAC_MGMT; + priv->mib_buf.size = 1; + priv->mib_buf.index = IBSS_CHANGE_OK_OFFSET; + ret = at76_set_mib(priv, &priv->mib_buf); + if (ret < 0) { + err("%s: set_mib (ibss change ok) failed: %d", priv->netdev->name, ret); + return ret; + } + + netif_carrier_on(priv->netdev); + netif_start_queue(priv->netdev); + return 0; } @@ -4410,7 +4447,7 @@ static void at76_work_join(struct work_struct *work) /* here we haven't found a matching (i)bss ... */ if (priv->iw_mode == IW_MODE_ADHOC) { priv->istate = STARTIBSS; - schedule_work(&priv->work_start_ibss); + at76_start_ibss(priv); goto end_join; } /* haven't found a matching BSS in infra mode - try again */ @@ -4767,55 +4804,6 @@ static void at76_work_set_promisc(struct work_struct *work) } -static void at76_work_start_ibss(struct work_struct *work) -{ - struct at76_priv *priv = container_of(work, struct at76_priv, - work_start_ibss); - int ret; - - mutex_lock(&priv->mtx); - - at76_assert(priv->istate == STARTIBSS); - ret = at76_start_ibss(priv); - if (ret < 0) { - err("%s: start_ibss failed: %d", priv->netdev->name, ret); - goto end_startibss; - } - - ret = at76_wait_completion(priv, CMD_START_IBSS); - if (ret != CMD_STATUS_COMPLETE) { - err("%s start_ibss failed to complete,%d", - priv->netdev->name, ret); - goto end_startibss; - } - - ret = at76_get_current_bssid(priv); - if (ret < 0) - goto end_startibss; - - ret = at76_get_current_channel(priv); - if (ret < 0) - goto end_startibss; - - /* not sure what this is good for ??? */ - memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer)); - priv->mib_buf.type = MIB_MAC_MGMT; - priv->mib_buf.size = 1; - priv->mib_buf.index = IBSS_CHANGE_OK_OFFSET; - ret = at76_set_mib(priv, &priv->mib_buf); - if (ret < 0) { - err("%s: set_mib (ibss change ok) failed: %d", priv->netdev->name, ret); - goto end_startibss; - } - - netif_carrier_on(priv->netdev); - netif_start_queue(priv->netdev); - - end_startibss: - mutex_unlock(&priv->mtx); -} - - static void at76_work_submit_rx(struct work_struct *work) { struct at76_priv *priv = container_of(work, struct at76_priv, @@ -6004,7 +5992,6 @@ static struct at76_priv *at76_alloc_new_device(struct usb_device *udev) 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_start_ibss, at76_work_start_ibss); INIT_WORK(&priv->work_submit_rx, at76_work_submit_rx); priv->open_count = 0; @@ -483,7 +483,6 @@ struct at76_priv { struct work_struct work_restart; struct work_struct work_scan; struct work_struct work_set_promisc; - struct work_struct work_start_ibss; struct work_struct work_submit_rx; int nr_submit_rx_tries; /* number of tries to submit an rx urb left */ |