iwlwifi: mvm: add read debugfs for he_sniffer_params
authorLiad Kaufman <liad.kaufman@intel.com>
Tue, 15 Jan 2019 11:38:30 +0000 (13:38 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Wed, 20 Feb 2019 18:47:57 +0000 (20:47 +0200)
Return the AID currently set when reading this debugfs entry.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h

index 05a6db2db478a46c13dacf1b304e775d7b0aebdd..776b24f5420006635c96520a4624bb2cd007a649 100644 (file)
@@ -1789,6 +1789,7 @@ iwl_dbgfs_send_echo_cmd_write(struct iwl_mvm *mvm, char *buf,
 
 struct iwl_mvm_sniffer_apply {
        struct iwl_mvm *mvm;
+       u8 *bssid;
        u16 aid;
 };
 
@@ -1798,6 +1799,8 @@ static bool iwl_mvm_sniffer_apply(struct iwl_notif_wait_data *notif_data,
        struct iwl_mvm_sniffer_apply *apply = data;
 
        apply->mvm->cur_aid = cpu_to_le16(apply->aid);
+       memcpy(apply->mvm->cur_bssid, apply->bssid,
+              sizeof(apply->mvm->cur_bssid));
 
        return true;
 }
@@ -1830,6 +1833,7 @@ iwl_dbgfs_he_sniffer_params_write(struct iwl_mvm *mvm, char *buf,
        he_mon_cmd.aid = cpu_to_le16(aid);
 
        apply.aid = aid;
+       apply.bssid = (void *)he_mon_cmd.bssid;
 
        mutex_lock(&mvm->mutex);
 
@@ -1858,6 +1862,23 @@ iwl_dbgfs_he_sniffer_params_write(struct iwl_mvm *mvm, char *buf,
        return ret ?: count;
 }
 
+static ssize_t
+iwl_dbgfs_he_sniffer_params_read(struct file *file, char __user *user_buf,
+                                size_t count, loff_t *ppos)
+{
+       struct iwl_mvm *mvm = file->private_data;
+       u8 buf[32];
+       int len;
+
+       len = scnprintf(buf, sizeof(buf),
+                       "%d %02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx\n",
+                       le16_to_cpu(mvm->cur_aid), mvm->cur_bssid[0],
+                       mvm->cur_bssid[1], mvm->cur_bssid[2], mvm->cur_bssid[3],
+                       mvm->cur_bssid[4], mvm->cur_bssid[5]);
+
+       return simple_read_from_buffer(user_buf, count, ppos, buf, len);
+}
+
 static ssize_t
 iwl_dbgfs_uapsd_noagg_bssids_read(struct file *file, char __user *user_buf,
                                  size_t count, loff_t *ppos)
@@ -1928,7 +1949,7 @@ MVM_DEBUGFS_READ_WRITE_FILE_OPS(d3_sram, 8);
 MVM_DEBUGFS_READ_FILE_OPS(sar_geo_profile);
 #endif
 
-MVM_DEBUGFS_WRITE_FILE_OPS(he_sniffer_params, 32);
+MVM_DEBUGFS_READ_WRITE_FILE_OPS(he_sniffer_params, 32);
 
 static ssize_t iwl_dbgfs_mem_read(struct file *file, char __user *user_buf,
                                  size_t count, loff_t *ppos)
@@ -2119,7 +2140,7 @@ int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir)
 #ifdef CONFIG_ACPI
        MVM_DEBUGFS_ADD_FILE(sar_geo_profile, dbgfs_dir, 0400);
 #endif
-       MVM_DEBUGFS_ADD_FILE(he_sniffer_params, mvm->debugfs_dir, 0200);
+       MVM_DEBUGFS_ADD_FILE(he_sniffer_params, mvm->debugfs_dir, 0600);
 
        if (!debugfs_create_bool("enable_scan_iteration_notif",
                                 0600,
index acb4cca5bdcf96aba1d389fc9426e8c576d9737d..148aee1ad79da931fa7743f7bd9af33fd5ab3f8f 100644 (file)
@@ -1176,6 +1176,7 @@ struct iwl_mvm {
 
        /* sniffer data to include in radiotap */
        __le16 cur_aid;
+       u8 cur_bssid[ETH_ALEN];
 
 #ifdef CONFIG_ACPI
        struct iwl_mvm_sar_profile sar_profiles[ACPI_SAR_PROFILE_NUM];