Commit Graph

7088 Commits

Author SHA1 Message Date
Bart Van Assche
ea7fac484e qla2x00t-32gbit: Backport to older kernel versions
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9307 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-31 16:59:15 +00:00
Bart Van Assche
4664d87d6a scripts/kernel-functions: Apply the yylloc patch also to scripts/dtc/dtc-lexer.lex.c_shipped
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9306 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-31 16:58:27 +00:00
Bart Van Assche
0895adbb92 scripts/kernel-functions: Unbreak the build against kernel versions 2.6.34[2..7]
Fixes: e3d187f6af ("scripts/kernel-functions: Apply kernel patches more selectively")



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9305 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-31 16:57:10 +00:00
Bart Van Assche
5b5a50db96 qla2x00t-32gbit: Fix the use of whitespace in qla_target.c
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9304 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-29 00:30:54 +00:00
Bart Van Assche
aa81b9023b qla2x00t-32gbit: Remove qla_nvme_ls() return value
The function always returns QLA_SUCCESS and the caller qla2x00_start_sp()
doesn't even evalute the return value. So there is no point in returning a
status.

Link: https://lore.kernel.org/r/20200520130819.90625-1-dwagner@suse.de
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

See also upstream commit ac988c49367a52b466285239361ede0f74c672da.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9303 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-29 00:21:49 +00:00
Bart Van Assche
5055d80d36 qla2x00t-32gbit: Update version to 10.02.00.104-k
Link: https://lore.kernel.org/r/20201202132312.19966-16-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

See also upstream commit afc516dcfe52802e0d29e37e3200c0f08583bd8f.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9302 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 23:53:31 +00:00
Bart Van Assche
dad1b2cb9c qla2x00t-32gbit: Fix device loss on 4G and older HBAs
Due to a bug in the older scan logic, when a once lost device re-appeared,
it was not discovered. Fix this by resetting login_retry counter upon
device discovery.

This is applicable only for 4G and older HBAs.

Link: https://lore.kernel.org/r/20201202132312.19966-15-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>

See also upstream commit abd9cae9bbae9f3a80dae82587b1f79161ad7836.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9301 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 23:52:31 +00:00
Bart Van Assche
ab98afb456 qla2x00t-32gbit: If fcport is undergoing deletion complete I/O with retry
Driver unload with I/Os in flight causes server to crash.  Complete I/O
with DID_IMM_RETRY if fcport undergoing deletion.

CPU: 44 PID: 35008 Comm: qla2xxx_4_dpc Kdump: loaded Tainted: G
OE  X   5.3.18-22-default #1 SLE15-SP2 (unreleased)
Hardware name: HPE ProLiant DL380 Gen10/ProLiant DL380 Gen10, BIOS U30 07/16/2020
RIP: 0010:dma_direct_unmap_sg+0x24/0x60
Code: 4c 8b 04 24 eb b9 0f 1f 44 00 00 85 d2 7e 4e 41 57
      4d 89 c7 41 56 41 89 ce 41 55 49 89 fd 41 54 41 89 d4 55 31 ed 53 48 89
      f3 <8b> 53 18 48 8b 73 10 4d 89 f8 44 89 f1 4c 89 ef 83 c5 01 e8 44 ff
RSP: 0018:ffffc0c661037d88 EFLAGS: 00010046
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000002
RDX: 000000000000001d RSI: 0000000000000000 RDI: ffff9a51ee53b0b0
RBP: 0000000000000000 R08: 0000000000000000 R09: ffff9a51ee53b0b0
R10: ffffc0c646463dc8 R11: ffff9a4a067087c8 R12: 000000000000001d
R13: ffff9a51ee53b0b0 R14: 0000000000000002 R15: 0000000000000000
FS:  0000000000000000(0000) GS:ffff9a523f800000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000018 CR3: 000000043740a004 CR4: 00000000007606e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
PKRU: 55555554
Call Trace:
qla2xxx_qpair_sp_free_dma+0x20d/0x3c0 [qla2xxx]
qla2xxx_qpair_sp_compl+0x35/0x90 [qla2xxx]
__qla2x00_abort_all_cmds+0x180/0x390 [qla2xxx]
? qla24xx_process_purex_list+0x100/0x100 [qla2xxx]
qla2x00_abort_all_cmds+0x5e/0x80 [qla2xxx]
qla2x00_do_dpc+0x317/0xa30 [qla2xxx]
kthread+0x10d/0x130
? kthread_park+0xa0/0xa0
ret_from_fork+0x35/0x40

Link: https://lore.kernel.org/r/20201202132312.19966-14-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

See also upstream commit 707531bc2626c1959a03b93566ebb4e629c99276.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9300 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 23:51:49 +00:00
Bart Van Assche
3e72ee7690 qla2x00t-32gbit: Fix the call trace for flush workqueue
The call trace was because workqueue was allocated without any flags, added
WQ_MEM_RECLAIM as flag when allocating.

kernel: workqueue: WQ_MEM_RECLAIM
kblockd:blk_mq_run_work_fn is flushing !WQ_MEM_RECLAIM qla2xxx_wq:0x0
kernel: WARNING: CPU: 0 PID: 2475 at
kernel/workqueue.c:2593 check_flush_dependency+0x110/0x130
kernel: CPU: 0 PID: 2475 Comm: kworker/0:1H Kdump:
loaded Tainted: G           OE    --------- -  - 4.18.0-193.el8.x86_64 #1
kernel: Hardware name: HPE ProLiant XL170r Gen10/ProLiant XL170r Gen10, BIOS U38 05/21/2019
kernel: Workqueue: kblockd blk_mq_run_work_fn
kernel: RIP: 0010:check_flush_dependency+0x110/0x130
kernel: Code: ff ff 48 8b 50 18 48 8d 8b b0 00 00 00 49 89 e8 48 81 c6 b0 00 00 00 48 c7 c7 00 1e e9
	95 c6 05 dc 9a 2f 01 01 e8 1a 42 fe ff <0f> 0b e9 0a ff ff ff 80 3d ca 9a 2f 01 0 0 75 95 e9 41 ff ff ff 90
kernel: RSP: 0018:ffffa40f48b2baf8 EFLAGS: 00010282
kernel: RAX: 0000000000000000 RBX: ffff946795282600 RCX: 0000000000000000
kernel: RDX: 000000000000005f RSI: ffffffff96a1af7f RDI: 0000000000000246
kernel: RBP: 0000000000000000 R08: ffffffff96a1af20 R09: 0000000000029480
kernel: R10: 00080c89bb3e7462 R11: 00000000000009ab R12: ffff946773628000
kernel: R13: 0000000000000282 R14: 0000000000000246 R15: ffffa40f48b2bb40
kernel: FS: 	0000000000000000(0000) 	GS:ffff94679fa00000(0000) knlGS:0000000000000000
kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
kernel: CR2: 00005570c4b60110 CR3: 000000029140a005 CR4: 00000000007606f0
kernel: DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
kernel: DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
kernel: PKRU: 55555554
kernel: Call Trace:
kernel: flush_workqueue+0x13a/0x440
kernel: qla2x00_wait_for_sess_deletion+0x1d6/0x200 [qla2xxx]
kernel: ? finish_wait+0x80/0x80
kernel: qla2xxx_disable_port+0x2b/0x30 [qla2xxx]
kernel: qla2x00_process_vendor_specific+0x1dc9/0x2d20 [qla2xxx]
kernel: ? blk_rq_map_sg+0x195/0x570
kernel: qla24xx_bsg_request+0x1a3/0xf90 [qla2xxx]

Link: https://lore.kernel.org/r/20201202132312.19966-13-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

See also upstream commit 0a6f4d762c6b8fd0d442db74c8d279744100ae25.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9299 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 23:51:08 +00:00
Bart Van Assche
44dd7f48a3 qla2x00t-32gbit: Fix flash update in 28XX adapters on big endian machines
Flash update failed due to missing endian conversion in FLT region access
as well as in checksum computation.

Link: https://lore.kernel.org/r/20201202132312.19966-12-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>

See also upstream commit 0bc17251dff432f2589d3d509fb4dc14912d4372.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9298 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 23:50:15 +00:00
Bart Van Assche
68207cfbb0 qla2x00t-32gbit: Handle aborts correctly for port undergoing deletion
Call trace observed while shutting down the adapter ports (LINK DOWN).
Handle aborts correctly.

localhost kernel: INFO: task nvme:44209 blocked for more than 120 seconds.
localhost kernel: "echo 0 >/proc/sys/kernel/hung_task_timeout_secs" disables this message.
localhost kernel: nvme            D ffff88b45fb5acc0     0 44209 1 0x00000080
localhost kernel: Call Trace:
localhost kernel: [<ffffffffbd187169>] schedule+0x29/0x70
localhost kernel: [<ffffffffbd184c51>] schedule_timeout+0x221/0x2d0
localhost kernel: [<ffffffffbcad7229>] ? ttwu_do_wakeup+0x19/0xe0
localhost kernel: [<ffffffffbcad735f>] ? ttwu_do_activate+0x6f/0x80
localhost kernel: [<ffffffffbcada830>] ? try_to_wake_up+0x190/0x390
localhost kernel: [<ffffffffbd18751d>] wait_for_completion+0xfd/0x140
localhost kernel: [<ffffffffbcadaaf0>] ? wake_up_state+0x20/0x20
localhost kernel: [<ffffffffbcabe3da>] flush_work+0x10a/0x1b0
localhost kernel: [<ffffffffbcabb0f0>] ? move_linked_works+0x90/0x90
localhost kernel: [<ffffffffbcabe6cf>] flush_delayed_work+0x3f/0x50
localhost kernel: [<ffffffffc0452767>] nvme_fc_init_ctrl+0x657/0x6a0 [nvme_fc]
localhost kernel: [<ffffffffc045293a>] nvme_fc_create_ctrl+0x18a/0x210 [nvme_fc]
localhost kernel: [<ffffffffc028962f>] nvmf_dev_write+0x98f/0xb35 [nvme_fabrics]
localhost kernel: [<ffffffffbcd08927>] ? security_file_permission+0x27/0xa0
localhost kernel: [<ffffffffbcc4db50>] vfs_write+0xc0/0x1f0
localhost kernel: [<ffffffffbcc4e92f>] SyS_write+0x7f/0xf0
localhost kernel: [<ffffffffbd193f92>] system_call_fastpath+0x25/0x2a

Link: https://lore.kernel.org/r/20201202132312.19966-11-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

See also upstream commit f795f96e725b472de59db06a21a23e2285faaf14.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9297 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 23:49:15 +00:00
Bart Van Assche
baed87d219 qla2x00t-32gbit: Fix crash during driver load on big endian machines
Crash stack:
	[576544.715489] Unable to handle kernel paging request for data at address 0xd00000000f970000
	[576544.715497] Faulting instruction address: 0xd00000000f880f64
	[576544.715503] Oops: Kernel access of bad area, sig: 11 [#1]
	[576544.715506] SMP NR_CPUS=2048 NUMA pSeries
	:
	[576544.715703] NIP [d00000000f880f64] .qla27xx_fwdt_template_valid+0x94/0x100 [qla2xxx]
	[576544.715722] LR [d00000000f7952dc] .qla24xx_load_risc_flash+0x2fc/0x590 [qla2xxx]
	[576544.715726] Call Trace:
	[576544.715731] [c0000004d0ffb000] [c0000006fe02c350] 0xc0000006fe02c350 (unreliable)
	[576544.715750] [c0000004d0ffb080] [d00000000f7952dc] .qla24xx_load_risc_flash+0x2fc/0x590 [qla2xxx]
	[576544.715770] [c0000004d0ffb170] [d00000000f7aa034] .qla81xx_load_risc+0x84/0x1a0 [qla2xxx]
	[576544.715789] [c0000004d0ffb210] [d00000000f79f7c8] .qla2x00_setup_chip+0xc8/0x910 [qla2xxx]
	[576544.715808] [c0000004d0ffb300] [d00000000f7a631c] .qla2x00_initialize_adapter+0x4dc/0xb00 [qla2xxx]
	[576544.715826] [c0000004d0ffb3e0] [d00000000f78ce28] .qla2x00_probe_one+0xf08/0x2200 [qla2xxx]

Link: https://lore.kernel.org/r/20201202132312.19966-8-njavali@marvell.com
Fixes: f73cb695d3ec ("[SCSI] qla2xxx: Add support for ISP2071.")
Cc: stable@vger.kernel.org
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>

See also upstream commit 8de309e7299a00b3045fb274f82b326f356404f0.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9296 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 23:46:16 +00:00
Bart Van Assche
b885c5f4e5 qla2x00t-32gbit: Fix compilation issue in PPC systems
Fix compile time errors reported on PPC systems,

qla_gbl.h:991:20: error: inlining failed in call to always_inline
     qla_nvme_abort_set_option: function body not available

Link: https://lore.kernel.org/r/20201202132312.19966-7-njavali@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 upstream commit aceba54ba0f998ed6bec88faaf94e7458f753399.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9295 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 23:41:05 +00:00
Bart Van Assche
260f713d87 qla2x00t-32gbit: Don't check for fw_started while posting NVMe command
NVMe commands can come only after successful addition of rport and NVMe
connect, and rport is only registered after FW started bit is set. Remove
the redundant check.

Link: https://lore.kernel.org/r/20201202132312.19966-6-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

See also upstream commit 0ce8ab50a6ed7c10bc3b7fc00d4aa5b67b5f9e2c.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9294 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 23:39:33 +00:00
Bart Van Assche
6464aae05b qla2x00t-32gbit: Tear down session if FW say it is down
The completion status 0x28 (ppc = be = 0x2800) below indicates session is
not there, trigger session deletion.

qla2xxx [000b:04:00.1]-8009:8: DEVICE RESET ISSUED nexus=8:1:51 cmd=c000001432d0f600.
qla2xxx [000b:04:00.1]-5039:8: Async-tmf error - hdl=67b completion status(2800).
qla2xxx [000b:04:00.1]-8030:8: TM IOCB failed (102).
qla2xxx [000b:04:00.1]-800c:8: do_reset failed for cmd=c000001432d0f600.
qla2xxx [000b:04:00.1]-800f:8: DEVICE RESET FAILED: Task management failed nexus=8:1:51 cmd=c000001432d0f600.
qla2xxx [000b:04:00.1]-8009:8: DEVICE RESET ISSUED nexus=8:1:52 cmd=c000001432d0c200.
qla2xxx [000b:04:00.1]-5039:8: Async-tmf error - hdl=67c completion status(2800).
qla2xxx [000b:04:00.1]-8030:8: TM IOCB failed (102).

Link: https://lore.kernel.org/r/20201202132312.19966-5-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>

See also upstream commit e4fc78f48d3f8a9ea49e4b24878ac48dc9a58744.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9293 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 23:38:59 +00:00
Bart Van Assche
bb519e83d1 qla2x00t-32gbit: Limit interrupt vectors to number of CPUs
Driver created too many QPairs(126) with 28xx adapter.  Limit to the number
of CPUs to minimize wasted resources.

Link: https://lore.kernel.org/r/20201202132312.19966-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>

See also upstream commit a6dcfe08487e5e83b6b4214c959a9577a9ed2d9f.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9292 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 23:38:04 +00:00
Bart Van Assche
590980405f qla2x00t-32gbit: Change post del message from debug level to log level
Change the message debug level.

Link: https://lore.kernel.org/r/20201202132312.19966-3-njavali@marvell.com
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

See also upstream commit c1599657d48ca65861408f9264e12c050ac9626b.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9291 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 23:37:18 +00:00
Bart Van Assche
d43dc69e27 qla2x00t-32gbit: Remove trailing semicolon in macro definition
The macro use will already have a semicolon. Remove unneeded escaped
newline.

Link: https://lore.kernel.org/r/20201130205509.3447316-1-trix@redhat.com
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

See also upstream commit 8f525bc2a7b296cf24cfa7e5186bc32dd8e766aa.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9290 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 23:35:42 +00:00
Bart Van Assche
d2f8ac98c0 qla2x00t-32gbit: Remove in_interrupt() from qla83xx-specific code
qla83xx_wait_logic() is used to control the frequency of device IDC lock
retries. If in_interrupt() is true, it does 20 loops of cpu_relax().
Otherwise, it sleeps for 100ms and yields the CPU.

While in_interrupt() is ill-defined and does not provide what the name
suggests, it is not needed here: that qla83xx_wait_logic() is exclusively
called by qla83xx_idc_lock() / unlock(), and they always run from process
context. Below is an analysis of all the idc lock/unlock callers, in order
of appearance:

  - qla_os.c:
      qla83xx_nic_core_unrecoverable_work(),
      qla83xx_idc_state_handler_work(),
      qla83xx_nic_core_reset_work(),
      qla83xx_service_idc_aen(), all workqueue context

  - qla_os.c: qla83xx_check_nic_core_fw_alive(), has msleep()

  - qla_os.c: qla83xx_set_drv_presence(), called once from
    qla2x00_abort_isp(), which is bound to process-context ->abort_isp()
    hook. It also invokes wait_for_completion_timeout() through the chain
    qla2x00_configure_hba() => qla24xx_link_initialize() =>
    qla2x00_mailbox_command().

  - qla_os.c: qla83xx_clear_drv_presence(), which is called from
    qla2x00_abort_isp() discussed above, and from qla2x00_remove_one()
    which is PCI process-context ->remove() hook.

  - qla_os.c: qla83xx_need_reset_handler(), has a one second msleep() in
    a loop.

  - qla_os.c: qla83xx_device_bootstrap(), called only by
    qla83xx_idc_state_handler(), which has multiple msleep()
    invocations.

  - qla_os.c: qla83xx_idc_state_handler(), multiple msleep()
    invocations.

  - qla_attr.c: qla2x00_sysfs_write_reset(), sysfs bin_attribute
    ->write() hook, process context

  - qla_init.c: qla83xx_nic_core_fw_load()
      => qla_init.c: qla2x00_initialize_adapter()
        => bound to isp_operations ->initialize_adapter() hook
        ** => qla_os.c: qla2x00_probe_one(), PCI ->probe() process ctx

  - qla_init.c: qla83xx_initiating_reset(), msleep() in a loop.

  - qla_init.c: qla83xx_nic_core_reset(), called by
    qla83xx_nic_core_reset_work(), workqueue context.

Remove the in_interrupt() check, and thus replace the entirety of
qla83xx_wait_logic() with an msleep(QLA83XX_WAIT_LOGIC_MS).

Mark qla83xx_idc_lock() / unlock() with "Context: task, can sleep".

Link: https://lore.kernel.org/r/20201126132952.2287996-7-bigeasy@linutronix.de
Cc: Nilesh Javali <njavali@marvell.com>
Cc: GR-QLogic-Storage-Upstream@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Ahmed S. Darwish <a.darwish@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

See also upstream commit 4f6a57c23b1e002487159791feef7d54b725bfa6.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9289 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 23:35:00 +00:00
Bart Van Assche
bb82ef36cc qla2x00t-32gbit: Remove in_interrupt() from qla82xx-specific code
qla82xx_idc_lock() spins on a certain hardware state until it's updated. At
the end of each spin, if in_interrupt() is true, it does 20 loops of
cpu_relax(). Otherwise, it yields the CPU.

While in_interrupt() is ill-defined and does not provide what the name
suggests, it is not needed here: qla82xx_idc_lock() is always called from
process context. Below is an analysis of its callers, in order of
appearance:

  - qla_nx.c: qla82xx_device_bootstrap(), only called by
    qla82xx_device_state_handler(), has multiple msleep()s.

  - qla_nx.c: qla82xx_need_qsnt_handler(), has one second msleep()

  - qla_nx.c: qla82xx_wait_for_state_change(), one second msleep()

  - qla_nx.c: qla82xx_need_reset_handler(), can sleep up to 10 seconds

  - qla_nx.c: qla82xx_device_state_handler(), has multiple msleep()s

  - qla_nx.c: qla82xx_abort_isp(), if it's a qla82xx controller, calls
    qla82xx_device_state_handler(), which sleeps. It's also bound to
    isp_operations ->abort_isp() hook, where all the callers are in process
    context.

  - qla_nx.c: qla82xx_beacon_on(), bound to isp_operations ->beacon_on()
    hook.  That hook is only called once, in a mutex locked context, from
    qla2x00_beacon_store().

  - qla_nx.c: qla82xx_beacon_off(), bound to isp_operations ->beacon_off()
    hook.  Like ->beacon_on(), it's only called once, in a mutex locked
    context, from qla2x00_beacon_store().

  - qla_nx.c: qla82xx_fw_dump(), calls qla2x00_wait_for_chip_reset(), which
    has msleep() in a loop. It is bound to isp_operations ->fw_dump()
    hook. That hook *is* called from atomic context at qla_isr.c by
    multiple interrupt handlers. Nonetheless, it's other controllers
    interrupt handlers, and not the qla82xx.

  - qla82xx_msix_default() and qla82xx_msix_rsp_q() call
    qla24xx_process_response_queue() which doesn't implement the firmware
    dumping.

  - qla_attr.c: qla2x00_sysfs_write_fw_dump(), and
    qla2x00_sysfs_write_reset(), process-context sysfs ->write() hooks.

  - qla_os.c: qla2x00_probe_one(). PCI ->probe(), process context.

  - qla_os.c: qla2x00_clear_drv_active(), called solely from
    qla2x00_remove_one(), which is PCI ->remove() hook, process context.

  - qla_os.c: qla2x00_do_dpc(), kthread function, process context.

Remove the in_interrupt() check. Change qla82xx_idc_lock() specification to
a purely process-context function. Mark it with "Context: task, might
sleep".

Change qla82xx_idc_lock() implementation to sleep 100ms, instead of a
schedule(), for each spin. This is more deterministic, and it matches the
other qla models idc_lock() functions.

Link: https://lore.kernel.org/r/20201126132952.2287996-5-bigeasy@linutronix.de
Cc: Nilesh Javali <njavali@marvell.com>
Cc: <GR-QLogic-Storage-Upstream@marvell.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Ahmed S. Darwish <a.darwish@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

See also upstream commit 8ac246bdd07a0f948f0e33eb4797bd2645cd8224.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9288 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 23:31:01 +00:00
Bart Van Assche
7579ad8980 qla2x00t-32gbit: Move sess cmd list/lock to driver
Except for debug output in the shutdown path, tcm_qla2xxx is the only
driver using the se_session sess_cmd_list. Move the list to that driver to
facilitate removing the sess_cmd_lock from the main I/O path for the rest
of the drivers.

Link: https://lore.kernel.org/r/1604257174-4524-6-git-send-email-michael.christie@oracle.com
Cc: Nilesh Javali <njavali@marvell.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

See also upstream commit 605e74025f953b995a3a241ead43bde71c1c99b5.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9287 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 23:28:43 +00:00
Bart Van Assche
ab09b4f3c3 qla2x00t-32gbit: Drop TARGET_SCF_LOOKUP_LUN_FROM_TAG
Only the __qlt_24xx_handle_abts() code path does not know the LUN for an
abort and it uses the TARGET_SCF_LOOKUP_LUN_FROM_TAG flag to have LIO core
look it up. LIO uses target_lookup_lun_from_tag to go from cmd tag to LUN
for the driver. However, qla2xxx has a tcm_qla2xxx_find_cmd_by_tag() which
does almost the same thing as the LIO helper (it finds the cmd but does not
return the LUN). This patch has qla2xxx use its internal helper.

Link: https://lore.kernel.org/r/1604257174-4524-4-git-send-email-michael.christie@oracle.com
Cc: Nilesh Javali <njavali@marvell.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

See also upstream commit 8f394da36a361cbe0e1e8b1d4213e5598c8095ac.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9286 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 23:24:14 +00:00
Bart Van Assche
be4657525b qla2x00t-32gbit: remove incorrect sparse #ifdef
The code to try to shut up sparse warnings about questionable locking
didn't shut up sparse: it made the result not parse as valid C at all,
since the end result now has a label with no statement.

The proper fix is to just always lock the hardware, the same way Bart
did in commit 8ae178760b23 ("scsi: qla2xxx: Simplify the functions for
dumping firmware").  That avoids the whole problem with having locking
that is not statically obvious.

But in the meantime, just remove the incorrect attempt at trying to
avoid a sparse warning that just made things worse.

This was exposed by commit 3e6efab865ac ("scsi: qla2xxx: Fix reset of
MPI firmware"), very similarly to how commit cbb01c2f2f63 ("scsi:
qla2xxx: Fix MPI failure AEN (8200) handling") exposed the same problem
in another place, and caused that commit 8ae178760b23.

Please don't add code to just shut up sparse without actually fixing
what sparse complains about.

Reported-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Cc: Bart Van Assche <bvanassche@acm.org>
Cc: Arun Easi <aeasi@marvell.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

See also upstream commit 4525c8781ec0701ce824e8bd379ae1b129e26568.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9285 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 23:20:19 +00:00
Bart Van Assche
c734b8e0d0 qla2x00t-32gbit: Remove unneeded break statements
A break is not needed if it is preceded by a return or goto.

Link: https://lore.kernel.org/r/20201019142333.16584-1-trix@redhat.com
Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

See also upstream commit 170b7d2de29e6239b8dbc63a88de1fa9789b0d8d.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9284 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 23:14:29 +00:00
Bart Van Assche
9c90f88f1d qla2x00t-32gbit: Return EBUSY on fcport deletion
When the fcport is about to be deleted we should return EBUSY instead of
ENODEV. Only for EBUSY will the request be requeued in a multipath setup.

Also return EBUSY when the firmware has not yet started to avoid dropping
the request.

Link: https://lore.kernel.org/r/20201014073048.36219-1-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>

See also upstream commit 98f9d33c5d0d779e6c96a4a8ac995085b11924f0.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9283 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 23:13:42 +00:00
Bart Van Assche
ca057f9e48 qla2x00t-32gbit: Fix return of uninitialized value in rval
A previous change removed the initialization of rval and there is now an
error where an uninitialized rval is being returned on an error return
path. Fix this by returning -ENODEV.

Link: https://lore.kernel.org/r/20201008183239.200358-1-colin.king@canonical.com
Fixes: b994718760fa ("scsi: qla2xxx: Use constant when it is known")
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Acked-by: Pavel Machek (CIP) <pavel@denx.de>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Addresses-Coverity: ("Uninitialized scalar variable")

See also upstream commit 1ef16a407f544408d3559e4de2ed05591df4da75.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9282 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 23:12:34 +00:00
Bart Van Assche
0b29c0e5d8 qla2x00t-32gbit: Convert to DEFINE_SHOW_ATTRIBUTE
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Link: https://lore.kernel.org/r/20200919025202.17531-1-miaoqinglang@huawei.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Acked-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

See also upstream commit 5e7e6472eda90433b251566755533cf1e9c2e522.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9281 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 23:10:25 +00:00
Bart Van Assche
847600bbba qla2x00t-32gbit: Initialize variable in qla8044_poll_reg()
clang static analysis reports this problem:

qla_nx2.c:694:3: warning: 6th function call argument is
  an uninitialized value
        ql_log(ql_log_fatal, vha, 0xb090,
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In qla8044_poll_reg(), when reading the reg fails, the error is reported by
reusing the timeout error reporter.  Because the value is unset, a garbage
value will be reported.  Initialize the value.

Link: https://lore.kernel.org/r/20201005144544.25335-1-trix@redhat.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

See also upstream commit 21a6cd48bb483e16703f4e4415ad2e9e3c71a5dd.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9280 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 23:09:46 +00:00
Bart Van Assche
ca0e0c811e qla2x00t-32gbit: Do not consume srb greedily
qla2xx_process_get_sp_from_handle() will clear the slot in which the
current srb is stored. As a result it can't be used in
qla24xx_process_mbx_iocb_response() to check for consistency and later
again in qla24xx_mbx_iocb_entry().

Move the consistency check directly into qla24xx_mbx_iocb_entry() and avoid
the double call or any open coding of the
qla2xx_process_get_sp_from_handle() functionality.

Link: https://lore.kernel.org/r/20200929073802.18770-1-dwagner@suse.de
Fixes: 31a3271ff11b ("scsi: qla2xxx: Handle incorrect entry_type entries")
Reviewed-by: Arun Easi <aeasi@marvell.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

See also upstream commit 657ed8a8a61b15eba70f7c4e2b61f643cf1ba91f.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9279 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 23:08:59 +00:00
Bart Van Assche
f25d0e8996 qla2x00t-32gbit: Use constant when it is known
Directly return constant when it is known to make code easier to
understand.

Link: https://lore.kernel.org/r/20200921112340.GA19336@duo.ucw.cz
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Pavel Machek (CIP) <pavel@denx.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

See also upstream commit b994718760fa6de431ee7504ca4553536c77ee43.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9278 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 23:08:08 +00:00
Bart Van Assche
08aaacda29 qla2x00t-32gbit: Fix inconsistent format argument type in qla_dbg.c
Fix the following warning:

[drivers/scsi/qla2xxx/qla_dbg.c:2451]: (warning) %ld in format string (no. 4)
	requires 'long' but the argument type is 'unsigned long'.

Link: https://lore.kernel.org/r/20200930022515.2862532-4-yebin10@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Ye Bin <yebin10@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

See also upstream commit 72e813d9a1b7a0a6dc6b27b563c389fbdb50cee2.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9277 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 23:07:16 +00:00
Bart Van Assche
911051bdc2 qla2x00t-32gbit: Fix inconsistent format argument type in qla_os.c
Fix the following warnings:

[drivers/scsi/qla2xxx/qla_os.c:4882]: (warning) %ld in format string (no. 2)
	requires 'long' but the argument type is 'unsigned long'.
[drivers/scsi/qla2xxx/qla_os.c:5011]: (warning) %ld in format string (no. 1)
	requires 'long' but the argument type is 'unsigned long'.

Link: https://lore.kernel.org/r/20200930022515.2862532-3-yebin10@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Ye Bin <yebin10@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

See also upstream commit 250bd00923c72c846092271a9e51ee373db081b6.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9276 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 23:06:30 +00:00
Bart Van Assche
480e079d69 qla2x00t-32gbit: Update version to 10.02.00.103-k
Link: https://lore.kernel.org/r/20200929102152.32278-8-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

See also upstream commit 718c2fe92b208415fa76550975dc5d7708448f7c.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9275 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 23:05:16 +00:00
Bart Van Assche
01a80a8851 qla2x00t-32gbit: Fix point-to-point (N2N) device discovery issue
Driver was using a shorter timeout waiting for PLOGI from the peer in
point-to-point configurations. Some devices takes some time (~4 seconds) to
initiate the PLOGI. This peer initiating PLOGI is when the peer has a
higher P-WWN.

Increase the wait time based on N2N R_A_TOV.

Link: https://lore.kernel.org/r/20200929102152.32278-7-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>

See also upstream commit 94eda2717826015a80ca271394c4378747de8936.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9274 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 23:04:28 +00:00
Bart Van Assche
9a1b2c10e2 qla2x00t-32gbit: Fix crash on session cleanup with unload
On unload, session cleanup prematurely gave the signal for driver unload
path to advance.

Link: https://lore.kernel.org/r/20200929102152.32278-6-njavali@marvell.com
Fixes: 726b85487067 ("qla2xxx: Add framework for async fabric discovery")
Cc: stable@vger.kernel.org
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>

See also upstream commit 50457dab670f396557e60c07f086358460876353.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9273 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 23:03:30 +00:00
Bart Van Assche
71746d0d0f qla2x00t-32gbit: Fix reset of MPI firmware
Normally, the MPI firmware is reset when an MPI dump is collected.  If an
unsaved MPI dump exists in the driver, though, an alternate mechanism is
used. This mechanism, which was not fully correct, is not recommended and
instead an MPI dump template walk is suggested to perform the MPI reset.

To allow for the MPI dump template walk, extra space is reserved in the MPI
dump buffer which gets used only when there is already an MPI dump in
place.

Link: https://lore.kernel.org/r/20200929102152.32278-5-njavali@marvell.com
Fixes: cbb01c2f2f63 ("scsi: qla2xxx: Fix MPI failure AEN (8200) handling")
Cc: stable@vger.kernel.org
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>

See also upstream commit 3e6efab865ac943f4ec43913eb665695737112b0.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9272 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 23:02:39 +00:00
Bart Van Assche
6a5bbac38a qla2x00t-32gbit: Fix MPI reset needed message
When printing the message:

  "MPI Heartbeat stop. MPI reset is not needed.."

..the wrong register was checked leading to always printing that MPI reset
is not needed, even when it is needed. Fix the MPI reset message.

Link: https://lore.kernel.org/r/20200929102152.32278-4-njavali@marvell.com
Fixes: cbb01c2f2f63 ("scsi: qla2xxx: Fix MPI failure AEN (8200) handling")
Cc: stable@vger.kernel.org
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>

See also upstream commit 7a6cdbd5e87515ebf6231b762ad903c7cff87b9c.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9271 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 23:01:40 +00:00
Bart Van Assche
fa9bf15340 qla2x00t-32gbit: Fix buffer-buffer credit extraction error
Current code uses wrong mailbox option to extract bbc from firmware. This
field is nested inside of PLOGI payload.  Extract bbc from PLOGI template
payload.

Link: https://lore.kernel.org/r/20200929102152.32278-3-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>

See also upstream commit 44f5a37d1e3e4e392412318666f8477601ae3024.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9270 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 23:00:18 +00:00
Bart Van Assche
f78ec93f05 qla2x00t-32gbit: Correct the check for sscanf() return value
Since the version string has been modified, sscanf() returns 4 instead of
6.

Link: https://lore.kernel.org/r/20200929102152.32278-2-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

See also upstream commit 7dc0f671d89c03db95db3d4cd57257790d7a4b80.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9269 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 22:59:11 +00:00
Bart Van Assche
411c5b0e1b qla2x00t-32gbit: Update version to 10.02.00.102-k
Update internal driver version and remove module version macro.

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

See also upstream commit 767c8457b729e774f5a4646f60a0598ab868c798.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9268 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 22:58:16 +00:00
Bart Van Assche
4e99fc582f qla2x00t-32gbit: Add SLER and PI control support
BIT_13 of extended FW attribute informs about NVMe-2 support.  Set BIT_15
of special feature control block for enabling SLER in FW.  Set bit 8 (SLER
supported) to 1 for the service parameter information when sending NVMe
PRLI request.  Set BIT_14 of special feature control block for enabling PI
Control in FW.  Driver should set bit 9 (PI Control supported) to 1 for the
service parameter information when sending NVMe PRLI request.  Set BIT_13
for NVMe Async events.

Link: https://lore.kernel.org/r/20200904045128.23631-13-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

See also upstream commit cf3c54fb49a4eb5b5b83ddab0b25df47b2e958af.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9267 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 22:57:26 +00:00
Bart Van Assche
49f618cea5 qla2x00t-32gbit: Add IOCB resource tracking
This patch tracks number of IOCB resources used in the I/O fast path. If
the number of used IOCBs reach a high water limit, driver would return the
I/O as busy and let upper layer retry. This prevents over subscription of
IOCB resources where any future error recovery command is unable to cut
through.  Enable IOCB throttling by default.

Link: https://lore.kernel.org/r/20200904045128.23631-12-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Quinn Tran <qutran@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 upstream commit 89c72f4245a8510ffdb0d1980944210b8bc6e49f.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9266 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 22:56:20 +00:00
Bart Van Assche
dc06ae2b08 qla2x00t-32gbit: Add rport fields in debugfs
This patch adds rport fields in debugfs.

Link: https://lore.kernel.org/r/20200904045128.23631-11-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>

See also upstream commit 6152d20fa6703cf364253efc4eab31151558cb01.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9265 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 22:54:58 +00:00
Bart Van Assche
51c390f09d qla2x00t-32gbit: Make tgt_port_database available in initiator mode
tgt_port_database data is today exported only in target mode, allow it to
be shown in initiator mode as well.

Link: https://lore.kernel.org/r/20200904045128.23631-10-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>

See also upstream commit 4e5a05d1ecd92cec59b11c33821b5407984df81d.
---
 drivers/scsi/qla2xxx/qla_dfs.c | 64 +++++++++++++++++-----------------
 1 file changed, 32 insertions(+), 32 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c
index 616ce891818d..1e9db568aee3 100644
--- a/drivers/scsi/qla2xxx/qla_dfs.c
+++ b/drivers/scsi/qla2xxx/qla_dfs.c
@@ -138,51 +138,51 @@ qla2x00_dfs_tgt_port_database_show(struct seq_file *s, void *unused)
 {
 	scsi_qla_host_t *vha = s->private;
 	struct qla_hw_data *ha = vha->hw;
-	struct gid_list_info *gid_list, *gid;
+	struct gid_list_info *gid_list;
 	dma_addr_t gid_list_dma;
 	fc_port_t fc_port;
+	char *id_iter;
 	int rc, i;
 	uint16_t entries, loop_id;
-	struct qla_tgt *tgt = vha->vha_tgt.qla_tgt;
 
 	seq_printf(s, "%s\n", vha->host_str);
-	if (tgt) {
-		gid_list = dma_alloc_coherent(&ha->pdev->dev,
-		    qla2x00_gid_list_size(ha),
-		    &gid_list_dma, GFP_KERNEL);
-		if (!gid_list) {
-			ql_dbg(ql_dbg_user, vha, 0x7018,
-			    "DMA allocation failed for %u\n",
-			     qla2x00_gid_list_size(ha));
-			return 0;
-		}
+	gid_list = dma_alloc_coherent(&ha->pdev->dev,
+				      qla2x00_gid_list_size(ha),
+				      &gid_list_dma, GFP_KERNEL);
+	if (!gid_list) {
+		ql_dbg(ql_dbg_user, vha, 0x7018,
+		       "DMA allocation failed for %u\n",
+		       qla2x00_gid_list_size(ha));
+		return 0;
+	}
 
-		rc = qla24xx_gidlist_wait(vha, gid_list, gid_list_dma,
-		    &entries);
-		if (rc != QLA_SUCCESS)
-			goto out_free_id_list;
+	rc = qla24xx_gidlist_wait(vha, gid_list, gid_list_dma,
+				  &entries);
+	if (rc != QLA_SUCCESS)
+		goto out_free_id_list;
 
-		gid = gid_list;
+	id_iter = (char *)gid_list;
 
-		seq_puts(s, "Port Name	Port ID 	Loop ID\n");
+	seq_puts(s, "Port Name	Port ID		Loop ID\n");
 
-		for (i = 0; i < entries; i++) {
-			loop_id = le16_to_cpu(gid->loop_id);
-			memset(&fc_port, 0, sizeof(fc_port_t));
+	for (i = 0; i < entries; i++) {
+		struct gid_list_info *gid =
+			(struct gid_list_info *)id_iter;
+		loop_id = le16_to_cpu(gid->loop_id);
+		memset(&fc_port, 0, sizeof(fc_port_t));
 
-			fc_port.loop_id = loop_id;
+		fc_port.loop_id = loop_id;
 
-			rc = qla24xx_gpdb_wait(vha, &fc_port, 0);
-			seq_printf(s, "%8phC  %02x%02x%02x  %d\n",
-				fc_port.port_name, fc_port.d_id.b.domain,
-				fc_port.d_id.b.area, fc_port.d_id.b.al_pa,
-				fc_port.loop_id);
-			gid = (void *)gid + ha->gid_list_info_size;
-		}
-out_free_id_list:
-		dma_free_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha),
-		    gid_list, gid_list_dma);
+		rc = qla24xx_gpdb_wait(vha, &fc_port, 0);
+		seq_printf(s, "%8phC  %02x%02x%02x  %d\n",
+			   fc_port.port_name, fc_port.d_id.b.domain,
+			   fc_port.d_id.b.area, fc_port.d_id.b.al_pa,
+			   fc_port.loop_id);
+		id_iter += ha->gid_list_info_size;
 	}
+out_free_id_list:
+	dma_free_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha),
+			  gid_list, gid_list_dma);
 
 	return 0;
 }



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9264 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 22:54:00 +00:00
Bart Van Assche
e5b56feaef qla2x00t-32gbit: Fix I/O errors during LIP reset tests
In .fcp_io(), returning ENODEV as soon as remote port delete has started
can cause I/O errors. Fix this by returning EBUSY until the remote port
delete finishes.

Link: https://lore.kernel.org/r/20200904045128.23631-9-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>

See also upstream commit a35f87bdcc0615c5a3a695d13dd1ccf827826368.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9263 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 22:53:12 +00:00
Bart Van Assche
3eb6d581ba qla2x00t-32gbit: Performance tweak
Move statistics fields from vha struct to qpair to reduce memory thrashing.

Link: https://lore.kernel.org/r/20200904045128.23631-8-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>

See also upstream commit 49db4d4e02aabcd4fa2f60142ef42e50fb2dd526.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9262 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 22:52:11 +00:00
Bart Van Assche
4aa1dc12c8 qla2x00t-32gbit: Fix memory size truncation
Memory size calculations for Extended Login used in hardware offload got
truncated. Fix this by changing definition of exlogin_size to use uint32_t.

Link: https://lore.kernel.org/r/20200904045128.23631-7-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>

See also upstream commit d38cb849e17a34637b97ce57c550ec70d63dd39a.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9261 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 22:48:59 +00:00
Bart Van Assche
9887b73dd2 qla2x00t-32gbit: Reduce duplicate code in reporting speed
Indicate correct speed for 16G Mezz card.

Link: https://lore.kernel.org/r/20200904045128.23631-6-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>

See also upstream commit d68930bae477e864e016aeb8d557f099b4636aac.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9260 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 20:10:28 +00:00
Bart Van Assche
fc2ae4183c qla2x00t-32gbit: Honor status qualifier in FCP_RSP per spec
FCP-4 (referred FCP-4 rev-2b) identifies the earlier known "retry delay
timer" field as "status qualifier", which is described in SAM-5 and later
specs. This fix makes appropriate driver side modifications to honor the
new definition. The SAM document referred was SAM-6 rev-5.

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

See also upstream commit 3aac0c0fde17d2fdb65c7840bdf057a681f1e035.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9259 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 20:09:19 +00:00
Bart Van Assche
f48aaeb800 qla2x00t-32gbit: Allow dev_loss_tmo setting for FC-NVMe devices
Add a remote port debugfs entry to get/set dev_loss_tmo for NVMe devices.

Link: https://lore.kernel.org/r/20200904045128.23631-4-njavali@marvell.com
Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

See also upstream commit 27c8aa5e1b069b7629e41bba83b522f99132a6b6.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9258 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-28 20:07:18 +00:00