Commit Graph

8896 Commits

Author SHA1 Message Date
Gleb Chesnokov
70dfb06c40 scst: Fix a checkpatch complaint about whitespace
This patch fixes the following checkpatch warnings:

    WARNING:SPACE_BEFORE_TAB: please, no space before tabs.
2023-04-04 11:47:44 +03:00
Robert Blackhart
9be09fd68b scst/include/backport.h: Fix building on RHEL 8.8
This fixes a compilation issue with RHEL 8.8 in scst/include/backport.h.
This is the same issue as was seen for RHEL 8.7 in #77
2023-04-03 14:15:55 +03:00
Gleb Chesnokov
4e8ec64959 scst_vdisk: Introduce the function vdev_set_t10_dev_id()
This patch reduces code duplication.

This patch does not change any functionality.
2023-03-31 18:54:42 +03:00
Gleb Chesnokov
db581fc016 qla2x00t-32gbit: Synchronize the IOCB count to be in order
A system hang was observed with the following call trace:

BUG: kernel NULL pointer dereference, address: 0000000000000000
PGD 0 P4D 0
Oops: 0000 [#1] PREEMPT SMP NOPTI
CPU: 15 PID: 86747 Comm: nvme Kdump: loaded Not tainted 6.2.0+ #1
Hardware name: Dell Inc. PowerEdge R6515/04F3CJ, BIOS 2.7.3 03/31/2022
RIP: 0010:__wake_up_common+0x55/0x190
Code: 41 f6 01 04 0f 85 b2 00 00 00 48 8b 43 08 4c 8d
      40 e8 48 8d 43 08 48 89 04 24 48 89 c6\
      49 8d 40 18 48 39 c6 0f 84 e9 00 00 00 <49> 8b 40 18 89 6c 24 14 31
      ed 4c 8d 60 e8 41 8b 18 f6 c3 04 75 5d
RSP: 0018:ffffb05a82afbba0 EFLAGS: 00010082
RAX: 0000000000000000 RBX: ffff8f9b83a00018 RCX: 0000000000000000
RDX: 0000000000000001 RSI: ffff8f9b83a00020 RDI: ffff8f9b83a00018
RBP: 0000000000000001 R08: ffffffffffffffe8 R09: ffffb05a82afbbf8
R10: 70735f7472617473 R11: 5f30307832616c71 R12: 0000000000000001
R13: 0000000000000003 R14: 0000000000000000 R15: 0000000000000000
FS:  00007f815cf4c740(0000) GS:ffff8f9eeed80000(0000)
	knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 000000010633a000 CR4: 0000000000350ee0
Call Trace:
    <TASK>
    __wake_up_common_lock+0x83/0xd0
    qla_nvme_ls_req+0x21b/0x2b0 [qla2xxx]
    __nvme_fc_send_ls_req+0x1b5/0x350 [nvme_fc]
    nvme_fc_xmt_disconnect_assoc+0xca/0x110 [nvme_fc]
    nvme_fc_delete_association+0x1bf/0x220 [nvme_fc]
    ? nvme_remove_namespaces+0x9f/0x140 [nvme_core]
    nvme_do_delete_ctrl+0x5b/0xa0 [nvme_core]
    nvme_sysfs_delete+0x5f/0x70 [nvme_core]
    kernfs_fop_write_iter+0x12b/0x1c0
    vfs_write+0x2a3/0x3b0
    ksys_write+0x5f/0xe0
    do_syscall_64+0x5c/0x90
    ? syscall_exit_work+0x103/0x130
    ? syscall_exit_to_user_mode+0x12/0x30
    ? do_syscall_64+0x69/0x90
    ? exit_to_user_mode_loop+0xd0/0x130
    ? exit_to_user_mode_prepare+0xec/0x100
    ? syscall_exit_to_user_mode+0x12/0x30
    ? do_syscall_64+0x69/0x90
    ? syscall_exit_to_user_mode+0x12/0x30
    ? do_syscall_64+0x69/0x90
    entry_SYSCALL_64_after_hwframe+0x72/0xdc
    RIP: 0033:0x7f815cd3eb97

The IOCB counts are out of order and that would block any commands from
going out and subsequently hang the system. Synchronize the IOCB count to
be in correct order.

Fixes: 5f63a163ed2f ("scsi: qla2xxx: Fix exchange oversubscription for management commands")
Cc: stable@vger.kernel.org
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Link: https://lore.kernel.org/r/20230313043711.13500-3-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: John Meneghini <jmeneghi@redhat.com>
Tested-by: Lin Li <lilin@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit d3affdeb400f upstream ]
2023-03-31 18:10:04 +03:00
Gleb Chesnokov
c477c7a4e7 qla2x00t-32gbit: Perform lockless command completion in abort path
While adding and removing the controller, the following call trace was
observed:

WARNING: CPU: 3 PID: 623596 at kernel/dma/mapping.c:532 dma_free_attrs+0x33/0x50
CPU: 3 PID: 623596 Comm: sh Kdump: loaded Not tainted 5.14.0-96.el9.x86_64 #1
RIP: 0010:dma_free_attrs+0x33/0x50

Call Trace:
   qla2x00_async_sns_sp_done+0x107/0x1b0 [qla2xxx]
   qla2x00_abort_srb+0x8e/0x250 [qla2xxx]
   ? ql_dbg+0x70/0x100 [qla2xxx]
   __qla2x00_abort_all_cmds+0x108/0x190 [qla2xxx]
   qla2x00_abort_all_cmds+0x24/0x70 [qla2xxx]
   qla2x00_abort_isp_cleanup+0x305/0x3e0 [qla2xxx]
   qla2x00_remove_one+0x364/0x400 [qla2xxx]
   pci_device_remove+0x36/0xa0
   __device_release_driver+0x17a/0x230
   device_release_driver+0x24/0x30
   pci_stop_bus_device+0x68/0x90
   pci_stop_and_remove_bus_device_locked+0x16/0x30
   remove_store+0x75/0x90
   kernfs_fop_write_iter+0x11c/0x1b0
   new_sync_write+0x11f/0x1b0
   vfs_write+0x1eb/0x280
   ksys_write+0x5f/0xe0
   do_syscall_64+0x5c/0x80
   ? do_user_addr_fault+0x1d8/0x680
   ? do_syscall_64+0x69/0x80
   ? exc_page_fault+0x62/0x140
   ? asm_exc_page_fault+0x8/0x30
   entry_SYSCALL_64_after_hwframe+0x44/0xae

The command was completed in the abort path during driver unload with a
lock held, causing the warning in abort path. Hence complete the command
without any lock held.

Reported-by: Lin Li <lilin@redhat.com>
Tested-by: Lin Li <lilin@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Link: https://lore.kernel.org/r/20230313043711.13500-2-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: John Meneghini <jmeneghi@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 0367076b0817 upstream ]
2023-03-31 18:10:04 +03:00
Brian Meagher
da4f7c6612 scst_vdisk, scstadmin: Allow t10_dev_id to be stored before cluster_mode
Since cluster_mode relies upon the t10_dev_id to generate a namespace, once
cluster_mode is set the t10_dev_id can no longer be changed.

However, because cluster_mode is listed as one of the various add_dev_params,
this meant that it would be set earlier than t10_dev_id when scstadmin
processes scst.conf

Rectify by adding t10_dev_id to fileio_add_dev_params, etc and modifying the
SCST.pm openDevice so that cluster_mode is set last.
2023-03-20 13:05:12 +03:00
Gleb Chesnokov
775d750512 qla2x00t-32gbit: Add option to disable FC2 Target support
Commit 44c57f205876 ("scsi: qla2xxx: Changes to support FCP2 Target") added
support for FC2 Targets. Unfortunately, there are older setups which break
with this new feature enabled.

Allow to disable it via module option.

Link: https://lore.kernel.org/r/20230208152014.109214-1-dwagner@suse.de
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 877b03795fcf upstream ]
2023-03-13 14:58:28 +03:00
Gleb Chesnokov
6fbb8ec634 qla2x00t-32gbit: Remove the unused variable wwn
Variable wwn is not used. Delete it.

drivers/scsi/qla2xxx/qla_init.c:1657:6: warning: variable 'wwn' set but not used.

Link: https://lore.kernel.org/r/20230207052234.24535-1-jiapeng.chong@linux.alibaba.com
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit d48a62381a73 upstream ]
2023-03-13 14:58:28 +03:00
Gleb Chesnokov
62a4d43a56 qla2x00t-32gbit: Simplify if condition evaluation
A logical evaluation of type (!A || A && B) can be simplified as (!A || B).
Improvement by suggested by excluded_middle.cocci Coccinelel semantic
patch.

Link: https://lore.kernel.org/r/Y7+oJuah0MgEW0PQ@ubun2204.myguest.virtualbox.org
Signed-off-by: Deepak R Varma <drv@mailo.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 5a5ef64f28ed upstream ]
2023-03-13 14:58:28 +03:00
Gleb Chesnokov
e5f38e016e qla2x00t-32gbit: Make qla_trim_buf() and __qla_adjust_buf() static
Smatch reports:

drivers/scsi/qla2xxx/qla_mid.c:1189:6: warning: symbol 'qla_trim_buf' was not declared. Should it be static?
drivers/scsi/qla2xxx/qla_mid.c:1221:6: warning: symbol '__qla_adjust_buf' was not declared. Should it be static?

These functions are only used in qla_mid.c, so they should be static.

Fixes: 1f8f9c34127e ("scsi: qla2xxx: edif: Reduce memory usage during low I/O")
Signed-off-by: Tom Rix <trix@redhat.com>
Link: https://lore.kernel.org/r/20230114013724.3943580-1-trix@redhat.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 54c51253b3d5 upstream ]
2023-03-13 14:58:28 +03:00
Gleb Chesnokov
942071e027 qla2x00t-32gbit: Fix printk() format string
Printing a size_t value that is the result of the sizeof() operator
requires using the %z format string modifier to avoid a warning on 32-bit
architectures:

drivers/scsi/qla2xxx/qla_mid.c: In function 'qla_create_buf_pool':
drivers/scsi/qla2xxx/qla_mid.c:1094:51: error: format '%ld' expects argument of type 'long int', but argument 5 has type 'unsigned int' [-Werror=format=]
 1094 |                     "Failed to allocate buf_map(%ld).\n", sz * sizeof(unsigned long));
      |                                                 ~~^       ~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                   |          |
      |                                                   long int   unsigned int
      |                                                 %d

Fixes: 82d8dfd2a238 ("scsi: qla2xxx: edif: Fix performance dip due to lock contention")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Himanshu Madhani <himansnhu.madhani@oracle.com <mailto:himansnhu.madhani@oracle.com>>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Link: https://lore.kernel.org/r/20230117170029.2387516-1-arnd@kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit d794a23113b1 upstream ]
2023-03-13 14:58:28 +03:00
Gleb Chesnokov
feac797794 qla2x00t-32gbit: Update version to 10.02.08.200-k
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit f7d1ba350fb3 upstream ]
2023-03-13 14:58:28 +03:00
Gleb Chesnokov
f3b50fb570 qla2x00t-32gbit: Backport to older kernel versions
Commit ccf2e9c8fab7 ("qla2x00t-32gbit: Select qpair depending on which
CPU post_cmd() gets called") introduced an optimization based on the
pci_irq_get_affinity() API.

Due to support for older kernel versions, limit the minimum kernel
version to use this optimization to v4.9.

See also commit ee8d41e53efe ("pci/msi: Retrieve affinity for a vector") # v4.9.
2023-03-13 14:58:28 +03:00
Gleb Chesnokov
a1ff8c3ae9 qla2x00t-32gbit: Select qpair depending on which CPU post_cmd() gets called
In current I/O path, Tx and Rx may not be processed on same CPU. This may
lead to thrashing and optimum performance may not be achieved.

Pick qpair such that Tx and Rx are processed on same CPU.

Signed-off-by: Shreyas Deodhar <sdeodhar@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 1d201c81d4cc upstream ]
2023-03-13 14:58:28 +03:00
Gleb Chesnokov
f4ebeba7d7 qla2x00t-32gbit: edif: Fix clang warning
clang warning:

  drivers/scsi/qla2xxx/qla_edif_bsg.h:93:12: warning: field remote_pid
  within 'struct app_pinfo_req' is less aligned than 'port_id_t' and is
  usually due to 'struct app_pinfo_req' being packed, which can lead to
  unaligned accesses [-Wunaligned-access]
  port_id_t remote_pid;
	        ^
  2 warnings generated.

Remove u32 field in remote_pid to silence warning.

Reported-by: kernel test robot <lkp@intel.com>
Fixes: 7ebb336e45ef ("scsi: qla2xxx: edif: Add start + stop bsgs")
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 2f5fab1b6c3a upstream ]
2023-03-13 14:58:28 +03:00
Gleb Chesnokov
784ad7e21f qla2x00t-32gbit: edif: Reduce memory usage during low I/O
For edif, each I/O requires a secondary buffer to carry the FCP
cmnd. During high traffic time, these buffers are cached in the qpair. As
traffic dies down, these buffers will be trimmed as needed. If traffic is
reduced to none over 2 consecutive intervals, then these buffers will be
further trimmed.

Free FCP cmnd buffers to reduce memory usage during slow I/O time.

Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 1f8f9c34127e upstream ]
2023-03-13 14:58:28 +03:00
Gleb Chesnokov
a45a827cea qla2x00t-32gbit: edif: Fix stall session after app start
For N2N, qla2x00_wait_for_sess_deletion call flushes
a session which accidentally clear the scan_flag and thus prevents
re-login to occur and causes session to stall.

Use session delete to avoid the accidental clearing of scan_flag.

Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 129a7c40294f upstream ]
2023-03-13 14:58:28 +03:00
Gleb Chesnokov
782cf5e36e qla2x00t-32gbit: edif: Fix performance dip due to lock contention
User experienced performance dip on measuring IOPS while EDIF
enabled. During I/O time, driver uses dma_pool_zalloc() call to allocate a
chunk of memory. This call contains a lock behind the scene which
contribute to lock contention. Save the allocated memory for reuse and
avoid the lock.

Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 82d8dfd2a238 upstream ]
2023-03-13 14:58:28 +03:00
Gleb Chesnokov
b6d1f19437 usr/fileio/common.c: Fix warning for older versions of GCC
Building SCST with an old version of GCC (e.g. 4.8.5 on Centos 7.X)
produces a warning about using initializer.

This is GCC bug # 53119:
  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119

Hence, use memset() instead of an initializer to avoid this warning.

Fixes: e8b300ef2a ("usr/fileio/common.c: Fix use of uninitialized
struct field")
2023-03-12 21:42:52 +03:00
Gleb Chesnokov
06d46171ff nightly build: Update kernel version for Centos 7.9 2023-03-12 16:57:30 +03:00
Gleb Chesnokov
c59f71b4c0 qla2x00t-32gbit: Relocate/rename vp map
There is no functional change in this patch.  VP map resource is renamed
and relocated so it is not viewed as just a target mode resource.

Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 430eef03a763 upstream ]
2023-03-12 13:24:07 +03:00
Gleb Chesnokov
e02b11de54 qla2x00t-32gbit: Remove dead code (GNN ID)
Remove stale/unused code (GNN ID).

Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 87f6dafd50fb upstream ]
2023-03-12 13:24:07 +03:00
Gleb Chesnokov
723a559a60 qla2x00t-32gbit: Remove dead code (GPNID)
Remove stale unused code for GPNID.

Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit b9d87b60aaeb upstream ]
2023-03-12 13:24:07 +03:00
Gleb Chesnokov
818e6d9892 qla2x00t-32gbit: Remove dead code
Removing drport field and FCPORT_UPDATE_NEEDED signals.

Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit efd1bd12a04d upstream ]
2023-03-12 13:24:07 +03:00
Gleb Chesnokov
50541fd2da qla2x00t-32gbit: Update version to 10.02.08.100-k
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit f590c2554c77 upstream ]
2023-03-12 13:24:07 +03:00
Gleb Chesnokov
b0768f5a6a qla2x00t-32gbit: Fix IOCB resource check warning
Make qla_get_iocbs_resource() static to fix the warning:

>> drivers/scsi/qla2xxx/qla_iocb.c:3820:5: warning: no previous prototype for
>> 'qla_get_iocbs_resource' [-Wmissing-prototypes]
    3820 | int qla_get_iocbs_resource(struct srb *sp)
	         |     ^~~~~~~~~~~~~~~~~~~~~~

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 1e27648c8482 upstream ]
2023-03-12 13:24:07 +03:00
Gleb Chesnokov
d4ced1a698 qla2x00t-32gbit: Remove increment of interface err cnt
Residual underrun is not an interface error, hence no need to increment
that count.

Fixes: dbf1f53cfd23 ("scsi: qla2xxx: Implementation to get and manage host, target stats and initiator port")
Cc: stable@vger.kernel.org
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit d676a9e3d9ef upstream ]
2023-03-12 13:24:07 +03:00
Gleb Chesnokov
7576d5e326 qla2x00t-32gbit: Fix erroneous link down
If after an adapter reset the appearance of link is not recovered, the
devices are not rediscovered.  This is result of a race condition between
adapter reset (abort_isp) and the topology scan.  During adapter reset, the
ABORT_ISP_ACTIVE flag is set.  Topology scan usually occurred after adapter
reset.  In this case, the topology scan came earlier than usual where it
ran into problem due to ABORT_ISP_ACTIVE flag was still set.

kernel: qla2xxx [0000:13:00.0]-1005:1: Cmd 0x6a aborted with timeout since ISP Abort is pending
kernel: qla2xxx [0000:13:00.0]-28a0:1: MBX_GET_PORT_NAME failed, No FL Port.
kernel: qla2xxx [0000:13:00.0]-286b:1: qla2x00_configure_loop: exiting normally. local port wwpn 51402ec0123d9a80 id 012300)
kernel: qla2xxx [0000:13:00.0]-8017:1: ADAPTER RESET SUCCEEDED nexus=1:0:15.

Allow adapter reset to complete before any scan can start.

Cc: stable@vger.kernel.org
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 3fbc74feb642 upstream ]
2023-03-12 13:24:07 +03:00
Gleb Chesnokov
0972c1f7cc qla2x00t-32gbit: Remove unintended flag clearing
FCF_ASYNC_SENT flag is used in session management. This flag is cleared in
task management path by accident.  Remove unintended flag clearing.

Fixes: 388a49959ee4 ("scsi: qla2xxx: Fix panic from use after free in qla2x00_async_tm_cmd")
Cc: stable@vger.kernel.org
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 7e8a936a2d0f upstream ]
2023-03-12 13:24:07 +03:00
Gleb Chesnokov
3913eb8f37 qla2x00t-32gbit: Fix stalled login
If a login failed due to low FW resources, the session can stall and will
not be connected. Reset session state to allow relogin logic to redrive
the connection.

Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 40f5b1b9a4af upstream ]
2023-03-12 13:24:07 +03:00
Gleb Chesnokov
d36ec295a0 qla2x00t-32gbit: Fix exchange oversubscription for management commands
Add resource checking for management (non-I/O) commands.

Fixes: 89c72f4245a8 ("scsi: qla2xxx: Add IOCB resource tracking")
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 5f63a163ed2f upstream ]
2023-03-12 13:24:07 +03:00
Gleb Chesnokov
150184a2d7 qla2x00t-32gbit: Fix exchange oversubscription
In large environment, it is possible to experience command timeout and
escalation of path recovery. Currently the driver does not track the number
of exchanges/commands sent to FW. If there is a delay for commands at the
head of the queue, then this will create back pressure for commands at the
back of the queue.

Check for exchange availability before command submission.

Fixes: 89c72f4245a8 ("scsi: qla2xxx: Add IOCB resource tracking")
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 41e5afe51f75 upstream ]
2023-03-12 13:24:07 +03:00
Gleb Chesnokov
edfef84e1f qla2x00t-32gbit: Fix DMA-API call trace on NVMe LS requests
The following message and call trace was seen with debug kernels:

DMA-API: qla2xxx 0000:41:00.0: device driver failed to check map
error [device address=0x00000002a3ff38d8] [size=1024 bytes] [mapped as
single]
WARNING: CPU: 0 PID: 2930 at kernel/dma/debug.c:1017
	 check_unmap+0xf42/0x1990

Call Trace:
	debug_dma_unmap_page+0xc9/0x100
	qla_nvme_ls_unmap+0x141/0x210 [qla2xxx]

Remove DMA mapping from the driver altogether, as it is already done by FC
layer. This prevents the warning.

Fixes: c85ab7d9e27a ("scsi: qla2xxx: Fix missed DMA unmap for NVMe ls requests")
Cc: stable@vger.kernel.org
Signed-off-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit c75e6aef5039 upstream ]
2023-03-12 13:24:07 +03:00
Gleb Chesnokov
61f39b3915 qla2x00t-32gbit: Fix link failure in NPIV environment
User experienced symptoms of adapter failure in NPIV environment. NPIV
hosts were allowed to trigger chip reset back to back due to NPIV link
state being slow to come online.

Fix link failure in NPIV environment by removing NPIV host from directly
being able to perform chip reset.

 kernel: qla2xxx [0000:04:00.1]-6009:261: Loop down - aborting ISP.
 kernel: qla2xxx [0000:04:00.1]-6009:262: Loop down - aborting ISP.
 kernel: qla2xxx [0000:04:00.1]-6009:281: Loop down - aborting ISP.
 kernel: qla2xxx [0000:04:00.1]-6009:285: Loop down - aborting ISP

Fixes: 0d6e61bc6a4f ("[SCSI] qla2xxx: Correct various NPIV issues.")
Cc: stable@vger.kernel.org
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit b1ae65c082f7 upstream ]
2023-03-12 13:24:07 +03:00
Gleb Chesnokov
dabc4a4e78 qla2x00t-32gbit: Check if port is online before sending ELS
CT Ping and ELS cmds fail for NVMe targets.  Check if port is online before
sending ELS instead of sending login.

Cc: stable@vger.kernel.org
Signed-off-by: Shreyas Deodhar <sdeodhar@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 0c227dc22ca1 upstream ]
2023-03-12 13:24:07 +03:00
Brian Meagher
527fed012f scst_vdisk: Add lb_per_pb_exp attribute
Add lb_per_pb_exp attribute to allow control of whether READ CAPACITY 16 returns
non-zero LOGICAL BLOCKS PER PHYSICAL BLOCK EXPONENT.
2023-03-09 12:59:11 +03:00
Gleb Chesnokov
906b1c8368 qla2x00t-32gbit: Port to Linux kernel v6.3
Support for the following fc changes in the Linux kernel v6.3:
- 64fd2ba977b1 ("scsi: scsi_transport_fc: Add an additional flag to fc_host_fpin_rcv()")
2023-03-06 20:30:43 +03:00
Gleb Chesnokov
c9476f104c scst: Port to Linux kernel v6.3
Support for the following scsi core changes in the Linux kernel v6.3:
- d0949565811f ("scsi: core: Add struct for args to execution functions")
2023-03-06 13:35:11 +03:00
Gleb Chesnokov
1cf04b01a5 scst_lib: Port to Linux kernel v6.3
Support for the following fs changes in the Linux kernel v6.3:
- abf08576afe3 ("fs: port vfs_*() helpers to struct mnt_idmap")
2023-03-06 13:35:11 +03:00
Gleb Chesnokov
83ff524b6c nightly build: Update kernel versions 2023-02-21 10:32:41 +03:00
Gleb Chesnokov
8068b10cac scst/include/backport.h: Fix the CentOS / RHEL 7.[012345] builds
See also PR https://github.com/SCST-project/scst/pull/132.
2023-02-19 17:01:38 +03:00
Brian Meagher
00f31004ab scst_sysfs: Add support for cluster_name
When dlm_new_lockspace is called with a NULL cluster_name the
kernel will emit an error message "dlm cluster name '%s' is being
used without an application provided cluster name".

Therefore, provide a mechanism to set a cluster_name and use it
when calling dlm_new_lockspace.
2023-02-14 10:12:15 +03:00
Gleb Chesnokov
250c9cd76a scst: Fix a version string mismatch
Make the SCST_VERSION_STRING macro revision-independent, because it
causes a version string mismatch for SCST-dependent modules where the
revision is not exported.

Fixes: a86e5c55ea ("Makefile, scst: Add revision to SCST version macro")
Fixes: https://github.com/SCST-project/scst/issues/130
2023-02-12 17:44:32 +03:00
Gleb Chesnokov
e76e3261a1 scst_lib: Fix bio_kmalloc usage for RHEL 9.1
See also commit 87340a8427 ("scst_lib: Fix bio_kmalloc usage to match
change in Linux kernel v5.19").
2023-01-30 19:29:36 +03:00
Gleb Chesnokov
a86e5c55ea Makefile, scst: Add revision to SCST version macro
Add SCST revision to SCST_VERSION_STRING macro. This might be useful
for issues reporting/investigation.
2023-01-29 16:31:20 +03:00
Brian Meagher
87340a8427 scst_lib: Fix bio_kmalloc usage to match change in Linux kernel v5.19
In kernel commit 066ff571011d ("block: turn bio_kmalloc into a simple kmalloc
wrapper"), the order of arguments to bio_kmalloc changed, as did its semantics.
2023-01-28 14:52:48 +03:00
Brian Meagher
d401702aba scst_lib: Fix sense data regression for pass-through commands.
In kernel commit 772c8f6f3bbd ("Merge tag 'for-4.11/linus-merge-signed' * of
git://git.kernel.dk/linux-block") both scsi_init_rq and scsi_init_request
(later renamed to scsi_mq_init_request in e7008ff5c61a) initialize the
scsi_request sense buffer, so we don't need to (nor should) provide our own.
2023-01-27 11:48:05 +03:00
Gleb Chesnokov
ae6c0bf914 scst_disk: Fix use of uninitialized variable
This patch fixes the following Coverity complaint:

    CID 307352 (#1 of 1): Uninitialized pointer read (UNINIT)
    uninit_use_in_call: Using uninitialized value arg when calling
    kfree.

Fixes: 7ba5b11f0a ("scst_disk: Add cluster SCSI sync state mode
support to dev_disk")
2023-01-20 10:48:47 +03:00
Brian Meagher
7ba5b11f0a scst_disk: Add cluster SCSI sync state mode support to dev_disk
Extend the cluster mode support that was first introduced in 9d61dc4b to
include dev_disk.  This will facilitate the situation where the underlying
disk is another SCST target.

Add the cluster_mode control to the sysfs subtree for the dev_disk to permit
entering or exiting cluster mode.

In disk_attach issue a INQUIRY (Unit Serial Number VPD) to obtain the serial
number of the underlying disk.  This is used when entering or exiting
cluster mode as the cl_dev_id parameter, which ultimately is used as part of
the DLM lockspace.
2023-01-20 10:12:58 +03:00
Samy Mahmoudi
fbe5316fc7 scst/README: Correct description of 'opt_trans_len'
1. Correct a sentence where 'optimal transfer length' should read 'block size'.
2. Use '4194304' instead of '4 MB' when referring to a value of the parameter.
2023-01-20 10:09:26 +03:00