aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/usb (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2018-09-25scsi: libsas: fix a race condition when smp task timeoutJason Yan1-5/+4
When the lldd is processing the complete sas task in interrupt and set the task stat as SAS_TASK_STATE_DONE, the smp timeout timer is able to be triggered at the same time. And smp_task_timedout() will complete the task wheter the SAS_TASK_STATE_DONE is set or not. Then the sas task may freed before lldd end the interrupt process. Thus a use-after-free will happen. Fix this by calling the complete() only when SAS_TASK_STATE_DONE is not set. And remove the check of the return value of the del_timer(). Once the LLDD sets DONE, it must call task->done(), which will call smp_task_done()->complete() and the task will be completed and freed correctly. Reported-by: chenxiang <chenxiang66@hisilicon.com> Signed-off-by: Jason Yan <yanaijie@huawei.com> CC: John Garry <john.garry@huawei.com> CC: Johannes Thumshirn <jthumshirn@suse.de> CC: Ewan Milne <emilne@redhat.com> CC: Christoph Hellwig <hch@lst.de> CC: Tomas Henzl <thenzl@redhat.com> CC: Dan Williams <dan.j.williams@intel.com> CC: Hannes Reinecke <hare@suse.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Reviewed-by: John Garry <john.garry@huawei.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-25scsi: libsas: check the ata device status by ata_dev_enabled()Jason Yan1-1/+1
When ata device IDENTIFY failed, the ata device status is ATA_DEV_UNKNOWN. The libata reported like: [113518.620433] ata5.00: qc timeout (cmd 0xec) [113518.653646] ata5.00: failed to IDENTIFY (I/O error, err_mask=0x4) But libsas verifies the device status by ata_dev_disabled(), which skipped ATA_DEV_UNKNOWN. This will make libsas think the ata device probing succeed the device cannot be actually brought up. And even the new bcast of this device will be considered as flutter and will not probe this device again. Change ata_dev_disabled() to !ata_dev_enabled() so that libsas can deal with this if the ata device probe failed. New bcasts can let us try to probe the device again and bring it up if it is fine to IDENTIFY. Tested-by: Zhou Yupeng <zhouyupeng1@huawei.com> Signed-off-by: Jason Yan <yanaijie@huawei.com> CC: John Garry <john.garry@huawei.com> CC: Johannes Thumshirn <jthumshirn@suse.de> CC: Ewan Milne <emilne@redhat.com> CC: Christoph Hellwig <hch@lst.de> CC: Tomas Henzl <thenzl@redhat.com> CC: Dan Williams <dan.j.williams@intel.com> CC: Hannes Reinecke <hare@suse.com> Reviewed-by: John Garry <john.garry@huawei.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-25scsi: libsas: always unregister the old device if going to discover newJason Yan1-8/+5
If we went into sas_rediscover_dev() the attached_sas_addr was already insured not to be zero. So it's unnecessary to check if the attached_sas_addr is zero. And although if the sas address is not changed, we always have to unregister the old device when we are going to register a new one. We cannot just leave the device there and bring up the new. Signed-off-by: Jason Yan <yanaijie@huawei.com> CC: chenxiang <chenxiang66@hisilicon.com> CC: John Garry <john.garry@huawei.com> CC: Johannes Thumshirn <jthumshirn@suse.de> CC: Ewan Milne <emilne@redhat.com> CC: Christoph Hellwig <hch@lst.de> CC: Tomas Henzl <thenzl@redhat.com> CC: Dan Williams <dan.j.williams@intel.com> CC: Hannes Reinecke <hare@suse.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-25scsi: libsas: make the lldd_port_deformed method optionalJason Yan2-8/+3
Now LLDDs have to implement lldd_port_deformed method otherwise NULL dereference will happen. Make it optional and remove the dummy implementation in hisi_sas. Signed-off-by: Jason Yan <yanaijie@huawei.com> CC: John Garry <john.garry@huawei.com> CC: Johannes Thumshirn <jthumshirn@suse.de> CC: Ewan Milne <emilne@redhat.com> CC: Christoph Hellwig <hch@lst.de> CC: Tomas Henzl <thenzl@redhat.com> CC: Dan Williams <dan.j.williams@intel.com> CC: Hannes Reinecke <hare@suse.com> Acked-by: John Garry <john.garry@huawei.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-25scsi: libsas: delete dead code in scsi_transport_sas.cJason Yan1-2/+0
This code is dead and no clue implies that it will be back again. Signed-off-by: Jason Yan <yanaijie@huawei.com> CC: John Garry <john.garry@huawei.com> CC: Johannes Thumshirn <jthumshirn@suse.de> CC: Ewan Milne <emilne@redhat.com> CC: Christoph Hellwig <hch@lst.de> CC: Tomas Henzl <thenzl@redhat.com> CC: Dan Williams <dan.j.williams@intel.com> CC: Hannes Reinecke <hare@suse.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: John Garry <john.garry@huawei.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-25scsi: megaraid: fix spelling mistake "maibox" -> "mailbox"Colin Ian King2-3/+3
Trivial fix to spelling mistake in warning message and comments Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-25scsi: FlashPoint: Remove unnecessary parenthesesNathan Chancellor1-3/+3
Clang warns when multiple pairs of parentheses are used for a single conditional statement. In file included from drivers/scsi/BusLogic.c:57: drivers/scsi/FlashPoint.c:2947:34: warning: equality comparison with extraneous parentheses [-Wparentheses-equality] if ((currSCCB->Sccb_scsistat == SELECT_SN_ST)) { ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~ drivers/scsi/FlashPoint.c:2947:34: note: remove extraneous parentheses around the comparison to silence this warning if ((currSCCB->Sccb_scsistat == SELECT_SN_ST)) { ~ ^ ~ drivers/scsi/FlashPoint.c:2947:34: note: use '=' to turn this equality comparison into an assignment if ((currSCCB->Sccb_scsistat == SELECT_SN_ST)) { ^~ = drivers/scsi/FlashPoint.c:2956:39: warning: equality comparison with extraneous parentheses [-Wparentheses-equality] else if ((currSCCB->Sccb_scsistat == ~~~~~~~~~~~~~~~~~~~~~~~~^~ drivers/scsi/FlashPoint.c:2956:39: note: remove extraneous parentheses around the comparison to silence this warning else if ((currSCCB->Sccb_scsistat == ~ ^ drivers/scsi/FlashPoint.c:2956:39: note: use '=' to turn this equality comparison into an assignment else if ((currSCCB->Sccb_scsistat == ^~ = 2 warnings generated. Link: https://github.com/ClangBuiltLinux/linux/issues/156 Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> Acked-by: Khalid Aziz <khalid@gonehiking.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-25scsi: hpsa: Use vmemdup_user to replace the open codezhong jiang1-8/+4
vmemdup_user is better than duplicating its implementation, So just replace the open code. The issue is detected with the help of Coccinelle. Tested-by: Don Brace <don.brace@microsemi.com> Acked-by: Don Brace <don.brace@microsemi.com> Signed-off-by: zhong jiang <zhongjiang@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-20scsi: advansys: Remove unnecessary parenthesesNathan Chancellor1-1/+1
Clang warns when multiple pairs of parentheses are used for a single conditional statement. drivers/scsi/advansys.c:6451:20: warning: equality comparison with extraneous parentheses [-Wparentheses-equality] if ((sdtr_data == 0xFF)) { ~~~~~~~~~~^~~~~~~ drivers/scsi/advansys.c:6451:20: note: remove extraneous parentheses around the comparison to silence this warning if ((sdtr_data == 0xFF)) { ~ ^ ~ drivers/scsi/advansys.c:6451:20: note: use '=' to turn this equality comparison into an assignment if ((sdtr_data == 0xFF)) { ^~ = 1 warning generated. Link: https://github.com/ClangBuiltLinux/linux/issues/155 Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> Acked-by: Matthew Wilcox <willy@infradead.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-20scsi: target: iblock: split T10 PI SGL across command biosGreg Edwards1-17/+37
When T10 PI is enabled on a backing device for the iblock backstore, the PI SGL for the entire command is attached to the first bio only. This works fine if the command is covered by a single bio, but can result in ref tag errors in the client for the other bios in a multi-bio command, e.g. [ 47.631236] sda: ref tag error at location 2048 (rcvd 0) [ 47.637658] sda: ref tag error at location 4096 (rcvd 0) [ 47.644228] sda: ref tag error at location 6144 (rcvd 0) The command will be split into multiple bios if the number of data SG elements exceeds BIO_MAX_PAGES (see iblock_get_bio()). The bios may later be split again in the block layer on the host after iblock_submit_bios(), depending on the queue limits of the backing device. The block and SCSI layers will pass through the whole PI SGL down to the LLDD however that first bio is split up, but the LLDD may only use the portion that corresponds to the data length (depends on the LLDD, tested with scsi_debug). Split the PI SGL across the bios in the command, so each bio's bio_integrity_payload contains the protection information for the data in the bio. Use an sg_mapping_iter to keep track of where we are in PI SGL, so we know where to start with the next bio. Signed-off-by: Greg Edwards <gedwards@ddn.com> Reviewed-by: Mike Christie <mchristi@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-17scsi: qla2xxx: Remove set but not used variable 'ptr_dma'YueHaibing1-2/+0
Fixes gcc '-Wunused-but-set-variable' warning: drivers/scsi/qla2xxx/qla_iocb.c: In function 'qla24xx_els_dcmd2_iocb': drivers/scsi/qla2xxx/qla_iocb.c:2644:13: warning: variable 'ptr_dma' set but not used [-Wunused-but-set-variable] Signed-off-by: YueHaibing <yuehaibing@huawei.com> Acked-by: Himanshu Madhani <himanshu.madhani@cavium.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-17scsi: lpfc: Remove set but not used variable 'sgl_size'YueHaibing1-3/+1
Fixes gcc '-Wunused-but-set-variable' warning: drivers/scsi/lpfc/lpfc_nvme.c: In function 'lpfc_new_nvme_buf': drivers/scsi/lpfc/lpfc_nvme.c:2238:24: warning: variable 'sgl_size' set but not used [-Wunused-but-set-variable] int bcnt, num_posted, sgl_size; ^ Signed-off-by: YueHaibing <yuehaibing@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-17scsi: bnx2fc: Remove set but not used variable 'oxid'YueHaibing1-3/+0
Fixes gcc '-Wunused-but-set-variable' warning: drivers/scsi/bnx2fc/bnx2fc_fcoe.c: In function 'bnx2fc_rcv': drivers/scsi/bnx2fc/bnx2fc_fcoe.c:435:17: warning: variable 'oxid' set but not used [-Wunused-but-set-variable] Signed-off-by: YueHaibing <yuehaibing@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-17scsi: core: remove unnecessary unlikely()Igor Stoppa1-2/+2
BUG_ON() already contains an unlikely(), there is no need for another one. Signed-off-by: Igor Stoppa <igor.stoppa@huawei.com> Cc: "Martin K. Petersen" <martin.petersen@oracle.com> Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com> Cc: linux-scsi@vger.kernel.org CC: linux-kernel@vger.kernel.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-17scsi: aic7xxx: remove set but not used variable 'shared_scb_data'YueHaibing1-2/+0
Fixes gcc '-Wunused-but-set-variable' warning: drivers/scsi/aic7xxx/aic79xx_pci.c: In function 'ahd_pci_config': drivers/scsi/aic7xxx/aic79xx_pci.c:291:19: warning: variable 'shared_scb_data' set but not used [-Wunused-but-set-variable] Signed-off-by: YueHaibing <yuehaibing@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-17scsi: iscsi: target: fix spelling mistake "entires" -> "entries"Colin Ian King4-4/+4
Trivial fix to spelling mistake in function name and comment Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-17scsi: pm80xx: Remove set but not used variable 'page_code'YueHaibing1-2/+1
Fixes gcc '-Wunused-but-set-variable' warning: drivers/scsi/pm8001/pm80xx_hwi.c: In function 'pm8001_set_phy_profile': drivers/scsi/pm8001/pm80xx_hwi.c:4679:6: warning: variable 'page_code' set but not used [-Wunused-but-set-variable] Signed-off-by: YueHaibing <yuehaibing@huawei.com> Acked-by: Jack Wang <jinpu.wang@profitbricks.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-17scsi: pm80xx: Remove set but not used variable 'device_id'YueHaibing1-4/+0
Fixes gcc '-Wunused-but-set-variable' warning: drivers/scsi/pm8001/pm8001_sas.c: In function 'pm8001_I_T_nexus_event_handler': drivers/scsi/pm8001/pm8001_sas.c:1052:6: warning: variable 'device_id' set but not used [-Wunused-but-set-variable] drivers/scsi/pm8001/pm8001_sas.c: In function 'pm8001_abort_task': drivers/scsi/pm8001/pm8001_sas.c:1191:6: warning: variable 'device_id' set but not used [-Wunused-but-set-variable] Signed-off-by: YueHaibing <yuehaibing@huawei.com> Acked-by: Jack Wang <jinpu.wang@profitbricks.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-17scsi: ufshcd: Fix NULL pointer dereference for in ufshcd_initVivek Gautam1-19/+34
Error paths in ufshcd_init() ufshcd_hba_exit() killed clk_scaling workqueue when the workqueue is actually created quite late in ufshcd_init(). So, we end up getting NULL pointer dereference in such error paths. Fix this by moving clk_scaling initialization and kill codes to two separate methods, and call them at required places. Fixes: 401f1e4490ee ("scsi: ufs: don't suspend clock scaling during clock gating") Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org> Cc: Bjorn Andersson <bjorn.andersson@linaro.org> Cc: Subhash Jadavani <subhashj@codeaurora.org> Cc: Matthias Kaehlcke <mka@chromium.org> Cc: Evan Green <evgreen@chromium.org> Cc: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Evan Green <evgreen@chromium.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-11scsi: message: fusion: fix a few trivial spelling mistakesColin Ian King3-9/+9
Trival fix to spelling mistakes: PrimativeSeqErrCount -> PrimitiveSeqErrCount Primative -> Primitive primative -> primitive mptsas_broadcast_primative_work -> mptsas_broadcast_primitive_work Broadcase -> Broadcast Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-11scsi: pm80xx: Update driver version to 0.1.39Deepak Ukey1-1/+1
Updated the driver version from 0.1.38 to 0.1.39. Signed-off-by: Deepak Ukey <deepak.ukey@microchip.com> Signed-off-by: Viswas G <Viswas.G@microchip.com> Acked-by: Jack Wang <jinpu.wang@profitbricks.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-11scsi: pm80xx: Fixed system hang issue during kexec bootDeepak Ukey5-6/+91
When the firmware is not responding, execution of kexec boot causes a system hang. When firmware assertion happened, driver get notified with interrupt vector updated in MPI configuration table. Then, the driver will read scratchpad register and set controller_fatal_error flag to true. Signed-off-by: Deepak Ukey <deepak.ukey@microchip.com> Signed-off-by: Viswas G <Viswas.G@microchip.com> Acked-by: Jack Wang <jinpu.wang@profitbricks.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-11scsi: pm80xx: Corrected dma_unmap_sg() parameterDeepak Ukey1-1/+1
For the function dma_unmap_sg(), the <nents> parameter should be number of elements in the scatter list prior to the mapping, not after the mapping. Signed-off-by: Deepak Ukey <deepak.ukey@microchip.com> Signed-off-by: Viswas G <Viswas.G@microchip.com> Acked-by: Jack Wang <jinpu.wang@profitbricks.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-11scsi: pm80xx: Fix for phy enable/disable functionalityDeepak Ukey7-17/+49
Added proper mask for phy id in mpi_phy_stop_resp(). Signed-off-by: Deepak Ukey <deepak.ukey@microchip.com> Signed-off-by: Viswas G <Viswas.G@microchip.com> Acked-by: Jack Wang <jinpu.wang@profitbricks.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-11scsi: qla2xxx: fix typo "CT-PASSTRHU" -> "CT-PASSTHRU"Colin Ian King1-1/+1
Trivial fix to typo in debug message text. Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Himanshu Madhani <himanshu.madhani@cavium.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-11scsi: aic7xxx: remove unused redundant variable num_chip_namesColin Ian King2-2/+0
Variable num_chip_names is defined but not used, hence it is redundant and can be removed. Cleans up clang warning: 'num_chip_names' defined but not used [-Wunused-const-variable=] Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-11scsi: libfc: remove set but not used variable 'rpriv'YueHaibing1-3/+0
Fixes gcc '-Wunused-but-set-variable' warning: drivers/scsi/libfc/fc_fcp.c: In function 'fc_queuecommand': drivers/scsi/libfc/fc_fcp.c:1875:30: warning: variable 'rpriv' set but not used [-Wunused-but-set-variable] Signed-off-by: YueHaibing <yuehaibing@huawei.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-11scsi: arcmsr: Spelling s/rebulid/rebuild/Geert Uytterhoeven1-10/+10
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-11scsi: sym53c8xx: fix NULL pointer dereference panic in sym_int_sir()George Kennedy1-4/+11
sym_int_sir() in sym_hipd.c does not check the command pointer for NULL before using it in debug message prints. Suggested-by: Matthew Wilcox <matthew.wilcox@oracle.com> Signed-off-by: George Kennedy <george.kennedy@oracle.com> Reviewed-by: Mark Kanda <mark.kanda@oracle.com> Acked-by: Matthew Wilcox <matthew.wilcox@oracle.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-11scsi: lpfc: update driver version to 12.0.0.7James Smart1-1/+1
Update the driver version to 12.0.0.7 Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-11scsi: lpfc: add support to retrieve firmware logsJames Smart9-2/+790
This patch adds the ability to read firmware logs from the adapter. The driver registers a buffer with the adapter that is then written to by the adapter. The adapter posts CQEs to indicate content updates in the buffer. While the adapter is writing to the buffer in a circular fashion, an application will poll the driver to read the next amount of log data from the buffer. Driver log buffer size is configurable via the ras_fwlog_buffsize sysfs attribute. Verbosity to be used by firmware when logging to host memory is controlled through the ras_fwlog_level attribute. The ras_fwlog_func attribute enables or disables loggy by firmware. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-11scsi: lpfc: reduce locking when updating statisticsJames Smart1-8/+10
Currently, on each io completion, the stats update routine indiscriminately holds a lock. While holding the adapter-wide lock, checks are made to check whether status are being tracked. When disabled (the default), the locking wasted a lot of cycles. Check for stats enablement before taking the lock. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-11scsi: lpfc: Fix errors in log messages.James Smart2-5/+4
Message 6408 is displayed for each entry in an array, but the cpu and queue numbers were incorrect for the entry. Message 6001 includes an extraneous character. Resolve both issues Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-11scsi: lpfc: Correct invalid EQ doorbell write on if_type=6James Smart1-5/+1
During attachment, the driver writes the EQ doorbell to disable potential interrupts from an EQ. The current EQ doorbell format used for clearing the interrupt is incorrect and uses an if_type=2 format, making the operation act on the wrong EQ. Correct the code to use the proper if_type=6 EQ doorbell format. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-11scsi: lpfc: Correct irq handling via locks when taking adapter offlineJames Smart7-22/+52
When taking the board offline while performing i/o, unsafe locking errors occurred and irq level isn't properly managed. In lpfc_sli_hba_down, spin_lock_irqsave(&phba->hbalock, flags) does not disable softirqs raised from timer expiry. It is possible that a softirq is raised from the lpfc_els_retry_delay routine and recursively requests the same phba->hbalock spinlock causing deadlock. Address the deadlocks by creating a new port_list lock. The softirq behavior can then be managed a level deeper into the calling sequences. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-11scsi: lpfc: Correct soft lockup when running mds diagnosticsJames Smart1-0/+7
When running an mds diagnostic that passes frames with the switch, soft lockups are detected. The driver is in a CQE processing loop and has sufficient amount of traffic that it never exits the ring processing routine, thus the "lockup". Cap the number of elements in the work processing routine to 64 elements. This ensures that the cpu will be given up and the handler reschedule to process additional items. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-11scsi: lpfc: Correct race with abort on completion pathJames Smart1-3/+11
On io completion, the driver is taking an adapter wide lock and nulling the scsi command back pointer. The nulling of the back pointer is to signify the io was completed and the scsi_done() routine was called. However, the routine makes no check to see if the abort routine had done the same thing and possibly nulled the pointer. Thus it may doubly-complete the io. Make the following mods: - Check to make sure forward progress (call scsi_done()) only happens if the command pointer was non-null. - As the taking of the lock, which is adapter wide, is very costly on a system under load, null the pointer using an xchg operation rather than under lock. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-11scsi: lpfc: Raise nvme defaults to support a larger io and more connectivityJames Smart1-0/+10
When nvme is enabled, change the default for two parameters: sg_seg_cnt - raise the per-io sg list size so that 1MB ios are supported (based on a 4k buffer per element). iocb_cnt - raise the number of buffers used for things like NVME LS request/responses to allow more concurrent requests to for larger nvme configs. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-11scsi: lpfc: raise sg count for nvme to use available sg resourcesJames Smart5-37/+103
The driver allocates a sg list per io struture based on a fixed maximum size. When it registers with the protocol transports and indicates the max sg list size it supports, the driver manipulates the fixed value to report a lesser amount so that it has reserved space for sg elements that are used for DIF. The driver initialization path sets the cfg_sg_seg_cnt field to the manipulated value for scsi. NVME initialization ran afterward and capped it's maximum by the manipulated value for SCSI. This erroneously made NVME report the SCSI-reduce-for-DIF value that reduced the max io size for nvme and wasted sg elements. Rework the driver so that cfg_sg_seg_cnt becomes the overall maximum size and allow the max size to be tunable. A separate (new) scsi sg count is then setup with the scsi-modified reduced value. NVME then initializes based off the overall maximum. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-11scsi: lpfc: Fix GFT_ID and PRLI logic for RSCNJames Smart3-6/+4
Driver only sends NVME PRLI to a device that also supports FCP. This resuls in remote ports that don't have fc_remote_ports created for them. The driver is clearing the nlp_fc4_type for a ndlp at the wrong time. Fix by moving the nlp_fc4_type clearing to the discovery engine in the DEVICE_RECOVERY state. Also ensure that rport registration is done for all nlp_fc4_types. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-11scsi: qla2xxx: Update driver version to 10.00.00.11-kHimanshu Madhani1-1/+1
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-11scsi: qla2xxx: Fix double increment of switch scan retry countQuinn Tran1-20/+17
This patch fixes issue when switch command fails, current code increments retry count twice. This results in a smaller number of retries. Signed-off-by: Quinn Tran <quinn.tran@cavium.com> Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-11scsi: qla2xxx: Fix duplicate switch's Nport ID entriesQuinn Tran1-1/+23
Current code relies on switch to provide a unique combination of WWPN + NPORTID to tract an FC port. This patch tries to detect a case where switch data base can get corrupted where multiple WWPNs can have the same Nport ID. The 1st Nport ID on the list will be kept while the duplicate Nport ID will be discarded. Signed-off-by: Quinn Tran <quinn.tran@cavium.com> Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-11scsi: qla2xxx: Remove stale debug trace message from tcm_qla2xxxQuinn Tran1-4/+0
Remove stale debug trace. Fixes: 1eb42f965ced ("qla2xxx: Make trace flags more readable") Cc: stable@vger.kernel.org #4.10 Signed-off-by: Quinn Tran <quinn.tran@cavium.com> Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-11scsi: qla2xxx: Fix premature command freeQuinn Tran3-3/+47
When qla2xxx and Target Core gets out of sync during command cleanup, qla2xxx will not free command until it is out of firmware's hand and Target Core has called the release on the command. This patch adds synchronization using cmd_lock and release flag. If the release flag is set, then qla2xxx will free up the command using qlt_free_cmd() otherwise transport_generic_free_cmd() will be responsible for relase of the command. Signed-off-by: Quinn Tran <quinn.tran@cavium.com> Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-11scsi: qla2xxx: Reject bsg request if chip is down.Quinn Tran1-1/+1
Reject bsg request if chip is down. This prevent erroneous timeout. Fixes: d051a5aa1c23 ("[SCSI] qla2xxx: Add an "is reset active" helper.") Cc: stable@vger.kernel.org # 4.10 Signed-off-by: Quinn Tran <quinn.tran@cavium.com> Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-11scsi: qla2xxx: shutdown chip if reset failQuinn Tran1-1/+1
If chip unable to fully initialize, use full shutdown sequence to clear out any stale FW state. Fixes: e315cd28b9ef ("[SCSI] qla2xxx: Code changes for qla data structure refactoring") Cc: stable@vger.kernel.org #4.10 Signed-off-by: Quinn Tran <quinn.tran@cavium.com> Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-11scsi: qla2xxx: Fix stuck session in PLOGI stateQuinn Tran2-8/+9
On PLOGI complete + RSCN received, driver tries to handle RSCN but failed to reset the session back to the beginning to restart the login process. Instead the session was left in the Plogi complete without moving forward. This patch will push the session state back to the delete state and restart the connection. Signed-off-by: Quinn Tran <quinn.tran@cavium.com> Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-11scsi: qla2xxx: Fix early srb free on abortQuinn Tran1-0/+2
Task abort can take 2 paths: 1) serial/synchronous abort where the calling thread will put to sleep, wait for completion and free cmd resource. 2) async abort where the cmd free will be free by the completion thread. For path 2, driver is freeing the SRB too early. Fixes: f6145e86d21f ("scsi: qla2xxx: Fix race between switch cmd completion and timeout") Cc: stable@vger.kernel.org # 4.19 Signed-off-by: Quinn Tran <quinn.tran@cavium.com> Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-09-11scsi: qla2xxx: Add mode control for each physical portQuinn Tran7-25/+542
Add ability to allow each physical port to control operating mode. Current code forces all ports to behave in one mode (i.e. initiator, target or dual). This patch allows user to select the operating mode for each port. - Driver must be loaded in dual mode to allow resource allocation modprobe qla2xxx qlini_mode=dual - In addition user can make adjustment to exchange resources using following command echo 1024 > /sys/class/scsi_host/host<x>/ql2xiniexchg echo 1024 > /sys/class/scsi_host/host<x>/ql2xexchoffld - trigger mode change and new setting of ql2xexchoffld|ql2xiniexchg echo [<value>] > /sys/class/scsi_host/host<x>/qlini_mode where, value can be one of following - enabled - disabled - dual - exclusive Signed-off-by: Quinn Tran <quinn.tran@cavium.com> Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>