wifi: iwlwifi: yoyo: Add new tlv for dump file name extension
authorMukesh Sisodiya <mukesh.sisodiya@intel.com>
Tue, 14 Mar 2023 17:49:14 +0000 (19:49 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 15 Mar 2023 12:25:12 +0000 (13:25 +0100)
Add tlv in dump file for dump file name extension.

Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Greenman, Gregory <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230314194113.ffc28212994e.Ie5f10709548497061f95c1634d942dd2facf72ec@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/dbg.c
drivers/net/wireless/intel/iwlwifi/fw/error-dump.h
drivers/net/wireless/intel/iwlwifi/iwl-trans.h

index abf4902..ca97f2f 100644 (file)
@@ -2320,6 +2320,34 @@ static u32 iwl_dump_ini_info(struct iwl_fw_runtime *fwrt,
        return entry->size;
 }
 
+static u32 iwl_dump_ini_file_name_info(struct iwl_fw_runtime *fwrt,
+                                      struct list_head *list)
+{
+       struct iwl_fw_ini_dump_entry *entry;
+       struct iwl_dump_file_name_info *tlv;
+       u32 len = strnlen(fwrt->trans->dbg.dump_file_name_ext,
+                         IWL_FW_INI_MAX_NAME);
+
+       if (!fwrt->trans->dbg.dump_file_name_ext_valid)
+               return 0;
+
+       entry = vzalloc(sizeof(*entry) + sizeof(*tlv) + len);
+       if (!entry)
+               return 0;
+
+       entry->size = sizeof(*tlv) + len;
+
+       tlv = (void *)entry->data;
+       tlv->type = cpu_to_le32(IWL_INI_DUMP_NAME_TYPE);
+       tlv->len = cpu_to_le32(len);
+       memcpy(tlv->data, fwrt->trans->dbg.dump_file_name_ext, len);
+
+       /* add the dump file name extension tlv to the list */
+       list_add_tail(&entry->list, list);
+
+       return entry->size;
+}
+
 static const struct iwl_dump_ini_mem_ops iwl_dump_ini_region_ops[] = {
        [IWL_FW_INI_REGION_INVALID] = {},
        [IWL_FW_INI_REGION_INTERNAL_BUFFER] = {
@@ -2495,8 +2523,10 @@ static u32 iwl_dump_ini_trigger(struct iwl_fw_runtime *fwrt,
                size += iwl_dump_ini_mem(fwrt, list, &reg_data,
                                         &iwl_dump_ini_region_ops[IWL_FW_INI_REGION_DRAM_IMR]);
 
-       if (size)
+       if (size) {
+               size += iwl_dump_ini_file_name_info(fwrt, list);
                size += iwl_dump_ini_info(fwrt, trigger, list);
+       }
 
        return size;
 }
index c62576e..f5e0898 100644 (file)
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
 /*
- * Copyright (C) 2014, 2018-2021 Intel Corporation
+ * Copyright (C) 2014, 2018-2022 Intel Corporation
  * Copyright (C) 2014-2015 Intel Mobile Communications GmbH
  * Copyright (C) 2016-2017 Intel Deutschland GmbH
  */
@@ -76,6 +76,18 @@ struct iwl_fw_error_dump_data {
 } __packed;
 
 /**
+ * struct iwl_dump_file_name_info - data for dump file name addition
+ * @type: region type with reserved bits
+ * @len: the length of file name string to be added to dump file
+ * @data: the string need to be added to dump file
+ */
+struct iwl_dump_file_name_info {
+       __le32 type;
+       __le32 len;
+       __u8 data[];
+} __packed;
+
+/**
  * struct iwl_fw_error_dump_file - the layout of the header of the file
  * @barker: must be %IWL_FW_ERROR_DUMP_BARKER
  * @file_len: the length of all the file starting from %barker
@@ -231,6 +243,9 @@ struct iwl_fw_error_dump_mem {
 /* Use bit 31 as dump info type to avoid colliding with region types */
 #define IWL_INI_DUMP_INFO_TYPE BIT(31)
 
+/* Use bit 31 and bit 24 as dump name type to avoid colliding with region types */
+#define IWL_INI_DUMP_NAME_TYPE (BIT(31) | BIT(24))
+
 /**
  * struct iwl_fw_error_dump_data - data for one type
  * @type: &enum iwl_fw_ini_region_type
index 9aced3e..dd277a4 100644 (file)
@@ -775,6 +775,8 @@ struct iwl_imr_data {
  * @periodic_trig_list: periodic triggers list
  * @domains_bitmap: bitmap of active domains other than &IWL_FW_INI_DOMAIN_ALWAYS_ON
  * @ucode_preset: preset based on ucode
+ * @dump_file_name_ext: dump file name extension
+ * @dump_file_name_ext_valid: dump file name extension if valid or not
  */
 struct iwl_trans_debug {
        u8 n_dest_reg;
@@ -813,6 +815,8 @@ struct iwl_trans_debug {
        bool restart_required;
        u32 last_tp_resetfw;
        struct iwl_imr_data imr_data;
+       u8 dump_file_name_ext[IWL_FW_INI_MAX_NAME];
+       bool dump_file_name_ext_valid;
 };
 
 struct iwl_dma_ptr {