aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorMohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>2016-03-16 08:43:32 -0400
committerKalle Valo <kvalo@qca.qualcomm.com>2016-03-23 08:54:10 -0400
commitcc61a1bbbc0ebbda3cc155bcbe164f4609fd62f6 (patch)
tree2c1776ab62442fc5a65cd685415a9446b61e15bc /drivers/net
parent3d9195ea19e4854d7daa11688b01905e244aead9 (diff)
ath10k: enable debugfs provision to enable Peer Stats feature
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 <mohammed@qti.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/ath/ath10k/core.c2
-rw-r--r--drivers/net/wireless/ath/ath10k/core.h12
-rw-r--r--drivers/net/wireless/ath/ath10k/debug.c80
-rw-r--r--drivers/net/wireless/ath/ath10k/mac.c2
-rw-r--r--drivers/net/wireless/ath/ath10k/wmi.c12
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 8b35e3adcee9..7a714d971615 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1586,7 +1586,7 @@ static int ath10k_core_init_firmware_features(struct ath10k *ar)
1586 case ATH10K_FW_WMI_OP_VERSION_10_1: 1586 case ATH10K_FW_WMI_OP_VERSION_10_1:
1587 case ATH10K_FW_WMI_OP_VERSION_10_2: 1587 case ATH10K_FW_WMI_OP_VERSION_10_2:
1588 case ATH10K_FW_WMI_OP_VERSION_10_2_4: 1588 case ATH10K_FW_WMI_OP_VERSION_10_2_4:
1589 if (test_bit(WMI_SERVICE_PEER_STATS, ar->wmi.svc_map)) { 1589 if (ath10k_peer_stats_enabled(ar)) {
1590 ar->max_num_peers = TARGET_10X_TX_STATS_NUM_PEERS; 1590 ar->max_num_peers = TARGET_10X_TX_STATS_NUM_PEERS;
1591 ar->max_num_stations = TARGET_10X_TX_STATS_NUM_STATIONS; 1591 ar->max_num_stations = TARGET_10X_TX_STATS_NUM_STATIONS;
1592 } else { 1592 } else {
diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index b6c157ef705a..c23c37312ef7 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 {
561 561
562 /* Bluetooth coexistance enabled */ 562 /* Bluetooth coexistance enabled */
563 ATH10K_FLAG_BTCOEX, 563 ATH10K_FLAG_BTCOEX,
564
565 /* Per Station statistics service */
566 ATH10K_FLAG_PEER_STATS,
564}; 567};
565 568
566enum ath10k_cal_mode { 569enum ath10k_cal_mode {
@@ -903,6 +906,15 @@ struct ath10k {
903 u8 drv_priv[0] __aligned(sizeof(void *)); 906 u8 drv_priv[0] __aligned(sizeof(void *));
904}; 907};
905 908
909static inline bool ath10k_peer_stats_enabled(struct ath10k *ar)
910{
911 if (test_bit(ATH10K_FLAG_PEER_STATS, &ar->dev_flags) &&
912 test_bit(WMI_SERVICE_PEER_STATS, ar->wmi.svc_map))
913 return true;
914
915 return false;
916}
917
906struct ath10k *ath10k_core_create(size_t priv_size, struct device *dev, 918struct ath10k *ath10k_core_create(size_t priv_size, struct device *dev,
907 enum ath10k_bus bus, 919 enum ath10k_bus bus,
908 enum ath10k_hw_rev hw_rev, 920 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 dec7e054b4b6..76bbe17b25b6 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -323,7 +323,7 @@ static void ath10k_debug_fw_stats_reset(struct ath10k *ar)
323void ath10k_debug_fw_stats_process(struct ath10k *ar, struct sk_buff *skb) 323void ath10k_debug_fw_stats_process(struct ath10k *ar, struct sk_buff *skb)
324{ 324{
325 struct ath10k_fw_stats stats = {}; 325 struct ath10k_fw_stats stats = {};
326 bool is_start, is_started, is_end, peer_stats_svc; 326 bool is_start, is_started, is_end;
327 size_t num_peers; 327 size_t num_peers;
328 size_t num_vdevs; 328 size_t num_vdevs;
329 int ret; 329 int ret;
@@ -350,13 +350,11 @@ void ath10k_debug_fw_stats_process(struct ath10k *ar, struct sk_buff *skb)
350 * b) consume stat update events until another one with pdev stats is 350 * b) consume stat update events until another one with pdev stats is
351 * delivered which is treated as end-of-data and is itself discarded 351 * delivered which is treated as end-of-data and is itself discarded
352 */ 352 */
353 353 if (ath10k_peer_stats_enabled(ar))
354 peer_stats_svc = test_bit(WMI_SERVICE_PEER_STATS, ar->wmi.svc_map);
355 if (peer_stats_svc)
356 ath10k_sta_update_rx_duration(ar, &stats.peers); 354 ath10k_sta_update_rx_duration(ar, &stats.peers);
357 355
358 if (ar->debug.fw_stats_done) { 356 if (ar->debug.fw_stats_done) {
359 if (!peer_stats_svc) 357 if (!ath10k_peer_stats_enabled(ar))
360 ath10k_warn(ar, "received unsolicited stats update event\n"); 358 ath10k_warn(ar, "received unsolicited stats update event\n");
361 359
362 goto free; 360 goto free;
@@ -2184,6 +2182,73 @@ static const struct file_operations fops_btcoex = {
2184 .open = simple_open 2182 .open = simple_open
2185}; 2183};
2186 2184
2185static ssize_t ath10k_write_peer_stats(struct file *file,
2186 const char __user *ubuf,
2187 size_t count, loff_t *ppos)
2188{
2189 struct ath10k *ar = file->private_data;
2190 char buf[32];
2191 size_t buf_size;
2192 int ret = 0;
2193 bool val;
2194
2195 buf_size = min(count, (sizeof(buf) - 1));
2196 if (copy_from_user(buf, ubuf, buf_size))
2197 return -EFAULT;
2198
2199 buf[buf_size] = '\0';
2200
2201 if (strtobool(buf, &val) != 0)
2202 return -EINVAL;
2203
2204 mutex_lock(&ar->conf_mutex);
2205
2206 if (ar->state != ATH10K_STATE_ON &&
2207 ar->state != ATH10K_STATE_RESTARTED) {
2208 ret = -ENETDOWN;
2209 goto exit;
2210 }
2211
2212 if (!(test_bit(ATH10K_FLAG_PEER_STATS, &ar->dev_flags) ^ val))
2213 goto exit;
2214
2215 if (val)
2216 set_bit(ATH10K_FLAG_PEER_STATS, &ar->dev_flags);
2217 else
2218 clear_bit(ATH10K_FLAG_PEER_STATS, &ar->dev_flags);
2219
2220 ath10k_info(ar, "restarting firmware due to Peer stats change");
2221
2222 queue_work(ar->workqueue, &ar->restart_work);
2223 ret = count;
2224
2225exit:
2226 mutex_unlock(&ar->conf_mutex);
2227 return ret;
2228}
2229
2230static ssize_t ath10k_read_peer_stats(struct file *file, char __user *ubuf,
2231 size_t count, loff_t *ppos)
2232
2233{
2234 char buf[32];
2235 struct ath10k *ar = file->private_data;
2236 int len = 0;
2237
2238 mutex_lock(&ar->conf_mutex);
2239 len = scnprintf(buf, sizeof(buf) - len, "%d\n",
2240 test_bit(ATH10K_FLAG_PEER_STATS, &ar->dev_flags));
2241 mutex_unlock(&ar->conf_mutex);
2242
2243 return simple_read_from_buffer(ubuf, count, ppos, buf, len);
2244}
2245
2246static const struct file_operations fops_peer_stats = {
2247 .read = ath10k_read_peer_stats,
2248 .write = ath10k_write_peer_stats,
2249 .open = simple_open
2250};
2251
2187static ssize_t ath10k_debug_fw_checksums_read(struct file *file, 2252static ssize_t ath10k_debug_fw_checksums_read(struct file *file,
2188 char __user *user_buf, 2253 char __user *user_buf,
2189 size_t count, loff_t *ppos) 2254 size_t count, loff_t *ppos)
@@ -2347,6 +2412,11 @@ int ath10k_debug_register(struct ath10k *ar)
2347 debugfs_create_file("btcoex", S_IRUGO | S_IWUSR, 2412 debugfs_create_file("btcoex", S_IRUGO | S_IWUSR,
2348 ar->debug.debugfs_phy, ar, &fops_btcoex); 2413 ar->debug.debugfs_phy, ar, &fops_btcoex);
2349 2414
2415 if (test_bit(WMI_SERVICE_PEER_STATS, ar->wmi.svc_map))
2416 debugfs_create_file("peer_stats", S_IRUGO | S_IWUSR,
2417 ar->debug.debugfs_phy, ar,
2418 &fops_peer_stats);
2419
2350 debugfs_create_file("fw_checksums", S_IRUSR, 2420 debugfs_create_file("fw_checksums", S_IRUSR,
2351 ar->debug.debugfs_phy, ar, &fops_fw_checksums); 2421 ar->debug.debugfs_phy, ar, &fops_fw_checksums);
2352 2422
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index ed00853ea9cc..20d72e29dfa1 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -4435,7 +4435,7 @@ static int ath10k_start(struct ieee80211_hw *hw)
4435 4435
4436 ar->ani_enabled = true; 4436 ar->ani_enabled = true;
4437 4437
4438 if (test_bit(WMI_SERVICE_PEER_STATS, ar->wmi.svc_map)) { 4438 if (ath10k_peer_stats_enabled(ar)) {
4439 param = ar->wmi.pdev_param->peer_stats_update_period; 4439 param = ar->wmi.pdev_param->peer_stats_update_period;
4440 ret = ath10k_wmi_pdev_set_param(ar, param, 4440 ret = ath10k_wmi_pdev_set_param(ar, param,
4441 PEER_DEFAULT_STATS_UPDATE_PERIOD); 4441 PEER_DEFAULT_STATS_UPDATE_PERIOD);
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 91375664dc35..afed9dab74f4 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -2856,11 +2856,8 @@ static int ath10k_wmi_10_2_4_op_pull_fw_stats(struct ath10k *ar,
2856 const struct wmi_10_2_4_ext_peer_stats *src; 2856 const struct wmi_10_2_4_ext_peer_stats *src;
2857 struct ath10k_fw_stats_peer *dst; 2857 struct ath10k_fw_stats_peer *dst;
2858 int stats_len; 2858 int stats_len;
2859 bool ext_peer_stats_support;
2860 2859
2861 ext_peer_stats_support = test_bit(WMI_SERVICE_PEER_STATS, 2860 if (test_bit(WMI_SERVICE_PEER_STATS, ar->wmi.svc_map))
2862 ar->wmi.svc_map);
2863 if (ext_peer_stats_support)
2864 stats_len = sizeof(struct wmi_10_2_4_ext_peer_stats); 2861 stats_len = sizeof(struct wmi_10_2_4_ext_peer_stats);
2865 else 2862 else
2866 stats_len = sizeof(struct wmi_10_2_4_peer_stats); 2863 stats_len = sizeof(struct wmi_10_2_4_peer_stats);
@@ -2877,7 +2874,7 @@ static int ath10k_wmi_10_2_4_op_pull_fw_stats(struct ath10k *ar,
2877 2874
2878 dst->peer_rx_rate = __le32_to_cpu(src->common.peer_rx_rate); 2875 dst->peer_rx_rate = __le32_to_cpu(src->common.peer_rx_rate);
2879 2876
2880 if (ext_peer_stats_support) 2877 if (ath10k_peer_stats_enabled(ar))
2881 dst->rx_duration = __le32_to_cpu(src->rx_duration); 2878 dst->rx_duration = __le32_to_cpu(src->rx_duration);
2882 /* FIXME: expose 10.2 specific values */ 2879 /* FIXME: expose 10.2 specific values */
2883 2880
@@ -5514,7 +5511,8 @@ static struct sk_buff *ath10k_wmi_10_2_op_gen_init(struct ath10k *ar)
5514 5511
5515 config.num_vdevs = __cpu_to_le32(TARGET_10X_NUM_VDEVS); 5512 config.num_vdevs = __cpu_to_le32(TARGET_10X_NUM_VDEVS);
5516 config.num_peer_keys = __cpu_to_le32(TARGET_10X_NUM_PEER_KEYS); 5513 config.num_peer_keys = __cpu_to_le32(TARGET_10X_NUM_PEER_KEYS);
5517 if (test_bit(WMI_SERVICE_PEER_STATS, ar->wmi.svc_map)) { 5514
5515 if (ath10k_peer_stats_enabled(ar)) {
5518 config.num_peers = __cpu_to_le32(TARGET_10X_TX_STATS_NUM_PEERS); 5516 config.num_peers = __cpu_to_le32(TARGET_10X_TX_STATS_NUM_PEERS);
5519 config.num_tids = __cpu_to_le32(TARGET_10X_TX_STATS_NUM_TIDS); 5517 config.num_tids = __cpu_to_le32(TARGET_10X_TX_STATS_NUM_TIDS);
5520 } else { 5518 } else {
@@ -5576,7 +5574,7 @@ static struct sk_buff *ath10k_wmi_10_2_op_gen_init(struct ath10k *ar)
5576 test_bit(WMI_SERVICE_COEX_GPIO, ar->wmi.svc_map)) 5574 test_bit(WMI_SERVICE_COEX_GPIO, ar->wmi.svc_map))
5577 features |= WMI_10_2_COEX_GPIO; 5575 features |= WMI_10_2_COEX_GPIO;
5578 5576
5579 if (test_bit(WMI_SERVICE_PEER_STATS, ar->wmi.svc_map)) 5577 if (ath10k_peer_stats_enabled(ar))
5580 features |= WMI_10_2_PEER_STATS; 5578 features |= WMI_10_2_PEER_STATS;
5581 5579
5582 cmd->resource_config.feature_mask = __cpu_to_le32(features); 5580 cmd->resource_config.feature_mask = __cpu_to_le32(features);