Commit Graph
526 Commits
Author SHA1 Message Date
Bart Van Assche 770ffb6553 qla2x00t-32gbit: Address a set of sparse warnings
Fix the following sparse warnings:

drivers/scsi/qla2xxx/qla_isr.c:881:23: warning: restricted __le16 degrades to integer
drivers/scsi/qla2xxx/qla_isr.c:881:23: warning: cast to restricted __le16

Link: https://lore.kernel.org/r/20200715043358.21668-1-njavali@marvell.com
Signed-off-by: Shyam Sundar <ssundar@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

See also commit 58101f1504ad9b36e34533ec1fb01a8de80aa6d6 upstream.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9075 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-07-25 14:47:24 +00:00
Bart Van Assche 7b375842e9 qla2x00t-32gbit: Fix two recently introduced build errors
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9074 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-07-25 14:45:27 +00:00
Bart Van Assche e675bc7b0a qla2x00t-32gbit: SAN congestion management implementation
* Firmware Initialization with SCM enabled based on NVRAM setting and
  firmware support (About Firmware).

* Enable PUREX and add support for fabric performance impact
  notification (FPIN) handling.

* Allocate a default PUREX item for each vha to handle memory allocation
  failures in ISR.

Link: https://lore.kernel.org/r/20200630102229.29660-3-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Shyam Sundar <ssundar@marvell.com>
Signed-off-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

See also commit 9f2475fe7406b8ef5f97099c4980021344872d9f upstream.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9072 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-07-25 14:37:22 +00:00
Bart Van Assche 786c8d6fd3 qla2x00t-32gbit: Change in PUREX to handle FPIN ELS requests
SAN Congestion Management generates ELS pkts whose size can vary and be >
64 bytes. Change the PUREX handling code to support non-standard ELS pkt
size.

Link: https://lore.kernel.org/r/20200630102229.29660-2-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Shyam Sundar <ssundar@marvell.com>
Signed-off-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

See also commit 62e9dd177732843ae6c5b9d2ed61e7c9538fa276 upstream.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9071 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-07-25 14:35:24 +00:00
Bart Van Assche 977661eb0e qla2x00t-32gbit: Introduce a function for computing the debug message prefix
Instead of repeating the code for generating a debug message prefix six
times, introduce a function for computing the debug message prefix.

Link: https://lore.kernel.org/r/20200629225454.22863-10-bvanassche@acm.org
Cc: Nilesh Javali <njavali@marvell.com>
Cc: Quinn Tran <qutran@marvell.com>
Cc: Himanshu Madhani <himanshu.madhani@oracle.com>
Cc: Martin Wilck <mwilck@suse.com>
Cc: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

See also upstream commit e7019c95c40daf8e8a9fa1d5f36eabce2eb8ef6b.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9070 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-07-25 14:29:24 +00:00
Bart Van Assche 38ed627b73 qla2x00t-32gbit: Make qla2x00_restart_isp() easier to read
Instead of using complicated control flow to only have one return statement
at the end of qla2x00_restart_isp(), return an error status as soon as it
is known that this function will fail.

Link: https://lore.kernel.org/r/20200629225454.22863-9-bvanassche@acm.org
Cc: Nilesh Javali <njavali@marvell.com>
Cc: Quinn Tran <qutran@marvell.com>
Cc: Himanshu Madhani <himanshu.madhani@oracle.com>
Cc: Martin Wilck <mwilck@suse.com>
Cc: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

See also commit f85a299f5ec55c82403cd2bc4aeaaedebfcf5ef6 upstream.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9069 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-07-25 14:22:07 +00:00
Bart Van Assche b7f0ee3cde qla2x00t-32gbit: Fix a Coverity complaint in qla2100_fw_dump()
'cnt' can exceed the size of the risc_ram[] array. Prevent that Coverity
complains by rewriting an address calculation expression. This patch fixes
the following Coverity complaint:

CID 337803 (#1 of 1): Out-of-bounds read (OVERRUN)
109. overrun-local: Overrunning array of 122880 bytes at byte offset 122880
by dereferencing pointer &fw->risc_ram[cnt].

Link: https://lore.kernel.org/r/20200629225454.22863-8-bvanassche@acm.org
Cc: Nilesh Javali <njavali@marvell.com>
Cc: Quinn Tran <qutran@marvell.com>
Cc: Himanshu Madhani <himanshu.madhani@oracle.com>
Cc: Martin Wilck <mwilck@suse.com>
Cc: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

See also commit 57fec9f24e580d8fe4219ee89572f49758e62c75 upstream.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9068 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-07-25 14:21:25 +00:00
Bart Van Assche 41d7c4e1fd qla2x00t-32gbit: Make __qla2x00_alloc_iocbs() initialize 32 bits of request_t.handle
The request_t 'handle' member is 32-bits wide, hence use wrt_reg_dword().
Change the cast in the wrt_reg_byte() call to make it clear that a regular
pointer is casted to an __iomem pointer.

Note: 'pkt' points to I/O memory for the qlafx00 adapter family and to
coherent memory for all other adapter families.

This patch fixes the following Coverity complaint:

CID 358864 (#1 of 1): Reliance on integer endianness (INCOMPATIBLE_CAST)
incompatible_cast: Pointer &pkt->handle points to an object whose effective
type is unsigned int (32 bits, unsigned) but is dereferenced as a narrower
unsigned short (16 bits, unsigned). This may lead to unexpected results
depending on machine endianness.

Link: https://lore.kernel.org/r/20200629225454.22863-7-bvanassche@acm.org
Fixes: 8ae6d9c7eb10 ("[SCSI] qla2xxx: Enhancements to support ISPFx00.")
Cc: Nilesh Javali <njavali@marvell.com>
Cc: Quinn Tran <qutran@marvell.com>
Cc: Himanshu Madhani <himanshu.madhani@oracle.com>
Cc: Martin Wilck <mwilck@suse.com>
Cc: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

See also commit f8f12bda53eae87ca2dea42b36d19e48c9851b9f upstream.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9067 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-07-25 14:20:47 +00:00
Bart Van Assche 82ae3e17f4 qla2x00t-32gbit: Remove a superfluous cast
Remove an unnecessary cast because it prevents the compiler to perform type
checking.
    
Link: https://lore.kernel.org/r/20200629225454.22863-6-bvanassche@acm.org
Cc: Nilesh Javali <njavali@marvell.com>
Cc: Quinn Tran <qutran@marvell.com>
Cc: Himanshu Madhani <himanshu.madhani@oracle.com>
Cc: Martin Wilck <mwilck@suse.com>
Cc: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Shyam Sundar <ssundar@marvell.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

See also commit 9bb013584a5ea18dfae89e33ded130cae08eb135 upstream.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9066 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-07-25 14:19:55 +00:00
Bart Van Assche 6c298568e9 qla2x00t-32gbit: Initialize 'n' before using it
The following code:
   
	qla82xx_rom_fast_read(ha, 0, &n)

only initializes 'n' if it succeeds. Since 'n' may be reported in a debug
message even if no ROM reads succeeded, initialize 'n' to zero.

This patch fixes the following sparse warning:

qla_nx.c:1218: qla82xx_pinit_from_rom() error: uninitialized symbol 'n'.

Link: https://lore.kernel.org/r/20200629225454.22863-5-bvanassche@acm.org
Cc: Nilesh Javali <njavali@marvell.com>
Cc: Quinn Tran <qutran@marvell.com>
Cc: Himanshu Madhani <himanshu.madhani@oracle.com>
Cc: Martin Wilck <mwilck@suse.com>
Cc: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Shyam Sundar <ssundar@marvell.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

See also commit 67668b5b13c7ba12f212d4b9067e54354ce5360b upstream.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9065 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-07-25 14:19:14 +00:00
Bart Van Assche 247d6d88b6 qla2x00t-32gbit: Make qla82xx_flash_wait_write_finish() easier to read
Return early instead of having a single return statement at the end of this
function. This patch fixes the following sparse warning:
    
qla_nx.c:1018: qla82xx_flash_wait_write_finish() error: uninitialized symbol 'val'.
    
Link: https://lore.kernel.org/r/20200629225454.22863-4-bvanassche@acm.org
Cc: Nilesh Javali <njavali@marvell.com>
Cc: Quinn Tran <qutran@marvell.com>
Cc: Himanshu Madhani <himanshu.madhani@oracle.com>
Cc: Martin Wilck <mwilck@suse.com>
Cc: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

See also commit 2f91a0a03c2da5140994d7b3d53469d07df9943c upstream.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9064 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-07-25 14:18:32 +00:00
Bart Van Assche 9c1c5315fa qla2x00t-32gbit: Remove the __packed annotation from struct fcp_hdr and fcp_hdr_le
Remove the __packed annotation from struct fcp_hdr* because that annotation
is not necessary for these data structures.

Link: https://lore.kernel.org/r/20200629225454.22863-3-bvanassche@acm.org
Cc: Nilesh Javali <njavali@marvell.com>
Cc: Quinn Tran <qutran@marvell.com>
Cc: Himanshu Madhani <himanshu.madhani@oracle.com>
Cc: Martin Wilck <mwilck@suse.com>
Cc: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

See also commit f1e12bee55e6eb28a53662765d5d2d96fa0247b1 upstream.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9063 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-07-25 14:17:48 +00:00
Bart Van Assche acb9ee4f23 qla2x00t-32gbit: replace '---help---' in Kconfig files with 'help'
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

See also commit a7f7f6248d9740d710fd6bd190293fe5e16410ac upstream.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9062 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-07-25 14:16:38 +00:00
Bart Van Assche 34ca359894 qla2x00t-32gbit: Fix spelling of the word 'descriptor'
Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

See also commit 0a19a725c0ede422e8510283c0c08e1a8f5b3486 upstream.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9061 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-07-25 14:15:50 +00:00
Bart Van Assche 7569ddaf2e Makefiles: Remove -Wextra
Since not all kernel header files are compatible with -Wextra, remove -Wextra.
To enable -Wextra, build SCST with W=1.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9054 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-07-19 01:18:24 +00:00
Bart Van Assche cf909e3e16 Makefiles: If both KDIR and KVER have been set, preserve KDIR
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9052 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-07-19 00:00:49 +00:00
Bart Van Assche d6fd03107f Split Makefiles: move kernel build rules into Kbuild files
This patch makes the Makefiles easier to read.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9039 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-07-05 02:13:40 +00:00
Bart Van Assche 47403656ee Make 'make clean' remove all build files
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9038 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-07-05 02:08:55 +00:00
Bart Van Assche 3a957d352a qla2xxx: Do not log message when reading port speed via sysfs
Calling ql_log() inside qla2x00_port_speed_show() is causing messages to be
output to the console for no particularly good reason.  The sysfs read
routine should just return the information to userspace.  The only reason
to log a message is when the port speed actually changes, and this already
occurs elsewhere.

Link: https://lore.kernel.org/r/20200504175416.15417-1-emilne@redhat.com
Fixes: 4910b524ac9e ("scsi: qla2xxx: Add support for setting port speed")
Cc: <stable@vger.kernel.org> # v5.1+
Reviewed-by: Lee Duncan <lduncan@suse.com>
Reviewed-by: Laurence Oberman <loberman@redhat.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Ewan D. Milne <emilne@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

[ commit fb9024b0646939e59d8a0b6799b317070619795a upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9022 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-06-13 17:42:10 +00:00
Bart Van Assche 703b35fcbe qla2xxx: Delete all sessions before unregister local nvme port
Delete all sessions before unregistering local nvme port.  This allows nvme
layer to decrement all active rport count down to zero.  Once the count is
down to zero, nvme would call qla to continue with the npiv port deletion.

PID: 27448  TASK: ffff9e34b777c1c0  CPU: 0   COMMAND: "qaucli"
 0 [ffff9e25e84abbd8] __schedule at ffffffff977858ca
 1 [ffff9e25e84abc68] schedule at ffffffff97785d79
 2 [ffff9e25e84abc78] schedule_timeout at ffffffff97783881
 3 [ffff9e25e84abd28] wait_for_completion at ffffffff9778612d
 4 [ffff9e25e84abd88] qla_nvme_delete at ffffffffc0e3024e [qla2xxx]
 5 [ffff9e25e84abda8] qla24xx_vport_delete at ffffffffc0e024b9 [qla2xxx]
 6 [ffff9e25e84abdf0] fc_vport_terminate at ffffffffc011c247 [scsi_transport_fc]
 7 [ffff9e25e84abe28] store_fc_host_vport_delete at ffffffffc011cd94 [scsi_transport_fc]
 8 [ffff9e25e84abe70] dev_attr_store at ffffffff974b376b
 9 [ffff9e25e84abe80] sysfs_kf_write at ffffffff972d9a92
10 [ffff9e25e84abe90] kernfs_fop_write at ffffffff972d907b
11 [ffff9e25e84abec8] vfs_write at ffffffff9724c790
12 [ffff9e25e84abf08] sys_write at ffffffff9724d55f
13 [ffff9e25e84abf50] system_call_fastpath at ffffffff97792ed2
    RIP: 00007fc0bd81a6fd  RSP: 00007ffff78d9648  RFLAGS: 00010202
    RAX: 0000000000000001  RBX: 0000000000000022  RCX: 00007ffff78d96e0
    RDX: 0000000000000022  RSI: 00007ffff78d94e0  RDI: 0000000000000008
    RBP: 00007ffff78d9440   R8: 0000000000000000   R9: 00007fc0bd48b2cd
    R10: 0000000000000017  R11: 0000000000000293  R12: 0000000000000000
    R13: 00005624e4dac840  R14: 00005624e4da9a10  R15: 0000000000000000
    ORIG_RAX: 0000000000000001  CS: 0033  SS: 002b

Link: https://lore.kernel.org/r/20200331104015.24868-4-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
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 c48f849d3f7a4ec1025105f446e29d395c4dcc2f upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9021 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-06-13 17:41:34 +00:00
Bart Van Assche 6bbee1b222 qla2xxx: Fix hang when issuing nvme disconnect-all in NPIV
In NPIV environment, a NPIV host may use a queue pair created by base host
or other NPIVs, so the check for a queue pair created by this NPIV is not
correct, and can cause an abort to fail, which in turn means the NVME
command not returned.  This leads to hang in nvme_fc layer in
nvme_fc_delete_association() which waits for all I/Os to be returned, which
is seen as hang in the application.

Link: https://lore.kernel.org/r/20200331104015.24868-3-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

[ commit 45a76264c26fd8cfd0c9746196892d9b7e2657ee upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9020 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-06-13 17:40:49 +00:00
Bart Van Assche 985a661701 qla2xxx: check UNLOADING before posting async work
qlt_free_session_done() tries to post async PRLO / LOGO, and waits for the
completion of these async commands. If UNLOADING is set, this is doomed to
timeout, because the async logout command will never complete.

The only way to avoid waiting pointlessly is to fail posting these commands
in the first place if the driver is in UNLOADING state.  In general,
posting any command should be avoided when the driver is UNLOADING.

With this patch, "rmmod qla2xxx" completes without noticeable delay.

Link: https://lore.kernel.org/r/20200421204621.19228-3-mwilck@suse.com
Fixes: 45235022da99 ("scsi: qla2xxx: Fix driver unload by shutting down chip")
Acked-by: Arun Easi <aeasi@marvell.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

[ commit 5a263892d7d0b4fe351363f8d1a14c6a75955475 upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9019 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-06-13 17:40:19 +00:00
Bart Van Assche a44749aa37 scsi: qla2xxx: set UNLOADING before waiting for session deletion
The purpose of the UNLOADING flag is to avoid port login procedures to
continue when a controller is in the process of shutting down.  It makes
sense to set this flag before starting session teardown.

Furthermore, use atomic test_and_set_bit() to avoid the shutdown being run
multiple times in parallel. In qla2x00_disable_board_on_pci_error(), the
test for UNLOADING is postponed until after the check for an already
disabled PCI board.

Link: https://lore.kernel.org/r/20200421204621.19228-2-mwilck@suse.com
Fixes: 45235022da99 ("scsi: qla2xxx: Fix driver unload by shutting down chip")
Reviewed-by: Arun Easi <aeasi@marvell.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

[ commit 856e152a3c08bf7987cbd41900741d83d9cddc8e upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9018 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-06-13 17:39:48 +00:00
Bart Van Assche 36714f6759 qla2x00t-32gbit: Fix several compiler warnings
Fix the following compiler warnings:

drivers/scsi/qla2xxx/qla_dbg.c:2542:7: warning: The scope of the variable 'pbuf' can be reduced. [variableScope]
drivers/scsi/qla2xxx/qla_init.c:3615:6: warning: Variable 'rc' is assigned a value that is never used. [unreadVariable]
drivers/scsi/qla2xxx/qla_isr.c:81:11-29: WARNING: dma_alloc_coherent use in rsp_els already zeroes out memory, so memset is not needed
drivers/scsi/qla2xxx/qla_mbx.c:4889:15-33: WARNING: dma_alloc_coherent use in els_cmd_map already zeroes out memory, so memset is not needed

[mkp: added newline after variable declaration]

Link: https://lore.kernel.org/r/20200403084018.30766-2-njavali@marvell.com
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

[ commit bb46737ec09e9a072424bf46def2977c5b6b925d upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9017 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-06-13 17:38:05 +00:00
Bart Van Assche 9be61ba538 Move KBUILD_EXTRA_SYMBOLS definitions into the kernel Makefiles
$(KBUILD_EXTRA_SYMBOLS) is not only used at compile time but also at link
time. Move the $(KBUILD_EXTRA_SYMBOLS) definitions such that it is
available both at compile time and at link time.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9000 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-06-01 02:15:47 +00:00
Bart Van Assche 80ac4d2810 Use $(src) instead of $(KBUILD_EXTMOD)
While $(src) is always defined, $(KBUILD_EXTMOD) is only defined when
building code as an external module.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8999 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-06-01 02:12:09 +00:00
Bart Van Assche f7fe23928f Change $(MODULE_SYMVERS) into Module.symvers
Or in other words, drop support for kernel versions before 2.6.18.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8998 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-06-01 02:11:16 +00:00
Bart Van Assche 1adaafdab1 qla2x00t-32gbit: Unbreak the 32-bit build
Note: this is not an attempt to port this driver to 32-bit systems.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8991 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-31 03:29:53 +00:00
Bart Van Assche a88046be97 qla2xxx: Minimize diffs with upstream
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8976 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 22:53:52 +00:00
Bart Van Assche ac5f86c035 qla2xxx: Fix a NULL pointer dereference in an error path
[ commit 17c5f65db629a3bd95ac8eb960940b6fbb39a310 upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8975 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 22:52:09 +00:00
Bart Van Assche bac6ce6350 qla2xxx: Fix endianness annotations in source files
[ commit 7ffa5b939751b6638e4a99518775c8503fbb46be upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8974 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 22:23:17 +00:00
Bart Van Assche 3e86d771e0 qla2xxx: Fix endianness annotations in header files
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
2020-05-23 22:20:52 +00:00
Bart Van Assche e2e106d53c qla2xxx: Use make_handle() instead of open-coding it
[ commit 2a4b684ab0aa2a8f8efede77ca1525042c2c0e01 upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8972 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 22:20:22 +00:00
Bart Van Assche 80041b881e qla2xxx: Cast explicitly to uint16_t / uint32_t
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
2020-05-23 22:19:55 +00:00
Bart Van Assche 6e9f52f1d4 qla2xxx: Change {RD,WRT}_REG_*() function names from upper case into lower case
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
2020-05-23 22:19:28 +00:00
Bart Van Assche 76ab4d5949 qla2xxx: Use register names instead of register offsets
[ commit c3888416221849ed46fd35413c7a1d00ee291cbe upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8969 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 22:18:44 +00:00
Bart Van Assche 807e5ec091 qla2xxx: Fix the code that reads from mailbox registers
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
2020-05-23 22:16:57 +00:00
Bart Van Assche 641a56ec5b qla2xxx: Change two hardcoded constants into offsetof() / sizeof() expressions
[ commit e544b720ef3191cdb6d3ea2915f82973d6372bca upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8967 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 22:15:33 +00:00
Bart Van Assche 55bcb91c24 qla2xxx: Increase the size of struct qla_fcp_prio_cfg to FCP_PRIO_CFG_SIZE
[ commit d9ab5f1f05fc147682d4fd1f1f1c5af00b766e33 upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8966 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 22:15:03 +00:00
Bart Van Assche e792922328 qla2xxx: Make a gap in struct qla2xxx_offld_chain explicit
[ commit 66f86367771507c88a970644d13646f6b57e82e5 upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8965 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 22:14:18 +00:00
Bart Van Assche 99374b5c06 qla2xxx: Add more BUILD_BUG_ON() statements
[ commit 8a73a0e002b318d8ad79fe0e6b48e27ca30e527a upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8964 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 22:11:00 +00:00
Bart Van Assche 9143dc55a7 qla2xxx: Simplify the functions for dumping firmware
[ commit 8ae178760b23e2055aecf8b8a54629cec7ccc58e upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8963 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 22:06:52 +00:00
Bart Van Assche ab70b43b05 qla2xxx: Fix spelling of a variable name
[ commit 246ee22583ed4847dcdd9a2f307eeca856f42882 upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8962 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 22:05:27 +00:00
Bart Van Assche 751580bcd4 qla2xxx: Make qlafx00_process_aen() return void
[ commit 88bfdf565cbe33524308d912777f4267981d4be0 upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8961 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 22:05:02 +00:00
Bart Van Assche 4f8071b6f7 qla2xxx: Use true, false for ha->fw_dumped
[ commit dbe6f49259dacc073c1ae602f383c177f57b1b8a upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8960 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 22:04:29 +00:00
Bart Van Assche db5f6bc28b qla2xxx: Use true, false for need_mpi_reset
[ commit bda552a7741a23708823c6e87a39d9a956087ac0 upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8959 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 22:04:02 +00:00
Bart Van Assche 630c4f49d0 qla2xxx: Make qla_set_ini_mode() return void
The return value is not used by the caller and the local variable 'rc' is
not needed. Make qla_set_ini_mode() return void and remove 'rc'.  This also
fixes the following coccicheck warning:

drivers/scsi/qla2xxx/qla_attr.c:1906:5-7: Unneeded variable: "rc".
Return "0" on line 2180

Link: https://lore.kernel.org/r/20200429140952.8240-1-yanaijie@huawei.com
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

[ commit 1b007f96f9e063f9f0b93597a4089114a89c1854 upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8958 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 22:03:28 +00:00
Bart Van Assche a0c11c0790 scsi: qla2xxx: Fix failure message in qlt_disable_vha()
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
2020-05-23 22:01:04 +00:00
Bart Van Assche 0f40406997 scsi: qla2xxx: Fix warning after FC target reset
Currently, FC target reset finishes with the warning message:

------------[ cut here ]------------
WARNING: CPU: 238 PID: 279973 at ../drivers/scsi/qla2xxx/qla_target.c:6644 qlt_enable_vha+0x1d0/0x260 [qla2xxx]
Supported: Yes, External
CPU: 238 PID: 279973 Comm: bash Tainted: G           OE      4.12.14-197.29-default #1 SLE15-SP1
task: c000000a104c0000 task.stack: c000000b52188000
NIP: d00000001ffd7f78 LR: d00000001ffd7f6c CTR: c0000000001676c0
REGS: c000000b5218b910 TRAP: 0700   Tainted: G           OE       (4.12.14-197.29-default)
Call Trace:
qlt_enable_vha+0x1c4/0x260 [qla2xxx] (unreliable)
tcm_qla2xxx_tpg_enable_store+0xc4/0x130 [tcm_qla2xxx]
configfs_write_file+0xd0/0x190 [configfs]
__vfs_write+0x3c/0x1e0
vfs_write+0xd8/0x220
SyS_write+0x6c/0x110
system_call+0x3c/0x130
---[ end trace e32abaf6e6fee826 ]---

Link: https://lore.kernel.org/r/1d7b21bf9f7676643239eb3d60eaca7cfa505cf0.camel@yadro.com
Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Viacheslav Dubeyko <v.dubeiko@yadro.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

[ commit f839544ccff60cbe534282aac68858fc3fb278ca upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8956 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 21:59:55 +00:00
Bart Van Assche e3f76c80a5 qla2x00t-32gbit: Only use 'pragma GCC diagnostic' if supported by gcc
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8936 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-17 21:06:37 +00:00