Re: [RFC v1] mac80211: Add support for per station rx stats histogram

2016-03-09 Thread Mohammed Shafi Shajakhan
On Wed, Mar 09, 2016 at 06:27:48PM +0100, Johannes Berg wrote:
> On Wed, 2016-03-09 at 22:00 +0530, Mohammed Shafi Shajakhan wrote:
> > 
> > I had started studying(understand) your patch. Please
> > let me know if you have already added support for the same
> > in userspace as well, we like to use your changes and possibly
> > add any changes that addresses rx_stats histogram as well
> 
> I had a very minimal file in iw, but that's all:
> 
> https://p.sipsolutions.net/744c0854bc02c95f.txt
>
[shafi] thank you for sharing this Johannes

-shafi
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC v1] mac80211: Add support for per station rx stats histogram

2016-03-09 Thread Johannes Berg
On Wed, 2016-03-09 at 22:00 +0530, Mohammed Shafi Shajakhan wrote:
> 
> I had started studying(understand) your patch. Please
> let me know if you have already added support for the same
> in userspace as well, we like to use your changes and possibly
> add any changes that addresses rx_stats histogram as well

I had a very minimal file in iw, but that's all:

https://p.sipsolutions.net/744c0854bc02c95f.txt

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC v1] mac80211: Add support for per station rx stats histogram

2016-03-09 Thread Mohammed Shafi Shajakhan
Hi Johannes,

I am able to apply both your patches in my local tree(with very very
minimal conflict)
http://thread.gmane.org/gmane.linux.kernel.wireless.general/133172

I had started studying(understand) your patch. Please
let me know if you have already added support for the same
in userspace as well, we like to use your changes and possibly
add any changes that addresses rx_stats histogram as well

I will keep you posted for any other queries/ clarification,
thanks !

-shafi

On Tue, Mar 08, 2016 at 03:12:50PM +0530, Mohammed Shafi Shajakhan wrote:
> Hi Johannes,
> 
> On Tue, Mar 08, 2016 at 09:07:31AM +0100, Johannes Berg wrote:
> > On Mon, 2016-03-07 at 21:53 +0530, Mohammed Shafi Shajakhan wrote:
> > > 
> > > +#define IEEE80211_HT_MCS_NUM 32
> > > +#define IEEE80211_VHT_MCS_NUM10
> > > +#define IEEE80211_BW_NUM 4
> > > +#define IEEE80211_NSS_NUM4
> > > +#define IEEE80211_GI_NUM 2
> > > +#define IEEE80211_RATE_TABLE_NUM 320
> > > +#define IEEE80211_LEGACY_RATE_NUM12
> > 
> > > +#ifdef CONFIG_MAC80211_DEBUG_PER_STA_RX_STATS
> > > + u64 rx_legacy_pkt[IEEE80211_LEGACY_RATE_NUM];
> > > + u64 rx_ht_pkt[IEEE80211_HT_MCS_NUM];
> > > + u64 rx_vht_pkt[IEEE80211_VHT_MCS_NUM];
> > > + u64 rx_bw_pkt[IEEE80211_BW_NUM];
> > > + u64 rx_nss_pkt[IEEE80211_NSS_NUM];
> > > + u64 rx_gi_pkt[IEEE80211_GI_NUM];
> > > + u64 rx_rate_pkt[IEEE80211_RATE_TABLE_NUM];
> > > + u64 rx_legacy_byte[IEEE80211_LEGACY_RATE_NUM];
> > > + u64 rx_ht_byte[IEEE80211_HT_MCS_NUM];
> > > + u64 rx_vht_byte[IEEE80211_VHT_MCS_NUM];
> > > + u64 rx_bw_byte[IEEE80211_BW_NUM];
> > > + u64 rx_nss_byte[IEEE80211_NSS_NUM];
> > > + u64 rx_gi_byte[IEEE80211_GI_NUM];
> > > + u64 rx_rate_byte[IEEE80211_RATE_TABLE_NUM];
> > > +#endif
> > 
> > Do you know how much data this is?!
> > 
> > Felix is going to kill both of us if I apply it.
> 
> [shafi] :-(
> 
> > 
> > Please look at reviving my rate-statistics patch and do the remaining
> > work in userspace:
> > 
> > http://thread.gmane.org/gmane.linux.kernel.wireless.general/133172
> >
> 
> [shafi] thank you, I will check this out.
> 
> regards,
> shafi
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC v1] mac80211: Add support for per station rx stats histogram

2016-03-08 Thread Mohammed Shafi Shajakhan
Hi Johannes,

On Tue, Mar 08, 2016 at 09:07:31AM +0100, Johannes Berg wrote:
> On Mon, 2016-03-07 at 21:53 +0530, Mohammed Shafi Shajakhan wrote:
> > 
> > +#define IEEE80211_HT_MCS_NUM   32
> > +#define IEEE80211_VHT_MCS_NUM  10
> > +#define IEEE80211_BW_NUM   4
> > +#define IEEE80211_NSS_NUM  4
> > +#define IEEE80211_GI_NUM   2
> > +#define IEEE80211_RATE_TABLE_NUM   320
> > +#define IEEE80211_LEGACY_RATE_NUM  12
> 
> > +#ifdef CONFIG_MAC80211_DEBUG_PER_STA_RX_STATS
> > +   u64 rx_legacy_pkt[IEEE80211_LEGACY_RATE_NUM];
> > +   u64 rx_ht_pkt[IEEE80211_HT_MCS_NUM];
> > +   u64 rx_vht_pkt[IEEE80211_VHT_MCS_NUM];
> > +   u64 rx_bw_pkt[IEEE80211_BW_NUM];
> > +   u64 rx_nss_pkt[IEEE80211_NSS_NUM];
> > +   u64 rx_gi_pkt[IEEE80211_GI_NUM];
> > +   u64 rx_rate_pkt[IEEE80211_RATE_TABLE_NUM];
> > +   u64 rx_legacy_byte[IEEE80211_LEGACY_RATE_NUM];
> > +   u64 rx_ht_byte[IEEE80211_HT_MCS_NUM];
> > +   u64 rx_vht_byte[IEEE80211_VHT_MCS_NUM];
> > +   u64 rx_bw_byte[IEEE80211_BW_NUM];
> > +   u64 rx_nss_byte[IEEE80211_NSS_NUM];
> > +   u64 rx_gi_byte[IEEE80211_GI_NUM];
> > +   u64 rx_rate_byte[IEEE80211_RATE_TABLE_NUM];
> > +#endif
> 
> Do you know how much data this is?!
> 
> Felix is going to kill both of us if I apply it.

[shafi] :-(

> 
> Please look at reviving my rate-statistics patch and do the remaining
> work in userspace:
> 
> http://thread.gmane.org/gmane.linux.kernel.wireless.general/133172
>

[shafi] thank you, I will check this out.

regards,
shafi
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC v1] mac80211: Add support for per station rx stats histogram

2016-03-08 Thread Johannes Berg
On Mon, 2016-03-07 at 21:53 +0530, Mohammed Shafi Shajakhan wrote:
> 
> +#define IEEE80211_HT_MCS_NUM 32
> +#define IEEE80211_VHT_MCS_NUM10
> +#define IEEE80211_BW_NUM 4
> +#define IEEE80211_NSS_NUM4
> +#define IEEE80211_GI_NUM 2
> +#define IEEE80211_RATE_TABLE_NUM 320
> +#define IEEE80211_LEGACY_RATE_NUM12

> +#ifdef CONFIG_MAC80211_DEBUG_PER_STA_RX_STATS
> + u64 rx_legacy_pkt[IEEE80211_LEGACY_RATE_NUM];
> + u64 rx_ht_pkt[IEEE80211_HT_MCS_NUM];
> + u64 rx_vht_pkt[IEEE80211_VHT_MCS_NUM];
> + u64 rx_bw_pkt[IEEE80211_BW_NUM];
> + u64 rx_nss_pkt[IEEE80211_NSS_NUM];
> + u64 rx_gi_pkt[IEEE80211_GI_NUM];
> + u64 rx_rate_pkt[IEEE80211_RATE_TABLE_NUM];
> + u64 rx_legacy_byte[IEEE80211_LEGACY_RATE_NUM];
> + u64 rx_ht_byte[IEEE80211_HT_MCS_NUM];
> + u64 rx_vht_byte[IEEE80211_VHT_MCS_NUM];
> + u64 rx_bw_byte[IEEE80211_BW_NUM];
> + u64 rx_nss_byte[IEEE80211_NSS_NUM];
> + u64 rx_gi_byte[IEEE80211_GI_NUM];
> + u64 rx_rate_byte[IEEE80211_RATE_TABLE_NUM];
> +#endif

Do you know how much data this is?!

Felix is going to kill both of us if I apply it.

Please look at reviving my rate-statistics patch and do the remaining
work in userspace:

http://thread.gmane.org/gmane.linux.kernel.wireless.general/133172

johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC v1] mac80211: Add support for per station rx stats histogram

2016-03-07 Thread Mohammed Shafi Shajakhan
Hi Johannes and all,

kindly share your thoughts regarding the draft change
(I can share the test results as well and sample dump).

This is an implementation of Rx statistics (histogram
for each of the clients connected under mac80211 station
debugfs).

Attached is a sample dump, tested in Openwrt distribution

regards,
shafi


On Mon, Mar 07, 2016 at 09:53:29PM +0530, Mohammed Shafi Shajakhan wrote:
> From: Mohammed Shafi Shajakhan 
> 
> Enable a provision in mac80211 'MAC80211_DEBUG_PER_STA_RX_STATS'
> to keep track and dump per station stats.
> 
> Dump rx pkts / bytes per {MCS, BW, NSS, GI} per station
> in histogram format. Rx stats provides a history
> of the receive stats of the stations connected to us.
> Information such as how consistently we received the packet
> in higher MCS index / Bandwidth is very useful to assess the
> performance of us(AP) and the connected clients
> 
> By default this feature is disabled though there is no impact
> in performance (based on our test results)
> 
> This change is based on the design of Yanbo Li and HT packet
> rate table fix by Anil
> 
> Signed-off-by: Mohammed Shafi Shajakhan 
> Signed-off-by: Anilkumar Kolli 
> ---
>  net/mac80211/Kconfig   |   12 +++
>  net/mac80211/debugfs_sta.c |  225 
> 
>  net/mac80211/debugfs_sta.h |5 +
>  net/mac80211/rx.c  |2 +
>  net/mac80211/sta_info.h|   23 +
>  5 files changed, 267 insertions(+)
> 
> diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig
> index 3891cbd..89fb17c 100644
> --- a/net/mac80211/Kconfig
> +++ b/net/mac80211/Kconfig
> @@ -309,6 +309,18 @@ config MAC80211_DEBUG_COUNTERS
>  
> If unsure, say N.
>  
> +config MAC80211_DEBUG_PER_STA_RX_STATS
> + bool "Per Station Receive Stats Histogram"
> + depends on MAC80211_DEBUG_MENU
> + depends on MAC80211_DEBUGFS
> + ---help---
> +   Selecting this option causes mac80211 to keep track of
> +   per station received packets, classify them based
> +   on Bandwidth, Rate index (legacy, HT, VHT) and dump
> +   a histogram of the same
> +
> +   If unsure, say N.
> +
>  config MAC80211_STA_HASH_MAX_SIZE
>   int "Station hash table maximum size" if MAC80211_DEBUG_MENU
>   default 0
> diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
> index a39512f..ed095f3 100644
> --- a/net/mac80211/debugfs_sta.c
> +++ b/net/mac80211/debugfs_sta.c
> @@ -289,6 +289,130 @@ static ssize_t sta_ht_capa_read(struct file *file, char 
> __user *userbuf,
>  }
>  STA_OPS(ht_capa);
>  
> +static ssize_t sta_rx_stats_read(struct file *file, char __user *userbuf,
> +  size_t count, loff_t *ppos)
> +{
> +#ifdef CONFIG_MAC80211_DEBUG_PER_STA_RX_STATS
> +#define RX_STATS_HIST_FMT(n) \
> + do { \
> + if ((i + 1) % n == 0) \
> + len += scnprintf(buf + len, size - len, "\n\t\t"); \
> + } while (0)
> + int retval = 0, len = 0;
> + char *buf;
> + const int size = 3072;
> + struct sta_info *sta = file->private_data;
> + struct ieee80211_local *local = sta->local;
> + int i;
> + char *bw_str[IEEE80211_BW_NUM] = {"20", "40", "80", "160"};
> + char *nss_str[IEEE80211_NSS_NUM] = {"1x1", "2x2", "3x3", "4x4"};
> + char *gi_str[IEEE80211_GI_NUM] = {"LGI", "SGI"};
> + char *legacy_str[IEEE80211_LEGACY_RATE_NUM] = {"1", "2", "5.5",
> +"11", "6", "9",
> +"12", "18", "24",
> +"36", "48", "54"};
> + buf = kzalloc(size, GFP_KERNEL);
> + if (!buf)
> + return -ENOMEM;
> +
> + len += scnprintf(buf + len, size - len, "VHT MCS packets: ");
> + for (i = 0; i < IEEE80211_VHT_MCS_NUM; i++) {
> + len += scnprintf(buf + len, size - len, "MCS %d: %llu, ",
> +  i, sta->rx_vht_pkt[i]);
> + RX_STATS_HIST_FMT(5);
> + }
> +
> + len += scnprintf(buf + len, size - len, "\nHT MCS packets: ");
> + for (i = 0; i < IEEE80211_HT_MCS_NUM; i++) {
> + len += scnprintf(buf + len, size - len, "MCS %d: %llu, ",
> +  i, sta->rx_ht_pkt[i]);
> + RX_STATS_HIST_FMT(5);
> + }
> +
> + len += scnprintf(buf + len, size - len, "\n\nBW packets: ");
> + for (i = 0; i < IEEE80211_BW_NUM; i++)
> + len += scnprintf(buf + len, size - len, "\t%sMhz: %llu",
> +  bw_str[i], sta->rx_bw_pkt[i]);
> +
> + len += scnprintf(buf + len, size - len, "\n\nNSS packets: ");
> + for (i = 0; i < IEEE80211_NSS_NUM; i++)
> + len += scnprintf(buf + len, size - len, "\t%s: %llu",
> +  nss_str[i], sta->rx_nss_pkt[i]);
> +
> + len += scnprintf(buf + len, size - len, "\n\nGI packets: ");
> + for (i = 0; i < IEEE80211_GI_NUM; i++)
> +   

[RFC v1] mac80211: Add support for per station rx stats histogram

2016-03-07 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan 

Enable a provision in mac80211 'MAC80211_DEBUG_PER_STA_RX_STATS'
to keep track and dump per station stats.

Dump rx pkts / bytes per {MCS, BW, NSS, GI} per station
in histogram format. Rx stats provides a history
of the receive stats of the stations connected to us.
Information such as how consistently we received the packet
in higher MCS index / Bandwidth is very useful to assess the
performance of us(AP) and the connected clients

By default this feature is disabled though there is no impact
in performance (based on our test results)

This change is based on the design of Yanbo Li and HT packet
rate table fix by Anil

Signed-off-by: Mohammed Shafi Shajakhan 
Signed-off-by: Anilkumar Kolli 
---
 net/mac80211/Kconfig   |   12 +++
 net/mac80211/debugfs_sta.c |  225 
 net/mac80211/debugfs_sta.h |5 +
 net/mac80211/rx.c  |2 +
 net/mac80211/sta_info.h|   23 +
 5 files changed, 267 insertions(+)

diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig
index 3891cbd..89fb17c 100644
--- a/net/mac80211/Kconfig
+++ b/net/mac80211/Kconfig
@@ -309,6 +309,18 @@ config MAC80211_DEBUG_COUNTERS
 
  If unsure, say N.
 
+config MAC80211_DEBUG_PER_STA_RX_STATS
+   bool "Per Station Receive Stats Histogram"
+   depends on MAC80211_DEBUG_MENU
+   depends on MAC80211_DEBUGFS
+   ---help---
+ Selecting this option causes mac80211 to keep track of
+ per station received packets, classify them based
+ on Bandwidth, Rate index (legacy, HT, VHT) and dump
+ a histogram of the same
+
+ If unsure, say N.
+
 config MAC80211_STA_HASH_MAX_SIZE
int "Station hash table maximum size" if MAC80211_DEBUG_MENU
default 0
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index a39512f..ed095f3 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -289,6 +289,130 @@ static ssize_t sta_ht_capa_read(struct file *file, char 
__user *userbuf,
 }
 STA_OPS(ht_capa);
 
+static ssize_t sta_rx_stats_read(struct file *file, char __user *userbuf,
+size_t count, loff_t *ppos)
+{
+#ifdef CONFIG_MAC80211_DEBUG_PER_STA_RX_STATS
+#define RX_STATS_HIST_FMT(n) \
+   do { \
+   if ((i + 1) % n == 0) \
+   len += scnprintf(buf + len, size - len, "\n\t\t"); \
+   } while (0)
+   int retval = 0, len = 0;
+   char *buf;
+   const int size = 3072;
+   struct sta_info *sta = file->private_data;
+   struct ieee80211_local *local = sta->local;
+   int i;
+   char *bw_str[IEEE80211_BW_NUM] = {"20", "40", "80", "160"};
+   char *nss_str[IEEE80211_NSS_NUM] = {"1x1", "2x2", "3x3", "4x4"};
+   char *gi_str[IEEE80211_GI_NUM] = {"LGI", "SGI"};
+   char *legacy_str[IEEE80211_LEGACY_RATE_NUM] = {"1", "2", "5.5",
+  "11", "6", "9",
+  "12", "18", "24",
+  "36", "48", "54"};
+   buf = kzalloc(size, GFP_KERNEL);
+   if (!buf)
+   return -ENOMEM;
+
+   len += scnprintf(buf + len, size - len, "VHT MCS packets: ");
+   for (i = 0; i < IEEE80211_VHT_MCS_NUM; i++) {
+   len += scnprintf(buf + len, size - len, "MCS %d: %llu, ",
+i, sta->rx_vht_pkt[i]);
+   RX_STATS_HIST_FMT(5);
+   }
+
+   len += scnprintf(buf + len, size - len, "\nHT MCS packets: ");
+   for (i = 0; i < IEEE80211_HT_MCS_NUM; i++) {
+   len += scnprintf(buf + len, size - len, "MCS %d: %llu, ",
+i, sta->rx_ht_pkt[i]);
+   RX_STATS_HIST_FMT(5);
+   }
+
+   len += scnprintf(buf + len, size - len, "\n\nBW packets: ");
+   for (i = 0; i < IEEE80211_BW_NUM; i++)
+   len += scnprintf(buf + len, size - len, "\t%sMhz: %llu",
+bw_str[i], sta->rx_bw_pkt[i]);
+
+   len += scnprintf(buf + len, size - len, "\n\nNSS packets: ");
+   for (i = 0; i < IEEE80211_NSS_NUM; i++)
+   len += scnprintf(buf + len, size - len, "\t%s: %llu",
+nss_str[i], sta->rx_nss_pkt[i]);
+
+   len += scnprintf(buf + len, size - len, "\n\nGI packets: ");
+   for (i = 0; i < IEEE80211_GI_NUM; i++)
+   len += scnprintf(buf + len, size - len, "\t%s: %llu",
+gi_str[i], sta->rx_gi_pkt[i]);
+
+   len += scnprintf(buf + len, size - len, "\n\nLegacy rate packets: ");
+   for (i = 0; i < IEEE80211_LEGACY_RATE_NUM; i++) {
+   len += scnprintf(buf + len, size - len, "\t%sMbps: %llu",
+legacy_str[i], sta->rx_legacy_pkt[i]);
+   RX_STATS_HIST_FMT(4);
+   }
+
+   len += scnprintf(buf + len, size - len, "\nRate table pa