summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Smart <jsmart2021@gmail.com>2017-03-04 12:30:31 -0500
committerMartin K. Petersen <martin.petersen@oracle.com>2017-03-06 23:04:22 -0500
commit96418b5e2c8867da3279d877f5d1ffabfe460c3d (patch)
tree8bc29edf4c5ff9f5e94dd35d7a7a97db46d6dbfe
parent318083ad9230ff13cdac34ae4c4135e0c4e2d9ad (diff)
scsi: lpfc: Fix eh_deadline setting for sli3 adapters.
A previous change unilaterally removed the hba reset entry point from the sli3 host template. This was done to allow tape devices being used for back up from being removed. Why was this done ? When there was non-responding device on the fabric, the error escalation policy would escalate to the reset handler. When the reset handler was called, it would reset the adapter, dropping link, thus logging out and terminating all i/o's - on any target. If there was a tape device on the same adapter that wasn't in error, it would kill the tape i/o's, effectively killing the tape device state. With the reset point removed, the adapter reset avoided the fabric logout, allowing the other devices to continue to operate unaffected. A hack - yes. Hint: we really need a transport I_T nexus reset callback added to the eh process (in between the SCSI target reset and hba reset points), so a fc logout could occur to the one bad target only and stop the error escalation process. This patch commonizes the approach so it can be used for sli3 and sli4 adapters, but mandates the admin, via module parameter, specifically identify which adapters the resets are to be removed for. Additionally, bus_reset, which sends Target Reset TMFs to all targets, is also removed from the template as it too has the same effect as the adapter reset. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Reviewed-by: Laurence Oberman <loberman@redhat.com> Tested-by: Laurence Oberman <loberman@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--drivers/scsi/lpfc/lpfc.h1
-rw-r--r--drivers/scsi/lpfc/lpfc_attr.c6
-rw-r--r--drivers/scsi/lpfc/lpfc_crtn.h4
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c61
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c3
5 files changed, 69 insertions, 6 deletions
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
index de6cd57dc7f6..763f32dd2d23 100644
--- a/drivers/scsi/lpfc/lpfc.h
+++ b/drivers/scsi/lpfc/lpfc.h
@@ -99,6 +99,7 @@ struct lpfc_sli2_slim;
99#define FC_MAX_ADPTMSG 64 99#define FC_MAX_ADPTMSG 64
100 100
101#define MAX_HBAEVT 32 101#define MAX_HBAEVT 32
102#define MAX_HBAS_NO_RESET 16
102 103
103/* Number of MSI-X vectors the driver uses */ 104/* Number of MSI-X vectors the driver uses */
104#define LPFC_MSIX_VECTORS 2 105#define LPFC_MSIX_VECTORS 2
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 4114cf4308d0..b741dcb8ee64 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -3010,6 +3010,12 @@ MODULE_PARM_DESC(lpfc_poll, "FCP ring polling mode control:"
3010static DEVICE_ATTR(lpfc_poll, S_IRUGO | S_IWUSR, 3010static DEVICE_ATTR(lpfc_poll, S_IRUGO | S_IWUSR,
3011 lpfc_poll_show, lpfc_poll_store); 3011 lpfc_poll_show, lpfc_poll_store);
3012 3012
3013int lpfc_no_hba_reset_cnt;
3014unsigned long lpfc_no_hba_reset[MAX_HBAS_NO_RESET] = {
3015 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
3016module_param_array(lpfc_no_hba_reset, ulong, &lpfc_no_hba_reset_cnt, 0444);
3017MODULE_PARM_DESC(lpfc_no_hba_reset, "WWPN of HBAs that should not be reset");
3018
3013LPFC_ATTR(sli_mode, 0, 0, 3, 3019LPFC_ATTR(sli_mode, 0, 0, 3,
3014 "SLI mode selector:" 3020 "SLI mode selector:"
3015 " 0 - auto (SLI-3 if supported)," 3021 " 0 - auto (SLI-3 if supported),"
diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h
index 843dd73004da..54e6ac42fbcd 100644
--- a/drivers/scsi/lpfc/lpfc_crtn.h
+++ b/drivers/scsi/lpfc/lpfc_crtn.h
@@ -384,7 +384,7 @@ void lpfc_free_sysfs_attr(struct lpfc_vport *);
384extern struct device_attribute *lpfc_hba_attrs[]; 384extern struct device_attribute *lpfc_hba_attrs[];
385extern struct device_attribute *lpfc_vport_attrs[]; 385extern struct device_attribute *lpfc_vport_attrs[];
386extern struct scsi_host_template lpfc_template; 386extern struct scsi_host_template lpfc_template;
387extern struct scsi_host_template lpfc_template_s3; 387extern struct scsi_host_template lpfc_template_no_hr;
388extern struct scsi_host_template lpfc_template_nvme; 388extern struct scsi_host_template lpfc_template_nvme;
389extern struct scsi_host_template lpfc_vport_template; 389extern struct scsi_host_template lpfc_vport_template;
390extern struct fc_function_template lpfc_transport_functions; 390extern struct fc_function_template lpfc_transport_functions;
@@ -554,3 +554,5 @@ void lpfc_nvme_abort_fcreq_cmpl(struct lpfc_hba *phba,
554 struct lpfc_wcqe_complete *abts_cmpl); 554 struct lpfc_wcqe_complete *abts_cmpl);
555extern int lpfc_enable_nvmet_cnt; 555extern int lpfc_enable_nvmet_cnt;
556extern unsigned long long lpfc_enable_nvmet[]; 556extern unsigned long long lpfc_enable_nvmet[];
557extern int lpfc_no_hba_reset_cnt;
558extern unsigned long lpfc_no_hba_reset[];
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index a0cba631869e..4fa21a9fd883 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -3555,6 +3555,44 @@ out_free_mem:
3555 return rc; 3555 return rc;
3556} 3556}
3557 3557
3558static uint64_t
3559lpfc_get_wwpn(struct lpfc_hba *phba)
3560{
3561 uint64_t wwn;
3562 int rc;
3563 LPFC_MBOXQ_t *mboxq;
3564 MAILBOX_t *mb;
3565
3566
3567 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool,
3568 GFP_KERNEL);
3569 if (!mboxq)
3570 return (uint64_t)-1;
3571
3572 /* First get WWN of HBA instance */
3573 lpfc_read_nv(phba, mboxq);
3574 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL);
3575 if (rc != MBX_SUCCESS) {
3576 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
3577 "6019 Mailbox failed , mbxCmd x%x "
3578 "READ_NV, mbxStatus x%x\n",
3579 bf_get(lpfc_mqe_command, &mboxq->u.mqe),
3580 bf_get(lpfc_mqe_status, &mboxq->u.mqe));
3581 mempool_free(mboxq, phba->mbox_mem_pool);
3582 return (uint64_t) -1;
3583 }
3584 mb = &mboxq->u.mb;
3585 memcpy(&wwn, (char *)mb->un.varRDnvp.portname, sizeof(uint64_t));
3586 /* wwn is WWPN of HBA instance */
3587 mempool_free(mboxq, phba->mbox_mem_pool);
3588 if (phba->sli_rev == LPFC_SLI_REV4)
3589 return be64_to_cpu(wwn);
3590 else
3591 return (((wwn & 0xffffffff00000000) >> 32) |
3592 ((wwn & 0x00000000ffffffff) << 32));
3593
3594}
3595
3558/** 3596/**
3559 * lpfc_sli4_nvme_sgl_update - update xri-sgl sizing and mapping 3597 * lpfc_sli4_nvme_sgl_update - update xri-sgl sizing and mapping
3560 * @phba: pointer to lpfc hba data structure. 3598 * @phba: pointer to lpfc hba data structure.
@@ -3676,17 +3714,32 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev)
3676 struct lpfc_vport *vport; 3714 struct lpfc_vport *vport;
3677 struct Scsi_Host *shost = NULL; 3715 struct Scsi_Host *shost = NULL;
3678 int error = 0; 3716 int error = 0;
3717 int i;
3718 uint64_t wwn;
3719 bool use_no_reset_hba = false;
3720
3721 wwn = lpfc_get_wwpn(phba);
3722
3723 for (i = 0; i < lpfc_no_hba_reset_cnt; i++) {
3724 if (wwn == lpfc_no_hba_reset[i]) {
3725 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
3726 "6020 Setting use_no_reset port=%llx\n",
3727 wwn);
3728 use_no_reset_hba = true;
3729 break;
3730 }
3731 }
3679 3732
3680 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) { 3733 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) {
3681 if (dev != &phba->pcidev->dev) { 3734 if (dev != &phba->pcidev->dev) {
3682 shost = scsi_host_alloc(&lpfc_vport_template, 3735 shost = scsi_host_alloc(&lpfc_vport_template,
3683 sizeof(struct lpfc_vport)); 3736 sizeof(struct lpfc_vport));
3684 } else { 3737 } else {
3685 if (phba->sli_rev == LPFC_SLI_REV4) 3738 if (!use_no_reset_hba)
3686 shost = scsi_host_alloc(&lpfc_template, 3739 shost = scsi_host_alloc(&lpfc_template,
3687 sizeof(struct lpfc_vport)); 3740 sizeof(struct lpfc_vport));
3688 else 3741 else
3689 shost = scsi_host_alloc(&lpfc_template_s3, 3742 shost = scsi_host_alloc(&lpfc_template_no_hr,
3690 sizeof(struct lpfc_vport)); 3743 sizeof(struct lpfc_vport));
3691 } 3744 }
3692 } else if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { 3745 } else if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) {
@@ -5472,7 +5525,8 @@ lpfc_sli_driver_resource_setup(struct lpfc_hba *phba)
5472 5525
5473 /* Initialize the host templates the configured values. */ 5526 /* Initialize the host templates the configured values. */
5474 lpfc_vport_template.sg_tablesize = phba->cfg_sg_seg_cnt; 5527 lpfc_vport_template.sg_tablesize = phba->cfg_sg_seg_cnt;
5475 lpfc_template_s3.sg_tablesize = phba->cfg_sg_seg_cnt; 5528 lpfc_template_no_hr.sg_tablesize = phba->cfg_sg_seg_cnt;
5529 lpfc_template.sg_tablesize = phba->cfg_sg_seg_cnt;
5476 5530
5477 /* There are going to be 2 reserved BDEs: 1 FCP cmnd + 1 FCP rsp */ 5531 /* There are going to be 2 reserved BDEs: 1 FCP cmnd + 1 FCP rsp */
5478 if (phba->cfg_enable_bg) { 5532 if (phba->cfg_enable_bg) {
@@ -5693,6 +5747,7 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
5693 /* Initialize the host templates with the updated values. */ 5747 /* Initialize the host templates with the updated values. */
5694 lpfc_vport_template.sg_tablesize = phba->cfg_sg_seg_cnt; 5748 lpfc_vport_template.sg_tablesize = phba->cfg_sg_seg_cnt;
5695 lpfc_template.sg_tablesize = phba->cfg_sg_seg_cnt; 5749 lpfc_template.sg_tablesize = phba->cfg_sg_seg_cnt;
5750 lpfc_template_no_hr.sg_tablesize = phba->cfg_sg_seg_cnt;
5696 5751
5697 if (phba->cfg_sg_dma_buf_size <= LPFC_MIN_SG_SLI4_BUF_SZ) 5752 if (phba->cfg_sg_dma_buf_size <= LPFC_MIN_SG_SLI4_BUF_SZ)
5698 phba->cfg_sg_dma_buf_size = LPFC_MIN_SG_SLI4_BUF_SZ; 5753 phba->cfg_sg_dma_buf_size = LPFC_MIN_SG_SLI4_BUF_SZ;
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index 9d6384af9fce..bcfd6d6ab16d 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -5953,7 +5953,7 @@ struct scsi_host_template lpfc_template_nvme = {
5953 .track_queue_depth = 0, 5953 .track_queue_depth = 0,
5954}; 5954};
5955 5955
5956struct scsi_host_template lpfc_template_s3 = { 5956struct scsi_host_template lpfc_template_no_hr = {
5957 .module = THIS_MODULE, 5957 .module = THIS_MODULE,
5958 .name = LPFC_DRIVER_NAME, 5958 .name = LPFC_DRIVER_NAME,
5959 .proc_name = LPFC_DRIVER_NAME, 5959 .proc_name = LPFC_DRIVER_NAME,
@@ -6015,7 +6015,6 @@ struct scsi_host_template lpfc_vport_template = {
6015 .eh_abort_handler = lpfc_abort_handler, 6015 .eh_abort_handler = lpfc_abort_handler,
6016 .eh_device_reset_handler = lpfc_device_reset_handler, 6016 .eh_device_reset_handler = lpfc_device_reset_handler,
6017 .eh_target_reset_handler = lpfc_target_reset_handler, 6017 .eh_target_reset_handler = lpfc_target_reset_handler,
6018 .eh_bus_reset_handler = lpfc_bus_reset_handler,
6019 .slave_alloc = lpfc_slave_alloc, 6018 .slave_alloc = lpfc_slave_alloc,
6020 .slave_configure = lpfc_slave_configure, 6019 .slave_configure = lpfc_slave_configure,
6021 .slave_destroy = lpfc_slave_destroy, 6020 .slave_destroy = lpfc_slave_destroy,