aboutsummaryrefslogtreecommitdiffstats
path: root/package/mac80211/patches/550-ath9k_limit_qlen.patch
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2011-08-27 21:57:07 +0000
committerFelix Fietkau <nbd@openwrt.org>2011-08-27 21:57:07 +0000
commit46d2b929c768ad4f0817f9132cddb71eaf1f40c4 (patch)
treefed67b37873565ef3fbd16fa3083a9138a1bb411 /package/mac80211/patches/550-ath9k_limit_qlen.patch
parent0a97fda27ece3b2c2efad038297ae284ff03ff78 (diff)
downloadupstream-46d2b929c768ad4f0817f9132cddb71eaf1f40c4.tar.gz
upstream-46d2b929c768ad4f0817f9132cddb71eaf1f40c4.tar.bz2
upstream-46d2b929c768ad4f0817f9132cddb71eaf1f40c4.zip
mac80211: update to wireless-testing 2011-08-26
SVN-Revision: 28093
Diffstat (limited to 'package/mac80211/patches/550-ath9k_limit_qlen.patch')
-rw-r--r--package/mac80211/patches/550-ath9k_limit_qlen.patch152
1 files changed, 152 insertions, 0 deletions
diff --git a/package/mac80211/patches/550-ath9k_limit_qlen.patch b/package/mac80211/patches/550-ath9k_limit_qlen.patch
new file mode 100644
index 0000000000..9e144f39c5
--- /dev/null
+++ b/package/mac80211/patches/550-ath9k_limit_qlen.patch
@@ -0,0 +1,152 @@
+--- a/drivers/net/wireless/ath/ath9k/ath9k.h
++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
+@@ -240,6 +240,7 @@ struct ath_atx_tid {
+ struct ath_node *an;
+ struct ath_atx_ac *ac;
+ unsigned long tx_buf[BITS_TO_LONGS(ATH_TID_MAX_BUFS)];
++ int buf_pending;
+ u16 seq_start;
+ u16 seq_next;
+ u16 baw_size;
+@@ -286,6 +287,9 @@ struct ath_tx_control {
+ * (axq_qnum).
+ */
+ struct ath_tx {
++ u32 qlen_single;
++ u32 qlen_aggr;
++
+ u16 seq_no;
+ u32 txqsetup;
+ spinlock_t txbuflock;
+--- a/drivers/net/wireless/ath/ath9k/debug.c
++++ b/drivers/net/wireless/ath/ath9k/debug.c
+@@ -1341,6 +1341,10 @@ int ath9k_init_debug(struct ath_hw *ah)
+ sc, &fops_wiphy);
+ debugfs_create_file("xmit", S_IRUSR, sc->debug.debugfs_phy, sc,
+ &fops_xmit);
++ debugfs_create_u32("qlen_single", S_IRUSR | S_IWUSR,
++ sc->debug.debugfs_phy, &sc->tx.qlen_single);
++ debugfs_create_u32("qlen_aggr", S_IRUSR | S_IWUSR,
++ sc->debug.debugfs_phy, &sc->tx.qlen_aggr);
+ debugfs_create_file("stations", S_IRUSR, sc->debug.debugfs_phy, sc,
+ &fops_stations);
+ debugfs_create_file("misc", S_IRUSR, sc->debug.debugfs_phy, sc,
+--- a/drivers/net/wireless/ath/ath9k/xmit.c
++++ b/drivers/net/wireless/ath/ath9k/xmit.c
+@@ -348,6 +348,14 @@ static void ath_tx_count_frames(struct a
+ }
+ }
+
++static struct ath_atx_tid *ath_get_tid(struct ath_node *an, struct sk_buff *skb)
++{
++ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
++ u8 tidno;
++
++ tidno = ieee80211_get_qos_ctl(hdr)[0] & IEEE80211_QOS_CTL_TID_MASK;
++ return ATH_AN_2_TID(an, tidno);
++}
+
+ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
+ struct ath_buf *bf, struct list_head *bf_q,
+@@ -438,6 +446,8 @@ static void ath_tx_complete_aggr(struct
+ __skb_queue_head_init(&bf_pending);
+
+ ath_tx_count_frames(sc, bf, ts, txok, &nframes, &nbad);
++ tid->buf_pending -= nframes;
++
+ while (bf) {
+ u16 seqno = bf->bf_state.seqno;
+
+@@ -834,6 +844,7 @@ static enum ATH_AGGR_STATUS ath_tx_form_
+ ath_tx_addto_baw(sc, tid, seqno);
+ ath9k_hw_set11n_aggr_middle(sc->sc_ah, bf->bf_desc, ndelim);
+
++ tid->buf_pending++;
+ __skb_unlink(skb, &tid->buf_q);
+ list_add_tail(&bf->list, bf_q);
+ if (bf_prev) {
+@@ -1489,6 +1500,8 @@ static void ath_tx_send_ampdu(struct ath
+ /* Add sub-frame to BAW */
+ ath_tx_addto_baw(sc, tid, bf->bf_state.seqno);
+
++ tid->buf_pending++;
++
+ /* Queue to h/w without aggregation */
+ TX_STAT_INC(txctl->txq->axq_qnum, a_queued_hw);
+ bf->bf_lastbf = bf;
+@@ -1817,23 +1830,13 @@ error:
+
+ /* FIXME: tx power */
+ static void ath_tx_start_dma(struct ath_softc *sc, struct sk_buff *skb,
+- struct ath_tx_control *txctl)
++ struct ath_tx_control *txctl,
++ struct ath_atx_tid *tid)
+ {
+ struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
+- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
+- struct ath_atx_tid *tid = NULL;
+ struct ath_buf *bf;
+- u8 tidno;
+
+ spin_lock_bh(&txctl->txq->axq_lock);
+- if ((sc->sc_flags & SC_OP_TXAGGR) && txctl->an &&
+- ieee80211_is_data_qos(hdr->frame_control)) {
+- tidno = ieee80211_get_qos_ctl(hdr)[0] &
+- IEEE80211_QOS_CTL_TID_MASK;
+- tid = ATH_AN_2_TID(txctl->an, tidno);
+-
+- WARN_ON(tid->ac->txq != txctl->txq);
+- }
+
+ if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) && tid) {
+ /*
+@@ -1875,6 +1878,7 @@ int ath_tx_start(struct ieee80211_hw *hw
+ struct ieee80211_vif *vif = info->control.vif;
+ struct ath_softc *sc = hw->priv;
+ struct ath_txq *txq = txctl->txq;
++ struct ath_atx_tid *tid = NULL;
+ int padpos, padsize;
+ int frmlen = skb->len + FCS_LEN;
+ int q;
+@@ -1907,6 +1911,7 @@ int ath_tx_start(struct ieee80211_hw *hw
+
+ skb_push(skb, padsize);
+ memmove(skb->data, skb->data + padsize, padpos);
++ hdr = (struct ieee80211_hdr *) skb->data;
+ }
+
+ if ((vif && vif->type != NL80211_IFTYPE_AP &&
+@@ -1916,6 +1921,24 @@ int ath_tx_start(struct ieee80211_hw *hw
+
+ setup_frame_info(hw, skb, frmlen);
+
++ if ((sc->sc_flags & SC_OP_TXAGGR) && txctl->an &&
++ ieee80211_is_data_qos(hdr->frame_control)) {
++ tid = ath_get_tid(txctl->an, skb);
++
++ WARN_ON(tid->ac->txq != txq);
++ }
++
++ if ((info->flags & IEEE80211_TX_CTL_AMPDU) && tid) {
++ if (sc->tx.qlen_aggr > 0 && skb_queue_len(&tid->buf_q) +
++ tid->buf_pending >= sc->tx.qlen_aggr)
++ return -ENOMEM;
++ } else {
++ if (sc->tx.qlen_single > 0 &&
++ txq->axq_depth - txq->axq_ampdu_depth >=
++ sc->tx.qlen_single)
++ return -ENOMEM;
++ }
++
+ /*
+ * At this point, the vif, hw_key and sta pointers in the tx control
+ * info are no longer valid (overwritten by the ath_frame_info data.
+@@ -1930,7 +1953,7 @@ int ath_tx_start(struct ieee80211_hw *hw
+ }
+ spin_unlock_bh(&txq->axq_lock);
+
+- ath_tx_start_dma(sc, skb, txctl);
++ ath_tx_start_dma(sc, skb, txctl, tid);
+ return 0;
+ }
+