]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
iwlwifi: mvm: clean up LDBG config command usage
authorJohannes Berg <johannes.berg@intel.com>
Mon, 29 Oct 2018 12:50:05 +0000 (13:50 +0100)
committerLuca Coelho <luciano.coelho@intel.com>
Tue, 29 Jan 2019 14:10:30 +0000 (16:10 +0200)
Clean up the LDBG config command to not be called "continuous
recording", and while at it actually remove the continuous
recording implementation completely since it was only used for
store & forward architectures.

This also fixes a bug at least in iwl_fw_dbg_buffer_allocation()
because what's now "__le32 type" (matching the firmware) used to
be "__le16 enable_recording", so the buffer allocation config
sub-struct would erroneously have started at the wrong offset.
In the other cases this didn't actually lead to a bug as other
bytes in pad[] were all zeroes, so accessing the 16-bit value as
a 32-bit value wouldn't make a difference (in little endian.)

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/api/debug.h
drivers/net/wireless/intel/iwlwifi/fw/dbg.c
drivers/net/wireless/intel/iwlwifi/fw/dbg.h
drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
drivers/net/wireless/intel/iwlwifi/mvm/ops.c

index dc1fa377087a60c12659722f769b5a609df1b599..988584973aba759412537282aa6605e45406ba9d 100644 (file)
@@ -335,29 +335,11 @@ struct iwl_dbg_mem_access_rsp {
        __le32 data[];
 } __packed; /* DEBUG_(U|L)MAC_RD_WR_RSP_API_S_VER_1 */
 
-#define CONT_REC_COMMAND_SIZE  80
-#define ENABLE_CONT_RECORDING  0x15
-#define DISABLE_CONT_RECORDING 0x16
+#define LDBG_CFG_COMMAND_SIZE  80
 #define BUFFER_ALLOCATION      0x27
 #define START_DEBUG_RECORDING  0x29
 #define STOP_DEBUG_RECORDING   0x2A
 
-/*
- * struct iwl_continuous_record_mode - recording mode
- */
-struct iwl_continuous_record_mode {
-       __le16 enable_recording;
-} __packed;
-
-/*
- * struct iwl_continuous_record_cmd - enable/disable continuous recording
- */
-struct iwl_continuous_record_cmd {
-       struct iwl_continuous_record_mode record_mode;
-       u8 pad[CONT_REC_COMMAND_SIZE -
-               sizeof(struct iwl_continuous_record_mode)];
-} __packed;
-
 /* maximum fragments to be allocated per target of allocationId */
 #define IWL_BUFFER_LOCATION_MAX_FRAGS  2
 
@@ -385,4 +367,17 @@ struct iwl_buffer_allocation_cmd {
        struct iwl_fragment_data fragments[IWL_BUFFER_LOCATION_MAX_FRAGS];
 } __packed; /* BUFFER_ALLOCATION_CMD_API_S_VER_1 */
 
+/**
+ * struct iwl_ldbg_config_cmd - LDBG config command
+ * @type: configuration type
+ * @pad: reserved space for type-dependent data
+ */
+struct iwl_ldbg_config_cmd {
+       __le32 type;
+       union {
+               u8 pad[LDBG_CFG_COMMAND_SIZE - sizeof(__le32)];
+               struct iwl_buffer_allocation_cmd buffer_allocation;
+       }; /* LDBG_CFG_BODY_API_U_VER_2 (partially) */
+} __packed; /* LDBG_CFG_CMD_API_S_VER_2 */
+
 #endif /* __iwl_fw_api_debug_h__ */
index a97bf17da14d41c744cfd8cef47ccf7a3340ef31..917aafe1a9dbb6af9a1d25e4645e712f3da00ba5 100644 (file)
@@ -1678,20 +1678,20 @@ iwl_fw_dbg_buffer_allocation(struct iwl_fw_runtime *fwrt,
                             struct iwl_fw_ini_allocation_tlv *alloc)
 {
        struct iwl_trans *trans = fwrt->trans;
-       struct iwl_continuous_record_cmd cont_rec = {};
-       struct iwl_buffer_allocation_cmd *cmd = (void *)&cont_rec.pad[0];
+       struct iwl_ldbg_config_cmd ldbg_cmd = {
+               .type = cpu_to_le32(BUFFER_ALLOCATION),
+       };
+       struct iwl_buffer_allocation_cmd *cmd = &ldbg_cmd.buffer_allocation;
        struct iwl_host_cmd hcmd = {
                .id = LDBG_CONFIG_CMD,
                .flags = CMD_ASYNC,
-               .data[0] = &cont_rec,
-               .len[0] = sizeof(cont_rec),
+               .data[0] = &ldbg_cmd,
+               .len[0] = sizeof(ldbg_cmd),
        };
        void *virtual_addr = NULL;
        u32 size = le32_to_cpu(alloc->size);
        dma_addr_t phys_addr;
 
-       cont_rec.record_mode.enable_recording = cpu_to_le16(BUFFER_ALLOCATION);
-
        if (!trans->num_blocks &&
            le32_to_cpu(alloc->buffer_location) !=
            IWL_FW_INI_LOCATION_DRAM_PATH)
index 40dcc3deb25710c37fa0bb37aeace508eb61deda..7cd206e6fb9e8dfe94fff9ddc8f860fde41c6d17 100644 (file)
@@ -271,18 +271,17 @@ _iwl_fw_dbg_trigger_simple_stop(struct iwl_fw_runtime *fwrt,
 
 static int iwl_fw_dbg_start_stop_hcmd(struct iwl_fw_runtime *fwrt, bool start)
 {
-       struct iwl_continuous_record_cmd cont_rec = {};
+       struct iwl_ldbg_config_cmd cmd = {
+               .type = start ? cpu_to_le32(START_DEBUG_RECORDING) :
+                               cpu_to_le32(STOP_DEBUG_RECORDING),
+       };
        struct iwl_host_cmd hcmd = {
                .id = LDBG_CONFIG_CMD,
                .flags = CMD_ASYNC,
-               .data[0] = &cont_rec,
-               .len[0] = sizeof(cont_rec),
+               .data[0] = &cmd,
+               .len[0] = sizeof(cmd),
        };
 
-       cont_rec.record_mode.enable_recording = start ?
-               cpu_to_le16(START_DEBUG_RECORDING) :
-               cpu_to_le16(STOP_DEBUG_RECORDING);
-
        return iwl_trans_send_cmd(fwrt->trans, &hcmd);
 }
 
index 52c361a6124cea9eb61dedabf1617b22189deb73..514aaec6d59e5b172a624beeba3e30ffc6ddc5c9 100644 (file)
@@ -1206,47 +1206,6 @@ static ssize_t iwl_dbgfs_fw_dbg_conf_read(struct file *file,
        return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
 }
 
-/*
- * Enable / Disable continuous recording.
- * Cause the FW to start continuous recording, by sending the relevant hcmd.
- * Enable: input of every integer larger than 0, ENABLE_CONT_RECORDING.
- * Disable: for 0 as input, DISABLE_CONT_RECORDING.
- */
-static ssize_t iwl_dbgfs_cont_recording_write(struct iwl_mvm *mvm,
-                                             char *buf, size_t count,
-                                             loff_t *ppos)
-{
-       struct iwl_trans *trans = mvm->trans;
-       const struct iwl_fw_dbg_dest_tlv_v1 *dest = trans->dbg_dest_tlv;
-       struct iwl_continuous_record_cmd cont_rec = {};
-       int ret, rec_mode;
-
-       if (!iwl_mvm_firmware_running(mvm))
-               return -EIO;
-
-       if (!dest)
-               return -EOPNOTSUPP;
-
-       if (dest->monitor_mode != SMEM_MODE ||
-           trans->cfg->device_family < IWL_DEVICE_FAMILY_8000)
-               return -EOPNOTSUPP;
-
-       ret = kstrtoint(buf, 0, &rec_mode);
-       if (ret)
-               return ret;
-
-       cont_rec.record_mode.enable_recording = rec_mode ?
-               cpu_to_le16(ENABLE_CONT_RECORDING) :
-               cpu_to_le16(DISABLE_CONT_RECORDING);
-
-       mutex_lock(&mvm->mutex);
-       ret = iwl_mvm_send_cmd_pdu(mvm, LDBG_CONFIG_CMD, 0,
-                                  sizeof(cont_rec), &cont_rec);
-       mutex_unlock(&mvm->mutex);
-
-       return ret ?: count;
-}
-
 static ssize_t iwl_dbgfs_fw_dbg_conf_write(struct iwl_mvm *mvm,
                                           char *buf, size_t count,
                                           loff_t *ppos)
@@ -1800,7 +1759,6 @@ MVM_DEBUGFS_READ_WRITE_FILE_OPS(scan_ant_rxchain, 8);
 MVM_DEBUGFS_READ_WRITE_FILE_OPS(d0i3_refs, 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(cont_recording, 8);
 MVM_DEBUGFS_WRITE_FILE_OPS(max_amsdu_len, 8);
 MVM_DEBUGFS_WRITE_FILE_OPS(indirection_tbl,
                           (IWL_RSS_INDIRECTION_TABLE_SIZE * 2));
@@ -2004,7 +1962,6 @@ int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir)
        MVM_DEBUGFS_ADD_FILE(fw_dbg_collect, mvm->debugfs_dir, 0200);
        MVM_DEBUGFS_ADD_FILE(max_amsdu_len, mvm->debugfs_dir, 0200);
        MVM_DEBUGFS_ADD_FILE(send_echo_cmd, mvm->debugfs_dir, 0200);
-       MVM_DEBUGFS_ADD_FILE(cont_recording, mvm->debugfs_dir, 0200);
        MVM_DEBUGFS_ADD_FILE(indirection_tbl, mvm->debugfs_dir, 0200);
        MVM_DEBUGFS_ADD_FILE(inject_packet, mvm->debugfs_dir, 0200);
 #ifdef CONFIG_ACPI
index d257c143e62447c7ca030c23f2f91b5074e97436..ee2ef3f0042c7b8ac75a79cea8f86fdde1dd96c7 100644 (file)
@@ -737,6 +737,9 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
                trans_cfg.rx_buf_size = rb_size_default;
        }
 
+       BUILD_BUG_ON(sizeof(struct iwl_ldbg_config_cmd) !=
+                    LDBG_CFG_COMMAND_SIZE);
+
        trans->wide_cmd_header = true;
        trans_cfg.bc_table_dword =
                mvm->trans->cfg->device_family < IWL_DEVICE_FAMILY_22560;