Commit 72569b7b authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Kalle Valo

ath9k: fix RX_STAT_INC() etc macros

A couple of macros that deal with statistics in ath9k rely on the
declaration of the 'sc' variable, which they dereference.

However, when the statistics are disabled, the new instance in
ath_cmn_process_fft() causes a warning for an unused variable:

drivers/net/wireless/ath/ath9k/common-spectral.c: In function 'ath_cmn_process_fft':
drivers/net/wireless/ath/ath9k/common-spectral.c:474:20: error: unused variable 'sc' [-Werror=unused-variable]

It's better if those macros only operate on their arguments instead of
known variable names, and adding a cast to (void) kills off that warning.

Fixes: 03224678 ("ath9k: add counters for good and errorneous FFT/spectral frames")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent e3bfecd5
...@@ -755,11 +755,11 @@ void ath_ant_comb_scan(struct ath_softc *sc, struct ath_rx_status *rs) ...@@ -755,11 +755,11 @@ void ath_ant_comb_scan(struct ath_softc *sc, struct ath_rx_status *rs)
} }
if (main_ant_conf == rx_ant_conf) { if (main_ant_conf == rx_ant_conf) {
ANT_STAT_INC(ANT_MAIN, recv_cnt); ANT_STAT_INC(sc, ANT_MAIN, recv_cnt);
ANT_LNA_INC(ANT_MAIN, rx_ant_conf); ANT_LNA_INC(sc, ANT_MAIN, rx_ant_conf);
} else { } else {
ANT_STAT_INC(ANT_ALT, recv_cnt); ANT_STAT_INC(sc, ANT_ALT, recv_cnt);
ANT_LNA_INC(ANT_ALT, rx_ant_conf); ANT_LNA_INC(sc, ANT_ALT, rx_ant_conf);
} }
/* Short scan check */ /* Short scan check */
......
...@@ -624,9 +624,9 @@ int ath_cmn_process_fft(struct ath_spec_scan_priv *spec_priv, struct ieee80211_h ...@@ -624,9 +624,9 @@ int ath_cmn_process_fft(struct ath_spec_scan_priv *spec_priv, struct ieee80211_h
tsf, freq, chan_type); tsf, freq, chan_type);
if (ret == 0) if (ret == 0)
RX_STAT_INC(rx_spectral_sample_good); RX_STAT_INC(sc, rx_spectral_sample_good);
else else
RX_STAT_INC(rx_spectral_sample_err); RX_STAT_INC(sc, rx_spectral_sample_err);
memset(sample_buf, 0, SPECTRAL_SAMPLE_MAX_LEN); memset(sample_buf, 0, SPECTRAL_SAMPLE_MAX_LEN);
...@@ -642,9 +642,9 @@ int ath_cmn_process_fft(struct ath_spec_scan_priv *spec_priv, struct ieee80211_h ...@@ -642,9 +642,9 @@ int ath_cmn_process_fft(struct ath_spec_scan_priv *spec_priv, struct ieee80211_h
tsf, freq, chan_type); tsf, freq, chan_type);
if (ret == 0) if (ret == 0)
RX_STAT_INC(rx_spectral_sample_good); RX_STAT_INC(sc, rx_spectral_sample_good);
else else
RX_STAT_INC(rx_spectral_sample_err); RX_STAT_INC(sc, rx_spectral_sample_err);
/* Mix the received bins to the /dev/random /* Mix the received bins to the /dev/random
* pool * pool
......
...@@ -785,35 +785,35 @@ void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf, ...@@ -785,35 +785,35 @@ void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf,
{ {
int qnum = txq->axq_qnum; int qnum = txq->axq_qnum;
TX_STAT_INC(qnum, tx_pkts_all); TX_STAT_INC(sc, qnum, tx_pkts_all);
sc->debug.stats.txstats[qnum].tx_bytes_all += bf->bf_mpdu->len; sc->debug.stats.txstats[qnum].tx_bytes_all += bf->bf_mpdu->len;
if (bf_isampdu(bf)) { if (bf_isampdu(bf)) {
if (flags & ATH_TX_ERROR) if (flags & ATH_TX_ERROR)
TX_STAT_INC(qnum, a_xretries); TX_STAT_INC(sc, qnum, a_xretries);
else else
TX_STAT_INC(qnum, a_completed); TX_STAT_INC(sc, qnum, a_completed);
} else { } else {
if (ts->ts_status & ATH9K_TXERR_XRETRY) if (ts->ts_status & ATH9K_TXERR_XRETRY)
TX_STAT_INC(qnum, xretries); TX_STAT_INC(sc, qnum, xretries);
else else
TX_STAT_INC(qnum, completed); TX_STAT_INC(sc, qnum, completed);
} }
if (ts->ts_status & ATH9K_TXERR_FILT) if (ts->ts_status & ATH9K_TXERR_FILT)
TX_STAT_INC(qnum, txerr_filtered); TX_STAT_INC(sc, qnum, txerr_filtered);
if (ts->ts_status & ATH9K_TXERR_FIFO) if (ts->ts_status & ATH9K_TXERR_FIFO)
TX_STAT_INC(qnum, fifo_underrun); TX_STAT_INC(sc, qnum, fifo_underrun);
if (ts->ts_status & ATH9K_TXERR_XTXOP) if (ts->ts_status & ATH9K_TXERR_XTXOP)
TX_STAT_INC(qnum, xtxop); TX_STAT_INC(sc, qnum, xtxop);
if (ts->ts_status & ATH9K_TXERR_TIMER_EXPIRED) if (ts->ts_status & ATH9K_TXERR_TIMER_EXPIRED)
TX_STAT_INC(qnum, timer_exp); TX_STAT_INC(sc, qnum, timer_exp);
if (ts->ts_flags & ATH9K_TX_DESC_CFG_ERR) if (ts->ts_flags & ATH9K_TX_DESC_CFG_ERR)
TX_STAT_INC(qnum, desc_cfg_err); TX_STAT_INC(sc, qnum, desc_cfg_err);
if (ts->ts_flags & ATH9K_TX_DATA_UNDERRUN) if (ts->ts_flags & ATH9K_TX_DATA_UNDERRUN)
TX_STAT_INC(qnum, data_underrun); TX_STAT_INC(sc, qnum, data_underrun);
if (ts->ts_flags & ATH9K_TX_DELIM_UNDERRUN) if (ts->ts_flags & ATH9K_TX_DELIM_UNDERRUN)
TX_STAT_INC(qnum, delim_underrun); TX_STAT_INC(sc, qnum, delim_underrun);
} }
void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs) void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs)
......
...@@ -25,17 +25,17 @@ struct ath_buf; ...@@ -25,17 +25,17 @@ struct ath_buf;
struct fft_sample_tlv; struct fft_sample_tlv;
#ifdef CONFIG_ATH9K_DEBUGFS #ifdef CONFIG_ATH9K_DEBUGFS
#define TX_STAT_INC(q, c) sc->debug.stats.txstats[q].c++ #define TX_STAT_INC(sc, q, c) do { (sc)->debug.stats.txstats[q].c++; } while (0)
#define RX_STAT_INC(c) (sc->debug.stats.rxstats.c++) #define RX_STAT_INC(sc, c) do { (sc)->debug.stats.rxstats.c++; } while (0)
#define RESET_STAT_INC(sc, type) sc->debug.stats.reset[type]++ #define RESET_STAT_INC(sc, type) do { (sc)->debug.stats.reset[type]++; } while (0)
#define ANT_STAT_INC(i, c) sc->debug.stats.ant_stats[i].c++ #define ANT_STAT_INC(sc, i, c) do { (sc)->debug.stats.ant_stats[i].c++; } while (0)
#define ANT_LNA_INC(i, c) sc->debug.stats.ant_stats[i].lna_recv_cnt[c]++; #define ANT_LNA_INC(sc, i, c) do { (sc)->debug.stats.ant_stats[i].lna_recv_cnt[c]++; } while (0)
#else #else
#define TX_STAT_INC(q, c) do { } while (0) #define TX_STAT_INC(sc, q, c) do { (void)(sc); } while (0)
#define RX_STAT_INC(c) #define RX_STAT_INC(sc, c) do { (void)(sc); } while (0)
#define RESET_STAT_INC(sc, type) do { } while (0) #define RESET_STAT_INC(sc, type) do { (void)(sc); } while (0)
#define ANT_STAT_INC(i, c) do { } while (0) #define ANT_STAT_INC(sc, i, c) do { (void)(sc); } while (0)
#define ANT_LNA_INC(i, c) do { } while (0) #define ANT_LNA_INC(sc, i, c) do { (void)(sc); } while (0)
#endif #endif
enum ath_reset_type { enum ath_reset_type {
......
...@@ -809,7 +809,7 @@ static void ath9k_tx(struct ieee80211_hw *hw, ...@@ -809,7 +809,7 @@ static void ath9k_tx(struct ieee80211_hw *hw,
if (ath_tx_start(hw, skb, &txctl) != 0) { if (ath_tx_start(hw, skb, &txctl) != 0) {
ath_dbg(common, XMIT, "TX failed\n"); ath_dbg(common, XMIT, "TX failed\n");
TX_STAT_INC(txctl.txq->axq_qnum, txfailed); TX_STAT_INC(sc, txctl.txq->axq_qnum, txfailed);
goto exit; goto exit;
} }
......
...@@ -829,7 +829,7 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc, ...@@ -829,7 +829,7 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc,
* Discard zero-length packets and packets smaller than an ACK * Discard zero-length packets and packets smaller than an ACK
*/ */
if (rx_stats->rs_datalen < 10) { if (rx_stats->rs_datalen < 10) {
RX_STAT_INC(rx_len_err); RX_STAT_INC(sc, rx_len_err);
goto corrupt; goto corrupt;
} }
...@@ -839,7 +839,7 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc, ...@@ -839,7 +839,7 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc,
* those frames. * those frames.
*/ */
if (rx_stats->rs_datalen > (common->rx_bufsize - ah->caps.rx_status_len)) { if (rx_stats->rs_datalen > (common->rx_bufsize - ah->caps.rx_status_len)) {
RX_STAT_INC(rx_len_err); RX_STAT_INC(sc, rx_len_err);
goto corrupt; goto corrupt;
} }
...@@ -880,7 +880,7 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc, ...@@ -880,7 +880,7 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc,
} else if (sc->spec_priv.spectral_mode != SPECTRAL_DISABLED && } else if (sc->spec_priv.spectral_mode != SPECTRAL_DISABLED &&
ath_cmn_process_fft(&sc->spec_priv, hdr, rx_stats, ath_cmn_process_fft(&sc->spec_priv, hdr, rx_stats,
rx_status->mactime)) { rx_status->mactime)) {
RX_STAT_INC(rx_spectral); RX_STAT_INC(sc, rx_spectral);
} }
return -EINVAL; return -EINVAL;
} }
...@@ -898,7 +898,7 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc, ...@@ -898,7 +898,7 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc,
spin_unlock_bh(&sc->chan_lock); spin_unlock_bh(&sc->chan_lock);
if (ath_is_mybeacon(common, hdr)) { if (ath_is_mybeacon(common, hdr)) {
RX_STAT_INC(rx_beacons); RX_STAT_INC(sc, rx_beacons);
rx_stats->is_mybeacon = true; rx_stats->is_mybeacon = true;
} }
...@@ -915,7 +915,7 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc, ...@@ -915,7 +915,7 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc,
*/ */
ath_dbg(common, ANY, "unsupported hw bitrate detected 0x%02x using 1 Mbit\n", ath_dbg(common, ANY, "unsupported hw bitrate detected 0x%02x using 1 Mbit\n",
rx_stats->rs_rate); rx_stats->rs_rate);
RX_STAT_INC(rx_rate_err); RX_STAT_INC(sc, rx_rate_err);
return -EINVAL; return -EINVAL;
} }
...@@ -1136,7 +1136,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) ...@@ -1136,7 +1136,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp)
* skb and put it at the tail of the sc->rx.rxbuf list for * skb and put it at the tail of the sc->rx.rxbuf list for
* processing. */ * processing. */
if (!requeue_skb) { if (!requeue_skb) {
RX_STAT_INC(rx_oom_err); RX_STAT_INC(sc, rx_oom_err);
goto requeue_drop_frag; goto requeue_drop_frag;
} }
...@@ -1164,7 +1164,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) ...@@ -1164,7 +1164,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp)
rxs, decrypt_error); rxs, decrypt_error);
if (rs.rs_more) { if (rs.rs_more) {
RX_STAT_INC(rx_frags); RX_STAT_INC(sc, rx_frags);
/* /*
* rs_more indicates chained descriptors which can be * rs_more indicates chained descriptors which can be
* used to link buffers together for a sort of * used to link buffers together for a sort of
...@@ -1174,7 +1174,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) ...@@ -1174,7 +1174,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp)
/* too many fragments - cannot handle frame */ /* too many fragments - cannot handle frame */
dev_kfree_skb_any(sc->rx.frag); dev_kfree_skb_any(sc->rx.frag);
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
RX_STAT_INC(rx_too_many_frags_err); RX_STAT_INC(sc, rx_too_many_frags_err);
skb = NULL; skb = NULL;
} }
sc->rx.frag = skb; sc->rx.frag = skb;
...@@ -1186,7 +1186,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) ...@@ -1186,7 +1186,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp)
if (pskb_expand_head(hdr_skb, 0, space, GFP_ATOMIC) < 0) { if (pskb_expand_head(hdr_skb, 0, space, GFP_ATOMIC) < 0) {
dev_kfree_skb(skb); dev_kfree_skb(skb);
RX_STAT_INC(rx_oom_err); RX_STAT_INC(sc, rx_oom_err);
goto requeue_drop_frag; goto requeue_drop_frag;
} }
......
...@@ -391,7 +391,7 @@ static void ath_tx_set_retry(struct ath_softc *sc, struct ath_txq *txq, ...@@ -391,7 +391,7 @@ static void ath_tx_set_retry(struct ath_softc *sc, struct ath_txq *txq,
struct ieee80211_hdr *hdr; struct ieee80211_hdr *hdr;
int prev = fi->retries; int prev = fi->retries;
TX_STAT_INC(txq->axq_qnum, a_retries); TX_STAT_INC(sc, txq->axq_qnum, a_retries);
fi->retries += count; fi->retries += count;
if (prev > 0) if (prev > 0)
...@@ -1105,7 +1105,7 @@ ath_tx_form_aggr(struct ath_softc *sc, struct ath_txq *txq, ...@@ -1105,7 +1105,7 @@ ath_tx_form_aggr(struct ath_softc *sc, struct ath_txq *txq,
al = get_frame_info(bf->bf_mpdu)->framelen; al = get_frame_info(bf->bf_mpdu)->framelen;
bf->bf_state.bf_type = BUF_AMPDU; bf->bf_state.bf_type = BUF_AMPDU;
} else { } else {
TX_STAT_INC(txq->axq_qnum, a_aggr); TX_STAT_INC(sc, txq->axq_qnum, a_aggr);
} }
return al; return al;
...@@ -1727,7 +1727,7 @@ void ath9k_release_buffered_frames(struct ieee80211_hw *hw, ...@@ -1727,7 +1727,7 @@ void ath9k_release_buffered_frames(struct ieee80211_hw *hw,
bf_tail = bf; bf_tail = bf;
nframes--; nframes--;
sent++; sent++;
TX_STAT_INC(txq->axq_qnum, a_queued_hw); TX_STAT_INC(sc, txq->axq_qnum, a_queued_hw);
if (an->sta && skb_queue_empty(&tid->retry_q)) if (an->sta && skb_queue_empty(&tid->retry_q))
ieee80211_sta_set_buffered(an->sta, i, false); ieee80211_sta_set_buffered(an->sta, i, false);
...@@ -2110,14 +2110,14 @@ static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq, ...@@ -2110,14 +2110,14 @@ static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq,
} }
if (puttxbuf) { if (puttxbuf) {
TX_STAT_INC(txq->axq_qnum, puttxbuf); TX_STAT_INC(sc, txq->axq_qnum, puttxbuf);
ath9k_hw_puttxbuf(ah, txq->axq_qnum, bf->bf_daddr); ath9k_hw_puttxbuf(ah, txq->axq_qnum, bf->bf_daddr);
ath_dbg(common, XMIT, "TXDP[%u] = %llx (%p)\n", ath_dbg(common, XMIT, "TXDP[%u] = %llx (%p)\n",
txq->axq_qnum, ito64(bf->bf_daddr), bf->bf_desc); txq->axq_qnum, ito64(bf->bf_daddr), bf->bf_desc);
} }
if (!edma || sc->tx99_state) { if (!edma || sc->tx99_state) {
TX_STAT_INC(txq->axq_qnum, txstart); TX_STAT_INC(sc, txq->axq_qnum, txstart);
ath9k_hw_txstart(ah, txq->axq_qnum); ath9k_hw_txstart(ah, txq->axq_qnum);
} }
...@@ -2154,7 +2154,7 @@ static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq, ...@@ -2154,7 +2154,7 @@ static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq,
bf->bf_lastbf = bf; bf->bf_lastbf = bf;
ath_tx_fill_desc(sc, bf, txq, fi->framelen); ath_tx_fill_desc(sc, bf, txq, fi->framelen);
ath_tx_txqaddbuf(sc, txq, &bf_head, false); ath_tx_txqaddbuf(sc, txq, &bf_head, false);
TX_STAT_INC(txq->axq_qnum, queued); TX_STAT_INC(sc, txq->axq_qnum, queued);
} }
static void setup_frame_info(struct ieee80211_hw *hw, static void setup_frame_info(struct ieee80211_hw *hw,
...@@ -2486,7 +2486,7 @@ void ath_tx_cabq(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ...@@ -2486,7 +2486,7 @@ void ath_tx_cabq(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
ath_txq_lock(sc, txctl.txq); ath_txq_lock(sc, txctl.txq);
ath_tx_fill_desc(sc, bf, txctl.txq, 0); ath_tx_fill_desc(sc, bf, txctl.txq, 0);
ath_tx_txqaddbuf(sc, txctl.txq, &bf_q, false); ath_tx_txqaddbuf(sc, txctl.txq, &bf_q, false);
TX_STAT_INC(txctl.txq->axq_qnum, queued); TX_STAT_INC(sc, txctl.txq->axq_qnum, queued);
ath_txq_unlock(sc, txctl.txq); ath_txq_unlock(sc, txctl.txq);
} }
...@@ -2699,7 +2699,7 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq) ...@@ -2699,7 +2699,7 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
if (status == -EINPROGRESS) if (status == -EINPROGRESS)
break; break;
TX_STAT_INC(txq->axq_qnum, txprocdesc); TX_STAT_INC(sc, txq->axq_qnum, txprocdesc);
/* /*
* Remove ath_buf's of the same transmit unit from txq, * Remove ath_buf's of the same transmit unit from txq,
...@@ -2778,7 +2778,7 @@ void ath_tx_edma_tasklet(struct ath_softc *sc) ...@@ -2778,7 +2778,7 @@ void ath_tx_edma_tasklet(struct ath_softc *sc)
ath_txq_lock(sc, txq); ath_txq_lock(sc, txq);
TX_STAT_INC(txq->axq_qnum, txprocdesc); TX_STAT_INC(sc, txq->axq_qnum, txprocdesc);
fifo_list = &txq->txq_fifo[txq->txq_tailidx]; fifo_list = &txq->txq_fifo[txq->txq_tailidx];
if (list_empty(fifo_list)) { if (list_empty(fifo_list)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment