Commit 23c3aae4 authored by Ben Greear's avatar Ben Greear Committed by Kalle Valo

ath10k: add the Rx rate in FW stats

FW stats does provide the Rx rate information. Add this.
Tested with firmware 10x firmware.

Increase buffer size so more peers can be shown.
Signed-off-by: default avatarChun-Yeow Yeoh <yeohchunyeow@gmail.com>
Signed-off-by: default avatarBen Greear <greearb@candelatech.com>
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent db9cdda6
...@@ -119,6 +119,7 @@ struct ath10k_peer_stat { ...@@ -119,6 +119,7 @@ struct ath10k_peer_stat {
u8 peer_macaddr[ETH_ALEN]; u8 peer_macaddr[ETH_ALEN];
u32 peer_rssi; u32 peer_rssi;
u32 peer_tx_rate; u32 peer_tx_rate;
u32 peer_rx_rate; /* 10x only */
}; };
struct ath10k_target_stats { struct ath10k_target_stats {
......
...@@ -243,13 +243,13 @@ void ath10k_debug_read_target_stats(struct ath10k *ar, ...@@ -243,13 +243,13 @@ void ath10k_debug_read_target_stats(struct ath10k *ar,
} }
if (num_peer_stats) { if (num_peer_stats) {
struct wmi_peer_stats *peer_stats; struct wmi_peer_stats_10x *peer_stats;
struct ath10k_peer_stat *s; struct ath10k_peer_stat *s;
stats->peers = num_peer_stats; stats->peers = num_peer_stats;
for (i = 0; i < num_peer_stats; i++) { for (i = 0; i < num_peer_stats; i++) {
peer_stats = (struct wmi_peer_stats *)tmp; peer_stats = (struct wmi_peer_stats_10x *)tmp;
s = &stats->peer_stat[i]; s = &stats->peer_stat[i];
memcpy(s->peer_macaddr, &peer_stats->peer_macaddr.addr, memcpy(s->peer_macaddr, &peer_stats->peer_macaddr.addr,
...@@ -257,8 +257,15 @@ void ath10k_debug_read_target_stats(struct ath10k *ar, ...@@ -257,8 +257,15 @@ void ath10k_debug_read_target_stats(struct ath10k *ar,
s->peer_rssi = __le32_to_cpu(peer_stats->peer_rssi); s->peer_rssi = __le32_to_cpu(peer_stats->peer_rssi);
s->peer_tx_rate = s->peer_tx_rate =
__le32_to_cpu(peer_stats->peer_tx_rate); __le32_to_cpu(peer_stats->peer_tx_rate);
if (test_bit(ATH10K_FW_FEATURE_WMI_10X,
tmp += sizeof(struct wmi_peer_stats); ar->fw_features)) {
s->peer_rx_rate =
__le32_to_cpu(peer_stats->peer_rx_rate);
tmp += sizeof(struct wmi_peer_stats_10x);
} else {
tmp += sizeof(struct wmi_peer_stats_old);
}
} }
} }
...@@ -272,7 +279,7 @@ static ssize_t ath10k_read_fw_stats(struct file *file, char __user *user_buf, ...@@ -272,7 +279,7 @@ static ssize_t ath10k_read_fw_stats(struct file *file, char __user *user_buf,
struct ath10k *ar = file->private_data; struct ath10k *ar = file->private_data;
struct ath10k_target_stats *fw_stats; struct ath10k_target_stats *fw_stats;
char *buf = NULL; char *buf = NULL;
unsigned int len = 0, buf_len = 2500; unsigned int len = 0, buf_len = 8000;
ssize_t ret_cnt = 0; ssize_t ret_cnt = 0;
long left; long left;
int i; int i;
...@@ -411,8 +418,8 @@ static ssize_t ath10k_read_fw_stats(struct file *file, char __user *user_buf, ...@@ -411,8 +418,8 @@ static ssize_t ath10k_read_fw_stats(struct file *file, char __user *user_buf,
"MPDU errors (FCS, MIC, ENC)", fw_stats->mpdu_errs); "MPDU errors (FCS, MIC, ENC)", fw_stats->mpdu_errs);
len += scnprintf(buf + len, buf_len - len, "\n"); len += scnprintf(buf + len, buf_len - len, "\n");
len += scnprintf(buf + len, buf_len - len, "%30s\n", len += scnprintf(buf + len, buf_len - len, "%30s (%d)\n",
"ath10k PEER stats"); "ath10k PEER stats", fw_stats->peers);
len += scnprintf(buf + len, buf_len - len, "%30s\n\n", len += scnprintf(buf + len, buf_len - len, "%30s\n\n",
"================="); "=================");
...@@ -425,6 +432,9 @@ static ssize_t ath10k_read_fw_stats(struct file *file, char __user *user_buf, ...@@ -425,6 +432,9 @@ static ssize_t ath10k_read_fw_stats(struct file *file, char __user *user_buf,
len += scnprintf(buf + len, buf_len - len, "%30s %u\n", len += scnprintf(buf + len, buf_len - len, "%30s %u\n",
"Peer TX rate", "Peer TX rate",
fw_stats->peer_stat[i].peer_tx_rate); fw_stats->peer_stat[i].peer_tx_rate);
len += scnprintf(buf + len, buf_len - len, "%30s %u\n",
"Peer RX rate",
fw_stats->peer_stat[i].peer_rx_rate);
len += scnprintf(buf + len, buf_len - len, "\n"); len += scnprintf(buf + len, buf_len - len, "\n");
} }
spin_unlock_bh(&ar->data_lock); spin_unlock_bh(&ar->data_lock);
......
...@@ -2857,12 +2857,19 @@ struct wmi_vdev_stats { ...@@ -2857,12 +2857,19 @@ struct wmi_vdev_stats {
* peer statistics. * peer statistics.
* TODO: add more stats * TODO: add more stats
*/ */
struct wmi_peer_stats { struct wmi_peer_stats_old {
struct wmi_mac_addr peer_macaddr; struct wmi_mac_addr peer_macaddr;
__le32 peer_rssi; __le32 peer_rssi;
__le32 peer_tx_rate; __le32 peer_tx_rate;
} __packed; } __packed;
struct wmi_peer_stats_10x {
struct wmi_mac_addr peer_macaddr;
__le32 peer_rssi;
__le32 peer_tx_rate;
__le32 peer_rx_rate;
} __packed;
struct wmi_vdev_create_cmd { struct wmi_vdev_create_cmd {
__le32 vdev_id; __le32 vdev_id;
__le32 vdev_type; __le32 vdev_type;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment