diff options
-rw-r--r-- | drivers/net/wireless/rndis_wlan.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c index 351affe793c4..61a7693baf92 100644 --- a/drivers/net/wireless/rndis_wlan.c +++ b/drivers/net/wireless/rndis_wlan.c | |||
@@ -440,7 +440,7 @@ struct rndis_wlan_private { | |||
440 | struct cfg80211_scan_request *scan_request; | 440 | struct cfg80211_scan_request *scan_request; |
441 | 441 | ||
442 | struct workqueue_struct *workqueue; | 442 | struct workqueue_struct *workqueue; |
443 | struct delayed_work stats_work; | 443 | struct delayed_work dev_poller_work; |
444 | struct delayed_work scan_work; | 444 | struct delayed_work scan_work; |
445 | struct work_struct work; | 445 | struct work_struct work; |
446 | struct mutex command_lock; | 446 | struct mutex command_lock; |
@@ -2984,15 +2984,16 @@ static int rndis_wlan_get_caps(struct usbnet *usbdev) | |||
2984 | } | 2984 | } |
2985 | 2985 | ||
2986 | 2986 | ||
2987 | #define STATS_UPDATE_JIFFIES (HZ) | 2987 | #define DEVICE_POLLER_JIFFIES (HZ) |
2988 | static void rndis_update_wireless_stats(struct work_struct *work) | 2988 | static void rndis_device_poller(struct work_struct *work) |
2989 | { | 2989 | { |
2990 | struct rndis_wlan_private *priv = | 2990 | struct rndis_wlan_private *priv = |
2991 | container_of(work, struct rndis_wlan_private, stats_work.work); | 2991 | container_of(work, struct rndis_wlan_private, |
2992 | dev_poller_work.work); | ||
2992 | struct usbnet *usbdev = priv->usbdev; | 2993 | struct usbnet *usbdev = priv->usbdev; |
2993 | __le32 rssi, tmp; | 2994 | __le32 rssi, tmp; |
2994 | int len, ret, j; | 2995 | int len, ret, j; |
2995 | int update_jiffies = STATS_UPDATE_JIFFIES; | 2996 | int update_jiffies = DEVICE_POLLER_JIFFIES; |
2996 | void *buf; | 2997 | void *buf; |
2997 | 2998 | ||
2998 | /* Only check/do workaround when connected. Calling is_associated() | 2999 | /* Only check/do workaround when connected. Calling is_associated() |
@@ -3007,8 +3008,8 @@ static void rndis_update_wireless_stats(struct work_struct *work) | |||
3007 | if (ret == 0) | 3008 | if (ret == 0) |
3008 | priv->last_qual = level_to_qual(le32_to_cpu(rssi)); | 3009 | priv->last_qual = level_to_qual(le32_to_cpu(rssi)); |
3009 | 3010 | ||
3010 | devdbg(usbdev, "stats: OID_802_11_RSSI -> %d, rssi:%d", ret, | 3011 | devdbg(usbdev, "dev-poller: OID_802_11_RSSI -> %d, rssi:%d, qual: %d", |
3011 | le32_to_cpu(rssi)); | 3012 | ret, le32_to_cpu(rssi), level_to_qual(le32_to_cpu(rssi))); |
3012 | 3013 | ||
3013 | /* Workaround transfer stalls on poor quality links. | 3014 | /* Workaround transfer stalls on poor quality links. |
3014 | * TODO: find right way to fix these stalls (as stalls do not happen | 3015 | * TODO: find right way to fix these stalls (as stalls do not happen |
@@ -3019,8 +3020,8 @@ static void rndis_update_wireless_stats(struct work_struct *work) | |||
3019 | * Slower doesn't catch stalls fast enough. | 3020 | * Slower doesn't catch stalls fast enough. |
3020 | */ | 3021 | */ |
3021 | j = msecs_to_jiffies(priv->param_workaround_interval); | 3022 | j = msecs_to_jiffies(priv->param_workaround_interval); |
3022 | if (j > STATS_UPDATE_JIFFIES) | 3023 | if (j > DEVICE_POLLER_JIFFIES) |
3023 | j = STATS_UPDATE_JIFFIES; | 3024 | j = DEVICE_POLLER_JIFFIES; |
3024 | else if (j <= 0) | 3025 | else if (j <= 0) |
3025 | j = 1; | 3026 | j = 1; |
3026 | update_jiffies = j; | 3027 | update_jiffies = j; |
@@ -3040,8 +3041,8 @@ static void rndis_update_wireless_stats(struct work_struct *work) | |||
3040 | rndis_query_oid(usbdev, OID_802_11_BSSID_LIST, buf, &len); | 3041 | rndis_query_oid(usbdev, OID_802_11_BSSID_LIST, buf, &len); |
3041 | kfree(buf); | 3042 | kfree(buf); |
3042 | } | 3043 | } |
3043 | end: | ||
3044 | 3044 | ||
3045 | end: | ||
3045 | if (update_jiffies >= HZ) | 3046 | if (update_jiffies >= HZ) |
3046 | update_jiffies = round_jiffies_relative(update_jiffies); | 3047 | update_jiffies = round_jiffies_relative(update_jiffies); |
3047 | else { | 3048 | else { |
@@ -3050,7 +3051,8 @@ end: | |||
3050 | update_jiffies = j; | 3051 | update_jiffies = j; |
3051 | } | 3052 | } |
3052 | 3053 | ||
3053 | queue_delayed_work(priv->workqueue, &priv->stats_work, update_jiffies); | 3054 | queue_delayed_work(priv->workqueue, &priv->dev_poller_work, |
3055 | update_jiffies); | ||
3054 | } | 3056 | } |
3055 | 3057 | ||
3056 | 3058 | ||
@@ -3175,7 +3177,7 @@ static int rndis_wlan_bind(struct usbnet *usbdev, struct usb_interface *intf) | |||
3175 | /* because rndis_command() sleeps we need to use workqueue */ | 3177 | /* because rndis_command() sleeps we need to use workqueue */ |
3176 | priv->workqueue = create_singlethread_workqueue("rndis_wlan"); | 3178 | priv->workqueue = create_singlethread_workqueue("rndis_wlan"); |
3177 | INIT_WORK(&priv->work, rndis_wlan_worker); | 3179 | INIT_WORK(&priv->work, rndis_wlan_worker); |
3178 | INIT_DELAYED_WORK(&priv->stats_work, rndis_update_wireless_stats); | 3180 | INIT_DELAYED_WORK(&priv->dev_poller_work, rndis_device_poller); |
3179 | INIT_DELAYED_WORK(&priv->scan_work, rndis_get_scan_results); | 3181 | INIT_DELAYED_WORK(&priv->scan_work, rndis_get_scan_results); |
3180 | 3182 | ||
3181 | /* try bind rndis_host */ | 3183 | /* try bind rndis_host */ |
@@ -3252,7 +3254,7 @@ static int rndis_wlan_bind(struct usbnet *usbdev, struct usb_interface *intf) | |||
3252 | return 0; | 3254 | return 0; |
3253 | 3255 | ||
3254 | fail: | 3256 | fail: |
3255 | cancel_delayed_work_sync(&priv->stats_work); | 3257 | cancel_delayed_work_sync(&priv->dev_poller_work); |
3256 | cancel_delayed_work_sync(&priv->scan_work); | 3258 | cancel_delayed_work_sync(&priv->scan_work); |
3257 | cancel_work_sync(&priv->work); | 3259 | cancel_work_sync(&priv->work); |
3258 | flush_workqueue(priv->workqueue); | 3260 | flush_workqueue(priv->workqueue); |
@@ -3270,7 +3272,7 @@ static void rndis_wlan_unbind(struct usbnet *usbdev, struct usb_interface *intf) | |||
3270 | /* turn radio off */ | 3272 | /* turn radio off */ |
3271 | disassociate(usbdev, 0); | 3273 | disassociate(usbdev, 0); |
3272 | 3274 | ||
3273 | cancel_delayed_work_sync(&priv->stats_work); | 3275 | cancel_delayed_work_sync(&priv->dev_poller_work); |
3274 | cancel_delayed_work_sync(&priv->scan_work); | 3276 | cancel_delayed_work_sync(&priv->scan_work); |
3275 | cancel_work_sync(&priv->work); | 3277 | cancel_work_sync(&priv->work); |
3276 | flush_workqueue(priv->workqueue); | 3278 | flush_workqueue(priv->workqueue); |
@@ -3301,8 +3303,8 @@ static int rndis_wlan_reset(struct usbnet *usbdev) | |||
3301 | (set_multicast_list() also turns on current packet filter) */ | 3303 | (set_multicast_list() also turns on current packet filter) */ |
3302 | set_multicast_list(usbdev); | 3304 | set_multicast_list(usbdev); |
3303 | 3305 | ||
3304 | queue_delayed_work(priv->workqueue, &priv->stats_work, | 3306 | queue_delayed_work(priv->workqueue, &priv->dev_poller_work, |
3305 | round_jiffies_relative(STATS_UPDATE_JIFFIES)); | 3307 | round_jiffies_relative(DEVICE_POLLER_JIFFIES)); |
3306 | 3308 | ||
3307 | return deauthenticate(usbdev); | 3309 | return deauthenticate(usbdev); |
3308 | } | 3310 | } |
@@ -3319,7 +3321,7 @@ static int rndis_wlan_stop(struct usbnet *usbdev) | |||
3319 | retval = disassociate(usbdev, 0); | 3321 | retval = disassociate(usbdev, 0); |
3320 | 3322 | ||
3321 | priv->work_pending = 0; | 3323 | priv->work_pending = 0; |
3322 | cancel_delayed_work_sync(&priv->stats_work); | 3324 | cancel_delayed_work_sync(&priv->dev_poller_work); |
3323 | cancel_delayed_work_sync(&priv->scan_work); | 3325 | cancel_delayed_work_sync(&priv->scan_work); |
3324 | cancel_work_sync(&priv->work); | 3326 | cancel_work_sync(&priv->work); |
3325 | flush_workqueue(priv->workqueue); | 3327 | flush_workqueue(priv->workqueue); |