From: Felix Fietkau <nbd@openwrt.org>
Date: Mon, 3 Jun 2013 14:15:57 +0000 (+0000)
Subject: ath9k: prevent excessive buffered multicast traffic from drowning out regular traffic
X-Git-Tag: reboot~10301
X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=791c103df72a002188129fea16c4ac45b5cb5857;p=openwrt%2Fstaging%2Fchunkeey.git

ath9k: prevent excessive buffered multicast traffic from drowning out regular traffic

Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 36825
---

diff --git a/package/mac80211/patches/300-pending_work.patch b/package/mac80211/patches/300-pending_work.patch
index 10da08954f..93a1271b81 100644
--- a/package/mac80211/patches/300-pending_work.patch
+++ b/package/mac80211/patches/300-pending_work.patch
@@ -52,7 +52,15 @@
  
  /********/
  /* VIFs */
-@@ -658,11 +661,10 @@ enum sc_op_flags {
+@@ -410,6 +413,7 @@ struct ath_beacon {
+ 	struct ath_descdma bdma;
+ 	struct ath_txq *cabq;
+ 	struct list_head bbuf;
++	int cabq_dur;
+ 
+ 	bool tx_processed;
+ 	bool tx_last;
+@@ -658,11 +662,10 @@ enum sc_op_flags {
  struct ath_rate_table;
  
  struct ath9k_vif_iter_data {
@@ -4407,7 +4415,7 @@
  
  		info.type = get_hw_packet_type(skb);
  		if (bf->bf_next)
-@@ -1142,6 +1146,18 @@ static void ath_tx_fill_desc(struct ath_
+@@ -1142,6 +1146,21 @@ static void ath_tx_fill_desc(struct ath_
  		else
  			info.link = 0;
  
@@ -4421,12 +4429,15 @@
 +				info.flags |= ATH9K_TXDESC_LDPC;
 +
 +			ath_buf_set_rate(sc, bf, &info, len);
++
++			if (txq == sc->beacon.cabq)
++				sc->beacon.cabq_dur += info.rates[0].PktDuration;
 +		}
 +
  		info.buf_addr[0] = bf->bf_buf_addr;
  		info.buf_len[0] = skb->len;
  		info.pkt_len = fi->framelen;
-@@ -1151,7 +1167,7 @@ static void ath_tx_fill_desc(struct ath_
+@@ -1151,7 +1170,7 @@ static void ath_tx_fill_desc(struct ath_
  		if (aggr) {
  			if (bf == bf_first)
  				info.aggr = AGGR_BUF_FIRST;
@@ -4435,7 +4446,7 @@
  				info.aggr = AGGR_BUF_LAST;
  			else
  				info.aggr = AGGR_BUF_MIDDLE;
-@@ -1160,6 +1176,9 @@ static void ath_tx_fill_desc(struct ath_
+@@ -1160,6 +1179,9 @@ static void ath_tx_fill_desc(struct ath_
  			info.aggr_len = len;
  		}
  
@@ -4445,7 +4456,7 @@
  		ath9k_hw_set_txdesc(ah, bf->bf_desc, &info);
  		bf = bf->bf_next;
  	}
-@@ -1224,9 +1243,6 @@ int ath_tx_aggr_start(struct ath_softc *
+@@ -1224,9 +1246,6 @@ int ath_tx_aggr_start(struct ath_softc *
  	an = (struct ath_node *)sta->drv_priv;
  	txtid = ATH_AN_2_TID(an, tid);
  
@@ -4455,7 +4466,7 @@
  	/* update ampdu factor/density, they may have changed. This may happen
  	 * in HT IBSS when a beacon with HT-info is received after the station
  	 * has already been added.
-@@ -1238,7 +1254,7 @@ int ath_tx_aggr_start(struct ath_softc *
+@@ -1238,7 +1257,7 @@ int ath_tx_aggr_start(struct ath_softc *
  		an->mpdudensity = density;
  	}
  
@@ -4464,7 +4475,7 @@
  	txtid->paused = true;
  	*ssn = txtid->seq_start = txtid->seq_next;
  	txtid->bar_index = -1;
-@@ -1255,28 +1271,9 @@ void ath_tx_aggr_stop(struct ath_softc *
+@@ -1255,28 +1274,9 @@ void ath_tx_aggr_stop(struct ath_softc *
  	struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tid);
  	struct ath_txq *txq = txtid->ac->txq;
  
@@ -4494,7 +4505,7 @@
  	ath_tx_flush_tid(sc, txtid);
  	ath_txq_unlock_complete(sc, txq);
  }
-@@ -1342,18 +1339,92 @@ void ath_tx_aggr_wakeup(struct ath_softc
+@@ -1342,18 +1342,92 @@ void ath_tx_aggr_wakeup(struct ath_softc
  	}
  }
  
@@ -4594,7 +4605,7 @@
  }
  
  /********************/
-@@ -1709,8 +1780,9 @@ static void ath_tx_txqaddbuf(struct ath_
+@@ -1709,8 +1783,9 @@ static void ath_tx_txqaddbuf(struct ath_
  	}
  }
  
@@ -4606,7 +4617,7 @@
  {
  	struct ath_frame_info *fi = get_frame_info(skb);
  	struct list_head bf_head;
-@@ -1723,26 +1795,28 @@ static void ath_tx_send_ampdu(struct ath
+@@ -1723,26 +1798,28 @@ static void ath_tx_send_ampdu(struct ath
  	 * - seqno is not within block-ack window
  	 * - h/w queue depth exceeds low water mark
  	 */
@@ -4641,7 +4652,7 @@
  	bf->bf_state.bf_type = BUF_AMPDU;
  	INIT_LIST_HEAD(&bf_head);
  	list_add(&bf->list, &bf_head);
-@@ -1751,10 +1825,10 @@ static void ath_tx_send_ampdu(struct ath
+@@ -1751,10 +1828,10 @@ static void ath_tx_send_ampdu(struct ath
  	ath_tx_addto_baw(sc, tid, bf->bf_state.seqno);
  
  	/* Queue to h/w without aggregation */
@@ -4655,7 +4666,7 @@
  }
  
  static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq,
-@@ -1892,49 +1966,6 @@ static struct ath_buf *ath_tx_setup_buff
+@@ -1892,49 +1969,6 @@ static struct ath_buf *ath_tx_setup_buff
  	return bf;
  }
  
@@ -4705,7 +4716,7 @@
  /* Upon failure caller should free skb */
  int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb,
  		 struct ath_tx_control *txctl)
-@@ -1945,8 +1976,11 @@ int ath_tx_start(struct ieee80211_hw *hw
+@@ -1945,8 +1979,11 @@ 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;
@@ -4717,7 +4728,7 @@
  	int q;
  
  	/* NOTE:  sta can be NULL according to net/mac80211.h */
-@@ -2002,8 +2036,47 @@ int ath_tx_start(struct ieee80211_hw *hw
+@@ -2002,8 +2039,47 @@ int ath_tx_start(struct ieee80211_hw *hw
  		txq->stopped = true;
  	}
  
@@ -4766,7 +4777,7 @@
  	ath_txq_unlock(sc, txq);
  
  	return 0;
-@@ -2054,7 +2127,12 @@ static void ath_tx_complete(struct ath_s
+@@ -2054,7 +2130,12 @@ static void ath_tx_complete(struct ath_s
  	}
  	spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
  
@@ -4779,7 +4790,7 @@
  	if (txq == sc->tx.txq_map[q]) {
  		if (WARN_ON(--txq->pending_frames < 0))
  			txq->pending_frames = 0;
-@@ -2065,8 +2143,6 @@ static void ath_tx_complete(struct ath_s
+@@ -2065,8 +2146,6 @@ static void ath_tx_complete(struct ath_s
  			txq->stopped = false;
  		}
  	}
@@ -4788,7 +4799,7 @@
  }
  
  static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
-@@ -2408,12 +2484,10 @@ void ath_tx_node_init(struct ath_softc *
+@@ -2408,12 +2487,10 @@ void ath_tx_node_init(struct ath_softc *
  		tid->baw_head  = tid->baw_tail = 0;
  		tid->sched     = false;
  		tid->paused    = false;
@@ -4802,7 +4813,7 @@
  	}
  
  	for (acno = 0, ac = &an->ac[acno];
-@@ -2450,9 +2524,9 @@ void ath_tx_node_cleanup(struct ath_soft
+@@ -2450,9 +2527,9 @@ void ath_tx_node_cleanup(struct ath_soft
  		}
  
  		ath_tid_drain(sc, txq, tid);
@@ -4970,3 +4981,21 @@
  	}
  
  	/*
+--- a/drivers/net/wireless/ath/ath9k/beacon.c
++++ b/drivers/net/wireless/ath/ath9k/beacon.c
+@@ -204,9 +204,15 @@ static struct ath_buf *ath9k_beacon_gene
+ 	}
+ 
+ 	ath9k_beacon_setup(sc, vif, bf, info->control.rates[0].idx);
++	sc->beacon.cabq_dur = 0;
+ 
+ 	while (skb) {
+ 		ath9k_tx_cabq(hw, skb);
++
++		if (sc->beacon.cabq_dur / 1000 - 1 >
++		    sc->cur_beacon_conf.beacon_interval / ATH_BCBUF)
++			break;
++
+ 		skb = ieee80211_get_buffered_bc(hw, vif);
+ 	}
+ 
diff --git a/package/mac80211/patches/512-ath9k_channelbw_debugfs.patch b/package/mac80211/patches/512-ath9k_channelbw_debugfs.patch
index 9edc4074f7..af5723a8b4 100644
--- a/package/mac80211/patches/512-ath9k_channelbw_debugfs.patch
+++ b/package/mac80211/patches/512-ath9k_channelbw_debugfs.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
-@@ -693,6 +693,7 @@ struct ath_softc {
+@@ -694,6 +694,7 @@ struct ath_softc {
  	struct ieee80211_hw *hw;
  	struct device *dev;
  
@@ -8,7 +8,7 @@
  	struct survey_info *cur_survey;
  	struct survey_info survey[ATH9K_NUM_CHANNELS];
  
-@@ -897,6 +898,7 @@ struct fft_sample_ht20 {
+@@ -898,6 +899,7 @@ struct fft_sample_ht20 {
  	u8 data[SPECTRAL_HT20_NUM_BINS];
  } __packed;
  
diff --git a/package/mac80211/patches/530-ath9k_extra_leds.patch b/package/mac80211/patches/530-ath9k_extra_leds.patch
index af3759bbd8..36b0cf6557 100644
--- a/package/mac80211/patches/530-ath9k_extra_leds.patch
+++ b/package/mac80211/patches/530-ath9k_extra_leds.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
-@@ -555,6 +555,9 @@ struct ath9k_wow_pattern {
+@@ -556,6 +556,9 @@ struct ath9k_wow_pattern {
  void ath_init_leds(struct ath_softc *sc);
  void ath_deinit_leds(struct ath_softc *sc);
  void ath_fill_led_pin(struct ath_softc *sc);
@@ -10,7 +10,7 @@
  #else
  static inline void ath_init_leds(struct ath_softc *sc)
  {
-@@ -689,6 +692,13 @@ enum spectral_mode {
+@@ -690,6 +693,13 @@ enum spectral_mode {
  	SPECTRAL_CHANSCAN,
  };
  
@@ -24,7 +24,7 @@
  struct ath_softc {
  	struct ieee80211_hw *hw;
  	struct device *dev;
-@@ -730,9 +740,8 @@ struct ath_softc {
+@@ -731,9 +741,8 @@ struct ath_softc {
  	struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];
  
  #ifdef CONFIG_MAC80211_LEDS