Skip to contentSkip to conversation

wifi: ath9k_htc: count length-discarded frames in the RX stats

PATCH New Nerijus Bendžiūnas 1 participant 1 message Sep 4 Qualcomm Atheros ATH9K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 wifi: ath9k_htc: count length-discarded frames in the RX stats

ath9k_rx_prepare() drops short and malformed frames with a log message and nothing counts them, so a burst of drops cannot be told apart from a quiet link in the statistics. The recv debugfs file already prints rx_len_err in its LENGTH-ERR line, but nothing increments it on ath9k_htc.

Count the three length drops in rx_stats.rx_len_err so the existing line reports them.

Assisted-by Claude:claude-fable-5-1

---
Changes in v2:
- Sent on its own; in v1 this was patch 2/2 of "cope with lost WMI reads", which it has nothing to do with.
- Add Assisted-by, rewrite the commit message, rebase onto ath-next. No code change.

 drivers/net/wireless/ath/ath9k/htc.h          | 2 ++
 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 3 +++
 2 files changed, 5 insertions(+)
drivers/net/wireless/ath/ath9k/htc.h +2 -0
index 6c33e898b300..0bdb300f0ad7 100644
@@ -328,6 +328,7 @@ static inline struct ath9k_htc_tx_ctl *HTC_SKB_CB(struct sk_buff *skb)
 #ifdef CONFIG_ATH9K_HTC_DEBUGFS
 #define __STAT_SAFE(hif_dev, expr)	do { ((hif_dev)->htc_handle->drv_priv ? (expr) : 0); } while (0)
 #define CAB_STAT_INC(priv)		do { ((priv)->debug.tx_stats.cab_queued++); } while (0)
+#define RX_LEN_ERR_INC(priv)		((priv)->debug.rx_stats.rx_len_err++)
 #define TX_QSTAT_INC(priv, q)		do { ((priv)->debug.tx_stats.queue_stats[q]++); } while (0)
 
 #define TX_STAT_INC(hif_dev, c) \
@@ -383,6 +384,7 @@ void ath9k_htc_get_et_stats(struct ieee80211_hw *hw,
 #define RX_STAT_ADD(hif_dev, c, a)	do { } while (0)
 
 #define CAB_STAT_INC(priv)
+#define RX_LEN_ERR_INC(priv)
 #define TX_QSTAT_INC(priv, c)
 
 static inline void ath9k_htc_err_stat_rx(struct ath9k_htc_priv *priv,
drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +3 -0
index bed7ea2425a0..3c1e4fad5ad1 100644
@@ -988,6 +988,7 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv,
 	if (skb->len < HTC_RX_FRAME_HEADER_SIZE) {
 		ath_err(common, "Corrupted RX frame, dropping (len: %d)\n",
 			skb->len);
+		RX_LEN_ERR_INC(priv);
 		goto rx_next;
 	}
 
@@ -999,6 +1000,7 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv,
 		ath_err(common,
 			"Corrupted RX data len, dropping (dlen: %d, skblen: %d)\n",
 			rs_datalen, skb->len);
+		RX_LEN_ERR_INC(priv);
 		goto rx_next;
 	}
 
@@ -1011,6 +1013,7 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv,
 		ath_dbg(common, ANY,
 			"Short RX data len, dropping (dlen: %d)\n",
 			rs_datalen);
+		RX_LEN_ERR_INC(priv);
 		goto rx_next;
 	}
 

base-commit: 1d8e73163ef933624341075f576e2f36ef9133f7

Signature · 1 line
2.55.0