Skip to contentSkip to conversation

ath9k: optimize rate control statistics

RFC In review Mohammed Shafi Shajakhan 1 participant 2 messages Aug 8, 2011 – Aug 9, 2011 Qualcomm Atheros ATH9K wireless driver

lore
Share & tools
lore
#0 lore raw

RFC 1/1 ath9k: optimize rate control statistics

From: Mohammed Shafi Shajakhan <[email protected]>

for ease of debugging, the optimization is done such that the rate control stats are shown only for rate's that might be possibly used. for instance if static HT20 is configured, showing HT40 rate control stats is unnecessary. for dynamic HT40/HT20 i had made it such that the stats will be displayed till HT40. double streams/ triple usage was also considered. did some basic testing.

Cc Vasanthakumar Thiagarajan <[email protected]>
Cc "Balasubramanian, senthilkumar" <[email protected]>
---
 drivers/net/wireless/ath/ath9k/rc.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath9k/rc.c +5 -3
index c04a6c3..f964473 100644
@@ -1478,13 +1478,15 @@ static ssize_t read_file_rcstat(struct file *file, char __user *user_buf,
 	struct ath_rate_priv *rc = file->private_data;
 	char *buf;
 	unsigned int len = 0, max;
-	int i = 0;
+	u8 i = 0;
+	static u8 max_rate_table_size;
 	ssize_t retval;
 
 	if (rc->rate_table == NULL)
 		return 0;
+	max_rate_table_size = max(max_rate_table_size, rc->rate_table_size);
 
-	max = 80 + rc->rate_table->rate_cnt * 1024 + 1;
+	max = 80 + max_rate_table_size * 1024 + 1;
 	buf = kmalloc(max, GFP_KERNEL);
 	if (buf == NULL)
 		return -ENOMEM;
@@ -1494,7 +1496,7 @@ static ssize_t read_file_rcstat(struct file *file, char __user *user_buf,
 		       "HT", "MCS", "Rate",
 		       "Success", "Retries", "XRetries", "PER");
 
-	for (i = 0; i < rc->rate_table->rate_cnt; i++) {
+	for (i = 0; i < max_rate_table_size; i++) {
 		u32 ratekbps = rc->rate_table->info[i].ratekbps;
 		struct ath_rc_stats *stats = &rc->rcstats[i];
 		char mcs[5];
Signature · 1 line
1.7.0.4
author
#1 lore raw
Quoted 8 lines · Mohammed Shafi Shajakhan

From: Mohammed Shafi Shajakhan<[email protected]>

for ease of debugging, the optimization is done such that the rate control stats are shown only for rate's that might be possibly used. for instance if static HT20 is configured, showing HT40 rate control stats is unnecessary. for dynamic HT40/HT20 i had made it such that the stats will be displayed till HT40. double streams/ triple usage was also considered. did some basic testing.

I just did further more testing with this patch and found that its better to simply use 'rate_table_size' parameter to determine the rate table size. with this patch, few times some unnecessary stats were showed, when the Access point is configured in legacy mode. will send a proper patch for this.

Quoted 39 lines
Cc Vasanthakumar Thiagarajan<[email protected]>
Cc "Balasubramanian, senthilkumar"<[email protected]>
---
  drivers/net/wireless/ath/ath9k/rc.c |    8 +++++---
  1 files changed, 5 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath9k/rc.c +5 -3
index c04a6c3..f964473 100644
@@ -1478,13 +1478,15 @@ static ssize_t read_file_rcstat(struct file *file, char __user *user_buf,
  	struct ath_rate_priv *rc = file->private_data;
  	char *buf;
  	unsigned int len = 0, max;
-	int i = 0;
+	u8 i = 0;
+	static u8 max_rate_table_size;
  	ssize_t retval;
 
  	if (rc->rate_table == NULL)
  		return 0;
+	max_rate_table_size = max(max_rate_table_size, rc->rate_table_size);
 
-	max = 80 + rc->rate_table->rate_cnt * 1024 + 1;
+	max = 80 + max_rate_table_size * 1024 + 1;
  	buf = kmalloc(max, GFP_KERNEL);
  	if (buf == NULL)
  		return -ENOMEM;
@@ -1494,7 +1496,7 @@ static ssize_t read_file_rcstat(struct file *file, char __user *user_buf,
  		       "HT", "MCS", "Rate",
  		       "Success", "Retries", "XRetries", "PER");
 
-	for (i = 0; i<  rc->rate_table->rate_cnt; i++) {
+	for (i = 0; i<  max_rate_table_size; i++) {
  		u32 ratekbps = rc->rate_table->info[i].ratekbps;
  		struct ath_rc_stats *stats =&rc->rcstats[i];
  		char mcs[5];