Skip to contentSkip to conversation

ath5k: Print rx/tx bytes in debugfs

PATCH In review [email protected] 2 participants 2 messages Oct 1, 2010 – Oct 4, 2010 Atheros ATH5K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ath5k: Print rx/tx bytes in debugfs

From: Ben Greear <[email protected]>

This adds counters for tx and rx bytes, including any errored packets as well as all wireless headers.

---
:100644 100644 2ed327a... d914a31... M drivers/net/wireless/ath/ath5k/base.c
:100644 100644 b9f6d13... 9a79773... M drivers/net/wireless/ath/ath5k/base.h
:100644 100644 0f06e84... c2d549f... M drivers/net/wireless/ath/ath5k/debug.c

 drivers/net/wireless/ath/ath5k/base.c  |    2 ++
 drivers/net/wireless/ath/ath5k/base.h  |    7 +++++++
 drivers/net/wireless/ath/ath5k/debug.c |    4 ++++
 3 files changed, 13 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath5k/base.c +2 -0
index 2ed327a..d914a31 100644
@@ -1433,6 +1433,7 @@ static bool
 ath5k_receive_frame_ok(struct ath5k_softc *sc, struct ath5k_rx_status *rs)
 {
 	sc->stats.rx_all_count++;
+	sc->stats.rx_bytes_count += rs->rs_datalen;
 
 	if (unlikely(rs->rs_status)) {
 		if (rs->rs_status & AR5K_RXERR_CRC)
@@ -1611,6 +1612,7 @@ ath5k_tx_frame_completed(struct ath5k_softc *sc, struct sk_buff *skb,
 	int i;
 
 	sc->stats.tx_all_count++;
+	sc->stats.tx_bytes_count += skb->len;
 	info = IEEE80211_SKB_CB(skb);
 
 	ieee80211_tx_info_clear_status(info);
drivers/net/wireless/ath/ath5k/base.h +7 -0
index b9f6d13..9a79773 100644
@@ -121,6 +121,13 @@ struct ath5k_statistics {
 	/* frame errors */
 	unsigned int rx_all_count;	/* all RX frames, including errors */
 	unsigned int tx_all_count;	/* all TX frames, including errors */
+	unsigned int rx_bytes_count;	/* all RX bytes, including errored pks
+					 * and the MAC headers for each packet
+					 */
+	unsigned int tx_bytes_count;	/* all TX bytes, including errored pkts
+					 * and the MAC headers and padding for
+					 * each packet.
+					 */
 	unsigned int rxerr_crc;
 	unsigned int rxerr_phy;
 	unsigned int rxerr_phy_code[32];
drivers/net/wireless/ath/ath5k/debug.c +4 -0
index 0f06e84..c2d549f 100644
@@ -587,6 +587,8 @@ static ssize_t read_file_frameerrors(struct file *file, char __user *user_buf,
 				st->rxerr_jumbo*100/st->rx_all_count : 0);
 	len += snprintf(buf+len, sizeof(buf)-len, "[RX all\t%d]\n",
 			st->rx_all_count);
+	len += snprintf(buf+len, sizeof(buf)-len, "RX-all-bytes\t%d\n",
+			st->rx_bytes_count);
 
 	len += snprintf(buf+len, sizeof(buf)-len,
 			"\nTX\n---------------------\n");
@@ -604,6 +606,8 @@ static ssize_t read_file_frameerrors(struct file *file, char __user *user_buf,
 				st->txerr_filt*100/st->tx_all_count : 0);
 	len += snprintf(buf+len, sizeof(buf)-len, "[TX all\t%d]\n",
 			st->tx_all_count);
+	len += snprintf(buf+len, sizeof(buf)-len, "TX-all-bytes\t%d\n",
+			st->tx_bytes_count);
 
 	if (len > sizeof(buf))
 		len = sizeof(buf);
Signature · 1 line
1.7.2.2
Acked-by on v1 1/1
#1 lore raw
Quoted 70 lines · On Sat October 2 2010 02:54:04 [email protected] wrote:

From: Ben Greear <[email protected]>

This adds counters for tx and rx bytes, including any errored packets as well as all wireless headers.

---

:100644 100644 2ed327a... d914a31...
:M drivers/net/wireless/ath/ath5k/base.c 100644 100644 b9f6d13...
:9a79773... M drivers/net/wireless/ath/ath5k/base.h 100644 100644
:0f06e84... c2d549f... M drivers/net/wireless/ath/ath5k/debug.c

 drivers/net/wireless/ath/ath5k/base.c  |    2 ++
 drivers/net/wireless/ath/ath5k/base.h  |    7 +++++++
 drivers/net/wireless/ath/ath5k/debug.c |    4 ++++
 3 files changed, 13 insertions(+), 0 deletions(-)
(quoted diff) +0 -0

b/drivers/net/wireless/ath/ath5k/base.c index 2ed327a..d914a31 100644

drivers/net/wireless/ath/ath5k/base.c +2 -0
@@ -1433,6 +1433,7 @@ static bool
 ath5k_receive_frame_ok(struct ath5k_softc *sc, struct ath5k_rx_status *rs)
 {
 	sc->stats.rx_all_count++;
+	sc->stats.rx_bytes_count += rs->rs_datalen;
 
 	if (unlikely(rs->rs_status)) {
 		if (rs->rs_status & AR5K_RXERR_CRC)
@@ -1611,6 +1612,7 @@ ath5k_tx_frame_completed(struct ath5k_softc *sc,
 struct sk_buff *skb, int i;
 
 	sc->stats.tx_all_count++;
+	sc->stats.tx_bytes_count += skb->len;
 	info = IEEE80211_SKB_CB(skb);
 
 	ieee80211_tx_info_clear_status(info);
(quoted diff) +0 -0

b/drivers/net/wireless/ath/ath5k/base.h index b9f6d13..9a79773 100644

drivers/net/wireless/ath/ath5k/base.h +7 -0
@@ -121,6 +121,13 @@ struct ath5k_statistics {
 	/* frame errors */
 	unsigned int rx_all_count;	/* all RX frames, including errors */
 	unsigned int tx_all_count;	/* all TX frames, including errors */
+	unsigned int rx_bytes_count;	/* all RX bytes, including errored pks
+					 * and the MAC headers for each packet
+					 */
+	unsigned int tx_bytes_count;	/* all TX bytes, including errored pkts
+					 * and the MAC headers and padding for
+					 * each packet.
+					 */
 	unsigned int rxerr_crc;
 	unsigned int rxerr_phy;
 	unsigned int rxerr_phy_code[32];
(quoted diff) +0 -0

b/drivers/net/wireless/ath/ath5k/debug.c index 0f06e84..c2d549f 100644

drivers/net/wireless/ath/ath5k/debug.c +2 -0
@@ -587,6 +587,8 @@ static ssize_t read_file_frameerrors(struct file *file,
 char __user *user_buf, st->rxerr_jumbo*100/st->rx_all_count : 0);
 	len += snprintf(buf+len, sizeof(buf)-len, "[RX all\t%d]\n",
 			st->rx_all_count);
+	len += snprintf(buf+len, sizeof(buf)-len, "RX-all-bytes\t%d\n",
+			st->rx_bytes_count);
 
 	len += snprintf(buf+len, sizeof(buf)-len,
 			"\nTX\n---------------------\n");

drivers/net/wireless/ath/ath5k/debug.c static ssize_t read_file_frameerrors(struct file *file, · line 613

Quoted 8 lines
drivers/net/wireless/ath/ath5k/debug.c +2 -0
@@ -604,6 +606,8 @@ static ssize_t read_file_frameerrors(struct file *file,
 char __user *user_buf, st->txerr_filt*100/st->tx_all_count : 0);
 	len += snprintf(buf+len, sizeof(buf)-len, "[TX all\t%d]\n",
 			st->tx_all_count);
+	len += snprintf(buf+len, sizeof(buf)-len, "TX-all-bytes\t%d\n",
+			st->tx_bytes_count);
 
 	if (len > sizeof(buf))
 		len = sizeof(buf);

sure, why not...