iwlwifi: dbg_ini: use linked list to store debug TLVs

Use a linked list to maintain the debug TLVs instead of a single buffer.
This way, the driver does not need to iterate over the binary file twice
and allocates smaller chunks of memory. Also, in case one allocation
fails the driver will work with the partial configuration instead of
aborting the entire debug configuration.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
This commit is contained in:
Shahar S Matityahu
2019-06-10 16:14:20 +03:00
committed by Luca Coelho
parent ccdc3d6d15
commit 40b7d22d1f
4 changed files with 48 additions and 101 deletions

View File

@ -2783,10 +2783,13 @@ static void _iwl_fw_dbg_apply_point(struct iwl_fw_runtime *fwrt,
enum iwl_fw_ini_apply_point pnt,
bool ext)
{
void *iter = data->data;
struct iwl_apply_point_data *iter;
while (iter && iter < data->data + data->size) {
struct iwl_ucode_tlv *tlv = iter;
if (!data->list.next)
return;
list_for_each_entry(iter, &data->list, list) {
struct iwl_ucode_tlv *tlv = &iter->tlv;
void *ini_tlv = (void *)tlv->data;
u32 type = le32_to_cpu(tlv->type);
@ -2799,7 +2802,7 @@ static void _iwl_fw_dbg_apply_point(struct iwl_fw_runtime *fwrt,
IWL_ERR(fwrt,
"WRT: ext=%d. Invalid apply point %d for buffer allocation\n",
ext, pnt);
goto next;
break;
}
iwl_fw_dbg_buffer_apply(fwrt, ini_tlv, pnt);
break;
@ -2808,7 +2811,7 @@ static void _iwl_fw_dbg_apply_point(struct iwl_fw_runtime *fwrt,
IWL_ERR(fwrt,
"WRT: ext=%d. Invalid apply point %d for host command\n",
ext, pnt);
goto next;
break;
}
iwl_fw_dbg_send_hcmd(fwrt, tlv, ext);
break;
@ -2826,8 +2829,6 @@ static void _iwl_fw_dbg_apply_point(struct iwl_fw_runtime *fwrt,
ext, type);
break;
}
next:
iter += sizeof(*tlv) + le32_to_cpu(tlv->length);
}
}