提交 dd940972 编写于 作者: J Jitendra Bhivare 提交者: Martin K. Petersen

scsi: be2iscsi: Reinit SGL handle, CID tables after TPE

After TPE recovery, CID table needs to be repopulated as per CIDs in
WRBQ creation responses.

SGL handles table needs to be recreated for posting and its indices need
to be resetted.

This is achieved by calling beiscsi_cleanup_port when disabling and
beiscsi_init_port in enabling port.
Signed-off-by: NJitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: NHannes Reinecke <hare@suse.com>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
上级 413f3656
...@@ -3919,31 +3919,6 @@ static void beiscsi_free_mem(struct beiscsi_hba *phba) ...@@ -3919,31 +3919,6 @@ static void beiscsi_free_mem(struct beiscsi_hba *phba)
kfree(phba->phwi_ctrlr); kfree(phba->phwi_ctrlr);
} }
static int beiscsi_init_controller(struct beiscsi_hba *phba)
{
int ret;
ret = beiscsi_get_memory(phba);
if (ret < 0) {
beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
"BM_%d : beiscsi_dev_probe -"
"Failed in beiscsi_alloc_memory\n");
return ret;
}
ret = hwi_init_controller(phba);
if (ret)
goto free_init;
beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT,
"BM_%d : Return success from beiscsi_init_controller");
return 0;
free_init:
beiscsi_free_mem(phba);
return ret;
}
static int beiscsi_init_sgl_handle(struct beiscsi_hba *phba) static int beiscsi_init_sgl_handle(struct beiscsi_hba *phba)
{ {
struct be_mem_descriptor *mem_descr_sglh, *mem_descr_sg; struct be_mem_descriptor *mem_descr_sglh, *mem_descr_sg;
...@@ -4217,33 +4192,30 @@ static int beiscsi_init_port(struct beiscsi_hba *phba) ...@@ -4217,33 +4192,30 @@ static int beiscsi_init_port(struct beiscsi_hba *phba)
{ {
int ret; int ret;
ret = beiscsi_init_controller(phba); ret = hwi_init_controller(phba);
if (ret < 0) { if (ret < 0) {
beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
"BM_%d : beiscsi_dev_probe - Failed in" "BM_%d : init controller failed\n");
"beiscsi_init_controller\n");
return ret; return ret;
} }
ret = beiscsi_init_sgl_handle(phba); ret = beiscsi_init_sgl_handle(phba);
if (ret < 0) { if (ret < 0) {
beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
"BM_%d : beiscsi_dev_probe - Failed in" "BM_%d : init sgl handles failed\n");
"beiscsi_init_sgl_handle\n"); goto cleanup_port;
goto do_cleanup_ctrlr;
} }
ret = hba_setup_cid_tbls(phba); ret = hba_setup_cid_tbls(phba);
if (ret < 0) { if (ret < 0) {
beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
"BM_%d : Failed in hba_setup_cid_tbls\n"); "BM_%d : setup CID table failed\n");
kfree(phba->io_sgl_hndl_base); kfree(phba->io_sgl_hndl_base);
kfree(phba->eh_sgl_hndl_base); kfree(phba->eh_sgl_hndl_base);
goto do_cleanup_ctrlr; goto cleanup_port;
} }
return ret; return ret;
do_cleanup_ctrlr: cleanup_port:
hwi_cleanup_port(phba); hwi_cleanup_port(phba);
return ret; return ret;
} }
...@@ -5403,10 +5375,10 @@ static int beiscsi_enable_port(struct beiscsi_hba *phba) ...@@ -5403,10 +5375,10 @@ static int beiscsi_enable_port(struct beiscsi_hba *phba)
phba->shost->max_id = phba->params.cxns_per_ctrl; phba->shost->max_id = phba->params.cxns_per_ctrl;
phba->shost->can_queue = phba->params.ios_per_ctrl; phba->shost->can_queue = phba->params.ios_per_ctrl;
ret = hwi_init_controller(phba); ret = beiscsi_init_port(phba);
if (ret) { if (ret < 0) {
__beiscsi_log(phba, KERN_ERR, __beiscsi_log(phba, KERN_ERR,
"BM_%d : init controller failed %d\n", ret); "BM_%d : init port failed\n");
goto disable_msix; goto disable_msix;
} }
...@@ -5512,6 +5484,7 @@ static void beiscsi_disable_port(struct beiscsi_hba *phba, int unload) ...@@ -5512,6 +5484,7 @@ static void beiscsi_disable_port(struct beiscsi_hba *phba, int unload)
cancel_work_sync(&pbe_eq->mcc_work); cancel_work_sync(&pbe_eq->mcc_work);
} }
hwi_cleanup_port(phba); hwi_cleanup_port(phba);
beiscsi_cleanup_port(phba);
} }
static void beiscsi_sess_work(struct work_struct *work) static void beiscsi_sess_work(struct work_struct *work)
...@@ -5722,11 +5695,18 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev, ...@@ -5722,11 +5695,18 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev,
phba->shost->max_id = phba->params.cxns_per_ctrl; phba->shost->max_id = phba->params.cxns_per_ctrl;
phba->shost->can_queue = phba->params.ios_per_ctrl; phba->shost->can_queue = phba->params.ios_per_ctrl;
ret = beiscsi_get_memory(phba);
if (ret < 0) {
beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
"BM_%d : alloc host mem failed\n");
goto free_port;
}
ret = beiscsi_init_port(phba); ret = beiscsi_init_port(phba);
if (ret < 0) { if (ret < 0) {
beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
"BM_%d : beiscsi_dev_probe-" "BM_%d : init port failed\n");
"Failed in beiscsi_init_port\n"); beiscsi_free_mem(phba);
goto free_port; goto free_port;
} }
...@@ -5868,7 +5848,6 @@ static void beiscsi_remove(struct pci_dev *pcidev) ...@@ -5868,7 +5848,6 @@ static void beiscsi_remove(struct pci_dev *pcidev)
/* free all resources */ /* free all resources */
destroy_workqueue(phba->wq); destroy_workqueue(phba->wq);
beiscsi_cleanup_port(phba);
beiscsi_free_mem(phba); beiscsi_free_mem(phba);
/* ctrl uninit */ /* ctrl uninit */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册