Commit 60d3c473 authored by Shahed Shaikh's avatar Shahed Shaikh Committed by David S. Miller

qlcnic: Skip unknown entry type while collecting firmware dump

o Driver aborts the minidump collection operation when it finds
  an unknown entry opcode. This patch skips unknown entry type
  and resumes the minidump collection operation.
o Removed a comparision of collected dump size with expected dump size.
  Size may differ when driver decides to skip an entry.
Signed-off-by: default avatarShahed Shaikh <shahed.shaikh@qlogic.com>
Signed-off-by: default avatarHimanshu Madhani <himanshu.madhani@qlogic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1de899d3
...@@ -1187,41 +1187,38 @@ int qlcnic_dump_fw(struct qlcnic_adapter *adapter) ...@@ -1187,41 +1187,38 @@ int qlcnic_dump_fw(struct qlcnic_adapter *adapter)
} }
if (ops_index == ops_cnt) { if (ops_index == ops_cnt) {
dev_info(&adapter->pdev->dev, dev_info(dev, "Skipping unknown entry opcode %d\n",
"Invalid entry type %d, exiting dump\n",
entry->hdr.type); entry->hdr.type);
goto error; entry->hdr.flags |= QLCNIC_DUMP_SKIP;
entry_offset += entry->hdr.offset;
continue;
} }
/* Collect dump for this entry */ /* Collect dump for this entry */
dump = fw_dump_ops[ops_index].handler(adapter, entry, buffer); dump = fw_dump_ops[ops_index].handler(adapter, entry, buffer);
if (!qlcnic_valid_dump_entry(&adapter->pdev->dev, entry, dump)) if (!qlcnic_valid_dump_entry(dev, entry, dump)) {
entry->hdr.flags |= QLCNIC_DUMP_SKIP; entry->hdr.flags |= QLCNIC_DUMP_SKIP;
entry_offset += entry->hdr.offset;
continue;
}
buf_offset += entry->hdr.cap_size; buf_offset += entry->hdr.cap_size;
entry_offset += entry->hdr.offset; entry_offset += entry->hdr.offset;
buffer = fw_dump->data + buf_offset; buffer = fw_dump->data + buf_offset;
} }
if (dump_size != buf_offset) {
dev_info(&adapter->pdev->dev, fw_dump->clr = 1;
"Captured(%d) and expected size(%d) do not match\n", snprintf(mesg, sizeof(mesg), "FW_DUMP=%s", adapter->netdev->name);
buf_offset, dump_size); dev_info(dev, "%s: Dump data %d bytes captured, template header size %d bytes\n",
goto error; adapter->netdev->name, fw_dump->size, tmpl_hdr->size);
} else { /* Send a udev event to notify availability of FW dump */
fw_dump->clr = 1; kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, msg);
snprintf(mesg, sizeof(mesg), "FW_DUMP=%s",
adapter->netdev->name);
dev_info(&adapter->pdev->dev, "%s: Dump data, %d bytes captured\n",
adapter->netdev->name, fw_dump->size);
/* Send a udev event to notify availability of FW dump */
kobject_uevent_env(&adapter->pdev->dev.kobj, KOBJ_CHANGE, msg);
return 0;
}
error:
if (fw_dump->use_pex_dma) if (fw_dump->use_pex_dma)
dma_free_coherent(dev, QLC_PEX_DMA_READ_SIZE, dma_free_coherent(dev, QLC_PEX_DMA_READ_SIZE,
fw_dump->dma_buffer, fw_dump->phys_addr); fw_dump->dma_buffer, fw_dump->phys_addr);
vfree(fw_dump->data);
return -EINVAL; return 0;
} }
void qlcnic_83xx_get_minidump_template(struct qlcnic_adapter *adapter) void qlcnic_83xx_get_minidump_template(struct qlcnic_adapter *adapter)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment