iwlwifi: mvm: enable sending HE_AIR_SNIFFER command via debugfs
authorShaul Triebitz <shaul.triebitz@intel.com>
Sun, 25 Feb 2018 16:37:30 +0000 (18:37 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Fri, 28 Sep 2018 05:57:23 +0000 (08:57 +0300)
In order to receive TB (Trigger Based) PPDU in monitor mode,
the Driver must send the HE_AIR_SNIFFER_CONFIG_CMD host command.
Enable that via debugfs.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Ido Yariv <idox.yariv@intel.com>
Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/api/datapath.h
drivers/net/wireless/intel/iwlwifi/fw/api/mac.h
drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c

index 59b3c6e8f37b609cf269c8915cdbe3bf7867079b..eff3249af48ad6a291f07c149b7490421f4e8008 100644 (file)
@@ -99,6 +99,11 @@ enum iwl_data_path_subcmd_ids {
         */
        TLC_MNG_CONFIG_CMD = 0xF,
 
+       /**
+        * @HE_AIR_SNIFFER_CONFIG_CMD: &struct iwl_he_monitor_cmd
+        */
+       HE_AIR_SNIFFER_CONFIG_CMD = 0x13,
+
        /**
         * @TLC_MNG_UPDATE_NOTIF: &struct iwl_tlc_update_notif
         */
index 55594c93b014cfe9c94ed689dd7482d835217bfe..1dd23f846fb9c4c89f8a0efa73a71efa83f0f08c 100644 (file)
@@ -578,4 +578,18 @@ struct iwl_he_sta_context_cmd {
        struct iwl_he_backoff_conf trig_based_txf[AC_NUM];
 } __packed; /* STA_CONTEXT_DOT11AX_API_S */
 
+/**
+ * struct iwl_he_monitor_cmd - configure air sniffer for HE
+ * @bssid: the BSSID to sniff for
+ * @reserved1: reserved for dword alignment
+ * @aid: the AID to track on for HE MU
+ * @reserved2: reserved for future use
+ */
+struct iwl_he_monitor_cmd {
+       u8 bssid[6];
+       __le16 reserved1;
+       __le16 aid;
+       u8 reserved2[6];
+} __packed; /* HE_AIR_SNIFFER_CONFIG_CMD_API_S_VER_1 */
+
 #endif /* __iwl_fw_api_mac_h__ */
index 202158d03d366830b058752eeec3a77cf8d9f8b1..de40752aa67e0218ae2046f30983ec87cd1ccb07 100644 (file)
@@ -1727,6 +1727,35 @@ iwl_dbgfs_send_echo_cmd_write(struct iwl_mvm *mvm, char *buf,
        return ret ?: count;
 }
 
+static ssize_t
+iwl_dbgfs_he_sniffer_params_write(struct iwl_mvm *mvm, char *buf,
+                       size_t count, loff_t *ppos)
+{
+       struct iwl_he_monitor_cmd he_mon_cmd = {};
+       u32 aid;
+       int ret;
+
+       if (!iwl_mvm_firmware_running(mvm))
+               return -EIO;
+
+       ret = sscanf(buf, "%x %2hhx:%2hhx:%2hhx:%2hhx:%2hhx:%2hhx", &aid,
+                    &he_mon_cmd.bssid[0], &he_mon_cmd.bssid[1],
+                    &he_mon_cmd.bssid[2], &he_mon_cmd.bssid[3],
+                    &he_mon_cmd.bssid[4], &he_mon_cmd.bssid[5]);
+       if (ret != 7)
+               return -EINVAL;
+
+       he_mon_cmd.aid = cpu_to_le16(aid);
+
+       mutex_lock(&mvm->mutex);
+       ret = iwl_mvm_send_cmd_pdu(mvm, iwl_cmd_id(HE_AIR_SNIFFER_CONFIG_CMD,
+                                                  DATA_PATH_GROUP, 0), 0,
+                                  sizeof(he_mon_cmd), &he_mon_cmd);
+       mutex_unlock(&mvm->mutex);
+
+       return ret ?: count;
+}
+
 static ssize_t
 iwl_dbgfs_uapsd_noagg_bssids_read(struct file *file, char __user *user_buf,
                                  size_t count, loff_t *ppos)
@@ -1796,6 +1825,8 @@ 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);
+
 static ssize_t iwl_dbgfs_mem_read(struct file *file, char __user *user_buf,
                                  size_t count, loff_t *ppos)
 {
@@ -1984,6 +2015,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);
 
        if (!debugfs_create_bool("enable_scan_iteration_notif",
                                 0600,