scsi: qedi: Add the CRC size within iSCSI NVM image

The QED driver commit, 1ac4329a1c ("qed: Add configuration information
to register dump and debug data"), removes the CRC length validation
causing nvm_get_image failure while loading qedi driver:

[qed_mcp_get_nvm_image:2700(host_10-0)]Image [0] is too big - 00006008 bytes
where only 00006004 are available
[qedi_get_boot_info:2253]:10: Could not get NVM image. ret = -12

Hence add and adjust the CRC size to iSCSI NVM image to read boot info at
qedi load time.

Signed-off-by: Nilesh Javali <nilesh.javali@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Nilesh Javali 2018-08-29 23:55:53 -07:00 committed by Martin K. Petersen
parent 05a86e78ea
commit c77a2fa3ff
2 changed files with 21 additions and 14 deletions

View File

@ -77,6 +77,11 @@ enum qedi_nvm_tgts {
QEDI_NVM_TGT_SEC,
};
struct qedi_nvm_iscsi_image {
struct nvm_iscsi_cfg iscsi_cfg;
u32 crc;
};
struct qedi_uio_ctrl {
/* meta data */
u32 uio_hsi_version;
@ -294,7 +299,7 @@ struct qedi_ctx {
void *bdq_pbl_list;
dma_addr_t bdq_pbl_list_dma;
u8 bdq_pbl_list_num_entries;
struct nvm_iscsi_cfg *iscsi_cfg;
struct qedi_nvm_iscsi_image *iscsi_image;
dma_addr_t nvm_buf_dma;
void __iomem *bdq_primary_prod;
void __iomem *bdq_secondary_prod;

View File

@ -1346,23 +1346,26 @@ exit_setup_int:
static void qedi_free_nvm_iscsi_cfg(struct qedi_ctx *qedi)
{
if (qedi->iscsi_cfg)
if (qedi->iscsi_image)
dma_free_coherent(&qedi->pdev->dev,
sizeof(struct nvm_iscsi_cfg),
qedi->iscsi_cfg, qedi->nvm_buf_dma);
sizeof(struct qedi_nvm_iscsi_image),
qedi->iscsi_image, qedi->nvm_buf_dma);
}
static int qedi_alloc_nvm_iscsi_cfg(struct qedi_ctx *qedi)
{
qedi->iscsi_cfg = dma_zalloc_coherent(&qedi->pdev->dev,
sizeof(struct nvm_iscsi_cfg),
&qedi->nvm_buf_dma, GFP_KERNEL);
if (!qedi->iscsi_cfg) {
struct qedi_nvm_iscsi_image nvm_image;
qedi->iscsi_image = dma_zalloc_coherent(&qedi->pdev->dev,
sizeof(nvm_image),
&qedi->nvm_buf_dma,
GFP_KERNEL);
if (!qedi->iscsi_image) {
QEDI_ERR(&qedi->dbg_ctx, "Could not allocate NVM BUF.\n");
return -ENOMEM;
}
QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
"NVM BUF addr=0x%p dma=0x%llx.\n", qedi->iscsi_cfg,
"NVM BUF addr=0x%p dma=0x%llx.\n", qedi->iscsi_image,
qedi->nvm_buf_dma);
return 0;
@ -1905,7 +1908,7 @@ qedi_get_nvram_block(struct qedi_ctx *qedi)
struct nvm_iscsi_block *block;
pf = qedi->dev_info.common.abs_pf_id;
block = &qedi->iscsi_cfg->block[0];
block = &qedi->iscsi_image->iscsi_cfg.block[0];
for (i = 0; i < NUM_OF_ISCSI_PF_SUPPORTED; i++, block++) {
flags = ((block->id) & NVM_ISCSI_CFG_BLK_CTRL_FLAG_MASK) >>
NVM_ISCSI_CFG_BLK_CTRL_FLAG_OFFSET;
@ -2194,15 +2197,14 @@ static void qedi_boot_release(void *data)
static int qedi_get_boot_info(struct qedi_ctx *qedi)
{
int ret = 1;
u16 len;
len = sizeof(struct nvm_iscsi_cfg);
struct qedi_nvm_iscsi_image nvm_image;
QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
"Get NVM iSCSI CFG image\n");
ret = qedi_ops->common->nvm_get_image(qedi->cdev,
QED_NVM_IMAGE_ISCSI_CFG,
(char *)qedi->iscsi_cfg, len);
(char *)qedi->iscsi_image,
sizeof(nvm_image));
if (ret)
QEDI_ERR(&qedi->dbg_ctx,
"Could not get NVM image. ret = %d\n", ret);