Commit 3f617281 authored by Luciano Coelho's avatar Luciano Coelho Committed by Johannes Berg

iwlwifi: mvm: fix fw_rx_stats debugfs entry

The fw_rx_stats entry in debugfs was getting truncated because the
internal buffer used to hold the string was too short.  The
calculation of the needed buffer size was rather bogus.

Simplify the calculation by multiplying the number of entries in the
entire structure by the size of each data line and adding the size of
the header lines.

Additionally, add the mac_id value, which was missing.
Signed-off-by: default avatarLuciano Coelho <luciano.coelho@intel.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 0af8835e
...@@ -654,9 +654,11 @@ static ssize_t iwl_dbgfs_fw_rx_stats_read(struct file *file, ...@@ -654,9 +654,11 @@ static ssize_t iwl_dbgfs_fw_rx_stats_read(struct file *file,
int pos = 0; int pos = 0;
char *buf; char *buf;
int ret; int ret;
int bufsz = sizeof(struct mvm_statistics_rx_phy) * 20 + /* 43 is the size of each data line, 33 is the size of each header */
sizeof(struct mvm_statistics_rx_non_phy) * 10 + size_t bufsz =
sizeof(struct mvm_statistics_rx_ht_phy) * 10 + 200; ((sizeof(struct mvm_statistics_rx) / sizeof(__le32)) * 43) +
(4 * 33) + 1;
struct mvm_statistics_rx_phy *ofdm; struct mvm_statistics_rx_phy *ofdm;
struct mvm_statistics_rx_phy *cck; struct mvm_statistics_rx_phy *cck;
struct mvm_statistics_rx_non_phy *general; struct mvm_statistics_rx_non_phy *general;
...@@ -751,6 +753,7 @@ static ssize_t iwl_dbgfs_fw_rx_stats_read(struct file *file, ...@@ -751,6 +753,7 @@ static ssize_t iwl_dbgfs_fw_rx_stats_read(struct file *file,
PRINT_STATS_LE32("beacon_energy_b", general->beacon_energy_b); PRINT_STATS_LE32("beacon_energy_b", general->beacon_energy_b);
PRINT_STATS_LE32("beacon_energy_c", general->beacon_energy_c); PRINT_STATS_LE32("beacon_energy_c", general->beacon_energy_c);
PRINT_STATS_LE32("num_bt_kills", general->num_bt_kills); PRINT_STATS_LE32("num_bt_kills", general->num_bt_kills);
PRINT_STATS_LE32("mac_id", general->mac_id);
PRINT_STATS_LE32("directed_data_mpdu", general->directed_data_mpdu); PRINT_STATS_LE32("directed_data_mpdu", general->directed_data_mpdu);
pos += scnprintf(buf + pos, bufsz - pos, fmt_header, pos += scnprintf(buf + pos, bufsz - pos, fmt_header,
......
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