From 47411a06c0c44b3c9dc2feffb0d97785ec9aaa68 Mon Sep 17 00:00:00 2001 From: Avinash Patil Date: Thu, 1 Nov 2012 18:44:16 -0700 Subject: mwifiex: add multi-queue support This patch adds support for multiple TX queues inside mwifiex driver. Four different queues according to WMM access categories are defined for each virtual interface. When a packet is received from netdev for transmission, tx pending count for particular queue is incremented and if tx pending count has reached upper water-mark, this queue is stopped instead of stopping all queues. Similarly when a packet is successfully transmitted from device, tx pending count is decremented per queue and if pending count falls below lower water-mark, queue operations are again resumed. This ensures that not all tranmission is blocked if traffic with particular TOS value suddenly increases. Also wake all queues after association/IBSS_join/uAP_BSS_start to enable traffic on all queues. Signed-off-by: Avinash Patil Signed-off-by: Bing Zhao Signed-off-by: John W. Linville --- drivers/net/wireless/mwifiex/txrx.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'drivers/net/wireless/mwifiex/txrx.c') diff --git a/drivers/net/wireless/mwifiex/txrx.c b/drivers/net/wireless/mwifiex/txrx.c index 5cb3f7af874..8c80024c30f 100644 --- a/drivers/net/wireless/mwifiex/txrx.c +++ b/drivers/net/wireless/mwifiex/txrx.c @@ -121,13 +121,13 @@ int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb, dev_err(adapter->dev, "mwifiex_write_data_async failed: 0x%X\n", ret); adapter->dbg.num_tx_host_to_card_failure++; - mwifiex_write_data_complete(adapter, skb, ret); + mwifiex_write_data_complete(adapter, skb, 0, ret); break; case -EINPROGRESS: adapter->data_sent = false; break; case 0: - mwifiex_write_data_complete(adapter, skb, ret); + mwifiex_write_data_complete(adapter, skb, 0, ret); break; default: break; @@ -144,11 +144,12 @@ int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb, * wakes up stalled traffic queue if required, and then frees the buffer. */ int mwifiex_write_data_complete(struct mwifiex_adapter *adapter, - struct sk_buff *skb, int status) + struct sk_buff *skb, int aggr, int status) { - struct mwifiex_private *priv, *tpriv; + struct mwifiex_private *priv; struct mwifiex_txinfo *tx_info; - int i; + struct netdev_queue *txq; + int index; if (!skb) return 0; @@ -172,15 +173,20 @@ int mwifiex_write_data_complete(struct mwifiex_adapter *adapter, if (tx_info->flags & MWIFIEX_BUF_FLAG_BRIDGED_PKT) atomic_dec_return(&adapter->pending_bridged_pkts); - if (atomic_dec_return(&adapter->tx_pending) >= LOW_TX_PENDING) + + if (aggr) + /* For skb_aggr, do not wake up tx queue */ goto done; - for (i = 0; i < adapter->priv_num; i++) { - tpriv = adapter->priv[i]; + atomic_dec(&adapter->tx_pending); - if (tpriv->media_connected && - netif_queue_stopped(tpriv->netdev)) - mwifiex_wake_up_net_dev_queue(tpriv->netdev, adapter); + index = mwifiex_1d_to_wmm_queue[skb->priority]; + if (atomic_dec_return(&priv->wmm_tx_pending[index]) < LOW_TX_PENDING) { + txq = netdev_get_tx_queue(priv->netdev, index); + if (netif_tx_queue_stopped(txq)) { + netif_tx_wake_queue(txq); + dev_dbg(adapter->dev, "wake queue: %d\n", index); + } } done: dev_kfree_skb_any(skb); -- cgit v1.2.3-70-g09d2