Skip to contentSkip to conversation

ath9k: Remove MAC_DEBUG

PATCH New Sujith Manoharan 1 participant 4 messages May 7, 2013 Qualcomm Atheros ATH9K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 ath9k: Remove MAC_DEBUG

From: Sujith Manoharan <[email protected]>

This option has not been enabled by default in any distribution, has never been enabled in OpenWrt and no developer has asked for this information in a bug report.

Dumping pages of random values doesn't help debugging, remove this option (along with the vmalloc() abuse).

---
 drivers/net/wireless/ath/ath9k/Kconfig |   8 -
 drivers/net/wireless/ath/ath9k/debug.c | 337 ---------------------------------
 drivers/net/wireless/ath/ath9k/debug.h |  20 --
 drivers/net/wireless/ath/ath9k/init.c  |   3 -
 drivers/net/wireless/ath/ath9k/link.c  |   1 -
 drivers/net/wireless/ath/ath9k/main.c  |   1 -
 6 files changed, 370 deletions(-)
drivers/net/wireless/ath/ath9k/Kconfig +0 -8
index 17507dc..ec33c80 100644
@@ -84,14 +84,6 @@ config ATH9K_DFS_CERTIFIED
 	  developed. At this point enabling this option won't do anything
 	  except increase code size.
 
-config ATH9K_MAC_DEBUG
-	bool "Atheros MAC statistics"
-	depends on ATH9K_DEBUGFS
-	default y
-	---help---
-	  This option enables collection of statistics for Rx/Tx status
-	  data and some other MAC related statistics
-
 config ATH9K_RATE_CONTROL
 	bool "Atheros ath9k rate control"
 	depends on ATH9K
drivers/net/wireless/ath/ath9k/debug.c +0 -337

374 lines not on this page · raw message

drivers/net/wireless/ath/ath9k/debug.h +0 -20
index 794a7ec..62da19c 100644
@@ -294,13 +294,6 @@ struct ath9k_debug {
 	struct dentry *debugfs_phy;
 	u32 regidx;
 	struct ath_stats stats;
-#ifdef CONFIG_ATH9K_MAC_DEBUG
-	spinlock_t samp_lock;
-	struct ath_dbg_bb_mac_samp bb_mac_samp[ATH_DBG_MAX_SAMPLES];
-	u8 sampidx;
-	u8 tsidx;
-	u8 rsidx;
-#endif
 };
 
 int ath9k_init_debug(struct ath_hw *ah);
@@ -359,17 +352,4 @@ static inline void ath_debug_stat_rx(struct ath_softc *sc,
 
 #endif /* CONFIG_ATH9K_DEBUGFS */
 
-#ifdef CONFIG_ATH9K_MAC_DEBUG
-
-void ath9k_debug_samp_bb_mac(struct ath_softc *sc);
-
-#else
-
-static inline void ath9k_debug_samp_bb_mac(struct ath_softc *sc)
-{
-}
-
-#endif
-
-
 #endif /* DEBUG_H */
drivers/net/wireless/ath/ath9k/init.c +0 -3
index 0237b28..c7b888f 100644
@@ -613,9 +613,6 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc,
 	spin_lock_init(&sc->sc_serial_rw);
 	spin_lock_init(&sc->sc_pm_lock);
 	mutex_init(&sc->mutex);
-#ifdef CONFIG_ATH9K_MAC_DEBUG
-	spin_lock_init(&sc->debug.samp_lock);
-#endif
 	tasklet_init(&sc->intr_tq, ath9k_tasklet, (unsigned long)sc);
 	tasklet_init(&sc->bcon_tasklet, ath9k_beacon_tasklet,
 		     (unsigned long)sc);
drivers/net/wireless/ath/ath9k/link.c +0 -1
index 849259b..cc422a4 100644
@@ -418,7 +418,6 @@ void ath_ani_calibrate(unsigned long data)
 		longcal ? "long" : "", shortcal ? "short" : "",
 		aniflag ? "ani" : "", common->ani.caldone ? "true" : "false");
 
-	ath9k_debug_samp_bb_mac(sc);
 	ath9k_ps_restore(sc);
 
 set_timer:
drivers/net/wireless/ath/ath9k/main.c +0 -1
index a18414b..04bf88a 100644
@@ -193,7 +193,6 @@ static bool ath_prepare_reset(struct ath_softc *sc)
 	ath_stop_ani(sc);
 	del_timer_sync(&sc->rx_poll_timer);
 
-	ath9k_debug_samp_bb_mac(sc);
 	ath9k_hw_disable_interrupts(ah);
 
 	if (!ath_drain_all_txq(sc))
Signature · 1 line
1.8.2.2
#1 lore raw

PATCH 2/4 ath9k: Use bitops for scan flag

From: Sujith Manoharan <[email protected]>

---
 drivers/net/wireless/ath/ath9k/ath9k.h | 2 +-
 drivers/net/wireless/ath/ath9k/main.c  | 8 +++-----
 2 files changed, 4 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +1 -1
index 8a1888d..579ed9c 100644
@@ -646,6 +646,7 @@ enum sc_op_flags {
 	SC_OP_ANI_RUN,
 	SC_OP_PRIM_STA_VIF,
 	SC_OP_HW_RESET,
+	SC_OP_SCANNING,
 };
 
 /* Powersave flags */
@@ -759,7 +760,6 @@ struct ath_softc {
 	struct rchan *rfs_chan_spec_scan;
 	enum spectral_mode spectral_mode;
 	struct ath_spec_scan spec_config;
-	int scanning;
 
 #ifdef CONFIG_PM_SLEEP
 	atomic_t wow_got_bmiss_intr;
drivers/net/wireless/ath/ath9k/main.c +3 -5
index 04bf88a..74a0482 100644
@@ -1272,7 +1272,7 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
 				curchan->center_freq);
 		} else {
 			/* perform spectral scan if requested. */
-			if (sc->scanning &&
+			if (test_bit(SC_OP_SCANNING, &sc->sc_flags) &&
 			    sc->spectral_mode == SPECTRAL_CHANSCAN)
 				ath9k_spectral_scan_trigger(hw);
 		}
@@ -2338,15 +2338,13 @@ static void ath9k_set_wakeup(struct ieee80211_hw *hw, bool enabled)
 static void ath9k_sw_scan_start(struct ieee80211_hw *hw)
 {
 	struct ath_softc *sc = hw->priv;
-
-	sc->scanning = 1;
+	set_bit(SC_OP_SCANNING, &sc->sc_flags);
 }
 
 static void ath9k_sw_scan_complete(struct ieee80211_hw *hw)
 {
 	struct ath_softc *sc = hw->priv;
-
-	sc->scanning = 0;
+	clear_bit(SC_OP_SCANNING, &sc->sc_flags);
 }
 
 struct ieee80211_ops ath9k_ops = {
Signature · 1 line
1.8.2.2
#2 lore raw

PATCH 3/4 ath9k: Do not use local_bh_disable in ampdu_action

In reply to Sujith Manoharan

From: Sujith Manoharan <[email protected]>

This was added during the early conversion of ampdu_action to a sleeping callback. There is no need to do this - instead, use the normal mutex that is acquired for all callbacks.

---
 drivers/net/wireless/ath/ath9k/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/main.c +2 -2
index 74a0482..a1630d1 100644
@@ -1688,7 +1688,7 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw,
 	struct ath_softc *sc = hw->priv;
 	int ret = 0;
 
-	local_bh_disable();
+	mutex_lock(&sc->mutex);
 
 	switch (action) {
 	case IEEE80211_AMPDU_RX_START:
@@ -1719,7 +1719,7 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw,
 		ath_err(ath9k_hw_common(sc->sc_ah), "Unknown AMPDU action\n");
 	}
 
-	local_bh_enable();
+	mutex_unlock(&sc->mutex);
 
 	return ret;
 }
Signature · 1 line
1.8.2.2
#3 lore raw

PATCH 4/4 ath9k: Fix TID locking

In reply to Sujith Manoharan

From: Sujith Manoharan <[email protected]>

The TID state is accessed from various contexts without any protection. Use the TX queue lock associated with the AC to make sure that the TID data is locked properly.

---
 drivers/net/wireless/ath/ath9k/rc.c   | 12 ++++++++----
 drivers/net/wireless/ath/ath9k/xmit.c | 37 ++++++++++++++++++++---------------
 2 files changed, 29 insertions(+), 20 deletions(-)
drivers/net/wireless/ath/ath9k/rc.c +8 -4
index aa4d368..aa1b63f 100644
@@ -1221,15 +1221,19 @@ static bool ath_tx_aggr_check(struct ath_softc *sc, struct ieee80211_sta *sta,
 			      u8 tidno)
 {
 	struct ath_node *an = (struct ath_node *)sta->drv_priv;
-	struct ath_atx_tid *txtid;
+	struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tidno);
+	struct ath_txq *txq = txtid->ac->txq;
 
 	if (!sta->ht_cap.ht_supported)
 		return false;
 
-	txtid = ATH_AN_2_TID(an, tidno);
+	ath_txq_lock(sc, txq);
+	if (!(txtid->state & (AGGR_ADDBA_COMPLETE | AGGR_ADDBA_PROGRESS))) {
+		ath_txq_unlock(sc, txq);
+		return true;
+	}
+	ath_txq_unlock(sc, txq);
 
-	if (!(txtid->state & (AGGR_ADDBA_COMPLETE | AGGR_ADDBA_PROGRESS)))
-			return true;
 	return false;
 }
 
drivers/net/wireless/ath/ath9k/xmit.c +21 -16
index eab0fcb..655057d 100644
@@ -131,16 +131,13 @@ static void ath_tx_resume_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
 
 	WARN_ON(!tid->paused);
 
-	ath_txq_lock(sc, txq);
 	tid->paused = false;
 
 	if (skb_queue_empty(&tid->buf_q))
-		goto unlock;
+		return;
 
 	ath_tx_queue_tid(txq, tid);
 	ath_txq_schedule(sc, txq);
-unlock:
-	ath_txq_unlock_complete(sc, txq);
 }
 
 static struct ath_frame_info *get_frame_info(struct sk_buff *skb)
@@ -1224,15 +1221,17 @@ static void ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq,
 int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
 		      u16 tid, u16 *ssn)
 {
-	struct ath_atx_tid *txtid;
-	struct ath_node *an;
+	struct ath_node *an = (struct ath_node *)sta->drv_priv;
+	struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tid);
+	struct ath_txq *txq = txtid->ac->txq;
 	u8 density;
 
-	an = (struct ath_node *)sta->drv_priv;
-	txtid = ATH_AN_2_TID(an, tid);
+	ath_txq_lock(sc, txq);
 
-	if (txtid->state & (AGGR_CLEANUP | AGGR_ADDBA_COMPLETE))
+	if (txtid->state & (AGGR_CLEANUP | AGGR_ADDBA_COMPLETE)) {
+		ath_txq_unlock(sc, txq);
 		return -EAGAIN;
+	}
 
 	/* 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
@@ -1253,6 +1252,8 @@ int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
 	memset(txtid->tx_buf, 0, sizeof(txtid->tx_buf));
 	txtid->baw_head = txtid->baw_tail = 0;
 
+	ath_txq_unlock(sc, txq);
+
 	return 0;
 }
 
@@ -1262,15 +1263,19 @@ void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid)
 	struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tid);
 	struct ath_txq *txq = txtid->ac->txq;
 
-	if (txtid->state & AGGR_CLEANUP)
+	ath_txq_lock(sc, txq);
+
+	if (txtid->state & AGGR_CLEANUP) {
+		ath_txq_unlock(sc, txq);
 		return;
+	}
 
 	if (!(txtid->state & AGGR_ADDBA_COMPLETE)) {
 		txtid->state &= ~AGGR_ADDBA_PROGRESS;
+		ath_txq_unlock(sc, txq);
 		return;
 	}
 
-	ath_txq_lock(sc, txq);
 	txtid->paused = true;
 
 	/*
@@ -1351,16 +1356,16 @@ void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an)
 
 void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid)
 {
-	struct ath_atx_tid *txtid;
-	struct ath_node *an;
-
-	an = (struct ath_node *)sta->drv_priv;
+	struct ath_node *an = (struct ath_node *)sta->drv_priv;
+	struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tid);
+	struct ath_txq *txq = txtid->ac->txq;
 
-	txtid = ATH_AN_2_TID(an, tid);
+	ath_txq_lock(sc, txq);
 	txtid->baw_size = IEEE80211_MIN_AMPDU_BUF << sta->ht_cap.ampdu_factor;
 	txtid->state |= AGGR_ADDBA_COMPLETE;
 	txtid->state &= ~AGGR_ADDBA_PROGRESS;
 	ath_tx_resume_tid(sc, txtid);
+	ath_txq_unlock_complete(sc, txq);
 }
 
 /********************/
Signature · 1 line
1.8.2.2