#include <linux/vmalloc.h>
#include <linux/err.h>
#include <linux/ieee80211.h>
#include <linux/netdevice.h>
#include <linux/dmi.h>
#include "mvm.h"
#include "sta.h"
#include "iwl-io.h"
#include "debugfs.h"
#include "iwl-modparams.h"
#include "iwl-drv.h"
#include "fw/error-dump.h"
#include "fw/api/phy-ctxt.h"
static ssize_t iwl_dbgfs_ctdp_budget_read(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
{ … }
static ssize_t iwl_dbgfs_stop_ctdp_write(struct iwl_mvm *mvm, char *buf,
size_t count, loff_t *ppos)
{ … }
static ssize_t iwl_dbgfs_start_ctdp_write(struct iwl_mvm *mvm,
char *buf, size_t count,
loff_t *ppos)
{ … }
static ssize_t iwl_dbgfs_force_ctkill_write(struct iwl_mvm *mvm, char *buf,
size_t count, loff_t *ppos)
{ … }
static ssize_t iwl_dbgfs_tx_flush_write(struct iwl_mvm *mvm, char *buf,
size_t count, loff_t *ppos)
{ … }
static ssize_t iwl_dbgfs_sram_read(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{ … }
static ssize_t iwl_dbgfs_sram_write(struct iwl_mvm *mvm, char *buf,
size_t count, loff_t *ppos)
{ … }
static ssize_t iwl_dbgfs_set_nic_temperature_read(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
{ … }
static ssize_t iwl_dbgfs_set_nic_temperature_write(struct iwl_mvm *mvm,
char *buf, size_t count,
loff_t *ppos)
{ … }
static ssize_t iwl_dbgfs_nic_temp_read(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
{ … }
#ifdef CONFIG_ACPI
static ssize_t iwl_dbgfs_sar_geo_profile_read(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
{ … }
static ssize_t iwl_dbgfs_wifi_6e_enable_read(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
{ … }
#endif
static ssize_t iwl_dbgfs_stations_read(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{ … }
static ssize_t iwl_dbgfs_rs_data_read(struct ieee80211_link_sta *link_sta,
struct iwl_mvm_sta *mvmsta,
struct iwl_mvm *mvm,
struct iwl_mvm_link_sta *mvm_link_sta,
char __user *user_buf,
size_t count, loff_t *ppos)
{ … }
static ssize_t iwl_dbgfs_amsdu_len_write(struct ieee80211_link_sta *link_sta,
struct iwl_mvm_sta *mvmsta,
struct iwl_mvm *mvm,
struct iwl_mvm_link_sta *mvm_link_sta,
char *buf, size_t count,
loff_t *ppos)
{ … }
static ssize_t iwl_dbgfs_amsdu_len_read(struct ieee80211_link_sta *link_sta,
struct iwl_mvm_sta *mvmsta,
struct iwl_mvm *mvm,
struct iwl_mvm_link_sta *mvm_link_sta,
char __user *user_buf,
size_t count, loff_t *ppos)
{ … }
static ssize_t iwl_dbgfs_disable_power_off_read(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
{ … }
static ssize_t iwl_dbgfs_disable_power_off_write(struct iwl_mvm *mvm, char *buf,
size_t count, loff_t *ppos)
{ … }
static ssize_t iwl_dbgfs_fw_ver_read(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{ … }
static ssize_t iwl_dbgfs_tas_get_status_read(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
{ … }
static ssize_t iwl_dbgfs_phy_integration_ver_read(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
{ … }
#define PRINT_STATS_LE32(_struct, _memb) …
static ssize_t iwl_dbgfs_fw_rx_stats_read(struct file *file,
char __user *user_buf, size_t count,
loff_t *ppos)
{ … }
#undef PRINT_STAT_LE32
static ssize_t iwl_dbgfs_fw_system_stats_read(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
{ … }
static ssize_t iwl_dbgfs_frame_stats_read(struct iwl_mvm *mvm,
char __user *user_buf, size_t count,
loff_t *ppos,
struct iwl_mvm_frame_stats *stats)
{ … }
static ssize_t iwl_dbgfs_drv_rx_stats_read(struct file *file,
char __user *user_buf, size_t count,
loff_t *ppos)
{ … }
static ssize_t iwl_dbgfs_fw_restart_write(struct iwl_mvm *mvm, char *buf,
size_t count, loff_t *ppos)
{ … }
static ssize_t iwl_dbgfs_fw_nmi_write(struct iwl_mvm *mvm, char *buf,
size_t count, loff_t *ppos)
{ … }
static ssize_t
iwl_dbgfs_scan_ant_rxchain_read(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
{ … }
static ssize_t
iwl_dbgfs_scan_ant_rxchain_write(struct iwl_mvm *mvm, char *buf,
size_t count, loff_t *ppos)
{ … }
static ssize_t iwl_dbgfs_indirection_tbl_write(struct iwl_mvm *mvm,
char *buf, size_t count,
loff_t *ppos)
{ … }
static ssize_t iwl_dbgfs_inject_packet_write(struct iwl_mvm *mvm,
char *buf, size_t count,
loff_t *ppos)
{ … }
static int _iwl_dbgfs_inject_beacon_ie(struct iwl_mvm *mvm, char *bin, int len)
{ … }
static ssize_t iwl_dbgfs_inject_beacon_ie_write(struct iwl_mvm *mvm,
char *buf, size_t count,
loff_t *ppos)
{ … }
static ssize_t iwl_dbgfs_inject_beacon_ie_restore_write(struct iwl_mvm *mvm,
char *buf,
size_t count,
loff_t *ppos)
{ … }
static ssize_t iwl_dbgfs_fw_dbg_conf_read(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
{ … }
static ssize_t iwl_dbgfs_fw_dbg_conf_write(struct iwl_mvm *mvm,
char *buf, size_t count,
loff_t *ppos)
{ … }
static ssize_t iwl_dbgfs_fw_dbg_collect_write(struct iwl_mvm *mvm,
char *buf, size_t count,
loff_t *ppos)
{ … }
static ssize_t iwl_dbgfs_fw_dbg_clear_write(struct iwl_mvm *mvm,
char *buf, size_t count,
loff_t *ppos)
{ … }
static ssize_t iwl_dbgfs_dbg_time_point_write(struct iwl_mvm *mvm,
char *buf, size_t count,
loff_t *ppos)
{ … }
#define MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz) …
#define MVM_DEBUGFS_READ_WRITE_FILE_OPS(name, bufsz) …
#define MVM_DEBUGFS_ADD_FILE_ALIAS(alias, name, parent, mode) …
#define MVM_DEBUGFS_ADD_FILE(name, parent, mode) …
static ssize_t
_iwl_dbgfs_link_sta_wrap_write(ssize_t (*real)(struct ieee80211_link_sta *,
struct iwl_mvm_sta *,
struct iwl_mvm *,
struct iwl_mvm_link_sta *,
char *,
size_t, loff_t *),
struct file *file,
char *buf, size_t buf_size, loff_t *ppos)
{ … }
static ssize_t
_iwl_dbgfs_link_sta_wrap_read(ssize_t (*real)(struct ieee80211_link_sta *,
struct iwl_mvm_sta *,
struct iwl_mvm *,
struct iwl_mvm_link_sta *,
char __user *,
size_t, loff_t *),
struct file *file,
char __user *user_buf, size_t count, loff_t *ppos)
{ … }
#define MVM_DEBUGFS_LINK_STA_WRITE_WRAPPER(name, buflen) … \
#define MVM_DEBUGFS_LINK_STA_READ_WRAPPER(name) … \
#define MVM_DEBUGFS_WRITE_LINK_STA_FILE_OPS(name, bufsz) …
#define MVM_DEBUGFS_READ_LINK_STA_FILE_OPS(name) …
#define MVM_DEBUGFS_READ_WRITE_LINK_STA_FILE_OPS(name, bufsz) …
#define MVM_DEBUGFS_ADD_LINK_STA_FILE_ALIAS(alias, name, parent, mode) …
#define MVM_DEBUGFS_ADD_LINK_STA_FILE(name, parent, mode) …
static ssize_t
iwl_dbgfs_prph_reg_read(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
{ … }
static ssize_t
iwl_dbgfs_prph_reg_write(struct iwl_mvm *mvm, char *buf,
size_t count, loff_t *ppos)
{ … }
static ssize_t
iwl_dbgfs_send_echo_cmd_write(struct iwl_mvm *mvm, char *buf,
size_t count, loff_t *ppos)
{ … }
struct iwl_mvm_sniffer_apply { … };
static bool iwl_mvm_sniffer_apply(struct iwl_notif_wait_data *notif_data,
struct iwl_rx_packet *pkt, void *data)
{ … }
static ssize_t
iwl_dbgfs_he_sniffer_params_write(struct iwl_mvm *mvm, char *buf,
size_t count, loff_t *ppos)
{ … }
static ssize_t
iwl_dbgfs_he_sniffer_params_read(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{ … }
static ssize_t
iwl_dbgfs_uapsd_noagg_bssids_read(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{ … }
static ssize_t
iwl_dbgfs_ltr_config_write(struct iwl_mvm *mvm,
char *buf, size_t count, loff_t *ppos)
{ … }
static ssize_t iwl_dbgfs_rfi_freq_table_write(struct iwl_mvm *mvm, char *buf,
size_t count, loff_t *ppos)
{ … }
#define IWL_RFI_BUF_SIZE …
static ssize_t iwl_dbgfs_rfi_freq_table_read(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
{ … }
MVM_DEBUGFS_READ_WRITE_FILE_OPS(prph_reg, 64);
MVM_DEBUGFS_READ_FILE_OPS(…);
MVM_DEBUGFS_WRITE_FILE_OPS(stop_ctdp, 8);
MVM_DEBUGFS_WRITE_FILE_OPS(start_ctdp, 8);
MVM_DEBUGFS_WRITE_FILE_OPS(force_ctkill, 8);
MVM_DEBUGFS_WRITE_FILE_OPS(tx_flush, 16);
MVM_DEBUGFS_WRITE_FILE_OPS(send_echo_cmd, 8);
MVM_DEBUGFS_READ_WRITE_FILE_OPS(sram, 64);
MVM_DEBUGFS_READ_WRITE_FILE_OPS(set_nic_temperature, 64);
MVM_DEBUGFS_READ_FILE_OPS(…);
MVM_DEBUGFS_READ_FILE_OPS(…);
MVM_DEBUGFS_READ_LINK_STA_FILE_OPS(…);
MVM_DEBUGFS_READ_WRITE_FILE_OPS(disable_power_off, 64);
MVM_DEBUGFS_READ_FILE_OPS(…);
MVM_DEBUGFS_READ_FILE_OPS(…);
MVM_DEBUGFS_READ_FILE_OPS(…);
MVM_DEBUGFS_READ_FILE_OPS(…);
MVM_DEBUGFS_READ_FILE_OPS(…);
MVM_DEBUGFS_READ_FILE_OPS(…);
MVM_DEBUGFS_WRITE_FILE_OPS(fw_restart, 10);
MVM_DEBUGFS_WRITE_FILE_OPS(fw_nmi, 10);
MVM_DEBUGFS_READ_WRITE_FILE_OPS(scan_ant_rxchain, 8);
MVM_DEBUGFS_READ_WRITE_FILE_OPS(fw_dbg_conf, 8);
MVM_DEBUGFS_WRITE_FILE_OPS(fw_dbg_collect, 64);
MVM_DEBUGFS_WRITE_FILE_OPS(fw_dbg_clear, 64);
MVM_DEBUGFS_WRITE_FILE_OPS(dbg_time_point, 64);
MVM_DEBUGFS_WRITE_FILE_OPS(indirection_tbl,
(IWL_RSS_INDIRECTION_TABLE_SIZE * 2));
MVM_DEBUGFS_WRITE_FILE_OPS(inject_packet, 512);
MVM_DEBUGFS_WRITE_FILE_OPS(inject_beacon_ie, 512);
MVM_DEBUGFS_WRITE_FILE_OPS(inject_beacon_ie_restore, 512);
MVM_DEBUGFS_READ_FILE_OPS(…);
#ifdef CONFIG_ACPI
MVM_DEBUGFS_READ_FILE_OPS(…);
MVM_DEBUGFS_READ_FILE_OPS(…);
#endif
MVM_DEBUGFS_READ_WRITE_LINK_STA_FILE_OPS(…);
MVM_DEBUGFS_READ_WRITE_FILE_OPS(he_sniffer_params, 32);
MVM_DEBUGFS_WRITE_FILE_OPS(ltr_config, 512);
MVM_DEBUGFS_READ_WRITE_FILE_OPS(rfi_freq_table, 16);
static ssize_t iwl_dbgfs_mem_read(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{ … }
static ssize_t iwl_dbgfs_mem_write(struct file *file,
const char __user *user_buf, size_t count,
loff_t *ppos)
{ … }
static const struct file_operations iwl_dbgfs_mem_ops = …;
void iwl_mvm_link_sta_add_debugfs(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct ieee80211_link_sta *link_sta,
struct dentry *dir)
{ … }
void iwl_mvm_dbgfs_register(struct iwl_mvm *mvm)
{ … }