diff options
author | Brian Cavagnolo <brian@cozybit.com> | 2011-04-12 14:06:28 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-04-13 15:21:56 -0400 |
commit | d0805c1c5758f8fd16c88bf1efa8fb4be4408ce1 (patch) | |
tree | e60f4ed86277190171d1b5281a982386224175cf /drivers/net | |
parent | 4114fa21465ec7ee9526173676d3122a98bbbbd8 (diff) |
mwl8k: use traffic threshold to decide when to start ampdu
Currently, ampdu stream is created on the first qos packet to an
HT sta. The overhead of setting up the BA session may not be
justified if the outgoing packet rate is minimal (e.g., ping). So
we only allow ampdu streams after seeing a critical number of
packets in an arbitrary one-second interval.
Based on work by Nishant Sarmukadam <nishants@marvell.com>
Signed-off-by: Brian Cavagnolo <brian@cozybit.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/mwl8k.c | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c index d2416709ba52..28ebaec80be6 100644 --- a/drivers/net/wireless/mwl8k.c +++ b/drivers/net/wireless/mwl8k.c | |||
@@ -289,10 +289,17 @@ struct mwl8k_vif { | |||
289 | #define MWL8K_VIF(_vif) ((struct mwl8k_vif *)&((_vif)->drv_priv)) | 289 | #define MWL8K_VIF(_vif) ((struct mwl8k_vif *)&((_vif)->drv_priv)) |
290 | #define IEEE80211_KEY_CONF(_u8) ((struct ieee80211_key_conf *)(_u8)) | 290 | #define IEEE80211_KEY_CONF(_u8) ((struct ieee80211_key_conf *)(_u8)) |
291 | 291 | ||
292 | struct tx_traffic_info { | ||
293 | u32 start_time; | ||
294 | u32 pkts; | ||
295 | }; | ||
296 | |||
297 | #define MWL8K_MAX_TID 8 | ||
292 | struct mwl8k_sta { | 298 | struct mwl8k_sta { |
293 | /* Index into station database. Returned by UPDATE_STADB. */ | 299 | /* Index into station database. Returned by UPDATE_STADB. */ |
294 | u8 peer_id; | 300 | u8 peer_id; |
295 | u8 is_ampdu_allowed; | 301 | u8 is_ampdu_allowed; |
302 | struct tx_traffic_info tx_stats[MWL8K_MAX_TID]; | ||
296 | }; | 303 | }; |
297 | #define MWL8K_STA(_sta) ((struct mwl8k_sta *)&((_sta)->drv_priv)) | 304 | #define MWL8K_STA(_sta) ((struct mwl8k_sta *)&((_sta)->drv_priv)) |
298 | 305 | ||
@@ -1754,6 +1761,41 @@ mwl8k_lookup_stream(struct ieee80211_hw *hw, u8 *addr, u8 tid) | |||
1754 | return NULL; | 1761 | return NULL; |
1755 | } | 1762 | } |
1756 | 1763 | ||
1764 | #define MWL8K_AMPDU_PACKET_THRESHOLD 64 | ||
1765 | static inline bool mwl8k_ampdu_allowed(struct ieee80211_sta *sta, u8 tid) | ||
1766 | { | ||
1767 | struct mwl8k_sta *sta_info = MWL8K_STA(sta); | ||
1768 | struct tx_traffic_info *tx_stats; | ||
1769 | |||
1770 | BUG_ON(tid >= MWL8K_MAX_TID); | ||
1771 | tx_stats = &sta_info->tx_stats[tid]; | ||
1772 | |||
1773 | return sta_info->is_ampdu_allowed && | ||
1774 | tx_stats->pkts > MWL8K_AMPDU_PACKET_THRESHOLD; | ||
1775 | } | ||
1776 | |||
1777 | static inline void mwl8k_tx_count_packet(struct ieee80211_sta *sta, u8 tid) | ||
1778 | { | ||
1779 | struct mwl8k_sta *sta_info = MWL8K_STA(sta); | ||
1780 | struct tx_traffic_info *tx_stats; | ||
1781 | |||
1782 | BUG_ON(tid >= MWL8K_MAX_TID); | ||
1783 | tx_stats = &sta_info->tx_stats[tid]; | ||
1784 | |||
1785 | if (tx_stats->start_time == 0) | ||
1786 | tx_stats->start_time = jiffies; | ||
1787 | |||
1788 | /* reset the packet count after each second elapses. If the number of | ||
1789 | * packets ever exceeds the ampdu_min_traffic threshold, we will allow | ||
1790 | * an ampdu stream to be started. | ||
1791 | */ | ||
1792 | if (jiffies - tx_stats->start_time > HZ) { | ||
1793 | tx_stats->pkts = 0; | ||
1794 | tx_stats->start_time = 0; | ||
1795 | } else | ||
1796 | tx_stats->pkts++; | ||
1797 | } | ||
1798 | |||
1757 | static void | 1799 | static void |
1758 | mwl8k_txq_xmit(struct ieee80211_hw *hw, int index, struct sk_buff *skb) | 1800 | mwl8k_txq_xmit(struct ieee80211_hw *hw, int index, struct sk_buff *skb) |
1759 | { | 1801 | { |
@@ -1840,6 +1882,7 @@ mwl8k_txq_xmit(struct ieee80211_hw *hw, int index, struct sk_buff *skb) | |||
1840 | skb->protocol != cpu_to_be16(ETH_P_PAE) && | 1882 | skb->protocol != cpu_to_be16(ETH_P_PAE) && |
1841 | sta->ht_cap.ht_supported && priv->ap_fw) { | 1883 | sta->ht_cap.ht_supported && priv->ap_fw) { |
1842 | tid = qos & 0xf; | 1884 | tid = qos & 0xf; |
1885 | mwl8k_tx_count_packet(sta, tid); | ||
1843 | spin_lock(&priv->stream_lock); | 1886 | spin_lock(&priv->stream_lock); |
1844 | stream = mwl8k_lookup_stream(hw, sta->addr, tid); | 1887 | stream = mwl8k_lookup_stream(hw, sta->addr, tid); |
1845 | if (stream != NULL) { | 1888 | if (stream != NULL) { |
@@ -1880,7 +1923,7 @@ mwl8k_txq_xmit(struct ieee80211_hw *hw, int index, struct sk_buff *skb) | |||
1880 | * prevents sequence number mismatch at the recepient | 1923 | * prevents sequence number mismatch at the recepient |
1881 | * as described above. | 1924 | * as described above. |
1882 | */ | 1925 | */ |
1883 | if (MWL8K_STA(sta)->is_ampdu_allowed) { | 1926 | if (mwl8k_ampdu_allowed(sta, tid)) { |
1884 | stream = mwl8k_add_stream(hw, sta, tid); | 1927 | stream = mwl8k_add_stream(hw, sta, tid); |
1885 | if (stream != NULL) | 1928 | if (stream != NULL) |
1886 | start_ba_session = true; | 1929 | start_ba_session = true; |