diff options
author | Avinash Patil <patila@marvell.com> | 2011-12-08 23:41:05 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-12-13 15:33:26 -0500 |
commit | bbea3bc432dc5c08d09ca5c80afdd82515470688 (patch) | |
tree | b4edf229e11f548e8e486d1f70d527f7c2a665a7 /drivers/net/wireless/mwifiex | |
parent | 17a60b48193f32ab0c87e0d57df6ab408fbe9bca (diff) |
mwifiex: wakeup and stop multiple tx queues in net_device
replace single queue function calls with equivalent multiple queue
functions. Wakeup queue and stop queue calls are guarded by spin lock.
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Kiran Divekar <dkiran@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/mwifiex')
-rw-r--r-- | drivers/net/wireless/mwifiex/init.c | 40 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/main.c | 11 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/main.h | 9 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/sta_event.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/sta_ioctl.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/txrx.c | 5 |
6 files changed, 63 insertions, 12 deletions
diff --git a/drivers/net/wireless/mwifiex/init.c b/drivers/net/wireless/mwifiex/init.c index 26940455255b..244c728ef9dc 100644 --- a/drivers/net/wireless/mwifiex/init.c +++ b/drivers/net/wireless/mwifiex/init.c | |||
@@ -283,6 +283,45 @@ static void mwifiex_init_adapter(struct mwifiex_adapter *adapter) | |||
283 | } | 283 | } |
284 | 284 | ||
285 | /* | 285 | /* |
286 | * This function sets trans_start per tx_queue | ||
287 | */ | ||
288 | void mwifiex_set_trans_start(struct net_device *dev) | ||
289 | { | ||
290 | int i; | ||
291 | |||
292 | for (i = 0; i < dev->num_tx_queues; i++) | ||
293 | netdev_get_tx_queue(dev, i)->trans_start = jiffies; | ||
294 | |||
295 | dev->trans_start = jiffies; | ||
296 | } | ||
297 | |||
298 | /* | ||
299 | * This function wakes up all queues in net_device | ||
300 | */ | ||
301 | void mwifiex_wake_up_net_dev_queue(struct net_device *netdev, | ||
302 | struct mwifiex_adapter *adapter) | ||
303 | { | ||
304 | unsigned long dev_queue_flags; | ||
305 | |||
306 | spin_lock_irqsave(&adapter->queue_lock, dev_queue_flags); | ||
307 | netif_tx_wake_all_queues(netdev); | ||
308 | spin_unlock_irqrestore(&adapter->queue_lock, dev_queue_flags); | ||
309 | } | ||
310 | |||
311 | /* | ||
312 | * This function stops all queues in net_device | ||
313 | */ | ||
314 | void mwifiex_stop_net_dev_queue(struct net_device *netdev, | ||
315 | struct mwifiex_adapter *adapter) | ||
316 | { | ||
317 | unsigned long dev_queue_flags; | ||
318 | |||
319 | spin_lock_irqsave(&adapter->queue_lock, dev_queue_flags); | ||
320 | netif_tx_stop_all_queues(netdev); | ||
321 | spin_unlock_irqrestore(&adapter->queue_lock, dev_queue_flags); | ||
322 | } | ||
323 | |||
324 | /* | ||
286 | * This function releases the lock variables and frees the locks and | 325 | * This function releases the lock variables and frees the locks and |
287 | * associated locks. | 326 | * associated locks. |
288 | */ | 327 | */ |
@@ -359,6 +398,7 @@ int mwifiex_init_lock_list(struct mwifiex_adapter *adapter) | |||
359 | spin_lock_init(&adapter->int_lock); | 398 | spin_lock_init(&adapter->int_lock); |
360 | spin_lock_init(&adapter->main_proc_lock); | 399 | spin_lock_init(&adapter->main_proc_lock); |
361 | spin_lock_init(&adapter->mwifiex_cmd_lock); | 400 | spin_lock_init(&adapter->mwifiex_cmd_lock); |
401 | spin_lock_init(&adapter->queue_lock); | ||
362 | for (i = 0; i < adapter->priv_num; i++) { | 402 | for (i = 0; i < adapter->priv_num; i++) { |
363 | if (adapter->priv[i]) { | 403 | if (adapter->priv[i]) { |
364 | priv = adapter->priv[i]; | 404 | priv = adapter->priv[i]; |
diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c index 67e6db7d672d..d21cd4707f01 100644 --- a/drivers/net/wireless/mwifiex/main.c +++ b/drivers/net/wireless/mwifiex/main.c | |||
@@ -401,7 +401,7 @@ mwifiex_fill_buffer(struct sk_buff *skb) | |||
401 | static int | 401 | static int |
402 | mwifiex_open(struct net_device *dev) | 402 | mwifiex_open(struct net_device *dev) |
403 | { | 403 | { |
404 | netif_start_queue(dev); | 404 | netif_tx_start_all_queues(dev); |
405 | return 0; | 405 | return 0; |
406 | } | 406 | } |
407 | 407 | ||
@@ -465,8 +465,8 @@ mwifiex_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
465 | atomic_inc(&priv->adapter->tx_pending); | 465 | atomic_inc(&priv->adapter->tx_pending); |
466 | 466 | ||
467 | if (atomic_read(&priv->adapter->tx_pending) >= MAX_TX_PENDING) { | 467 | if (atomic_read(&priv->adapter->tx_pending) >= MAX_TX_PENDING) { |
468 | netif_stop_queue(priv->netdev); | 468 | mwifiex_set_trans_start(dev); |
469 | dev->trans_start = jiffies; | 469 | mwifiex_stop_net_dev_queue(priv->netdev, priv->adapter); |
470 | } | 470 | } |
471 | 471 | ||
472 | queue_work(priv->adapter->workqueue, &priv->adapter->main_work); | 472 | queue_work(priv->adapter->workqueue, &priv->adapter->main_work); |
@@ -533,7 +533,7 @@ mwifiex_tx_timeout(struct net_device *dev) | |||
533 | 533 | ||
534 | dev_err(priv->adapter->dev, "%lu : Tx timeout, bss_index=%d\n", | 534 | dev_err(priv->adapter->dev, "%lu : Tx timeout, bss_index=%d\n", |
535 | jiffies, priv->bss_index); | 535 | jiffies, priv->bss_index); |
536 | dev->trans_start = jiffies; | 536 | mwifiex_set_trans_start(dev); |
537 | priv->num_tx_timeout++; | 537 | priv->num_tx_timeout++; |
538 | } | 538 | } |
539 | 539 | ||
@@ -793,7 +793,8 @@ int mwifiex_remove_card(struct mwifiex_adapter *adapter, struct semaphore *sem) | |||
793 | priv = adapter->priv[i]; | 793 | priv = adapter->priv[i]; |
794 | if (priv && priv->netdev) { | 794 | if (priv && priv->netdev) { |
795 | if (!netif_queue_stopped(priv->netdev)) | 795 | if (!netif_queue_stopped(priv->netdev)) |
796 | netif_stop_queue(priv->netdev); | 796 | mwifiex_stop_net_dev_queue(priv->netdev, |
797 | adapter); | ||
797 | if (netif_carrier_ok(priv->netdev)) | 798 | if (netif_carrier_ok(priv->netdev)) |
798 | netif_carrier_off(priv->netdev); | 799 | netif_carrier_off(priv->netdev); |
799 | } | 800 | } |
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h index 3861a617c0e1..41f88631763c 100644 --- a/drivers/net/wireless/mwifiex/main.h +++ b/drivers/net/wireless/mwifiex/main.h | |||
@@ -655,10 +655,19 @@ struct mwifiex_adapter { | |||
655 | struct mwifiex_wait_queue cmd_wait_q; | 655 | struct mwifiex_wait_queue cmd_wait_q; |
656 | u8 scan_wait_q_woken; | 656 | u8 scan_wait_q_woken; |
657 | struct cmd_ctrl_node *cmd_queued; | 657 | struct cmd_ctrl_node *cmd_queued; |
658 | spinlock_t queue_lock; /* lock for tx queues */ | ||
658 | }; | 659 | }; |
659 | 660 | ||
660 | int mwifiex_init_lock_list(struct mwifiex_adapter *adapter); | 661 | int mwifiex_init_lock_list(struct mwifiex_adapter *adapter); |
661 | 662 | ||
663 | void mwifiex_set_trans_start(struct net_device *dev); | ||
664 | |||
665 | void mwifiex_stop_net_dev_queue(struct net_device *netdev, | ||
666 | struct mwifiex_adapter *adapter); | ||
667 | |||
668 | void mwifiex_wake_up_net_dev_queue(struct net_device *netdev, | ||
669 | struct mwifiex_adapter *adapter); | ||
670 | |||
662 | int mwifiex_init_fw(struct mwifiex_adapter *adapter); | 671 | int mwifiex_init_fw(struct mwifiex_adapter *adapter); |
663 | 672 | ||
664 | int mwifiex_init_fw_complete(struct mwifiex_adapter *adapter); | 673 | int mwifiex_init_fw_complete(struct mwifiex_adapter *adapter); |
diff --git a/drivers/net/wireless/mwifiex/sta_event.c b/drivers/net/wireless/mwifiex/sta_event.c index f204810e8338..40205f60be4d 100644 --- a/drivers/net/wireless/mwifiex/sta_event.c +++ b/drivers/net/wireless/mwifiex/sta_event.c | |||
@@ -126,7 +126,7 @@ mwifiex_reset_connect_state(struct mwifiex_private *priv) | |||
126 | queue_work(priv->workqueue, &priv->cfg_workqueue); | 126 | queue_work(priv->workqueue, &priv->cfg_workqueue); |
127 | } | 127 | } |
128 | if (!netif_queue_stopped(priv->netdev)) | 128 | if (!netif_queue_stopped(priv->netdev)) |
129 | netif_stop_queue(priv->netdev); | 129 | mwifiex_stop_net_dev_queue(priv->netdev, adapter); |
130 | if (netif_carrier_ok(priv->netdev)) | 130 | if (netif_carrier_ok(priv->netdev)) |
131 | netif_carrier_off(priv->netdev); | 131 | netif_carrier_off(priv->netdev); |
132 | /* Reset wireless stats signal info */ | 132 | /* Reset wireless stats signal info */ |
@@ -201,7 +201,7 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv) | |||
201 | if (!netif_carrier_ok(priv->netdev)) | 201 | if (!netif_carrier_ok(priv->netdev)) |
202 | netif_carrier_on(priv->netdev); | 202 | netif_carrier_on(priv->netdev); |
203 | if (netif_queue_stopped(priv->netdev)) | 203 | if (netif_queue_stopped(priv->netdev)) |
204 | netif_wake_queue(priv->netdev); | 204 | mwifiex_wake_up_net_dev_queue(priv->netdev, adapter); |
205 | break; | 205 | break; |
206 | 206 | ||
207 | case EVENT_DEAUTHENTICATED: | 207 | case EVENT_DEAUTHENTICATED: |
@@ -292,7 +292,7 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv) | |||
292 | priv->adhoc_is_link_sensed = false; | 292 | priv->adhoc_is_link_sensed = false; |
293 | mwifiex_clean_txrx(priv); | 293 | mwifiex_clean_txrx(priv); |
294 | if (!netif_queue_stopped(priv->netdev)) | 294 | if (!netif_queue_stopped(priv->netdev)) |
295 | netif_stop_queue(priv->netdev); | 295 | mwifiex_stop_net_dev_queue(priv->netdev, adapter); |
296 | if (netif_carrier_ok(priv->netdev)) | 296 | if (netif_carrier_ok(priv->netdev)) |
297 | netif_carrier_off(priv->netdev); | 297 | netif_carrier_off(priv->netdev); |
298 | break; | 298 | break; |
diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c index 4b6f5539657d..6d990c798a20 100644 --- a/drivers/net/wireless/mwifiex/sta_ioctl.c +++ b/drivers/net/wireless/mwifiex/sta_ioctl.c | |||
@@ -234,7 +234,7 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss, | |||
234 | "associating...\n"); | 234 | "associating...\n"); |
235 | 235 | ||
236 | if (!netif_queue_stopped(priv->netdev)) | 236 | if (!netif_queue_stopped(priv->netdev)) |
237 | netif_stop_queue(priv->netdev); | 237 | mwifiex_stop_net_dev_queue(priv->netdev, adapter); |
238 | 238 | ||
239 | /* Clear any past association response stored for | 239 | /* Clear any past association response stored for |
240 | * application retrieval */ | 240 | * application retrieval */ |
@@ -265,7 +265,7 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss, | |||
265 | ret = mwifiex_check_network_compatibility(priv, bss_desc); | 265 | ret = mwifiex_check_network_compatibility(priv, bss_desc); |
266 | 266 | ||
267 | if (!netif_queue_stopped(priv->netdev)) | 267 | if (!netif_queue_stopped(priv->netdev)) |
268 | netif_stop_queue(priv->netdev); | 268 | mwifiex_stop_net_dev_queue(priv->netdev, adapter); |
269 | 269 | ||
270 | if (!ret) { | 270 | if (!ret) { |
271 | dev_dbg(adapter->dev, "info: network found in scan" | 271 | dev_dbg(adapter->dev, "info: network found in scan" |
diff --git a/drivers/net/wireless/mwifiex/txrx.c b/drivers/net/wireless/mwifiex/txrx.c index a206f412875f..d9274a1b77ac 100644 --- a/drivers/net/wireless/mwifiex/txrx.c +++ b/drivers/net/wireless/mwifiex/txrx.c | |||
@@ -134,7 +134,7 @@ int mwifiex_write_data_complete(struct mwifiex_adapter *adapter, | |||
134 | if (!priv) | 134 | if (!priv) |
135 | goto done; | 135 | goto done; |
136 | 136 | ||
137 | priv->netdev->trans_start = jiffies; | 137 | mwifiex_set_trans_start(priv->netdev); |
138 | if (!status) { | 138 | if (!status) { |
139 | priv->stats.tx_packets++; | 139 | priv->stats.tx_packets++; |
140 | priv->stats.tx_bytes += skb->len; | 140 | priv->stats.tx_bytes += skb->len; |
@@ -152,7 +152,8 @@ int mwifiex_write_data_complete(struct mwifiex_adapter *adapter, | |||
152 | if ((GET_BSS_ROLE(tpriv) == MWIFIEX_BSS_ROLE_STA) | 152 | if ((GET_BSS_ROLE(tpriv) == MWIFIEX_BSS_ROLE_STA) |
153 | && (tpriv->media_connected)) { | 153 | && (tpriv->media_connected)) { |
154 | if (netif_queue_stopped(tpriv->netdev)) | 154 | if (netif_queue_stopped(tpriv->netdev)) |
155 | netif_wake_queue(tpriv->netdev); | 155 | mwifiex_wake_up_net_dev_queue(tpriv->netdev, |
156 | adapter); | ||
156 | } | 157 | } |
157 | } | 158 | } |
158 | done: | 159 | done: |