Colin Ian King [Sat, 16 Mar 2019 22:57:09 +0000 (22:57 +0000)]
scsi: libcxgbi: remove uninitialized variable len
The variable len is not being inintialized and the uninitialized value is
being returned. However, this return path is never reached because the
default case in the switch statement returns -ENOSYS. Clean up the code by
replacing the return -ENOSYS with a break for the default case and
returning -ENOSYS at the end of the function. This allows len to be
removed.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
tangwenji [Wed, 27 Mar 2019 13:59:06 +0000 (21:59 +0800)]
scsi: target: alua: fix the tg_pt_gps_count
Reducing the count should be alua_tg_pt_gps_count instead of
alua_tg_pt_gps_counter when free alua group.
Signed-off-by: tangwenji <tang.wenji@zte.com.cn>
Reviewed-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Nathan Chancellor [Thu, 7 Mar 2019 23:18:39 +0000 (16:18 -0700)]
scsi: gdth: Only call dma_free_coherent when buf is not NULL in ioc_general
When building with -Wsometimes-uninitialized, Clang warns:
drivers/scsi/gdth.c:3662:6: warning: variable 'paddr' is used
uninitialized whenever 'if' condition is false
[-Wsometimes-uninitialized]
Don't attempt to call dma_free_coherent when buf is NULL (meaning that
we never called dma_alloc_coherent and initialized paddr), which avoids
this warning.
Link: https://github.com/ClangBuiltLinux/linux/issues/402
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
YueHaibing [Sat, 23 Mar 2019 02:15:59 +0000 (02:15 +0000)]
scsi: pm8001: remove set but not used variables 'param, sas_ha'
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/scsi/pm8001/pm8001_hwi.c: In function 'mpi_smp_completion':
drivers/scsi/pm8001/pm8001_hwi.c:2901:6: warning:
variable 'param' set but not used [-Wunused-but-set-variable]
drivers/scsi/pm8001/pm8001_hwi.c: In function 'pm8001_bytes_dmaed':
drivers/scsi/pm8001/pm8001_hwi.c:3247:24: warning:
variable 'sas_ha' set but not used [-Wunused-but-set-variable]
They're never used since introduction, so can be removed.
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Arnd Bergmann [Fri, 22 Mar 2019 14:25:03 +0000 (15:25 +0100)]
scsi: qla4xxx: avoid freeing unallocated dma memory
Clang -Wuninitialized notices that on is_qla40XX we never allocate any DMA
memory in get_fw_boot_info() but attempt to free it anyway:
drivers/scsi/qla4xxx/ql4_os.c:5915:7: error: variable 'buf_dma' is used uninitialized whenever 'if' condition is false
[-Werror,-Wsometimes-uninitialized]
if (!(val & 0x07)) {
^~~~~~~~~~~~~
drivers/scsi/qla4xxx/ql4_os.c:5985:47: note: uninitialized use occurs here
dma_free_coherent(&ha->pdev->dev, size, buf, buf_dma);
^~~~~~~
drivers/scsi/qla4xxx/ql4_os.c:5915:3: note: remove the 'if' if its condition is always true
if (!(val & 0x07)) {
^~~~~~~~~~~~~~~~~~~
drivers/scsi/qla4xxx/ql4_os.c:5885:20: note: initialize the variable 'buf_dma' to silence this warning
dma_addr_t buf_dma;
^
= 0
Skip the call to dma_free_coherent() here.
Fixes: 2a991c215978 ("[SCSI] qla4xxx: Boot from SAN support for open-iscsi")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Arnd Bergmann [Fri, 22 Mar 2019 14:25:49 +0000 (15:25 +0100)]
scsi: lpfc: avoid uninitialized variable warning
clang -Wuninitialized incorrectly sees a variable being used without
initialization:
drivers/scsi/lpfc/lpfc_nvme.c:2102:37: error: variable 'localport' is uninitialized when used here
[-Werror,-Wuninitialized]
lport = (struct lpfc_nvme_lport *)localport->private;
^~~~~~~~~
drivers/scsi/lpfc/lpfc_nvme.c:2059:38: note: initialize the variable 'localport' to silence this warning
struct nvme_fc_local_port *localport;
^
= NULL
1 error generated.
This is clearly in dead code, as the condition leading up to it is always
false when CONFIG_NVME_FC is disabled, and the variable is always
initialized when nvme_fc_register_localport() got called successfully.
Change the preprocessor conditional to the equivalent C construct, which
makes the code more readable and gets rid of the warning.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Silvio Cesare [Thu, 21 Mar 2019 16:44:32 +0000 (09:44 -0700)]
scsi: lpfc: change snprintf to scnprintf for possible overflow
Change snprintf to scnprintf. There are generally two cases where using
snprintf causes problems.
1) Uses of size += snprintf(buf, SIZE - size, fmt, ...)
In this case, if snprintf would have written more characters than what the
buffer size (SIZE) is, then size will end up larger than SIZE. In later
uses of snprintf, SIZE - size will result in a negative number, leading
to problems. Note that size might already be too large by using
size = snprintf before the code reaches a case of size += snprintf.
2) If size is ultimately used as a length parameter for a copy back to user
space, then it will potentially allow for a buffer overflow and information
disclosure when size is greater than SIZE. When the size is used to index
the buffer directly, we can have memory corruption. This also means when
size = snprintf... is used, it may also cause problems since size may become
large. Copying to userspace is mitigated by the HARDENED_USERCOPY kernel
configuration.
The solution to these issues is to use scnprintf which returns the number of
characters actually written to the buffer, so the size variable will never
exceed SIZE.
Signed-off-by: Silvio Cesare <silvio.cesare@gmail.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: James Smart <james.smart@broadcom.com>
Cc: Dick Kennedy <dick.kennedy@broadcom.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Anders Roxell [Thu, 21 Mar 2019 13:24:44 +0000 (14:24 +0100)]
scsi: ufs-mediatek: Add missing MODULE_* information
When building the ufs-mediatek module the following warning shows up:
WARNING: modpost: missing MODULE_LICENSE() in
drivers/scsi/ufs/ufs-mediatek.o
Rework to add MODULE_LICENSE,MODULE_AUTHOR and MODULE_DESCRIPTION.
Fixes: ddd90623ce26 ("scsi: ufs-mediatek: Add UFS support for Mediatek SoC chips")
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
YueHaibing [Thu, 21 Mar 2019 01:45:17 +0000 (01:45 +0000)]
scsi: ufs-mediatek: Fix platform_no_drv_owner.cocci warnings
Remove .owner field if calls are used which set it automatically
Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
tangwenji [Wed, 20 Mar 2019 14:14:44 +0000 (22:14 +0800)]
scsi: target: iscsi: Free conn_ops when zalloc_cpumask_var failed
It should not free cpumask but free conn->conn_ops when zalloc_cpumask_var
failed.
Signed-off-by: tangwenji <tang.wenji@zte.com.cn>
Reviewed-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
tangwenji [Wed, 13 Mar 2019 14:56:38 +0000 (22:56 +0800)]
scsi: target: iscsi: Fix np_ip_proto and np_sock_type in iscsit_setup_np
In the switch, np_ip_proto and np_sock_type set different values according
to np_network_transport, and then uniformly assign values, so the previous
values are overwritten.
Signed-off-by: tangwenji <tang.wenji@zte.com.cn>
Reviewed-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Colin Ian King [Wed, 20 Mar 2019 16:37:09 +0000 (16:37 +0000)]
scsi: target: fix unsigned comparision with less than zero
Currently an error return is being assigned to an unsigned size_t varianle
and then checked if the result is less than zero which will always be
false. Fix this by making ret ssize_t rather than a size_t.
Fixes: 0322913cab79 ("scsi: target: Add device product id and revision configfs attributes")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Nathan Chancellor [Wed, 20 Mar 2019 18:03:40 +0000 (11:03 -0700)]
scsi: ufs-mediatek: Avoid using ret uninitialized in ufs_mtk_setup_clocks
When building with -Wsometimes-uninitialized, Clang warns:
drivers/scsi/ufs/ufs-mediatek.c:112:7: warning: variable 'ret' is used
uninitialized whenever 'if' condition is false
[-Wsometimes-uninitialized]
if (on)
^~
drivers/scsi/ufs/ufs-mediatek.c:120:9: note: uninitialized use occurs
here
return ret;
^~~
drivers/scsi/ufs/ufs-mediatek.c:112:3: note: remove the 'if' if its
condition is always true
if (on)
^~~~~~~
drivers/scsi/ufs/ufs-mediatek.c:108:7: warning: variable 'ret' is used
uninitialized whenever 'if' condition is false
[-Wsometimes-uninitialized]
if (!on)
^~~
drivers/scsi/ufs/ufs-mediatek.c:120:9: note: uninitialized use occurs
here
return ret;
^~~
drivers/scsi/ufs/ufs-mediatek.c:108:3: note: remove the 'if' if its
condition is always true
if (!on)
^~~~~~~~
drivers/scsi/ufs/ufs-mediatek.c:96:9: note: initialize the variable
'ret' to silence this warning
int ret;
^
= 0
2 warnings generated.
Remove the default case and initialize ret to -EINVAL to properly fix
this warning.
Fixes: ddd90623ce26 ("scsi: ufs-mediatek: Add UFS support for Mediatek SoC chips")
Link: https://github.com/ClangBuiltLinux/linux/issues/426
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
YueHaibing [Wed, 20 Mar 2019 14:24:58 +0000 (22:24 +0800)]
scsi: ufs-mediatek: Make some symbols static
Fix sparse warnings:
drivers/scsi/ufs/ufs-mediatek.c:19:6: warning: symbol 'ufs_mtk_cfg_unipro_cg' was not declared. Should it be static?
drivers/scsi/ufs/ufs-mediatek.c:55:5: warning: symbol 'ufs_mtk_bind_mphy' was not declared. Should it be static?
drivers/scsi/ufs/ufs-mediatek.c:342:27: warning: symbol 'ufs_mtk_of_match' was not declared. Should it be static?
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Wed, 20 Mar 2019 17:44:22 +0000 (10:44 -0700)]
scsi: lpfc: Fixup eq_clr_intr references
Declaring interrupt clear routines as inline is bogus as they are used as
an indirect pointer.
Remove the inline references.
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Bottomley [Thu, 21 Mar 2019 00:02:04 +0000 (20:02 -0400)]
scsi: lpfc: Fix build error
You can't declare a function inline in a header if it doesn't have a body
available to the compiler. So realistically you either don't declare it
inline or you make it a static inline in the header. I think the latter
applies in this case, so this should be the fix
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Acked-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
YueHaibing [Sat, 16 Feb 2019 10:01:30 +0000 (18:01 +0800)]
scsi: mvumi: Stop using plain integer as NULL pointer
Fix following sparse warning:
drivers/scsi/mvumi.c:1797:48: warning: Using plain integer as NULL pointer
drivers/scsi/mvumi.c:2143:50: warning: Using plain integer as NULL pointer
drivers/scsi/mvumi.c:755:58: warning: Using plain integer as NULL pointer
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
YueHaibing [Sat, 16 Feb 2019 07:39:06 +0000 (07:39 +0000)]
scsi: qedi: Remove set but not used variable 'cls_sess'
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/scsi/qedi/qedi_fw.c: In function 'qedi_tmf_resp_work':
drivers/scsi/qedi/qedi_fw.c:158:28: warning:
variable 'cls_sess' set but not used [-Wunused-but-set-variable]
drivers/scsi/qedi/qedi_fw.c: In function 'qedi_tmf_work':
drivers/scsi/qedi/qedi_fw.c:1370:28: warning:
variable 'cls_sess' set but not used [-Wunused-but-set-variable]
It's never used since introduction.
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Matteo Croce [Fri, 4 Jan 2019 21:38:54 +0000 (22:38 +0100)]
scsi: be2iscsi: lpfc: fix typo
Fix spelling mistake: "lenght" -> "length"
Signed-off-by: Matteo Croce <mcroce@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Milan P. Gandhi [Tue, 12 Mar 2019 12:53:15 +0000 (18:23 +0530)]
scsi: qla2xxx: Fix a small typo in qla_bsg.c
Fixed a typo for 'iiDMA' cmd in qla_bsg.c.
Signed-off-by: Milan P. Gandhi <mgandhi@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Milan P. Gandhi [Tue, 12 Mar 2019 12:51:11 +0000 (18:21 +0530)]
scsi: qla2xxx: Fix comment alignment in qla_bsg.c
Fixed a minor formatting issue with comment section in qla_bsg.c
Signed-off-by: Milan P. Gandhi <mgandhi@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
YueHaibing [Wed, 20 Feb 2019 12:56:14 +0000 (12:56 +0000)]
scsi: mptfusion: remove set, but not used, variables
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/message/fusion/mptspi.c: In function 'mptspi_writeIOCPage4':
drivers/message/fusion/mptspi.c:262:9: warning:
variable 'frameOffset' set but not used [-Wunused-but-set-variable]
drivers/message/fusion/mptspi.c:261:9: warning:
variable 'req_idx' set but not used [-Wunused-but-set-variable]
They're never used and can be removed.
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Gustavo A. R. Silva [Mon, 11 Feb 2019 22:45:30 +0000 (16:45 -0600)]
scsi: mptfusion: mark expected switch fall-through
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where
we are expecting to fall through.
This patch fixes the following warning:
drivers/message/fusion/mptbase.c: In function mptbase_reply :
drivers/message/fusion/mptbase.c:643:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (event != MPI_EVENT_EVENT_CHANGE)
^
drivers/message/fusion/mptbase.c:646:2: note: here
case MPI_FUNCTION_CONFIG:
^~~~
Warning level 3 was used: -Wimplicit-fallthrough=3
Notice that, in this particular case, the code comment is modified in
accordance with what GCC is expecting to find.
This patch is part of the ongoing efforts to enable
-Wimplicit-fallthrough.
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Colin Ian King [Thu, 7 Feb 2019 12:44:07 +0000 (12:44 +0000)]
scsi: mptfusion: fix indentation issues
There are several statements and code blocks there are incorrectly
indented. Fix these.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Colin Ian King [Sat, 2 Feb 2019 10:30:35 +0000 (10:30 +0000)]
scsi: mvsas: clean up a few indentation issues
There are a few statements that are not indented correctly, so fix
these. Also add empty line between variable declaration and first
statements in functions. Also remove whitespace between * and mvi_dev to
clean up a cppcheck warning.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Colin Ian King [Wed, 23 Jan 2019 13:10:04 +0000 (13:10 +0000)]
scsi: qlogicfas408: clean up a couple of indentation issues
An if statement is indented correctly and an outb statement has a redundant
empty comment and incorrect indentation. Fix these.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Colin Ian King [Wed, 23 Jan 2019 12:53:19 +0000 (12:53 +0000)]
scsi: dpt_i2o: clean up indentation issues, remove spaces
There are several lines where the indentation has an extra space, fix this
by removing the spaces.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Colin Ian King [Tue, 22 Jan 2019 15:10:30 +0000 (15:10 +0000)]
scsi: atp870u: clean up code style and indentation issues
Clean up { brace to fix cppcheck warning. Remove some trailing spaces at
end of a statement. Also clean up an indentation issue.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Stanley Chu [Sat, 16 Mar 2019 05:04:47 +0000 (13:04 +0800)]
scsi: ufs-mediatek: Add UFS support for Mediatek SoC chips
This patch adds UFS support for MediaTek SoC chips.
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Stanley Chu [Sat, 16 Mar 2019 05:04:46 +0000 (13:04 +0800)]
scsi: phy: mediatek: Add UFS M-PHY driver
Add UFS M-PHY driver on MediaTek chipsets.
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Stanley Chu [Sat, 16 Mar 2019 05:04:45 +0000 (13:04 +0800)]
scsi: dt-bindings: ufs: Add document for ufs-mediatek
Add UFS and UFS PHY node document for Mediatek SoC chips.
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Stanley Chu [Sat, 16 Mar 2019 05:04:44 +0000 (13:04 +0800)]
scsi: dt-bindings: phy: Add document for phy-mtk-ufs
Add UFS M-PHY node document for MediaTek SoC chips.
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Stanley Chu [Sat, 16 Mar 2019 05:04:43 +0000 (13:04 +0800)]
scsi: ufs-hisi: Re-factor ufshcd_get_pwr_dev_param
ufshcd_get_pwr_dev_param function and ufs_dev_params struct have been
relocated to ufs core. Switch ufs-hisi to the common interface.
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Acked-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Stanley Chu [Sat, 16 Mar 2019 05:04:42 +0000 (13:04 +0800)]
scsi: ufs-qcom: Re-factor ufshcd_get_pwr_dev_param
ufshcd_get_pwr_dev_param function and ufs_dev_params struct have been
relocated to ufs core. Switch ufs-qcom to the common interface.
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Acked-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Stanley Chu [Sat, 16 Mar 2019 05:04:41 +0000 (13:04 +0800)]
scsi: ufs: Introduce ufshcd_get_pwr_dev_param
ufshcd_get_pwr_dev_param defines an interface for power mode management
currently used by both ufs-qcom and ufs-hisi. Move the interface to ufs
core so every driver can take advantage of it.
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Acked-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dongli Zhang [Tue, 12 Mar 2019 01:00:31 +0000 (09:00 +0800)]
scsi: smartpqi: Use HCTX_TYPE_DEFAULT for blk_mq_tag_set->map
Use HCTX_TYPE_DEFAULT instead of 0 to avoid hardcoding.
Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dongli Zhang [Tue, 12 Mar 2019 01:00:30 +0000 (09:00 +0800)]
scsi: qla2xxx: Use HCTX_TYPE_DEFAULT for blk_mq_tag_set->map
Use HCTX_TYPE_DEFAULT instead of 0 to avoid hardcoding.
Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dongli Zhang [Tue, 12 Mar 2019 01:00:29 +0000 (09:00 +0800)]
scsi: virtio_scsi: Use HCTX_TYPE_DEFAULT for blk_mq_tag_set->map
Use HCTX_TYPE_DEFAULT instead of 0 to avoid hardcoding.
Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dongli Zhang [Tue, 12 Mar 2019 01:00:28 +0000 (09:00 +0800)]
scsi: core: Use HCTX_TYPE_DEFAULT for blk_mq_tag_set->map
Use HCTX_TYPE_DEFAULT instead of 0 to avoid hardcoding.
Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Kangjie Lu [Fri, 15 Mar 2019 07:11:56 +0000 (02:11 -0500)]
scsi: ufs: fix a missing check of devm_reset_control_get
devm_reset_control_get could fail, so the fix checks its return value and
passes the error code upstream in case it fails.
Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Acked-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Colin Ian King [Sun, 17 Mar 2019 18:15:32 +0000 (18:15 +0000)]
scsi: pm8001: clean up various indentation issues
There are several lines of code where the indentation is at an incorrect
level; fix these.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Finn Thain [Thu, 7 Mar 2019 21:49:02 +0000 (08:49 +1100)]
scsi: NCR5380: Remove set but unused variable
Cc: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Finn Thain [Thu, 7 Mar 2019 21:49:02 +0000 (08:49 +1100)]
scsi: NCR5380: Avoid compiler warning when -Wimplicit-fallthrough is enabled
Adjust comments accordingly.
Cc: Gustavo A. R. Silva <gustavo@embeddedor.com>
Cc: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Bart Van Assche [Tue, 19 Mar 2019 03:06:42 +0000 (20:06 -0700)]
scsi: core: Remove OSD include files
All code from which the OSD include files were included has been removed.
Hence also remove the include files themselves. See also commit
19fcae3d4f2d ("scsi: remove the SCSI OSD library").
Cc: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Christoph Hellwig [Fri, 15 Mar 2019 08:44:19 +0000 (09:44 +0100)]
scsi: core: remove the scsi_ioctl_reset export
This function is only used inside the SCSI midlayer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Hannes Reinecke [Tue, 26 Feb 2019 15:00:39 +0000 (16:00 +0100)]
scsi: core: reshuffle no_scsi2_lun_in_cdb for better alignment
no_scsi2_lun_in_cdb declares a new bitfield, but we should rather move
it to the existing bitfield for better alignment.
Signed-off-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Tue, 12 Mar 2019 23:30:33 +0000 (16:30 -0700)]
scsi: lpfc: Update lpfc version to 12.2.0.1
Update lpfc version to 12.2.0.0
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Tue, 12 Mar 2019 23:30:32 +0000 (16:30 -0700)]
scsi: lpfc: Update Copyright in driver version
Revise driver copyright message to show 2019. Update couple of files
modified by 12.2.0.1 patch set.
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Tue, 12 Mar 2019 23:30:31 +0000 (16:30 -0700)]
scsi: lpfc: Enhance 6072 log string
Update the 6072 log message string to print the whole 32 bits of the
extended status.
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Tue, 12 Mar 2019 23:30:30 +0000 (16:30 -0700)]
scsi: lpfc: Fix duplicate log message numbers
Driver had duplicated log message numbers making debug difficult.
Make all messages unique.
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Tue, 12 Mar 2019 23:30:29 +0000 (16:30 -0700)]
scsi: lpfc: Specify node affinity for queue memory allocation
Change the SLI4 queue creation code to use NUMA node based memory
allocation based on the cpu the queues will be related to.
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Tue, 12 Mar 2019 23:30:28 +0000 (16:30 -0700)]
scsi: lpfc: Reduce memory footprint for lpfc_queue
Currently the driver maintains a sideband structure which has a pointer for
each queue element. However, at 8 bytes per pointer, and up to 4k elements
per queue, and 100s of queues, this can take up a lot of memory.
Convert the driver to using an access routine that calculates the element
address based on its index rather than using the pointer table.
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Tue, 12 Mar 2019 23:30:27 +0000 (16:30 -0700)]
scsi: lpfc: Add loopback testing to trunking mode
When in trunking mode, the adapter can be placed into diagnostic mode and
each link in the trunk tested via loopback.
Add support to the driver to perform per-link loopback testing when in
trunking mode.
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Tue, 12 Mar 2019 23:30:26 +0000 (16:30 -0700)]
scsi: lpfc: Fix link speed reporting for 4-link trunk
Driver is using uint16_t and is encountering an overflow of the 16bits when
calculating link speed.
Fix by using a u32 type.
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Tue, 12 Mar 2019 23:30:25 +0000 (16:30 -0700)]
scsi: lpfc: Fix handling of trunk links state reporting
If all the trunk links drop and a single link resumes, the link_state is
not properly reported. When trunked, the driver receives two async
cqes. One acqe reports the trunk link states, which the driver records.
The other cqe reports the overall state of the trunk. In the failing case,
the trunk link state acqe preceeds the overall trunk link state acqe. The
trunk link state acqe, as it's an "up" transition, calls a code path which
ensures a down transition before moving to the up state. The down
transition had a side effect of clearing the just-saved trunk link states.
Fix by not clearing the trunk link states if we've already transitioned
to a down state.
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Tue, 12 Mar 2019 23:30:24 +0000 (16:30 -0700)]
scsi: lpfc: Fix protocol support on G6 and G7 adapters
Invalid test is allowing Loop to be a supported topology on G6 and G7
adapters. The chips do not support loop as their link speeds prohibit loop
per standard.
Correct the conditional so that loop is not reported.
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Tue, 12 Mar 2019 23:30:23 +0000 (16:30 -0700)]
scsi: lpfc: Correct boot bios information to FDMI registration
The driver is currently reporting the firmware revision not the actual boot
bios version in FDMI data.
Modify the driver to obtain the boot bios version from the adapter and use
that data in the FMDI data sent to the switch.
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Tue, 12 Mar 2019 23:30:22 +0000 (16:30 -0700)]
scsi: lpfc: Fix HDMI2 registration string for symbolic name
The switch is rejecting FDMI2 registration for symbolic name. There is a
"\n" in the name string, which the switch dislikes thus rejects the
registration.
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Tue, 12 Mar 2019 23:30:21 +0000 (16:30 -0700)]
scsi: lpfc: Fix fc4type information for FDMI
The driver is reporting support for NVME even when not configured for NVME
operation.
Fix (and make more readable) when NVME protocol support is indicated.
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Tue, 12 Mar 2019 23:30:20 +0000 (16:30 -0700)]
scsi: lpfc: Fix FDMI manufacturer attribute value
The FDMI manufacturer value being reported on Linux is inconsistent with
other OS's.
Set the value to "Emulex Corporation" for consistency.
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Tue, 12 Mar 2019 23:30:19 +0000 (16:30 -0700)]
scsi: lpfc: Fix io lost on host resets
If the driver undergoes repeated host resets it starts losing exchange
structures and eventually returns SCSI_MLQUEUE_HOST_BUSY and does not
recover. The offline path is not reclaiming the outstanding ios on the fcp
pring txcmplq before calling lpfc_destroy_multixripool, which causes the
txmcplq to be reinit and the resources lost.
Flush the fcp rings before destroying the multixripools.
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Tue, 12 Mar 2019 23:30:18 +0000 (16:30 -0700)]
scsi: lpfc: Fix mailbox hang on adapter init
The adapter initialization sequence enables interrupts, initializes the
adapter link_state to LINK_DOWN, then issues commands to initialize the
adapter. The interrupt handler on the adapter validates the link_state (has
to be at least LINK_DOWN) and if invalid, will discard the interrupting
event.
In most cases, there is not a command completion, thus an interrupt until
the initialization commands have been sent which is post the setting of
state to LINK_DOWN. However, in cases of firmware reset, the reset will
modify the link_state to an invalid value (indicating a reset of the
adapter) and there occasionally are cases where the adapter will generate
an asynchronous event which shares the eq/cq used for mailbox commands. In
the failure case, an interrupt is generated immediately after enabling them
due to the async event. As link_state is invalid, the eq is list and the
CQ not serviced. At this point link_state is initialized and the mailbox
command sent. As the CQ has not been serviced, it is not armed, so no
interrupt event is generated when the mailbox command completes.
Modify the initialization sequence so that interrupts are enabled after
link_state is properly initialized, which avoids the race condition with
the async event.
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Tue, 12 Mar 2019 23:30:17 +0000 (16:30 -0700)]
scsi: lpfc: Fix driver crash in target reset handler
It's possible for the scsi error handler to fire and call the target reset
handler simultaneously to the driver logging out and relogging into the
system. If hit just right, the re-login may not have fully re-established
the remote port and the rdata->pnod structure may be null.
Check for NULL in the reset handler and return failure if NULL.
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Tue, 12 Mar 2019 23:30:16 +0000 (16:30 -0700)]
scsi: lpfc: Correct localport timeout duration error
Current code incorrectly specifies a completion wait timeout duration in 5
jiffies, when it should have been 5 seconds.
Fix the adjust for units for the completion timeout call.
[mkp: manual merge]
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Tue, 12 Mar 2019 23:30:15 +0000 (16:30 -0700)]
scsi: lpfc: Convert bootstrap mbx polling from msleep to udelay
Current code is using msleep when polling for hw ready. Unfortunately the
msleep routine isn't very accurate on rescheduling. In fact, on a busy
systems which reset the adapter, it became 10s of seconds before it was
rescheduled.
Fix by busy waiting using udelay. As we're now busy waiting, significantly
reduce the wait time so that we can exit the pool loop as soon as possible.
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Tue, 12 Mar 2019 23:30:14 +0000 (16:30 -0700)]
scsi: lpfc: Coordinate adapter error handling with offline handling
The driver periodically checks for adapter error in a background thread. If
the thread detects an error, the adapter will be reset including the
deletion and reallocation of workqueues on the adapter. Simultaneously,
there may be a user-space request to offline the adapter which may try to
do many of the same steps, in parallel, on a different thread. As memory
was deallocated while unexpected, the parallel offline request hit a bad
pointer.
Add coordination between the two threads. The error recovery thread has
precedence. So, when an error is detected, a flag is set on the adapter to
indicate the error thread is terminating the adapter. But, before doing
that work, it will look for a flag that is set by the offline flow, and if
set, will wait for it to complete before then processing the error handling
path. Similarly, in the offline thread, it first checks for whether the
error thread is resetting the adapter, and if so, will then wait for the
error thread to finish. Only after it has finished, will it set its flag
and offline the adapter.
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Tue, 12 Mar 2019 23:30:13 +0000 (16:30 -0700)]
scsi: lpfc: Stop adapter if pci errors detected
In a couple of cases, the driver detected a pci error (via pci device state
or via failed register reads) but didn't take any action to disable the
device. Additionally, the driver is ignoring the status of pci
configuration space reads.
Having the driver take the adapter offline whenever the pci error is
detected. Pay attention to pci_config_space_read status and return failure
if an error is seen.
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Tue, 12 Mar 2019 23:30:12 +0000 (16:30 -0700)]
scsi: lpfc: Fix deadlock due to nested hbalock call
If an adapter fails, causing a board reset, the board reset routine
lpfc_hba_down_s4() takes the hbalock out then calls
lpfc_nvmet_ctxbuf_post() who then tries to take out the same lock. As the
context lists are now protected under the buf_list_locks, there is no need
for the hbalock to be held by the board reset routine.
Fix by no longer taking the hbalock in the board reset routine.
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Tue, 12 Mar 2019 23:30:11 +0000 (16:30 -0700)]
scsi: lpfc: Fix nvmet handling of first burst cmd
With negative test injection, the driver is receiving a command with first
burst enabled, meaning Sequence initiative is not passed with the command
frame. The driver notes the condition and discards the frame. However the
driver calls the incorrect buffer free routine, resulting in a NULL pointer
reference.
For hbq buffer free, convert to using lpfc_rq_buf_free().
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Tue, 12 Mar 2019 23:30:10 +0000 (16:30 -0700)]
scsi: lpfc: Fix lpfc_nvmet_mrq attribute handling when 0
Currently, when lpfc_nvmet_mrq is 0 it could mean 2 different things
depending on when its looked at. If at module load time it specifies the
default number of hardware queues to allocate, with 0 meaning default to
the number of CPUs. But post module load, a value of zero means to disable
mrq use.
Changed the driver so that enablement of mrq is based on whether nvme
target mode is enabled or not. When enabled, mrq is enabled. Thus, the
cfg_nvemt_mrq field only specifies the number of mrq queues to enable, with
0 defaulting to the number of cpus.
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Tue, 12 Mar 2019 23:30:09 +0000 (16:30 -0700)]
scsi: lpfc: Fix nvmet async receive buffer replenishment
Under circustances with high load, the driver is running out of async
receive buffers which may result in one of the following messages:
0:6401 RQE Error x13, posted 226 err_cnt 0:
925c6050 925c604e 925c5d54
or
0:2885 Port Status Event: port status reg 0x81800000,
port smphr reg 0xc000, error 1=0x52004a01, error 2=0x0
The driver is waiting for full io completion before returning receive
buffers to the adapter. There is no need for such a relationship.
Whenever a new command is received from the wire, the driver will have two
contexts - an io context (ctxp) and a receive buffer context. In current
code, the receive buffer context stays 1:1 with the io and won't be
reposted to the hardware until the io completes. There is no need for such
a relationship.
Change the driver so that up on successful handing of the command to the
transport, where the transport has copied what it needed thus the buffer is
returned to the driver, have the driver immediately repost the buffer to
the hardware. If the command cannot be successfully handed to the transport
as transport resources are temporarily busy, have the driver allocate a new
and separate receive buffer and post it to the hardware so that hardware
can continue while the command is queued for the transport.
When an io is complete, the transport returns the io context to the driver,
and the driver may be waiting for more contexts, thus immediately reuse the
io context. In this path, there was a buffer posted when the receive buffer
was queued waiting for an io context so a replacement is not needed in the
new code additions. Thus, exempt this the context reuse case from the
buffer reposting.
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Tue, 12 Mar 2019 23:30:08 +0000 (16:30 -0700)]
scsi: lpfc: Fix location of SCSI ktime counters
The debug ktime counters that trace an io were inadvertently not placed in
the common section of an io buffer. Thus, they generate an invalid opcode
error when accessed.
Move the ktime counters into the common area.
Fixes: 0794d601d174 ("scsi: lpfc: Implement common IO buffers between NVME and SCSI")
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Tue, 12 Mar 2019 23:30:07 +0000 (16:30 -0700)]
scsi: lpfc: Fix SLI3 commands being issued on SLI4 devices
During debug, it was seen that the driver is issuing commands specific to
SLI3 on SLI4 devices. Although the adapter correctly rejected the command,
this should not be done.
Revise the code to stop sending these commands on a SLI4 adapter.
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Tue, 12 Mar 2019 23:30:06 +0000 (16:30 -0700)]
scsi: lpfc: Fix use-after-free mailbox cmd completion
When unloading the driver, mailbox commands may be sent without holding a
reference on the ndlp. By the time the mailbox command completes, the ndlp
may have reduced its ref counts and been freed. The problem was reported
by KASAN.
While unregistering due to driver unload, have the completion noop'd by
setting the ndlp context NULL'd. Due to the unload, no further action was
necessary. Also, while reviewing this path, the generic nulling of the
context after handling should be slightly moved.
Reported by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Tue, 12 Mar 2019 23:30:05 +0000 (16:30 -0700)]
scsi: lpfc: Resolve irq-unsafe lockdep heirarchy warning in lpfc_io_free
A patch in the 12.2.0.0 set caused a new lockdep warning:
WARNING: SOFTIRQ-safe -> SOFTIRQ-unsafe lock order detected
5.0.0-rc8-next-
20190301-dbg+ #1 Not tainted
Possible interrupt unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&(&qp->io_buf_list_put_lock)->rlock);
local_irq_disable();
lock(&(&phba->hbalock)->rlock);
lock(&(&qp->io_buf_list_put_lock)->rlock);
<Interrupt>
lock(&(&phba->hbalock)->rlock);
see: https://www.spinics.net/lists/linux-scsi/msg128389.html
In summary, the new patch added taking the io_buf_list_put_lock while under
an irq-disabled hbalock. This created a lock heirarchy dependent upon irq
being disabled, and there are paths that take the io_buf_list_put_lock
without disabling irq.
Looking at the lpfc_io_free routine, which is where the new heirarchy was
introduced, there is no reason to be taking out the hbalock and raising
irq, as the functionality is replaced by the io_buf_list_xxx locks.
Resolve by removing the hbalock/irq calls in lpfc_io_free.
Fixes: 5e5b511d8bfa ("scsi: lpfc: Partition XRI buffer list across Hardware Queues")
Reported-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Tue, 12 Mar 2019 23:30:04 +0000 (16:30 -0700)]
scsi: lpfc: Resolve inconsistent check of hdwq in lpfc_scsi_cmd_iocb_cmpl
A prior patch which added support for non-uniform allocation of MSIX
vectors now causes a smatch complaint:
drivers/scsi/lpfc/lpfc_scsi.c:3674 lpfc_scsi_cmd_iocb_cmpl()
error: we previously assumed 'phba->sli4_hba.hdwq' could be
null (see line 3667)
Resolve by removing the unnecessary check for a NULL hdwq table.
Fixes
6a828b0f6192: ("scsi: lpfc: Support non-uniform allocation of MSIX vectors to hardware queues")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Himanshu Madhani [Tue, 12 Mar 2019 18:08:23 +0000 (11:08 -0700)]
scsi: qla2xxx: Update driver version to 10.01.00.15-k
This version includes support for ISP28XX.
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Michael Hernandez [Tue, 12 Mar 2019 18:08:22 +0000 (11:08 -0700)]
scsi: qla2xxx: Secure flash update support for ISP28XX
This patch adds support for Secure flash update with ISP28xx.
Signed-off-by: Michael Hernandez <mhernandez@marvell.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Joe Carnuccio [Tue, 12 Mar 2019 18:08:21 +0000 (11:08 -0700)]
scsi: qla2xxx: Add 28xx flash primary/secondary status/image mechanism
Includes the following:
- correction to 27xx image status struct;
- factoring of 27xx image status validating routines to make common;
- image status generation compare that works across zero wrap;
- bsg interface to report current active images (as loaded by driver).
Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Mike Hernandez <mhernandez@marvell.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Joe Carnuccio [Tue, 12 Mar 2019 18:08:20 +0000 (11:08 -0700)]
scsi: qla2xxx: Simplification of register address used in qla_tmpl.c
Reduce stack space on each fwdt routine by eliminating local variable reg.
Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Joe Carnuccio [Tue, 12 Mar 2019 18:08:19 +0000 (11:08 -0700)]
scsi: qla2xxx: Correction and improvement to fwdt processing
This patch cleans up and fixes firmware dump template processing. These
changes are added to support newer features for ISP27XX/ISP28XX.
Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Joe Carnuccio [Tue, 12 Mar 2019 18:08:18 +0000 (11:08 -0700)]
scsi: qla2xxx: Update flash read/write routine
This patch makes following changes to flash access routines:
- update return type for read_optrom
- use void instead of uint32_t * for buffer parameter in read
and write optrom routines
- fix flash/nvram addressing
Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Joe Carnuccio [Tue, 12 Mar 2019 18:08:17 +0000 (11:08 -0700)]
scsi: qla2xxx: Add support for multiple fwdump templates/segments
This patch adds multipe firmware dump template and segments support for
ISP27XX/28XX.
Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Joe Carnuccio [Tue, 12 Mar 2019 18:08:16 +0000 (11:08 -0700)]
scsi: qla2xxx: Cleanups for NVRAM/Flash read/write path
This patch does following:
- Clean up NVRAM code.
- Optimizes reading of primary/secondary flash image validation.
- Remove 0xff mask and make correct width in FLT structure.
- Use endian macros to assign static fields in fwdump header.
- Correct fdwt checksum calculation.
- Simplify ql_dump_buffer() interface usage.
- Add endianizers to 27xx firmware image validator.
- fixes compiler warnings for big endian architecture.
Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Joe Carnuccio [Tue, 12 Mar 2019 18:08:15 +0000 (11:08 -0700)]
scsi: qla2xxx: Correctly report max/min supported speeds
This patch fixes reported speed for min_link and max_supported speed. Also
rename sysfs nodes link_speed and max_supported to be consistent with
{min|max}_suuported_speed.
Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Mike Hernandez <mhernandez@marvell.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Joe Carnuccio [Tue, 12 Mar 2019 18:08:14 +0000 (11:08 -0700)]
scsi: qla2xxx: Add Serdes support for ISP28XX
This patch adds sysfs node for serdes_version and also cleans up port_speed
display.
Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Joe Carnuccio [Tue, 12 Mar 2019 18:08:13 +0000 (11:08 -0700)]
scsi: qla2xxx: Add Device ID for ISP28XX
This patch adds PCI device ID ISP28XX for Gen7 support. Also signature
determination for primary/secondary flash image for ISP27XX/28XX is aded as
part of Gen7 support.
Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Joe Carnuccio [Tue, 12 Mar 2019 18:08:12 +0000 (11:08 -0700)]
scsi: qla2xxx: Fix routine qla27xx_dump_{mpi|ram}()
This patch fixes qla27xx_dump_{mpi|ram} api for ISP27XX.
Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Joe Carnuccio [Tue, 12 Mar 2019 18:08:11 +0000 (11:08 -0700)]
scsi: qla2xxx: Remove FW default template
This patch removes FW default template as there will never be case where
the default template would be invoked.
Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Joe Carnuccio [Tue, 12 Mar 2019 18:08:10 +0000 (11:08 -0700)]
scsi: qla2xxx: Add fw_attr and port_no SysFS node
This patch adds new sysfs node to display firmware attributes and port
number.
Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Suganath Prabu [Fri, 15 Feb 2019 07:40:30 +0000 (02:40 -0500)]
scsi: mpt3sas: Update mpt3sas driver version to 28.100.00.00
Updated driver version to 28.100.00.00, which is equivalent to OOB Phase 9.
Signed-off-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Suganath Prabu [Fri, 15 Feb 2019 07:40:29 +0000 (02:40 -0500)]
scsi: mpt3sas: Improve the threshold value and introduce module param
* Reduce the threshold value to 1/4 of the queue depth.
* With this FW can find enough entries to post the Reply Descriptors in the
reply descriptor post queue.
* With module param, user can play with threshold value, the same
irqpoll_weight is used as the budget in processing of reply descriptor
post queues in _base_process_reply_queue.
Signed-off-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Suganath Prabu [Fri, 15 Feb 2019 07:40:28 +0000 (02:40 -0500)]
scsi: mpt3sas: Load balance to improve performance and avoid soft lockups
Driver uses "reply descriptor post queues" in round robin fashion so that
IO's are distributed to all the available reply descriptor post queues
equally. With this each reply descriptor post queue load is balanced.
This is enabled only if CPUs count to MSI-X vector count ratio is X:1
(where X > 1) This improves performance and also fixes soft lockups.
Signed-off-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Suganath Prabu [Fri, 15 Feb 2019 07:40:27 +0000 (02:40 -0500)]
scsi: mpt3sas: Irq poll to avoid CPU hard lockups
Issue Description:
We have seen cpu lock up issue from fields if system has greater (more than
96) logical cpu count. SAS3.0 controller (Invader series) supports at max
96 msix vector and SAS3.5 product (Ventura) supports at max 128 msix
vectors.
This may be a generic issue (if PCI device supports completion on multiple
reply queues). Let me explain it w.r.t to mpt3sas supported h/w just to
simplify the problem and possible changes to handle such issues. IT HBA
(mpt3sas) supports multiple reply queues in completion path. Driver creates
MSI-x vectors for controller as "min of (FW supported Reply queue, Logical
CPUs)". If submitter is not interrupted via completion on same CPU, there
is a loop in the IO path. This behavior can cause hard/soft CPU lockups, IO
timeout, system sluggish etc.
Example - one CPU (e.g. CPU A) is busy submitting the IOs and another CPU
(e.g. CPU B) is busy with processing the corresponding IO's reply
descriptors from reply descriptor queue upon receiving the interrupts from
HBA. If the CPU A is continuously pumping the IOs then always CPU B (which
is executing the ISR) will see the valid reply descriptors in the reply
descriptor queue and it will be continuously processing those reply
descriptor in a loop without quitting the ISR handler.
Mpt3sas driver will exit ISR handler if it finds unused reply descriptor in
the reply descriptor queue. Since CPU A will be continuously sending the
IOs, CPU B may always see a valid reply descriptor (posted by HBA Firmware
after processing the IO) in the reply descriptor queue. In worst case,
driver will not quit from this loop in the ISR handler. Eventually, CPU
lockup will be detected by watchdog.
Above mentioned behavior is not common if "rq_affinity" set to 2 or
affinity_hint is honored by irqbalance as "exact". If rq_affinity is set
to 2, submitter will be always interrupted via completion on same CPU. If
irqbalance is using "exact" policy, interrupt will be delivered to
submitter CPU.
If CPU counts to MSI-X vectors (reply descriptor Queues) count ratio is not
1:1, we still have exposure of issue explained above and for that we don't
have any solution.
Exposure of soft/hard lockup if CPU count is more than MSI-x supported by
device.
If CPUs count to MSI-x vectors count ratio is not 1:1, (Other way, if CPU
counts to MSI-x vector count ratio is something like X:1, where X > 1) then
'exact' irqbalance policy OR rq_affinity = 2 won't help to avoid CPU
hard/soft lockups. There won't be any one to one mapping between CPU to
MSI-x vector instead one MSI-x interrupt (or reply descriptor queue) is
shared with group/set of CPUs and there is a possibility of having a loop
in the IO path within that CPU group and may observe lockups.
For example: Consider a system having two NUMA nodes and each node having
four logical CPUs and also consider that number of MSI-x vectors enabled on
the HBA is two, then CPUs count to MSI-x vector count ratio as 4:1. e.g.
MSIx vector 0 is affinity to CPU 0, CPU 1, CPU 2 & CPU 3 of NUMA node 0 and
MSI-x vector 1 is affinity to CPU 4, CPU 5, CPU 6 & CPU 7 of NUMA node 1.
numactl --hardware
available: 2 nodes (0-1)
node 0 cpus: 0 1 2 3 --> MSI-x 0
node 0 size: 65536 MB
node 0 free: 63176 MB
node 1 cpus: 4 5 6 7 -->MSI-x 1
node 1 size: 65536 MB
node 1 free: 63176 MB
Assume that user started an application which uses all the CPUs of NUMA
node 0 for issuing the IOs. Only one CPU from affinity list (it can be any
cpu since this behavior depends upon irqbalance) CPU0 will receive the
interrupts from MSIx vector 0 for all the IOs. Eventually, CPU 0 IO
submission percentage will be decreasing and ISR processing percentage will
be increasing as it is more busy with processing the interrupts. Gradually
IO submission percentage on CPU 0 will be zero and it's ISR processing
percentage will be 100 percentage as IO loop has already formed within the
NUMA node 0, i.e. CPU 1, CPU 2 & CPU 3 will be continuously busy with
submitting the heavy IOs and only CPU 0 is busy in the ISR path as it
always find the valid reply descriptor in the reply descriptor
queue. Eventually, we will observe the hard lockup here.
Chances of occurring of hard/soft lockups are directly proportional to
value of X. If value of X is high, then chances of observing CPU lockups is
high.
Solution: Use IRQ poll interface defined in " irq_poll.c". mpt3sas driver
will execute ISR routine in Softirq context and it will always quit the
loop based on budget provided in IRQ poll interface.
In these scenarios (i.e. where CPUs count to MSI-X vectors count ratio is
X:1 (where X > 1)), IRQ poll interface will avoid CPU hard lockups due to
voluntary exit from the reply queue processing based on budget. Note -
Only one MSI-x vector is busy doing processing.
Irqstat output:
IRQs / 1 second(s)
IRQ# TOTAL NODE0 NODE1 NODE2 NODE3 NAME
44 122871 122871 0 0 0 IR-PCI-MSI-edge mpt3sas0-msix0
45 0 0 0 0 0 IR-PCI-MSI-edge mpt3sas0-msix1
We use this approach only if cpu count is more than FW supported MSI-x
vector
Signed-off-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Suganath Prabu [Fri, 15 Feb 2019 07:40:25 +0000 (02:40 -0500)]
scsi: mpt3sas: simplify interrupt handler
Separate out processing of reply descriptor post queue from _base_interrupt
to _base_process_reply_queue.
Signed-off-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Suganath Prabu [Fri, 15 Feb 2019 07:40:24 +0000 (02:40 -0500)]
scsi: mpt3sas: Fix typo in request_desript_type
Fixed typo in request_desript_type.
request_desript_type --> request_descript_type.
Signed-off-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Alan Adamson [Fri, 1 Mar 2019 22:44:20 +0000 (14:44 -0800)]
scsi: target: Add device product id and revision configfs attributes
The product_id and revision attributes will allow for the modification of
the T10 Model and Revision strings returned in inquiry responses. Its
value can be viewed and modified via the ConfigFS path at:
target/core/$backstore/$name/wwn/product_id
target/core/$backstore/$name/wwn/revision
[mkp: dropped parentheses as requested by Bart]
Signed-off-by: Alan Adamson <alan.adamson@oracle.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Don Brace [Thu, 14 Mar 2019 21:58:16 +0000 (16:58 -0500)]
scsi: smartpqi: bump driver version
Reviewed-by: Gerry Morong <gerry.morong@microsemi.com>
Reviewed-by: David Carroll <david.carroll@microsemi.com>
Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Don Brace [Thu, 14 Mar 2019 21:58:09 +0000 (16:58 -0500)]
scsi: smartpqi: add spdx
Reviewed-by: David Carroll <david.carroll@microsemi.com>
Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Don Brace [Thu, 14 Mar 2019 21:58:02 +0000 (16:58 -0500)]
scsi: smartpqi: update copyright
Reviewed-by: Gerry Morong <gerry.morong@microsemi.com>
Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: David Carroll <david.carroll@microsemi.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>