|
|
|
|
@ -391,13 +391,14 @@ static ssize_t iwl_dbgfs_stations_read(struct file *file, char __user *user_buf,
|
|
|
|
|
return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static ssize_t iwl_dbgfs_rs_data_read(struct file *file, char __user *user_buf,
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
struct ieee80211_sta *sta = file->private_data;
|
|
|
|
|
struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
|
|
|
|
|
struct iwl_lq_sta_rs_fw *lq_sta = &mvmsta->deflink.lq_sta.rs_fw;
|
|
|
|
|
struct iwl_mvm *mvm = lq_sta->pers.drv;
|
|
|
|
|
struct iwl_lq_sta_rs_fw *lq_sta = &mvm_link_sta->lq_sta.rs_fw;
|
|
|
|
|
static const size_t bufsz = 2048;
|
|
|
|
|
char *buff;
|
|
|
|
|
int desc = 0;
|
|
|
|
|
@ -407,8 +408,6 @@ static ssize_t iwl_dbgfs_rs_data_read(struct file *file, char __user *user_buf,
|
|
|
|
|
if (!buff)
|
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
|
|
mutex_lock(&mvm->mutex);
|
|
|
|
|
|
|
|
|
|
desc += scnprintf(buff + desc, bufsz - desc, "sta_id %d\n",
|
|
|
|
|
lq_sta->pers.sta_id);
|
|
|
|
|
desc += scnprintf(buff + desc, bufsz - desc,
|
|
|
|
|
@ -429,18 +428,19 @@ static ssize_t iwl_dbgfs_rs_data_read(struct file *file, char __user *user_buf,
|
|
|
|
|
lq_sta->last_rate_n_flags);
|
|
|
|
|
if (desc < bufsz - 1)
|
|
|
|
|
buff[desc++] = '\n';
|
|
|
|
|
mutex_unlock(&mvm->mutex);
|
|
|
|
|
|
|
|
|
|
ret = simple_read_from_buffer(user_buf, count, ppos, buff, desc);
|
|
|
|
|
kfree(buff);
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static ssize_t iwl_dbgfs_amsdu_len_write(struct ieee80211_sta *sta,
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
|
|
|
|
|
int i;
|
|
|
|
|
u16 amsdu_len;
|
|
|
|
|
|
|
|
|
|
@ -448,36 +448,39 @@ static ssize_t iwl_dbgfs_amsdu_len_write(struct ieee80211_sta *sta,
|
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
|
|
/* only change from debug set <-> debug unset */
|
|
|
|
|
if (amsdu_len && mvmsta->orig_amsdu_len)
|
|
|
|
|
if (amsdu_len && mvm_link_sta->orig_amsdu_len)
|
|
|
|
|
return -EBUSY;
|
|
|
|
|
|
|
|
|
|
if (amsdu_len) {
|
|
|
|
|
mvmsta->orig_amsdu_len = sta->cur->max_amsdu_len;
|
|
|
|
|
sta->deflink.agg.max_amsdu_len = amsdu_len;
|
|
|
|
|
sta->deflink.agg.max_amsdu_len = amsdu_len;
|
|
|
|
|
for (i = 0; i < ARRAY_SIZE(sta->deflink.agg.max_tid_amsdu_len); i++)
|
|
|
|
|
sta->deflink.agg.max_tid_amsdu_len[i] = amsdu_len;
|
|
|
|
|
mvm_link_sta->orig_amsdu_len = link_sta->agg.max_amsdu_len;
|
|
|
|
|
link_sta->agg.max_amsdu_len = amsdu_len;
|
|
|
|
|
link_sta->agg.max_amsdu_len = amsdu_len;
|
|
|
|
|
for (i = 0; i < ARRAY_SIZE(link_sta->agg.max_tid_amsdu_len); i++)
|
|
|
|
|
link_sta->agg.max_tid_amsdu_len[i] = amsdu_len;
|
|
|
|
|
} else {
|
|
|
|
|
sta->deflink.agg.max_amsdu_len = mvmsta->orig_amsdu_len;
|
|
|
|
|
mvmsta->orig_amsdu_len = 0;
|
|
|
|
|
link_sta->agg.max_amsdu_len = mvm_link_sta->orig_amsdu_len;
|
|
|
|
|
mvm_link_sta->orig_amsdu_len = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ieee80211_sta_recalc_aggregates(link_sta->sta);
|
|
|
|
|
|
|
|
|
|
return count;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static ssize_t iwl_dbgfs_amsdu_len_read(struct file *file,
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
struct ieee80211_sta *sta = file->private_data;
|
|
|
|
|
struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
|
|
|
|
|
|
|
|
|
|
char buf[32];
|
|
|
|
|
int pos;
|
|
|
|
|
|
|
|
|
|
pos = scnprintf(buf, sizeof(buf), "current %d ", sta->cur->max_amsdu_len);
|
|
|
|
|
pos = scnprintf(buf, sizeof(buf), "current %d ",
|
|
|
|
|
link_sta->agg.max_amsdu_len);
|
|
|
|
|
pos += scnprintf(buf + pos, sizeof(buf) - pos, "stored %d\n",
|
|
|
|
|
mvmsta->orig_amsdu_len);
|
|
|
|
|
mvm_link_sta->orig_amsdu_len);
|
|
|
|
|
|
|
|
|
|
return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
|
|
|
|
}
|
|
|
|
|
@ -1596,17 +1599,127 @@ static ssize_t iwl_dbgfs_dbg_time_point_write(struct iwl_mvm *mvm,
|
|
|
|
|
#define MVM_DEBUGFS_ADD_FILE(name, parent, mode) \
|
|
|
|
|
MVM_DEBUGFS_ADD_FILE_ALIAS(#name, name, parent, mode)
|
|
|
|
|
|
|
|
|
|
#define MVM_DEBUGFS_WRITE_STA_FILE_OPS(name, bufsz) \
|
|
|
|
|
_MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz, struct ieee80211_sta)
|
|
|
|
|
#define MVM_DEBUGFS_READ_WRITE_STA_FILE_OPS(name, bufsz) \
|
|
|
|
|
_MVM_DEBUGFS_READ_WRITE_FILE_OPS(name, bufsz, struct ieee80211_sta)
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
struct ieee80211_link_sta *link_sta = file->private_data;
|
|
|
|
|
struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(link_sta->sta);
|
|
|
|
|
struct iwl_mvm *mvm = iwl_mvm_vif_from_mac80211(mvmsta->vif)->mvm;
|
|
|
|
|
struct iwl_mvm_link_sta *mvm_link_sta;
|
|
|
|
|
ssize_t ret;
|
|
|
|
|
|
|
|
|
|
#define MVM_DEBUGFS_ADD_STA_FILE_ALIAS(alias, name, parent, mode) do { \
|
|
|
|
|
debugfs_create_file(alias, mode, parent, sta, \
|
|
|
|
|
&iwl_dbgfs_##name##_ops); \
|
|
|
|
|
} while (0)
|
|
|
|
|
#define MVM_DEBUGFS_ADD_STA_FILE(name, parent, mode) \
|
|
|
|
|
MVM_DEBUGFS_ADD_STA_FILE_ALIAS(#name, name, parent, mode)
|
|
|
|
|
mutex_lock(&mvm->mutex);
|
|
|
|
|
|
|
|
|
|
mvm_link_sta = rcu_dereference_protected(mvmsta->link[link_sta->link_id],
|
|
|
|
|
lockdep_is_held(&mvm->mutex));
|
|
|
|
|
if (WARN_ON(!mvm_link_sta)) {
|
|
|
|
|
mutex_unlock(&mvm->mutex);
|
|
|
|
|
return -ENODEV;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ret = real(link_sta, mvmsta, mvm, mvm_link_sta, buf, buf_size, ppos);
|
|
|
|
|
|
|
|
|
|
mutex_unlock(&mvm->mutex);
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
struct ieee80211_link_sta *link_sta = file->private_data;
|
|
|
|
|
struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(link_sta->sta);
|
|
|
|
|
struct iwl_mvm *mvm = iwl_mvm_vif_from_mac80211(mvmsta->vif)->mvm;
|
|
|
|
|
struct iwl_mvm_link_sta *mvm_link_sta;
|
|
|
|
|
ssize_t ret;
|
|
|
|
|
|
|
|
|
|
mutex_lock(&mvm->mutex);
|
|
|
|
|
|
|
|
|
|
mvm_link_sta = rcu_dereference_protected(mvmsta->link[link_sta->link_id],
|
|
|
|
|
lockdep_is_held(&mvm->mutex));
|
|
|
|
|
if (WARN_ON(!mvm_link_sta)) {
|
|
|
|
|
mutex_unlock(&mvm->mutex);
|
|
|
|
|
return -ENODEV;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ret = real(link_sta, mvmsta, mvm, mvm_link_sta, user_buf, count, ppos);
|
|
|
|
|
|
|
|
|
|
mutex_unlock(&mvm->mutex);
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define MVM_DEBUGFS_LINK_STA_WRITE_WRAPPER(name, buflen) \
|
|
|
|
|
static ssize_t _iwl_dbgfs_link_sta_##name##_write(struct file *file, \
|
|
|
|
|
const char __user *user_buf, \
|
|
|
|
|
size_t count, loff_t *ppos) \
|
|
|
|
|
{ \
|
|
|
|
|
char buf[buflen] = {}; \
|
|
|
|
|
size_t buf_size = min(count, sizeof(buf) - 1); \
|
|
|
|
|
\
|
|
|
|
|
if (copy_from_user(buf, user_buf, sizeof(buf))) \
|
|
|
|
|
return -EFAULT; \
|
|
|
|
|
\
|
|
|
|
|
return _iwl_dbgfs_link_sta_wrap_write(iwl_dbgfs_##name##_write, \
|
|
|
|
|
file, \
|
|
|
|
|
buf, buf_size, ppos); \
|
|
|
|
|
} \
|
|
|
|
|
|
|
|
|
|
#define MVM_DEBUGFS_LINK_STA_READ_WRAPPER(name) \
|
|
|
|
|
static ssize_t _iwl_dbgfs_link_sta_##name##_read(struct file *file, \
|
|
|
|
|
char __user *user_buf, \
|
|
|
|
|
size_t count, loff_t *ppos) \
|
|
|
|
|
{ \
|
|
|
|
|
return _iwl_dbgfs_link_sta_wrap_read(iwl_dbgfs_##name##_read, \
|
|
|
|
|
file, \
|
|
|
|
|
user_buf, count, ppos); \
|
|
|
|
|
} \
|
|
|
|
|
|
|
|
|
|
#define MVM_DEBUGFS_WRITE_LINK_STA_FILE_OPS(name, bufsz) \
|
|
|
|
|
MVM_DEBUGFS_LINK_STA_WRITE_WRAPPER(name, bufsz) \
|
|
|
|
|
static const struct file_operations iwl_dbgfs_link_sta_##name##_ops = { \
|
|
|
|
|
.write = _iwl_dbgfs_link_sta_##name##_write, \
|
|
|
|
|
.open = simple_open, \
|
|
|
|
|
.llseek = generic_file_llseek, \
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define MVM_DEBUGFS_READ_LINK_STA_FILE_OPS(name) \
|
|
|
|
|
MVM_DEBUGFS_LINK_STA_READ_WRAPPER(name) \
|
|
|
|
|
static const struct file_operations iwl_dbgfs_link_sta_##name##_ops = { \
|
|
|
|
|
.read = _iwl_dbgfs_link_sta_##name##_read, \
|
|
|
|
|
.open = simple_open, \
|
|
|
|
|
.llseek = generic_file_llseek, \
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define MVM_DEBUGFS_READ_WRITE_LINK_STA_FILE_OPS(name, bufsz) \
|
|
|
|
|
MVM_DEBUGFS_LINK_STA_READ_WRAPPER(name) \
|
|
|
|
|
MVM_DEBUGFS_LINK_STA_WRITE_WRAPPER(name, bufsz) \
|
|
|
|
|
static const struct file_operations iwl_dbgfs_link_sta_##name##_ops = { \
|
|
|
|
|
.read = _iwl_dbgfs_link_sta_##name##_read, \
|
|
|
|
|
.write = _iwl_dbgfs_link_sta_##name##_write, \
|
|
|
|
|
.open = simple_open, \
|
|
|
|
|
.llseek = generic_file_llseek, \
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define MVM_DEBUGFS_ADD_LINK_STA_FILE_ALIAS(alias, name, parent, mode) \
|
|
|
|
|
debugfs_create_file(alias, mode, parent, link_sta, \
|
|
|
|
|
&iwl_dbgfs_link_sta_##name##_ops)
|
|
|
|
|
#define MVM_DEBUGFS_ADD_LINK_STA_FILE(name, parent, mode) \
|
|
|
|
|
MVM_DEBUGFS_ADD_LINK_STA_FILE_ALIAS(#name, name, parent, mode)
|
|
|
|
|
|
|
|
|
|
static ssize_t
|
|
|
|
|
iwl_dbgfs_prph_reg_read(struct file *file,
|
|
|
|
|
@ -1891,7 +2004,7 @@ MVM_DEBUGFS_READ_WRITE_FILE_OPS(sram, 64);
|
|
|
|
|
MVM_DEBUGFS_READ_WRITE_FILE_OPS(set_nic_temperature, 64);
|
|
|
|
|
MVM_DEBUGFS_READ_FILE_OPS(nic_temp);
|
|
|
|
|
MVM_DEBUGFS_READ_FILE_OPS(stations);
|
|
|
|
|
MVM_DEBUGFS_READ_FILE_OPS(rs_data);
|
|
|
|
|
MVM_DEBUGFS_READ_LINK_STA_FILE_OPS(rs_data);
|
|
|
|
|
MVM_DEBUGFS_READ_FILE_OPS(bt_notif);
|
|
|
|
|
MVM_DEBUGFS_READ_FILE_OPS(bt_cmd);
|
|
|
|
|
MVM_DEBUGFS_READ_WRITE_FILE_OPS(disable_power_off, 64);
|
|
|
|
|
@ -1921,7 +2034,7 @@ MVM_DEBUGFS_READ_FILE_OPS(sar_geo_profile);
|
|
|
|
|
MVM_DEBUGFS_READ_FILE_OPS(wifi_6e_enable);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
MVM_DEBUGFS_READ_WRITE_STA_FILE_OPS(amsdu_len, 16);
|
|
|
|
|
MVM_DEBUGFS_READ_WRITE_LINK_STA_FILE_OPS(amsdu_len, 16);
|
|
|
|
|
|
|
|
|
|
MVM_DEBUGFS_READ_WRITE_FILE_OPS(he_sniffer_params, 32);
|
|
|
|
|
|
|
|
|
|
@ -2068,17 +2181,18 @@ static const struct file_operations iwl_dbgfs_mem_ops = {
|
|
|
|
|
.llseek = default_llseek,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void iwl_mvm_sta_add_debugfs(struct ieee80211_hw *hw,
|
|
|
|
|
struct ieee80211_vif *vif,
|
|
|
|
|
struct ieee80211_sta *sta,
|
|
|
|
|
struct dentry *dir)
|
|
|
|
|
void iwl_mvm_link_sta_add_debugfs(struct ieee80211_hw *hw,
|
|
|
|
|
struct ieee80211_vif *vif,
|
|
|
|
|
struct ieee80211_link_sta *link_sta,
|
|
|
|
|
struct dentry *dir)
|
|
|
|
|
{
|
|
|
|
|
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
|
|
|
|
|
|
|
|
|
|
if (iwl_mvm_has_tlc_offload(mvm)) {
|
|
|
|
|
MVM_DEBUGFS_ADD_STA_FILE(rs_data, dir, 0400);
|
|
|
|
|
MVM_DEBUGFS_ADD_LINK_STA_FILE(rs_data, dir, 0400);
|
|
|
|
|
}
|
|
|
|
|
MVM_DEBUGFS_ADD_STA_FILE(amsdu_len, dir, 0600);
|
|
|
|
|
|
|
|
|
|
MVM_DEBUGFS_ADD_LINK_STA_FILE(amsdu_len, dir, 0600);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void iwl_mvm_dbgfs_register(struct iwl_mvm *mvm)
|
|
|
|
|
|