All of lore.kernel.org
 help / color / mirror / Atom feed
* [ath9k-devel] [PATCH 1/2] ath9k combined rcstat
@ 2009-05-25 13:32 Jeff Hansen
  2009-05-26 16:46 ` Luis R. Rodriguez
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Hansen @ 2009-05-25 13:32 UTC (permalink / raw)
  To: ath9k-devel

This patch combines the legacy and 11n rcstats into one, using the normal 
rate table indices instead of two separate indices for each mode.  Legacy 
rates also get all of the PER information, now, too.

-Jeff

---------------------------------------------------
"If someone's gotta do it, it might as well be me."
                 x at jeffhansen.com
-------------- next part --------------
Index: compat-wireless-2009-05-20/drivers/net/wireless/ath/ath9k/debug.h
===================================================================
--- compat-wireless-2009-05-20.orig/drivers/net/wireless/ath/ath9k/debug.h	2009-05-25 13:15:11.000000000 +0000
+++ compat-wireless-2009-05-20/drivers/net/wireless/ath/ath9k/debug.h	2009-05-25 13:15:44.000000000 +0000
@@ -80,11 +80,7 @@
 	u32 dtim;
 };
 
-struct ath_legacy_rc_stats {
-	u32 success;
-};
-
-struct ath_11n_rc_stats {
+struct ath_rc_stats {
 	u32 success;
 	u32 retries;
 	u32 xretries;
@@ -93,8 +89,7 @@
 
 struct ath_stats {
 	struct ath_interrupt_stats istats;
-	struct ath_legacy_rc_stats legacy_rcstats[12];	/* max(11a,11b,11g) */
-	struct ath_11n_rc_stats n_rcstats[16];		/* 0..15 MCS rates */
+	struct ath_rc_stats rcstats[RATE_TABLE_SIZE];
 };
 
 struct ath9k_debug {
Index: compat-wireless-2009-05-20/drivers/net/wireless/ath/ath9k/debug.c
===================================================================
--- compat-wireless-2009-05-20.orig/drivers/net/wireless/ath/ath9k/debug.c	2009-05-25 13:15:11.000000000 +0000
+++ compat-wireless-2009-05-20/drivers/net/wireless/ath/ath9k/debug.c	2009-05-25 13:15:44.000000000 +0000
@@ -15,6 +15,7 @@
  */
 
 #include <asm/unaligned.h>
+#include <linux/vmalloc.h>
 
 #include "ath9k.h"
 
@@ -224,111 +225,62 @@
 	.owner = THIS_MODULE
 };
 
-static void ath_debug_stat_11n_rc(struct ath_softc *sc, struct sk_buff *skb)
-{
-	struct ath_tx_info_priv *tx_info_priv = NULL;
-	struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
-	struct ieee80211_tx_rate *rates = tx_info->status.rates;
-	int final_ts_idx, idx;
-
-	tx_info_priv = ATH_TX_INFO_PRIV(tx_info);
-	final_ts_idx = tx_info_priv->tx.ts_rateindex;
-	idx = sc->cur_rate_table->info[rates[final_ts_idx].idx].dot11rate;
-
-	sc->debug.stats.n_rcstats[idx].success++;
-}
-
-static void ath_debug_stat_legacy_rc(struct ath_softc *sc, struct sk_buff *skb)
+void ath_debug_stat_rc(struct ath_softc *sc, struct sk_buff *skb)
 {
 	struct ath_tx_info_priv *tx_info_priv = NULL;
 	struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
 	struct ieee80211_tx_rate *rates = tx_info->status.rates;
-	int final_ts_idx, idx;
+	int final_ts_idx;
 
 	tx_info_priv = ATH_TX_INFO_PRIV(tx_info);
 	final_ts_idx = tx_info_priv->tx.ts_rateindex;
-	idx = rates[final_ts_idx].idx;
-
-	sc->debug.stats.legacy_rcstats[idx].success++;
+	sc->debug.stats.rcstats[rates[final_ts_idx].idx].success++;
 }
 
-void ath_debug_stat_rc(struct ath_softc *sc, struct sk_buff *skb)
-{
-	if (conf_is_ht(&sc->hw->conf))
-		ath_debug_stat_11n_rc(sc, skb);
-	else
-		ath_debug_stat_legacy_rc(sc, skb);
-}
-
-/* FIXME: legacy rates, later on .. */
 void ath_debug_stat_retries(struct ath_softc *sc, int rix,
 			    int xretries, int retries, u8 per)
 {
-	if (conf_is_ht(&sc->hw->conf)) {
-		int idx = sc->cur_rate_table->info[rix].dot11rate;
+	struct ath_rc_stats *stats = &sc->debug.stats.rcstats[rix];
 
-		sc->debug.stats.n_rcstats[idx].xretries += xretries;
-		sc->debug.stats.n_rcstats[idx].retries += retries;
-		sc->debug.stats.n_rcstats[idx].per = per;
-	}
+	stats->xretries += xretries;
+	stats->retries += retries;
+	stats->per = per;
 }
 
-static ssize_t ath_read_file_stat_11n_rc(struct file *file,
-					 char __user *user_buf,
-					 size_t count, loff_t *ppos)
+static ssize_t read_file_rcstat(struct file *file, char __user *user_buf,
+				size_t count, loff_t *ppos)
 {
 	struct ath_softc *sc = file->private_data;
-	char buf[1024];
-	unsigned int len = 0;
+	char *buf;
+	unsigned int len = 0, max;
 	int i = 0;
+	ssize_t retval;
 
-	len += sprintf(buf, "%7s %13s %8s %8s %6s\n\n", "Rate", "Success",
-		       "Retries", "XRetries", "PER");
-
-	for (i = 0; i <= 15; i++) {
-		len += snprintf(buf + len, sizeof(buf) - len,
-				"%5s%3d: %8u %8u %8u %8u\n", "MCS", i,
-				sc->debug.stats.n_rcstats[i].success,
-				sc->debug.stats.n_rcstats[i].retries,
-				sc->debug.stats.n_rcstats[i].xretries,
-				sc->debug.stats.n_rcstats[i].per);
-	}
-
-	return simple_read_from_buffer(user_buf, count, ppos, buf, len);
-}
+	if (sc->cur_rate_table == NULL)
+		return 0;
 
-static ssize_t ath_read_file_stat_legacy_rc(struct file *file,
-					    char __user *user_buf,
-					    size_t count, loff_t *ppos)
-{
-	struct ath_softc *sc = file->private_data;
-	char buf[512];
-	unsigned int len = 0;
-	int i = 0;
+	if ((buf = vmalloc((max = 80 +
+	                    sc->cur_rate_table->rate_cnt * 64) + 1)) == NULL)
+		return 0;
+	buf[max] = 0;
 
-	len += sprintf(buf, "%7s %13s\n\n", "Rate", "Success");
+	len += sprintf(buf, "%5s %15s %8s %9s %3s\n\n", "Rate", "Success",
+		       "Retries", "XRetries", "PER");
 
 	for (i = 0; i < sc->cur_rate_table->rate_cnt; i++) {
-		len += snprintf(buf + len, sizeof(buf) - len, "%5u: %12u\n",
-				sc->cur_rate_table->info[i].ratekbps / 1000,
-				sc->debug.stats.legacy_rcstats[i].success);
-	}
-
-	return simple_read_from_buffer(user_buf, count, ppos, buf, len);
-}
-
-static ssize_t read_file_rcstat(struct file *file, char __user *user_buf,
-				size_t count, loff_t *ppos)
-{
-	struct ath_softc *sc = file->private_data;
+		u32 ratekbps = sc->cur_rate_table->info[i].ratekbps;
+		struct ath_rc_stats *stats = &sc->debug.stats.rcstats[i];
 
-	if (sc->cur_rate_table == NULL)
-		return 0;
+		len += snprintf(buf + len, max - len,
+			"%3u.%d: %8u %8u %8u %8u\n", ratekbps / 1000,
+			(ratekbps % 1000) / 100, stats->success,
+			stats->retries, stats->xretries,
+			stats->per);
+	}
 
-	if (conf_is_ht(&sc->hw->conf))
-		return ath_read_file_stat_11n_rc(file, user_buf, count, ppos);
-	else
-		return ath_read_file_stat_legacy_rc(file, user_buf, count ,ppos);
+	retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
+	vfree(buf);
+	return retval;
 }
 
 static const struct file_operations fops_rcstat = {

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [ath9k-devel] [PATCH 1/2] ath9k combined rcstat
  2009-05-25 13:32 [ath9k-devel] [PATCH 1/2] ath9k combined rcstat Jeff Hansen
@ 2009-05-26 16:46 ` Luis R. Rodriguez
  0 siblings, 0 replies; 2+ messages in thread
From: Luis R. Rodriguez @ 2009-05-26 16:46 UTC (permalink / raw)
  To: ath9k-devel

On Mon, May 25, 2009 at 06:32:31AM -0700, Jeff Hansen wrote:
> This patch combines the legacy and 11n rcstats into one, using the normal
> rate table indices instead of two separate indices for each mode.  Legacy
> rates also get all of the PER information, now, too.
> 
> -Jeff
> 
> ---------------------------------------------------
> "If someone's gotta do it, it might as well be me."
>                  x at jeffhansen.com

Content-Description: 001-combined-rcstat.patch
> Index: compat-wireless-2009-05-20/drivers/net/wireless/ath/ath9k/debug.h
> ===================================================================
> --- compat-wireless-2009-05-20.orig/drivers/net/wireless/ath/ath9k/debug.h	2009-05-25 13:15:11.000000000 +0000
> +++ compat-wireless-2009-05-20/drivers/net/wireless/ath/ath9k/debug.h	2009-05-25 13:15:44.000000000 +0000

Thanks for the patch, can you please address the considerations below but also
format the patch using git on wireless-testing and also abide by the usual patch
format for upstream?

http://wireless.kernel.org/en/developers/Documentation/SubmittingPatches

> @@ -224,111 +225,62 @@
>  	.owner = THIS_MODULE
>  };
>  
> -static void ath_debug_stat_11n_rc(struct ath_softc *sc, struct sk_buff *skb)
> -{
> -	struct ath_tx_info_priv *tx_info_priv = NULL;
> -	struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
> -	struct ieee80211_tx_rate *rates = tx_info->status.rates;
> -	int final_ts_idx, idx;
> -
> -	tx_info_priv = ATH_TX_INFO_PRIV(tx_info);
> -	final_ts_idx = tx_info_priv->tx.ts_rateindex;
> -	idx = sc->cur_rate_table->info[rates[final_ts_idx].idx].dot11rate;
> -
> -	sc->debug.stats.n_rcstats[idx].success++;
> -}
> -
> -static void ath_debug_stat_legacy_rc(struct ath_softc *sc, struct sk_buff *skb)
> +void ath_debug_stat_rc(struct ath_softc *sc, struct sk_buff *skb)
>  {
>  	struct ath_tx_info_priv *tx_info_priv = NULL;
>  	struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
>  	struct ieee80211_tx_rate *rates = tx_info->status.rates;
> -	int final_ts_idx, idx;
> +	int final_ts_idx;
>  
>  	tx_info_priv = ATH_TX_INFO_PRIV(tx_info);
>  	final_ts_idx = tx_info_priv->tx.ts_rateindex;
> -	idx = rates[final_ts_idx].idx;
> -
> -	sc->debug.stats.legacy_rcstats[idx].success++;
> +	sc->debug.stats.rcstats[rates[final_ts_idx].idx].success++;

This seems a bit hard to read can you add a pointer for the 
rcstats[foo] and then access it.

  Luis

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-05-26 16:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-25 13:32 [ath9k-devel] [PATCH 1/2] ath9k combined rcstat Jeff Hansen
2009-05-26 16:46 ` Luis R. Rodriguez

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.