aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mwifiex/wmm.c
diff options
context:
space:
mode:
authorYogesh Ashok Powar <yogeshp@marvell.com>2011-06-06 05:19:32 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-06-07 14:44:02 -0400
commitfcf2176c87af77e5ee947edaf8e390bc67b729d8 (patch)
tree7a567a1e4bcce262bac3fe425eb4a852cd00c2c7 /drivers/net/wireless/mwifiex/wmm.c
parent485868266150022a139b74ba4daf0da9ad86c1c0 (diff)
mwifiex: remove list traversal in mwifiex_num_pkts_in_txq
Instead of counting the number of packets in txq for particular RA list before AMSDU creation, maintain a counter which will keep track of the same. This will reduce some MIPS while generating AMSDU traffic as we only have to check the counter instead of traversing through skb list. Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/mwifiex/wmm.c')
-rw-r--r--drivers/net/wireless/mwifiex/wmm.c30
1 files changed, 6 insertions, 24 deletions
diff --git a/drivers/net/wireless/mwifiex/wmm.c b/drivers/net/wireless/mwifiex/wmm.c
index 91634daec306..67b2d0b78c71 100644
--- a/drivers/net/wireless/mwifiex/wmm.c
+++ b/drivers/net/wireless/mwifiex/wmm.c
@@ -121,6 +121,7 @@ mwifiex_wmm_allocate_ralist_node(struct mwifiex_adapter *adapter, u8 *ra)
121 memcpy(ra_list->ra, ra, ETH_ALEN); 121 memcpy(ra_list->ra, ra, ETH_ALEN);
122 122
123 ra_list->total_pkts_size = 0; 123 ra_list->total_pkts_size = 0;
124 ra_list->total_pkts = 0;
124 125
125 dev_dbg(adapter->dev, "info: allocated ra_list %p\n", ra_list); 126 dev_dbg(adapter->dev, "info: allocated ra_list %p\n", ra_list);
126 127
@@ -645,6 +646,7 @@ mwifiex_wmm_add_buf_txqueue(struct mwifiex_adapter *adapter,
645 skb_queue_tail(&ra_list->skb_head, skb); 646 skb_queue_tail(&ra_list->skb_head, skb);
646 647
647 ra_list->total_pkts_size += skb->len; 648 ra_list->total_pkts_size += skb->len;
649 ra_list->total_pkts++;
648 650
649 atomic_inc(&priv->wmm.tx_pkts_queued); 651 atomic_inc(&priv->wmm.tx_pkts_queued);
650 652
@@ -971,28 +973,6 @@ mwifiex_wmm_get_highest_priolist_ptr(struct mwifiex_adapter *adapter,
971} 973}
972 974
973/* 975/*
974 * This function gets the number of packets in the Tx queue of a
975 * particular RA list.
976 */
977static int
978mwifiex_num_pkts_in_txq(struct mwifiex_private *priv,
979 struct mwifiex_ra_list_tbl *ptr, int max_buf_size)
980{
981 int count = 0, total_size = 0;
982 struct sk_buff *skb, *tmp;
983
984 skb_queue_walk_safe(&ptr->skb_head, skb, tmp) {
985 total_size += skb->len;
986 if (total_size < max_buf_size)
987 ++count;
988 else
989 break;
990 }
991
992 return count;
993}
994
995/*
996 * This function sends a single packet to firmware for transmission. 976 * This function sends a single packet to firmware for transmission.
997 */ 977 */
998static void 978static void
@@ -1019,6 +999,7 @@ mwifiex_send_single_packet(struct mwifiex_private *priv,
1019 dev_dbg(adapter->dev, "data: dequeuing the packet %p %p\n", ptr, skb); 999 dev_dbg(adapter->dev, "data: dequeuing the packet %p %p\n", ptr, skb);
1020 1000
1021 ptr->total_pkts_size -= skb->len; 1001 ptr->total_pkts_size -= skb->len;
1002 ptr->total_pkts--;
1022 1003
1023 if (!skb_queue_empty(&ptr->skb_head)) 1004 if (!skb_queue_empty(&ptr->skb_head))
1024 skb_next = skb_peek(&ptr->skb_head); 1005 skb_next = skb_peek(&ptr->skb_head);
@@ -1044,6 +1025,7 @@ mwifiex_send_single_packet(struct mwifiex_private *priv,
1044 skb_queue_tail(&ptr->skb_head, skb); 1025 skb_queue_tail(&ptr->skb_head, skb);
1045 1026
1046 ptr->total_pkts_size += skb->len; 1027 ptr->total_pkts_size += skb->len;
1028 ptr->total_pkts++;
1047 tx_info->flags |= MWIFIEX_BUF_FLAG_REQUEUED_PKT; 1029 tx_info->flags |= MWIFIEX_BUF_FLAG_REQUEUED_PKT;
1048 spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, 1030 spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock,
1049 ra_list_flags); 1031 ra_list_flags);
@@ -1231,9 +1213,9 @@ mwifiex_dequeue_tx_packet(struct mwifiex_adapter *adapter)
1231 } 1213 }
1232/* Minimum number of AMSDU */ 1214/* Minimum number of AMSDU */
1233#define MIN_NUM_AMSDU 2 1215#define MIN_NUM_AMSDU 2
1216
1234 if (mwifiex_is_amsdu_allowed(priv, tid) && 1217 if (mwifiex_is_amsdu_allowed(priv, tid) &&
1235 (mwifiex_num_pkts_in_txq(priv, ptr, adapter->tx_buf_size) >= 1218 (ptr->total_pkts >= MIN_NUM_AMSDU))
1236 MIN_NUM_AMSDU))
1237 mwifiex_11n_aggregate_pkt(priv, ptr, INTF_HEADER_LEN, 1219 mwifiex_11n_aggregate_pkt(priv, ptr, INTF_HEADER_LEN,
1238 ptr_index, flags); 1220 ptr_index, flags);
1239 /* ra_list_spinlock has been freed in 1221 /* ra_list_spinlock has been freed in