Annotate members of FC protocol and firmware dump data structures as big
endian. Annotate members of RISC control structures as little endian.
Annotate mailbox registers as little endian. Annotate the mb[] arrays as
CPU-endian because communication of the mb[] values with the hardware
happens through the readw() and writew() functions. readw() converts from
__le16 to u16 and writew() converts from u16 to __le16. Annotate 'handles'
as CPU-endian because for the firmware these are opaque values.
[ commit 21038b0900d1b8728ec77d9286d7b0b57ca7b585 upstream ]
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8973 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Casting a pointer to void * and relying on an implicit cast from void *
to uint16_t or uint32_t suppresses sparse warnings about endianness. Hence
cast explicitly to uint16_t and uint32_t. Additionally, remove superfluous
void * casts.
[ commit ab053c09ee2066a2fe62a755f1e64dbc8eddc17c upstream ]
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8971 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This was suggested by Daniel Wagner.
[ commit 04474d3a1c968119e7214c312b273dee01258cad upstream ]
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8970 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Make the MMIO accessors strongly typed such that the compiler checks
whether the accessor function is used that matches the register width. Fix
those MMIO accesses where another number of bits was read or written than
the size of the register.
[ commit 37139da1b097e06841d40a6055db64c78755aea9 upstream ]
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8968 d57e44dd-8a1f-0410-8b47-8ef2f437770f
The following sequence of commands result in an incorrect failure message
being printed:
echo 0x7fffffff > /sys/module/qla2xxx/parameters/logging
modprobe target_core_mod
modprobe tcm_qla2xxx
mkdir /sys/kernel/config/target/qla2xxx
mkdir /sys/kernel/config/target/qla2xxx/<port-name>
mkdir /sys/kernel/config/target/qla2xxx/<port-name>/tpgt_1
echo 1 > /sys/kernel/config/target/qla2xxx/<port-name>/tpgt_1/enable
echo 0 > /sys/kernel/config/target/qla2xxx/<port-name>/tpgt_1/enable
qla2xxx [0001:00:02.0]-e881:1: qla2x00_wait_for_hba_online() failed
The reason of this message is the QLA_FUNCTION_FAILED code that
qla2x00_wait_for_hba_online() returns. However, qlt_disable_vha() expects
that adapter is offlined and QLA_FUNCTION_FAILED informs about the offline
state of the adapter.
The qla2x00_abort_isp() function finishes the execution at the point of
checking the adapter's mode (for example, qla_tgt_mode_enabled()) because
of the qlt_disable_vha() calls qlt_clear_mode() method. It means that
qla2x00_abort_isp() keeps vha->flags.online is equal to zero. Finally,
qla2x00_wait_for_hba_online() checks the state of this flag and returns
QLA_FUNCTION_FAILED error code.
This patch changes the failure message which informs about adapter's
offline state.
Link: https://lore.kernel.org/r/3cd0bbf3599c53b0c2a7184582d705d8b8052c8b.camel@yadro.com
Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Viacheslav Dubeyko <v.dubeiko@yadro.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 6b3d16f9875e181412401b8ab445dce83bd6fedc upstream ]
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8957 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Flag RQF_COPY_USER has been removed from kernel v5.8. Since that flag
only controls padding that we don't need, do not set that flag. See also
Linux kernel commit f18573abcc57 ("block: move the padding adjustment to
blk_rq_map_sg") # v2.6.26.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8955 d57e44dd-8a1f-0410-8b47-8ef2f437770f
When using SG_IO it is easy to submit data buffers that do not match the
alignment requirements of vdisk_blockio. Make the submitter copy buffers
that are not aligned. See also the blk_rq_map_user() call in the Linux
kernel source file drivers/scsi/sg.c.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8953 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Also unload SCST kernel modules that have been loaded manually or that are
no longer referenced by /etc/scst.conf.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8951 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Instead of passing an scst_data_direction value to scst_scsi_execute(), pass
a dma_data_direction value.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8948 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Running fio at the initiator side with buffer size 1 MiB and when using
direct I/O triggers the following error with a ConnectX-3 and Linux kernel
v4.19 or later or CentOS 7.7 or later at the target side:
ib_srpt: RDMA t 4 for idx 20 failed with status 5. If this has not been triggered by a cable pull, please check the involved IB HCA's and cables.
This was observed with firmware version 2.42.5000 but this is probably
independent of the firmware version. Fix this by reducing the send SGE QP
limit. This patch increases ch->max_recv_sge for older kernel versions.
Reported-by: Chesnokov Gleb <Chesnokov.G@raidix.com>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8938 d57e44dd-8a1f-0410-8b47-8ef2f437770f
The path_rec pointer is set for IB and RoCE logins but not for iWARP
logins. Hence check the path_rec pointer before dereferencing it.
See also upstream commit cbca2442a096 ("RDMA/srpt: Fix handling of iWARP
logins") # v5.5.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8934 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Set *res_sg_cnt correctly in case the scatterlist is chained. Support chained
scatterlists in the loop that calculates the number of bytes left. Fix
restoring the original SG list in case an error happens:
scst_check_restore_sg_buff() only restores the original sg list if
cmd->sg_buff_modified has been set. However, __scst_adjust_sg_get_tail()
does not set that variable. This patch fixes the following kernel complaints
triggered by COMPARE AND WRITE (see also
https://github.com/bvanassche/scst/issues/22):
scst_adjust_sg_get_tail() failed: -22
WARNING: CPU: 2 PID: 1179 at /home/bart/software/scst.git/scst/src/scst_lib.c:6860 scst_cwr_read_cmd_finished+0x954/0xb10 [scst]
CPU: 2 PID: 1179 Comm: disk011_0 Tainted: G O 5.7.0-rc4-dbg+ #4
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4-rebuilt.opensuse.org 04/01/2014
RIP: 0010:scst_cwr_read_cmd_finished+0x954/0xb10 [scst]
Call Trace:
scst_finish_internal_cmd+0x1f8/0x3c0 [scst]
scst_process_active_cmd+0x594/0x17f0 [scst]
scst_cmd_thread+0x470/0xc30 [scst]
kthread+0x211/0x240
ret_from_fork+0x24/0x30
WARNING: CPU: 2 PID: 1179 at /home/bart/software/scst.git/scst/src/../include/scst.h:5030 blockio_exec_rw+0xbb2/0xe00 [scst_vdisk]
CPU: 2 PID: 1179 Comm: disk011_0 Tainted: G W O 5.7.0-rc4-dbg+ #4
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4-rebuilt.opensuse.org 04/01/2014
RIP: 0010:blockio_exec_rw+0xbb2/0xe00 [scst_vdisk]
Call Trace:
blockio_exec_write+0x9c/0x160 [scst_vdisk]
vdev_do_job+0xe8/0x290 [scst_vdisk]
blockio_exec+0x153/0x4b0 [scst_vdisk]
scst_do_real_exec+0xf4/0x680 [scst]
scst_exec_check_blocking+0x24e/0x7b0 [scst]
scst_exec_check_sn+0x252/0x7d0 [scst]
scst_process_active_cmd+0x9a0/0x17f0 [scst]
scst_cmd_thread+0x37e/0xc30 [scst]
kthread+0x211/0x240
ret_from_fork+0x24/0x30
BUG: KASAN: slab-out-of-bounds in __scst_adjust_sg_get_tail+0x2da/0x550 [scst]
Read of size 4 at addr ffff8881dd9b93cc by task disk011_0/1179
CPU: 3 PID: 1179 Comm: disk011_0 Tainted: G W O 5.7.0-rc4-dbg+ #4
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4-rebuilt.opensuse.org 04/01/2014
Call Trace:
dump_stack+0xa5/0xe6
print_address_description.constprop.0+0x46/0x60
__kasan_report.cold+0x94/0xbb
kasan_report+0x45/0x60
__asan_load4+0x6f/0x90
__scst_adjust_sg_get_tail+0x2da/0x550 [scst]
scst_cwr_read_cmd_finished+0x574/0xb10 [scst]
scst_finish_internal_cmd+0x1f8/0x3c0 [scst]
scst_process_active_cmd+0x594/0x17f0 [scst]
scst_cmd_thread+0x470/0xc30 [scst]
kthread+0x211/0x240
ret_from_fork+0x24/0x30
Allocated by task 1549:
save_stack+0x23/0x50
__kasan_kmalloc.constprop.0+0xcf/0xe0
kasan_slab_alloc+0x12/0x20
kmem_cache_alloc+0x101/0x370
mempool_alloc_slab+0x1b/0x20
mempool_alloc+0xf3/0x2b0
sg_pool_alloc+0x58/0xb0
__sg_alloc_table+0x14e/0x1c0
sg_alloc_table_chained+0x4f/0xf0
scsi_init_io+0x144/0x6d0 [scsi_mod]
scsi_queue_rq+0xabc/0xe00 [scsi_mod]
blk_mq_dispatch_rq_list+0x6ad/0xd10
__blk_mq_sched_dispatch_requests+0x1e9/0x2c0
blk_mq_sched_dispatch_requests+0x8e/0xc0
__blk_mq_run_hw_queue+0x128/0x1e0
__blk_mq_delay_run_hw_queue+0x2dd/0x310
blk_mq_run_hw_queue+0x145/0x1e0
blk_mq_sched_insert_request+0x236/0x360
blk_execute_rq_nowait+0x8e/0xa0
blk_execute_rq+0xe1/0x160
sg_io+0x43b/0x7a0
scsi_cmd_ioctl+0x27a/0x3e0
scsi_cmd_blk_ioctl+0x83/0x95
sd_ioctl_common+0xb6/0x150 [sd_mod]
sd_ioctl+0x20/0x80 [sd_mod]
blkdev_ioctl+0x1c3/0x3c0
block_ioctl+0x87/0xa0
ksys_ioctl+0x8e/0xd0
__x64_sys_ioctl+0x47/0x50
do_syscall_64+0x6f/0x310
entry_SYSCALL_64_after_hwframe+0x49/0xb3
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8932 d57e44dd-8a1f-0410-8b47-8ef2f437770f