Commit bbea3bc4 authored by Avinash Patil's avatar Avinash Patil Committed by John W. Linville

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: default avatarAvinash Patil <patila@marvell.com>
Signed-off-by: default avatarKiran Divekar <dkiran@marvell.com>
Signed-off-by: default avatarBing Zhao <bzhao@marvell.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 17a60b48
...@@ -282,6 +282,45 @@ static void mwifiex_init_adapter(struct mwifiex_adapter *adapter) ...@@ -282,6 +282,45 @@ static void mwifiex_init_adapter(struct mwifiex_adapter *adapter)
adapter->arp_filter_size = 0; adapter->arp_filter_size = 0;
} }
/*
* This function sets trans_start per tx_queue
*/
void mwifiex_set_trans_start(struct net_device *dev)
{
int i;
for (i = 0; i < dev->num_tx_queues; i++)
netdev_get_tx_queue(dev, i)->trans_start = jiffies;
dev->trans_start = jiffies;
}
/*
* This function wakes up all queues in net_device
*/
void mwifiex_wake_up_net_dev_queue(struct net_device *netdev,
struct mwifiex_adapter *adapter)
{
unsigned long dev_queue_flags;
spin_lock_irqsave(&adapter->queue_lock, dev_queue_flags);
netif_tx_wake_all_queues(netdev);
spin_unlock_irqrestore(&adapter->queue_lock, dev_queue_flags);
}
/*
* This function stops all queues in net_device
*/
void mwifiex_stop_net_dev_queue(struct net_device *netdev,
struct mwifiex_adapter *adapter)
{
unsigned long dev_queue_flags;
spin_lock_irqsave(&adapter->queue_lock, dev_queue_flags);
netif_tx_stop_all_queues(netdev);
spin_unlock_irqrestore(&adapter->queue_lock, dev_queue_flags);
}
/* /*
* This function releases the lock variables and frees the locks and * This function releases the lock variables and frees the locks and
* associated locks. * associated locks.
...@@ -359,6 +398,7 @@ int mwifiex_init_lock_list(struct mwifiex_adapter *adapter) ...@@ -359,6 +398,7 @@ int mwifiex_init_lock_list(struct mwifiex_adapter *adapter)
spin_lock_init(&adapter->int_lock); spin_lock_init(&adapter->int_lock);
spin_lock_init(&adapter->main_proc_lock); spin_lock_init(&adapter->main_proc_lock);
spin_lock_init(&adapter->mwifiex_cmd_lock); spin_lock_init(&adapter->mwifiex_cmd_lock);
spin_lock_init(&adapter->queue_lock);
for (i = 0; i < adapter->priv_num; i++) { for (i = 0; i < adapter->priv_num; i++) {
if (adapter->priv[i]) { if (adapter->priv[i]) {
priv = adapter->priv[i]; priv = adapter->priv[i];
......
...@@ -401,7 +401,7 @@ mwifiex_fill_buffer(struct sk_buff *skb) ...@@ -401,7 +401,7 @@ mwifiex_fill_buffer(struct sk_buff *skb)
static int static int
mwifiex_open(struct net_device *dev) mwifiex_open(struct net_device *dev)
{ {
netif_start_queue(dev); netif_tx_start_all_queues(dev);
return 0; return 0;
} }
...@@ -465,8 +465,8 @@ mwifiex_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -465,8 +465,8 @@ mwifiex_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
atomic_inc(&priv->adapter->tx_pending); atomic_inc(&priv->adapter->tx_pending);
if (atomic_read(&priv->adapter->tx_pending) >= MAX_TX_PENDING) { if (atomic_read(&priv->adapter->tx_pending) >= MAX_TX_PENDING) {
netif_stop_queue(priv->netdev); mwifiex_set_trans_start(dev);
dev->trans_start = jiffies; mwifiex_stop_net_dev_queue(priv->netdev, priv->adapter);
} }
queue_work(priv->adapter->workqueue, &priv->adapter->main_work); queue_work(priv->adapter->workqueue, &priv->adapter->main_work);
...@@ -533,7 +533,7 @@ mwifiex_tx_timeout(struct net_device *dev) ...@@ -533,7 +533,7 @@ mwifiex_tx_timeout(struct net_device *dev)
dev_err(priv->adapter->dev, "%lu : Tx timeout, bss_index=%d\n", dev_err(priv->adapter->dev, "%lu : Tx timeout, bss_index=%d\n",
jiffies, priv->bss_index); jiffies, priv->bss_index);
dev->trans_start = jiffies; mwifiex_set_trans_start(dev);
priv->num_tx_timeout++; priv->num_tx_timeout++;
} }
...@@ -793,7 +793,8 @@ int mwifiex_remove_card(struct mwifiex_adapter *adapter, struct semaphore *sem) ...@@ -793,7 +793,8 @@ int mwifiex_remove_card(struct mwifiex_adapter *adapter, struct semaphore *sem)
priv = adapter->priv[i]; priv = adapter->priv[i];
if (priv && priv->netdev) { if (priv && priv->netdev) {
if (!netif_queue_stopped(priv->netdev)) if (!netif_queue_stopped(priv->netdev))
netif_stop_queue(priv->netdev); mwifiex_stop_net_dev_queue(priv->netdev,
adapter);
if (netif_carrier_ok(priv->netdev)) if (netif_carrier_ok(priv->netdev))
netif_carrier_off(priv->netdev); netif_carrier_off(priv->netdev);
} }
......
...@@ -655,10 +655,19 @@ struct mwifiex_adapter { ...@@ -655,10 +655,19 @@ struct mwifiex_adapter {
struct mwifiex_wait_queue cmd_wait_q; struct mwifiex_wait_queue cmd_wait_q;
u8 scan_wait_q_woken; u8 scan_wait_q_woken;
struct cmd_ctrl_node *cmd_queued; struct cmd_ctrl_node *cmd_queued;
spinlock_t queue_lock; /* lock for tx queues */
}; };
int mwifiex_init_lock_list(struct mwifiex_adapter *adapter); int mwifiex_init_lock_list(struct mwifiex_adapter *adapter);
void mwifiex_set_trans_start(struct net_device *dev);
void mwifiex_stop_net_dev_queue(struct net_device *netdev,
struct mwifiex_adapter *adapter);
void mwifiex_wake_up_net_dev_queue(struct net_device *netdev,
struct mwifiex_adapter *adapter);
int mwifiex_init_fw(struct mwifiex_adapter *adapter); int mwifiex_init_fw(struct mwifiex_adapter *adapter);
int mwifiex_init_fw_complete(struct mwifiex_adapter *adapter); int mwifiex_init_fw_complete(struct mwifiex_adapter *adapter);
......
...@@ -126,7 +126,7 @@ mwifiex_reset_connect_state(struct mwifiex_private *priv) ...@@ -126,7 +126,7 @@ mwifiex_reset_connect_state(struct mwifiex_private *priv)
queue_work(priv->workqueue, &priv->cfg_workqueue); queue_work(priv->workqueue, &priv->cfg_workqueue);
} }
if (!netif_queue_stopped(priv->netdev)) if (!netif_queue_stopped(priv->netdev))
netif_stop_queue(priv->netdev); mwifiex_stop_net_dev_queue(priv->netdev, adapter);
if (netif_carrier_ok(priv->netdev)) if (netif_carrier_ok(priv->netdev))
netif_carrier_off(priv->netdev); netif_carrier_off(priv->netdev);
/* Reset wireless stats signal info */ /* Reset wireless stats signal info */
...@@ -201,7 +201,7 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv) ...@@ -201,7 +201,7 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv)
if (!netif_carrier_ok(priv->netdev)) if (!netif_carrier_ok(priv->netdev))
netif_carrier_on(priv->netdev); netif_carrier_on(priv->netdev);
if (netif_queue_stopped(priv->netdev)) if (netif_queue_stopped(priv->netdev))
netif_wake_queue(priv->netdev); mwifiex_wake_up_net_dev_queue(priv->netdev, adapter);
break; break;
case EVENT_DEAUTHENTICATED: case EVENT_DEAUTHENTICATED:
...@@ -292,7 +292,7 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv) ...@@ -292,7 +292,7 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv)
priv->adhoc_is_link_sensed = false; priv->adhoc_is_link_sensed = false;
mwifiex_clean_txrx(priv); mwifiex_clean_txrx(priv);
if (!netif_queue_stopped(priv->netdev)) if (!netif_queue_stopped(priv->netdev))
netif_stop_queue(priv->netdev); mwifiex_stop_net_dev_queue(priv->netdev, adapter);
if (netif_carrier_ok(priv->netdev)) if (netif_carrier_ok(priv->netdev))
netif_carrier_off(priv->netdev); netif_carrier_off(priv->netdev);
break; break;
......
...@@ -234,7 +234,7 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss, ...@@ -234,7 +234,7 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss,
"associating...\n"); "associating...\n");
if (!netif_queue_stopped(priv->netdev)) if (!netif_queue_stopped(priv->netdev))
netif_stop_queue(priv->netdev); mwifiex_stop_net_dev_queue(priv->netdev, adapter);
/* Clear any past association response stored for /* Clear any past association response stored for
* application retrieval */ * application retrieval */
...@@ -265,7 +265,7 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss, ...@@ -265,7 +265,7 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss,
ret = mwifiex_check_network_compatibility(priv, bss_desc); ret = mwifiex_check_network_compatibility(priv, bss_desc);
if (!netif_queue_stopped(priv->netdev)) if (!netif_queue_stopped(priv->netdev))
netif_stop_queue(priv->netdev); mwifiex_stop_net_dev_queue(priv->netdev, adapter);
if (!ret) { if (!ret) {
dev_dbg(adapter->dev, "info: network found in scan" dev_dbg(adapter->dev, "info: network found in scan"
......
...@@ -134,7 +134,7 @@ int mwifiex_write_data_complete(struct mwifiex_adapter *adapter, ...@@ -134,7 +134,7 @@ int mwifiex_write_data_complete(struct mwifiex_adapter *adapter,
if (!priv) if (!priv)
goto done; goto done;
priv->netdev->trans_start = jiffies; mwifiex_set_trans_start(priv->netdev);
if (!status) { if (!status) {
priv->stats.tx_packets++; priv->stats.tx_packets++;
priv->stats.tx_bytes += skb->len; priv->stats.tx_bytes += skb->len;
...@@ -152,7 +152,8 @@ int mwifiex_write_data_complete(struct mwifiex_adapter *adapter, ...@@ -152,7 +152,8 @@ int mwifiex_write_data_complete(struct mwifiex_adapter *adapter,
if ((GET_BSS_ROLE(tpriv) == MWIFIEX_BSS_ROLE_STA) if ((GET_BSS_ROLE(tpriv) == MWIFIEX_BSS_ROLE_STA)
&& (tpriv->media_connected)) { && (tpriv->media_connected)) {
if (netif_queue_stopped(tpriv->netdev)) if (netif_queue_stopped(tpriv->netdev))
netif_wake_queue(tpriv->netdev); mwifiex_wake_up_net_dev_queue(tpriv->netdev,
adapter);
} }
} }
done: done:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment