162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 262306a36Sopenharmony_ci/****************************************************************************** 362306a36Sopenharmony_ci* 462306a36Sopenharmony_ci* Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 562306a36Sopenharmony_ci* 662306a36Sopenharmony_ci* Contact Information: 762306a36Sopenharmony_ci* Intel Linux Wireless <ilw@linux.intel.com> 862306a36Sopenharmony_ci* Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 962306a36Sopenharmony_ci*****************************************************************************/ 1062306a36Sopenharmony_ci#include "common.h" 1162306a36Sopenharmony_ci#include "4965.h" 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_cistatic const char *fmt_value = " %-30s %10u\n"; 1462306a36Sopenharmony_cistatic const char *fmt_table = " %-30s %10u %10u %10u %10u\n"; 1562306a36Sopenharmony_cistatic const char *fmt_header = 1662306a36Sopenharmony_ci "%-32s current cumulative delta max\n"; 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_cistatic int 1962306a36Sopenharmony_ciil4965_stats_flag(struct il_priv *il, char *buf, int bufsz) 2062306a36Sopenharmony_ci{ 2162306a36Sopenharmony_ci int p = 0; 2262306a36Sopenharmony_ci u32 flag; 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ci flag = le32_to_cpu(il->_4965.stats.flag); 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ci p += scnprintf(buf + p, bufsz - p, "Statistics Flag(0x%X):\n", flag); 2762306a36Sopenharmony_ci if (flag & UCODE_STATS_CLEAR_MSK) 2862306a36Sopenharmony_ci p += scnprintf(buf + p, bufsz - p, 2962306a36Sopenharmony_ci "\tStatistics have been cleared\n"); 3062306a36Sopenharmony_ci p += scnprintf(buf + p, bufsz - p, "\tOperational Frequency: %s\n", 3162306a36Sopenharmony_ci (flag & UCODE_STATS_FREQUENCY_MSK) ? "2.4 GHz" : 3262306a36Sopenharmony_ci "5.2 GHz"); 3362306a36Sopenharmony_ci p += scnprintf(buf + p, bufsz - p, "\tTGj Narrow Band: %s\n", 3462306a36Sopenharmony_ci (flag & UCODE_STATS_NARROW_BAND_MSK) ? "enabled" : 3562306a36Sopenharmony_ci "disabled"); 3662306a36Sopenharmony_ci 3762306a36Sopenharmony_ci return p; 3862306a36Sopenharmony_ci} 3962306a36Sopenharmony_ci 4062306a36Sopenharmony_cistatic ssize_t 4162306a36Sopenharmony_ciil4965_ucode_rx_stats_read(struct file *file, char __user *user_buf, 4262306a36Sopenharmony_ci size_t count, loff_t *ppos) 4362306a36Sopenharmony_ci{ 4462306a36Sopenharmony_ci struct il_priv *il = file->private_data; 4562306a36Sopenharmony_ci int pos = 0; 4662306a36Sopenharmony_ci char *buf; 4762306a36Sopenharmony_ci int bufsz = 4862306a36Sopenharmony_ci sizeof(struct stats_rx_phy) * 40 + 4962306a36Sopenharmony_ci sizeof(struct stats_rx_non_phy) * 40 + 5062306a36Sopenharmony_ci sizeof(struct stats_rx_ht_phy) * 40 + 400; 5162306a36Sopenharmony_ci ssize_t ret; 5262306a36Sopenharmony_ci struct stats_rx_phy *ofdm, *accum_ofdm, *delta_ofdm, *max_ofdm; 5362306a36Sopenharmony_ci struct stats_rx_phy *cck, *accum_cck, *delta_cck, *max_cck; 5462306a36Sopenharmony_ci struct stats_rx_non_phy *general, *accum_general; 5562306a36Sopenharmony_ci struct stats_rx_non_phy *delta_general, *max_general; 5662306a36Sopenharmony_ci struct stats_rx_ht_phy *ht, *accum_ht, *delta_ht, *max_ht; 5762306a36Sopenharmony_ci 5862306a36Sopenharmony_ci if (!il_is_alive(il)) 5962306a36Sopenharmony_ci return -EAGAIN; 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ci buf = kzalloc(bufsz, GFP_KERNEL); 6262306a36Sopenharmony_ci if (!buf) { 6362306a36Sopenharmony_ci IL_ERR("Can not allocate Buffer\n"); 6462306a36Sopenharmony_ci return -ENOMEM; 6562306a36Sopenharmony_ci } 6662306a36Sopenharmony_ci 6762306a36Sopenharmony_ci /* 6862306a36Sopenharmony_ci * the statistic information display here is based on 6962306a36Sopenharmony_ci * the last stats notification from uCode 7062306a36Sopenharmony_ci * might not reflect the current uCode activity 7162306a36Sopenharmony_ci */ 7262306a36Sopenharmony_ci ofdm = &il->_4965.stats.rx.ofdm; 7362306a36Sopenharmony_ci cck = &il->_4965.stats.rx.cck; 7462306a36Sopenharmony_ci general = &il->_4965.stats.rx.general; 7562306a36Sopenharmony_ci ht = &il->_4965.stats.rx.ofdm_ht; 7662306a36Sopenharmony_ci accum_ofdm = &il->_4965.accum_stats.rx.ofdm; 7762306a36Sopenharmony_ci accum_cck = &il->_4965.accum_stats.rx.cck; 7862306a36Sopenharmony_ci accum_general = &il->_4965.accum_stats.rx.general; 7962306a36Sopenharmony_ci accum_ht = &il->_4965.accum_stats.rx.ofdm_ht; 8062306a36Sopenharmony_ci delta_ofdm = &il->_4965.delta_stats.rx.ofdm; 8162306a36Sopenharmony_ci delta_cck = &il->_4965.delta_stats.rx.cck; 8262306a36Sopenharmony_ci delta_general = &il->_4965.delta_stats.rx.general; 8362306a36Sopenharmony_ci delta_ht = &il->_4965.delta_stats.rx.ofdm_ht; 8462306a36Sopenharmony_ci max_ofdm = &il->_4965.max_delta.rx.ofdm; 8562306a36Sopenharmony_ci max_cck = &il->_4965.max_delta.rx.cck; 8662306a36Sopenharmony_ci max_general = &il->_4965.max_delta.rx.general; 8762306a36Sopenharmony_ci max_ht = &il->_4965.max_delta.rx.ofdm_ht; 8862306a36Sopenharmony_ci 8962306a36Sopenharmony_ci pos += il4965_stats_flag(il, buf, bufsz); 9062306a36Sopenharmony_ci pos += 9162306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_header, 9262306a36Sopenharmony_ci "Statistics_Rx - OFDM:"); 9362306a36Sopenharmony_ci pos += 9462306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "ina_cnt:", 9562306a36Sopenharmony_ci le32_to_cpu(ofdm->ina_cnt), accum_ofdm->ina_cnt, 9662306a36Sopenharmony_ci delta_ofdm->ina_cnt, max_ofdm->ina_cnt); 9762306a36Sopenharmony_ci pos += 9862306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "fina_cnt:", 9962306a36Sopenharmony_ci le32_to_cpu(ofdm->fina_cnt), accum_ofdm->fina_cnt, 10062306a36Sopenharmony_ci delta_ofdm->fina_cnt, max_ofdm->fina_cnt); 10162306a36Sopenharmony_ci pos += 10262306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "plcp_err:", 10362306a36Sopenharmony_ci le32_to_cpu(ofdm->plcp_err), accum_ofdm->plcp_err, 10462306a36Sopenharmony_ci delta_ofdm->plcp_err, max_ofdm->plcp_err); 10562306a36Sopenharmony_ci pos += 10662306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "crc32_err:", 10762306a36Sopenharmony_ci le32_to_cpu(ofdm->crc32_err), accum_ofdm->crc32_err, 10862306a36Sopenharmony_ci delta_ofdm->crc32_err, max_ofdm->crc32_err); 10962306a36Sopenharmony_ci pos += 11062306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "overrun_err:", 11162306a36Sopenharmony_ci le32_to_cpu(ofdm->overrun_err), accum_ofdm->overrun_err, 11262306a36Sopenharmony_ci delta_ofdm->overrun_err, max_ofdm->overrun_err); 11362306a36Sopenharmony_ci pos += 11462306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "early_overrun_err:", 11562306a36Sopenharmony_ci le32_to_cpu(ofdm->early_overrun_err), 11662306a36Sopenharmony_ci accum_ofdm->early_overrun_err, 11762306a36Sopenharmony_ci delta_ofdm->early_overrun_err, 11862306a36Sopenharmony_ci max_ofdm->early_overrun_err); 11962306a36Sopenharmony_ci pos += 12062306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "crc32_good:", 12162306a36Sopenharmony_ci le32_to_cpu(ofdm->crc32_good), accum_ofdm->crc32_good, 12262306a36Sopenharmony_ci delta_ofdm->crc32_good, max_ofdm->crc32_good); 12362306a36Sopenharmony_ci pos += 12462306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "false_alarm_cnt:", 12562306a36Sopenharmony_ci le32_to_cpu(ofdm->false_alarm_cnt), 12662306a36Sopenharmony_ci accum_ofdm->false_alarm_cnt, delta_ofdm->false_alarm_cnt, 12762306a36Sopenharmony_ci max_ofdm->false_alarm_cnt); 12862306a36Sopenharmony_ci pos += 12962306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "fina_sync_err_cnt:", 13062306a36Sopenharmony_ci le32_to_cpu(ofdm->fina_sync_err_cnt), 13162306a36Sopenharmony_ci accum_ofdm->fina_sync_err_cnt, 13262306a36Sopenharmony_ci delta_ofdm->fina_sync_err_cnt, 13362306a36Sopenharmony_ci max_ofdm->fina_sync_err_cnt); 13462306a36Sopenharmony_ci pos += 13562306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "sfd_timeout:", 13662306a36Sopenharmony_ci le32_to_cpu(ofdm->sfd_timeout), accum_ofdm->sfd_timeout, 13762306a36Sopenharmony_ci delta_ofdm->sfd_timeout, max_ofdm->sfd_timeout); 13862306a36Sopenharmony_ci pos += 13962306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "fina_timeout:", 14062306a36Sopenharmony_ci le32_to_cpu(ofdm->fina_timeout), accum_ofdm->fina_timeout, 14162306a36Sopenharmony_ci delta_ofdm->fina_timeout, max_ofdm->fina_timeout); 14262306a36Sopenharmony_ci pos += 14362306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "unresponded_rts:", 14462306a36Sopenharmony_ci le32_to_cpu(ofdm->unresponded_rts), 14562306a36Sopenharmony_ci accum_ofdm->unresponded_rts, delta_ofdm->unresponded_rts, 14662306a36Sopenharmony_ci max_ofdm->unresponded_rts); 14762306a36Sopenharmony_ci pos += 14862306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "rxe_frame_lmt_ovrun:", 14962306a36Sopenharmony_ci le32_to_cpu(ofdm->rxe_frame_limit_overrun), 15062306a36Sopenharmony_ci accum_ofdm->rxe_frame_limit_overrun, 15162306a36Sopenharmony_ci delta_ofdm->rxe_frame_limit_overrun, 15262306a36Sopenharmony_ci max_ofdm->rxe_frame_limit_overrun); 15362306a36Sopenharmony_ci pos += 15462306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "sent_ack_cnt:", 15562306a36Sopenharmony_ci le32_to_cpu(ofdm->sent_ack_cnt), accum_ofdm->sent_ack_cnt, 15662306a36Sopenharmony_ci delta_ofdm->sent_ack_cnt, max_ofdm->sent_ack_cnt); 15762306a36Sopenharmony_ci pos += 15862306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "sent_cts_cnt:", 15962306a36Sopenharmony_ci le32_to_cpu(ofdm->sent_cts_cnt), accum_ofdm->sent_cts_cnt, 16062306a36Sopenharmony_ci delta_ofdm->sent_cts_cnt, max_ofdm->sent_cts_cnt); 16162306a36Sopenharmony_ci pos += 16262306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "sent_ba_rsp_cnt:", 16362306a36Sopenharmony_ci le32_to_cpu(ofdm->sent_ba_rsp_cnt), 16462306a36Sopenharmony_ci accum_ofdm->sent_ba_rsp_cnt, delta_ofdm->sent_ba_rsp_cnt, 16562306a36Sopenharmony_ci max_ofdm->sent_ba_rsp_cnt); 16662306a36Sopenharmony_ci pos += 16762306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "dsp_self_kill:", 16862306a36Sopenharmony_ci le32_to_cpu(ofdm->dsp_self_kill), 16962306a36Sopenharmony_ci accum_ofdm->dsp_self_kill, delta_ofdm->dsp_self_kill, 17062306a36Sopenharmony_ci max_ofdm->dsp_self_kill); 17162306a36Sopenharmony_ci pos += 17262306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "mh_format_err:", 17362306a36Sopenharmony_ci le32_to_cpu(ofdm->mh_format_err), 17462306a36Sopenharmony_ci accum_ofdm->mh_format_err, delta_ofdm->mh_format_err, 17562306a36Sopenharmony_ci max_ofdm->mh_format_err); 17662306a36Sopenharmony_ci pos += 17762306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, 17862306a36Sopenharmony_ci "re_acq_main_rssi_sum:", 17962306a36Sopenharmony_ci le32_to_cpu(ofdm->re_acq_main_rssi_sum), 18062306a36Sopenharmony_ci accum_ofdm->re_acq_main_rssi_sum, 18162306a36Sopenharmony_ci delta_ofdm->re_acq_main_rssi_sum, 18262306a36Sopenharmony_ci max_ofdm->re_acq_main_rssi_sum); 18362306a36Sopenharmony_ci 18462306a36Sopenharmony_ci pos += 18562306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_header, 18662306a36Sopenharmony_ci "Statistics_Rx - CCK:"); 18762306a36Sopenharmony_ci pos += 18862306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "ina_cnt:", 18962306a36Sopenharmony_ci le32_to_cpu(cck->ina_cnt), accum_cck->ina_cnt, 19062306a36Sopenharmony_ci delta_cck->ina_cnt, max_cck->ina_cnt); 19162306a36Sopenharmony_ci pos += 19262306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "fina_cnt:", 19362306a36Sopenharmony_ci le32_to_cpu(cck->fina_cnt), accum_cck->fina_cnt, 19462306a36Sopenharmony_ci delta_cck->fina_cnt, max_cck->fina_cnt); 19562306a36Sopenharmony_ci pos += 19662306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "plcp_err:", 19762306a36Sopenharmony_ci le32_to_cpu(cck->plcp_err), accum_cck->plcp_err, 19862306a36Sopenharmony_ci delta_cck->plcp_err, max_cck->plcp_err); 19962306a36Sopenharmony_ci pos += 20062306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "crc32_err:", 20162306a36Sopenharmony_ci le32_to_cpu(cck->crc32_err), accum_cck->crc32_err, 20262306a36Sopenharmony_ci delta_cck->crc32_err, max_cck->crc32_err); 20362306a36Sopenharmony_ci pos += 20462306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "overrun_err:", 20562306a36Sopenharmony_ci le32_to_cpu(cck->overrun_err), accum_cck->overrun_err, 20662306a36Sopenharmony_ci delta_cck->overrun_err, max_cck->overrun_err); 20762306a36Sopenharmony_ci pos += 20862306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "early_overrun_err:", 20962306a36Sopenharmony_ci le32_to_cpu(cck->early_overrun_err), 21062306a36Sopenharmony_ci accum_cck->early_overrun_err, 21162306a36Sopenharmony_ci delta_cck->early_overrun_err, max_cck->early_overrun_err); 21262306a36Sopenharmony_ci pos += 21362306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "crc32_good:", 21462306a36Sopenharmony_ci le32_to_cpu(cck->crc32_good), accum_cck->crc32_good, 21562306a36Sopenharmony_ci delta_cck->crc32_good, max_cck->crc32_good); 21662306a36Sopenharmony_ci pos += 21762306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "false_alarm_cnt:", 21862306a36Sopenharmony_ci le32_to_cpu(cck->false_alarm_cnt), 21962306a36Sopenharmony_ci accum_cck->false_alarm_cnt, delta_cck->false_alarm_cnt, 22062306a36Sopenharmony_ci max_cck->false_alarm_cnt); 22162306a36Sopenharmony_ci pos += 22262306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "fina_sync_err_cnt:", 22362306a36Sopenharmony_ci le32_to_cpu(cck->fina_sync_err_cnt), 22462306a36Sopenharmony_ci accum_cck->fina_sync_err_cnt, 22562306a36Sopenharmony_ci delta_cck->fina_sync_err_cnt, max_cck->fina_sync_err_cnt); 22662306a36Sopenharmony_ci pos += 22762306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "sfd_timeout:", 22862306a36Sopenharmony_ci le32_to_cpu(cck->sfd_timeout), accum_cck->sfd_timeout, 22962306a36Sopenharmony_ci delta_cck->sfd_timeout, max_cck->sfd_timeout); 23062306a36Sopenharmony_ci pos += 23162306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "fina_timeout:", 23262306a36Sopenharmony_ci le32_to_cpu(cck->fina_timeout), accum_cck->fina_timeout, 23362306a36Sopenharmony_ci delta_cck->fina_timeout, max_cck->fina_timeout); 23462306a36Sopenharmony_ci pos += 23562306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "unresponded_rts:", 23662306a36Sopenharmony_ci le32_to_cpu(cck->unresponded_rts), 23762306a36Sopenharmony_ci accum_cck->unresponded_rts, delta_cck->unresponded_rts, 23862306a36Sopenharmony_ci max_cck->unresponded_rts); 23962306a36Sopenharmony_ci pos += 24062306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "rxe_frame_lmt_ovrun:", 24162306a36Sopenharmony_ci le32_to_cpu(cck->rxe_frame_limit_overrun), 24262306a36Sopenharmony_ci accum_cck->rxe_frame_limit_overrun, 24362306a36Sopenharmony_ci delta_cck->rxe_frame_limit_overrun, 24462306a36Sopenharmony_ci max_cck->rxe_frame_limit_overrun); 24562306a36Sopenharmony_ci pos += 24662306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "sent_ack_cnt:", 24762306a36Sopenharmony_ci le32_to_cpu(cck->sent_ack_cnt), accum_cck->sent_ack_cnt, 24862306a36Sopenharmony_ci delta_cck->sent_ack_cnt, max_cck->sent_ack_cnt); 24962306a36Sopenharmony_ci pos += 25062306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "sent_cts_cnt:", 25162306a36Sopenharmony_ci le32_to_cpu(cck->sent_cts_cnt), accum_cck->sent_cts_cnt, 25262306a36Sopenharmony_ci delta_cck->sent_cts_cnt, max_cck->sent_cts_cnt); 25362306a36Sopenharmony_ci pos += 25462306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "sent_ba_rsp_cnt:", 25562306a36Sopenharmony_ci le32_to_cpu(cck->sent_ba_rsp_cnt), 25662306a36Sopenharmony_ci accum_cck->sent_ba_rsp_cnt, delta_cck->sent_ba_rsp_cnt, 25762306a36Sopenharmony_ci max_cck->sent_ba_rsp_cnt); 25862306a36Sopenharmony_ci pos += 25962306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "dsp_self_kill:", 26062306a36Sopenharmony_ci le32_to_cpu(cck->dsp_self_kill), accum_cck->dsp_self_kill, 26162306a36Sopenharmony_ci delta_cck->dsp_self_kill, max_cck->dsp_self_kill); 26262306a36Sopenharmony_ci pos += 26362306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "mh_format_err:", 26462306a36Sopenharmony_ci le32_to_cpu(cck->mh_format_err), accum_cck->mh_format_err, 26562306a36Sopenharmony_ci delta_cck->mh_format_err, max_cck->mh_format_err); 26662306a36Sopenharmony_ci pos += 26762306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, 26862306a36Sopenharmony_ci "re_acq_main_rssi_sum:", 26962306a36Sopenharmony_ci le32_to_cpu(cck->re_acq_main_rssi_sum), 27062306a36Sopenharmony_ci accum_cck->re_acq_main_rssi_sum, 27162306a36Sopenharmony_ci delta_cck->re_acq_main_rssi_sum, 27262306a36Sopenharmony_ci max_cck->re_acq_main_rssi_sum); 27362306a36Sopenharmony_ci 27462306a36Sopenharmony_ci pos += 27562306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_header, 27662306a36Sopenharmony_ci "Statistics_Rx - GENERAL:"); 27762306a36Sopenharmony_ci pos += 27862306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "bogus_cts:", 27962306a36Sopenharmony_ci le32_to_cpu(general->bogus_cts), accum_general->bogus_cts, 28062306a36Sopenharmony_ci delta_general->bogus_cts, max_general->bogus_cts); 28162306a36Sopenharmony_ci pos += 28262306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "bogus_ack:", 28362306a36Sopenharmony_ci le32_to_cpu(general->bogus_ack), accum_general->bogus_ack, 28462306a36Sopenharmony_ci delta_general->bogus_ack, max_general->bogus_ack); 28562306a36Sopenharmony_ci pos += 28662306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "non_bssid_frames:", 28762306a36Sopenharmony_ci le32_to_cpu(general->non_bssid_frames), 28862306a36Sopenharmony_ci accum_general->non_bssid_frames, 28962306a36Sopenharmony_ci delta_general->non_bssid_frames, 29062306a36Sopenharmony_ci max_general->non_bssid_frames); 29162306a36Sopenharmony_ci pos += 29262306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "filtered_frames:", 29362306a36Sopenharmony_ci le32_to_cpu(general->filtered_frames), 29462306a36Sopenharmony_ci accum_general->filtered_frames, 29562306a36Sopenharmony_ci delta_general->filtered_frames, 29662306a36Sopenharmony_ci max_general->filtered_frames); 29762306a36Sopenharmony_ci pos += 29862306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "non_channel_beacons:", 29962306a36Sopenharmony_ci le32_to_cpu(general->non_channel_beacons), 30062306a36Sopenharmony_ci accum_general->non_channel_beacons, 30162306a36Sopenharmony_ci delta_general->non_channel_beacons, 30262306a36Sopenharmony_ci max_general->non_channel_beacons); 30362306a36Sopenharmony_ci pos += 30462306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "channel_beacons:", 30562306a36Sopenharmony_ci le32_to_cpu(general->channel_beacons), 30662306a36Sopenharmony_ci accum_general->channel_beacons, 30762306a36Sopenharmony_ci delta_general->channel_beacons, 30862306a36Sopenharmony_ci max_general->channel_beacons); 30962306a36Sopenharmony_ci pos += 31062306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "num_missed_bcon:", 31162306a36Sopenharmony_ci le32_to_cpu(general->num_missed_bcon), 31262306a36Sopenharmony_ci accum_general->num_missed_bcon, 31362306a36Sopenharmony_ci delta_general->num_missed_bcon, 31462306a36Sopenharmony_ci max_general->num_missed_bcon); 31562306a36Sopenharmony_ci pos += 31662306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, 31762306a36Sopenharmony_ci "adc_rx_saturation_time:", 31862306a36Sopenharmony_ci le32_to_cpu(general->adc_rx_saturation_time), 31962306a36Sopenharmony_ci accum_general->adc_rx_saturation_time, 32062306a36Sopenharmony_ci delta_general->adc_rx_saturation_time, 32162306a36Sopenharmony_ci max_general->adc_rx_saturation_time); 32262306a36Sopenharmony_ci pos += 32362306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, 32462306a36Sopenharmony_ci "ina_detect_search_tm:", 32562306a36Sopenharmony_ci le32_to_cpu(general->ina_detection_search_time), 32662306a36Sopenharmony_ci accum_general->ina_detection_search_time, 32762306a36Sopenharmony_ci delta_general->ina_detection_search_time, 32862306a36Sopenharmony_ci max_general->ina_detection_search_time); 32962306a36Sopenharmony_ci pos += 33062306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, 33162306a36Sopenharmony_ci "beacon_silence_rssi_a:", 33262306a36Sopenharmony_ci le32_to_cpu(general->beacon_silence_rssi_a), 33362306a36Sopenharmony_ci accum_general->beacon_silence_rssi_a, 33462306a36Sopenharmony_ci delta_general->beacon_silence_rssi_a, 33562306a36Sopenharmony_ci max_general->beacon_silence_rssi_a); 33662306a36Sopenharmony_ci pos += 33762306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, 33862306a36Sopenharmony_ci "beacon_silence_rssi_b:", 33962306a36Sopenharmony_ci le32_to_cpu(general->beacon_silence_rssi_b), 34062306a36Sopenharmony_ci accum_general->beacon_silence_rssi_b, 34162306a36Sopenharmony_ci delta_general->beacon_silence_rssi_b, 34262306a36Sopenharmony_ci max_general->beacon_silence_rssi_b); 34362306a36Sopenharmony_ci pos += 34462306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, 34562306a36Sopenharmony_ci "beacon_silence_rssi_c:", 34662306a36Sopenharmony_ci le32_to_cpu(general->beacon_silence_rssi_c), 34762306a36Sopenharmony_ci accum_general->beacon_silence_rssi_c, 34862306a36Sopenharmony_ci delta_general->beacon_silence_rssi_c, 34962306a36Sopenharmony_ci max_general->beacon_silence_rssi_c); 35062306a36Sopenharmony_ci pos += 35162306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, 35262306a36Sopenharmony_ci "interference_data_flag:", 35362306a36Sopenharmony_ci le32_to_cpu(general->interference_data_flag), 35462306a36Sopenharmony_ci accum_general->interference_data_flag, 35562306a36Sopenharmony_ci delta_general->interference_data_flag, 35662306a36Sopenharmony_ci max_general->interference_data_flag); 35762306a36Sopenharmony_ci pos += 35862306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "channel_load:", 35962306a36Sopenharmony_ci le32_to_cpu(general->channel_load), 36062306a36Sopenharmony_ci accum_general->channel_load, delta_general->channel_load, 36162306a36Sopenharmony_ci max_general->channel_load); 36262306a36Sopenharmony_ci pos += 36362306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "dsp_false_alarms:", 36462306a36Sopenharmony_ci le32_to_cpu(general->dsp_false_alarms), 36562306a36Sopenharmony_ci accum_general->dsp_false_alarms, 36662306a36Sopenharmony_ci delta_general->dsp_false_alarms, 36762306a36Sopenharmony_ci max_general->dsp_false_alarms); 36862306a36Sopenharmony_ci pos += 36962306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "beacon_rssi_a:", 37062306a36Sopenharmony_ci le32_to_cpu(general->beacon_rssi_a), 37162306a36Sopenharmony_ci accum_general->beacon_rssi_a, 37262306a36Sopenharmony_ci delta_general->beacon_rssi_a, max_general->beacon_rssi_a); 37362306a36Sopenharmony_ci pos += 37462306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "beacon_rssi_b:", 37562306a36Sopenharmony_ci le32_to_cpu(general->beacon_rssi_b), 37662306a36Sopenharmony_ci accum_general->beacon_rssi_b, 37762306a36Sopenharmony_ci delta_general->beacon_rssi_b, max_general->beacon_rssi_b); 37862306a36Sopenharmony_ci pos += 37962306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "beacon_rssi_c:", 38062306a36Sopenharmony_ci le32_to_cpu(general->beacon_rssi_c), 38162306a36Sopenharmony_ci accum_general->beacon_rssi_c, 38262306a36Sopenharmony_ci delta_general->beacon_rssi_c, max_general->beacon_rssi_c); 38362306a36Sopenharmony_ci pos += 38462306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "beacon_energy_a:", 38562306a36Sopenharmony_ci le32_to_cpu(general->beacon_energy_a), 38662306a36Sopenharmony_ci accum_general->beacon_energy_a, 38762306a36Sopenharmony_ci delta_general->beacon_energy_a, 38862306a36Sopenharmony_ci max_general->beacon_energy_a); 38962306a36Sopenharmony_ci pos += 39062306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "beacon_energy_b:", 39162306a36Sopenharmony_ci le32_to_cpu(general->beacon_energy_b), 39262306a36Sopenharmony_ci accum_general->beacon_energy_b, 39362306a36Sopenharmony_ci delta_general->beacon_energy_b, 39462306a36Sopenharmony_ci max_general->beacon_energy_b); 39562306a36Sopenharmony_ci pos += 39662306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "beacon_energy_c:", 39762306a36Sopenharmony_ci le32_to_cpu(general->beacon_energy_c), 39862306a36Sopenharmony_ci accum_general->beacon_energy_c, 39962306a36Sopenharmony_ci delta_general->beacon_energy_c, 40062306a36Sopenharmony_ci max_general->beacon_energy_c); 40162306a36Sopenharmony_ci 40262306a36Sopenharmony_ci pos += 40362306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_header, 40462306a36Sopenharmony_ci "Statistics_Rx - OFDM_HT:"); 40562306a36Sopenharmony_ci pos += 40662306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "plcp_err:", 40762306a36Sopenharmony_ci le32_to_cpu(ht->plcp_err), accum_ht->plcp_err, 40862306a36Sopenharmony_ci delta_ht->plcp_err, max_ht->plcp_err); 40962306a36Sopenharmony_ci pos += 41062306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "overrun_err:", 41162306a36Sopenharmony_ci le32_to_cpu(ht->overrun_err), accum_ht->overrun_err, 41262306a36Sopenharmony_ci delta_ht->overrun_err, max_ht->overrun_err); 41362306a36Sopenharmony_ci pos += 41462306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "early_overrun_err:", 41562306a36Sopenharmony_ci le32_to_cpu(ht->early_overrun_err), 41662306a36Sopenharmony_ci accum_ht->early_overrun_err, delta_ht->early_overrun_err, 41762306a36Sopenharmony_ci max_ht->early_overrun_err); 41862306a36Sopenharmony_ci pos += 41962306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "crc32_good:", 42062306a36Sopenharmony_ci le32_to_cpu(ht->crc32_good), accum_ht->crc32_good, 42162306a36Sopenharmony_ci delta_ht->crc32_good, max_ht->crc32_good); 42262306a36Sopenharmony_ci pos += 42362306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "crc32_err:", 42462306a36Sopenharmony_ci le32_to_cpu(ht->crc32_err), accum_ht->crc32_err, 42562306a36Sopenharmony_ci delta_ht->crc32_err, max_ht->crc32_err); 42662306a36Sopenharmony_ci pos += 42762306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "mh_format_err:", 42862306a36Sopenharmony_ci le32_to_cpu(ht->mh_format_err), accum_ht->mh_format_err, 42962306a36Sopenharmony_ci delta_ht->mh_format_err, max_ht->mh_format_err); 43062306a36Sopenharmony_ci pos += 43162306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "agg_crc32_good:", 43262306a36Sopenharmony_ci le32_to_cpu(ht->agg_crc32_good), accum_ht->agg_crc32_good, 43362306a36Sopenharmony_ci delta_ht->agg_crc32_good, max_ht->agg_crc32_good); 43462306a36Sopenharmony_ci pos += 43562306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "agg_mpdu_cnt:", 43662306a36Sopenharmony_ci le32_to_cpu(ht->agg_mpdu_cnt), accum_ht->agg_mpdu_cnt, 43762306a36Sopenharmony_ci delta_ht->agg_mpdu_cnt, max_ht->agg_mpdu_cnt); 43862306a36Sopenharmony_ci pos += 43962306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "agg_cnt:", 44062306a36Sopenharmony_ci le32_to_cpu(ht->agg_cnt), accum_ht->agg_cnt, 44162306a36Sopenharmony_ci delta_ht->agg_cnt, max_ht->agg_cnt); 44262306a36Sopenharmony_ci pos += 44362306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "unsupport_mcs:", 44462306a36Sopenharmony_ci le32_to_cpu(ht->unsupport_mcs), accum_ht->unsupport_mcs, 44562306a36Sopenharmony_ci delta_ht->unsupport_mcs, max_ht->unsupport_mcs); 44662306a36Sopenharmony_ci 44762306a36Sopenharmony_ci ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); 44862306a36Sopenharmony_ci kfree(buf); 44962306a36Sopenharmony_ci return ret; 45062306a36Sopenharmony_ci} 45162306a36Sopenharmony_ci 45262306a36Sopenharmony_cistatic ssize_t 45362306a36Sopenharmony_ciil4965_ucode_tx_stats_read(struct file *file, char __user *user_buf, 45462306a36Sopenharmony_ci size_t count, loff_t *ppos) 45562306a36Sopenharmony_ci{ 45662306a36Sopenharmony_ci struct il_priv *il = file->private_data; 45762306a36Sopenharmony_ci int pos = 0; 45862306a36Sopenharmony_ci char *buf; 45962306a36Sopenharmony_ci int bufsz = (sizeof(struct stats_tx) * 48) + 250; 46062306a36Sopenharmony_ci ssize_t ret; 46162306a36Sopenharmony_ci struct stats_tx *tx, *accum_tx, *delta_tx, *max_tx; 46262306a36Sopenharmony_ci 46362306a36Sopenharmony_ci if (!il_is_alive(il)) 46462306a36Sopenharmony_ci return -EAGAIN; 46562306a36Sopenharmony_ci 46662306a36Sopenharmony_ci buf = kzalloc(bufsz, GFP_KERNEL); 46762306a36Sopenharmony_ci if (!buf) { 46862306a36Sopenharmony_ci IL_ERR("Can not allocate Buffer\n"); 46962306a36Sopenharmony_ci return -ENOMEM; 47062306a36Sopenharmony_ci } 47162306a36Sopenharmony_ci 47262306a36Sopenharmony_ci /* the statistic information display here is based on 47362306a36Sopenharmony_ci * the last stats notification from uCode 47462306a36Sopenharmony_ci * might not reflect the current uCode activity 47562306a36Sopenharmony_ci */ 47662306a36Sopenharmony_ci tx = &il->_4965.stats.tx; 47762306a36Sopenharmony_ci accum_tx = &il->_4965.accum_stats.tx; 47862306a36Sopenharmony_ci delta_tx = &il->_4965.delta_stats.tx; 47962306a36Sopenharmony_ci max_tx = &il->_4965.max_delta.tx; 48062306a36Sopenharmony_ci 48162306a36Sopenharmony_ci pos += il4965_stats_flag(il, buf, bufsz); 48262306a36Sopenharmony_ci pos += scnprintf(buf + pos, bufsz - pos, fmt_header, "Statistics_Tx:"); 48362306a36Sopenharmony_ci pos += 48462306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "preamble:", 48562306a36Sopenharmony_ci le32_to_cpu(tx->preamble_cnt), accum_tx->preamble_cnt, 48662306a36Sopenharmony_ci delta_tx->preamble_cnt, max_tx->preamble_cnt); 48762306a36Sopenharmony_ci pos += 48862306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "rx_detected_cnt:", 48962306a36Sopenharmony_ci le32_to_cpu(tx->rx_detected_cnt), 49062306a36Sopenharmony_ci accum_tx->rx_detected_cnt, delta_tx->rx_detected_cnt, 49162306a36Sopenharmony_ci max_tx->rx_detected_cnt); 49262306a36Sopenharmony_ci pos += 49362306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "bt_prio_defer_cnt:", 49462306a36Sopenharmony_ci le32_to_cpu(tx->bt_prio_defer_cnt), 49562306a36Sopenharmony_ci accum_tx->bt_prio_defer_cnt, delta_tx->bt_prio_defer_cnt, 49662306a36Sopenharmony_ci max_tx->bt_prio_defer_cnt); 49762306a36Sopenharmony_ci pos += 49862306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "bt_prio_kill_cnt:", 49962306a36Sopenharmony_ci le32_to_cpu(tx->bt_prio_kill_cnt), 50062306a36Sopenharmony_ci accum_tx->bt_prio_kill_cnt, delta_tx->bt_prio_kill_cnt, 50162306a36Sopenharmony_ci max_tx->bt_prio_kill_cnt); 50262306a36Sopenharmony_ci pos += 50362306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "few_bytes_cnt:", 50462306a36Sopenharmony_ci le32_to_cpu(tx->few_bytes_cnt), accum_tx->few_bytes_cnt, 50562306a36Sopenharmony_ci delta_tx->few_bytes_cnt, max_tx->few_bytes_cnt); 50662306a36Sopenharmony_ci pos += 50762306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "cts_timeout:", 50862306a36Sopenharmony_ci le32_to_cpu(tx->cts_timeout), accum_tx->cts_timeout, 50962306a36Sopenharmony_ci delta_tx->cts_timeout, max_tx->cts_timeout); 51062306a36Sopenharmony_ci pos += 51162306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "ack_timeout:", 51262306a36Sopenharmony_ci le32_to_cpu(tx->ack_timeout), accum_tx->ack_timeout, 51362306a36Sopenharmony_ci delta_tx->ack_timeout, max_tx->ack_timeout); 51462306a36Sopenharmony_ci pos += 51562306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "expected_ack_cnt:", 51662306a36Sopenharmony_ci le32_to_cpu(tx->expected_ack_cnt), 51762306a36Sopenharmony_ci accum_tx->expected_ack_cnt, delta_tx->expected_ack_cnt, 51862306a36Sopenharmony_ci max_tx->expected_ack_cnt); 51962306a36Sopenharmony_ci pos += 52062306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "actual_ack_cnt:", 52162306a36Sopenharmony_ci le32_to_cpu(tx->actual_ack_cnt), accum_tx->actual_ack_cnt, 52262306a36Sopenharmony_ci delta_tx->actual_ack_cnt, max_tx->actual_ack_cnt); 52362306a36Sopenharmony_ci pos += 52462306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "dump_msdu_cnt:", 52562306a36Sopenharmony_ci le32_to_cpu(tx->dump_msdu_cnt), accum_tx->dump_msdu_cnt, 52662306a36Sopenharmony_ci delta_tx->dump_msdu_cnt, max_tx->dump_msdu_cnt); 52762306a36Sopenharmony_ci pos += 52862306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, 52962306a36Sopenharmony_ci "abort_nxt_frame_mismatch:", 53062306a36Sopenharmony_ci le32_to_cpu(tx->burst_abort_next_frame_mismatch_cnt), 53162306a36Sopenharmony_ci accum_tx->burst_abort_next_frame_mismatch_cnt, 53262306a36Sopenharmony_ci delta_tx->burst_abort_next_frame_mismatch_cnt, 53362306a36Sopenharmony_ci max_tx->burst_abort_next_frame_mismatch_cnt); 53462306a36Sopenharmony_ci pos += 53562306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, 53662306a36Sopenharmony_ci "abort_missing_nxt_frame:", 53762306a36Sopenharmony_ci le32_to_cpu(tx->burst_abort_missing_next_frame_cnt), 53862306a36Sopenharmony_ci accum_tx->burst_abort_missing_next_frame_cnt, 53962306a36Sopenharmony_ci delta_tx->burst_abort_missing_next_frame_cnt, 54062306a36Sopenharmony_ci max_tx->burst_abort_missing_next_frame_cnt); 54162306a36Sopenharmony_ci pos += 54262306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, 54362306a36Sopenharmony_ci "cts_timeout_collision:", 54462306a36Sopenharmony_ci le32_to_cpu(tx->cts_timeout_collision), 54562306a36Sopenharmony_ci accum_tx->cts_timeout_collision, 54662306a36Sopenharmony_ci delta_tx->cts_timeout_collision, 54762306a36Sopenharmony_ci max_tx->cts_timeout_collision); 54862306a36Sopenharmony_ci pos += 54962306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, 55062306a36Sopenharmony_ci "ack_ba_timeout_collision:", 55162306a36Sopenharmony_ci le32_to_cpu(tx->ack_or_ba_timeout_collision), 55262306a36Sopenharmony_ci accum_tx->ack_or_ba_timeout_collision, 55362306a36Sopenharmony_ci delta_tx->ack_or_ba_timeout_collision, 55462306a36Sopenharmony_ci max_tx->ack_or_ba_timeout_collision); 55562306a36Sopenharmony_ci pos += 55662306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "agg ba_timeout:", 55762306a36Sopenharmony_ci le32_to_cpu(tx->agg.ba_timeout), accum_tx->agg.ba_timeout, 55862306a36Sopenharmony_ci delta_tx->agg.ba_timeout, max_tx->agg.ba_timeout); 55962306a36Sopenharmony_ci pos += 56062306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, 56162306a36Sopenharmony_ci "agg ba_resched_frames:", 56262306a36Sopenharmony_ci le32_to_cpu(tx->agg.ba_reschedule_frames), 56362306a36Sopenharmony_ci accum_tx->agg.ba_reschedule_frames, 56462306a36Sopenharmony_ci delta_tx->agg.ba_reschedule_frames, 56562306a36Sopenharmony_ci max_tx->agg.ba_reschedule_frames); 56662306a36Sopenharmony_ci pos += 56762306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, 56862306a36Sopenharmony_ci "agg scd_query_agg_frame:", 56962306a36Sopenharmony_ci le32_to_cpu(tx->agg.scd_query_agg_frame_cnt), 57062306a36Sopenharmony_ci accum_tx->agg.scd_query_agg_frame_cnt, 57162306a36Sopenharmony_ci delta_tx->agg.scd_query_agg_frame_cnt, 57262306a36Sopenharmony_ci max_tx->agg.scd_query_agg_frame_cnt); 57362306a36Sopenharmony_ci pos += 57462306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, 57562306a36Sopenharmony_ci "agg scd_query_no_agg:", 57662306a36Sopenharmony_ci le32_to_cpu(tx->agg.scd_query_no_agg), 57762306a36Sopenharmony_ci accum_tx->agg.scd_query_no_agg, 57862306a36Sopenharmony_ci delta_tx->agg.scd_query_no_agg, 57962306a36Sopenharmony_ci max_tx->agg.scd_query_no_agg); 58062306a36Sopenharmony_ci pos += 58162306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "agg scd_query_agg:", 58262306a36Sopenharmony_ci le32_to_cpu(tx->agg.scd_query_agg), 58362306a36Sopenharmony_ci accum_tx->agg.scd_query_agg, delta_tx->agg.scd_query_agg, 58462306a36Sopenharmony_ci max_tx->agg.scd_query_agg); 58562306a36Sopenharmony_ci pos += 58662306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, 58762306a36Sopenharmony_ci "agg scd_query_mismatch:", 58862306a36Sopenharmony_ci le32_to_cpu(tx->agg.scd_query_mismatch), 58962306a36Sopenharmony_ci accum_tx->agg.scd_query_mismatch, 59062306a36Sopenharmony_ci delta_tx->agg.scd_query_mismatch, 59162306a36Sopenharmony_ci max_tx->agg.scd_query_mismatch); 59262306a36Sopenharmony_ci pos += 59362306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "agg frame_not_ready:", 59462306a36Sopenharmony_ci le32_to_cpu(tx->agg.frame_not_ready), 59562306a36Sopenharmony_ci accum_tx->agg.frame_not_ready, 59662306a36Sopenharmony_ci delta_tx->agg.frame_not_ready, 59762306a36Sopenharmony_ci max_tx->agg.frame_not_ready); 59862306a36Sopenharmony_ci pos += 59962306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "agg underrun:", 60062306a36Sopenharmony_ci le32_to_cpu(tx->agg.underrun), accum_tx->agg.underrun, 60162306a36Sopenharmony_ci delta_tx->agg.underrun, max_tx->agg.underrun); 60262306a36Sopenharmony_ci pos += 60362306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "agg bt_prio_kill:", 60462306a36Sopenharmony_ci le32_to_cpu(tx->agg.bt_prio_kill), 60562306a36Sopenharmony_ci accum_tx->agg.bt_prio_kill, delta_tx->agg.bt_prio_kill, 60662306a36Sopenharmony_ci max_tx->agg.bt_prio_kill); 60762306a36Sopenharmony_ci pos += 60862306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "agg rx_ba_rsp_cnt:", 60962306a36Sopenharmony_ci le32_to_cpu(tx->agg.rx_ba_rsp_cnt), 61062306a36Sopenharmony_ci accum_tx->agg.rx_ba_rsp_cnt, delta_tx->agg.rx_ba_rsp_cnt, 61162306a36Sopenharmony_ci max_tx->agg.rx_ba_rsp_cnt); 61262306a36Sopenharmony_ci 61362306a36Sopenharmony_ci ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); 61462306a36Sopenharmony_ci kfree(buf); 61562306a36Sopenharmony_ci return ret; 61662306a36Sopenharmony_ci} 61762306a36Sopenharmony_ci 61862306a36Sopenharmony_cistatic ssize_t 61962306a36Sopenharmony_ciil4965_ucode_general_stats_read(struct file *file, char __user *user_buf, 62062306a36Sopenharmony_ci size_t count, loff_t *ppos) 62162306a36Sopenharmony_ci{ 62262306a36Sopenharmony_ci struct il_priv *il = file->private_data; 62362306a36Sopenharmony_ci int pos = 0; 62462306a36Sopenharmony_ci char *buf; 62562306a36Sopenharmony_ci int bufsz = sizeof(struct stats_general) * 10 + 300; 62662306a36Sopenharmony_ci ssize_t ret; 62762306a36Sopenharmony_ci struct stats_general_common *general, *accum_general; 62862306a36Sopenharmony_ci struct stats_general_common *delta_general, *max_general; 62962306a36Sopenharmony_ci struct stats_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg; 63062306a36Sopenharmony_ci struct stats_div *div, *accum_div, *delta_div, *max_div; 63162306a36Sopenharmony_ci 63262306a36Sopenharmony_ci if (!il_is_alive(il)) 63362306a36Sopenharmony_ci return -EAGAIN; 63462306a36Sopenharmony_ci 63562306a36Sopenharmony_ci buf = kzalloc(bufsz, GFP_KERNEL); 63662306a36Sopenharmony_ci if (!buf) { 63762306a36Sopenharmony_ci IL_ERR("Can not allocate Buffer\n"); 63862306a36Sopenharmony_ci return -ENOMEM; 63962306a36Sopenharmony_ci } 64062306a36Sopenharmony_ci 64162306a36Sopenharmony_ci /* the statistic information display here is based on 64262306a36Sopenharmony_ci * the last stats notification from uCode 64362306a36Sopenharmony_ci * might not reflect the current uCode activity 64462306a36Sopenharmony_ci */ 64562306a36Sopenharmony_ci general = &il->_4965.stats.general.common; 64662306a36Sopenharmony_ci dbg = &il->_4965.stats.general.common.dbg; 64762306a36Sopenharmony_ci div = &il->_4965.stats.general.common.div; 64862306a36Sopenharmony_ci accum_general = &il->_4965.accum_stats.general.common; 64962306a36Sopenharmony_ci accum_dbg = &il->_4965.accum_stats.general.common.dbg; 65062306a36Sopenharmony_ci accum_div = &il->_4965.accum_stats.general.common.div; 65162306a36Sopenharmony_ci delta_general = &il->_4965.delta_stats.general.common; 65262306a36Sopenharmony_ci max_general = &il->_4965.max_delta.general.common; 65362306a36Sopenharmony_ci delta_dbg = &il->_4965.delta_stats.general.common.dbg; 65462306a36Sopenharmony_ci max_dbg = &il->_4965.max_delta.general.common.dbg; 65562306a36Sopenharmony_ci delta_div = &il->_4965.delta_stats.general.common.div; 65662306a36Sopenharmony_ci max_div = &il->_4965.max_delta.general.common.div; 65762306a36Sopenharmony_ci 65862306a36Sopenharmony_ci pos += il4965_stats_flag(il, buf, bufsz); 65962306a36Sopenharmony_ci pos += 66062306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_header, 66162306a36Sopenharmony_ci "Statistics_General:"); 66262306a36Sopenharmony_ci pos += 66362306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_value, "temperature:", 66462306a36Sopenharmony_ci le32_to_cpu(general->temperature)); 66562306a36Sopenharmony_ci pos += 66662306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_value, "ttl_timestamp:", 66762306a36Sopenharmony_ci le32_to_cpu(general->ttl_timestamp)); 66862306a36Sopenharmony_ci pos += 66962306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "burst_check:", 67062306a36Sopenharmony_ci le32_to_cpu(dbg->burst_check), accum_dbg->burst_check, 67162306a36Sopenharmony_ci delta_dbg->burst_check, max_dbg->burst_check); 67262306a36Sopenharmony_ci pos += 67362306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "burst_count:", 67462306a36Sopenharmony_ci le32_to_cpu(dbg->burst_count), accum_dbg->burst_count, 67562306a36Sopenharmony_ci delta_dbg->burst_count, max_dbg->burst_count); 67662306a36Sopenharmony_ci pos += 67762306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, 67862306a36Sopenharmony_ci "wait_for_silence_timeout_count:", 67962306a36Sopenharmony_ci le32_to_cpu(dbg->wait_for_silence_timeout_cnt), 68062306a36Sopenharmony_ci accum_dbg->wait_for_silence_timeout_cnt, 68162306a36Sopenharmony_ci delta_dbg->wait_for_silence_timeout_cnt, 68262306a36Sopenharmony_ci max_dbg->wait_for_silence_timeout_cnt); 68362306a36Sopenharmony_ci pos += 68462306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "sleep_time:", 68562306a36Sopenharmony_ci le32_to_cpu(general->sleep_time), 68662306a36Sopenharmony_ci accum_general->sleep_time, delta_general->sleep_time, 68762306a36Sopenharmony_ci max_general->sleep_time); 68862306a36Sopenharmony_ci pos += 68962306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "slots_out:", 69062306a36Sopenharmony_ci le32_to_cpu(general->slots_out), accum_general->slots_out, 69162306a36Sopenharmony_ci delta_general->slots_out, max_general->slots_out); 69262306a36Sopenharmony_ci pos += 69362306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "slots_idle:", 69462306a36Sopenharmony_ci le32_to_cpu(general->slots_idle), 69562306a36Sopenharmony_ci accum_general->slots_idle, delta_general->slots_idle, 69662306a36Sopenharmony_ci max_general->slots_idle); 69762306a36Sopenharmony_ci pos += 69862306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "tx_on_a:", 69962306a36Sopenharmony_ci le32_to_cpu(div->tx_on_a), accum_div->tx_on_a, 70062306a36Sopenharmony_ci delta_div->tx_on_a, max_div->tx_on_a); 70162306a36Sopenharmony_ci pos += 70262306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "tx_on_b:", 70362306a36Sopenharmony_ci le32_to_cpu(div->tx_on_b), accum_div->tx_on_b, 70462306a36Sopenharmony_ci delta_div->tx_on_b, max_div->tx_on_b); 70562306a36Sopenharmony_ci pos += 70662306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "exec_time:", 70762306a36Sopenharmony_ci le32_to_cpu(div->exec_time), accum_div->exec_time, 70862306a36Sopenharmony_ci delta_div->exec_time, max_div->exec_time); 70962306a36Sopenharmony_ci pos += 71062306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "probe_time:", 71162306a36Sopenharmony_ci le32_to_cpu(div->probe_time), accum_div->probe_time, 71262306a36Sopenharmony_ci delta_div->probe_time, max_div->probe_time); 71362306a36Sopenharmony_ci pos += 71462306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "rx_enable_counter:", 71562306a36Sopenharmony_ci le32_to_cpu(general->rx_enable_counter), 71662306a36Sopenharmony_ci accum_general->rx_enable_counter, 71762306a36Sopenharmony_ci delta_general->rx_enable_counter, 71862306a36Sopenharmony_ci max_general->rx_enable_counter); 71962306a36Sopenharmony_ci pos += 72062306a36Sopenharmony_ci scnprintf(buf + pos, bufsz - pos, fmt_table, "num_of_sos_states:", 72162306a36Sopenharmony_ci le32_to_cpu(general->num_of_sos_states), 72262306a36Sopenharmony_ci accum_general->num_of_sos_states, 72362306a36Sopenharmony_ci delta_general->num_of_sos_states, 72462306a36Sopenharmony_ci max_general->num_of_sos_states); 72562306a36Sopenharmony_ci ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); 72662306a36Sopenharmony_ci kfree(buf); 72762306a36Sopenharmony_ci return ret; 72862306a36Sopenharmony_ci} 72962306a36Sopenharmony_ci 73062306a36Sopenharmony_ciconst struct il_debugfs_ops il4965_debugfs_ops = { 73162306a36Sopenharmony_ci .rx_stats_read = il4965_ucode_rx_stats_read, 73262306a36Sopenharmony_ci .tx_stats_read = il4965_ucode_tx_stats_read, 73362306a36Sopenharmony_ci .general_stats_read = il4965_ucode_general_stats_read, 73462306a36Sopenharmony_ci}; 735