Skip to content

Commit ff907d9

Browse files
yedidyaBenshjmberg-intel
authored andcommitted
wifi: iwlwifi: mvm: add a debugfs for reading EMLSR blocking reasons
Add a reading for all active EMLSR blocking reasons for testing purposes. Signed-off-by: Yedidya Benshimol <yedidya.ben.shimol@intel.com> Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com> Link: https://msgid.link/20240506095953.6d494a335e81.Ic0fa6a9636e3c1a3b1420e85e704a19d4a56e8d9@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 05f10da commit ff907d9

3 files changed

Lines changed: 40 additions & 5 deletions

File tree

drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -722,8 +722,41 @@ static ssize_t iwl_dbgfs_int_mlo_scan_write(struct ieee80211_vif *vif,
722722
return ret ?: count;
723723
}
724724

725-
static ssize_t iwl_dbgfs_block_esr_write(struct ieee80211_vif *vif, char *buf,
726-
size_t count, loff_t *ppos)
725+
static ssize_t iwl_dbgfs_esr_disable_reason_read(struct file *file,
726+
char __user *user_buf,
727+
size_t count, loff_t *ppos)
728+
{
729+
struct ieee80211_vif *vif = file->private_data;
730+
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
731+
struct iwl_mvm *mvm = mvmvif->mvm;
732+
unsigned long esr_mask;
733+
char *buf;
734+
int bufsz, pos, i;
735+
ssize_t rv;
736+
737+
mutex_lock(&mvm->mutex);
738+
esr_mask = mvmvif->esr_disable_reason;
739+
mutex_unlock(&mvm->mutex);
740+
741+
bufsz = hweight32(esr_mask) * 32 + 40;
742+
buf = kmalloc(bufsz, GFP_KERNEL);
743+
if (!buf)
744+
return -ENOMEM;
745+
746+
pos = scnprintf(buf, bufsz, "EMLSR state: '0x%lx'\nreasons:\n",
747+
esr_mask);
748+
for_each_set_bit(i, &esr_mask, BITS_PER_LONG)
749+
pos += scnprintf(buf + pos, bufsz - pos, " - %s\n",
750+
iwl_get_esr_state_string(BIT(i)));
751+
752+
rv = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
753+
kfree(buf);
754+
return rv;
755+
}
756+
757+
static ssize_t iwl_dbgfs_esr_disable_reason_write(struct ieee80211_vif *vif,
758+
char *buf, size_t count,
759+
loff_t *ppos)
727760
{
728761
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
729762
struct iwl_mvm *mvm = mvmvif->mvm;
@@ -769,7 +802,7 @@ MVM_DEBUGFS_READ_WRITE_FILE_OPS(rx_phyinfo, 10);
769802
MVM_DEBUGFS_READ_WRITE_FILE_OPS(quota_min, 32);
770803
MVM_DEBUGFS_READ_FILE_OPS(os_device_timediff);
771804
MVM_DEBUGFS_WRITE_FILE_OPS(int_mlo_scan, 32);
772-
MVM_DEBUGFS_WRITE_FILE_OPS(block_esr, 32);
805+
MVM_DEBUGFS_READ_WRITE_FILE_OPS(esr_disable_reason, 32);
773806

774807
void iwl_mvm_vif_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
775808
{
@@ -800,7 +833,7 @@ void iwl_mvm_vif_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
800833
debugfs_create_bool("ftm_unprotected", 0200, mvmvif->dbgfs_dir,
801834
&mvmvif->ftm_unprotected);
802835
MVM_DEBUGFS_ADD_FILE_VIF(int_mlo_scan, mvmvif->dbgfs_dir, 0200);
803-
MVM_DEBUGFS_ADD_FILE_VIF(block_esr, mvmvif->dbgfs_dir, 0600);
836+
MVM_DEBUGFS_ADD_FILE_VIF(esr_disable_reason, mvmvif->dbgfs_dir, 0600);
804837

805838
if (vif->type == NL80211_IFTYPE_STATION && !vif->p2p &&
806839
mvmvif == mvm->bf_allowed_vif)

drivers/net/wireless/intel/iwlwifi/mvm/link.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ static const char *const iwl_mvm_esr_states_names[] = {
2222
HANDLE_ESR_REASONS(NAME_ENTRY)
2323
};
2424

25-
static const char *iwl_get_esr_state_string(enum iwl_mvm_esr_state state)
25+
const char *iwl_get_esr_state_string(enum iwl_mvm_esr_state state)
2626
{
2727
int offs = ilog2(state);
2828

drivers/net/wireless/intel/iwlwifi/mvm/mvm.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,8 @@ enum iwl_mvm_esr_state {
385385

386386
#define IWL_MVM_BLOCK_ESR_REASONS 0xffff
387387

388+
const char *iwl_get_esr_state_string(enum iwl_mvm_esr_state state);
389+
388390
/**
389391
* struct iwl_mvm_esr_exit - details of the last exit from EMLSR mode.
390392
* @reason: The reason for the last exit from EMLSR.

0 commit comments

Comments
 (0)