[PATCH v3 2/2] ath10k: fix CCK h/w rates for QCA99X0 and newer chipsets

2016-06-02 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

CCK hardware table mapping from QCA99X0 onwards got revised.
The CCK hardware rate values are in a proper order wrt. to
rate and preamble as below

ATH10K_HW_RATE_REV2_CCK_LP_1M = 1,
ATH10K_HW_RATE_REV2_CCK_LP_2M = 2,
ATH10K_HW_RATE_REV2_CCK_LP_5_5M = 3,
ATH10K_HW_RATE_REV2_CCK_LP_11M = 4,
ATH10K_HW_RATE_REV2_CCK_SP_2M = 5,
ATH10K_HW_RATE_REV2_CCK_SP_5_5M = 6,
ATH10K_HW_RATE_REV2_CCK_SP_11M = 7,

This results in reporting of rx frames (with CCK rates)
totally wrong for QCA99X0, QCA4019. Fix this by having
separate CCK rate table for these chipsets with rev2 suffix
and registering the correct rate mapping to mac80211 based on
the new hw_param (introduced) 'cck_rate_map_rev2' which shall
be true for any newchipsets from QCA99X0 onwards

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
[v2: Enabled the fix for QCA9984 - thanks Kalle]
[v3: removed patch id]

 drivers/net/wireless/ath/ath10k/core.c |3 +++
 drivers/net/wireless/ath/ath10k/core.h |6 +
 drivers/net/wireless/ath/ath10k/hw.h   |   10 
 drivers/net/wireless/ath/ath10k/mac.c  |   39 ++--
 4 files changed, 56 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index a003980..2692243 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -148,6 +148,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.uart_pin = 7,
.otp_exe_param = 0x0700,
.continuous_frag_desc = true,
+   .cck_rate_map_rev2 = true,
.channel_counters_freq_hz = 15,
.max_probe_resp_desc_thres = 24,
.hw_4addr_pad = ATH10K_HW_4ADDR_PAD_BEFORE,
@@ -170,6 +171,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.uart_pin = 7,
.otp_exe_param = 0x0700,
.continuous_frag_desc = true,
+   .cck_rate_map_rev2 = true,
.channel_counters_freq_hz = 15,
.max_probe_resp_desc_thres = 24,
.hw_4addr_pad = ATH10K_HW_4ADDR_PAD_BEFORE,
@@ -227,6 +229,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.has_shifted_cc_wraparound = true,
.otp_exe_param = 0x001,
.continuous_frag_desc = true,
+   .cck_rate_map_rev2 = true,
.channel_counters_freq_hz = 125000,
.max_probe_resp_desc_thres = 24,
.hw_4addr_pad = ATH10K_HW_4ADDR_PAD_BEFORE,
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 1852e0e..04cea23 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -716,6 +716,12 @@ struct ath10k {
 */
bool continuous_frag_desc;
 
+   /* CCK hardware rate table mapping for the newer chipsets
+* like QCA99X0, QCA4019 got revised. The CCK h/w rate values
+* are in a proper order with respect to the rate/preamble
+*/
+   bool cck_rate_map_rev2;
+
u32 channel_counters_freq_hz;
 
/* Mgmt tx descriptors threshold for limiting probe response
diff --git a/drivers/net/wireless/ath/ath10k/hw.h 
b/drivers/net/wireless/ath/ath10k/hw.h
index f41c91c..4ed5be9 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -326,6 +326,16 @@ enum ath10k_hw_rate_cck {
ATH10K_HW_RATE_CCK_SP_2M,
 };
 
+enum ath10k_hw_rate_rev2_cck {
+   ATH10K_HW_RATE_REV2_CCK_LP_1M = 1,
+   ATH10K_HW_RATE_REV2_CCK_LP_2M,
+   ATH10K_HW_RATE_REV2_CCK_LP_5_5M,
+   ATH10K_HW_RATE_REV2_CCK_LP_11M,
+   ATH10K_HW_RATE_REV2_CCK_SP_2M,
+   ATH10K_HW_RATE_REV2_CCK_SP_5_5M,
+   ATH10K_HW_RATE_REV2_CCK_SP_11M,
+};
+
 enum ath10k_hw_4addr_pad {
ATH10K_HW_4ADDR_PAD_AFTER,
ATH10K_HW_4ADDR_PAD_BEFORE,
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 1dd415d..e7162db 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -62,6 +62,32 @@ static struct ieee80211_rate ath10k_rates[] = {
{ .bitrate = 540, .hw_value = ATH10K_HW_RATE_OFDM_54M },
 };
 
+static struct ieee80211_rate ath10k_rates_rev2[] = {
+   { .bitrate = 10,
+ .hw_value = ATH10K_HW_RATE_REV2_CCK_LP_1M },
+   { .bitrate = 20,
+ .hw_value = ATH10K_HW_RATE_REV2_CCK_LP_2M,
+ .hw_value_short = ATH10K_HW_RATE_REV2_CCK_SP_2M,
+ .flags = IEEE80211_RATE_SHORT_PREAMBLE },
+   { .bitrate = 55,
+ .hw_value = ATH10K_HW_RATE_REV2_CCK_LP_5_5M,
+ .hw_value_short = ATH10K_HW_RATE_REV2_CCK_SP_5_5M,
+   

[PATCH v2 2/2] ath10k: fix CCK h/w rates for QCA99X0 and newer chipsets

2016-06-02 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

CCK hardware table mapping from QCA99X0 onwards got revised.
The CCK hardware rate values are in a proper order wrt. to
rate and preamble as below

ATH10K_HW_RATE_REV2_CCK_LP_1M = 1,
ATH10K_HW_RATE_REV2_CCK_LP_2M = 2,
ATH10K_HW_RATE_REV2_CCK_LP_5_5M = 3,
ATH10K_HW_RATE_REV2_CCK_LP_11M = 4,
ATH10K_HW_RATE_REV2_CCK_SP_2M = 5,
ATH10K_HW_RATE_REV2_CCK_SP_5_5M = 6,
ATH10K_HW_RATE_REV2_CCK_SP_11M = 7,

This results in reporting of rx frames (with CCK rates)
totally wrong for QCA99X0, QCA4019. Fix this by having
separate CCK rate table for these chipsets with rev2 suffix
and registering the correct rate mapping to mac80211 based on
the new hw_param (introduced) 'cck_rate_map_rev2' which shall
be true for any newchipsets from QCA99X0 onwards

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
[v2: Enabled the fix for QCA9984 - thanks Kalle]

 drivers/net/wireless/ath/ath10k/core.c |3 +++
 drivers/net/wireless/ath/ath10k/core.h |6 +
 drivers/net/wireless/ath/ath10k/hw.h   |   10 
 drivers/net/wireless/ath/ath10k/mac.c  |   39 ++--
 4 files changed, 56 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index a003980..2692243 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -148,6 +148,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.uart_pin = 7,
.otp_exe_param = 0x0700,
.continuous_frag_desc = true,
+   .cck_rate_map_rev2 = true,
.channel_counters_freq_hz = 15,
.max_probe_resp_desc_thres = 24,
.hw_4addr_pad = ATH10K_HW_4ADDR_PAD_BEFORE,
@@ -170,6 +171,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.uart_pin = 7,
.otp_exe_param = 0x0700,
.continuous_frag_desc = true,
+   .cck_rate_map_rev2 = true,
.channel_counters_freq_hz = 15,
.max_probe_resp_desc_thres = 24,
.hw_4addr_pad = ATH10K_HW_4ADDR_PAD_BEFORE,
@@ -227,6 +229,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.has_shifted_cc_wraparound = true,
.otp_exe_param = 0x001,
.continuous_frag_desc = true,
+   .cck_rate_map_rev2 = true,
.channel_counters_freq_hz = 125000,
.max_probe_resp_desc_thres = 24,
.hw_4addr_pad = ATH10K_HW_4ADDR_PAD_BEFORE,
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 1852e0e..04cea23 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -716,6 +716,12 @@ struct ath10k {
 */
bool continuous_frag_desc;
 
+   /* CCK hardware rate table mapping for the newer chipsets
+* like QCA99X0, QCA4019 got revised. The CCK h/w rate values
+* are in a proper order with respect to the rate/preamble
+*/
+   bool cck_rate_map_rev2;
+
u32 channel_counters_freq_hz;
 
/* Mgmt tx descriptors threshold for limiting probe response
diff --git a/drivers/net/wireless/ath/ath10k/hw.h 
b/drivers/net/wireless/ath/ath10k/hw.h
index f41c91c..4ed5be9 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -326,6 +326,16 @@ enum ath10k_hw_rate_cck {
ATH10K_HW_RATE_CCK_SP_2M,
 };
 
+enum ath10k_hw_rate_rev2_cck {
+   ATH10K_HW_RATE_REV2_CCK_LP_1M = 1,
+   ATH10K_HW_RATE_REV2_CCK_LP_2M,
+   ATH10K_HW_RATE_REV2_CCK_LP_5_5M,
+   ATH10K_HW_RATE_REV2_CCK_LP_11M,
+   ATH10K_HW_RATE_REV2_CCK_SP_2M,
+   ATH10K_HW_RATE_REV2_CCK_SP_5_5M,
+   ATH10K_HW_RATE_REV2_CCK_SP_11M,
+};
+
 enum ath10k_hw_4addr_pad {
ATH10K_HW_4ADDR_PAD_AFTER,
ATH10K_HW_4ADDR_PAD_BEFORE,
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 1dd415d..e7162db 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -62,6 +62,32 @@ static struct ieee80211_rate ath10k_rates[] = {
{ .bitrate = 540, .hw_value = ATH10K_HW_RATE_OFDM_54M },
 };
 
+static struct ieee80211_rate ath10k_rates_rev2[] = {
+   { .bitrate = 10,
+ .hw_value = ATH10K_HW_RATE_REV2_CCK_LP_1M },
+   { .bitrate = 20,
+ .hw_value = ATH10K_HW_RATE_REV2_CCK_LP_2M,
+ .hw_value_short = ATH10K_HW_RATE_REV2_CCK_SP_2M,
+ .flags = IEEE80211_RATE_SHORT_PREAMBLE },
+   { .bitrate = 55,
+ .hw_value = ATH10K_HW_RATE_REV2_CCK_LP_5_5M,
+ .hw_value_short = ATH10K_HW_RATE_REV2_CCK_SP_5_5M,
+ .flags = IEEE80211_RATE_SH

[PATCH v2 1/2] ath10k: remove duplicate and unused rx rate flags

2016-06-02 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

All these flags are not used and their use is completely
covered by 'ath10k_hw_rate_ofdm', 'ath10k_hw_rate_cck',
and RX_PPDU_START_RATE_FLAG

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
Patchwork-Id: 9129361
Signed-off-by: Kalle Valo <kv...@qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/rx_desc.h |   39 -
 1 file changed, 39 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/rx_desc.h 
b/drivers/net/wireless/ath/ath10k/rx_desc.h
index 9ceebea..034e7a5 100644
--- a/drivers/net/wireless/ath/ath10k/rx_desc.h
+++ b/drivers/net/wireless/ath/ath10k/rx_desc.h
@@ -656,26 +656,6 @@ struct rx_msdu_end {
  * Reserved: HW should fill with zero.  FW should ignore.
  */
 
-#define RX_PPDU_START_SIG_RATE_SELECT_OFDM 0
-#define RX_PPDU_START_SIG_RATE_SELECT_CCK  1
-
-#define RX_PPDU_START_SIG_RATE_OFDM_48 0
-#define RX_PPDU_START_SIG_RATE_OFDM_24 1
-#define RX_PPDU_START_SIG_RATE_OFDM_12 2
-#define RX_PPDU_START_SIG_RATE_OFDM_6  3
-#define RX_PPDU_START_SIG_RATE_OFDM_54 4
-#define RX_PPDU_START_SIG_RATE_OFDM_36 5
-#define RX_PPDU_START_SIG_RATE_OFDM_18 6
-#define RX_PPDU_START_SIG_RATE_OFDM_9  7
-
-#define RX_PPDU_START_SIG_RATE_CCK_LP_11  0
-#define RX_PPDU_START_SIG_RATE_CCK_LP_5_5 1
-#define RX_PPDU_START_SIG_RATE_CCK_LP_2   2
-#define RX_PPDU_START_SIG_RATE_CCK_LP_1   3
-#define RX_PPDU_START_SIG_RATE_CCK_SP_11  4
-#define RX_PPDU_START_SIG_RATE_CCK_SP_5_5 5
-#define RX_PPDU_START_SIG_RATE_CCK_SP_2   6
-
 #define HTT_RX_PPDU_START_PREAMBLE_LEGACY0x04
 #define HTT_RX_PPDU_START_PREAMBLE_HT0x08
 #define HTT_RX_PPDU_START_PREAMBLE_HT_WITH_TXBF  0x09
@@ -711,25 +691,6 @@ struct rx_msdu_end {
 /* No idea what this flag means. It seems to be always set in rate. */
 #define RX_PPDU_START_RATE_FLAG BIT(3)
 
-enum rx_ppdu_start_rate {
-   RX_PPDU_START_RATE_OFDM_48M = RX_PPDU_START_RATE_FLAG | 
ATH10K_HW_RATE_OFDM_48M,
-   RX_PPDU_START_RATE_OFDM_24M = RX_PPDU_START_RATE_FLAG | 
ATH10K_HW_RATE_OFDM_24M,
-   RX_PPDU_START_RATE_OFDM_12M = RX_PPDU_START_RATE_FLAG | 
ATH10K_HW_RATE_OFDM_12M,
-   RX_PPDU_START_RATE_OFDM_6M  = RX_PPDU_START_RATE_FLAG | 
ATH10K_HW_RATE_OFDM_6M,
-   RX_PPDU_START_RATE_OFDM_54M = RX_PPDU_START_RATE_FLAG | 
ATH10K_HW_RATE_OFDM_54M,
-   RX_PPDU_START_RATE_OFDM_36M = RX_PPDU_START_RATE_FLAG | 
ATH10K_HW_RATE_OFDM_36M,
-   RX_PPDU_START_RATE_OFDM_18M = RX_PPDU_START_RATE_FLAG | 
ATH10K_HW_RATE_OFDM_18M,
-   RX_PPDU_START_RATE_OFDM_9M  = RX_PPDU_START_RATE_FLAG | 
ATH10K_HW_RATE_OFDM_9M,
-
-   RX_PPDU_START_RATE_CCK_LP_11M  = RX_PPDU_START_RATE_FLAG | 
ATH10K_HW_RATE_CCK_LP_11M,
-   RX_PPDU_START_RATE_CCK_LP_5_5M = RX_PPDU_START_RATE_FLAG | 
ATH10K_HW_RATE_CCK_LP_5_5M,
-   RX_PPDU_START_RATE_CCK_LP_2M   = RX_PPDU_START_RATE_FLAG | 
ATH10K_HW_RATE_CCK_LP_2M,
-   RX_PPDU_START_RATE_CCK_LP_1M   = RX_PPDU_START_RATE_FLAG | 
ATH10K_HW_RATE_CCK_LP_1M,
-   RX_PPDU_START_RATE_CCK_SP_11M  = RX_PPDU_START_RATE_FLAG | 
ATH10K_HW_RATE_CCK_SP_11M,
-   RX_PPDU_START_RATE_CCK_SP_5_5M = RX_PPDU_START_RATE_FLAG | 
ATH10K_HW_RATE_CCK_SP_5_5M,
-   RX_PPDU_START_RATE_CCK_SP_2M   = RX_PPDU_START_RATE_FLAG | 
ATH10K_HW_RATE_CCK_SP_2M,
-};
-
 struct rx_ppdu_start {
struct {
u8 pri20_mhz;
-- 
1.7.9.5

--
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


[PATCH v3] ath10k: Fix 10.4 extended peer stats update

2016-06-02 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

10.4 'extended peer stats' will be not be appended with normal peer stats
data and they shall be coming in separate chunks. Fix this by maintaining
a separate linked list 'extender peer stats' for 10.4 and update
rx_duration for per station statistics. Also parse through beacon filter
(if enabled), to make sure we parse the extended peer stats properly.
This issue was exposed when more than one client is connected and
extended peer stats for 10.4 is enabled

The order for the stats is as below
S - standard peer stats, E- extended peer stats, B - beacon filter stats

{S1, S2, S3..} -> {B1, B2, B3..}(if available) -> {E1, E2, E3..}

Fixes: f9575793d44c ("ath10k: enable parsing per station rx duration for 10.4")
Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
[v1: addressed line wrap around comment from Kalle]
[v2: fixed ; in dummy inline function definition - thanks Sven Eckelmann]
[v3: removed wmi-op-version suggested by Kalle, introduced fw specifi hw param 
for extd_stats]

 drivers/net/wireless/ath/ath10k/core.c|3 ++
 drivers/net/wireless/ath/ath10k/core.h|9 +
 drivers/net/wireless/ath/ath10k/debug.c   |   18 -
 drivers/net/wireless/ath/ath10k/debug.h   |8 ++--
 drivers/net/wireless/ath/ath10k/debugfs_sta.c |   32 ++-
 drivers/net/wireless/ath/ath10k/wmi.c |   53 ++---
 drivers/net/wireless/ath/ath10k/wmi.h |   14 ++-
 7 files changed, 117 insertions(+), 20 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 9ccb69c..bfa96ac 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -181,6 +181,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.board = QCA99X0_HW_2_0_BOARD_DATA_FILE,
.board_size = QCA99X0_BOARD_DATA_SZ,
.board_ext_size = QCA99X0_BOARD_EXT_DATA_SZ,
+   .extd_peer_stats = true,
},
},
{
@@ -203,6 +204,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.board = QCA9984_HW_1_0_BOARD_DATA_FILE,
.board_size = QCA99X0_BOARD_DATA_SZ,
.board_ext_size = QCA99X0_BOARD_EXT_DATA_SZ,
+   .extd_peer_stats = true,
},
},
{
@@ -261,6 +263,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.board = QCA4019_HW_1_0_BOARD_DATA_FILE,
.board_size = QCA4019_BOARD_DATA_SZ,
.board_ext_size = QCA4019_BOARD_EXT_DATA_SZ,
+   .extd_peer_stats = true,
},
},
 };
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index bbc4e0f..da9b2a9 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -165,6 +165,13 @@ struct ath10k_fw_stats_peer {
u32 rx_duration;
 };
 
+struct ath10k_fw_extd_stats_peer {
+   struct list_head list;
+
+   u8 peer_macaddr[ETH_ALEN];
+   u32 rx_duration;
+};
+
 struct ath10k_fw_stats_vdev {
struct list_head list;
 
@@ -259,6 +266,7 @@ struct ath10k_fw_stats {
struct list_head pdevs;
struct list_head vdevs;
struct list_head peers;
+   struct list_head peers_extd;
 };
 
 #define ATH10K_TPC_TABLE_TYPE_FLAG 1
@@ -752,6 +760,7 @@ struct ath10k {
const char *board;
size_t board_size;
size_t board_ext_size;
+   bool extd_peer_stats;
} fw;
} hw_params;
 
diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index 8fbb8f2..001c0a1 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -313,6 +313,16 @@ static void ath10k_fw_stats_peers_free(struct list_head 
*head)
}
 }
 
+static void ath10k_fw_extd_stats_peers_free(struct list_head *head)
+{
+   struct ath10k_fw_extd_stats_peer *i, *tmp;
+
+   list_for_each_entry_safe(i, tmp, head, list) {
+   list_del(>list);
+   kfree(i);
+   }
+}
+
 static void ath10k_debug_fw_stats_reset(struct ath10k *ar)
 {
spin_lock_bh(>data_lock);
@@ -320,6 +330,7 @@ static void ath10k_debug_fw_stats_reset(struct ath10k *ar)
ath10k_fw_stats_pdevs_free(>debug.fw_stats.pdevs);
ath10k_fw_stats_vdevs_free(>debug.fw_stats.vdevs);
ath10k_fw_stats_peers_free(>debug.fw_stats.peers);
+   ath10k_fw_extd_stats_peers_free(>debug.fw_stats.peers_extd);
spin_unlock_bh(>data_lock);
 }
 
@@ -334,6 +345,7 @@ void ath10k_

Re: [PATCH v2] ath10k: Fix 10.4 extended peer stats update

2016-06-01 Thread Mohammed Shafi Shajakhan
On Wed, Jun 01, 2016 at 01:00:40PM +, Valo, Kalle wrote:
> Mohammed Shafi Shajakhan <moham...@codeaurora.org> writes:
> 
> > Hello,
> >
> > On Tue, May 31, 2016 at 06:57:52PM +, Valo, Kalle wrote:
> >> Mohammed Shafi Shajakhan <moham...@codeaurora.org> writes:
> >> 
> >> >> > +void ath10k_sta_update_rx_duration(struct ath10k *ar,
> >> >> > +struct ath10k_fw_stats *stats)
> >> >> > +{
> >> >> > + struct ath10k_fw_file *fw_file = >normal_mode_fw.fw_file;
> >> >> > +
> >> >> > + if (fw_file->wmi_op_version < ATH10K_FW_WMI_OP_VERSION_10_4)
> >> >> > + ath10k_sta_update_stats_rx_duration(ar, >peers);
> >> >> > + else
> >> >> > + ath10k_sta_update_extd_stats_rx_duration(ar,
> >> >> > +  
> >> >> > >peers_extd);
> >> >> > +}
> >> >> 
> >> >> _Ideally_ wmi_op_version should be used only in ath10k_wmi_attach() and
> >> >> nowhere else. Isn't there any other way to detect this scenario? For
> >> >> example, what if you store stats_id to struct ath10k_fw_stats and do
> >> >> something like this:
> >> >> 
> >> >> if (stats->stats_id & WMI_10_4_STAT_PEER_EXTD)
> >> >> ath10k_sta_update_extd_stats_rx_duration(ar,
> >> >>  >peers_extd);
> >> >> else
> >> >> ath10k_sta_update_stats_rx_duration(ar, >peers);
> >> >> 
> >> >> Would that work?
> >> >
> >> > [shafi] I am also thinking to re-use (ar->fw_stats_req_mask & 
> >> > WMI_10_4_STAT_PEER_EXTD)
> >> > it might work, but will it conflict vdev stats WMI_STAT_VDEV (though its 
> >> > not currently
> >> > supported for 10.2 )
> >> 
> >> Can you describe more how they conflict?
> >
> > [shafi] 'WMI_STAT_VDEV' and 'WMI_10_4_STAT_PEER_EXTD' are having the same 
> > value
> > BIT(3), though as of now we are only 'WMI_10_4_STAT_PEER_EXTD' for 10.4
> 
> Ah. But that's easy to solve, for example you could use a bool instead.
>
[shafi] sure thanks will do the same, i had a similar change in my mind as well
!
--
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: [PATCH v2] ath10k: Fix 10.4 extended peer stats update

2016-06-01 Thread Mohammed Shafi Shajakhan
Hello,

On Tue, May 31, 2016 at 06:57:52PM +, Valo, Kalle wrote:
> Mohammed Shafi Shajakhan <moham...@codeaurora.org> writes:
> 
> >> > +void ath10k_sta_update_rx_duration(struct ath10k *ar,
> >> > +   struct ath10k_fw_stats *stats)
> >> > +{
> >> > +struct ath10k_fw_file *fw_file = >normal_mode_fw.fw_file;
> >> > +
> >> > +if (fw_file->wmi_op_version < ATH10K_FW_WMI_OP_VERSION_10_4)
> >> > +ath10k_sta_update_stats_rx_duration(ar, >peers);
> >> > +else
> >> > +ath10k_sta_update_extd_stats_rx_duration(ar,
> >> > + 
> >> > >peers_extd);
> >> > +}
> >> 
> >> _Ideally_ wmi_op_version should be used only in ath10k_wmi_attach() and
> >> nowhere else. Isn't there any other way to detect this scenario? For
> >> example, what if you store stats_id to struct ath10k_fw_stats and do
> >> something like this:
> >> 
> >> if (stats->stats_id & WMI_10_4_STAT_PEER_EXTD)
> >>ath10k_sta_update_extd_stats_rx_duration(ar,
> >> >peers_extd);
> >> else
> >>ath10k_sta_update_stats_rx_duration(ar, >peers);
> >> 
> >> Would that work?
> >
> > [shafi] I am also thinking to re-use (ar->fw_stats_req_mask & 
> > WMI_10_4_STAT_PEER_EXTD)
> > it might work, but will it conflict vdev stats WMI_STAT_VDEV (though its 
> > not currently
> > supported for 10.2 )
> 
> Can you describe more how they conflict?

[shafi] 'WMI_STAT_VDEV' and 'WMI_10_4_STAT_PEER_EXTD' are having the same value
BIT(3), though as of now we are only 'WMI_10_4_STAT_PEER_EXTD' for 10.4

> 
> > let me know your thoughts about this, seems extended stats was
> > implemented for 10.4 wmi version so i made it explicit
> 
> I don't like hard coding features like this based on wmi_op_version as
> that might create problems managing the firmware interfaces in the
> future. The simplest is if we can automatically runtime detect if
> firmware uses the extended version or not.
>
[shafi] Sure i come up with something else to address this in v3.

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: [PATCH v2] ath10k: Fix 10.4 extended peer stats update

2016-05-31 Thread Mohammed Shafi Shajakhan
Hi Kalle,

thanks for the review


On Tue, May 31, 2016 at 12:18:49PM +, Valo, Kalle wrote:
> Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com> writes:
> 
> > From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
> >
> > 10.4 'extended peer stats' will be not be appended with normal peer stats
> > data and they shall be coming in separate chunks. Fix this by maintaining
> > a separate linked list 'extender peer stats' for 10.4 and update
> > rx_duration for per station statistics. Also parse through beacon filter
> > (if enabled), to make sure we parse the extended peer stats properly.
> > This issue was exposed when more than one client is connected and
> > extended peer stats for 10.4 is enabled
> >
> > The order for the stats is as below
> > S - standard peer stats, E- extended peer stats, B - beacon filter stats
> >
> > {S1, S2, S3..} -> {B1, B2, B3..}(if available) -> {E1, E2, E3..}
> >
> > Fixes: f9575793d44c ("ath10k: enable parsing per station rx duration for 
> > 10.4")
> > Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
> 
> [...]
> 
> > +void ath10k_sta_update_rx_duration(struct ath10k *ar,
> > +  struct ath10k_fw_stats *stats)
> > +{
> > +   struct ath10k_fw_file *fw_file = >normal_mode_fw.fw_file;
> > +
> > +   if (fw_file->wmi_op_version < ATH10K_FW_WMI_OP_VERSION_10_4)
> > +   ath10k_sta_update_stats_rx_duration(ar, >peers);
> > +   else
> > +   ath10k_sta_update_extd_stats_rx_duration(ar,
> > +>peers_extd);
> > +}
> 
> _Ideally_ wmi_op_version should be used only in ath10k_wmi_attach() and
> nowhere else. Isn't there any other way to detect this scenario? For
> example, what if you store stats_id to struct ath10k_fw_stats and do
> something like this:
> 
> if (stats->stats_id & WMI_10_4_STAT_PEER_EXTD)
>   ath10k_sta_update_extd_stats_rx_duration(ar,
>>peers_extd);
> else
>   ath10k_sta_update_stats_rx_duration(ar, >peers);
> 
> Would that work?

[shafi] I am also thinking to re-use (ar->fw_stats_req_mask & 
WMI_10_4_STAT_PEER_EXTD)
it might work, but will it conflict vdev stats WMI_STAT_VDEV (though its not 
currently
supported for 10.2 ) let me know your thoughts about this, seems extended stats
was implemented for 10.4 wmi version so i made it explicit

> 
> -- 
> Kalle Valo--
> 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: [PATCH v4] iw: Add support for NL80211_STA_INFO_RX_DURATION netlink attribute

2016-05-31 Thread Mohammed Shafi Shajakhan
On Tue, May 31, 2016 at 11:41:08AM +0200, Johannes Berg wrote:
> On Thu, 2016-04-07 at 20:00 +0530, Mohammed Shafi Shajakhan wrote:
> > From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
> > 
> > Add support for new netlink attribute 'NL80211_STA_INFO_RX_DURATION'.
> > 'NL80211_STA_INFO_RX_DURATION' accounts for aggregate PPDU duration
> > in microseconds for all the frames from a peer. Drivers can fill
> > 'rx_duration' field and set the flag 'NL80211_STA_INFO_RX_DURATION'.
> > 'rx_duration' will give an idea about the total time spent by our
> > peer
> > with each of its connected peers.
> > 
> > This will get dumped as part of 'iw dev wlan#N station dump'
> > 
> Applied.
> 
> It's easier for me if you don't send nl80211.h changes in iw patches,
> but I can deal with just removing those too.

[shafi] sure Johannes, next time i will sending nl80211.h changes

> 
> --
> 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: [PATCH v1] ath10k: Fix 10.4 extended peer stats update

2016-05-31 Thread Mohammed Shafi Shajakhan
Hi Kalle,

On Tue, May 31, 2016 at 11:09:38AM +, Valo, Kalle wrote:
> "Shajakhan, Mohammed Shafi (Mohammed Shafi)" 
> writes:
> > seems the change got merged in pending branch
> > https://git.kernel.org/cgit/linux/kernel/git/kvalo/ath.git/commit/?h=master-pending=2a872321e07506e339fc1b3ca81aa3e88628cd6e
> >
> > Request if you can send the patch to address this(incase the patch cannot 
> > be dropped)
> > and the v2 version cannot be picked
> 
> The pending branches (pending and pending-master) are just for build and
> runtime testing, they can be freely modified or dropped. v2 is now in
> pending branch and I'm looking at the patch right now.
>

[shafi] sure thanks for the clarification !

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: [PATCH v1] ath10k: Fix 10.4 extended peer stats update

2016-05-27 Thread Mohammed Shafi Shajakhan
On Fri, May 27, 2016 at 10:12:45AM +0200, Sven Eckelmann wrote:
> On Wednesday 11 May 2016 11:54:30 Mohammed Shafi Shajakhan wrote:
> >  #else
> > -static inline void ath10k_sta_update_rx_duration(struct ath10k *ar,
> > -struct list_head *peer)
> > +static inline
> > +void ath10k_sta_update_rx_duration(struct ath10k *ar,
> > +  struct ath10k_fw_stats *stats);
> >  {
> >  }
> 
> Please remove the ";" for the "static inline" version. I can also
> submit a patch in case patches in ath.git/pending cannot be dropped
> anymore.

[shafi] thanks a lot fixed it ! sorry for the typo, sent a v2 for
the same, kindly review the same.

> 
> Kind regards,
>   Sven


--
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


[PATCH v2] ath10k: Fix 10.4 extended peer stats update

2016-05-27 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

10.4 'extended peer stats' will be not be appended with normal peer stats
data and they shall be coming in separate chunks. Fix this by maintaining
a separate linked list 'extender peer stats' for 10.4 and update
rx_duration for per station statistics. Also parse through beacon filter
(if enabled), to make sure we parse the extended peer stats properly.
This issue was exposed when more than one client is connected and
extended peer stats for 10.4 is enabled

The order for the stats is as below
S - standard peer stats, E- extended peer stats, B - beacon filter stats

{S1, S2, S3..} -> {B1, B2, B3..}(if available) -> {E1, E2, E3..}

Fixes: f9575793d44c ("ath10k: enable parsing per station rx duration for 10.4")
Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---

[v1: Fixed line wrap around suggested by Kalle)

 drivers/net/wireless/ath/ath10k/core.h|8 
 drivers/net/wireless/ath/ath10k/debug.c   |   18 -
 drivers/net/wireless/ath/ath10k/debug.h   |8 ++--
 drivers/net/wireless/ath/ath10k/debugfs_sta.c |   34 +++-
 drivers/net/wireless/ath/ath10k/wmi.c |   53 ++---
 drivers/net/wireless/ath/ath10k/wmi.h |   14 ++-
 6 files changed, 115 insertions(+), 20 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 1852e0e..7ea6bc4 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -165,6 +165,13 @@ struct ath10k_fw_stats_peer {
u32 rx_duration;
 };
 
+struct ath10k_fw_extd_stats_peer {
+   struct list_head list;
+
+   u8 peer_macaddr[ETH_ALEN];
+   u32 rx_duration;
+};
+
 struct ath10k_fw_stats_vdev {
struct list_head list;
 
@@ -259,6 +266,7 @@ struct ath10k_fw_stats {
struct list_head pdevs;
struct list_head vdevs;
struct list_head peers;
+   struct list_head peers_extd;
 };
 
 #define ATH10K_TPC_TABLE_TYPE_FLAG 1
diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index e251155..c07eb3f 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -313,6 +313,16 @@ static void ath10k_fw_stats_peers_free(struct list_head 
*head)
}
 }
 
+static void ath10k_fw_extd_stats_peers_free(struct list_head *head)
+{
+   struct ath10k_fw_extd_stats_peer *i, *tmp;
+
+   list_for_each_entry_safe(i, tmp, head, list) {
+   list_del(>list);
+   kfree(i);
+   }
+}
+
 static void ath10k_debug_fw_stats_reset(struct ath10k *ar)
 {
spin_lock_bh(>data_lock);
@@ -320,6 +330,7 @@ static void ath10k_debug_fw_stats_reset(struct ath10k *ar)
ath10k_fw_stats_pdevs_free(>debug.fw_stats.pdevs);
ath10k_fw_stats_vdevs_free(>debug.fw_stats.vdevs);
ath10k_fw_stats_peers_free(>debug.fw_stats.peers);
+   ath10k_fw_extd_stats_peers_free(>debug.fw_stats.peers_extd);
spin_unlock_bh(>data_lock);
 }
 
@@ -334,6 +345,7 @@ void ath10k_debug_fw_stats_process(struct ath10k *ar, 
struct sk_buff *skb)
INIT_LIST_HEAD();
INIT_LIST_HEAD();
INIT_LIST_HEAD();
+   INIT_LIST_HEAD(_extd);
 
spin_lock_bh(>data_lock);
ret = ath10k_wmi_pull_fw_stats(ar, skb, );
@@ -354,7 +366,7 @@ void ath10k_debug_fw_stats_process(struct ath10k *ar, 
struct sk_buff *skb)
 * delivered which is treated as end-of-data and is itself discarded
 */
if (ath10k_peer_stats_enabled(ar))
-   ath10k_sta_update_rx_duration(ar, );
+   ath10k_sta_update_rx_duration(ar, );
 
if (ar->debug.fw_stats_done) {
if (!ath10k_peer_stats_enabled(ar))
@@ -396,6 +408,8 @@ void ath10k_debug_fw_stats_process(struct ath10k *ar, 
struct sk_buff *skb)
 
list_splice_tail_init(, >debug.fw_stats.peers);
list_splice_tail_init(, >debug.fw_stats.vdevs);
+   list_splice_tail_init(_extd,
+ >debug.fw_stats.peers_extd);
}
 
complete(>debug.fw_stats_complete);
@@ -407,6 +421,7 @@ free:
ath10k_fw_stats_pdevs_free();
ath10k_fw_stats_vdevs_free();
ath10k_fw_stats_peers_free();
+   ath10k_fw_extd_stats_peers_free(_extd);
 
spin_unlock_bh(>data_lock);
 }
@@ -2320,6 +2335,7 @@ int ath10k_debug_create(struct ath10k *ar)
INIT_LIST_HEAD(>debug.fw_stats.pdevs);
INIT_LIST_HEAD(>debug.fw_stats.vdevs);
INIT_LIST_HEAD(>debug.fw_stats.peers);
+   INIT_LIST_HEAD(>debug.fw_stats.peers_extd);
 
return 0;
 }
diff --git a/drivers/net/wireless/ath/ath10k/debug.h 
b/drivers/net/wireless/ath/ath10k/debug.h
index 75c89e3..1a722be 100644
--- a/drivers/net/wireless/a

[PATCH] ath10k: Fix error while writing 'simulate_fw_crash' debugfs

2016-05-26 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

Fix invalid argument error while writing 'simulate_fw_crash',
though the funcionality is working fine we get an error 'invalid
argument' because 'count' value is not returned properly
(no reason to reduce the count value for removing the newline)

Fixes the below write error:

/sys/kernel/debug/ieee80211/phy0/ath10k# echo hw-restart >
simulate_fw_crash
-bash: echo: write error: Invalid argument

Also move the 'conf_mutex' as it is really not required for
fetching the userspace buffer.

Reported-by: Maharaja Kennadyrajan <c_mke...@qti.qualcomm.com>
Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
Signed-off-by: Maharaja Kennadyrajan <c_mke...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/debug.c |   14 ++
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index e251155..54cb629 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -609,25 +609,23 @@ static ssize_t ath10k_write_simulate_fw_crash(struct file 
*file,
char buf[32];
int ret;
 
-   mutex_lock(>conf_mutex);
-
simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, user_buf, count);
 
/* make sure that buf is null terminated */
buf[sizeof(buf) - 1] = 0;
 
+   /* drop the possible '\n' from the end */
+   if (buf[count - 1] == '\n')
+   buf[count - 1] = 0;
+
+   mutex_lock(>conf_mutex);
+
if (ar->state != ATH10K_STATE_ON &&
ar->state != ATH10K_STATE_RESTARTED) {
ret = -ENETDOWN;
goto exit;
}
 
-   /* drop the possible '\n' from the end */
-   if (buf[count - 1] == '\n') {
-   buf[count - 1] = 0;
-   count--;
-   }
-
if (!strcmp(buf, "soft")) {
ath10k_info(ar, "simulating soft firmware crash\n");
ret = ath10k_wmi_force_fw_hang(ar, WMI_FORCE_FW_HANG_ASSERT, 0);
-- 
1.7.9.5

--
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: [PATCH 1/2] ath10k: add QCA9887 chipset support

2016-05-23 Thread Mohammed Shafi Shajakhan
On Mon, May 23, 2016 at 11:52:11AM +0530, Mohammed Shafi Shajakhan wrote:
> Hi Sven,
> 
> On Fri, May 20, 2016 at 04:41:11PM +0200, Sven Eckelmann wrote:
> > Add the hardware name, revision, firmware names and update the pci_id
> > table.
> > 
> > QA9887 HW1.0 is supposed to be similar to QCA988X HW2.0 . Details about
> > he firmware interface are currently unknown.
> > 
> > Signed-off-by: Sven Eckelmann <sven.eckelm...@open-mesh.com>
> > ---
> >  drivers/net/wireless/ath/ath10k/core.c  | 20 
> >  drivers/net/wireless/ath/ath10k/hw.h| 10 ++
> >  drivers/net/wireless/ath/ath10k/pci.c   | 20 ++--
> >  drivers/net/wireless/ath/ath10k/targaddrs.h |  3 +++
> >  4 files changed, 51 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/net/wireless/ath/ath10k/core.c 
> > b/drivers/net/wireless/ath/ath10k/core.c
> > index 49af624..0f4a4f6 100644
> > --- a/drivers/net/wireless/ath/ath10k/core.c
> > +++ b/drivers/net/wireless/ath/ath10k/core.c
> > @@ -69,6 +69,25 @@ static const struct ath10k_hw_params 
> > ath10k_hw_params_list[] = {
> > },
> > },
> > {
> > +   .id = QCA9887_HW_1_0_VERSION,
> > +   .dev_id = QCA9887_1_0_DEVICE_ID,
> > +   .name = "qca9887 hw1.0",
> > +   .patch_load_addr = QCA9887_HW_1_0_PATCH_LOAD_ADDR,
> > +   .uart_pin = 7,
> > +   .has_shifted_cc_wraparound = true,
> > +   .otp_exe_param = 0,
> > +   .channel_counters_freq_hz = 88000,
> > +   .max_probe_resp_desc_thres = 0,
> > +   .hw_4addr_pad = ATH10K_HW_4ADDR_PAD_AFTER,
> > +   .cal_data_len = 2116,
> 
> [shafi] i think we can re-use QCA988X_CAL_DATA_LEN instead of a new h/w param

sorry ignore this comment, i was looking into some old code, this change looks
fine to me

> 
> > +   .fw = {
> > +   .dir = QCA9887_HW_1_0_FW_DIR,
> > +   .board = QCA9887_HW_1_0_BOARD_DATA_FILE,
> > +   .board_size = QCA9887_BOARD_DATA_SZ,
> > +   .board_ext_size = QCA9887_BOARD_EXT_DATA_SZ,
> > +   },
> > +   },
> > +   {
> > .id = QCA6174_HW_2_1_VERSION,
> > .dev_id = QCA6164_2_1_DEVICE_ID,
> > .name = "qca6164 hw2.1",
> > @@ -2062,6 +2081,7 @@ struct ath10k *ath10k_core_create(size_t priv_size, 
> > struct device *dev,
> >  
> > switch (hw_rev) {
> > case ATH10K_HW_QCA988X:
> > +   case ATH10K_HW_QCA9887:
> > ar->regs = _regs;
> > ar->hw_values = _values;
> > break;
> > diff --git a/drivers/net/wireless/ath/ath10k/hw.h 
> > b/drivers/net/wireless/ath/ath10k/hw.h
> > index aedd898..9108831 100644
> > --- a/drivers/net/wireless/ath/ath10k/hw.h
> > +++ b/drivers/net/wireless/ath/ath10k/hw.h
> > @@ -27,6 +27,7 @@
> >  #define QCA6174_2_1_DEVICE_ID   (0x003e)
> >  #define QCA99X0_2_0_DEVICE_ID   (0x0040)
> >  #define QCA9377_1_0_DEVICE_ID   (0x0042)
> > +#define QCA9887_1_0_DEVICE_ID   (0x0050)
> >  
> >  /* QCA988X 1.0 definitions (unsupported) */
> >  #define QCA988X_HW_1_0_CHIP_ID_REV 0x0
> > @@ -38,6 +39,13 @@
> >  #define QCA988X_HW_2_0_BOARD_DATA_FILE "board.bin"
> >  #define QCA988X_HW_2_0_PATCH_LOAD_ADDR 0x1234
> >  
> > +/* QCA9887 1.0 definitions */
> > +#define QCA9887_HW_1_0_VERSION 0x4100016d
> > +#define QCA9887_HW_1_0_CHIP_ID_REV 0
> > +#define QCA9887_HW_1_0_FW_DIR  ATH10K_FW_DIR "/QCA9887/hw1.0"
> > +#define QCA9887_HW_1_0_BOARD_DATA_FILE "board.bin"
> > +#define QCA9887_HW_1_0_PATCH_LOAD_ADDR 0x1234
> > +
> >  /* QCA6174 target BMI version signatures */
> >  #define QCA6174_HW_1_0_VERSION 0x0500
> >  #define QCA6174_HW_1_1_VERSION 0x0501
> > @@ -195,6 +203,7 @@ enum ath10k_hw_rev {
> > ATH10K_HW_QCA99X0,
> > ATH10K_HW_QCA9377,
> > ATH10K_HW_QCA4019,
> > +   ATH10K_HW_QCA9887,
> >  };
> >  
> >  struct ath10k_hw_regs {
> > @@ -247,6 +256,7 @@ void ath10k_hw_fill_survey_time(struct ath10k *ar, 
> > struct survey_info *survey,
> > u32 cc, u32 rcc, u32 cc_prev, u32 rcc_prev);
> >  
> >  #define QCA_REV_988X(ar) ((ar)->hw_rev == ATH10K_HW_QCA988X)
> > +#define QCA_REV_9887(ar) ((ar)->hw_rev == ATH10K_HW_QCA9887)
> >  #define QCA_REV_6174(ar) ((ar)->hw_

Re: [PATCH 1/2] ath10k: add QCA9887 chipset support

2016-05-23 Thread Mohammed Shafi Shajakhan
Hi Sven,

On Fri, May 20, 2016 at 04:41:11PM +0200, Sven Eckelmann wrote:
> Add the hardware name, revision, firmware names and update the pci_id
> table.
> 
> QA9887 HW1.0 is supposed to be similar to QCA988X HW2.0 . Details about
> he firmware interface are currently unknown.
> 
> Signed-off-by: Sven Eckelmann 
> ---
>  drivers/net/wireless/ath/ath10k/core.c  | 20 
>  drivers/net/wireless/ath/ath10k/hw.h| 10 ++
>  drivers/net/wireless/ath/ath10k/pci.c   | 20 ++--
>  drivers/net/wireless/ath/ath10k/targaddrs.h |  3 +++
>  4 files changed, 51 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath10k/core.c 
> b/drivers/net/wireless/ath/ath10k/core.c
> index 49af624..0f4a4f6 100644
> --- a/drivers/net/wireless/ath/ath10k/core.c
> +++ b/drivers/net/wireless/ath/ath10k/core.c
> @@ -69,6 +69,25 @@ static const struct ath10k_hw_params 
> ath10k_hw_params_list[] = {
>   },
>   },
>   {
> + .id = QCA9887_HW_1_0_VERSION,
> + .dev_id = QCA9887_1_0_DEVICE_ID,
> + .name = "qca9887 hw1.0",
> + .patch_load_addr = QCA9887_HW_1_0_PATCH_LOAD_ADDR,
> + .uart_pin = 7,
> + .has_shifted_cc_wraparound = true,
> + .otp_exe_param = 0,
> + .channel_counters_freq_hz = 88000,
> + .max_probe_resp_desc_thres = 0,
> + .hw_4addr_pad = ATH10K_HW_4ADDR_PAD_AFTER,
> + .cal_data_len = 2116,

[shafi] i think we can re-use QCA988X_CAL_DATA_LEN instead of a new h/w param

> + .fw = {
> + .dir = QCA9887_HW_1_0_FW_DIR,
> + .board = QCA9887_HW_1_0_BOARD_DATA_FILE,
> + .board_size = QCA9887_BOARD_DATA_SZ,
> + .board_ext_size = QCA9887_BOARD_EXT_DATA_SZ,
> + },
> + },
> + {
>   .id = QCA6174_HW_2_1_VERSION,
>   .dev_id = QCA6164_2_1_DEVICE_ID,
>   .name = "qca6164 hw2.1",
> @@ -2062,6 +2081,7 @@ struct ath10k *ath10k_core_create(size_t priv_size, 
> struct device *dev,
>  
>   switch (hw_rev) {
>   case ATH10K_HW_QCA988X:
> + case ATH10K_HW_QCA9887:
>   ar->regs = _regs;
>   ar->hw_values = _values;
>   break;
> diff --git a/drivers/net/wireless/ath/ath10k/hw.h 
> b/drivers/net/wireless/ath/ath10k/hw.h
> index aedd898..9108831 100644
> --- a/drivers/net/wireless/ath/ath10k/hw.h
> +++ b/drivers/net/wireless/ath/ath10k/hw.h
> @@ -27,6 +27,7 @@
>  #define QCA6174_2_1_DEVICE_ID   (0x003e)
>  #define QCA99X0_2_0_DEVICE_ID   (0x0040)
>  #define QCA9377_1_0_DEVICE_ID   (0x0042)
> +#define QCA9887_1_0_DEVICE_ID   (0x0050)
>  
>  /* QCA988X 1.0 definitions (unsupported) */
>  #define QCA988X_HW_1_0_CHIP_ID_REV   0x0
> @@ -38,6 +39,13 @@
>  #define QCA988X_HW_2_0_BOARD_DATA_FILE   "board.bin"
>  #define QCA988X_HW_2_0_PATCH_LOAD_ADDR   0x1234
>  
> +/* QCA9887 1.0 definitions */
> +#define QCA9887_HW_1_0_VERSION   0x4100016d
> +#define QCA9887_HW_1_0_CHIP_ID_REV   0
> +#define QCA9887_HW_1_0_FW_DIRATH10K_FW_DIR "/QCA9887/hw1.0"
> +#define QCA9887_HW_1_0_BOARD_DATA_FILE   "board.bin"
> +#define QCA9887_HW_1_0_PATCH_LOAD_ADDR   0x1234
> +
>  /* QCA6174 target BMI version signatures */
>  #define QCA6174_HW_1_0_VERSION   0x0500
>  #define QCA6174_HW_1_1_VERSION   0x0501
> @@ -195,6 +203,7 @@ enum ath10k_hw_rev {
>   ATH10K_HW_QCA99X0,
>   ATH10K_HW_QCA9377,
>   ATH10K_HW_QCA4019,
> + ATH10K_HW_QCA9887,
>  };
>  
>  struct ath10k_hw_regs {
> @@ -247,6 +256,7 @@ void ath10k_hw_fill_survey_time(struct ath10k *ar, struct 
> survey_info *survey,
>   u32 cc, u32 rcc, u32 cc_prev, u32 rcc_prev);
>  
>  #define QCA_REV_988X(ar) ((ar)->hw_rev == ATH10K_HW_QCA988X)
> +#define QCA_REV_9887(ar) ((ar)->hw_rev == ATH10K_HW_QCA9887)
>  #define QCA_REV_6174(ar) ((ar)->hw_rev == ATH10K_HW_QCA6174)
>  #define QCA_REV_99X0(ar) ((ar)->hw_rev == ATH10K_HW_QCA99X0)
>  #define QCA_REV_9377(ar) ((ar)->hw_rev == ATH10K_HW_QCA9377)
> diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
> b/drivers/net/wireless/ath/ath10k/pci.c
> index 8133d7b..b799f46 100644
> --- a/drivers/net/wireless/ath/ath10k/pci.c
> +++ b/drivers/net/wireless/ath/ath10k/pci.c
> @@ -57,6 +57,7 @@ static const struct pci_device_id ath10k_pci_id_table[] = {
>   { PCI_VDEVICE(ATHEROS, QCA6174_2_1_DEVICE_ID) }, /* PCI-E QCA6174 V2.1 
> */
>   { PCI_VDEVICE(ATHEROS, QCA99X0_2_0_DEVICE_ID) }, /* PCI-E QCA99X0 V2 */
>   { PCI_VDEVICE(ATHEROS, QCA9377_1_0_DEVICE_ID) }, /* PCI-E QCA9377 V1 */
> + { PCI_VDEVICE(ATHEROS, QCA9887_1_0_DEVICE_ID) }, /* PCI-E QCA9887 */
>   {0}
>  };
>  
> @@ -83,6 +84,8 @@ static const struct ath10k_pci_supp_chip 
> ath10k_pci_supp_chips[] = {
>  
>   { QCA9377_1_0_DEVICE_ID, QCA9377_HW_1_0_CHIP_ID_REV 

[PATCH 1/2] ath10k: Remove duplicate and unused rx rate flags

2016-05-20 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

All these flags are not used and their use is completely
covered by 'ath10k_hw_rate_ofdm', 'ath10k_hw_rate_cck',
and RX_PPDU_START_RATE_FLAG

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
[thanks Michal/Kalle/Vasanth for the first level review]

 drivers/net/wireless/ath/ath10k/rx_desc.h |   39 -
 1 file changed, 39 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/rx_desc.h 
b/drivers/net/wireless/ath/ath10k/rx_desc.h
index ca8d168..aa660a4 100644
--- a/drivers/net/wireless/ath/ath10k/rx_desc.h
+++ b/drivers/net/wireless/ath/ath10k/rx_desc.h
@@ -656,26 +656,6 @@ struct rx_msdu_end {
  * Reserved: HW should fill with zero.  FW should ignore.
  */
 
-#define RX_PPDU_START_SIG_RATE_SELECT_OFDM 0
-#define RX_PPDU_START_SIG_RATE_SELECT_CCK  1
-
-#define RX_PPDU_START_SIG_RATE_OFDM_48 0
-#define RX_PPDU_START_SIG_RATE_OFDM_24 1
-#define RX_PPDU_START_SIG_RATE_OFDM_12 2
-#define RX_PPDU_START_SIG_RATE_OFDM_6  3
-#define RX_PPDU_START_SIG_RATE_OFDM_54 4
-#define RX_PPDU_START_SIG_RATE_OFDM_36 5
-#define RX_PPDU_START_SIG_RATE_OFDM_18 6
-#define RX_PPDU_START_SIG_RATE_OFDM_9  7
-
-#define RX_PPDU_START_SIG_RATE_CCK_LP_11  0
-#define RX_PPDU_START_SIG_RATE_CCK_LP_5_5 1
-#define RX_PPDU_START_SIG_RATE_CCK_LP_2   2
-#define RX_PPDU_START_SIG_RATE_CCK_LP_1   3
-#define RX_PPDU_START_SIG_RATE_CCK_SP_11  4
-#define RX_PPDU_START_SIG_RATE_CCK_SP_5_5 5
-#define RX_PPDU_START_SIG_RATE_CCK_SP_2   6
-
 #define HTT_RX_PPDU_START_PREAMBLE_LEGACY0x04
 #define HTT_RX_PPDU_START_PREAMBLE_HT0x08
 #define HTT_RX_PPDU_START_PREAMBLE_HT_WITH_TXBF  0x09
@@ -711,25 +691,6 @@ struct rx_msdu_end {
 /* No idea what this flag means. It seems to be always set in rate. */
 #define RX_PPDU_START_RATE_FLAG BIT(3)
 
-enum rx_ppdu_start_rate {
-   RX_PPDU_START_RATE_OFDM_48M = RX_PPDU_START_RATE_FLAG | 
ATH10K_HW_RATE_OFDM_48M,
-   RX_PPDU_START_RATE_OFDM_24M = RX_PPDU_START_RATE_FLAG | 
ATH10K_HW_RATE_OFDM_24M,
-   RX_PPDU_START_RATE_OFDM_12M = RX_PPDU_START_RATE_FLAG | 
ATH10K_HW_RATE_OFDM_12M,
-   RX_PPDU_START_RATE_OFDM_6M  = RX_PPDU_START_RATE_FLAG | 
ATH10K_HW_RATE_OFDM_6M,
-   RX_PPDU_START_RATE_OFDM_54M = RX_PPDU_START_RATE_FLAG | 
ATH10K_HW_RATE_OFDM_54M,
-   RX_PPDU_START_RATE_OFDM_36M = RX_PPDU_START_RATE_FLAG | 
ATH10K_HW_RATE_OFDM_36M,
-   RX_PPDU_START_RATE_OFDM_18M = RX_PPDU_START_RATE_FLAG | 
ATH10K_HW_RATE_OFDM_18M,
-   RX_PPDU_START_RATE_OFDM_9M  = RX_PPDU_START_RATE_FLAG | 
ATH10K_HW_RATE_OFDM_9M,
-
-   RX_PPDU_START_RATE_CCK_LP_11M  = RX_PPDU_START_RATE_FLAG | 
ATH10K_HW_RATE_CCK_LP_11M,
-   RX_PPDU_START_RATE_CCK_LP_5_5M = RX_PPDU_START_RATE_FLAG | 
ATH10K_HW_RATE_CCK_LP_5_5M,
-   RX_PPDU_START_RATE_CCK_LP_2M   = RX_PPDU_START_RATE_FLAG | 
ATH10K_HW_RATE_CCK_LP_2M,
-   RX_PPDU_START_RATE_CCK_LP_1M   = RX_PPDU_START_RATE_FLAG | 
ATH10K_HW_RATE_CCK_LP_1M,
-   RX_PPDU_START_RATE_CCK_SP_11M  = RX_PPDU_START_RATE_FLAG | 
ATH10K_HW_RATE_CCK_SP_11M,
-   RX_PPDU_START_RATE_CCK_SP_5_5M = RX_PPDU_START_RATE_FLAG | 
ATH10K_HW_RATE_CCK_SP_5_5M,
-   RX_PPDU_START_RATE_CCK_SP_2M   = RX_PPDU_START_RATE_FLAG | 
ATH10K_HW_RATE_CCK_SP_2M,
-};
-
 struct rx_ppdu_start {
struct {
u8 pri20_mhz;
-- 
1.7.9.5

--
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


[PATCH 2/2] ath10k: Fix CCK h/w rates for QCA99X0 and newer chipsets

2016-05-20 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

CCK hardware table mapping from QCA99X0 onwards got revised.
The CCK hardware rate values are in a proper order wrt. to
rate and preamble as below

ATH10K_HW_RATE_REV2_CCK_LP_1M = 1,
ATH10K_HW_RATE_REV2_CCK_LP_2M = 2,
ATH10K_HW_RATE_REV2_CCK_LP_5_5M = 3,
ATH10K_HW_RATE_REV2_CCK_LP_11M = 4,
ATH10K_HW_RATE_REV2_CCK_SP_2M = 5,
ATH10K_HW_RATE_REV2_CCK_SP_5_5M = 6,
ATH10K_HW_RATE_REV2_CCK_SP_11M = 7,

This results in reporting of rx frames (with CCK rates)
totally wrong for QCA99X0, QCA4019. Fix this by having
separate CCK rate table for these chipsets with rev2 suffix
and registering the correct rate mapping to mac80211 based on
the new hw_param (introduced) 'cck_rate_map_rev2' which shall
be true for any newchipsets from QCA99X0 onwards

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
[thanks Michal/Kalle/Vasanth for the first level review]

 drivers/net/wireless/ath/ath10k/core.c |2 ++
 drivers/net/wireless/ath/ath10k/core.h |6 +
 drivers/net/wireless/ath/ath10k/hw.h   |   10 
 drivers/net/wireless/ath/ath10k/mac.c  |   39 ++--
 4 files changed, 55 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 49af624..86ed64d 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -148,6 +148,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.uart_pin = 7,
.otp_exe_param = 0x0700,
.continuous_frag_desc = true,
+   .cck_rate_map_rev2 = true,
.channel_counters_freq_hz = 15,
.max_probe_resp_desc_thres = 24,
.hw_4addr_pad = ATH10K_HW_4ADDR_PAD_BEFORE,
@@ -205,6 +206,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.has_shifted_cc_wraparound = true,
.otp_exe_param = 0x001,
.continuous_frag_desc = true,
+   .cck_rate_map_rev2 = true,
.channel_counters_freq_hz = 125000,
.max_probe_resp_desc_thres = 24,
.hw_4addr_pad = ATH10K_HW_4ADDR_PAD_BEFORE,
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 1852e0e..04cea23 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -716,6 +716,12 @@ struct ath10k {
 */
bool continuous_frag_desc;
 
+   /* CCK hardware rate table mapping for the newer chipsets
+* like QCA99X0, QCA4019 got revised. The CCK h/w rate values
+* are in a proper order with respect to the rate/preamble
+*/
+   bool cck_rate_map_rev2;
+
u32 channel_counters_freq_hz;
 
/* Mgmt tx descriptors threshold for limiting probe response
diff --git a/drivers/net/wireless/ath/ath10k/hw.h 
b/drivers/net/wireless/ath/ath10k/hw.h
index aedd898..3d5648d 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -315,6 +315,16 @@ enum ath10k_hw_rate_cck {
ATH10K_HW_RATE_CCK_SP_2M,
 };
 
+enum ath10k_hw_rate_rev2_cck {
+   ATH10K_HW_RATE_REV2_CCK_LP_1M = 1,
+   ATH10K_HW_RATE_REV2_CCK_LP_2M,
+   ATH10K_HW_RATE_REV2_CCK_LP_5_5M,
+   ATH10K_HW_RATE_REV2_CCK_LP_11M,
+   ATH10K_HW_RATE_REV2_CCK_SP_2M,
+   ATH10K_HW_RATE_REV2_CCK_SP_5_5M,
+   ATH10K_HW_RATE_REV2_CCK_SP_11M,
+};
+
 enum ath10k_hw_4addr_pad {
ATH10K_HW_4ADDR_PAD_AFTER,
ATH10K_HW_4ADDR_PAD_BEFORE,
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 6dd1d26..a55e3ae 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -62,6 +62,32 @@ static struct ieee80211_rate ath10k_rates[] = {
{ .bitrate = 540, .hw_value = ATH10K_HW_RATE_OFDM_54M },
 };
 
+static struct ieee80211_rate ath10k_rates_rev2[] = {
+   { .bitrate = 10,
+ .hw_value = ATH10K_HW_RATE_REV2_CCK_LP_1M },
+   { .bitrate = 20,
+ .hw_value = ATH10K_HW_RATE_REV2_CCK_LP_2M,
+ .hw_value_short = ATH10K_HW_RATE_REV2_CCK_SP_2M,
+ .flags = IEEE80211_RATE_SHORT_PREAMBLE },
+   { .bitrate = 55,
+ .hw_value = ATH10K_HW_RATE_REV2_CCK_LP_5_5M,
+ .hw_value_short = ATH10K_HW_RATE_REV2_CCK_SP_5_5M,
+ .flags = IEEE80211_RATE_SHORT_PREAMBLE },
+   { .bitrate = 110,
+ .hw_value = ATH10K_HW_RATE_REV2_CCK_LP_11M,
+ .hw_value_short = ATH10K_HW_RATE_REV2_CCK_SP_11M,
+ .flags = IEEE80211_RATE_SHORT_PREAMBLE },
+
+   { .bitrate = 60, .hw_value = ATH10K_HW_RATE_OFDM_6M },
+   { .bitrate = 90, .hw_value = ATH10K_HW_RATE_OFDM_9M },
+   { .bitrate = 120, .hw_value = ATH10K_HW_RATE_OFDM_12M },
+ 

[PATCH] ath10k: Fix legacy rate packet debug messages

2016-05-17 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

Legacy rate packets may not necessarily be having a rx status
flag of '0' always, for example management frame have flags
like RX_FLAG_ONLY_MONITOR / RX_FLAG_MACTIME_END also set

Just check 'VHT' and 'HT' flags are not set , and simply clasify it as
legacy rate packets

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/htt_rx.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c 
b/drivers/net/wireless/ath/ath10k/htt_rx.c
index cc979a4..0419a21 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -939,7 +939,8 @@ static void ath10k_process_rx(struct ath10k *ar,
   is_multicast_ether_addr(ieee80211_get_DA(hdr)) ?
"mcast" : "ucast",
   (__le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_SEQ) >> 4,
-  status->flag == 0 ? "legacy" : "",
+  (status->flag & (RX_FLAG_HT | RX_FLAG_VHT)) == 0 ?
+   "legacy" : "",
   status->flag & RX_FLAG_HT ? "ht" : "",
   status->flag & RX_FLAG_VHT ? "vht" : "",
   status->flag & RX_FLAG_40MHZ ? "40" : "",
-- 
1.7.9.5

--
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: [PATCH v3 RESEND 1/2] ath10k: Add support for ath10k_sta_statistics support

2016-05-17 Thread Mohammed Shafi Shajakhan
Hi Kalle,

On Fri, May 13, 2016 at 03:13:36PM +, Valo, Kalle wrote:
> Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com> writes:
> 
> > From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
> >
> > Enable support for 'drv_sta_statistics' callback.
> > Export rx_duration support if available to cfg80211/nl80211
> >
> > This can also act as a placeholder for any new per STA stats support
> >
> > Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
> > ---
> > [v3] removed conditions for ath10k state checks based on Michal's suggestion
> 
> It's nicer to ping than resend a patch. This patchset has been in
> "Awaiting Upstream" state while waiting for the dependencies trickle
> down to ath-next.

[shafi] sure, thanks ! will do this next time. I was afraid this patch got lost.

> 
> > Dependencies:
> >
> > 1. cfg80211/nl80211: Add support for NL80211_STA_INFO_RX_DURATION (under 
> > review)
> 
> 739960f128e5 cfg80211/nl80211: Add support for NL80211_STA_INFO_RX_DURATION
> 
> Currently in net-next, should come to ath-next soon.

[shafi] thanks for the info.

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


[PATCH v1] ath10k: Fix 10.4 extended peer stats update

2016-05-11 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

10.4 'extended peer stats' will be not be appended with normal peer stats
data and they shall be coming in separate chunks. Fix this by maintaining
a separate linked list 'extender peer stats' for 10.4 and update
rx_duration for per station statistics. Also parse through beacon filter
(if enabled), to make sure we parse the extended peer stats properly.
This issue was exposed when more than one client is connected and
extended peer stats for 10.4 is enabled

The order for the stats is as below
S - standard peer stats, E- extended peer stats, B - beacon filter stats

{S1, S2, S3..} -> {B1, B2, B3..}(if available) -> {E1, E2, E3..}

Fixes: f9575793d44c ("ath10k: enable parsing per station rx duration for 10.4")
Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---

[v1: Fixed line wrap around suggested by Kalle)

 drivers/net/wireless/ath/ath10k/core.h|8 
 drivers/net/wireless/ath/ath10k/debug.c   |   18 -
 drivers/net/wireless/ath/ath10k/debug.h   |8 ++--
 drivers/net/wireless/ath/ath10k/debugfs_sta.c |   34 +++-
 drivers/net/wireless/ath/ath10k/wmi.c |   53 ++---
 drivers/net/wireless/ath/ath10k/wmi.h |   14 ++-
 6 files changed, 115 insertions(+), 20 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 1852e0e..7ea6bc4 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -165,6 +165,13 @@ struct ath10k_fw_stats_peer {
u32 rx_duration;
 };
 
+struct ath10k_fw_extd_stats_peer {
+   struct list_head list;
+
+   u8 peer_macaddr[ETH_ALEN];
+   u32 rx_duration;
+};
+
 struct ath10k_fw_stats_vdev {
struct list_head list;
 
@@ -259,6 +266,7 @@ struct ath10k_fw_stats {
struct list_head pdevs;
struct list_head vdevs;
struct list_head peers;
+   struct list_head peers_extd;
 };
 
 #define ATH10K_TPC_TABLE_TYPE_FLAG 1
diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index e251155..c07eb3f 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -313,6 +313,16 @@ static void ath10k_fw_stats_peers_free(struct list_head 
*head)
}
 }
 
+static void ath10k_fw_extd_stats_peers_free(struct list_head *head)
+{
+   struct ath10k_fw_extd_stats_peer *i, *tmp;
+
+   list_for_each_entry_safe(i, tmp, head, list) {
+   list_del(>list);
+   kfree(i);
+   }
+}
+
 static void ath10k_debug_fw_stats_reset(struct ath10k *ar)
 {
spin_lock_bh(>data_lock);
@@ -320,6 +330,7 @@ static void ath10k_debug_fw_stats_reset(struct ath10k *ar)
ath10k_fw_stats_pdevs_free(>debug.fw_stats.pdevs);
ath10k_fw_stats_vdevs_free(>debug.fw_stats.vdevs);
ath10k_fw_stats_peers_free(>debug.fw_stats.peers);
+   ath10k_fw_extd_stats_peers_free(>debug.fw_stats.peers_extd);
spin_unlock_bh(>data_lock);
 }
 
@@ -334,6 +345,7 @@ void ath10k_debug_fw_stats_process(struct ath10k *ar, 
struct sk_buff *skb)
INIT_LIST_HEAD();
INIT_LIST_HEAD();
INIT_LIST_HEAD();
+   INIT_LIST_HEAD(_extd);
 
spin_lock_bh(>data_lock);
ret = ath10k_wmi_pull_fw_stats(ar, skb, );
@@ -354,7 +366,7 @@ void ath10k_debug_fw_stats_process(struct ath10k *ar, 
struct sk_buff *skb)
 * delivered which is treated as end-of-data and is itself discarded
 */
if (ath10k_peer_stats_enabled(ar))
-   ath10k_sta_update_rx_duration(ar, );
+   ath10k_sta_update_rx_duration(ar, );
 
if (ar->debug.fw_stats_done) {
if (!ath10k_peer_stats_enabled(ar))
@@ -396,6 +408,8 @@ void ath10k_debug_fw_stats_process(struct ath10k *ar, 
struct sk_buff *skb)
 
list_splice_tail_init(, >debug.fw_stats.peers);
list_splice_tail_init(, >debug.fw_stats.vdevs);
+   list_splice_tail_init(_extd,
+ >debug.fw_stats.peers_extd);
}
 
complete(>debug.fw_stats_complete);
@@ -407,6 +421,7 @@ free:
ath10k_fw_stats_pdevs_free();
ath10k_fw_stats_vdevs_free();
ath10k_fw_stats_peers_free();
+   ath10k_fw_extd_stats_peers_free(_extd);
 
spin_unlock_bh(>data_lock);
 }
@@ -2320,6 +2335,7 @@ int ath10k_debug_create(struct ath10k *ar)
INIT_LIST_HEAD(>debug.fw_stats.pdevs);
INIT_LIST_HEAD(>debug.fw_stats.vdevs);
INIT_LIST_HEAD(>debug.fw_stats.peers);
+   INIT_LIST_HEAD(>debug.fw_stats.peers_extd);
 
return 0;
 }
diff --git a/drivers/net/wireless/ath/ath10k/debug.h 
b/drivers/net/wireless/ath/ath10k/debug.h
index 75c89e3..1a722be 100644
--- a/drivers/net/wireless/a

Re: [PATCH] ath10k: Fix 10.4 extended peer stats update

2016-05-10 Thread Mohammed Shafi Shajakhan
On Tue, May 10, 2016 at 09:34:55AM -0700, Ben Greear wrote:
> On 05/10/2016 09:27 AM, Mohammed Shafi Shajakhan wrote:
> >From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
> >
> >10.4 'extended peer stats' will be not be appended with normal peer stats
> >data and they shall be coming in separate chunks. Fix this by maintaining
> >a separate linked list 'extender peer stats' for 10.4 and update
> >rx_duration for per station statistics. Also parse through beacon filter
> >(if enabled), to make sure we parse the extended peer stats properly.
> >This issue was exposed when more than one client is connected and
> >extended peer stats for 10.4 is enabled
> 
> In general, maybe more of these stats should be kept in the driver instead
> of the firmware?  The firmware is very tight on RAM already, and if
> we can pass the needed info back to the host, it could gather arbitrary
> amounts of stats as needed.
>

[shafi] agreed, probably thats why we are tracking u64 counters like rx_duration
etc in host while the firmware variable will wrap aroud in sometime

regards,
shafi
> -- 
> Ben Greear <gree...@candelatech.com>
> Candela Technologies Inc  http://www.candelatech.com
> 
--
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: [PATCH v2 3/5] ath10k: Add WARN_ON if we over-write peer-map pointer.

2016-05-10 Thread Mohammed Shafi Shajakhan
On Tue, May 10, 2016 at 07:41:44AM -0700, Ben Greear wrote:
> 
> 
> On 05/10/2016 12:12 AM, Mohammed Shafi Shajakhan wrote:
> >Hi Ben,
> >
> >On Fri, Apr 01, 2016 at 02:12:10PM -0700, gree...@candelatech.com wrote:
> >>From: Ben Greear <gree...@candelatech.com>
> >>
> >>Not sure this can happen, but seems like a reasonable sanity
> >>check.
> >
> >[shafi] possibly if the peer is removed and the bit is not cleared in the 
> >driver
> >? when the new peer occupies the slot
> 
> A firmware bug could cause this, but I never saw this WARN hit.  Still seems 
> like
> a good sanity check to me, though...it would be quite hard to debug this sort 
> of bug
> if it actually did happen.

[shafi] yeah its good to have, in one of the case i saw a duplicate event
(though its harmless )

> 
> >
> >>
> >>Signed-off-by: Ben Greear <gree...@candelatech.com>
> >>---
> >>  drivers/net/wireless/ath/ath10k/txrx.c | 1 +
> >>  1 file changed, 1 insertion(+)
> >>
> >>diff --git a/drivers/net/wireless/ath/ath10k/txrx.c 
> >>b/drivers/net/wireless/ath/ath10k/txrx.c
> >>index a779a4e..2edef8a 100644
> >>--- a/drivers/net/wireless/ath/ath10k/txrx.c
> >>+++ b/drivers/net/wireless/ath/ath10k/txrx.c
> >>@@ -309,6 +309,7 @@ void ath10k_peer_map_event(struct ath10k_htt *htt,
> >>ath10k_warn(ar, /*ATH10K_DBG_HTT,*/ "htt peer map vdev %d peer %pM id 
> >> %d\n",
> >>   ev->vdev_id, ev->addr, ev->peer_id);
> >>
> >>+   WARN_ON(ar->peer_map[ev->peer_id] && (ar->peer_map[ev->peer_id] != 
> >>peer));
> >>ar->peer_map[ev->peer_id] = peer;
> >>set_bit(ev->peer_id, peer->peer_ids);
> >>  exit:
> >>--
> >>2.4.3
> >
> >regards,
> >shafi
> >
> >>
> >>
> >>___
> >>ath10k mailing list
> >>ath...@lists.infradead.org
> >>http://lists.infradead.org/mailman/listinfo/ath10k
> >
> >___
> >ath10k mailing list
> >ath...@lists.infradead.org
> >http://lists.infradead.org/mailman/listinfo/ath10k
> >
> 
> -- 
> Ben Greear <gree...@candelatech.com>
> Candela Technologies Inc  http://www.candelatech.com
> 
> ___
> ath10k mailing list
> ath...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/ath10k
--
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: [PATCH v2 1/5] ath10k: Ensure txrx-compl-task is stopped when cleaning htt-tx.

2016-05-10 Thread Mohammed Shafi Shajakhan
> >
> >On Fri, Apr 01, 2016 at 02:12:08PM -0700, gree...@candelatech.com wrote:
> >>From: Ben Greear 
> >>
> >>Otherwise, the txrx-compl-task may access some bad memory?
> >
> >good to mention when this happens, will be helpful ifsome one recreates
> >the issue and matches your call trace
> 
> The backtraces were all over the place because the driver was writing to
> memory after it was freed, so I am not sure they are worth while.  I'm sure I 
> posted
> some to the mailing lists around the time where I was working on this, but 
> since
> I was fighting several different problems, hard to know exactly what was what.

[shafi] sure Ben, lets wait for the comments from ath10k reviewers.

> 
> Thanks,
> Ben
> 
> >>Signed-off-by: Ben Greear 
> >>---
> >>  drivers/net/wireless/ath/ath10k/htt_tx.c | 2 ++
> >>  1 file changed, 2 insertions(+)
> >>
> >>diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c 
> >>b/drivers/net/wireless/ath/ath10k/htt_tx.c
> >>index 07b960e..58e88d3 100644
> >>--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
> >>+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
> >>@@ -376,6 +376,8 @@ void ath10k_htt_tx_free(struct ath10k_htt *htt)
> >>  {
> >>int size;
> >>
> >>+   tasklet_kill(>txrx_compl_task);
> >>+
> >>idr_for_each(>pending_tx, ath10k_htt_tx_clean_up_pending, htt->ar);
> >>idr_destroy(>pending_tx);
> >>
> >>--
> >>2.4.3
> >
> >regards,
> >shafi
> >
> >>
> >>
> >>___
> >>ath10k mailing list
> >>ath...@lists.infradead.org
> >>http://lists.infradead.org/mailman/listinfo/ath10k
> >
> >___
> >ath10k mailing list
> >ath...@lists.infradead.org
> >http://lists.infradead.org/mailman/listinfo/ath10k
> >
> 
> -- 
> Ben Greear 
> Candela Technologies Inc  http://www.candelatech.com
--
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


[PATCH] ath10k: Fix 10.4 extended peer stats update

2016-05-10 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

10.4 'extended peer stats' will be not be appended with normal peer stats
data and they shall be coming in separate chunks. Fix this by maintaining
a separate linked list 'extender peer stats' for 10.4 and update
rx_duration for per station statistics. Also parse through beacon filter
(if enabled), to make sure we parse the extended peer stats properly.
This issue was exposed when more than one client is connected and
extended peer stats for 10.4 is enabled

The order for the stats is as below
S - standard peer stats, E- extended peer stats, B - beacon filter stats

{S1, S2, S3..} -> {B1, B2, B3..}(if available) -> {E1, E2, E3..}

Fixes: f9575793d44c ("ath10k: enable parsing per station rx duration for
10.4")
Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/core.h|8 
 drivers/net/wireless/ath/ath10k/debug.c   |   18 -
 drivers/net/wireless/ath/ath10k/debug.h   |8 ++--
 drivers/net/wireless/ath/ath10k/debugfs_sta.c |   34 +++-
 drivers/net/wireless/ath/ath10k/wmi.c |   53 ++---
 drivers/net/wireless/ath/ath10k/wmi.h |   14 ++-
 6 files changed, 115 insertions(+), 20 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 1852e0e..7ea6bc4 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -165,6 +165,13 @@ struct ath10k_fw_stats_peer {
u32 rx_duration;
 };
 
+struct ath10k_fw_extd_stats_peer {
+   struct list_head list;
+
+   u8 peer_macaddr[ETH_ALEN];
+   u32 rx_duration;
+};
+
 struct ath10k_fw_stats_vdev {
struct list_head list;
 
@@ -259,6 +266,7 @@ struct ath10k_fw_stats {
struct list_head pdevs;
struct list_head vdevs;
struct list_head peers;
+   struct list_head peers_extd;
 };
 
 #define ATH10K_TPC_TABLE_TYPE_FLAG 1
diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index e251155..c07eb3f 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -313,6 +313,16 @@ static void ath10k_fw_stats_peers_free(struct list_head 
*head)
}
 }
 
+static void ath10k_fw_extd_stats_peers_free(struct list_head *head)
+{
+   struct ath10k_fw_extd_stats_peer *i, *tmp;
+
+   list_for_each_entry_safe(i, tmp, head, list) {
+   list_del(>list);
+   kfree(i);
+   }
+}
+
 static void ath10k_debug_fw_stats_reset(struct ath10k *ar)
 {
spin_lock_bh(>data_lock);
@@ -320,6 +330,7 @@ static void ath10k_debug_fw_stats_reset(struct ath10k *ar)
ath10k_fw_stats_pdevs_free(>debug.fw_stats.pdevs);
ath10k_fw_stats_vdevs_free(>debug.fw_stats.vdevs);
ath10k_fw_stats_peers_free(>debug.fw_stats.peers);
+   ath10k_fw_extd_stats_peers_free(>debug.fw_stats.peers_extd);
spin_unlock_bh(>data_lock);
 }
 
@@ -334,6 +345,7 @@ void ath10k_debug_fw_stats_process(struct ath10k *ar, 
struct sk_buff *skb)
INIT_LIST_HEAD();
INIT_LIST_HEAD();
INIT_LIST_HEAD();
+   INIT_LIST_HEAD(_extd);
 
spin_lock_bh(>data_lock);
ret = ath10k_wmi_pull_fw_stats(ar, skb, );
@@ -354,7 +366,7 @@ void ath10k_debug_fw_stats_process(struct ath10k *ar, 
struct sk_buff *skb)
 * delivered which is treated as end-of-data and is itself discarded
 */
if (ath10k_peer_stats_enabled(ar))
-   ath10k_sta_update_rx_duration(ar, );
+   ath10k_sta_update_rx_duration(ar, );
 
if (ar->debug.fw_stats_done) {
if (!ath10k_peer_stats_enabled(ar))
@@ -396,6 +408,8 @@ void ath10k_debug_fw_stats_process(struct ath10k *ar, 
struct sk_buff *skb)
 
list_splice_tail_init(, >debug.fw_stats.peers);
list_splice_tail_init(, >debug.fw_stats.vdevs);
+   list_splice_tail_init(_extd,
+ >debug.fw_stats.peers_extd);
}
 
complete(>debug.fw_stats_complete);
@@ -407,6 +421,7 @@ free:
ath10k_fw_stats_pdevs_free();
ath10k_fw_stats_vdevs_free();
ath10k_fw_stats_peers_free();
+   ath10k_fw_extd_stats_peers_free(_extd);
 
spin_unlock_bh(>data_lock);
 }
@@ -2320,6 +2335,7 @@ int ath10k_debug_create(struct ath10k *ar)
INIT_LIST_HEAD(>debug.fw_stats.pdevs);
INIT_LIST_HEAD(>debug.fw_stats.vdevs);
INIT_LIST_HEAD(>debug.fw_stats.peers);
+   INIT_LIST_HEAD(>debug.fw_stats.peers_extd);
 
return 0;
 }
diff --git a/drivers/net/wireless/ath/ath10k/debug.h 
b/drivers/net/wireless/ath/ath10k/debug.h
index 75c89e3..1a722be 100644
--- a/drivers/net/wireless/ath/ath10k/debug.h
+++ b/drivers/net/wireless/ath/ath10k/debug.h
@

[PATCH] ath10k: Reduce warning messages during rx without proper channel context

2016-05-10 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

WARN_ON_ONCE when we receive packets for self peer when mac80211
had not assigned a proper channel context. This scenario happens
in QCA4019 when we start the AP via hostapd in background and start
it once again in the background without killing the previous instance!
This happens intermittently when we start / stop hostapd in a while loop
(incase the hostapd is not properly killed).  This results in mac80211
chancontext to be unassigned, while the self peer continuous receive
packets in target operating channel. This results in lot of call traces
in the rx path. Make this as a WARN_ON_ONCE to avoid flooding the console
which result in rebooting low memory systems, while still reporting the
warning once that we are receiving packets in target operating channel and
to indicate that something is happening which is not the expected result.

WARNING: CPU: 0 PID: 0 at ath/ath10k/htt_rx.c:803
[] (warn_slowpath_null) from []
(ath10k_htt_rx_h_channel+0xe0/0x1b8 [ath10k_core])
[] (ath10k_htt_rx_h_channel [ath10k_core]) from
[] (ath10k_htt_rx_h_ppdu+0x80/0x288 [ath10k_core])
[] (ath10k_htt_rx_h_ppdu [ath10k_core]) from
[] (ath10k_htt_txrx_compl_task+0x724/0x9d4 [ath10k_core])
[] (ath10k_htt_txrx_compl_task [ath10k_core])

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/htt_rx.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c 
b/drivers/net/wireless/ath/ath10k/htt_rx.c
index cc979a4..77d9200 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -748,7 +748,7 @@ ath10k_htt_rx_h_peer_channel(struct ath10k *ar, struct 
htt_rx_desc *rxd)
if (WARN_ON_ONCE(!arvif))
return NULL;
 
-   if (WARN_ON(ath10k_mac_vif_chan(arvif->vif, )))
+   if (WARN_ON_ONCE(ath10k_mac_vif_chan(arvif->vif, )))
return NULL;
 
return def.chan;
-- 
1.7.9.5

--
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: [PATCH 15/21] ath10k: support CT firmware flag.

2016-05-10 Thread Mohammed Shafi Shajakhan
Hi Ben,

On Mon, May 09, 2016 at 04:11:09PM -0700, gree...@candelatech.com wrote:
> From: Ben Greear 
> 
> Add placeholder so CT firmware can more easily co-exist with upstream
> kernel.

[shafi] nitpick: good to provide an expansion in commit log as well, so that
if we can easily figure out in git log alone, rather than going through
the change and suggesting that it supports more vif's etc

> 
> Signed-off-by: Ben Greear 
> ---
>  drivers/net/wireless/ath/ath10k/core.c | 1 +
>  drivers/net/wireless/ath/ath10k/core.h | 3 +++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/drivers/net/wireless/ath/ath10k/core.c 
> b/drivers/net/wireless/ath/ath10k/core.c
> index fa71d57..49c85c3 100644
> --- a/drivers/net/wireless/ath/ath10k/core.c
> +++ b/drivers/net/wireless/ath/ath10k/core.c
> @@ -235,6 +235,7 @@ static const char *const ath10k_core_fw_feature_str[] = {
>   [ATH10K_FW_FEATURE_SUPPORTS_ADAPTIVE_CCA] = "adaptive-cca",
>   [ATH10K_FW_FEATURE_MFP_SUPPORT] = "mfp",
>   [ATH10K_FW_FEATURE_PEER_FLOW_CONTROL] = "peer-flow-ctrl",
> + [ATH10K_FW_FEATURE_WMI_10X_CT] = "wmi-10.x-CT",
>  };
>  
>  static unsigned int ath10k_core_get_fw_feature_str(char *buf,
> diff --git a/drivers/net/wireless/ath/ath10k/core.h 
> b/drivers/net/wireless/ath/ath10k/core.h
> index 1a75e2e..dd38f34 100644
> --- a/drivers/net/wireless/ath/ath10k/core.h
> +++ b/drivers/net/wireless/ath/ath10k/core.h
> @@ -566,6 +566,9 @@ enum ath10k_fw_features {
>*/
>   ATH10K_FW_FEATURE_PEER_FLOW_CONTROL = 13,
>  
> + /* Firmware from Candela Technologies, enables more VIFs, etc */
> + ATH10K_FW_FEATURE_WMI_10X_CT = 31,
> +
>   /* keep last */
>   ATH10K_FW_FEATURE_COUNT,
>  };
>
regards,
shafi

> 
> ___
> ath10k mailing list
> ath...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/ath10k
--
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: [PATCH v2 3/5] ath10k: Add WARN_ON if we over-write peer-map pointer.

2016-05-10 Thread Mohammed Shafi Shajakhan
Hi Ben,

On Fri, Apr 01, 2016 at 02:12:10PM -0700, gree...@candelatech.com wrote:
> From: Ben Greear 
> 
> Not sure this can happen, but seems like a reasonable sanity
> check.

[shafi] possibly if the peer is removed and the bit is not cleared in the driver
? when the new peer occupies the slot

> 
> Signed-off-by: Ben Greear 
> ---
>  drivers/net/wireless/ath/ath10k/txrx.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/wireless/ath/ath10k/txrx.c 
> b/drivers/net/wireless/ath/ath10k/txrx.c
> index a779a4e..2edef8a 100644
> --- a/drivers/net/wireless/ath/ath10k/txrx.c
> +++ b/drivers/net/wireless/ath/ath10k/txrx.c
> @@ -309,6 +309,7 @@ void ath10k_peer_map_event(struct ath10k_htt *htt,
>   ath10k_warn(ar, /*ATH10K_DBG_HTT,*/ "htt peer map vdev %d peer %pM id 
> %d\n",
>  ev->vdev_id, ev->addr, ev->peer_id);
>  
> + WARN_ON(ar->peer_map[ev->peer_id] && (ar->peer_map[ev->peer_id] != 
> peer));
>   ar->peer_map[ev->peer_id] = peer;
>   set_bit(ev->peer_id, peer->peer_ids);
>  exit:
> -- 
> 2.4.3

regards,
shafi

> 
> 
> ___
> ath10k mailing list
> ath...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/ath10k
--
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: [PATCH v2 1/5] ath10k: Ensure txrx-compl-task is stopped when cleaning htt-tx.

2016-05-10 Thread Mohammed Shafi Shajakhan
Hi Ben,

On Fri, Apr 01, 2016 at 02:12:08PM -0700, gree...@candelatech.com wrote:
> From: Ben Greear 
> 
> Otherwise, the txrx-compl-task may access some bad memory?

good to mention when this happens, will be helpful ifsome one recreates
the issue and matches your call trace

> 
> Signed-off-by: Ben Greear 
> ---
>  drivers/net/wireless/ath/ath10k/htt_tx.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c 
> b/drivers/net/wireless/ath/ath10k/htt_tx.c
> index 07b960e..58e88d3 100644
> --- a/drivers/net/wireless/ath/ath10k/htt_tx.c
> +++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
> @@ -376,6 +376,8 @@ void ath10k_htt_tx_free(struct ath10k_htt *htt)
>  {
>   int size;
>  
> + tasklet_kill(>txrx_compl_task);
> +
>   idr_for_each(>pending_tx, ath10k_htt_tx_clean_up_pending, htt->ar);
>   idr_destroy(>pending_tx);
>  
> -- 
> 2.4.3

regards,
shafi

> 
> 
> ___
> ath10k mailing list
> ath...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/ath10k
--
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


[PATCH v3 RESEND 2/2] ath10k: Remove debugfs support for Per STA total rx duration

2016-05-02 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

cfg80211/nl80211 interface changes for per STA total rx-duration and
very basic 'ath10k_sta_statistics'  mac80211 callback is implemented
to extend support for per station statistics from the driver.

Also provision in 'iw dev wlan#N station dump' to parse rx-duration
is supported. So its safer to remove the debugfs entry for per STA
rx-duration

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/debugfs_sta.c |   24 
 1 file changed, 24 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/debugfs_sta.c 
b/drivers/net/wireless/ath/ath10k/debugfs_sta.c
index c5396bf..d1186b6 100644
--- a/drivers/net/wireless/ath/ath10k/debugfs_sta.c
+++ b/drivers/net/wireless/ath/ath10k/debugfs_sta.c
@@ -263,28 +263,6 @@ static const struct file_operations fops_delba = {
.llseek = default_llseek,
 };
 
-static ssize_t ath10k_dbg_sta_read_rx_duration(struct file *file,
-  char __user *user_buf,
-  size_t count, loff_t *ppos)
-{
-   struct ieee80211_sta *sta = file->private_data;
-   struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv;
-   char buf[100];
-   int len = 0;
-
-   len = scnprintf(buf, sizeof(buf),
-   "%llu usecs\n", arsta->rx_duration);
-
-   return simple_read_from_buffer(user_buf, count, ppos, buf, len);
-}
-
-static const struct file_operations fops_rx_duration = {
-   .read = ath10k_dbg_sta_read_rx_duration,
-   .open = simple_open,
-   .owner = THIS_MODULE,
-   .llseek = default_llseek,
-};
-
 void ath10k_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, struct dentry *dir)
 {
@@ -293,6 +271,4 @@ void ath10k_sta_add_debugfs(struct ieee80211_hw *hw, struct 
ieee80211_vif *vif,
debugfs_create_file("addba", S_IWUSR, dir, sta, _addba);
debugfs_create_file("addba_resp", S_IWUSR, dir, sta, _addba_resp);
debugfs_create_file("delba", S_IWUSR, dir, sta, _delba);
-   debugfs_create_file("rx_duration", S_IRUGO, dir, sta,
-   _rx_duration);
 }
-- 
1.7.9.5

--
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


[PATCH v3 RESEND 1/2] ath10k: Add support for ath10k_sta_statistics support

2016-05-02 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

Enable support for 'drv_sta_statistics' callback.
Export rx_duration support if available to cfg80211/nl80211

This can also act as a placeholder for any new per STA stats support

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
[v3] removed conditions for ath10k state checks based on Michal's suggestion

Dependencies:

1. cfg80211/nl80211: Add support for NL80211_STA_INFO_RX_DURATION (under review)
2. iw: Add support for NL80211_STA_INFO_RX_DURATION netlink
 attribute (under review)
3. ath10k: Enable debugfs provision to enable Peer Stats feature (merged in 
pending branch)

 drivers/net/wireless/ath/ath10k/debug.h   |4 
 drivers/net/wireless/ath/ath10k/debugfs_sta.c |   14 ++
 drivers/net/wireless/ath/ath10k/mac.c |1 +
 3 files changed, 19 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/debug.h 
b/drivers/net/wireless/ath/ath10k/debug.h
index 6206edd..01c500f 100644
--- a/drivers/net/wireless/ath/ath10k/debug.h
+++ b/drivers/net/wireless/ath/ath10k/debug.h
@@ -155,6 +155,10 @@ ath10k_debug_get_new_fw_crash_data(struct ath10k *ar)
 void ath10k_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, struct dentry *dir);
 void ath10k_sta_update_rx_duration(struct ath10k *ar, struct list_head *peer);
+void ath10k_sta_statistics(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+  struct ieee80211_sta *sta,
+  struct station_info *sinfo);
+
 #else
 static inline void ath10k_sta_update_rx_duration(struct ath10k *ar,
 struct list_head *peer)
diff --git a/drivers/net/wireless/ath/ath10k/debugfs_sta.c 
b/drivers/net/wireless/ath/ath10k/debugfs_sta.c
index 67ef75b..c5396bf 100644
--- a/drivers/net/wireless/ath/ath10k/debugfs_sta.c
+++ b/drivers/net/wireless/ath/ath10k/debugfs_sta.c
@@ -35,6 +35,20 @@ void ath10k_sta_update_rx_duration(struct ath10k *ar, struct 
list_head *head)
rcu_read_unlock();
 }
 
+void ath10k_sta_statistics(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+  struct ieee80211_sta *sta,
+  struct station_info *sinfo)
+{
+   struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv;
+   struct ath10k *ar = arsta->arvif->ar;
+
+   if (!ath10k_peer_stats_enabled(ar))
+   return;
+
+   sinfo->rx_duration = arsta->rx_duration;
+   sinfo->filled |= 1ULL << NL80211_STA_INFO_RX_DURATION;
+}
+
 static ssize_t ath10k_dbg_sta_read_aggr_mode(struct file *file,
 char __user *user_buf,
 size_t count, loff_t *ppos)
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 20d72e2..02edeff 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -7271,6 +7271,7 @@ static const struct ieee80211_ops ath10k_ops = {
 #endif
 #ifdef CONFIG_MAC80211_DEBUGFS
.sta_add_debugfs= ath10k_sta_add_debugfs,
+   .sta_statistics = ath10k_sta_statistics,
 #endif
 };
 
-- 
1.7.9.5

--
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


[PATCH] ath10k: Move spectral related structures under ath10k debugfs

2016-04-26 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

Spectral related structures are accessed / modified only if ath10k
debugfs is enabled, so it makes more sense to move them under
ATH10K_DEBUGFS

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
[compile tested disabling ATH10K_DEBUGFS]

 drivers/net/wireless/ath/ath10k/core.h |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index c23c373..48fffef 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -868,8 +868,6 @@ struct ath10k {
 
 #ifdef CONFIG_ATH10K_DEBUGFS
struct ath10k_debug debug;
-#endif
-
struct {
/* relay(fs) channel for spectral scan */
struct rchan *rfs_chan_spec_scan;
@@ -878,6 +876,7 @@ struct ath10k {
enum ath10k_spectral_mode mode;
struct ath10k_spec_scan config;
} spectral;
+#endif
 
struct {
/* protected by conf_mutex */
-- 
1.7.9.5

--
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


[PATCH] ath10k: fix a typo in ath10k_start()

2016-04-22 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

fix a typo (spelling mistake) in 'ath10k_start'

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/mac.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 02edeff..20bd317 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -4324,7 +4324,7 @@ static int ath10k_start(struct ieee80211_hw *hw)
 
/*
 * This makes sense only when restarting hw. It is harmless to call
-* uncoditionally. This is necessary to make sure no HTT/WMI tx
+* unconditionally. This is necessary to make sure no HTT/WMI tx
 * commands will be submitted while restarting.
 */
ath10k_drain_tx(ar);
-- 
1.7.9.5

--
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: [PATCH v4] cfg80211/nl80211: Add support for NL80211_STA_INFO_RX_DURATION

2016-04-18 Thread Mohammed Shafi Shajakhan
On Thu, Apr 14, 2016 at 10:59:36AM +0200, Johannes Berg wrote:
> On Thu, 2016-04-07 at 19:59 +0530, Mohammed Shafi Shajakhan wrote:
> > From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
> > 
> > Add support for new netlink attribute 'NL80211_STA_INFO_RX_DURATION'.
> > 'NL80211_STA_INFO_RX_DURATION' accounts for aggregate PPDU duration
> > in microseconds for all the frames from a peer. Drivers can fill
> > 'rx_duration' field and set the flag 'NL80211_STA_INFO_RX_DURATION'.
> > 'rx_duration' will give an idea about the total time spent by our
> > peer
> > with each of its connected peers.
> > 
> > Also extend 'PUT_SINFO' for supporting rx_duration field
> > 
> Applied, with some minor changes.
>
[shafi] thank you for accepting this change Johannes.

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


[PATCH v4] iw: Add support for NL80211_STA_INFO_RX_DURATION netlink attribute

2016-04-07 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

Add support for new netlink attribute 'NL80211_STA_INFO_RX_DURATION'.
'NL80211_STA_INFO_RX_DURATION' accounts for aggregate PPDU duration
in microseconds for all the frames from a peer. Drivers can fill
'rx_duration' field and set the flag 'NL80211_STA_INFO_RX_DURATION'.
'rx_duration' will give an idea about the total time spent by our peer
with each of its connected peers.

This will get dumped as part of 'iw dev wlan#N station dump'

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
 nl80211.h |3 +++
 station.c |5 +
 2 files changed, 8 insertions(+)

diff --git a/nl80211.h b/nl80211.h
index 5b7b5eb..991b3ce 100644
--- a/nl80211.h
+++ b/nl80211.h
@@ -2464,6 +2464,8 @@ enum nl80211_sta_bss_param {
  * TID+1 and the special TID 16 (i.e. value 17) is used for non-QoS frames;
  * each one of those is again nested with  nl80211_tid_stats
  * attributes carrying the actual values.
+ * @NL80210_STA_INFO_RX_DURATION: aggregate PPDU duration(usecs) for all the
+ * frames from a peer
  * @__NL80211_STA_INFO_AFTER_LAST: internal
  * @NL80211_STA_INFO_MAX: highest possible station info attribute
  */
@@ -2500,6 +2502,7 @@ enum nl80211_sta_info {
NL80211_STA_INFO_BEACON_RX,
NL80211_STA_INFO_BEACON_SIGNAL_AVG,
NL80211_STA_INFO_TID_STATS,
+   NL80211_STA_INFO_RX_DURATION,
 
/* keep last */
__NL80211_STA_INFO_AFTER_LAST,
diff --git a/station.c b/station.c
index b5ccf4a..a730db1 100644
--- a/station.c
+++ b/station.c
@@ -147,6 +147,7 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
[NL80211_STA_INFO_NONPEER_PM] = { .type = NLA_U32},
[NL80211_STA_INFO_CHAIN_SIGNAL] = { .type = NLA_NESTED },
[NL80211_STA_INFO_CHAIN_SIGNAL_AVG] = { .type = NLA_NESTED },
+   [NL80211_STA_INFO_RX_DURATION] = { .type = NLA_U64 },
};
char *chain;
 
@@ -226,6 +227,10 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
printf("\n\trx bitrate:\t%s", buf);
}
 
+   if (sinfo[NL80211_STA_INFO_RX_DURATION])
+   printf("\n\trx duration:\t%lld us",
+  (unsigned long 
long)nla_get_u64(sinfo[NL80211_STA_INFO_RX_DURATION]));
+
if (sinfo[NL80211_STA_INFO_EXPECTED_THROUGHPUT]) {
uint32_t thr;
 
-- 
1.7.9.5

--
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


[PATCH v4] cfg80211/nl80211: Add support for NL80211_STA_INFO_RX_DURATION

2016-04-07 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

Add support for new netlink attribute 'NL80211_STA_INFO_RX_DURATION'.
'NL80211_STA_INFO_RX_DURATION' accounts for aggregate PPDU duration
in microseconds for all the frames from a peer. Drivers can fill
'rx_duration' field and set the flag 'NL80211_STA_INFO_RX_DURATION'.
'rx_duration' will give an idea about the total time spent by our peer
with each of its connected peers.

Also extend 'PUT_SINFO' for supporting rx_duration field

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
 include/net/cfg80211.h   |4 +++-
 include/uapi/linux/nl80211.h |3 +++
 net/wireless/nl80211.c   |3 ++-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 0bbfbf3..e0fe16e 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1063,11 +1063,12 @@ struct cfg80211_tid_stats {
  * @rx_beacon: number of beacons received from this peer
  * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received
  * from this peer
+ * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer
  * @pertid: per-TID statistics, see  cfg80211_tid_stats, using the last
  * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
  */
 struct station_info {
-   u32 filled;
+   u64 filled;
u32 connected_time;
u32 inactive_time;
u64 rx_bytes;
@@ -1106,6 +1107,7 @@ struct station_info {
u32 expected_throughput;
 
u64 rx_beacon;
+   u64 rx_duration;
u8 rx_beacon_signal_avg;
struct cfg80211_tid_stats pertid[IEEE80211_NUM_TIDS + 1];
 };
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index b2a8d8c..e11559f 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -2482,6 +2482,8 @@ enum nl80211_sta_bss_param {
  * TID+1 and the special TID 16 (i.e. value 17) is used for non-QoS frames;
  * each one of those is again nested with  nl80211_tid_stats
  * attributes carrying the actual values.
+ * @NL80211_STA_INFO_RX_DURATION: aggregate PPDU duration(usecs) for all the
+ * frames from a peer
  * @__NL80211_STA_INFO_AFTER_LAST: internal
  * @NL80211_STA_INFO_MAX: highest possible station info attribute
  */
@@ -2518,6 +2520,7 @@ enum nl80211_sta_info {
NL80211_STA_INFO_BEACON_RX,
NL80211_STA_INFO_BEACON_SIGNAL_AVG,
NL80211_STA_INFO_TID_STATS,
+   NL80211_STA_INFO_RX_DURATION,
 
/* keep last */
__NL80211_STA_INFO_AFTER_LAST,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index d6c6449..3969d10 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -3753,7 +3753,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32 
cmd, u32 portid,
goto nla_put_failure;
 
 #define PUT_SINFO(attr, memb, type) do {   \
-   if (sinfo->filled & BIT(NL80211_STA_INFO_ ## attr) &&   \
+   if (sinfo->filled & (1ULL << NL80211_STA_INFO_ ## attr) &&  \
nla_put_ ## type(msg, NL80211_STA_INFO_ ## attr,\
 sinfo->memb))  \
goto nla_put_failure;   \
@@ -3779,6 +3779,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32 
cmd, u32 portid,
PUT_SINFO(LLID, llid, u16);
PUT_SINFO(PLID, plid, u16);
PUT_SINFO(PLINK_STATE, plink_state, u8);
+   PUT_SINFO(RX_DURATION, rx_duration, u64);
 
switch (rdev->wiphy.signal_type) {
case CFG80211_SIGNAL_TYPE_MBM:
-- 
1.7.9.5

--
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: [PATCH] ath10k: Fix return value for btcoex and peer stats debugfs

2016-04-06 Thread Mohammed Shafi Shajakhan
Hello Joe,

On Tue, Apr 05, 2016 at 10:28:56AM -0700, Joe Perches wrote:
> On Tue, 2016-04-05 at 20:58 +0530, Mohammed Shafi Shajakhan wrote:
> > From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
> > 
> > Return value is incorrect for btcoex and peer stats debugfs
> > 'write' entries if the user provides a value that matches with
> > the already available debugfs entry, this results in the debugfs
> > entry getting stuck and the operation has to be terminated manually.
> > Fix this by returning the appropriate return 'count' as we do it for
> > other debugfs entries like pktlog etc
> 
> Not your code, but some of the xor uses are odd at best.

[shafi] ok.

> 
> > diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
> > b/drivers/net/wireless/ath/ath10k/debug.c
> []
> > @@ -2122,7 +2122,7 @@ static ssize_t ath10k_write_btcoex(struct file *file,
> >     struct ath10k *ar = file->private_data;
> >     char buf[32];
> >     size_t buf_size;
> > -   int ret = 0;
> > +   int ret;
> >     bool val;
> >  
> >     buf_size = min(count, (sizeof(buf) - 1));
> > @@ -2142,8 +2142,10 @@ static ssize_t ath10k_write_btcoex(struct file *file,
> >     goto exit;
> >     }
> >  
> > -   if (!(test_bit(ATH10K_FLAG_BTCOEX, >dev_flags) ^ val))
> > +   if (!(test_bit(ATH10K_FLAG_BTCOEX, >dev_flags) ^ val)) {
> 
> xor on an int and a bool.

[shafi] Should we change the 'val' to int, but this code seems to be working
test_bit seems to do this :
return 1UL & (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));

do we see a problem, it should work right  (because they are bitwise
'ANDING' with 1UL)

> 
> > @@ -2189,7 +2191,7 @@ static ssize_t ath10k_write_peer_stats(struct file 
> > *file,
> >     struct ath10k *ar = file->private_data;
> >     char buf[32];
> >     size_t buf_size;
> > -   int ret = 0;
> > +   int ret;
> >     bool val;
> >  
> >     buf_size = min(count, (sizeof(buf) - 1));
> > @@ -2209,8 +2211,10 @@ static ssize_t ath10k_write_peer_stats(struct file 
> > *file,
> >     goto exit;
> >     }
> >  
> > -   if (!(test_bit(ATH10K_FLAG_PEER_STATS, >dev_flags) ^ val))
> > +   if (!(test_bit(ATH10K_FLAG_PEER_STATS, >dev_flags) ^ val)) {
> 
> here too

[shafi] same thing here ? is there a better code , kindly suggest

> 
> --
> 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


[PATCH] ath10k: Fix return value for btcoex and peer stats debugfs

2016-04-05 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

Return value is incorrect for btcoex and peer stats debugfs
'write' entries if the user provides a value that matches with
the already available debugfs entry, this results in the debugfs
entry getting stuck and the operation has to be terminated manually.
Fix this by returning the appropriate return 'count' as we do it for
other debugfs entries like pktlog etc

Fixes: cc61a1bbbc0e ("ath10k: enable debugfs provision to enable
Peer Stats feature")
Fixes: c28e6f06ff40 ("ath10k: fix sanity check on enabling btcoex via
debugfs")
Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/debug.c |   12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index 76bbe17..e7d441c 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -2122,7 +2122,7 @@ static ssize_t ath10k_write_btcoex(struct file *file,
struct ath10k *ar = file->private_data;
char buf[32];
size_t buf_size;
-   int ret = 0;
+   int ret;
bool val;
 
buf_size = min(count, (sizeof(buf) - 1));
@@ -2142,8 +2142,10 @@ static ssize_t ath10k_write_btcoex(struct file *file,
goto exit;
}
 
-   if (!(test_bit(ATH10K_FLAG_BTCOEX, >dev_flags) ^ val))
+   if (!(test_bit(ATH10K_FLAG_BTCOEX, >dev_flags) ^ val)) {
+   ret = count;
goto exit;
+   }
 
if (val)
set_bit(ATH10K_FLAG_BTCOEX, >dev_flags);
@@ -2189,7 +2191,7 @@ static ssize_t ath10k_write_peer_stats(struct file *file,
struct ath10k *ar = file->private_data;
char buf[32];
size_t buf_size;
-   int ret = 0;
+   int ret;
bool val;
 
buf_size = min(count, (sizeof(buf) - 1));
@@ -2209,8 +2211,10 @@ static ssize_t ath10k_write_peer_stats(struct file *file,
goto exit;
}
 
-   if (!(test_bit(ATH10K_FLAG_PEER_STATS, >dev_flags) ^ val))
+   if (!(test_bit(ATH10K_FLAG_PEER_STATS, >dev_flags) ^ val)) {
+   ret = count;
goto exit;
+   }
 
if (val)
set_bit(ATH10K_FLAG_PEER_STATS, >dev_flags);
-- 
1.7.9.5

--
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: [PATCH v3] cfg80211/nl80211: Add support for NL80211_STA_INFO_RX_DURATION

2016-04-05 Thread Mohammed Shafi Shajakhan
Hi Johannes,

On Tue, Apr 05, 2016 at 12:04:10PM +0200, Johannes Berg wrote:
> Hi,
> 
> The implementation seems fine now, but I think the commit log needs some work.

[shafi] thanks for reviewing.

> 
> > Add support for new netlink attribute 'NL80211_STA_INFO_RX_DURATION'
> 
> I think it'd be worthwhile to describe the attribute a bit more,
> including why you're adding it.

[shafi] will update in v4

> 
> > This flag
> 
> There's no flag.

[shafi] i will replace it with the name 'NL80211_STA_INFO_RX_DURATION'

> 
> >  will be set when drivers can fill rx_duration (aggregate
> > PPDU duration(usecs) for all the frames from a peer) 
> 
> You have the description here, but putting it with the attribute would
> be better.

[shafi] ok

> 
> > via 'drv_sta_statistics' callback
> 
> drv_sta_statistics is a mac80211 detail, that's not relevant at
> cfg80211 level; mentioning that is just confusing. This can well used
> by non-mac80211 drivers.

[shafi] agreed, will remove it.

> 
> > Also make sta_info flags 'filled' as 64 bit to accommodate for new
> > per station stats. 
> 
> That sentence doesn't parse well.
> 
> > Extend 'PUT_SINFO' for supporting rx_duration
> > field and any new per sta information in future
> 
> That sentence I think should just be removed.

[shafi] ok.

-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


[PATCH v3 2/2] ath10k: Remove debugfs support for Per STA total rx duration

2016-03-29 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

cfg80211/nl80211 interface changes for per STA total rx-duration and
very basic 'ath10k_sta_statistics'  mac80211 callback is implemented
to extend support for per station statistics from the driver.

Also provision in 'iw dev wlan#N station dump' to parse rx-duration
is supported. So its safer to remove the debugfs entry for per STA
rx-duration

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/debugfs_sta.c |   24 
 1 file changed, 24 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/debugfs_sta.c 
b/drivers/net/wireless/ath/ath10k/debugfs_sta.c
index c5396bf..d1186b6 100644
--- a/drivers/net/wireless/ath/ath10k/debugfs_sta.c
+++ b/drivers/net/wireless/ath/ath10k/debugfs_sta.c
@@ -263,28 +263,6 @@ static const struct file_operations fops_delba = {
.llseek = default_llseek,
 };
 
-static ssize_t ath10k_dbg_sta_read_rx_duration(struct file *file,
-  char __user *user_buf,
-  size_t count, loff_t *ppos)
-{
-   struct ieee80211_sta *sta = file->private_data;
-   struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv;
-   char buf[100];
-   int len = 0;
-
-   len = scnprintf(buf, sizeof(buf),
-   "%llu usecs\n", arsta->rx_duration);
-
-   return simple_read_from_buffer(user_buf, count, ppos, buf, len);
-}
-
-static const struct file_operations fops_rx_duration = {
-   .read = ath10k_dbg_sta_read_rx_duration,
-   .open = simple_open,
-   .owner = THIS_MODULE,
-   .llseek = default_llseek,
-};
-
 void ath10k_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, struct dentry *dir)
 {
@@ -293,6 +271,4 @@ void ath10k_sta_add_debugfs(struct ieee80211_hw *hw, struct 
ieee80211_vif *vif,
debugfs_create_file("addba", S_IWUSR, dir, sta, _addba);
debugfs_create_file("addba_resp", S_IWUSR, dir, sta, _addba_resp);
debugfs_create_file("delba", S_IWUSR, dir, sta, _delba);
-   debugfs_create_file("rx_duration", S_IRUGO, dir, sta,
-   _rx_duration);
 }
-- 
1.7.9.5

--
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


[PATCH v3 1/2] ath10k: Add support for ath10k_sta_statistics support

2016-03-29 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

Enable support for 'drv_sta_statistics' callback.
Export rx_duration support if available to cfg80211/nl80211

This can also act as a placeholder for any new per STA stats support

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
[v3] removed conditions for ath10k state checks based on Michal's suggestion

Dependencies:

1. cfg80211/nl80211: Add support for NL80211_STA_INFO_RX_DURATION (under review)
2. iw: Add support for NL80211_STA_INFO_RX_DURATION netlink
 attribute (under review)
3. ath10k: Enable debugfs provision to enable Peer Stats feature (merged in 
pending branch)

 drivers/net/wireless/ath/ath10k/debug.h   |4 
 drivers/net/wireless/ath/ath10k/debugfs_sta.c |   14 ++
 drivers/net/wireless/ath/ath10k/mac.c |1 +
 3 files changed, 19 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/debug.h 
b/drivers/net/wireless/ath/ath10k/debug.h
index 6206edd..01c500f 100644
--- a/drivers/net/wireless/ath/ath10k/debug.h
+++ b/drivers/net/wireless/ath/ath10k/debug.h
@@ -155,6 +155,10 @@ ath10k_debug_get_new_fw_crash_data(struct ath10k *ar)
 void ath10k_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, struct dentry *dir);
 void ath10k_sta_update_rx_duration(struct ath10k *ar, struct list_head *peer);
+void ath10k_sta_statistics(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+  struct ieee80211_sta *sta,
+  struct station_info *sinfo);
+
 #else
 static inline void ath10k_sta_update_rx_duration(struct ath10k *ar,
 struct list_head *peer)
diff --git a/drivers/net/wireless/ath/ath10k/debugfs_sta.c 
b/drivers/net/wireless/ath/ath10k/debugfs_sta.c
index 67ef75b..c5396bf 100644
--- a/drivers/net/wireless/ath/ath10k/debugfs_sta.c
+++ b/drivers/net/wireless/ath/ath10k/debugfs_sta.c
@@ -35,6 +35,20 @@ void ath10k_sta_update_rx_duration(struct ath10k *ar, struct 
list_head *head)
rcu_read_unlock();
 }
 
+void ath10k_sta_statistics(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+  struct ieee80211_sta *sta,
+  struct station_info *sinfo)
+{
+   struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv;
+   struct ath10k *ar = arsta->arvif->ar;
+
+   if (!ath10k_peer_stats_enabled(ar))
+   return;
+
+   sinfo->rx_duration = arsta->rx_duration;
+   sinfo->filled |= 1ULL << NL80211_STA_INFO_RX_DURATION;
+}
+
 static ssize_t ath10k_dbg_sta_read_aggr_mode(struct file *file,
 char __user *user_buf,
 size_t count, loff_t *ppos)
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 20d72e2..02edeff 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -7271,6 +7271,7 @@ static const struct ieee80211_ops ath10k_ops = {
 #endif
 #ifdef CONFIG_MAC80211_DEBUGFS
.sta_add_debugfs= ath10k_sta_add_debugfs,
+   .sta_statistics = ath10k_sta_statistics,
 #endif
 };
 
-- 
1.7.9.5

--
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: [RFCv2 2/3] ath10k: report per-station tx/rate rates to mac80211

2016-03-24 Thread Mohammed Shafi Shajakhan
On Thu, Mar 24, 2016 at 08:49:12AM +0100, Michal Kazior wrote:
> On 24 March 2016 at 08:19, Mohammed Shafi Shajakhan
> <moham...@codeaurora.org> wrote:
> > Hi Michal,
> >
> > On Wed, Mar 16, 2016 at 11:17:57AM +0100, Michal Kazior wrote:
> >> The rate control is offloaded by firmware so it's
> >> challanging to provide expected throughput value
> >> for given station.
> >>
> >> This approach is naive as it reports last tx rate
> >> used for given station as provided by firmware
> >> stat event.
> >>
> >> This should be sufficient for airtime estimation
> >> used for fq-codel-in-mac80211 tx scheduling
> >> purposes now.
> >>
> >> This patch uses a very hacky way to get the stats.
> >> This is sufficient for proof-of-concept but must
> >> be cleaned up properly eventually.
> >>
> >> Signed-off-by: Michal Kazior <michal.kaz...@tieto.com>
> >> ---
> >>  drivers/net/wireless/ath/ath10k/core.h  |  5 +++
> >>  drivers/net/wireless/ath/ath10k/debug.c | 61 
> >> +
> >>  drivers/net/wireless/ath/ath10k/mac.c   | 26 --
> >>  drivers/net/wireless/ath/ath10k/wmi.h   |  2 +-
> >>  4 files changed, 76 insertions(+), 18 deletions(-)
> >>
> >> diff --git a/drivers/net/wireless/ath/ath10k/core.h 
> >> b/drivers/net/wireless/ath/ath10k/core.h
> >> index 23ba03fb7a5f..3f76669d44cf 100644
> >> --- a/drivers/net/wireless/ath/ath10k/core.h
> >> +++ b/drivers/net/wireless/ath/ath10k/core.h
> >> @@ -331,6 +331,9 @@ struct ath10k_sta {
> >>   /* protected by conf_mutex */
> >>   bool aggr_mode;
> >>   u64 rx_duration;
> >> +
> >> + u32 tx_rate_kbps;
> >> + u32 rx_rate_kbps;
> >>  #endif
> >>  };
> >>
> >> @@ -372,6 +375,8 @@ struct ath10k_vif {
> >>   s8 def_wep_key_idx;
> >>
> >>   u16 tx_seq_no;
> >> + u32 tx_rate_kbps;
> >> + u32 rx_rate_kbps;
> >>
> >>   union {
> >>   struct {
> >> diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
> >> b/drivers/net/wireless/ath/ath10k/debug.c
> >> index 076d29b53ddf..cc7ebf04ae00 100644
> >> --- a/drivers/net/wireless/ath/ath10k/debug.c
> >> +++ b/drivers/net/wireless/ath/ath10k/debug.c
> >> @@ -316,6 +316,58 @@ static void ath10k_debug_fw_stats_reset(struct ath10k 
> >> *ar)
> >>   spin_unlock_bh(>data_lock);
> >>  }
> >>
> >> +static void ath10k_mac_update_txrx_rate_iter(void *data,
> >> +  u8 *mac,
> >> +  struct ieee80211_vif *vif)
> >> +{
> >> + struct ath10k_fw_stats_peer *peer = data;
> >> + struct ath10k_vif *arvif;
> >> +
> >> + if (memcmp(vif->addr, peer->peer_macaddr, ETH_ALEN))
> >> + return;
> >> +
> >> + arvif = (void *)vif->drv_priv;
> >> + arvif->tx_rate_kbps = peer->peer_tx_rate;
> >> + arvif->rx_rate_kbps = peer->peer_rx_rate;
> >> +}
> >> +
> >> +static void ath10k_mac_update_txrx_rate(struct ath10k *ar,
> >> + struct ath10k_fw_stats *stats)
> >> +{
> >> + struct ieee80211_hw *hw = ar->hw;
> >> + struct ath10k_fw_stats_peer *peer;
> >> + struct ath10k_sta *arsta;
> >> + struct ieee80211_sta *sta;
> >> + const u8 *localaddr = NULL;
> >> +
> >> + rcu_read_lock();
> >> +
> >> + list_for_each_entry(peer, >peers, list) {
> >> + /* This doesn't account for multiple STA connected on 
> >> different
> >> +  * vifs. Unfortunately there's no way to derive that from 
> >> the available
> >> +  * information.
> >> +  */
> >> + sta = ieee80211_find_sta_by_ifaddr(hw,
> >> +peer->peer_macaddr,
> >> +localaddr);
> >> + if (!sta) {
> >> + /* This tries to update multicast rates */
> >> + ieee80211_iterate_active_interfaces_atomic(
> >> + hw,
> >> + IEEE80211_IFACE_ITER_NORMA

Re: [PATCH v2 1/2] ath10k: Add support for ath10k_sta_statistics support

2016-03-24 Thread Mohammed Shafi Shajakhan
Hi Michal / Kalle,

> 
> On Thu, Mar 17, 2016 at 12:35:00PM +0100, Michal Kazior wrote:
> > On 17 March 2016 at 12:20, Mohammed Shafi Shajakhan
> > <moham...@codeaurora.org> wrote:
> > > Hi Michal,
> > >
> > > On Thu, Mar 17, 2016 at 12:12:31PM +0100, Michal Kazior wrote:
> > >> On 17 March 2016 at 11:48, Mohammed Shafi Shajakhan
> > >> <moham...@qti.qualcomm.com> wrote:
> > >> [...]
> > >> > +void ath10k_sta_statistics(struct ieee80211_hw *hw, struct 
> > >> > ieee80211_vif *vif,
> > >> > +  struct ieee80211_sta *sta,
> > >> > +  struct station_info *sinfo)
> > >> > +{
> > >> > +   struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv;
> > >> > +   struct ath10k *ar = arsta->arvif->ar;
> > >> > +
> > >> > +   mutex_lock(>conf_mutex);
> > >> > +
> > >> > +   if (ar->state != ATH10K_STATE_ON &&
> > >> > +   ar->state != ATH10K_STATE_RESTARTED)
> > >> > +   goto out;
> > >>
> > >> Do you really need mutex and ar->state check in this function?
> > >>
> > >
> > > [shafi] By default peer stats will be disabled, we are enabling this by 
> > > debugfs
> > > (hw-restart) so i thought these checks are needed , please advise .. Do 
> > > you say
> > > they  will be never hit
> > 
> > Hmm.. I think mac80211 shouldn't call sta_statistics() before
> > sta_state() during recovery (it makes no sense). In practice I think
> > this isn't enforced in which case it's a mac80211 bug.
> 
> [shafi] sure i will check this. If the hardware is restarting there should
> be no stations connected and station related info.

[shafi] I did not see any checks in mac80211 to prevent this (may be i missed
something), but i did remove the checks and tested it, could not find warnings, 
crashes
(or) garbage values, so is it safer to remove (unless we find some issue with
this) ?, please suggest Michal.

i was doing this parallely in two terminals

a) while true
do
cat rx_stats | grep duration -A 2
done

b) /sys/kernel/debug/ieee80211/phy0/ath10k# echo 1 > peer_stats 
 /sys/kernel/debug/ieee80211/phy0/ath10k# echo 0 > peer_stats 

 (or)
 /sys/kernel/debug/ieee80211/phy0/ath10k# echo hw-restart > simulate_fw_crash 



> 
> > 
> > Anyway, this isn't much of a problem now. You only read out u64 from
> > `arsta` (sta->drv_priv). Even if it's uninitialized/undefined there's
> > no way for you to crash the system (it's not a list, spinlock or any
> > other complex data structure). Worst case userspace will get garbage
> > rx_duration value if it happens to get_station() while hw-restart is
> > ongoing.
> 
> [shafi] will check this ..

[shafi] agree though i could not see any checks in mac80211 to prevent
sta_set_sinfo (or check for the station state), i did not see any issues in my
testing

> 
> > 
> > It'd be good to verify this is actually a problem and - assuming you
> > want to guarantee correct readouts at all times - to fix the problem
> > in mac80211.
> >
> [shafi] ok, sure

[shafi] I really don't have a deeper understanding of mac80211 code,
i need to go through it thoroughly if i need to have checks for this
if they were not already there.

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: [RFCv2 2/3] ath10k: report per-station tx/rate rates to mac80211

2016-03-24 Thread Mohammed Shafi Shajakhan
Hi Michal,

On Wed, Mar 16, 2016 at 11:17:57AM +0100, Michal Kazior wrote:
> The rate control is offloaded by firmware so it's
> challanging to provide expected throughput value
> for given station.
> 
> This approach is naive as it reports last tx rate
> used for given station as provided by firmware
> stat event.
> 
> This should be sufficient for airtime estimation
> used for fq-codel-in-mac80211 tx scheduling
> purposes now.
> 
> This patch uses a very hacky way to get the stats.
> This is sufficient for proof-of-concept but must
> be cleaned up properly eventually.
> 
> Signed-off-by: Michal Kazior 
> ---
>  drivers/net/wireless/ath/ath10k/core.h  |  5 +++
>  drivers/net/wireless/ath/ath10k/debug.c | 61 
> +
>  drivers/net/wireless/ath/ath10k/mac.c   | 26 --
>  drivers/net/wireless/ath/ath10k/wmi.h   |  2 +-
>  4 files changed, 76 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath10k/core.h 
> b/drivers/net/wireless/ath/ath10k/core.h
> index 23ba03fb7a5f..3f76669d44cf 100644
> --- a/drivers/net/wireless/ath/ath10k/core.h
> +++ b/drivers/net/wireless/ath/ath10k/core.h
> @@ -331,6 +331,9 @@ struct ath10k_sta {
>   /* protected by conf_mutex */
>   bool aggr_mode;
>   u64 rx_duration;
> +
> + u32 tx_rate_kbps;
> + u32 rx_rate_kbps;
>  #endif
>  };
>  
> @@ -372,6 +375,8 @@ struct ath10k_vif {
>   s8 def_wep_key_idx;
>  
>   u16 tx_seq_no;
> + u32 tx_rate_kbps;
> + u32 rx_rate_kbps;
>  
>   union {
>   struct {
> diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
> b/drivers/net/wireless/ath/ath10k/debug.c
> index 076d29b53ddf..cc7ebf04ae00 100644
> --- a/drivers/net/wireless/ath/ath10k/debug.c
> +++ b/drivers/net/wireless/ath/ath10k/debug.c
> @@ -316,6 +316,58 @@ static void ath10k_debug_fw_stats_reset(struct ath10k 
> *ar)
>   spin_unlock_bh(>data_lock);
>  }
>  
> +static void ath10k_mac_update_txrx_rate_iter(void *data,
> +  u8 *mac,
> +  struct ieee80211_vif *vif)
> +{
> + struct ath10k_fw_stats_peer *peer = data;
> + struct ath10k_vif *arvif;
> +
> + if (memcmp(vif->addr, peer->peer_macaddr, ETH_ALEN))
> + return;
> +
> + arvif = (void *)vif->drv_priv;
> + arvif->tx_rate_kbps = peer->peer_tx_rate;
> + arvif->rx_rate_kbps = peer->peer_rx_rate;
> +}
> +
> +static void ath10k_mac_update_txrx_rate(struct ath10k *ar,
> + struct ath10k_fw_stats *stats)
> +{
> + struct ieee80211_hw *hw = ar->hw;
> + struct ath10k_fw_stats_peer *peer;
> + struct ath10k_sta *arsta;
> + struct ieee80211_sta *sta;
> + const u8 *localaddr = NULL;
> +
> + rcu_read_lock();
> +
> + list_for_each_entry(peer, >peers, list) {
> + /* This doesn't account for multiple STA connected on different
> +  * vifs. Unfortunately there's no way to derive that from the 
> available
> +  * information.
> +  */
> + sta = ieee80211_find_sta_by_ifaddr(hw,
> +peer->peer_macaddr,
> +localaddr);
> + if (!sta) {
> + /* This tries to update multicast rates */
> + ieee80211_iterate_active_interfaces_atomic(
> + hw,
> + IEEE80211_IFACE_ITER_NORMAL,
> + ath10k_mac_update_txrx_rate_iter,
> + peer);
> + continue;
> + }
> +
> + arsta = (void *)sta->drv_priv;
> + arsta->tx_rate_kbps = peer->peer_tx_rate;
> + arsta->rx_rate_kbps = peer->peer_rx_rate;
> + }
> +
> + rcu_read_unlock();
> +}
> +
>  void ath10k_debug_fw_stats_process(struct ath10k *ar, struct sk_buff *skb)
>  {
>   struct ath10k_fw_stats stats = {};
> @@ -335,6 +387,8 @@ void ath10k_debug_fw_stats_process(struct ath10k *ar, 
> struct sk_buff *skb)
>   goto free;
>   }
>  
> + ath10k_mac_update_txrx_rate(ar, );
> +
>   /* Stat data may exceed htc-wmi buffer limit. In such case firmware
>* splits the stats data and delivers it in a ping-pong fashion of
>* request cmd-update event.
> @@ -351,13 +405,6 @@ void ath10k_debug_fw_stats_process(struct ath10k *ar, 
> struct sk_buff *skb)
>   if (peer_stats_svc)
>   ath10k_sta_update_rx_duration(ar, );
>  
> - if (ar->debug.fw_stats_done) {
> - if (!peer_stats_svc)
> - ath10k_warn(ar, "received unsolicited stats update 
> event\n");
> -
> - goto free;
> - }
> -

[shafi] As you had suggested previously, should we completely clean up this ping
- pong response approach for f/w stats, (or) this should be 

Re: [PATCH v1 3/3] ath10k: Enable parsing per station rx duration for 10.4

2016-03-24 Thread Mohammed Shafi Shajakhan
Hi Kalle,

On Thu, Mar 24, 2016 at 06:51:18AM +, Valo, Kalle wrote:
> "Shajakhan, Mohammed Shafi (Mohammed Shafi)" 
> writes:
> > I will make sure, I will run sparse before sending it for review
> > http://linuxwireless.org/en/users/Drivers/ath10k/CodingStyle/#Linux_style
> >
> > make drivers/net/wireless/ath/ath10k/ C=2 CF="-D__CHECK_ENDIAN__"
> >
> > regret the inconvenience so caused  (including the compilation error)
> 
> I guess easier is to use my ath10k-check script:
> 
> https://github.com/qca/qca-swiss-army-knife/blob/master/tools/scripts/ath10k/ath10k-check
> 
> I use that script to test every patch before I commit them. Run the
> script on the top level kernel source tree and ideally you should not
> see any warnings (the output should be empty).
>

[shafi] sure will do that.

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: [PATCH v1 3/3] ath10k: Enable parsing per station rx duration for 10.4

2016-03-23 Thread Mohammed Shafi Shajakhan
Hi Kalle,

On Wed, Mar 23, 2016 at 01:00:01PM +, Valo, Kalle wrote:
> Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com> writes:
> 
> > From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
> >
> > Rx duration support for per station is part of extended peer
> > stats, enable provision to parse the same and provide backward
> > compatibility based on the 'stats_id' event
> >
> > Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
> 
> There was a new sparse warning:
> 
> drivers/net/wireless/ath/ath10k/wmi.c:2978:42: warning: incorrect type in 
> assignment (different base types)
> drivers/net/wireless/ath/ath10k/wmi.c:2978:42:expected unsigned int 
> [unsigned] [usertype] rx_duration
> drivers/net/wireless/ath/ath10k/wmi.c:2978:42:got restricted __le32 const 
> [usertype] rx_duration
> 
> I fixed it like this in the pending branch, please double check:

[shafi] thanks for fixing this, sorry i missed this.

> 
> --- a/drivers/net/wireless/ath/ath10k/wmi.c
> +++ b/drivers/net/wireless/ath/ath10k/wmi.c
> @@ -2975,7 +2975,7 @@ static int ath10k_wmi_10_4_op_pull_fw_stats(struct 
> ath10k *ar,
> ath10k_wmi_10_4_pull_peer_stats(>common, dst);
> /* FIXME: expose 10.4 specific values */
> if (extd_peer_stats)
> -   dst->rx_duration = src->rx_duration;
> +   dst->rx_duration = __le32_to_cpu(src->rx_duration);
>  
> list_add_tail(>list, >peers);
> }
>
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: [PATCH v2 1/2] ath10k: Add support for ath10k_sta_statistics support

2016-03-19 Thread Mohammed Shafi Shajakhan
Hi Michal,

On Thu, Mar 17, 2016 at 12:12:31PM +0100, Michal Kazior wrote:
> On 17 March 2016 at 11:48, Mohammed Shafi Shajakhan
> <moham...@qti.qualcomm.com> wrote:
> [...]
> > +void ath10k_sta_statistics(struct ieee80211_hw *hw, struct ieee80211_vif 
> > *vif,
> > +  struct ieee80211_sta *sta,
> > +  struct station_info *sinfo)
> > +{
> > +   struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv;
> > +   struct ath10k *ar = arsta->arvif->ar;
> > +
> > +   mutex_lock(>conf_mutex);
> > +
> > +   if (ar->state != ATH10K_STATE_ON &&
> > +   ar->state != ATH10K_STATE_RESTARTED)
> > +   goto out;
> 
> Do you really need mutex and ar->state check in this function?
>

[shafi] By default peer stats will be disabled, we are enabling this by debugfs
(hw-restart) so i thought these checks are needed , please advise .. Do you say
they  will be never hit 

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


[PATCH v1 2/3] ath10k: Introduce Extended Resource Config support for 10.4

2016-03-19 Thread Mohammed Shafi Shajakhan
From: Raja Mani <rm...@qti.qualcomm.com>

Add API support for Extended Resource Configuration for 10.4. This
is useful to enable new features like Peer Stats, LTEU etc if the
firmware advertises support for the service. This is also done to
provide backward compatibility with older firmware. Also for clarity
send default host platform type as 'WMI_HOST_PLATFORM_HIGH_PERF',
though this should not make any difference in functionality

Signed-off-by: Raja Mani <rm...@qti.qualcomm.com>
Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/wmi-ops.h |   23 +
 drivers/net/wireless/ath/ath10k/wmi.c |   24 ++
 drivers/net/wireless/ath/ath10k/wmi.h |   31 +
 3 files changed, 78 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/wmi-ops.h 
b/drivers/net/wireless/ath/ath10k/wmi-ops.h
index 32ab34e..7fb00dc 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-ops.h
+++ b/drivers/net/wireless/ath/ath10k/wmi-ops.h
@@ -186,6 +186,9 @@ struct wmi_ops {
u8 enable,
u32 detect_level,
u32 detect_margin);
+   struct sk_buff *(*ext_resource_config)(struct ath10k *ar,
+  enum wmi_host_platform_type type,
+  u32 fw_feature_bitmap);
int (*get_vdev_subtype)(struct ath10k *ar,
enum wmi_vdev_subtype subtype);
 };
@@ -1330,6 +1333,26 @@ ath10k_wmi_pdev_enable_adaptive_cca(struct ath10k *ar, 
u8 enable,
 }
 
 static inline int
+ath10k_wmi_ext_resource_config(struct ath10k *ar,
+  enum wmi_host_platform_type type,
+  u32 fw_feature_bitmap)
+{
+   struct sk_buff *skb;
+
+   if (!ar->wmi.ops->ext_resource_config)
+   return -EOPNOTSUPP;
+
+   skb = ar->wmi.ops->ext_resource_config(ar, type,
+  fw_feature_bitmap);
+
+   if (IS_ERR(skb))
+   return PTR_ERR(skb);
+
+   return ath10k_wmi_cmd_send(ar, skb,
+  ar->wmi.cmd->ext_resource_cfg_cmdid);
+}
+
+static inline int
 ath10k_wmi_get_vdev_subtype(struct ath10k *ar, enum wmi_vdev_subtype subtype)
 {
if (!ar->wmi.ops->get_vdev_subtype)
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 731856b..0bcdd79 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -705,6 +705,7 @@ static struct wmi_cmd_map wmi_10_4_cmd_map = {
.set_cca_params_cmdid = WMI_10_4_SET_CCA_PARAMS_CMDID,
.pdev_bss_chan_info_request_cmdid =
WMI_10_4_PDEV_BSS_CHAN_INFO_REQUEST_CMDID,
+   .ext_resource_cfg_cmdid = WMI_10_4_EXT_RESOURCE_CFG_CMDID,
 };
 
 /* MAIN WMI VDEV param map */
@@ -7507,6 +7508,28 @@ static int ath10k_wmi_10_4_op_get_vdev_subtype(struct 
ath10k *ar,
return -ENOTSUPP;
 }
 
+static struct sk_buff *
+ath10k_wmi_10_4_ext_resource_config(struct ath10k *ar,
+   enum wmi_host_platform_type type,
+   u32 fw_feature_bitmap)
+{
+   struct wmi_ext_resource_config_10_4_cmd *cmd;
+   struct sk_buff *skb;
+
+   skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
+   if (!skb)
+   return ERR_PTR(-ENOMEM);
+
+   cmd = (struct wmi_ext_resource_config_10_4_cmd *)skb->data;
+   cmd->host_platform_config = __cpu_to_le32(type);
+   cmd->fw_feature_bitmap = __cpu_to_le32(fw_feature_bitmap);
+
+   ath10k_dbg(ar, ATH10K_DBG_WMI,
+  "host platform type :%d firmware feature bitmap :%08x\n",
+  type, fw_feature_bitmap);
+   return skb;
+}
+
 static const struct wmi_ops wmi_ops = {
.rx = ath10k_wmi_op_rx,
.map_svc = wmi_main_svc_map,
@@ -7833,6 +7856,7 @@ static const struct wmi_ops wmi_10_4_ops = {
.gen_addba_set_resp = ath10k_wmi_op_gen_addba_set_resp,
.gen_delba_send = ath10k_wmi_op_gen_delba_send,
.fw_stats_fill = ath10k_wmi_10_4_op_fw_stats_fill,
+   .ext_resource_config = ath10k_wmi_10_4_ext_resource_config,
 
/* shared with 10.2 */
.gen_request_stats = ath10k_wmi_op_gen_request_stats,
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h 
b/drivers/net/wireless/ath/ath10k/wmi.h
index bb42f7a..bd29f27 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -816,6 +816,7 @@ struct wmi_cmd_map {
u32 set_cca_params_cmdid;
u32 pdev_bss_chan_info_request_cmdid;
u32 pdev_enable_adaptive_cca_cmdid;
+   u32 ext_resource_cfg_cmdid;
 };
 
 /*
@@ -2667,6 +2668,31 @@ 

[PATCH] mac80211: Remove unused variable in per STA debugfs struct

2016-03-19 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

Remove unused variable in per STA debugfs structure, 'commit 34e895075e21
("mac80211: allow station add/remove to sleep")' removed the only user of
'add_has_run'.

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
 net/mac80211/debugfs_sta.c |2 --
 net/mac80211/sta_info.h|1 -
 2 files changed, 3 deletions(-)

diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index a39512f..43d6ab8 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -339,8 +339,6 @@ void ieee80211_sta_debugfs_add(struct sta_info *sta)
struct dentry *stations_dir = sta->sdata->debugfs.subdir_stations;
u8 mac[3*ETH_ALEN];
 
-   sta->debugfs.add_has_run = true;
-
if (!stations_dir)
return;
 
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index 57545e5..aae260b 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -487,7 +487,6 @@ struct sta_info {
 #ifdef CONFIG_MAC80211_DEBUGFS
struct sta_info_debugfsdentries {
struct dentry *dir;
-   bool add_has_run;
} debugfs;
 #endif
 
-- 
1.7.9.5

--
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


[PATCH v2 1/2] ath10k: Add support for ath10k_sta_statistics support

2016-03-19 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

Enable support for 'drv_sta_statistics' callback.
Export rx_duration support if available to cfg80211/nl80211

This can also act as a placeholder for any new per STA stats support

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
[v2] fixed condition for ath10k state

Dependencies:

1. cfg80211/nl80211: Add support for NL80211_STA_INFO_RX_DURATION
2. iw: Add support for NL80211_STA_INFO_RX_DURATION netlink
 attribute
3. ath10k: Enable debugfs provision to enable Peer Stats feature

 drivers/net/wireless/ath/ath10k/debug.h   |4 
 drivers/net/wireless/ath/ath10k/debugfs_sta.c |   22 ++
 drivers/net/wireless/ath/ath10k/mac.c |1 +
 3 files changed, 27 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/debug.h 
b/drivers/net/wireless/ath/ath10k/debug.h
index 6206edd..01c500f 100644
--- a/drivers/net/wireless/ath/ath10k/debug.h
+++ b/drivers/net/wireless/ath/ath10k/debug.h
@@ -155,6 +155,10 @@ ath10k_debug_get_new_fw_crash_data(struct ath10k *ar)
 void ath10k_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, struct dentry *dir);
 void ath10k_sta_update_rx_duration(struct ath10k *ar, struct list_head *peer);
+void ath10k_sta_statistics(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+  struct ieee80211_sta *sta,
+  struct station_info *sinfo);
+
 #else
 static inline void ath10k_sta_update_rx_duration(struct ath10k *ar,
 struct list_head *peer)
diff --git a/drivers/net/wireless/ath/ath10k/debugfs_sta.c 
b/drivers/net/wireless/ath/ath10k/debugfs_sta.c
index 67ef75b..4c459f2 100644
--- a/drivers/net/wireless/ath/ath10k/debugfs_sta.c
+++ b/drivers/net/wireless/ath/ath10k/debugfs_sta.c
@@ -35,6 +35,28 @@ void ath10k_sta_update_rx_duration(struct ath10k *ar, struct 
list_head *head)
rcu_read_unlock();
 }
 
+void ath10k_sta_statistics(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+  struct ieee80211_sta *sta,
+  struct station_info *sinfo)
+{
+   struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv;
+   struct ath10k *ar = arsta->arvif->ar;
+
+   mutex_lock(>conf_mutex);
+
+   if (ar->state != ATH10K_STATE_ON &&
+   ar->state != ATH10K_STATE_RESTARTED)
+   goto out;
+
+   if (!ath10k_peer_stats_enabled(ar))
+   goto out;
+
+   sinfo->rx_duration = arsta->rx_duration;
+   sinfo->filled |= 1ULL << NL80211_STA_INFO_RX_DURATION;
+out:
+   mutex_unlock(>conf_mutex);
+}
+
 static ssize_t ath10k_dbg_sta_read_aggr_mode(struct file *file,
 char __user *user_buf,
 size_t count, loff_t *ppos)
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index d5ef201..69a1dcf 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -6852,6 +6852,7 @@ static const struct ieee80211_ops ath10k_ops = {
 #endif
 #ifdef CONFIG_MAC80211_DEBUGFS
.sta_add_debugfs= ath10k_sta_add_debugfs,
+   .sta_statistics = ath10k_sta_statistics,
 #endif
 };
 
-- 
1.7.9.5

--
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: [PATCH v2 1/2] ath10k: Add support for ath10k_sta_statistics support

2016-03-19 Thread Mohammed Shafi Shajakhan
Hi Michal,

thanks for the comments ..

On Thu, Mar 17, 2016 at 12:35:00PM +0100, Michal Kazior wrote:
> On 17 March 2016 at 12:20, Mohammed Shafi Shajakhan
> <moham...@codeaurora.org> wrote:
> > Hi Michal,
> >
> > On Thu, Mar 17, 2016 at 12:12:31PM +0100, Michal Kazior wrote:
> >> On 17 March 2016 at 11:48, Mohammed Shafi Shajakhan
> >> <moham...@qti.qualcomm.com> wrote:
> >> [...]
> >> > +void ath10k_sta_statistics(struct ieee80211_hw *hw, struct 
> >> > ieee80211_vif *vif,
> >> > +  struct ieee80211_sta *sta,
> >> > +  struct station_info *sinfo)
> >> > +{
> >> > +   struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv;
> >> > +   struct ath10k *ar = arsta->arvif->ar;
> >> > +
> >> > +   mutex_lock(>conf_mutex);
> >> > +
> >> > +   if (ar->state != ATH10K_STATE_ON &&
> >> > +   ar->state != ATH10K_STATE_RESTARTED)
> >> > +   goto out;
> >>
> >> Do you really need mutex and ar->state check in this function?
> >>
> >
> > [shafi] By default peer stats will be disabled, we are enabling this by 
> > debugfs
> > (hw-restart) so i thought these checks are needed , please advise .. Do you 
> > say
> > they  will be never hit
> 
> Hmm.. I think mac80211 shouldn't call sta_statistics() before
> sta_state() during recovery (it makes no sense). In practice I think
> this isn't enforced in which case it's a mac80211 bug.

[shafi] sure i will check this. If the hardware is restarting there should
be no stations connected and station related info.

> 
> Anyway, this isn't much of a problem now. You only read out u64 from
> `arsta` (sta->drv_priv). Even if it's uninitialized/undefined there's
> no way for you to crash the system (it's not a list, spinlock or any
> other complex data structure). Worst case userspace will get garbage
> rx_duration value if it happens to get_station() while hw-restart is
> ongoing.

[shafi] will check this ..

> 
> It'd be good to verify this is actually a problem and - assuming you
> want to guarantee correct readouts at all times - to fix the problem
> in mac80211.
>
[shafi] ok, sure


-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


[PATCH v1 1/3] ath10k: Enable debugfs provision to enable Peer Stats feature

2016-03-19 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

Provide a debugfs entry to enable/ disable Peer Stats feature.
Peer Stats feature is for developers/users who are more interested
in studying in Rx/Tx stats with multiple clients connected, hence
disable this by default. Enabling this feature by default results
in unneccessary processing of Peer Stats event for every 500ms
and updating peer_stats list (allocating memory) and cleaning it up
ifexceeds the higher limit and this can be an unnecessary overhead
during long run stress testing.

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/core.c  |2 +-
 drivers/net/wireless/ath/ath10k/core.h  |   12 +
 drivers/net/wireless/ath/ath10k/debug.c |   80 +--
 drivers/net/wireless/ath/ath10k/mac.c   |2 +-
 drivers/net/wireless/ath/ath10k/wmi.c   |   12 ++---
 5 files changed, 94 insertions(+), 14 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 2389c07..02a5ce6 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1505,7 +1505,7 @@ static int ath10k_core_init_firmware_features(struct 
ath10k *ar)
case ATH10K_FW_WMI_OP_VERSION_10_1:
case ATH10K_FW_WMI_OP_VERSION_10_2:
case ATH10K_FW_WMI_OP_VERSION_10_2_4:
-   if (test_bit(WMI_SERVICE_PEER_STATS, ar->wmi.svc_map)) {
+   if (ath10k_peer_stats_enabled(ar)) {
ar->max_num_peers = TARGET_10X_TX_STATS_NUM_PEERS;
ar->max_num_stations = TARGET_10X_TX_STATS_NUM_STATIONS;
} else {
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 23ba03f..6923404 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -561,6 +561,9 @@ enum ath10k_dev_flags {
 
/* Bluetooth coexistance enabled */
ATH10K_FLAG_BTCOEX,
+
+   /* Per Station statistics service */
+   ATH10K_FLAG_PEER_STATS,
 };
 
 enum ath10k_cal_mode {
@@ -890,6 +893,15 @@ struct ath10k {
u8 drv_priv[0] __aligned(sizeof(void *));
 };
 
+static inline bool ath10k_peer_stats_enabled(struct ath10k *ar)
+{
+   if (test_bit(ATH10K_FLAG_PEER_STATS, >dev_flags) &&
+   test_bit(WMI_SERVICE_PEER_STATS, ar->wmi.svc_map))
+   return true;
+
+   return false;
+}
+
 struct ath10k *ath10k_core_create(size_t priv_size, struct device *dev,
  enum ath10k_bus bus,
  enum ath10k_hw_rev hw_rev,
diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index 076d29b..ff77fc1 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -319,7 +319,7 @@ static void ath10k_debug_fw_stats_reset(struct ath10k *ar)
 void ath10k_debug_fw_stats_process(struct ath10k *ar, struct sk_buff *skb)
 {
struct ath10k_fw_stats stats = {};
-   bool is_start, is_started, is_end, peer_stats_svc;
+   bool is_start, is_started, is_end;
size_t num_peers;
size_t num_vdevs;
int ret;
@@ -346,13 +346,11 @@ void ath10k_debug_fw_stats_process(struct ath10k *ar, 
struct sk_buff *skb)
 *  b) consume stat update events until another one with pdev stats is
 * delivered which is treated as end-of-data and is itself discarded
 */
-
-   peer_stats_svc = test_bit(WMI_SERVICE_PEER_STATS, ar->wmi.svc_map);
-   if (peer_stats_svc)
+   if (ath10k_peer_stats_enabled(ar))
ath10k_sta_update_rx_duration(ar, );
 
if (ar->debug.fw_stats_done) {
-   if (!peer_stats_svc)
+   if (!ath10k_peer_stats_enabled(ar))
ath10k_warn(ar, "received unsolicited stats update 
event\n");
 
goto free;
@@ -2174,6 +2172,73 @@ static const struct file_operations fops_btcoex = {
.open = simple_open
 };
 
+static ssize_t ath10k_write_peer_stats(struct file *file,
+  const char __user *ubuf,
+  size_t count, loff_t *ppos)
+{
+   struct ath10k *ar = file->private_data;
+   char buf[32];
+   size_t buf_size;
+   int ret = 0;
+   bool val;
+
+   buf_size = min(count, (sizeof(buf) - 1));
+   if (copy_from_user(buf, ubuf, buf_size))
+   return -EFAULT;
+
+   buf[buf_size] = '\0';
+
+   if (strtobool(buf, ) != 0)
+   return -EINVAL;
+
+   mutex_lock(>conf_mutex);
+
+   if (ar->state != ATH10K_STATE_ON &&
+   ar->state != ATH10K_STATE_RESTARTED) {
+   ret = -ENETDOWN;
+   goto exit;
+   }
+
+   if (!(test_bit(ATH10K_FLAG_PEER_

Re: [PATCH 2/2] ath10k: Enable parsing per station rx duration for 10.4

2016-03-19 Thread Mohammed Shafi Shajakhan
On Wed, Mar 16, 2016 at 10:22:22AM +, Valo, Kalle wrote:
> Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com> writes:
> 
> > From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
> >
> > Rx duration support for per station is part of extended peer
> > stats, enable provision to parse the same and provide backward
> > compatibility based on the 'stats_id' event
> >
> > Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
> 
> After fixing patch 1 this doesn't compile either. Please fix and resend
> both patches.

[shafi] sure, sorry for wasting your time, i think this dependent on the
patch "[PATCH v5] ath10k: Enable debugfs provision to enable Peer Stats
 feature" anyway i will resend them , with compile testing

> 
> drivers/net/wireless/ath/ath10k/core.c: In function 'ath10k_core_start':
> drivers/net/wireless/ath/ath10k/core.c:1787:3: error: implicit
> declaration of function 'ath10k_peer_stats_enabled'
> [-Werror=implicit-function-declaration]
> cc1: some warnings being treated as errors
> 
> -- 
> Kalle Valo
--
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


[PATCH v1 3/3] ath10k: Enable parsing per station rx duration for 10.4

2016-03-18 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

Rx duration support for per station is part of extended peer
stats, enable provision to parse the same and provide backward
compatibility based on the 'stats_id' event

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/core.c |   19 ++-
 drivers/net/wireless/ath/ath10k/wmi.c  |   30 --
 drivers/net/wireless/ath/ath10k/wmi.h  |   16 
 3 files changed, 58 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 02a5ce6..9d74a7d 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1534,7 +1534,8 @@ static int ath10k_core_init_firmware_features(struct 
ath10k *ar)
ar->num_active_peers = TARGET_10_4_ACTIVE_PEERS;
ar->max_num_vdevs = TARGET_10_4_NUM_VDEVS;
ar->num_tids = TARGET_10_4_TGT_NUM_TIDS;
-   ar->fw_stats_req_mask = WMI_STAT_PEER;
+   ar->fw_stats_req_mask = WMI_10_4_STAT_PEER |
+   WMI_10_4_STAT_PEER_EXTD;
ar->max_spatial_stream = ar->hw_params.max_spatial_stream;
 
if (test_bit(ATH10K_FW_FEATURE_PEER_FLOW_CONTROL,
@@ -1579,6 +1580,7 @@ static int ath10k_core_init_firmware_features(struct 
ath10k *ar)
 int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode)
 {
int status;
+   u32 val;
 
lockdep_assert_held(>conf_mutex);
 
@@ -1699,6 +1701,21 @@ int ath10k_core_start(struct ath10k *ar, enum 
ath10k_firmware_mode mode)
ath10k_dbg(ar, ATH10K_DBG_BOOT, "firmware %s booted\n",
   ar->hw->wiphy->fw_version);
 
+   if (test_bit(WMI_SERVICE_EXT_RES_CFG_SUPPORT, ar->wmi.svc_map)) {
+   val = 0;
+   if (ath10k_peer_stats_enabled(ar))
+   val = WMI_10_4_PEER_STATS;
+
+   status = ath10k_wmi_ext_resource_config(ar,
+   
WMI_HOST_PLATFORM_HIGH_PERF, val);
+   if (status) {
+   ath10k_err(ar,
+  "failed to send ext resource cfg command : 
%d\n",
+  status);
+   goto err_hif_stop;
+   }
+   }
+
status = ath10k_wmi_cmd_init(ar);
if (status) {
ath10k_err(ar, "could not send WMI init command (%d)\n",
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 0bcdd79..a52af7e 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -2632,6 +2632,16 @@ void ath10k_wmi_pull_peer_stats(const struct 
wmi_peer_stats *src,
dst->peer_tx_rate = __le32_to_cpu(src->peer_tx_rate);
 }
 
+static void
+ath10k_wmi_10_4_pull_peer_stats(const struct wmi_10_4_peer_stats *src,
+   struct ath10k_fw_stats_peer *dst)
+{
+   ether_addr_copy(dst->peer_macaddr, src->peer_macaddr.addr);
+   dst->peer_rssi = __le32_to_cpu(src->peer_rssi);
+   dst->peer_tx_rate = __le32_to_cpu(src->peer_tx_rate);
+   dst->peer_rx_rate = __le32_to_cpu(src->peer_rx_rate);
+}
+
 static int ath10k_wmi_main_op_pull_fw_stats(struct ath10k *ar,
struct sk_buff *skb,
struct ath10k_fw_stats *stats)
@@ -2922,6 +2932,7 @@ static int ath10k_wmi_10_4_op_pull_fw_stats(struct ath10k 
*ar,
u32 num_pdev_ext_stats;
u32 num_vdev_stats;
u32 num_peer_stats;
+   u32 stats_id;
int i;
 
if (!skb_pull(skb, sizeof(*ev)))
@@ -2931,6 +2942,7 @@ static int ath10k_wmi_10_4_op_pull_fw_stats(struct ath10k 
*ar,
num_pdev_ext_stats = __le32_to_cpu(ev->num_pdev_ext_stats);
num_vdev_stats = __le32_to_cpu(ev->num_vdev_stats);
num_peer_stats = __le32_to_cpu(ev->num_peer_stats);
+   stats_id = __le32_to_cpu(ev->stats_id);
 
for (i = 0; i < num_pdev_stats; i++) {
const struct wmi_10_4_pdev_stats *src;
@@ -2970,22 +2982,28 @@ static int ath10k_wmi_10_4_op_pull_fw_stats(struct 
ath10k *ar,
/* fw doesn't implement vdev stats */
 
for (i = 0; i < num_peer_stats; i++) {
-   const struct wmi_10_4_peer_stats *src;
+   const struct wmi_10_4_peer_extd_stats *src;
struct ath10k_fw_stats_peer *dst;
+   int stats_len;
+   bool extd_peer_stats = !!(stats_id & WMI_10_4_STAT_PEER_EXTD);
+
+   if (extd_peer_stats)
+   stats_len = sizeof(struct wmi_10_4_peer_extd_stats);
+   else
+ 

[PATCH v2 2/2] ath10k: Remove debugfs support for Per STA total rx duration

2016-03-18 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

cfg80211/nl80211 interface changes for per STA total rx-duration and
very basic 'ath10k_sta_statistics'  mac80211 callback is implemented
to extend support for per station statistics from the driver.

Also provision in 'iw dev wlan#N station dump' to parse rx-duration
is supported. So its safer to remove the debugfs entry for per STA
rx-duration

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
Dependencies:

1. cfg80211/nl80211: Add support for NL80211_STA_INFO_RX_DURATION
2. iw: Add support for NL80211_STA_INFO_RX_DURATION netlink.
3. ath10k: Add support for ath10k_sta_statistics support
4. ath10k: Enable debugfs provision to enable Peer Stats feature

 drivers/net/wireless/ath/ath10k/debugfs_sta.c |   24 
 1 file changed, 24 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/debugfs_sta.c 
b/drivers/net/wireless/ath/ath10k/debugfs_sta.c
index 4c459f2..0f24327 100644
--- a/drivers/net/wireless/ath/ath10k/debugfs_sta.c
+++ b/drivers/net/wireless/ath/ath10k/debugfs_sta.c
@@ -271,28 +271,6 @@ static const struct file_operations fops_delba = {
.llseek = default_llseek,
 };
 
-static ssize_t ath10k_dbg_sta_read_rx_duration(struct file *file,
-  char __user *user_buf,
-  size_t count, loff_t *ppos)
-{
-   struct ieee80211_sta *sta = file->private_data;
-   struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv;
-   char buf[100];
-   int len = 0;
-
-   len = scnprintf(buf, sizeof(buf),
-   "%llu usecs\n", arsta->rx_duration);
-
-   return simple_read_from_buffer(user_buf, count, ppos, buf, len);
-}
-
-static const struct file_operations fops_rx_duration = {
-   .read = ath10k_dbg_sta_read_rx_duration,
-   .open = simple_open,
-   .owner = THIS_MODULE,
-   .llseek = default_llseek,
-};
-
 void ath10k_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, struct dentry *dir)
 {
@@ -301,6 +279,4 @@ void ath10k_sta_add_debugfs(struct ieee80211_hw *hw, struct 
ieee80211_vif *vif,
debugfs_create_file("addba", S_IWUSR, dir, sta, _addba);
debugfs_create_file("addba_resp", S_IWUSR, dir, sta, _addba_resp);
debugfs_create_file("delba", S_IWUSR, dir, sta, _delba);
-   debugfs_create_file("rx_duration", S_IRUGO, dir, sta,
-   _rx_duration);
 }
-- 
1.7.9.5

--
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: [PATCH v5] ath10k: Enable debugfs provision to enable Peer Stats feature

2016-03-18 Thread Mohammed Shafi Shajakhan
Hi Kalle,

I had resent this change (to avoid any confusions with compilation issues)
as a part of the below series
[PATCH v1 1/3] ath10k: Enable debugfs provision to enable Peer Stats feature
[PATCH v1 2/3] ath10k: Introduce Extended Resource Config support
 for 10.4
[PATCH v1 3/3] ath10k: Enable parsing per station rx duration for
  10.4

Please let me know if there are any issues.

thanks,
shafi

On Fri, Feb 26, 2016 at 09:19:30PM +0530, Mohammed Shafi Shajakhan wrote:
> From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
> 
> Provide a debugfs entry to enable/ disable Peer Stats feature.
> Peer Stats feature is for developers/users who are more interested
> in studying in Rx/Tx stats with multiple clients connected, hence
> disable this by default. Enabling this feature by default results
> in unneccessary processing of Peer Stats event for every 500ms
> and updating peer_stats list (allocating memory) and cleaning it up
> ifexceeds the higher limit and this can be an unnecessary overhead
> during long run stress testing.
> 
> Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
> ---
> Dependencies:-
> 
> [PATCH] ath10k: Reduce number of peers to support peer stats feature
> (in upstream review)
> 
>   ath10k: Fix updating peer stats rx duration (in upstream review)
>   ath10k: Fix pointless update of peer stats list (in upstream review)
> 
>  drivers/net/wireless/ath/ath10k/core.c  |2 +-
>  drivers/net/wireless/ath/ath10k/core.h  |   12 +
>  drivers/net/wireless/ath/ath10k/debug.c |   80 
> +--
>  drivers/net/wireless/ath/ath10k/mac.c   |2 +-
>  drivers/net/wireless/ath/ath10k/wmi.c   |   12 ++---
>  5 files changed, 94 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath10k/core.c 
> b/drivers/net/wireless/ath/ath10k/core.c
> index c84c2d3..c4c31b2 100644
> --- a/drivers/net/wireless/ath/ath10k/core.c
> +++ b/drivers/net/wireless/ath/ath10k/core.c
> @@ -1509,7 +1509,7 @@ static int ath10k_core_init_firmware_features(struct 
> ath10k *ar)
>   case ATH10K_FW_WMI_OP_VERSION_10_1:
>   case ATH10K_FW_WMI_OP_VERSION_10_2:
>   case ATH10K_FW_WMI_OP_VERSION_10_2_4:
> - if (test_bit(WMI_SERVICE_PEER_STATS, ar->wmi.svc_map)) {
> + if (ath10k_peer_stats_enabled(ar)) {
>   ar->max_num_peers = TARGET_10X_TX_STATS_NUM_PEERS;
>   ar->max_num_stations = TARGET_10X_TX_STATS_NUM_STATIONS;
>   } else {
> diff --git a/drivers/net/wireless/ath/ath10k/core.h 
> b/drivers/net/wireless/ath/ath10k/core.h
> index a62b62a..cebf22c 100644
> --- a/drivers/net/wireless/ath/ath10k/core.h
> +++ b/drivers/net/wireless/ath/ath10k/core.h
> @@ -549,6 +549,9 @@ enum ath10k_dev_flags {
>  
>   /* Bluetooth coexistance enabled */
>   ATH10K_FLAG_BTCOEX,
> +
> + /* Per Station statistics service */
> + ATH10K_FLAG_PEER_STATS,
>  };
>  
>  enum ath10k_cal_mode {
> @@ -876,6 +879,15 @@ struct ath10k {
>   u8 drv_priv[0] __aligned(sizeof(void *));
>  };
>  
> +static inline bool ath10k_peer_stats_enabled(struct ath10k *ar)
> +{
> + if (test_bit(ATH10K_FLAG_PEER_STATS, >dev_flags) &&
> + test_bit(WMI_SERVICE_PEER_STATS, ar->wmi.svc_map))
> + return true;
> +
> + return false;
> +}
> +
>  struct ath10k *ath10k_core_create(size_t priv_size, struct device *dev,
> enum ath10k_bus bus,
> enum ath10k_hw_rev hw_rev,
> diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
> b/drivers/net/wireless/ath/ath10k/debug.c
> index 06581fa..406e8bc 100644
> --- a/drivers/net/wireless/ath/ath10k/debug.c
> +++ b/drivers/net/wireless/ath/ath10k/debug.c
> @@ -319,7 +319,7 @@ static void ath10k_debug_fw_stats_reset(struct ath10k *ar)
>  void ath10k_debug_fw_stats_process(struct ath10k *ar, struct sk_buff *skb)
>  {
>   struct ath10k_fw_stats stats = {};
> - bool is_start, is_started, is_end, peer_stats_svc;
> + bool is_start, is_started, is_end;
>   size_t num_peers;
>   size_t num_vdevs;
>   int ret;
> @@ -346,13 +346,11 @@ void ath10k_debug_fw_stats_process(struct ath10k *ar, 
> struct sk_buff *skb)
>*  b) consume stat update events until another one with pdev stats is
>* delivered which is treated as end-of-data and is itself discarded
>*/
> -
> - peer_stats_svc = test_bit(WMI_SERVICE_PEER_STATS, ar->wmi.svc_map);
> - if (peer_stats_svc)
> + if (ath10k_peer_stats_enabled(ar))
>   ath10k_sta_update_rx_duration(ar, );
>  
>   if (ar->debug.fw_stats_done)

[PATCH 0/2] Parsing per station rx duration for 10.4

2016-03-15 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

Peer Stats for 10.4 is enabled by Extended Resource Configuration
API (based on one of the earlier patch from Raja Mani), and parsing
of the same is based also 'stats_id' which also provides backward
compatibility with older f/w (or) ath10k by design

review help:

1. Fixed documentation related comments from Kalle / Michal
2. Fixed indentation related comments from Michal
3. Removed the check for excluding peer stats for test mode (Michal)
4. Fix checking for peer stats feature enabled

Dependency over

[PATCH v5] ath10k: Enable debugfs provision to enable Peer Stats

Mohammed Shafi Shajakhan (1):
  ath10k: Enable parsing per station rx duration for 10.4

Raja Mani (1):
  ath10k: Introduce Extended Resource Config support for 10.4

 drivers/net/wireless/ath/ath10k/core.c|   19 +-
 drivers/net/wireless/ath/ath10k/wmi-ops.h |   23 
 drivers/net/wireless/ath/ath10k/wmi.c |   54 +
 drivers/net/wireless/ath/ath10k/wmi.h |   49 +-
 4 files changed, 137 insertions(+), 8 deletions(-)

-- 
1.7.9.5

--
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


[PATCH 1/2] ath10k: Introduce Extended Resource Config support for 10.4

2016-03-15 Thread Mohammed Shafi Shajakhan
From: Raja Mani <rm...@qti.qualcomm.com>

Add API support for Extended Resource Configuration for 10.4. This
is useful to enable new features like Peer Stats, LTEU etc if the
firmware advertises support for the service. This is also done to
provide backward compatibility with older firmware. Also for clarity
send default host platform type as 'WMI_HOST_PLATFORM_HIGH_PERF',
though this should not make any difference in functionality

Signed-off-by: Raja Mani <rm...@qti.qualcomm.com>
Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/wmi-ops.h |   23 
 drivers/net/wireless/ath/ath10k/wmi.c |   24 +
 drivers/net/wireless/ath/ath10k/wmi.h |   33 -
 3 files changed, 79 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi-ops.h 
b/drivers/net/wireless/ath/ath10k/wmi-ops.h
index 32ab34e..7fb00dc 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-ops.h
+++ b/drivers/net/wireless/ath/ath10k/wmi-ops.h
@@ -186,6 +186,9 @@ struct wmi_ops {
u8 enable,
u32 detect_level,
u32 detect_margin);
+   struct sk_buff *(*ext_resource_config)(struct ath10k *ar,
+  enum wmi_host_platform_type type,
+  u32 fw_feature_bitmap);
int (*get_vdev_subtype)(struct ath10k *ar,
enum wmi_vdev_subtype subtype);
 };
@@ -1330,6 +1333,26 @@ ath10k_wmi_pdev_enable_adaptive_cca(struct ath10k *ar, 
u8 enable,
 }
 
 static inline int
+ath10k_wmi_ext_resource_config(struct ath10k *ar,
+  enum wmi_host_platform_type type,
+  u32 fw_feature_bitmap)
+{
+   struct sk_buff *skb;
+
+   if (!ar->wmi.ops->ext_resource_config)
+   return -EOPNOTSUPP;
+
+   skb = ar->wmi.ops->ext_resource_config(ar, type,
+  fw_feature_bitmap);
+
+   if (IS_ERR(skb))
+   return PTR_ERR(skb);
+
+   return ath10k_wmi_cmd_send(ar, skb,
+  ar->wmi.cmd->ext_resource_cfg_cmdid);
+}
+
+static inline int
 ath10k_wmi_get_vdev_subtype(struct ath10k *ar, enum wmi_vdev_subtype subtype)
 {
if (!ar->wmi.ops->get_vdev_subtype)
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index c260894..fcef9a0 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -705,6 +705,7 @@ static struct wmi_cmd_map wmi_10_4_cmd_map = {
.set_cca_params_cmdid = WMI_10_4_SET_CCA_PARAMS_CMDID,
.pdev_bss_chan_info_request_cmdid =
WMI_10_4_PDEV_BSS_CHAN_INFO_REQUEST_CMDID,
+   .ext_resource_cfg_cmdid = WMI_10_4_EXT_RESOURCE_CFG_CMDID,
 };
 
 /* MAIN WMI VDEV param map */
@@ -7509,6 +7510,28 @@ static int ath10k_wmi_10_4_op_get_vdev_subtype(struct 
ath10k *ar,
return -ENOTSUPP;
 }
 
+static struct sk_buff *
+ath10k_wmi_10_4_ext_resource_config(struct ath10k *ar,
+   enum wmi_host_platform_type type,
+   u32 fw_feature_bitmap)
+{
+   struct wmi_ext_resource_config_10_4_cmd *cmd;
+   struct sk_buff *skb;
+
+   skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
+   if (!skb)
+   return ERR_PTR(-ENOMEM);
+
+   cmd = (struct wmi_ext_resource_config_10_4_cmd *)skb->data;
+   cmd->host_platform_config = __cpu_to_le32(type);
+   cmd->fw_feature_bitmap = __cpu_to_le32(fw_feature_bitmap);
+
+   ath10k_dbg(ar, ATH10K_DBG_WMI,
+  "host platform type :%d firmware feature bitmap :%08x\n",
+  type, fw_feature_bitmap);
+   return skb;
+}
+
 static const struct wmi_ops wmi_ops = {
.rx = ath10k_wmi_op_rx,
.map_svc = wmi_main_svc_map,
@@ -7835,6 +7858,7 @@ static const struct wmi_ops wmi_10_4_ops = {
.gen_addba_set_resp = ath10k_wmi_op_gen_addba_set_resp,
.gen_delba_send = ath10k_wmi_op_gen_delba_send,
.fw_stats_fill = ath10k_wmi_10_4_op_fw_stats_fill,
+   .ext_resource_config = ath10k_wmi_10_4_ext_resource_config,
 
/* shared with 10.2 */
.gen_request_stats = ath10k_wmi_op_gen_request_stats,
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h 
b/drivers/net/wireless/ath/ath10k/wmi.h
index bb42f7a..1d3e085 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -816,6 +816,7 @@ struct wmi_cmd_map {
u32 set_cca_params_cmdid;
u32 pdev_bss_chan_info_request_cmdid;
u32 pdev_enable_adaptive_cca_cmdid;
+   u32 ext_resource_cfg_cmdid;
 };
 
 /*
@@ -2665

[PATCH 2/2] ath10k: Enable parsing per station rx duration for 10.4

2016-03-15 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

Rx duration support for per station is part of extended peer
stats, enable provision to parse the same and provide backward
compatibility based on the 'stats_id' event

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/core.c |   19 ++-
 drivers/net/wireless/ath/ath10k/wmi.c  |   30 --
 drivers/net/wireless/ath/ath10k/wmi.h  |   16 
 3 files changed, 58 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 2389c07..5e37e61 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1534,7 +1534,8 @@ static int ath10k_core_init_firmware_features(struct 
ath10k *ar)
ar->num_active_peers = TARGET_10_4_ACTIVE_PEERS;
ar->max_num_vdevs = TARGET_10_4_NUM_VDEVS;
ar->num_tids = TARGET_10_4_TGT_NUM_TIDS;
-   ar->fw_stats_req_mask = WMI_STAT_PEER;
+   ar->fw_stats_req_mask = WMI_10_4_STAT_PEER |
+   WMI_10_4_STAT_PEER_EXTD;
ar->max_spatial_stream = ar->hw_params.max_spatial_stream;
 
if (test_bit(ATH10K_FW_FEATURE_PEER_FLOW_CONTROL,
@@ -1579,6 +1580,7 @@ static int ath10k_core_init_firmware_features(struct 
ath10k *ar)
 int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode)
 {
int status;
+   u32 val;
 
lockdep_assert_held(>conf_mutex);
 
@@ -1699,6 +1701,21 @@ int ath10k_core_start(struct ath10k *ar, enum 
ath10k_firmware_mode mode)
ath10k_dbg(ar, ATH10K_DBG_BOOT, "firmware %s booted\n",
   ar->hw->wiphy->fw_version);
 
+   if (test_bit(WMI_SERVICE_EXT_RES_CFG_SUPPORT, ar->wmi.svc_map)) {
+   val = 0;
+   if (ath10k_peer_stats_enabled(ar))
+   val = WMI_10_4_PEER_STATS;
+
+   status = ath10k_wmi_ext_resource_config(ar,
+   
WMI_HOST_PLATFORM_HIGH_PERF, val);
+   if (status) {
+   ath10k_err(ar,
+  "failed to send ext resource cfg command : 
%d\n",
+  status);
+   goto err_hif_stop;
+   }
+   }
+
status = ath10k_wmi_cmd_init(ar);
if (status) {
ath10k_err(ar, "could not send WMI init command (%d)\n",
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index fcef9a0..7542ed8 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -2632,6 +2632,16 @@ void ath10k_wmi_pull_peer_stats(const struct 
wmi_peer_stats *src,
dst->peer_tx_rate = __le32_to_cpu(src->peer_tx_rate);
 }
 
+static void
+ath10k_wmi_10_4_pull_peer_stats(const struct wmi_10_4_peer_stats *src,
+   struct ath10k_fw_stats_peer *dst)
+{
+   ether_addr_copy(dst->peer_macaddr, src->peer_macaddr.addr);
+   dst->peer_rssi = __le32_to_cpu(src->peer_rssi);
+   dst->peer_tx_rate = __le32_to_cpu(src->peer_tx_rate);
+   dst->peer_rx_rate = __le32_to_cpu(src->peer_rx_rate);
+}
+
 static int ath10k_wmi_main_op_pull_fw_stats(struct ath10k *ar,
struct sk_buff *skb,
struct ath10k_fw_stats *stats)
@@ -2925,6 +2935,7 @@ static int ath10k_wmi_10_4_op_pull_fw_stats(struct ath10k 
*ar,
u32 num_pdev_ext_stats;
u32 num_vdev_stats;
u32 num_peer_stats;
+   u32 stats_id;
int i;
 
if (!skb_pull(skb, sizeof(*ev)))
@@ -2934,6 +2945,7 @@ static int ath10k_wmi_10_4_op_pull_fw_stats(struct ath10k 
*ar,
num_pdev_ext_stats = __le32_to_cpu(ev->num_pdev_ext_stats);
num_vdev_stats = __le32_to_cpu(ev->num_vdev_stats);
num_peer_stats = __le32_to_cpu(ev->num_peer_stats);
+   stats_id = __le32_to_cpu(ev->stats_id);
 
for (i = 0; i < num_pdev_stats; i++) {
const struct wmi_10_4_pdev_stats *src;
@@ -2973,22 +2985,28 @@ static int ath10k_wmi_10_4_op_pull_fw_stats(struct 
ath10k *ar,
/* fw doesn't implement vdev stats */
 
for (i = 0; i < num_peer_stats; i++) {
-   const struct wmi_10_4_peer_stats *src;
+   const struct wmi_10_4_peer_extd_stats *src;
struct ath10k_fw_stats_peer *dst;
+   int stats_len;
+   bool extd_peer_stats = !!(stats_id & WMI_10_4_STAT_PEER_EXTD);
+
+   if (extd_peer_stats)
+   stats_len = sizeof(struct wmi_10_4_peer_extd_stats);
+   else
+ 

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: [PATCH v1 1/2] ath10k: Add support for ath10k_sta_statistics support

2016-03-09 Thread Mohammed Shafi Shajakhan
On Wed, Mar 09, 2016 at 04:39:30PM +, Valo, Kalle wrote:
> kbuild test robot <l...@intel.com> writes:
> 
> > Hi Mohammed,
> >
> > [auto build test ERROR on wireless-drivers-next/master]
> > [also build test ERROR on next-20160309]
> > [cannot apply to v4.5-rc7]
> > [if your patch is applied to the wrong git tree, please drop us a note to 
> > help improving the system]
> >
> > url:
> > https://github.com/0day-ci/linux/commits/Mohammed-Shafi-Shajakhan/ath10k-Add-support-for-ath10k_sta_statistics-support/20160309-153522
> > base:   
> > https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git
> >  master
> > config: sparc64-allmodconfig (attached as .config)
> > reproduce:
> > wget 
> > https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
> >  -O ~/bin/make.cross
> > chmod +x ~/bin/make.cross
> > # save the attached .config to linux build tree
> > make.cross ARCH=sparc64 
> >
> > All errors (new ones prefixed by >>):
> >
> >drivers/net/wireless/ath/ath10k/debugfs_sta.c: In function 
> > 'ath10k_sta_statistics':
> >>> drivers/net/wireless/ath/ath10k/debugfs_sta.c:51:2: error: implicit 
> >>> declaration of function 'ath10k_peer_stats_enabled' 
> >>> [-Werror=implicit-function-declaration]
> >  if (!ath10k_peer_stats_enabled(ar))

[shafi] this is due to the dependency patch in ath10k "ath10k: Enable debugfs
provision to enable Peer Stats feature"

> >  ^
> >>> drivers/net/wireless/ath/ath10k/debugfs_sta.c:54:7: error: 'struct 
> >>> station_info' has no member named 'rx_duration'
> >  sinfo->rx_duration = arsta->rx_duration;
> >   ^
> >>> drivers/net/wireless/ath/ath10k/debugfs_sta.c:55:27: error: 
> >>> 'NL80211_STA_INFO_RX_DURATION' undeclared (first use in this function)
> >  sinfo->filled |= 1ULL << NL80211_STA_INFO_RX_DURATION;
> >   ^
> >drivers/net/wireless/ath/ath10k/debugfs_sta.c:55:27: note: each 
> > undeclared identifier is reported only once for each function it appears in
> >cc1: some warnings being treated as errors
> 
> This is expected as the patches depend on mac80211 patches.
>
[shafi] thanks Kalle !, yes correct .
--
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


[PATCH v3] cfg80211/nl80211: Add support for NL80211_STA_INFO_RX_DURATION

2016-03-09 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

Add support for new netlink attribute 'NL80211_STA_INFO_RX_DURATION'
This flag will be set when drivers can fill rx_duration (aggregate
PPDU duration(usecs) for all the frames from a peer) via
'drv_sta_statistics' callback

Also make sta_info flags 'filled' as 64 bit to accommodate for new
per station stats. Extend 'PUT_SINFO' for supporting rx_duration
field and any new per sta information in future

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
 include/net/cfg80211.h   |4 +++-
 include/uapi/linux/nl80211.h |3 +++
 net/wireless/nl80211.c   |3 ++-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 9bcaaf7..a9552f6 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1060,11 +1060,12 @@ struct cfg80211_tid_stats {
  * @rx_beacon: number of beacons received from this peer
  * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received
  * from this peer
+ * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer
  * @pertid: per-TID statistics, see  cfg80211_tid_stats, using the last
  * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
  */
 struct station_info {
-   u32 filled;
+   u64 filled;
u32 connected_time;
u32 inactive_time;
u64 rx_bytes;
@@ -1103,6 +1104,7 @@ struct station_info {
u32 expected_throughput;
 
u64 rx_beacon;
+   u64 rx_duration;
u8 rx_beacon_signal_avg;
struct cfg80211_tid_stats pertid[IEEE80211_NUM_TIDS + 1];
 };
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 5b7b5eb..361b2cd 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -2464,6 +2464,8 @@ enum nl80211_sta_bss_param {
  * TID+1 and the special TID 16 (i.e. value 17) is used for non-QoS frames;
  * each one of those is again nested with  nl80211_tid_stats
  * attributes carrying the actual values.
+ * @NL80211_STA_INFO_RX_DURATION: aggregate PPDU duration(usecs) for all the
+ * frames from a peer
  * @__NL80211_STA_INFO_AFTER_LAST: internal
  * @NL80211_STA_INFO_MAX: highest possible station info attribute
  */
@@ -2500,6 +2502,7 @@ enum nl80211_sta_info {
NL80211_STA_INFO_BEACON_RX,
NL80211_STA_INFO_BEACON_SIGNAL_AVG,
NL80211_STA_INFO_TID_STATS,
+   NL80211_STA_INFO_RX_DURATION,
 
/* keep last */
__NL80211_STA_INFO_AFTER_LAST,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index d4786f2..a81c016 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -3719,7 +3719,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32 
cmd, u32 portid,
goto nla_put_failure;
 
 #define PUT_SINFO(attr, memb, type) do {   \
-   if (sinfo->filled & BIT(NL80211_STA_INFO_ ## attr) &&   \
+   if (sinfo->filled & (1ULL << NL80211_STA_INFO_ ## attr) &&  \
nla_put_ ## type(msg, NL80211_STA_INFO_ ## attr,\
 sinfo->memb))  \
goto nla_put_failure;   \
@@ -3745,6 +3745,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32 
cmd, u32 portid,
PUT_SINFO(LLID, llid, u16);
PUT_SINFO(PLID, plid, u16);
PUT_SINFO(PLINK_STATE, plink_state, u8);
+   PUT_SINFO(RX_DURATION, rx_duration, u64);
 
switch (rdev->wiphy.signal_type) {
case CFG80211_SIGNAL_TYPE_MBM:
-- 
1.7.9.5

--
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


[PATCH v3] iw: Add support for NL80211_STA_INFO_RX_DURATION netlink attribute

2016-03-09 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

Enable support for parsing per station rx-duration (usecs)
via adding support for new netlink attribute NL80211_STA_INFO_RX_DURATION

rx_duration is aggregate PPDU duration(usecs) for all the frames
frames from a peer . This will get dumped as part of
'iw dev wlan#N station dump'

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
 nl80211.h |3 +++
 station.c |5 +
 2 files changed, 8 insertions(+)

diff --git a/nl80211.h b/nl80211.h
index 5b7b5eb..991b3ce 100644
--- a/nl80211.h
+++ b/nl80211.h
@@ -2464,6 +2464,8 @@ enum nl80211_sta_bss_param {
  * TID+1 and the special TID 16 (i.e. value 17) is used for non-QoS frames;
  * each one of those is again nested with  nl80211_tid_stats
  * attributes carrying the actual values.
+ * @NL80210_STA_INFO_RX_DURATION: aggregate PPDU duration(usecs) for all the
+ * frames from a peer
  * @__NL80211_STA_INFO_AFTER_LAST: internal
  * @NL80211_STA_INFO_MAX: highest possible station info attribute
  */
@@ -2500,6 +2502,7 @@ enum nl80211_sta_info {
NL80211_STA_INFO_BEACON_RX,
NL80211_STA_INFO_BEACON_SIGNAL_AVG,
NL80211_STA_INFO_TID_STATS,
+   NL80211_STA_INFO_RX_DURATION,
 
/* keep last */
__NL80211_STA_INFO_AFTER_LAST,
diff --git a/station.c b/station.c
index b5ccf4a..a730db1 100644
--- a/station.c
+++ b/station.c
@@ -147,6 +147,7 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
[NL80211_STA_INFO_NONPEER_PM] = { .type = NLA_U32},
[NL80211_STA_INFO_CHAIN_SIGNAL] = { .type = NLA_NESTED },
[NL80211_STA_INFO_CHAIN_SIGNAL_AVG] = { .type = NLA_NESTED },
+   [NL80211_STA_INFO_RX_DURATION] = { .type = NLA_U64 },
};
char *chain;
 
@@ -226,6 +227,10 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
printf("\n\trx bitrate:\t%s", buf);
}
 
+   if (sinfo[NL80211_STA_INFO_RX_DURATION])
+   printf("\n\trx duration:\t%lld us",
+  (unsigned long 
long)nla_get_u64(sinfo[NL80211_STA_INFO_RX_DURATION]));
+
if (sinfo[NL80211_STA_INFO_EXPECTED_THROUGHPUT]) {
uint32_t thr;
 
-- 
1.7.9.5

--
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


[PATCH v2] iw: Add support for NL80211_STA_INFO_RX_DURATION netlink attribute

2016-03-09 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

Enable support for parsing per station rx-duration (usecs)
via adding support for new netlink attribute NL80211_STA_INFO_RX_DURATION

rx_duration is aggregate PPDU duration(usecs) for all the frames
frames from a peer . This will get dumped as part of
'iw dev wlan#N station dump'

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
 nl80211.h |3 +++
 station.c |5 +
 2 files changed, 8 insertions(+)

diff --git a/nl80211.h b/nl80211.h
index 5b7b5eb..991b3ce 100644
--- a/nl80211.h
+++ b/nl80211.h
@@ -2464,6 +2464,8 @@ enum nl80211_sta_bss_param {
  * TID+1 and the special TID 16 (i.e. value 17) is used for non-QoS frames;
  * each one of those is again nested with  nl80211_tid_stats
  * attributes carrying the actual values.
+ * @NL80210_STA_INFO_RX_DURATION: aggregate PPDU duration(usecs) for all the
+ * frames from a peer
  * @__NL80211_STA_INFO_AFTER_LAST: internal
  * @NL80211_STA_INFO_MAX: highest possible station info attribute
  */
@@ -2500,6 +2502,7 @@ enum nl80211_sta_info {
NL80211_STA_INFO_BEACON_RX,
NL80211_STA_INFO_BEACON_SIGNAL_AVG,
NL80211_STA_INFO_TID_STATS,
+   NL80211_STA_INFO_RX_DURATION,
 
/* keep last */
__NL80211_STA_INFO_AFTER_LAST,
diff --git a/station.c b/station.c
index b5ccf4a..a730db1 100644
--- a/station.c
+++ b/station.c
@@ -147,6 +147,7 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
[NL80211_STA_INFO_NONPEER_PM] = { .type = NLA_U32},
[NL80211_STA_INFO_CHAIN_SIGNAL] = { .type = NLA_NESTED },
[NL80211_STA_INFO_CHAIN_SIGNAL_AVG] = { .type = NLA_NESTED },
+   [NL80211_STA_INFO_RX_DURATION] = { .type = NLA_U64 },
};
char *chain;
 
@@ -226,6 +227,10 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
printf("\n\trx bitrate:\t%s", buf);
}
 
+   if (sinfo[NL80211_STA_INFO_RX_DURATION])
+   printf("\n\trx duration:\t%lld us",
+  (unsigned long 
long)nla_get_u64(sinfo[NL80211_STA_INFO_RX_DURATION]));
+
if (sinfo[NL80211_STA_INFO_EXPECTED_THROUGHPUT]) {
uint32_t thr;
 
-- 
1.7.9.5

--
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


[PATCH v2] cfg80211/nl80211: Add support for NL80211_STA_INFO_RX_DURATION

2016-03-09 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

Add support for new netlink attribute 'NL80211_STA_INFO_RX_DURATION'
This flag will be set when drivers can fill rx_duration (aggregate
PPDU duration(usecs) for all the frames from a peer) via
'drv_sta_statistics' callback

Also make sta_info flags 'filled' as 64 bit to accommodate for new
per station stats. Extend 'PUT_SINFO' for supporting rx_duration
field and any new per sta information in future

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
 include/net/cfg80211.h   |4 +++-
 include/uapi/linux/nl80211.h |3 +++
 net/wireless/nl80211.c   |3 ++-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 9bcaaf7..a9552f6 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1060,11 +1060,12 @@ struct cfg80211_tid_stats {
  * @rx_beacon: number of beacons received from this peer
  * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received
  * from this peer
+ * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer
  * @pertid: per-TID statistics, see  cfg80211_tid_stats, using the last
  * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
  */
 struct station_info {
-   u32 filled;
+   u64 filled;
u32 connected_time;
u32 inactive_time;
u64 rx_bytes;
@@ -1103,6 +1104,7 @@ struct station_info {
u32 expected_throughput;
 
u64 rx_beacon;
+   u64 rx_duration;
u8 rx_beacon_signal_avg;
struct cfg80211_tid_stats pertid[IEEE80211_NUM_TIDS + 1];
 };
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 5b7b5eb..361b2cd 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -2464,6 +2464,8 @@ enum nl80211_sta_bss_param {
  * TID+1 and the special TID 16 (i.e. value 17) is used for non-QoS frames;
  * each one of those is again nested with  nl80211_tid_stats
  * attributes carrying the actual values.
+ * @NL80211_STA_INFO_RX_DURATION: aggregate ppdu duration(usecs) for all the
+ * frames from a peer
  * @__NL80211_STA_INFO_AFTER_LAST: internal
  * @NL80211_STA_INFO_MAX: highest possible station info attribute
  */
@@ -2500,6 +2502,7 @@ enum nl80211_sta_info {
NL80211_STA_INFO_BEACON_RX,
NL80211_STA_INFO_BEACON_SIGNAL_AVG,
NL80211_STA_INFO_TID_STATS,
+   NL80211_STA_INFO_RX_DURATION,
 
/* keep last */
__NL80211_STA_INFO_AFTER_LAST,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index d4786f2..a81c016 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -3719,7 +3719,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32 
cmd, u32 portid,
goto nla_put_failure;
 
 #define PUT_SINFO(attr, memb, type) do {   \
-   if (sinfo->filled & BIT(NL80211_STA_INFO_ ## attr) &&   \
+   if (sinfo->filled & (1ULL << NL80211_STA_INFO_ ## attr) &&  \
nla_put_ ## type(msg, NL80211_STA_INFO_ ## attr,\
 sinfo->memb))  \
goto nla_put_failure;   \
@@ -3745,6 +3745,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32 
cmd, u32 portid,
PUT_SINFO(LLID, llid, u16);
PUT_SINFO(PLID, plid, u16);
PUT_SINFO(PLINK_STATE, plink_state, u8);
+   PUT_SINFO(RX_DURATION, rx_duration, u64);
 
switch (rdev->wiphy.signal_type) {
case CFG80211_SIGNAL_TYPE_MBM:
-- 
1.7.9.5

--
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: [PATCH v2] cfg80211/nl80211: Add support for NL80211_STA_INFO_RX_DURATION

2016-03-09 Thread Mohammed Shafi Shajakhan
On Wed, Mar 09, 2016 at 12:18:25PM +0100, Johannes Berg wrote:
> On Wed, 2016-03-09 at 16:22 +0530, Mohammed Shafi Shajakhan wrote:
> > 
> > [shafi] ath10k implementation is based on PPDU duration calculation
> > and it does not includes any IFS duration.
> > 
> > So 'Energy' (time spent by the radio on receiving frames from a
> > particular peer) makes more sense right ?
> > 
> 
> Fine with me, perhaps just saying "aggregate PPDU duration" would be a
> good thing?
>

[shafi] thanks johannes, fine with me and I also confirmed with the person who 
implemented this for ath10k, she is also fine with this definition as well.

I will send a v3 updating the same as below:

"@rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer"

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: [PATCH v2] cfg80211/nl80211: Add support for NL80211_STA_INFO_RX_DURATION

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


On Wed, Mar 09, 2016 at 10:58:08AM +0100, Johannes Berg wrote:
> On Wed, 2016-03-09 at 15:08 +0530, Mohammed Shafi Shajakhan wrote:
> 
> > [shafi] Please suggest if this is ok ? I will be thankful
> > if you can suggest a better one if this is not ok
> > 
> > * @rx_duration: approximate total air time(usecs) for all the
> >  frames from a peer
> > 
> 
> That seems fine. We should perhaps specify the meaning of "air time"
> though. Is it allocated NAV time, or is it just time in which there was
> energy? With or without any IFS?
>

[shafi] ath10k implementation is based on PPDU duration calculation
and it does not includes any IFS duration.

So 'Energy' (time spent by the radio on receiving frames from a particular
peer) makes more sense right ?

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: [PATCH v2] cfg80211/nl80211: Add support for NL80211_STA_INFO_RX_DURATION

2016-03-09 Thread Mohammed Shafi Shajakhan
On Wed, Mar 09, 2016 at 10:30:03AM +0100, Johannes Berg wrote:
> On Wed, 2016-03-09 at 12:50 +0530, Mohammed Shafi Shajakhan wrote:
> > 
> > + * @rx_duration: approximate total air time(usecs) for all the
> > frames from a
> > + * connected client
> 
> I don't see why this should be restricted to "connected clients". The
> same value could be used for a mesh peer. Or TDLS peer. Or the AP on a
> managed connection. Or all the other types of STA.

[shafi] Please suggest if this is ok ? I will be thankful
if you can suggest a better one if this is not ok

* @rx_duration: approximate total air time(usecs) for all the
 frames from a peer

 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


[PATCH v2] iw: Add support for NL80211_STA_INFO_RX_DURATION netlink attribute

2016-03-08 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

Enable support for parsing per station rx-duration (usecs)
via adding support for new netlink attribute NL80211_STA_INFO_RX_DURATION

rx_duration is an approximate total air time(usecs) for all the frames
frames from a connected client. This will get dumped as
part of 'iw dev wlan#N station dump'

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
 nl80211.h |3 +++
 station.c |5 +
 2 files changed, 8 insertions(+)

diff --git a/nl80211.h b/nl80211.h
index 5b7b5eb..d11198f 100644
--- a/nl80211.h
+++ b/nl80211.h
@@ -2464,6 +2464,8 @@ enum nl80211_sta_bss_param {
  * TID+1 and the special TID 16 (i.e. value 17) is used for non-QoS frames;
  * each one of those is again nested with  nl80211_tid_stats
  * attributes carrying the actual values.
+ * @NL80210_STA_INFO_RX_DURATION: approximate total air time(usecs) for all the
+ * frames from a connected client
  * @__NL80211_STA_INFO_AFTER_LAST: internal
  * @NL80211_STA_INFO_MAX: highest possible station info attribute
  */
@@ -2500,6 +2502,7 @@ enum nl80211_sta_info {
NL80211_STA_INFO_BEACON_RX,
NL80211_STA_INFO_BEACON_SIGNAL_AVG,
NL80211_STA_INFO_TID_STATS,
+   NL80211_STA_INFO_RX_DURATION,
 
/* keep last */
__NL80211_STA_INFO_AFTER_LAST,
diff --git a/station.c b/station.c
index b5ccf4a..a730db1 100644
--- a/station.c
+++ b/station.c
@@ -147,6 +147,7 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
[NL80211_STA_INFO_NONPEER_PM] = { .type = NLA_U32},
[NL80211_STA_INFO_CHAIN_SIGNAL] = { .type = NLA_NESTED },
[NL80211_STA_INFO_CHAIN_SIGNAL_AVG] = { .type = NLA_NESTED },
+   [NL80211_STA_INFO_RX_DURATION] = { .type = NLA_U64 },
};
char *chain;
 
@@ -226,6 +227,10 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
printf("\n\trx bitrate:\t%s", buf);
}
 
+   if (sinfo[NL80211_STA_INFO_RX_DURATION])
+   printf("\n\trx duration:\t%lld us",
+  (unsigned long 
long)nla_get_u64(sinfo[NL80211_STA_INFO_RX_DURATION]));
+
if (sinfo[NL80211_STA_INFO_EXPECTED_THROUGHPUT]) {
uint32_t thr;
 
-- 
1.7.9.5

--
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


[PATCH v2] cfg80211/nl80211: Add support for NL80211_STA_INFO_RX_DURATION

2016-03-08 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

Add support for new netlink attribute 'NL80211_STA_INFO_RX_DURATION'
This flag will be set when drivers can fill rx_duration (approximate
total air time(usecs) for all the frames from a connected client) via
'drv_sta_statistics' callback

Also make sta_info flags 'filled' as 64 bit to accommodate for new
per station stats. Extend 'PUT_SINFO' for supporting rx_duration
field and any new per sta information in future

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
 include/net/cfg80211.h   |5 -
 include/uapi/linux/nl80211.h |3 +++
 net/wireless/nl80211.c   |3 ++-
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 9bcaaf7..7897162 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1060,11 +1060,13 @@ struct cfg80211_tid_stats {
  * @rx_beacon: number of beacons received from this peer
  * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received
  * from this peer
+ * @rx_duration: approximate total air time(usecs) for all the frames from a
+ * connected client
  * @pertid: per-TID statistics, see  cfg80211_tid_stats, using the last
  * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
  */
 struct station_info {
-   u32 filled;
+   u64 filled;
u32 connected_time;
u32 inactive_time;
u64 rx_bytes;
@@ -1103,6 +1105,7 @@ struct station_info {
u32 expected_throughput;
 
u64 rx_beacon;
+   u64 rx_duration;
u8 rx_beacon_signal_avg;
struct cfg80211_tid_stats pertid[IEEE80211_NUM_TIDS + 1];
 };
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 5b7b5eb..3de3975 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -2464,6 +2464,8 @@ enum nl80211_sta_bss_param {
  * TID+1 and the special TID 16 (i.e. value 17) is used for non-QoS frames;
  * each one of those is again nested with  nl80211_tid_stats
  * attributes carrying the actual values.
+ * @NL80211_STA_INFO_RX_DURATION: approximate total air time(usecs) for all the
+ * frames from a connected client
  * @__NL80211_STA_INFO_AFTER_LAST: internal
  * @NL80211_STA_INFO_MAX: highest possible station info attribute
  */
@@ -2500,6 +2502,7 @@ enum nl80211_sta_info {
NL80211_STA_INFO_BEACON_RX,
NL80211_STA_INFO_BEACON_SIGNAL_AVG,
NL80211_STA_INFO_TID_STATS,
+   NL80211_STA_INFO_RX_DURATION,
 
/* keep last */
__NL80211_STA_INFO_AFTER_LAST,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index d4786f2..a81c016 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -3719,7 +3719,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32 
cmd, u32 portid,
goto nla_put_failure;
 
 #define PUT_SINFO(attr, memb, type) do {   \
-   if (sinfo->filled & BIT(NL80211_STA_INFO_ ## attr) &&   \
+   if (sinfo->filled & (1ULL << NL80211_STA_INFO_ ## attr) &&  \
nla_put_ ## type(msg, NL80211_STA_INFO_ ## attr,\
 sinfo->memb))  \
goto nla_put_failure;   \
@@ -3745,6 +3745,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32 
cmd, u32 portid,
PUT_SINFO(LLID, llid, u16);
PUT_SINFO(PLID, plid, u16);
PUT_SINFO(PLINK_STATE, plink_state, u8);
+   PUT_SINFO(RX_DURATION, rx_duration, u64);
 
switch (rdev->wiphy.signal_type) {
case CFG80211_SIGNAL_TYPE_MBM:
-- 
1.7.9.5

--
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: [PATCH v1] cfg80211/nl80211: Add support for NL80211_STA_INFO_RX_DURATION

2016-03-08 Thread Mohammed Shafi Shajakhan
On Wed, Mar 09, 2016 at 12:09:15PM +0530, Mohammed Shafi Shajakhan wrote:
> Hi Johannes,
> 
> On Tue, Mar 08, 2016 at 05:52:23PM +0100, Johannes Berg wrote:
> > On Mon, 2016-03-07 at 16:33 +0530, Mohammed Shafi Shajakhan wrote:
> > > From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
> > > 
> > > Add support for new netlink attribute 'NL80211_STA_INFO_RX_DURATION'
> > > This flag will be set when drivers can fill rx_duration (vendor
> > > specific total air time(usecs) for data/management frames from the
> > > connected client) via 'drv_sta_statistics' callback
> > > 
> > > Also make sta_info flags 'filled' as 64 bit to accommodate for new
> > > per station stats. Extend 'PUT_SINFO' for supporting rx_duration
> > > field and any new per sta information in future
> > > 
> > > Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
> > > ---
> > > [v1] 
> > > 1. Fixed typo for accommodate
> > > 2. changed the doc for rx_duration as 'vendor specific
> > > implementation'
> > 
> > No, I want it defined for all cases, not left undefined.
> 
> [shafi] Let me know if the below documentation is fine with you please
> 
> "@rx_duration: approximate total air time(usecs) for all data/management
> frames from the connected client "

[shafi] correction (made it all frames (not only data/management frames)

 "@rx_duration: approximate total air time(usecs) for all frames
from the connected client "

> 
> thanks for reviewing this and Jouni for his initial suggestions.
> 
> 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-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 <moham...@qti.qualcomm.com>
> 
> 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 <moham...@qti.qualcomm.com>
> Signed-off-by: Anilkumar Kolli <ako...@qti.qualcomm.com>
> ---
>  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_pk

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

2016-03-07 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

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 <moham...@qti.qualcomm.com>
Signed-off-by: Anilkumar Kolli <ako...@qti.qualcomm.com>
---
 net/mac80211/Kconfig   |   12 +++
 net/mac80211/debugfs_sta.c |  231 
 net/mac80211/debugfs_sta.h |5 +
 net/mac80211/rx.c  |2 +
 net/mac80211/sta_info.h|   23 +
 5 files changed, 273 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..85c66ef 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -289,6 +289,136 @@ 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, &quo

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

2016-03-07 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

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 <moham...@qti.qualcomm.com>
Signed-off-by: Anilkumar Kolli <ako...@qti.qualcomm.com>
---
 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, &quo

[PATCH v1] cfg80211/nl80211: Add support for NL80211_STA_INFO_RX_DURATION

2016-03-07 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

Add support for new netlink attribute 'NL80211_STA_INFO_RX_DURATION'
This flag will be set when drivers can fill rx_duration (vendor
specific total air time(usecs) for data/management frames from the
connected client) via 'drv_sta_statistics' callback

Also make sta_info flags 'filled' as 64 bit to accommodate for new
per station stats. Extend 'PUT_SINFO' for supporting rx_duration
field and any new per sta information in future

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
[v1] 
1. Fixed typo for accommodate
2. changed the doc for rx_duration as 'vendor specific implementation'

 include/net/cfg80211.h   |5 -
 include/uapi/linux/nl80211.h |3 +++
 net/wireless/nl80211.c   |3 ++-
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 9bcaaf7..2db26a9 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1060,11 +1060,13 @@ struct cfg80211_tid_stats {
  * @rx_beacon: number of beacons received from this peer
  * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received
  * from this peer
+ * @rx_duration: vendor specific total air time(usecs) for data/management
+ * frames from the connected client
  * @pertid: per-TID statistics, see  cfg80211_tid_stats, using the last
  * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
  */
 struct station_info {
-   u32 filled;
+   u64 filled;
u32 connected_time;
u32 inactive_time;
u64 rx_bytes;
@@ -1103,6 +1105,7 @@ struct station_info {
u32 expected_throughput;
 
u64 rx_beacon;
+   u64 rx_duration;
u8 rx_beacon_signal_avg;
struct cfg80211_tid_stats pertid[IEEE80211_NUM_TIDS + 1];
 };
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 5b7b5eb..f64a854 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -2464,6 +2464,8 @@ enum nl80211_sta_bss_param {
  * TID+1 and the special TID 16 (i.e. value 17) is used for non-QoS frames;
  * each one of those is again nested with  nl80211_tid_stats
  * attributes carrying the actual values.
+ * @NL80211_STA_INFO_RX_DURATION: vendor specific total air time(usecs) for
+ * data/management frames from the connected client
  * @__NL80211_STA_INFO_AFTER_LAST: internal
  * @NL80211_STA_INFO_MAX: highest possible station info attribute
  */
@@ -2500,6 +2502,7 @@ enum nl80211_sta_info {
NL80211_STA_INFO_BEACON_RX,
NL80211_STA_INFO_BEACON_SIGNAL_AVG,
NL80211_STA_INFO_TID_STATS,
+   NL80211_STA_INFO_RX_DURATION,
 
/* keep last */
__NL80211_STA_INFO_AFTER_LAST,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index d4786f2..a81c016 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -3719,7 +3719,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32 
cmd, u32 portid,
goto nla_put_failure;
 
 #define PUT_SINFO(attr, memb, type) do {   \
-   if (sinfo->filled & BIT(NL80211_STA_INFO_ ## attr) &&   \
+   if (sinfo->filled & (1ULL << NL80211_STA_INFO_ ## attr) &&  \
nla_put_ ## type(msg, NL80211_STA_INFO_ ## attr,\
 sinfo->memb))  \
goto nla_put_failure;   \
@@ -3745,6 +3745,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32 
cmd, u32 portid,
PUT_SINFO(LLID, llid, u16);
PUT_SINFO(PLID, plid, u16);
PUT_SINFO(PLINK_STATE, plink_state, u8);
+   PUT_SINFO(RX_DURATION, rx_duration, u64);
 
switch (rdev->wiphy.signal_type) {
case CFG80211_SIGNAL_TYPE_MBM:
-- 
1.7.9.5

--
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


[PATCH v1] iw: Add support for NL80211_STA_INFO_RX_DURATION netlink attribute

2016-03-07 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

Enable support for parsing per station rx-duration (usecs)
via adding support for new netlink attribute NL80211_STA_INFO_RX_DURATION

rx_duration is vendor specific total air time(usecs) for data/management
frames from the connected client. This will get dumped as
part of 'iw dev wlan#N station dump'

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
[v1]

changed the doc for rx_duration as 'vendor specific implementation'

 nl80211.h |3 +++
 station.c |5 +
 2 files changed, 8 insertions(+)

diff --git a/nl80211.h b/nl80211.h
index 5b7b5eb..3aeb2c6 100644
--- a/nl80211.h
+++ b/nl80211.h
@@ -2464,6 +2464,8 @@ enum nl80211_sta_bss_param {
  * TID+1 and the special TID 16 (i.e. value 17) is used for non-QoS frames;
  * each one of those is again nested with  nl80211_tid_stats
  * attributes carrying the actual values.
+ * @NL80210_STA_INFO_RX_DURATION: vendor specific total airtime(usecs) for
+ * data/management frames from the connected client
  * @__NL80211_STA_INFO_AFTER_LAST: internal
  * @NL80211_STA_INFO_MAX: highest possible station info attribute
  */
@@ -2500,6 +2502,7 @@ enum nl80211_sta_info {
NL80211_STA_INFO_BEACON_RX,
NL80211_STA_INFO_BEACON_SIGNAL_AVG,
NL80211_STA_INFO_TID_STATS,
+   NL80211_STA_INFO_RX_DURATION,
 
/* keep last */
__NL80211_STA_INFO_AFTER_LAST,
diff --git a/station.c b/station.c
index b5ccf4a..a730db1 100644
--- a/station.c
+++ b/station.c
@@ -147,6 +147,7 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
[NL80211_STA_INFO_NONPEER_PM] = { .type = NLA_U32},
[NL80211_STA_INFO_CHAIN_SIGNAL] = { .type = NLA_NESTED },
[NL80211_STA_INFO_CHAIN_SIGNAL_AVG] = { .type = NLA_NESTED },
+   [NL80211_STA_INFO_RX_DURATION] = { .type = NLA_U64 },
};
char *chain;
 
@@ -226,6 +227,10 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
printf("\n\trx bitrate:\t%s", buf);
}
 
+   if (sinfo[NL80211_STA_INFO_RX_DURATION])
+   printf("\n\trx duration:\t%lld us",
+  (unsigned long 
long)nla_get_u64(sinfo[NL80211_STA_INFO_RX_DURATION]));
+
if (sinfo[NL80211_STA_INFO_EXPECTED_THROUGHPUT]) {
uint32_t thr;
 
-- 
1.7.9.5

--
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: [PATCH] cfg80211/nl80211: Add support for NL80211_STA_INFO_RX_DURATION

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

https://groups.google.com/a/chromium.org/forum/#!msg/chromium-os-reviews/lDzKxgl6fIE/H5GQfMcuBwAJ

for more information regarding the request for implementation. I will send a v2
re-phrasing that it is implementation specific.

regards,
shafi


On Thu, Mar 03, 2016 at 09:50:36PM +0530, Mohammed Shafi Shajakhan wrote:
> Hi johannes,
> 
> On Thu, Mar 03, 2016 at 05:07:51PM +0100, Johannes Berg wrote:
> > On Thu, 2016-03-03 at 21:30 +0530, Mohammed Shafi Shajakhan wrote:
> > 
> > > [shafi] This is part of the Per Station statistics requirement,
> > 
> > Heh. Whose requirements? :)
> 
> [shafi] We have this as part of ath10k debugfs based on the end user (or) a
> customer requirement and i think its make more sense to have this common 
> across all
> wifi drivers rather thank simply dumping it in ath10k debugfs. I think its
> similar to 'ieee80211_frame_duration'(?) in mac80211 but for drivers like 
> ath10k
> where this is calculated in firmware for rx and implementation specific.
> 
> > 
> > > the information from 'iw dev wlan#N station dump' which has
> > > rx_duration
> > > field will be used by application assesing the statistics
> > > /performance of various clients connected to our AP. We will plot
> > > a graph based on this information (assesing the rx time spent by
> > > AP for various clients).
> > > 
> > > > 
> > > > Are you really sure you mean "unicast"? What if the station is the
> > > > AP? Why wouldn't multicast frames it transmitted be accounted for?
> > > 
> > > [shafi] This is based on the implementation by the driver/firmware.
> > > We are focused on the AP side so unicast frames, if you are ok with
> > > this change, i can change the documentation to be specific (generic
> > > for all the drivers)  something like implementation specific (please
> > > advise)
> > 
> > Ok, but for AP side I don't see the difference between "unicast" and
> > "all frames", since all frames from that station should be unicast?
> > Apart, perhaps, from some management frames the station might send
> > outside the BSS, but that's not likely to matter much?
> 
> [shafi] exactly, I can change the documentation as you wish and
> this is implementation specific, and we have implemented like this in ath10k
> targeting AP mode.
> 
> > 
> > IOW, why not specify all frames, and let this make some sense for other
> > interface modes?
> >
> [shafi] Agreed.
> 
> 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: [PATCH] cfg80211/nl80211: Add support for NL80211_STA_INFO_RX_DURATION

2016-03-03 Thread Mohammed Shafi Shajakhan
Hi johannes,

On Thu, Mar 03, 2016 at 05:07:51PM +0100, Johannes Berg wrote:
> On Thu, 2016-03-03 at 21:30 +0530, Mohammed Shafi Shajakhan wrote:
> 
> > [shafi] This is part of the Per Station statistics requirement,
> 
> Heh. Whose requirements? :)

[shafi] We have this as part of ath10k debugfs based on the end user (or) a
customer requirement and i think its make more sense to have this common across 
all
wifi drivers rather thank simply dumping it in ath10k debugfs. I think its
similar to 'ieee80211_frame_duration'(?) in mac80211 but for drivers like ath10k
where this is calculated in firmware for rx and implementation specific.

> 
> > the information from 'iw dev wlan#N station dump' which has
> > rx_duration
> > field will be used by application assesing the statistics
> > /performance of various clients connected to our AP. We will plot
> > a graph based on this information (assesing the rx time spent by
> > AP for various clients).
> > 
> > > 
> > > Are you really sure you mean "unicast"? What if the station is the
> > > AP? Why wouldn't multicast frames it transmitted be accounted for?
> > 
> > [shafi] This is based on the implementation by the driver/firmware.
> > We are focused on the AP side so unicast frames, if you are ok with
> > this change, i can change the documentation to be specific (generic
> > for all the drivers)  something like implementation specific (please
> > advise)
> 
> Ok, but for AP side I don't see the difference between "unicast" and
> "all frames", since all frames from that station should be unicast?
> Apart, perhaps, from some management frames the station might send
> outside the BSS, but that's not likely to matter much?

[shafi] exactly, I can change the documentation as you wish and
this is implementation specific, and we have implemented like this in ath10k
targeting AP mode.

> 
> IOW, why not specify all frames, and let this make some sense for other
> interface modes?
>
[shafi] Agreed.

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


[PATCH 2/2] ath10k: Remove debugfs support for Per STA total rx duration

2016-03-02 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

cfg80211/nl80211 interface changes for per STA total rx-duration and
very basic 'ath10k_sta_statistics'  mac80211 callback is implemented
to extend support for per station statistics from the driver.

Also provision in 'iw dev wlan#N station dump' to parse rx-duration
is supported. So its safer to remove the debugfs entry for per STA
rx-duration

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
Dependencies:

1. cfg80211/nl80211: Add support for NL80211_STA_INFO_RX_DURATION
2. iw: Add support for NL80211_STA_INFO_RX_DURATION netlink.
3. ath10k: Add support for ath10k_sta_statistics support

 drivers/net/wireless/ath/ath10k/debugfs_sta.c |   24 
 1 file changed, 24 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/debugfs_sta.c 
b/drivers/net/wireless/ath/ath10k/debugfs_sta.c
index 8502cdb..083f259 100644
--- a/drivers/net/wireless/ath/ath10k/debugfs_sta.c
+++ b/drivers/net/wireless/ath/ath10k/debugfs_sta.c
@@ -271,28 +271,6 @@ static const struct file_operations fops_delba = {
.llseek = default_llseek,
 };
 
-static ssize_t ath10k_dbg_sta_read_rx_duration(struct file *file,
-  char __user *user_buf,
-  size_t count, loff_t *ppos)
-{
-   struct ieee80211_sta *sta = file->private_data;
-   struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv;
-   char buf[100];
-   int len = 0;
-
-   len = scnprintf(buf, sizeof(buf),
-   "%llu usecs\n", arsta->rx_duration);
-
-   return simple_read_from_buffer(user_buf, count, ppos, buf, len);
-}
-
-static const struct file_operations fops_rx_duration = {
-   .read = ath10k_dbg_sta_read_rx_duration,
-   .open = simple_open,
-   .owner = THIS_MODULE,
-   .llseek = default_llseek,
-};
-
 void ath10k_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, struct dentry *dir)
 {
@@ -301,6 +279,4 @@ void ath10k_sta_add_debugfs(struct ieee80211_hw *hw, struct 
ieee80211_vif *vif,
debugfs_create_file("addba", S_IWUSR, dir, sta, _addba);
debugfs_create_file("addba_resp", S_IWUSR, dir, sta, _addba_resp);
debugfs_create_file("delba", S_IWUSR, dir, sta, _delba);
-   debugfs_create_file("rx_duration", S_IRUGO, dir, sta,
-   _rx_duration);
 }
-- 
1.7.9.5

--
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


[PATCH 1/2] ath10k: Add support for ath10k_sta_statistics support

2016-03-02 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

Enable support for 'drv_sta_statistics' callback.
Export rx_duration support if available to cfg80211/nl80211

This can also act as a placeholder for any new per STA stats support

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
Dependencies:

1. cfg80211/nl80211: Add support for NL80211_STA_INFO_RX_DURATION
2. iw: Add support for NL80211_STA_INFO_RX_DURATION netlink
 attribute

 drivers/net/wireless/ath/ath10k/debug.h   |4 
 drivers/net/wireless/ath/ath10k/debugfs_sta.c |   22 ++
 drivers/net/wireless/ath/ath10k/mac.c |1 +
 3 files changed, 27 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/debug.h 
b/drivers/net/wireless/ath/ath10k/debug.h
index 6206edd..01c500f 100644
--- a/drivers/net/wireless/ath/ath10k/debug.h
+++ b/drivers/net/wireless/ath/ath10k/debug.h
@@ -155,6 +155,10 @@ ath10k_debug_get_new_fw_crash_data(struct ath10k *ar)
 void ath10k_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, struct dentry *dir);
 void ath10k_sta_update_rx_duration(struct ath10k *ar, struct list_head *peer);
+void ath10k_sta_statistics(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+  struct ieee80211_sta *sta,
+  struct station_info *sinfo);
+
 #else
 static inline void ath10k_sta_update_rx_duration(struct ath10k *ar,
 struct list_head *peer)
diff --git a/drivers/net/wireless/ath/ath10k/debugfs_sta.c 
b/drivers/net/wireless/ath/ath10k/debugfs_sta.c
index 67ef75b..8502cdb 100644
--- a/drivers/net/wireless/ath/ath10k/debugfs_sta.c
+++ b/drivers/net/wireless/ath/ath10k/debugfs_sta.c
@@ -35,6 +35,28 @@ void ath10k_sta_update_rx_duration(struct ath10k *ar, struct 
list_head *head)
rcu_read_unlock();
 }
 
+void ath10k_sta_statistics(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+  struct ieee80211_sta *sta,
+  struct station_info *sinfo)
+{
+   struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv;
+   struct ath10k *ar = arsta->arvif->ar;
+
+   mutex_lock(>conf_mutex);
+
+   if (ar->state != ATH10K_STATE_ON ||
+   ar->state != ATH10K_STATE_RESTARTED)
+   goto out;
+
+   if (!test_bit(WMI_SERVICE_PEER_STATS, ar->wmi.svc_map))
+   goto out;
+
+   sinfo->rx_duration = arsta->rx_duration;
+   sinfo->filled |= 1ULL << NL80211_STA_INFO_RX_DURATION;
+out:
+   mutex_unlock(>conf_mutex);
+}
+
 static ssize_t ath10k_dbg_sta_read_aggr_mode(struct file *file,
 char __user *user_buf,
 size_t count, loff_t *ppos)
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index d5ef201..69a1dcf 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -6852,6 +6852,7 @@ static const struct ieee80211_ops ath10k_ops = {
 #endif
 #ifdef CONFIG_MAC80211_DEBUGFS
.sta_add_debugfs= ath10k_sta_add_debugfs,
+   .sta_statistics = ath10k_sta_statistics,
 #endif
 };
 
-- 
1.7.9.5

--
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


[PATCH] iw: Add support for NL80211_STA_INFO_RX_DURATION netlink attribute

2016-03-02 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

Enable support for parsing per station rx-duration (usecs)
via adding support for new netlink attribute NL80211_STA_INFO_RX_DURATION

rx_duration is total air time(usecs) for unicast data/management frames
from the connected client. This will get dumped as part ofi
iw dev wlan#N station dump

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
 nl80211.h |3 +++
 station.c |5 +
 2 files changed, 8 insertions(+)

diff --git a/nl80211.h b/nl80211.h
index 5b7b5eb..f510206 100644
--- a/nl80211.h
+++ b/nl80211.h
@@ -2464,6 +2464,8 @@ enum nl80211_sta_bss_param {
  * TID+1 and the special TID 16 (i.e. value 17) is used for non-QoS frames;
  * each one of those is again nested with  nl80211_tid_stats
  * attributes carrying the actual values.
+ * @NL80210_STA_INFO_RX_DURATION: total rx time(usecs) spent for receiving data
+ * frames from this peer. This is driver/firmware implementation specific
  * @__NL80211_STA_INFO_AFTER_LAST: internal
  * @NL80211_STA_INFO_MAX: highest possible station info attribute
  */
@@ -2500,6 +2502,7 @@ enum nl80211_sta_info {
NL80211_STA_INFO_BEACON_RX,
NL80211_STA_INFO_BEACON_SIGNAL_AVG,
NL80211_STA_INFO_TID_STATS,
+   NL80211_STA_INFO_RX_DURATION,
 
/* keep last */
__NL80211_STA_INFO_AFTER_LAST,
diff --git a/station.c b/station.c
index b5ccf4a..a730db1 100644
--- a/station.c
+++ b/station.c
@@ -147,6 +147,7 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
[NL80211_STA_INFO_NONPEER_PM] = { .type = NLA_U32},
[NL80211_STA_INFO_CHAIN_SIGNAL] = { .type = NLA_NESTED },
[NL80211_STA_INFO_CHAIN_SIGNAL_AVG] = { .type = NLA_NESTED },
+   [NL80211_STA_INFO_RX_DURATION] = { .type = NLA_U64 },
};
char *chain;
 
@@ -226,6 +227,10 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
printf("\n\trx bitrate:\t%s", buf);
}
 
+   if (sinfo[NL80211_STA_INFO_RX_DURATION])
+   printf("\n\trx duration:\t%lld us",
+  (unsigned long 
long)nla_get_u64(sinfo[NL80211_STA_INFO_RX_DURATION]));
+
if (sinfo[NL80211_STA_INFO_EXPECTED_THROUGHPUT]) {
uint32_t thr;
 
-- 
1.7.9.5

--
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


[PATCH] cfg80211/nl80211: Add support for NL80211_STA_INFO_RX_DURATION

2016-03-02 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

Add support for new netlink attribute 'NL80211_STA_INFO_RX_DURATION'
This flag will be set when drivers can fill rx_duration ( approximate
total air time(usecs) for unicast data/management frames from the
connected client) via 'drv_sta_statistics' callback

Also make sta_info flags 'filled' as 64 bit to accomodate for new
per station stats. Extend 'PUT_SINFO' for supporting rx_duration
field and any new per sta information in future

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
 include/net/cfg80211.h   |5 -
 include/uapi/linux/nl80211.h |3 +++
 net/wireless/nl80211.c   |3 ++-
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 9bcaaf7..b8bf024 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1060,11 +1060,13 @@ struct cfg80211_tid_stats {
  * @rx_beacon: number of beacons received from this peer
  * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received
  * from this peer
+ * @rx_duration: approximate total air time(usecs) for unicast data/management
+ * frames from the connected client
  * @pertid: per-TID statistics, see  cfg80211_tid_stats, using the last
  * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
  */
 struct station_info {
-   u32 filled;
+   u64 filled;
u32 connected_time;
u32 inactive_time;
u64 rx_bytes;
@@ -1103,6 +1105,7 @@ struct station_info {
u32 expected_throughput;
 
u64 rx_beacon;
+   u64 rx_duration;
u8 rx_beacon_signal_avg;
struct cfg80211_tid_stats pertid[IEEE80211_NUM_TIDS + 1];
 };
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 5b7b5eb..1220a7b 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -2464,6 +2464,8 @@ enum nl80211_sta_bss_param {
  * TID+1 and the special TID 16 (i.e. value 17) is used for non-QoS frames;
  * each one of those is again nested with  nl80211_tid_stats
  * attributes carrying the actual values.
+ * @NL80211_STA_INFO_RX_DURATION: approximate total air time(usecs) for unicast
+ * data/management frames from the connected client
  * @__NL80211_STA_INFO_AFTER_LAST: internal
  * @NL80211_STA_INFO_MAX: highest possible station info attribute
  */
@@ -2500,6 +2502,7 @@ enum nl80211_sta_info {
NL80211_STA_INFO_BEACON_RX,
NL80211_STA_INFO_BEACON_SIGNAL_AVG,
NL80211_STA_INFO_TID_STATS,
+   NL80211_STA_INFO_RX_DURATION,
 
/* keep last */
__NL80211_STA_INFO_AFTER_LAST,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index d4786f2..a81c016 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -3719,7 +3719,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32 
cmd, u32 portid,
goto nla_put_failure;
 
 #define PUT_SINFO(attr, memb, type) do {   \
-   if (sinfo->filled & BIT(NL80211_STA_INFO_ ## attr) &&   \
+   if (sinfo->filled & (1ULL << NL80211_STA_INFO_ ## attr) &&  \
nla_put_ ## type(msg, NL80211_STA_INFO_ ## attr,\
 sinfo->memb))  \
goto nla_put_failure;   \
@@ -3745,6 +3745,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32 
cmd, u32 portid,
PUT_SINFO(LLID, llid, u16);
PUT_SINFO(PLID, plid, u16);
PUT_SINFO(PLINK_STATE, plink_state, u8);
+   PUT_SINFO(RX_DURATION, rx_duration, u64);
 
switch (rdev->wiphy.signal_type) {
case CFG80211_SIGNAL_TYPE_MBM:
-- 
1.7.9.5

--
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


[PATCH v5] ath10k: Enable debugfs provision to enable Peer Stats feature

2016-02-26 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

Provide a debugfs entry to enable/ disable Peer Stats feature.
Peer Stats feature is for developers/users who are more interested
in studying in Rx/Tx stats with multiple clients connected, hence
disable this by default. Enabling this feature by default results
in unneccessary processing of Peer Stats event for every 500ms
and updating peer_stats list (allocating memory) and cleaning it up
ifexceeds the higher limit and this can be an unnecessary overhead
during long run stress testing.

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
Dependencies:-

[PATCH] ath10k: Reduce number of peers to support peer stats feature
(in upstream review)

  ath10k: Fix updating peer stats rx duration (in upstream review)
  ath10k: Fix pointless update of peer stats list (in upstream review)

 drivers/net/wireless/ath/ath10k/core.c  |2 +-
 drivers/net/wireless/ath/ath10k/core.h  |   12 +
 drivers/net/wireless/ath/ath10k/debug.c |   80 +--
 drivers/net/wireless/ath/ath10k/mac.c   |2 +-
 drivers/net/wireless/ath/ath10k/wmi.c   |   12 ++---
 5 files changed, 94 insertions(+), 14 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index c84c2d3..c4c31b2 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1509,7 +1509,7 @@ static int ath10k_core_init_firmware_features(struct 
ath10k *ar)
case ATH10K_FW_WMI_OP_VERSION_10_1:
case ATH10K_FW_WMI_OP_VERSION_10_2:
case ATH10K_FW_WMI_OP_VERSION_10_2_4:
-   if (test_bit(WMI_SERVICE_PEER_STATS, ar->wmi.svc_map)) {
+   if (ath10k_peer_stats_enabled(ar)) {
ar->max_num_peers = TARGET_10X_TX_STATS_NUM_PEERS;
ar->max_num_stations = TARGET_10X_TX_STATS_NUM_STATIONS;
} else {
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index a62b62a..cebf22c 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -549,6 +549,9 @@ enum ath10k_dev_flags {
 
/* Bluetooth coexistance enabled */
ATH10K_FLAG_BTCOEX,
+
+   /* Per Station statistics service */
+   ATH10K_FLAG_PEER_STATS,
 };
 
 enum ath10k_cal_mode {
@@ -876,6 +879,15 @@ struct ath10k {
u8 drv_priv[0] __aligned(sizeof(void *));
 };
 
+static inline bool ath10k_peer_stats_enabled(struct ath10k *ar)
+{
+   if (test_bit(ATH10K_FLAG_PEER_STATS, >dev_flags) &&
+   test_bit(WMI_SERVICE_PEER_STATS, ar->wmi.svc_map))
+   return true;
+
+   return false;
+}
+
 struct ath10k *ath10k_core_create(size_t priv_size, struct device *dev,
  enum ath10k_bus bus,
  enum ath10k_hw_rev hw_rev,
diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index 06581fa..406e8bc 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -319,7 +319,7 @@ static void ath10k_debug_fw_stats_reset(struct ath10k *ar)
 void ath10k_debug_fw_stats_process(struct ath10k *ar, struct sk_buff *skb)
 {
struct ath10k_fw_stats stats = {};
-   bool is_start, is_started, is_end, peer_stats_svc;
+   bool is_start, is_started, is_end;
size_t num_peers;
size_t num_vdevs;
int ret;
@@ -346,13 +346,11 @@ void ath10k_debug_fw_stats_process(struct ath10k *ar, 
struct sk_buff *skb)
 *  b) consume stat update events until another one with pdev stats is
 * delivered which is treated as end-of-data and is itself discarded
 */
-
-   peer_stats_svc = test_bit(WMI_SERVICE_PEER_STATS, ar->wmi.svc_map);
-   if (peer_stats_svc)
+   if (ath10k_peer_stats_enabled(ar))
ath10k_sta_update_rx_duration(ar, );
 
if (ar->debug.fw_stats_done) {
-   if (!peer_stats_svc)
+   if (!ath10k_peer_stats_enabled(ar))
ath10k_warn(ar, "received unsolicited stats update 
event\n");
 
goto free;
@@ -2169,6 +2167,73 @@ static const struct file_operations fops_btcoex = {
.open = simple_open
 };
 
+static ssize_t ath10k_write_peer_stats(struct file *file,
+  const char __user *ubuf,
+  size_t count, loff_t *ppos)
+{
+   struct ath10k *ar = file->private_data;
+   char buf[32];
+   size_t buf_size;
+   int ret = 0;
+   bool val;
+
+   buf_size = min(count, (sizeof(buf) - 1));
+   if (copy_from_user(buf, ubuf, buf_size))
+   return -EFAULT;
+
+   buf[buf_size] = '\0';
+
+   if (strtobool(buf, ) != 0)
+   return -EINVAL;
+
+   mutex_lock(&g

[PATCH] ath10k: Fix sanity check on enabling btcoex via debugfs

2016-02-22 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

First check for the device state before enabling / disabling
btcoex, also return a proper error value. Enabling / disabling
btcoex ideally does a f/w + ath10k_core_restart so the checks
that are applicable for 'simulate_fw_crash' shall be applicable
for this as well

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/debug.c |   13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index 628b031..e3e29fb 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -2116,6 +2116,7 @@ static ssize_t ath10k_write_btcoex(struct file *file,
struct ath10k *ar = file->private_data;
char buf[32];
size_t buf_size;
+   int ret = 0;
bool val;
 
buf_size = min(count, (sizeof(buf) - 1));
@@ -2129,6 +2130,12 @@ static ssize_t ath10k_write_btcoex(struct file *file,
 
mutex_lock(>conf_mutex);
 
+   if (ar->state != ATH10K_STATE_ON &&
+   ar->state != ATH10K_STATE_RESTARTED) {
+   ret = -ENETDOWN;
+   goto exit;
+   }
+
if (!(test_bit(ATH10K_FLAG_BTCOEX, >dev_flags) ^ val))
goto exit;
 
@@ -2137,17 +2144,15 @@ static ssize_t ath10k_write_btcoex(struct file *file,
else
clear_bit(ATH10K_FLAG_BTCOEX, >dev_flags);
 
-   if (ar->state != ATH10K_STATE_ON)
-   goto exit;
-
ath10k_info(ar, "restarting firmware due to btcoex change");
 
queue_work(ar->workqueue, >restart_work);
+   ret = count;
 
 exit:
mutex_unlock(>conf_mutex);
 
-   return count;
+   return ret;
 }
 
 static ssize_t ath10k_read_btcoex(struct file *file, char __user *ubuf,
-- 
1.7.9.5

--
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


[PATCH 1/2] ath10k: Fix updating peer stats rx duration

2016-02-03 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

We are not updating peer stats rx_duration periodically
unless the user one polls for fw_stats, this is because
we discard the update event since pdev list is empty. Fix
this by updating rx duration periodically irrepective of checks
for pdev list (irrespective of ping-pong response)

Fixes: 856e7c3 ("ath10k: add debugfs support for Per STA total rx duration")
Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/debug.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index 8d4148a..d80a44e 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -348,6 +348,9 @@ void ath10k_debug_fw_stats_process(struct ath10k *ar, 
struct sk_buff *skb)
 */
 
peer_stats_svc = test_bit(WMI_SERVICE_PEER_STATS, ar->wmi.svc_map);
+   if (peer_stats_svc)
+   ath10k_sta_update_rx_duration(ar, );
+
if (ar->debug.fw_stats_done && !peer_stats_svc) {
ath10k_warn(ar, "received unsolicited stats update event\n");
goto free;
@@ -384,9 +387,6 @@ void ath10k_debug_fw_stats_process(struct ath10k *ar, 
struct sk_buff *skb)
goto free;
}
 
-   if (peer_stats_svc)
-   ath10k_sta_update_rx_duration(ar, );
-
list_splice_tail_init(, >debug.fw_stats.peers);
list_splice_tail_init(, >debug.fw_stats.vdevs);
}
-- 
1.7.9.5

--
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


[PATCH] ath10k: Remove unnecessary amsdu/ampdu assignment in debugfs

2015-11-30 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

The default values of max_num_amsdu / max_num_amdpu is assigned a
default value as part of 'ath10k_core_init_firmware_features'

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/debug.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index b502b7f..f635972f 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -1114,7 +1114,7 @@ static ssize_t ath10k_read_htt_max_amsdu_ampdu(struct 
file *file,
 {
struct ath10k *ar = file->private_data;
char buf[64];
-   u8 amsdu = 3, ampdu = 64;
+   u8 amsdu, ampdu;
unsigned int len;
 
mutex_lock(>conf_mutex);
-- 
1.7.9.5

--
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


[PATCH v2] ath10k: Fix write permission on few debugfs files

2015-11-24 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

Fix write permission for few of the debugfs entries
which support write file operations as well.

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/debug.c |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index 145c066..b502b7f 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -2185,8 +2185,8 @@ int ath10k_debug_register(struct ath10k *ar)
debugfs_create_file("wmi_services", S_IRUSR, ar->debug.debugfs_phy, ar,
_wmi_services);
 
-   debugfs_create_file("simulate_fw_crash", S_IRUSR, ar->debug.debugfs_phy,
-   ar, _simulate_fw_crash);
+   debugfs_create_file("simulate_fw_crash", S_IRUSR | S_IWUSR,
+   ar->debug.debugfs_phy, ar, _simulate_fw_crash);
 
debugfs_create_file("fw_crash_dump", S_IRUSR, ar->debug.debugfs_phy,
ar, _fw_crash_dump);
@@ -2203,15 +2203,15 @@ int ath10k_debug_register(struct ath10k *ar)
debugfs_create_file("chip_id", S_IRUSR, ar->debug.debugfs_phy,
ar, _chip_id);
 
-   debugfs_create_file("htt_stats_mask", S_IRUSR, ar->debug.debugfs_phy,
-   ar, _htt_stats_mask);
+   debugfs_create_file("htt_stats_mask", S_IRUSR | S_IWUSR,
+   ar->debug.debugfs_phy, ar, _htt_stats_mask);
 
debugfs_create_file("htt_max_amsdu_ampdu", S_IRUSR | S_IWUSR,
ar->debug.debugfs_phy, ar,
_htt_max_amsdu_ampdu);
 
-   debugfs_create_file("fw_dbglog", S_IRUSR, ar->debug.debugfs_phy,
-   ar, _fw_dbglog);
+   debugfs_create_file("fw_dbglog", S_IRUSR | S_IWUSR,
+   ar->debug.debugfs_phy, ar, _fw_dbglog);
 
debugfs_create_file("cal_data", S_IRUSR, ar->debug.debugfs_phy,
ar, _cal_data);
-- 
1.7.9.5

--
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


[PATCH] ath10k: Enable AP + STA interface combination support for 10.x

2015-11-21 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

Enable AP + STA interface combination support for 10.x and
this enables Repeater mode testing (with WDS Repeater combinations
as well). Fix indentation as well.

Based on the suggestions from Michal and Yanbo Li,
thanks to them

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/mac.c |   30 +-
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 79490ad..9652384 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -6766,35 +6766,39 @@ void ath10k_mac_destroy(struct ath10k *ar)
 
 static const struct ieee80211_iface_limit ath10k_if_limits[] = {
{
-   .max= 8,
-   .types  = BIT(NL80211_IFTYPE_STATION)
-   | BIT(NL80211_IFTYPE_P2P_CLIENT)
+   .max= 8,
+   .types  = BIT(NL80211_IFTYPE_STATION)
+   | BIT(NL80211_IFTYPE_P2P_CLIENT)
},
{
-   .max= 3,
-   .types  = BIT(NL80211_IFTYPE_P2P_GO)
+   .max= 3,
+   .types  = BIT(NL80211_IFTYPE_P2P_GO)
},
{
-   .max= 1,
-   .types  = BIT(NL80211_IFTYPE_P2P_DEVICE)
+   .max= 1,
+   .types  = BIT(NL80211_IFTYPE_P2P_DEVICE)
},
{
-   .max= 7,
-   .types  = BIT(NL80211_IFTYPE_AP)
+   .max= 7,
+   .types  = BIT(NL80211_IFTYPE_AP)
 #ifdef CONFIG_MAC80211_MESH
-   | BIT(NL80211_IFTYPE_MESH_POINT)
+   | BIT(NL80211_IFTYPE_MESH_POINT)
 #endif
},
 };
 
 static const struct ieee80211_iface_limit ath10k_10x_if_limits[] = {
{
-   .max= 8,
-   .types  = BIT(NL80211_IFTYPE_AP)
+   .max= 8,
+   .types  = BIT(NL80211_IFTYPE_AP)
 #ifdef CONFIG_MAC80211_MESH
-   | BIT(NL80211_IFTYPE_MESH_POINT)
+   | BIT(NL80211_IFTYPE_MESH_POINT)
 #endif
},
+   {
+   .max= 1,
+   .types  = BIT(NL80211_IFTYPE_STATION)
+   },
 };
 
 static const struct ieee80211_iface_combination ath10k_if_comb[] = {
-- 
1.7.9.5

--
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: [PATCH] ath10k: Adjust the RX packet pad offset at QCA99X0 4addr mode

2015-11-20 Thread Mohammed Shafi Shajakhan
Hi Kalle\Yanbo,

On Mon, Nov 16, 2015 at 10:57:44PM +0200, Kalle Valo wrote:
> "Li, Yanbo"  writes:
> 
> >> > +/* The padding bytes's location is different on various 
> >> > chips */
> >> > +enum ath10k_loc_4addr_pad loc_4addr_pad;
> >> 
> >> I think that loc prefix is a bit misleading, it reminds me of
> >> locationing/positioning etc. What about ath10k_hw_4addr_pad?
> >> 
> >
> >
> > There is already a FW feature defined as
> > "ATH10K_FW_FEATURE_NO_NWIFI_DECAP_4ADDR_PADDIND" and the relative
> > string is "no-4addr-pad", if we just remove the "loc" prefix, it may
> > be confuse with this FW feature.
> >
> > How about we change the loc to offset in this case or any better suggestion?
> 
> I did some naming changes in the pending branch:
> 
> https://git.kernel.org/cgit/linux/kernel/git/kvalo/ath.git/commit/?h=pending=42cd3832cd7c78bfeabb639a4086c7838fda5b57
> 
> Please review and let me know what you think.

Please merge this change, as this is a critical fix (I hope Yanbo is fine with
the change in naming convention). I went through the change, it looks good to
me and I had tested the earlier version and it fixed a Repeater mode bug.

regards,
shafi

> 
> -- 
> Kalle Valo
> --
> 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


[PATCH] ath10k: Fix cleanup in ath10k_thermal_unregister

2015-10-08 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

First remove the 'cooling_device#n' syslink created
for ath10k and then unregsiter from the thermal subsystem(cooling)

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/thermal.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/thermal.c 
b/drivers/net/wireless/ath/ath10k/thermal.c
index 1a899d7..60fe562 100644
--- a/drivers/net/wireless/ath/ath10k/thermal.c
+++ b/drivers/net/wireless/ath/ath10k/thermal.c
@@ -215,6 +215,6 @@ err_cooling_destroy:
 
 void ath10k_thermal_unregister(struct ath10k *ar)
 {
-   thermal_cooling_device_unregister(ar->thermal.cdev);
sysfs_remove_link(>dev->kobj, "cooling_device");
+   thermal_cooling_device_unregister(ar->thermal.cdev);
 }
-- 
1.7.9.5

--
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


[PATCH] mac80211: Fix hwflags debugfs file format

2015-10-08 Thread Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>

Commit 30686bf7f5b3 ("mac80211: convert HW flags to unsigned long
bitmap") accidentally removed the newline delimiter from the hwflags
debugfs file. Fix this by adding back the newline between the HW flags.

Signed-off-by: Mohammed Shafi Shajakhan <moham...@qti.qualcomm.com>
[fix commit log]
Signed-off-by: Jouni Malinen <jo...@qca.qualcomm.com>
---
 net/mac80211/debugfs.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c
index 3636b45..4d2aaeb 100644
--- a/net/mac80211/debugfs.c
+++ b/net/mac80211/debugfs.c
@@ -151,7 +151,7 @@ static ssize_t hwflags_read(struct file *file, char __user 
*user_buf,
 
for (i = 0; i < NUM_IEEE80211_HW_FLAGS; i++) {
if (test_bit(i, local->hw.flags))
-   pos += scnprintf(pos, end - pos, "%s",
+   pos += scnprintf(pos, end - pos, "%s\n",
 hw_flag_names[i]);
}
 
-- 
1.7.9.5

--
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


<    1   2