platform/kernel/linux-rpi.git
3 years agoscsi: megaraid: Make smp_affinity_enable static
Jason Yan [Tue, 15 Sep 2020 08:39:48 +0000 (16:39 +0800)]
scsi: megaraid: Make smp_affinity_enable static

This addresses the following sparse warning:

drivers/scsi/megaraid/megaraid_sas_base.c:80:5: warning: symbol
'smp_affinity_enable' was not declared. Should it be static?

Link: https://lore.kernel.org/r/20200915083948.2826598-1-yanaijie@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: target: Remove redundant assignment to variable 'ret'
Jing Xiangfeng [Mon, 14 Sep 2020 02:32:07 +0000 (10:32 +0800)]
scsi: target: Remove redundant assignment to variable 'ret'

The variable ret has been initialized with a value '0'. The assignment in
switch-case is redundant. Remove it.

Link: https://lore.kernel.org/r/20200914023207.113792-1-jingxiangfeng@huawei.com
Reviewed-by: Maurizio Lombardi <mlombard@redhat.com>
Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: zfcp: Clarify access to erp_action in zfcp_fsf_req_complete()
Julian Wiedmann [Thu, 10 Sep 2020 19:49:16 +0000 (21:49 +0200)]
scsi: zfcp: Clarify access to erp_action in zfcp_fsf_req_complete()

While reviewing commit 936e6b85da04 ("scsi: zfcp: Fix panic on ERP timeout
for previously dismissed ERP action"), I stumbled over
zfcp_fsf_req_complete() and wondered whether it has similar issues wrt
concurrent modification of req->erp_action by
zfcp_erp_strategy_check_fsfreq().

But a closer look shows that both its two callers [zfcp_fsf_reqid_check(),
zfcp_fsf_req_dismiss_all()] remove the request from the adapter's req_list
under the req_list's lock.  Hence we can trust that if
zfcp_erp_strategy_check_fsfreq() concurrently looks up the corresponding
req_id, it won't find this request and is thus unable to modify it while
it's being processed by zfcp_fsf_req_complete().

Add a code comment that hopefully makes this easier for future readers, and
condense the two accesses to ->erp_action that made me trip over this code
path in the first place.

Link: https://lore.kernel.org/r/c500eac301fcbba5af942bbd200f2d6b14e46994.1599765652.git.bblock@linux.ibm.com
Reviewed-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: zfcp: Use list_first_entry_or_null() in zfcp_erp_thread()
Julian Wiedmann [Thu, 10 Sep 2020 19:49:15 +0000 (21:49 +0200)]
scsi: zfcp: Use list_first_entry_or_null() in zfcp_erp_thread()

Use the right helper to avoid poking around in the list's internals.

Link: https://lore.kernel.org/r/ed669555c73aab95b29444c10066f492c0c43391.1599765652.git.bblock@linux.ibm.com
Reviewed-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: aic94xx: Remove unused inline function
YueHaibing [Wed, 9 Sep 2020 13:57:11 +0000 (21:57 +0800)]
scsi: aic94xx: Remove unused inline function

There is no caller in tree. Remove it.

Link: https://lore.kernel.org/r/20200909135711.35728-1-yuehaibing@huawei.com
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: libfc: Fix passing zero to 'PTR_ERR' warning
YueHaibing [Wed, 9 Sep 2020 13:54:32 +0000 (21:54 +0800)]
scsi: libfc: Fix passing zero to 'PTR_ERR' warning

drivers/scsi/libfc/fc_disc.c:304
 fc_disc_error() warn: passing zero to 'PTR_ERR'

fp may be NULL in fc_disc_error(), use PTR_ERR_OR_ZERO to handle this.

Link: https://lore.kernel.org/r/20200909135432.36772-1-yuehaibing@huawei.com
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: fnic: Remove unneeded semicolon
Jason Yan [Fri, 11 Sep 2020 09:10:57 +0000 (17:10 +0800)]
scsi: fnic: Remove unneeded semicolon

This addresses the following coccinelle warning:

drivers/scsi/fnic/fnic_main.c:446:2-3: Unneeded semicolon

Link: https://lore.kernel.org/r/20200911091057.2938685-1-yanaijie@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: nsp32: Remove unneeded semicolon
Jason Yan [Fri, 11 Sep 2020 09:10:49 +0000 (17:10 +0800)]
scsi: nsp32: Remove unneeded semicolon

This addresses the following coccinelle warning:

drivers/scsi/nsp32.c:1250:4-5: Unneeded semicolon
drivers/scsi/nsp32.c:1842:2-3: Unneeded semicolon

Link: https://lore.kernel.org/r/20200911091049.2938158-1-yanaijie@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: sym53c8xx_2: Remove unneeded semicolon
Jason Yan [Fri, 11 Sep 2020 09:10:31 +0000 (17:10 +0800)]
scsi: sym53c8xx_2: Remove unneeded semicolon

This addresses the following coccinelle warning:

drivers/scsi/sym53c8xx_2/sym_fw.c:372:3-4: Unneeded semicolon
drivers/scsi/sym53c8xx_2/sym_fw.c:480:3-4: Unneeded semicolon
drivers/scsi/sym53c8xx_2/sym_fw.c:536:2-3: Unneeded semicolon

Link: https://lore.kernel.org/r/20200911091031.2937834-1-yanaijie@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: qla2xxx: Remove unneeded variable 'rval'
Jason Yan [Fri, 11 Sep 2020 09:10:21 +0000 (17:10 +0800)]
scsi: qla2xxx: Remove unneeded variable 'rval'

This addresses the following coccinelle warning:

drivers/scsi/qla2xxx/qla_init.c:7112:5-9: Unneeded variable: "rval".
Return "QLA_SUCCESS" on line 7115

Link: https://lore.kernel.org/r/20200911091021.2937708-1-yanaijie@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ufs-pci: Add LTR support for Intel controllers
Adrian Hunter [Thu, 27 Aug 2020 07:20:30 +0000 (10:20 +0300)]
scsi: ufs-pci: Add LTR support for Intel controllers

Intel host controllers support the setting of latency tolerance.
Accordingly, implement the PM QoS ->set_latency_tolerance() callback. The
raw register values are also exposed via debugfs.

Link: https://lore.kernel.org/r/20200827072030.24655-1-adrian.hunter@intel.com
Fixes: 8c09d7527697 ("scsi: ufshdc-pci: Add Intel PCI IDs for EHL")
Fixes: 1ab27c9cf8b6 ("ufs: Add support for clock gating")
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Acked-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoMerge branch '5.9/scsi-fixes' into 5.10/scsi-ufs
Martin K. Petersen [Tue, 15 Sep 2020 15:24:32 +0000 (11:24 -0400)]
Merge branch '5.9/scsi-fixes' into 5.10/scsi-ufs

Resolve UFS discrepancies between fixes and queue.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: lpfc: Remove set but not used 'qp'
Ye Bin [Wed, 9 Sep 2020 08:27:16 +0000 (16:27 +0800)]
scsi: lpfc: Remove set but not used 'qp'

This addresses the following gcc warning with "make W=1":

not used [-Wunused-but-set-variable]
  struct lpfc_sli4_hdw_queue *qp;
                                ^

Link: https://lore.kernel.org/r/20200909082716.37787-1-yebin10@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Ye Bin <yebin10@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc_debugfs.c: In function ‘lpfc_debugfs_hdwqstat_data’:
drivers/scsi/lpfc/lpfc_debugfs.c:1699:30: warning: variable ‘qp’ set but

3 years agoscsi: gdth: Remove set but used 'cmd_index'
Ye Bin [Wed, 9 Sep 2020 08:26:26 +0000 (16:26 +0800)]
scsi: gdth: Remove set but used 'cmd_index'

This addresses the following gcc warning with "make W=1":

drivers/scsi/gdth.c: In function ‘gdth_async_event’:
drivers/scsi/gdth.c:3010:9: warning: variable ‘cmd_index’ set but not
used [-Wunused-but-set-variable]
     int cmd_index;

Link: https://lore.kernel.org/r/20200909082627.101984-1-yebin10@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Ye Bin <yebin10@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: pmcraid: Remove set but not used 'res'
Ye Bin [Wed, 9 Sep 2020 08:26:27 +0000 (16:26 +0800)]
scsi: pmcraid: Remove set but not used 'res'

This addresses the following gcc warning with "make W=1":

 drivers/scsi/pmcraid.c: In function ‘pmcraid_abort_cmd’:
 drivers/scsi/pmcraid.c:2863:33: warning: variable ‘res’ set but not
 used [-Wunused-but-set-variable]
   struct pmcraid_resource_entry *res;
                                    ^

Link: https://lore.kernel.org/r/20200909082627.101984-2-yebin10@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Ye Bin <yebin10@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: qla1280: Remove set but not used variable in qla1280_status_entry()
Jason Yan [Mon, 7 Sep 2020 07:45:18 +0000 (15:45 +0800)]
scsi: qla1280: Remove set but not used variable in qla1280_status_entry()

This addresses the following gcc warning with "make W=1":

drivers/scsi/qla1280.c: In function ‘qla1280_status_entry’:
drivers/scsi/qla1280.c:3607:28: warning: variable ‘lun’ set but not used
[-Wunused-but-set-variable]
 3607 |  unsigned int bus, target, lun;
      |                            ^~~
drivers/scsi/qla1280.c:3607:20: warning: variable ‘target’ set but not
used [-Wunused-but-set-variable]
 3607 |  unsigned int bus, target, lun;
      |                    ^~~~~~
drivers/scsi/qla1280.c:3607:15: warning: variable ‘bus’ set but not used
[-Wunused-but-set-variable]
 3607 |  unsigned int bus, target, lun;
      |               ^~~

Link: https://lore.kernel.org/r/20200907074518.2326360-5-yanaijie@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: qla1280: Remove set but not used variable in qla1280_mailbox_command()
Jason Yan [Mon, 7 Sep 2020 07:45:17 +0000 (15:45 +0800)]
scsi: qla1280: Remove set but not used variable in qla1280_mailbox_command()

This addresses the following gcc warning with "make W=1":

drivers/scsi/qla1280.c: In function ‘qla1280_mailbox_command’:
drivers/scsi/qla1280.c:2430:11: warning: variable ‘data’ set but not
used [-Wunused-but-set-variable]
 2430 |  uint16_t data;
      |           ^~~~

Link: https://lore.kernel.org/r/20200907074518.2326360-4-yanaijie@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: qla1280: Remove set but not used variable in qla1280_nvram_config()
Jason Yan [Mon, 7 Sep 2020 07:45:16 +0000 (15:45 +0800)]
scsi: qla1280: Remove set but not used variable in qla1280_nvram_config()

This addresses the following gcc warning with "make W=1":

drivers/scsi/qla1280.c: In function ‘qla1280_nvram_config’:
drivers/scsi/qla1280.c:2188:36: warning: variable ‘ddma_conf’ set but
not used [-Wunused-but-set-variable]
 2188 |   uint16_t hwrev, cfg1, cdma_conf, ddma_conf;
      |                                    ^~~~~~~~~

Link: https://lore.kernel.org/r/20200907074518.2326360-3-yanaijie@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: qla1280: Remove set but not used variable in qla1280_done()
Jason Yan [Mon, 7 Sep 2020 07:45:15 +0000 (15:45 +0800)]
scsi: qla1280: Remove set but not used variable in qla1280_done()

This addresses the following gcc warning with "make W=1":

drivers/scsi/qla1280.c: In function ‘qla1280_done’:
drivers/scsi/qla1280.c:1244:19: warning: variable ‘lun’ set but not used
[-Wunused-but-set-variable]
 1244 |  int bus, target, lun;
      |                   ^~~

Link: https://lore.kernel.org/r/20200907074518.2326360-2-yanaijie@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ufs: Fix 'unmet direct dependencies' config warning
Alim Akhtar [Tue, 21 Jul 2020 17:20:21 +0000 (22:50 +0530)]
scsi: ufs: Fix 'unmet direct dependencies' config warning

With !CONFIG_OF and SCSI_UFS_EXYNOS selected, the below warning is given:

WARNING: unmet direct dependencies detected for PHY_SAMSUNG_UFS
  Depends on [n]: OF [=n] && (ARCH_EXYNOS || COMPILE_TEST [=y])
  Selected by [y]:
  - SCSI_UFS_EXYNOS [=y] && SCSI_LOWLEVEL [=y] && SCSI [=y] && SCSI_UFSHCD_PLATFORM [=y] && (ARCH_EXYNOS || COMPILE_TEST [=y])

Fix it by removing PHY_SAMSUNG_UFS dependency.

Link: https://lore.kernel.org/r/20200721172021.28922-1-alim.akhtar@samsung.com
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ibmvfc: Fix error return in ibmvfc_probe()
Jing Xiangfeng [Mon, 7 Sep 2020 08:39:49 +0000 (16:39 +0800)]
scsi: ibmvfc: Fix error return in ibmvfc_probe()

Fix to return error code PTR_ERR() from the error handling case instead of
0.

Link: https://lore.kernel.org/r/20200907083949.154251-1-jingxiangfeng@huawei.com
Acked-by: Tyrel Datwyler <tyreld@linux.ibm.com>
Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ufs: ufs-mediatek: Fix build warnings with make W=1
Stanley Chu [Thu, 10 Sep 2020 01:37:56 +0000 (09:37 +0800)]
scsi: ufs: ufs-mediatek: Fix build warnings with make W=1

Fix build warnings with make W=1 as below,

1.
>> drivers/scsi/ufs/ufs-mediatek.c:116:22: warning: format '%d' expects
>> argument of type 'int', but argument 4 has type 'long int'

2.
  CC [M]  drivers/scsi/ufs/ufs-mediatek.o
../drivers/scsi/ufs/ufs-mediatek.c:749: error: Cannot parse struct or union!

/** is used specifically with kernel-doc tool.
As a quick fix by removing dubious /** in the comment block of
struct ufs_hba_variant_ops ufs_hba_mtk_vops.

Link: https://lore.kernel.org/r/20200910013756.11385-1-stanley.chu@mediatek.com
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: qla2xxx: Handle incorrect entry_type entries
Daniel Wagner [Tue, 8 Sep 2020 08:15:16 +0000 (10:15 +0200)]
scsi: qla2xxx: Handle incorrect entry_type entries

It was observed on an ISP8324 16Gb HBA with fw=8.08.203 (d0d5) in a
PowerPC64 machine that pkt->entry_type was MBX_IOCB_TYPE/0x39 with an
sp->type SRB_SCSI_CMD which is invalid and should not be possible.

Reading the entry_type from the crash dump shows the expected value of
STATUS_TYPE/0x03 but the call trace shows that qla24xx_mbx_iocb_entry() is
used.

Add a check to verify for consistency and reset the HBA if an invalid state
is reached. Obviously, this is only a workaround until the real problem is
solved.

Link: https://lore.kernel.org/r/20200908081516.8561-5-dwagner@suse.de
Reviewed-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: qla2xxx: Log calling function name in qla2x00_get_sp_from_handle()
Daniel Wagner [Tue, 8 Sep 2020 08:15:15 +0000 (10:15 +0200)]
scsi: qla2xxx: Log calling function name in qla2x00_get_sp_from_handle()

Commit 7c3df1320e5e ("[SCSI] qla2xxx: Code changes to support new dynamic
logging infrastructure.") removed the use of the func argument. Let's add
it back.

Link: https://lore.kernel.org/r/20200908081516.8561-4-dwagner@suse.de
Reviewed-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: qla2xxx: Simplify return value logic in qla2x00_get_sp_from_handle()
Daniel Wagner [Tue, 8 Sep 2020 08:15:14 +0000 (10:15 +0200)]
scsi: qla2xxx: Simplify return value logic in qla2x00_get_sp_from_handle()

Refactor qla2x00_get_sp_from_handle() to avoid the unnecessary goto if
early returns are used. With this we can also avoid preinitialzing the sp
pointer.

Link: https://lore.kernel.org/r/20200908081516.8561-3-dwagner@suse.de
Reviewed-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: qla2xxx: Warn if done() or free() are called on an already freed srb
Daniel Wagner [Tue, 8 Sep 2020 08:15:13 +0000 (10:15 +0200)]
scsi: qla2xxx: Warn if done() or free() are called on an already freed srb

Emit a warning when ->done or ->free are called on an already freed
srb. There is a hidden use-after-free bug in the driver which corrupts
the srb memory pool which originates from the cleanup callbacks.

An extensive search didn't bring any lights on the real problem. The
initial fix was to set both pointers to NULL and try to catch invalid
accesses. But instead the memory corruption was gone and the driver
didn't crash. Since not all calling places check for NULL pointer, add
explicitly default handlers. With this we workaround the memory
corruption and add a debug help.

Link: https://lore.kernel.org/r/20200908081516.8561-2-dwagner@suse.de
Reviewed-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: libsas: Fix error path in sas_notify_lldd_dev_found()
Dan Carpenter [Sat, 5 Sep 2020 12:58:36 +0000 (15:58 +0300)]
scsi: libsas: Fix error path in sas_notify_lldd_dev_found()

In sas_notify_lldd_dev_found(), if we can't allocate the necessary
resources, then it seems like the wrong thing to mark the device as found
and to increment the reference count.  None of the callers ever drop the
reference in that situation.

[mkp: tweaked commit desc based on feedback from John]

Link: https://lore.kernel.org/r/20200905125836.GF183976@mwanda
Fixes: 735f7d2fedf5 ("[SCSI] libsas: fix domain_device leak")
Reviewed-by: Jason Yan <yanaijie@huawei.com>
Acked-by: John Garry <john.garry@huawei.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: qedf: Retry qed->probe during recovery
Saurav Kashyap [Mon, 7 Sep 2020 12:14:42 +0000 (05:14 -0700)]
scsi: qedf: Retry qed->probe during recovery

During recovery due to FCoE fn ramrod failure we wait for 2 sec and then
call qed->probe. If probe fails then retry max 10 times.

Link: https://lore.kernel.org/r/20200907121443.5150-8-jhasan@marvell.com
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Javed Hasan <jhasan@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: qedf: Add schedule_hw_err_handler callback for fan failure
Saurav Kashyap [Mon, 7 Sep 2020 12:14:41 +0000 (05:14 -0700)]
scsi: qedf: Add schedule_hw_err_handler callback for fan failure

On fan failure, disable the PCI function and initiate recovery for ramrod
failure.

Link: https://lore.kernel.org/r/20200907121443.5150-7-jhasan@marvell.com
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Javed Hasan <jhasan@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: qedf: Return SUCCESS if stale rport is encountered
Saurav Kashyap [Mon, 7 Sep 2020 12:14:40 +0000 (05:14 -0700)]
scsi: qedf: Return SUCCESS if stale rport is encountered

If SUCCESS is not returned, error handling will escalate. Return SUCCESS
similar to other conditions in this function.

Link: https://lore.kernel.org/r/20200907121443.5150-6-jhasan@marvell.com
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Javed Hasan <jhasan@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: qedf: FDMI attributes correction
Javed Hasan [Mon, 7 Sep 2020 12:14:39 +0000 (05:14 -0700)]
scsi: qedf: FDMI attributes correction

Correction in the FDMI attributes required for RHBA and RPA registration.

Link: https://lore.kernel.org/r/20200907121443.5150-5-jhasan@marvell.com
Signed-off-by: Javed Hasan <jhasan@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: qedf: Fix for the session’s E_D_TOV value
Javed Hasan [Mon, 7 Sep 2020 12:14:38 +0000 (05:14 -0700)]
scsi: qedf: Fix for the session’s E_D_TOV value

Firmware expects E_D_TOV field in connection offload parameters as “msec”.
Earlier incorrect value (100ms), was leading to abort from driver in the
case when data frames for read take more than 100ms from target side,
resulting in firmware reporting E_D_TOV expiration.

Link: https://lore.kernel.org/r/20200907121443.5150-4-jhasan@marvell.com
Signed-off-by: Javed Hasan <jhasan@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: qedf: Correct the comment in qedf_initiate_els
Saurav Kashyap [Mon, 7 Sep 2020 12:14:37 +0000 (05:14 -0700)]
scsi: qedf: Correct the comment in qedf_initiate_els

Correct the misleading comment in qedf_initiate_els().

Link: https://lore.kernel.org/r/20200907121443.5150-3-jhasan@marvell.com
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Javed Hasan <jhasan@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: qedf: Change the debug parameter permission to read & write
Javed Hasan [Mon, 7 Sep 2020 12:14:36 +0000 (05:14 -0700)]
scsi: qedf: Change the debug parameter permission to read & write

Change the debug parameter permission to read & write.  Gives flexibility
to change the debug verbosity dynamically.

Link: https://lore.kernel.org/r/20200907121443.5150-2-jhasan@marvell.com
Signed-off-by: Javed Hasan <jhasan@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ufs: ufs-mediatek: Add host reset mechanism
Stanley Chu [Tue, 8 Sep 2020 06:45:07 +0000 (14:45 +0800)]
scsi: ufs: ufs-mediatek: Add host reset mechanism

Add host reset mechanism to try to recover host-side errors during recovery
flow.

Link: https://lore.kernel.org/r/20200908064507.30774-5-stanley.chu@mediatek.com
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ufs: ufs-mediatek: Fix flag of unipro low-power mode
Stanley Chu [Tue, 8 Sep 2020 06:45:06 +0000 (14:45 +0800)]
scsi: ufs: ufs-mediatek: Fix flag of unipro low-power mode

Forcibly leave UniPro low-power mode if UIC commands failed.  This makes
hba_enable_delay_us as correct (default) value for re-enabling the host.

At the same time, change type of parameter "lpm" in function
ufs_mtk_unipro_set_pm() to "bool".

Link: https://lore.kernel.org/r/20200908064507.30774-4-stanley.chu@mediatek.com
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ufs: ufs-mediatek: Fix HOST_PA_TACTIVATE quirk
Stanley Chu [Tue, 8 Sep 2020 06:45:05 +0000 (14:45 +0800)]
scsi: ufs: ufs-mediatek: Fix HOST_PA_TACTIVATE quirk

Simply add HOST_PA_TACTIVATE quirk back since it was incorrectly removed
before.

Link: https://lore.kernel.org/r/20200908064507.30774-3-stanley.chu@mediatek.com
Fixes: 47d054580a75 ("scsi: ufs-mediatek: fix HOST_PA_TACTIVATE quirk for Samsung UFS Devices")
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ufs: ufs-mediatek: Eliminate error message for unbound mphy
Stanley Chu [Tue, 8 Sep 2020 06:45:04 +0000 (14:45 +0800)]
scsi: ufs: ufs-mediatek: Eliminate error message for unbound mphy

Some MediaTek platforms does not have to bind MPHY so users shall not see
any unnecessary logs. Simply remove logs for this case.

Link: https://lore.kernel.org/r/20200908064507.30774-2-stanley.chu@mediatek.com
Fixes: fc4983018fea ("scsi: ufs-mediatek: Allow unbound mphy")
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: qedi: Add support for handling PCIe errors
Manish Rangankar [Tue, 8 Sep 2020 09:56:57 +0000 (02:56 -0700)]
scsi: qedi: Add support for handling PCIe errors

The error recovery is handled by management firmware (MFW) with the help of
qed/qedi drivers. Upon detecting errors, driver informs MFW about this
event which in turn starts a recovery process. MFW sends ERROR_RECOVERY
notification to the driver which performs the required cleanup/recovery
from the driver side.

Link: https://lore.kernel.org/r/20200908095657.26821-9-mrangankar@marvell.com
Signed-off-by: Manish Rangankar <mrangankar@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: qedi: Add firmware error recovery invocation support
Manish Rangankar [Tue, 8 Sep 2020 09:56:56 +0000 (02:56 -0700)]
scsi: qedi: Add firmware error recovery invocation support

Add support to initiate MFW process recovery for all the devices if storage
function receives the event first.

Also added fix for kernel test robot warning,

>> drivers/scsi/qedi/qedi_main.c:1119:6: warning: no previous prototype
>> for 'qedi_schedule_hw_err_handler' [-Wmissing-prototypes]

Link: https://lore.kernel.org/r/20200908095657.26821-8-mrangankar@marvell.com
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Manish Rangankar <mrangankar@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: qedi: Mark all connections for recovery on link down event
Nilesh Javali [Tue, 8 Sep 2020 09:56:55 +0000 (02:56 -0700)]
scsi: qedi: Mark all connections for recovery on link down event

For short time cable pulls, the in-flight I/O to the firmware is never
cleaned up, resulting in the behaviour of stale I/O completion causing
list_del corruption and soft lockup of the system.

On link down event, mark all the connections for recovery, causing cleanup
of all the in-flight I/O immediately.

Link: https://lore.kernel.org/r/20200908095657.26821-7-mrangankar@marvell.com
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Manish Rangankar <mrangankar@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: qedi: Use snprintf instead of sprintf
Manish Rangankar [Tue, 8 Sep 2020 09:56:54 +0000 (02:56 -0700)]
scsi: qedi: Use snprintf instead of sprintf

Use snprintf to limit max number of bytes to the buffer.

Link: https://lore.kernel.org/r/20200908095657.26821-6-mrangankar@marvell.com
Signed-off-by: Manish Rangankar <mrangankar@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: qedi: Protect active command list to avoid list corruption
Nilesh Javali [Tue, 8 Sep 2020 09:56:53 +0000 (02:56 -0700)]
scsi: qedi: Protect active command list to avoid list corruption

Protect active command list for non-I/O commands like login response,
logout response, text response, and recovery cleanup of active list to
avoid list corruption.

Link: https://lore.kernel.org/r/20200908095657.26821-5-mrangankar@marvell.com
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Manish Rangankar <mrangankar@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: qedi: Fix list_del corruption while removing active I/O
Nilesh Javali [Tue, 8 Sep 2020 09:56:52 +0000 (02:56 -0700)]
scsi: qedi: Fix list_del corruption while removing active I/O

While aborting the I/O, the firmware cleanup task timed out and driver
deleted the I/O from active command list. Some time later the firmware
sent the cleanup task response and driver again deleted the I/O from
active command list causing firmware to send completion for non-existent
I/O and list_del corruption of active command list.

Add fix to check if I/O is present before deleting it from the active
command list to ensure firmware sends valid I/O completion and protect
against list_del corruption.

Link: https://lore.kernel.org/r/20200908095657.26821-4-mrangankar@marvell.com
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Manish Rangankar <mrangankar@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: qedi: Skip firmware connection termination for PCI shutdown handler
Manish Rangankar [Tue, 8 Sep 2020 09:56:51 +0000 (02:56 -0700)]
scsi: qedi: Skip firmware connection termination for PCI shutdown handler

In boot from SAN scenario when qedi PCI shutdown handler is called with
active iSCSI sessions, sometimes target takes too long time to respond to
firmware connection termination request.  Instead skip sending termination
ramrod and progress with unload path.

Link: https://lore.kernel.org/r/20200908095657.26821-3-mrangankar@marvell.com
Signed-off-by: Manish Rangankar <mrangankar@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: qedi: Use qed count from set_fp_int in msix allocation
Manish Rangankar [Tue, 8 Sep 2020 09:56:50 +0000 (02:56 -0700)]
scsi: qedi: Use qed count from set_fp_int in msix allocation

To avoid unnecessary vector allocation when the number of fast-path queues
is less then available msix vectors, use return count from module
qed->set_fp_int.

Link: https://lore.kernel.org/r/20200908095657.26821-2-mrangankar@marvell.com
Signed-off-by: Manish Rangankar <mrangankar@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: docs: Remove obsolete scsi typedef text from scsi_mid_low_api
Nícolas F. R. A. Prado [Sat, 5 Sep 2020 21:03:00 +0000 (21:03 +0000)]
scsi: docs: Remove obsolete scsi typedef text from scsi_mid_low_api

Commit 91ebc1facd77 ("scsi: core: remove Scsi_Cmnd typedef") removed the
Scsi_cmnd typedef but it was still mentioned in a paragraph in the "SCSI
mid_level - lower_level driver interface" documentation page.  Remove this
obsolete paragraph.

Link: https://lore.kernel.org/r/20200905210211.2286172-1-nfraprado@protonmail.com
Suggested-by: Randy Dunlap <rdunlap@infradead.org>
Suggested-by: Jonathan Corbet <corbet@lwn.net>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@protonmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ibmvfc: Interface updates for future FPIN and MQ support
Tyrel Datwyler [Fri, 4 Sep 2020 23:29:36 +0000 (18:29 -0500)]
scsi: ibmvfc: Interface updates for future FPIN and MQ support

VIOS partitions with SLI-4 enabled Emulex adapters will be capable of
driving I/O in parallel through mulitple work queues or channels, and with
new hypervisor firmware that supports multiple interrupt sources an ibmvfc
NPIV single initiator can be modified to exploit end-to-end channelization
in a PowerVM environment.

VIOS hosts will also be able to expose fabric perfromance impact
notifications (FPIN) via a new asynchronous event to ibmvfc clients that
advertise support via IBMVFC_CAN_HANDLE_FPIN in their capabilities flag
during NPIV_LOGIN.

This patch introduces three new Management Datagrams (MADs) for
channelization support negotiation as well as the FPIN asynchronous
event and FPIN status flags. Follow up work is required to plumb the
ibmvfc client driver to use these new interfaces.

Link: https://lore.kernel.org/r/20200904232936.840193-2-tyreld@linux.ibm.com
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ibmvfc: Use compiler attribute defines instead of __attribute__()
Tyrel Datwyler [Fri, 4 Sep 2020 23:29:35 +0000 (18:29 -0500)]
scsi: ibmvfc: Use compiler attribute defines instead of __attribute__()

Update ibmvfc.h structs to use the preferred __packed and __aligned()
attribute macros defined in include/linux/compiler_attributes.h in place of
__attribute__().

Link: https://lore.kernel.org/r/20200904232936.840193-1-tyreld@linux.ibm.com
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ufshcd: Allow specifying an Auto-Hibernate Timer value of zero
Bao D. Nguyen [Sat, 29 Aug 2020 01:05:13 +0000 (18:05 -0700)]
scsi: ufshcd: Allow specifying an Auto-Hibernate Timer value of zero

Setting the Auto-Hibernate Timer to zero is a valid setting which indicates
the Auto-Hibernate feature being disabled. Correctly support this setting.

In addition, when the timer value is queried from sysfs, read from the host
controller's register and return that value instead of using the RAM value.

Link: https://lore.kernel.org/r/b141cfcd7998b8933635828b56fbb64f8ad4d175.1598661071.git.nguyenb@codeaurora.org
Acked-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Bao D. Nguyen <nguyenb@codeaurora.org>
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: scsi_debug: Make sdebug_build_parts() respect virtual_gb
John Pittman [Wed, 2 Sep 2020 21:14:34 +0000 (17:14 -0400)]
scsi: scsi_debug: Make sdebug_build_parts() respect virtual_gb

If virtual_gb is passed while using num_parts, when creating the
partitions, virtual_gb is not respected.  Set num_sectors using
get_sdebug_capacity() to pull virtual_gb if set.

Link: https://lore.kernel.org/r/20200902211434.9979-3-jpittman@redhat.com
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: John Pittman <jpittman@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: scsi_debug: Adjust num_parts to create equally sized partitions
John Pittman [Wed, 2 Sep 2020 21:14:33 +0000 (17:14 -0400)]
scsi: scsi_debug: Adjust num_parts to create equally sized partitions

Currently when using the num_parts parameter, partitions are aligned and
the end sector is one prior to the next start.  This creates different
sized partitions. Create instead equally sized partitions by trimming the
end of each partition to the size of the smallest partition.  This aligns
better with what one would expect from automatically created partitions and
can be helpful with testing things such as raid which often expect legs of
the same size.  Minimal space is lost as the initial partition starting
size is calculated by dividing num_sectors by sdebug_num_parts.

Link: https://lore.kernel.org/r/20200902211434.9979-2-jpittman@redhat.com
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: John Pittman <jpittman@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: MAINTAINERS: Update Marvell owned driver maintainers
Nilesh Javali [Wed, 2 Sep 2020 07:34:30 +0000 (00:34 -0700)]
scsi: MAINTAINERS: Update Marvell owned driver maintainers

Update Marvell owned driver maintainers and add Marvell Upstream email
alias to the maintainers list.

Link: https://lore.kernel.org/r/20200902073430.11787-1-njavali@marvell.com
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: hisi_sas: Code style cleanup
Luo Jiaxing [Tue, 1 Sep 2020 11:13:10 +0000 (19:13 +0800)]
scsi: hisi_sas: Code style cleanup

Remove extra blank lines and add spaces around operators.

Link: https://lore.kernel.org/r/1598958790-232272-9-git-send-email-john.garry@huawei.com
Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: hisi_sas: Add missing newlines
Xiang Chen [Tue, 1 Sep 2020 11:13:09 +0000 (19:13 +0800)]
scsi: hisi_sas: Add missing newlines

Newline is missing from some printk() statements. Add them.

Link: https://lore.kernel.org/r/1598958790-232272-8-git-send-email-john.garry@huawei.com
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: hisi_sas: Add BIST support for fixed code pattern
Luo Jiaxing [Tue, 1 Sep 2020 11:13:08 +0000 (19:13 +0800)]
scsi: hisi_sas: Add BIST support for fixed code pattern

Through the new debugfs interface the user can select fixed code
patterns. Add two new interfaces fixed_code and fixed_code1.

Link: https://lore.kernel.org/r/1598958790-232272-7-git-send-email-john.garry@huawei.com
Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: hisi_sas: Add BIST support for phy FFE
Luo Jiaxing [Tue, 1 Sep 2020 11:13:07 +0000 (19:13 +0800)]
scsi: hisi_sas: Add BIST support for phy FFE

Add BIST support for phy FFE (Feed forward equalizer) setting. The user can
configure FFE through the new debugfs interface.

FFE is a parameter used for link layer control. It will affect the link
quality between the SAS controller and the backplane. In the BIST test, the
FFE interface is provided to assist board testers in optimizing link
parameters.

The modification of the FFE parameter will affect the test after BIST or
the normal running of the board. The user should save the initial FFE
values and restore them after BIST test is complete.

Link: https://lore.kernel.org/r/1598958790-232272-6-git-send-email-john.garry@huawei.com
Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: hisi_sas: Make phy index variable name consistent
Luo Jiaxing [Tue, 1 Sep 2020 11:13:06 +0000 (19:13 +0800)]
scsi: hisi_sas: Make phy index variable name consistent

We use "phy_id" to identify phy in the BIST code but the rest of code
always uses "phy_no". Change it for consistency.

Link: https://lore.kernel.org/r/1598958790-232272-5-git-send-email-john.garry@huawei.com
Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: hisi_sas: Do not modify upper fields of PROG_PHY_LINK_RATE reg
Luo Jiaxing [Tue, 1 Sep 2020 11:13:05 +0000 (19:13 +0800)]
scsi: hisi_sas: Do not modify upper fields of PROG_PHY_LINK_RATE reg

When updating PROG_PHY_LINK_RATE to set linkrate for a phy we used a
hard-coded initial value instead of getting the current value from the
register. The assumption was that this register would not be modified, but
in fact it was partially modified in a new version of hardware. The
hard-coded value we used changed the default value of the register to a an
incorrect setting and as a result the SAS controller could not change
linkrate for the phy.

Delete hard-coded value and always read the latest value of register before
updating it.

Link: https://lore.kernel.org/r/1598958790-232272-4-git-send-email-john.garry@huawei.com
Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: hisi_sas: Modify macro name for OOB phy linkrate
Luo Jiaxing [Tue, 1 Sep 2020 11:13:04 +0000 (19:13 +0800)]
scsi: hisi_sas: Modify macro name for OOB phy linkrate

The macro for OOB phy linkrate is named CFG_PROG_PHY_LINK_RATE_* but that
is inaccurate. For clarification, include OOB in macro name.

Link: https://lore.kernel.org/r/1598958790-232272-3-git-send-email-john.garry@huawei.com
Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: hisi_sas: Avoid accessing to SSP task for SMP I/Os
Xiang Chen [Tue, 1 Sep 2020 11:13:03 +0000 (19:13 +0800)]
scsi: hisi_sas: Avoid accessing to SSP task for SMP I/Os

hisi_sas_slot_task_free() attempts to dereference SSP task for non-ATA
tasks. If the task is SMP, the code may reference the wrong structure
although this may not cause any problems.

To avoid this, only access to SSP task when slot->n_elem_dif is not 0 which
indicates this is an SSP task.

Link: https://lore.kernel.org/r/1598958790-232272-2-git-send-email-john.garry@huawei.com
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: fc: Add 256GBit speed setting to SCSI FC transport
James Smart [Mon, 31 Aug 2020 21:35:18 +0000 (14:35 -0700)]
scsi: fc: Add 256GBit speed setting to SCSI FC transport

Add 256GBit speed setting to the SCSI FC transport.  This speed can be
reached via FC trunking techniques.

Link: https://lore.kernel.org/r/20200831213518.48409-1-james.smart@broadcom.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: fnic: Remove set but not used 'eth_hdrs_stripped'
Jason Yan [Mon, 31 Aug 2020 08:11:26 +0000 (16:11 +0800)]
scsi: fnic: Remove set but not used 'eth_hdrs_stripped'

This addresses the following gcc warning with "make W=1":

drivers/scsi/fnic/fnic_fcs.c: In function ‘fnic_rq_cmpl_frame_recv’:
drivers/scsi/fnic/fnic_fcs.c:840:15: warning: variable
‘eth_hdrs_stripped’ set but not used [-Wunused-but-set-variable]
  840 |  unsigned int eth_hdrs_stripped;
      |               ^~~~~~~~~~~~~~~~~

Link: https://lore.kernel.org/r/20200831081126.3251288-5-yanaijie@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: fnic: Remove set but not used 'fr_len'
Jason Yan [Mon, 31 Aug 2020 08:11:25 +0000 (16:11 +0800)]
scsi: fnic: Remove set but not used 'fr_len'

This addresses the following gcc warning with "make W=1":

drivers/scsi/fnic/fnic_fcs.c: In function ‘fnic_fcoe_send_vlan_req’:
drivers/scsi/fnic/fnic_fcs.c:379:6: warning: variable ‘fr_len’ set but
not used [-Wunused-but-set-variable]
  379 |  int fr_len;
      |      ^~~~~~

Link: https://lore.kernel.org/r/20200831081126.3251288-4-yanaijie@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: fnic: Remove set but not used variable in is_fnic_fip_flogi_reject()
Jason Yan [Mon, 31 Aug 2020 08:11:24 +0000 (16:11 +0800)]
scsi: fnic: Remove set but not used variable in is_fnic_fip_flogi_reject()

This addresses the following gcc warning with "make W=1":

drivers/scsi/fnic/fnic_fcs.c: In function ‘is_fnic_fip_flogi_reject’:
drivers/scsi/fnic/fnic_fcs.c:317:9: warning: variable ‘els_len’ set but
not used [-Wunused-but-set-variable]
  317 |  size_t els_len = 0;
      |         ^~~~~~~
drivers/scsi/fnic/fnic_fcs.c:312:21: warning: variable ‘els_dtype’ set
but not used [-Wunused-but-set-variable]
  312 |  enum fip_desc_type els_dtype = 0;
      |                     ^~~~~~~~~

Link: https://lore.kernel.org/r/20200831081126.3251288-3-yanaijie@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: fnic: Remove set but not used 'old_vlan'
Jason Yan [Mon, 31 Aug 2020 08:11:23 +0000 (16:11 +0800)]
scsi: fnic: Remove set but not used 'old_vlan'

This addresses the following gcc warning with "make W=1":

drivers/scsi/fnic/fnic_main.c: In function ‘fnic_set_vlan’:
drivers/scsi/fnic/fnic_main.c:555:6: warning: variable ‘old_vlan’ set
but not used [-Wunused-but-set-variable]
  555 |  u16 old_vlan;
      |      ^~~~~~~~

Link: https://lore.kernel.org/r/20200831081126.3251288-2-yanaijie@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: fdomain_isa: Merge branches in fdomain_isa_match()
Sergey Shtylyov [Sat, 29 Aug 2020 20:19:42 +0000 (23:19 +0300)]
scsi: fdomain_isa: Merge branches in fdomain_isa_match()

The *else* branch of the *if* (base) statement in fdomain_isa_match() is
immediately followed by the *if* (!base) statement. Simplify the code by
removing the unneeded *if*.

Link: https://lore.kernel.org/r/df68e341-5113-4cf2-b64c-dc1ad0b686ac@omprussia.ru
Signed-off-by: Sergey Shtylyov <s.shtylyov@omprussia.ru>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: qla2xxx: Fix the return value
Xianting Tian [Sat, 29 Aug 2020 07:57:46 +0000 (15:57 +0800)]
scsi: qla2xxx: Fix the return value

A negative error code should be returned.

Link: https://lore.kernel.org/r/20200829075746.19166-1-tian.xianting@h3c.com
Acked-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Xianting Tian <tian.xianting@h3c.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: arm: Avoid comma separated statements
Joe Perches [Tue, 25 Aug 2020 04:56:17 +0000 (21:56 -0700)]
scsi: arm: Avoid comma separated statements

Use semicolons and braces.

Link: https://lore.kernel.org/r/be30bb0f24a5fb4f70ca8ed7027ca7555816a3fb.1598331149.git.joe@perches.com
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ufs: Handle LINERESET indication in err handler
Can Guo [Tue, 25 Aug 2020 02:07:06 +0000 (19:07 -0700)]
scsi: ufs: Handle LINERESET indication in err handler

PA Layer issues a LINERESET to the PHY at the recovery step in the Power
Mode change operation. If it happens during auto or manual hibern8 enter,
even if hibern8 enter succeeds, UFS power mode shall be set to PWM-G1 mode
and kept in that mode after exit from hibern8, leading to bad performance.
Handle the LINERESET in the eh_work by restoring power mode to HS mode
after all pending reqs and tasks are cleared from doorbell.

Link: https://lore.kernel.org/r/1598321228-21093-3-git-send-email-cang@codeaurora.org
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ufs: Abort tasks before clearing them from doorbell
Can Guo [Tue, 25 Aug 2020 02:07:05 +0000 (19:07 -0700)]
scsi: ufs: Abort tasks before clearing them from doorbell

To recover non-fatal errors, no full reset is required, err_handler only
clears those pending TRs/TMRs so that SCSI layer can re-issue them. In
current err_handler, TRs are directly cleared from UFS host's doorbell but
not aborted from device side. However, according to the UFSHCI JEDEC spec,
the host software shall use UTP Transfer Request List Clear Register to
clear a task from UFS host's doorbell only when a UTP Transfer Request is
expected to not be completed, e.g. when the host software receives a
“FUNCTION COMPLETE” Task Management response which means a Transfer Request
was aborted. To follow the UFSHCI JEDEC spec, in err_handler, abort one TR
before clearing it from doorbell.

Link: https://lore.kernel.org/r/1598321228-21093-2-git-send-email-cang@codeaurora.org
Acked-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: smartpqi: Update copyright
Don Brace [Fri, 28 Aug 2020 21:09:22 +0000 (16:09 -0500)]
scsi: smartpqi: Update copyright

Update driver copyright.

Link: https://lore.kernel.org/r/159864896224.13630.9798419111015060967.stgit@brunhilda
Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: smartpqi: Update documentation
Don Brace [Fri, 28 Aug 2020 21:09:15 +0000 (16:09 -0500)]
scsi: smartpqi: Update documentation

Change Microsemi references to Microchip.

Link: https://lore.kernel.org/r/159864895592.13630.18113151805817361168.stgit@brunhilda
Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: MAINTAINERS: Update smartpqi and hpsa
Don Brace [Fri, 28 Aug 2020 20:05:08 +0000 (15:05 -0500)]
scsi: MAINTAINERS: Update smartpqi and hpsa

Change M entry e-mail to microchip.

Change L entry e-mail for storagedev to microchip.

Link: https://lore.kernel.org/r/159864510818.12656.822985017436862534.stgit@brunhilda
Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: hpsa: Update copyright
Don Brace [Fri, 28 Aug 2020 19:07:42 +0000 (14:07 -0500)]
scsi: hpsa: Update copyright

Add entry for Microchip.

Link: https://lore.kernel.org/r/159864166227.12131.3427629298809272795.stgit@brunhilda
Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: mpt3sas: Don't call disable_irq from IRQ poll handler
Tomas Henzl [Tue, 1 Sep 2020 14:50:26 +0000 (16:50 +0200)]
scsi: mpt3sas: Don't call disable_irq from IRQ poll handler

disable_irq() might sleep, replace it with disable_irq_nosync(). For
synchronisation 'irq_poll_scheduled' is sufficient

Fixes: 320e77acb3 scsi: mpt3sas: Irq poll to avoid CPU hard lockups
Link: https://lore.kernel.org/r/20200901145026.12174-1-thenzl@redhat.com
Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: megaraid_sas: Don't call disable_irq from process IRQ poll
Tomas Henzl [Thu, 27 Aug 2020 16:53:32 +0000 (18:53 +0200)]
scsi: megaraid_sas: Don't call disable_irq from process IRQ poll

disable_irq() might sleep. Replace it with disable_irq_nosync() which is
sufficient as irq_poll_scheduled protects against concurrently running
complete_cmd_fusion() from megasas_irqpoll() and megasas_isr_fusion().

Link: https://lore.kernel.org/r/20200827165332.8432-1-thenzl@redhat.com
Fixes: a6ffd5bf681 scsi: megaraid_sas: Call disable_irq from process IRQ poll
Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: target: iscsi: Fix hang in iscsit_access_np() when getting tpg->np_login_sem
Hou Pu [Wed, 29 Jul 2020 13:03:43 +0000 (09:03 -0400)]
scsi: target: iscsi: Fix hang in iscsit_access_np() when getting tpg->np_login_sem

The iSCSI target login thread might get stuck with the following stack:

cat /proc/`pidof iscsi_np`/stack
[<0>] down_interruptible+0x42/0x50
[<0>] iscsit_access_np+0xe3/0x167
[<0>] iscsi_target_locate_portal+0x695/0x8ac
[<0>] __iscsi_target_login_thread+0x855/0xb82
[<0>] iscsi_target_login_thread+0x2f/0x5a
[<0>] kthread+0xfa/0x130
[<0>] ret_from_fork+0x1f/0x30

This can be reproduced via the following steps:

1. Initiator A tries to log in to iqn1-tpg1 on port 3260. After finishing
   PDU exchange in the login thread and before the negotiation is finished
   the the network link goes down. At this point A has not finished login
   and tpg->np_login_sem is held.

2. Initiator B tries to log in to iqn2-tpg1 on port 3260. After finishing
   PDU exchange in the login thread the target expects to process remaining
   login PDUs in workqueue context.

3. Initiator A' tries to log in to iqn1-tpg1 on port 3260 from a new
   socket. A' will wait for tpg->np_login_sem with np->np_login_timer
   loaded to wait for at most 15 seconds. The lock is held by A so A'
   eventually times out.

4. Before A' got timeout initiator B gets negotiation failed and calls
   iscsi_target_login_drop()->iscsi_target_login_sess_out().  The
   np->np_login_timer is canceled and initiator A' will hang forever.
   Because A' is now in the login thread, no new login requests can be
   serviced.

Fix this by moving iscsi_stop_login_thread_timer() out of
iscsi_target_login_sess_out(). Also remove iscsi_np parameter from
iscsi_target_login_sess_out().

Link: https://lore.kernel.org/r/20200729130343.24976-1-houpu@bytedance.com
Cc: stable@vger.kernel.org
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Hou Pu <houpu@bytedance.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: mptscsih: Remove set but not used 'timeleft'
Jason Yan [Thu, 27 Aug 2020 12:59:25 +0000 (20:59 +0800)]
scsi: mptscsih: Remove set but not used 'timeleft'

This addresses the following gcc warning with "make W=1":

drivers/message/fusion/mptscsih.c: In function ‘mptscsih_IssueTaskMgmt’:
drivers/message/fusion/mptscsih.c:1519:17: warning: variable ‘timeleft’
set but not used [-Wunused-but-set-variable]
 1519 |  unsigned long  timeleft;
      |                 ^~~~~~~~

Link: https://lore.kernel.org/r/20200827125925.428357-1-yanaijie@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: isci: Remove set but not used 'index'
Jason Yan [Thu, 27 Aug 2020 12:58:51 +0000 (20:58 +0800)]
scsi: isci: Remove set but not used 'index'

This addresses the following gcc warning with "make W=1":

drivers/scsi/isci/host.c: In function ‘sci_controller_complete_io’:
drivers/scsi/isci/host.c:2674:6: warning: variable ‘index’ set but not
used [-Wunused-but-set-variable]
 2674 |  u16 index;
      |      ^~~~~

Link: https://lore.kernel.org/r/20200827125851.428071-1-yanaijie@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: dpt_i2o: Remove set but not used 'pHba'
Jason Yan [Thu, 27 Aug 2020 12:58:12 +0000 (20:58 +0800)]
scsi: dpt_i2o: Remove set but not used 'pHba'

This addresses the following gcc warning with "make W=1":

drivers/scsi/dpt_i2o.c: In function ‘adpt_slave_configure’:
drivers/scsi/dpt_i2o.c:411:12: warning: variable ‘pHba’ set but not used
[-Wunused-but-set-variable]
  411 |  adpt_hba* pHba;
      |            ^~~~

Link: https://lore.kernel.org/r/20200827125812.427753-1-yanaijie@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: qedi: Remove redundant NULL check
Xu Wang [Thu, 27 Aug 2020 09:26:06 +0000 (09:26 +0000)]
scsi: qedi: Remove redundant NULL check

kfree_skb() handles a NULL skb argument so the additional check is
unnecessary. Remove it.

Link: https://lore.kernel.org/r/20200827092606.32148-1-vulab@iscas.ac.cn
Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ufs: Make ufshcd_print_trs() consider UFSHCD_QUIRK_PRDT_BYTE_GRAN
Eric Biggers [Wed, 26 Aug 2020 02:10:40 +0000 (19:10 -0700)]
scsi: ufs: Make ufshcd_print_trs() consider UFSHCD_QUIRK_PRDT_BYTE_GRAN

Fix ufshcd_print_trs() to consider UFSHCD_QUIRK_PRDT_BYTE_GRAN when using
utp_transfer_req_desc::prd_table_length, so that it doesn't treat the
number of bytes as the number of entries.

Originally from Kiwoong Kim
(https://lkml.kernel.org/r/20200218233115.8185-1-kwmad.kim@samsung.com).

Link: https://lore.kernel.org/r/20200826021040.152148-1-ebiggers@kernel.org
Fixes: 26f968d7de82 ("scsi: ufs: Introduce UFSHCD_QUIRK_PRDT_BYTE_GRAN quirk")
Cc: Alim Akhtar <alim.akhtar@samsung.com>
Cc: Kiwoong Kim <kwmad.kim@samsung.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: aacraid: Remove erroneous fallthrough annotation
Dan Carpenter [Tue, 25 Aug 2020 11:20:03 +0000 (14:20 +0300)]
scsi: aacraid: Remove erroneous fallthrough annotation

This fallthrough annotation is unreachable so we can delete it.

Link: https://lore.kernel.org/r/20200825112003.GD285523@mwanda
Fixes: c4e2fbca374b ("scsi: aacraid: Reworked scsi command submission path")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: scsi_debug: Implement lun_format
Douglas Gilbert [Fri, 21 Aug 2020 04:22:49 +0000 (00:22 -0400)]
scsi: scsi_debug: Implement lun_format

Implement 'flat space LUN addressing', which allows us to raise the max_lun
limitation to 16384. The maximum number of LUNs prior to this patch was
256.

Link: https://lore.kernel.org/r/20200821042249.5097-1-dgilbert@interlog.com
Suggested-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: libsas: Set data_dir as DMA_NONE if libata marks qc as NODATA
Luo Jiaxing [Wed, 26 Aug 2020 07:24:26 +0000 (15:24 +0800)]
scsi: libsas: Set data_dir as DMA_NONE if libata marks qc as NODATA

It was discovered that sdparm will fail when attempting to disable write
cache on a SATA disk connected via libsas.

In the ATA command set the write cache state is controlled through the SET
FEATURES operation. This is roughly corresponds to MODE SELECT in SCSI and
the latter command is what is used in the SCSI-ATA translation layer. A
subtle difference is that a MODE SELECT carries data whereas SET FEATURES
is defined as a non-data command in ATA.

Set the DMA data direction to DMA_NONE if the requested ATA command is
identified as non-data.

[mkp: commit desc]

Fixes: fa1c1e8f1ece ("[SCSI] Add SATA support to libsas")
Link: https://lore.kernel.org/r/1598426666-54544-1-git-send-email-luojiaxing@huawei.com
Reviewed-by: John Garry <john.garry@huawei.com>
Reviewed-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: target: iscsi: Fix data digest calculation
Varun Prakash [Tue, 25 Aug 2020 12:35:10 +0000 (18:05 +0530)]
scsi: target: iscsi: Fix data digest calculation

Current code does not consider 'page_off' in data digest calculation. To
fix this, add a local variable 'first_sg' and set first_sg.offset to
sg->offset + page_off.

Link: https://lore.kernel.org/r/1598358910-3052-1-git-send-email-varun@chelsio.com
Fixes: e48354ce078c ("iscsi-target: Add iSCSI fabric support for target v4.1")
Cc: <stable@vger.kernel.org>
Reviewed-by: Mike Christie <michael.christie@oralce.com>
Signed-off-by: Varun Prakash <varun@chelsio.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ufs: exynos: Enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL
Kiwoong Kim [Tue, 25 Aug 2020 01:43:16 +0000 (10:43 +0900)]
scsi: ufs: exynos: Enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL

For Exynos, flush during hibern8 is sufficient. Manual flush will cause an
increase in power usage.

Link: https://lore.kernel.org/r/ef94af8f273316d50d7f50a0cac9c7be9b9316a1.1598319701.git.kwmad.kim@samsung.com
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ufs: Introduce skipping manual flush for Write Booster
Kiwoong Kim [Tue, 25 Aug 2020 01:43:15 +0000 (10:43 +0900)]
scsi: ufs: Introduce skipping manual flush for Write Booster

We have two knobs to control flush for write booster,
fWriteBoosterBufferFlushDuringHibernate and fWriteBoosterBufferFlushEn.

Some vendors use only fWriteBoosterBufferFlushDuringHibernate because this
can reportedly cover most scenarios. Also, there have been some reports
that flush by fWriteBoosterBufferFlushEn could lead to increased power
consumption thanks to unexpected internal operations. Consequently, we need
a way to enable or disable fWriteBoosterEn operations. Add quirk to bypass
manual flush.

Link: https://lore.kernel.org/r/ffdb0eda30515809f0ad9ee936b26917ee9b4593.1598319701.git.kwmad.kim@samsung.com
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: lpfc: Update lpfc version to 12.8.0.4
James Smart [Fri, 28 Aug 2020 17:53:32 +0000 (10:53 -0700)]
scsi: lpfc: Update lpfc version to 12.8.0.4

Update lpfc version to 12.8.0.4

Link: https://lore.kernel.org/r/20200828175332.130300-5-james.smart@broadcom.com
Co-developed-by: Dick Kennedy <dick.kennedy@broadcom.com>
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>
3 years agoscsi: lpfc: Extend the RDF FPIN Registration descriptor for additional events
James Smart [Fri, 28 Aug 2020 17:53:31 +0000 (10:53 -0700)]
scsi: lpfc: Extend the RDF FPIN Registration descriptor for additional events

Currently the driver registers for Link Integrity events only.

This patch adds registration for the following FPIN types:

 - Delivery Notifications
 - Congestion Notification
 - Peer Congestion Notification

Link: https://lore.kernel.org/r/20200828175332.130300-4-james.smart@broadcom.com
Co-developed-by: Dick Kennedy <dick.kennedy@broadcom.com>
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>
3 years agoscsi: lpfc: Fix FLOGI/PLOGI receive race condition in pt2pt discovery
James Smart [Fri, 28 Aug 2020 17:53:30 +0000 (10:53 -0700)]
scsi: lpfc: Fix FLOGI/PLOGI receive race condition in pt2pt discovery

The driver is unable to successfully login with remote device. During pt2pt
login, the driver completes its FLOGI request with the remote device having
WWN precedence.  The remote device issues its own (delayed) FLOGI after
accepting the driver's and, upon transmitting the FLOGI, immediately
recognizes it has already processed the driver's FLOGI thus it transitions
to sending a PLOGI before waiting for an ACC to its FLOGI.

In the driver, the FLOGI is received and an ACC sent, followed by the PLOGI
being received and an ACC sent. The issue is that the PLOGI reception
occurs before the response from the adapter from the FLOGI ACC is
received. Processing of the PLOGI sets state flags to perform the REG_RPI
mailbox command and proceed with the rest of discovery on the port. The
same completion routine used by both FLOGI and PLOGI is generic in
nature. One of the things it does is clear flags, and those flags happen to
drive the rest of discovery.  So what happened was the PLOGI processing set
the flags, the FLOGI ACC completion cleared them, thus when the PLOGI ACC
completes it doesn't see the flags and stops.

Fix by modifying the generic completion routine to not clear the rest of
discovery flag (NLP_ACC_REGLOGIN) unless the completion is also associated
with performing a mailbox command as part of its handling.  For things such
as FLOGI ACC, there isn't a subsequent action to perform with the adapter,
thus there is no mailbox cmd ptr. PLOGI ACC though will perform REG_RPI
upon completion, thus there is a mailbox cmd ptr.

Link: https://lore.kernel.org/r/20200828175332.130300-3-james.smart@broadcom.com
Co-developed-by: Dick Kennedy <dick.kennedy@broadcom.com>
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>
3 years agoscsi: lpfc: Fix setting IRQ affinity with an empty CPU mask
James Smart [Fri, 28 Aug 2020 17:53:29 +0000 (10:53 -0700)]
scsi: lpfc: Fix setting IRQ affinity with an empty CPU mask

Some systems are reporting the following log message during driver unload
or system shutdown:

  ics_rtas_set_affinity: No online cpus in the mask

A prior commit introduced the writing of an empty affinity mask in calls to
irq_set_affinity_hint() when disabling interrupts or when there are no
remaining online CPUs to service an eq interrupt. At least some ppc64
systems are checking whether affinity masks are empty or not.

Do not call irq_set_affinity_hint() with an empty CPU mask.

Fixes: dcaa21367938 ("scsi: lpfc: Change default IRQ model on AMD architectures")
Link: https://lore.kernel.org/r/20200828175332.130300-2-james.smart@broadcom.com
Cc: <stable@vger.kernel.org> # v5.5+
Co-developed-by: Dick Kennedy <dick.kennedy@broadcom.com>
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>
3 years agoscsi: qla2xxx: Fix regression on sparc64
René Rebe [Thu, 27 Aug 2020 20:27:29 +0000 (22:27 +0200)]
scsi: qla2xxx: Fix regression on sparc64

Commit 98aee70d19a7 ("qla2xxx: Add endianizer to max_payload_size
modifier.") in 2014 broke qla2xxx on sparc64, e.g. as in the Sun Blade 1000
/ 2000. Unbreak by partial revert to fix endianness in nvram firmware
default initialization. Also mark the second frame_payload_size in nvram_t
__le16 to avoid new sparse warnings.

Link: https://lore.kernel.org/r/20200827.222729.1875148247374704975.rene@exactcode.com
Fixes: 98aee70d19a7 ("qla2xxx: Add endianizer to max_payload_size modifier.")
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: René Rebe <rene@exactcode.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: libfc: Fix for double free()
Javed Hasan [Tue, 25 Aug 2020 09:39:40 +0000 (02:39 -0700)]
scsi: libfc: Fix for double free()

Fix for '&fp->skb' double free.

Link:
https://lore.kernel.org/r/20200825093940.19612-1-jhasan@marvell.com
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Javed Hasan <jhasan@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: pm8001: Fix memleak in pm8001_exec_internal_task_abort
Dinghao Liu [Sun, 23 Aug 2020 09:14:53 +0000 (17:14 +0800)]
scsi: pm8001: Fix memleak in pm8001_exec_internal_task_abort

When pm8001_tag_alloc() fails, task should be freed just like it is done in
the subsequent error paths.

Link: https://lore.kernel.org/r/20200823091453.4782-1-dinghao.liu@zju.edu.cn
Acked-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: esas2r: Remove unnecessary casts
Alex Dewar [Thu, 20 Aug 2020 18:14:11 +0000 (19:14 +0100)]
scsi: esas2r: Remove unnecessary casts

In a number of places in esas2r_ioctl.c, the void* returned from
pci_alloc_consistent() is cast unnecessarily. Remove casts.

Issue identified with Coccinelle.

Link: https://lore.kernel.org/r/20200820181411.866057-1-alex.dewar90@gmail.com
Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: csiostor: Fix wrong return value in csio_hw_prep_fw()
Tianjia Zhang [Sun, 2 Aug 2020 11:15:31 +0000 (19:15 +0800)]
scsi: csiostor: Fix wrong return value in csio_hw_prep_fw()

On an error exit path, a negative error code should be returned instead of
a positive return value.

Link: https://lore.kernel.org/r/20200802111531.5065-1-tianjia.zhang@linux.alibaba.com
Fixes: f40e74ffa3de ("csiostor:firmware upgrade fix")
Cc: Praveen Madhavan <praveenm@chelsio.com>
Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: qla2xxx: Fix wrong return value in qla_nvme_register_hba()
Tianjia Zhang [Sun, 2 Aug 2020 11:15:30 +0000 (19:15 +0800)]
scsi: qla2xxx: Fix wrong return value in qla_nvme_register_hba()

On an error exit path, a negative error code should be returned instead of
a positive return value.

Link: https://lore.kernel.org/r/20200802111530.5020-1-tianjia.zhang@linux.alibaba.com
Fixes: 8777e4314d39 ("scsi: qla2xxx: Migrate NVME N2N handling into state machine")
Cc: Quinn Tran <quinn.tran@cavium.com>
Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: qla2xxx: Fix wrong return value in qlt_chk_unresolv_exchg()
Tianjia Zhang [Sun, 2 Aug 2020 11:15:28 +0000 (19:15 +0800)]
scsi: qla2xxx: Fix wrong return value in qlt_chk_unresolv_exchg()

In the case of a failed retry, a positive value EIO is returned here.  I
think this is a typo error. It is necessary to return an error value.

[mkp: caller checks != 0 but the rest of the file uses -Exxx so fix this up
to be consistent]

Link: https://lore.kernel.org/r/20200802111528.4974-1-tianjia.zhang@linux.alibaba.com
Fixes: 0691094ff3f2 ("scsi: qla2xxx: Add logic to detect ABTS hang and response completion")
Cc: Quinn Tran <quinn.tran@cavium.com>
Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>