From f3d0a8acc5a88435186d242376db05788a891516 Mon Sep 17 00:00:00 2001 From: James Smart Date: Wed, 18 Dec 2019 15:58:01 -0800 Subject: scsi: lpfc: Fix missing check for CSF in Write Object Mbox Rsp When the WriteObject mailbox response has change_status set to is 0x2 (Firmware Reset) or 0x04 (Port Migration Reset), the CSF field should also be checked to see if a fw reset is sufficient to enable all new features in the updated firmware image. If not, a fw reset would start the new firmware, but with a feature level equal to existing firmware. To enable the new features, a chip reset/pci slot reset would be required. Check the CSF bit when change_status is 0x2 or 0x4 to know whether to perform a pci bus reset or fw reset. Link: https://lore.kernel.org/r/20191218235808.31922-4-jsmart2021@gmail.com Signed-off-by: Dick Kennedy Signed-off-by: James Smart Signed-off-by: Martin K. Petersen --- drivers/scsi/lpfc/lpfc_sli.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'drivers/scsi/lpfc/lpfc_sli.c') diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index c82b5792da98..12319f63cb45 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -19449,7 +19449,7 @@ lpfc_wr_object(struct lpfc_hba *phba, struct list_head *dmabuf_list, struct lpfc_mbx_wr_object *wr_object; LPFC_MBOXQ_t *mbox; int rc = 0, i = 0; - uint32_t shdr_status, shdr_add_status, shdr_change_status; + uint32_t shdr_status, shdr_add_status, shdr_change_status, shdr_csf; uint32_t mbox_tmo; struct lpfc_dmabuf *dmabuf; uint32_t written = 0; @@ -19506,6 +19506,16 @@ lpfc_wr_object(struct lpfc_hba *phba, struct list_head *dmabuf_list, if (check_change_status) { shdr_change_status = bf_get(lpfc_wr_object_change_status, &wr_object->u.response); + + if (shdr_change_status == LPFC_CHANGE_STATUS_FW_RESET || + shdr_change_status == LPFC_CHANGE_STATUS_PORT_MIGRATION) { + shdr_csf = bf_get(lpfc_wr_object_csf, + &wr_object->u.response); + if (shdr_csf) + shdr_change_status = + LPFC_CHANGE_STATUS_PCI_RESET; + } + switch (shdr_change_status) { case (LPFC_CHANGE_STATUS_PHYS_DEV_RESET): lpfc_printf_log(phba, KERN_INFO, LOG_INIT, -- cgit v1.2.3 From 999fbbceb8312a764b318cf19510273291ec3575 Mon Sep 17 00:00:00 2001 From: James Smart Date: Wed, 18 Dec 2019 15:58:06 -0800 Subject: scsi: lpfc: Fix MDS Latency Diagnostics Err-drop rates When running Cisco-MDS diagnostics which perform driver-level frame loop back, the switch is reporting errors. Diagnostic has a limit on latency that is not being met by the driver. The requirement of Latency frames is that they should be responded back by the host with a maximum delay of few hundreds of microseconds. If the switch doesn't get response frames within this time frame, it fails the test. Test is failing as the lpfc-wq workqueue was overwhelmed by the packet rate and in some cases, the work element yielded to other kernel elements. To resolve, reduce the outstanding load allowed by the adapter. This ensures the driver spends a reasonable amount of time doing loopback and can do so such that latency values can be met. Load is managed by reducing the number of receive buffers posted such that the link can be backpressured to reduce load. Link: https://lore.kernel.org/r/20191218235808.31922-9-jsmart2021@gmail.com Signed-off-by: Dick Kennedy Signed-off-by: James Smart Signed-off-by: Martin K. Petersen --- drivers/scsi/lpfc/lpfc_sli.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'drivers/scsi/lpfc/lpfc_sli.c') diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 12319f63cb45..e660ee98ad8b 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -4918,8 +4918,17 @@ static int lpfc_sli4_rb_setup(struct lpfc_hba *phba) { phba->hbq_in_use = 1; - phba->hbqs[LPFC_ELS_HBQ].entry_count = - lpfc_hbq_defs[LPFC_ELS_HBQ]->entry_count; + /** + * Specific case when the MDS diagnostics is enabled and supported. + * The receive buffer count is truncated to manage the incoming + * traffic. + **/ + if (phba->cfg_enable_mds_diags && phba->mds_diags_support) + phba->hbqs[LPFC_ELS_HBQ].entry_count = + lpfc_hbq_defs[LPFC_ELS_HBQ]->entry_count >> 1; + else + phba->hbqs[LPFC_ELS_HBQ].entry_count = + lpfc_hbq_defs[LPFC_ELS_HBQ]->entry_count; phba->hbq_count = 1; lpfc_sli_hbqbuf_init_hbqs(phba, LPFC_ELS_HBQ); /* Initially populate or replenish the HBQs */ -- cgit v1.2.3