[PATCH] scsi: lpfc: Switch memcpy_fromio() to __read32_copy()

2018-01-26 Thread Huacai Chen
In commit bc73905abf770192 ("[SCSI] lpfc 8.3.16: SLI Additions, updates, and code cleanup"), lpfc_memcpy_to_slim() have switched memcpy_toio() to __write32_copy() in order to prevent unaligned 64 bit copy. Recently, we found that lpfc_memcpy_from_slim() have similar issues, so let it switch memcpy_

Re: [PATCH 3/3] virtio_scsi: Implement 'native LUN' feature

2018-01-26 Thread Steffen Maier
On 12/18/2017 08:48 AM, Hannes Reinecke wrote: On 12/15/2017 07:17 PM, Steffen Maier wrote: On 12/14/2017 11:11 AM, Hannes Reinecke wrote: The 'native LUN' feature allows virtio-scsi to pass in the LUN numbers from the underlying storage directly, without having to modify the LUN number itself.

Re: [PATCH] scsi_debug: Use scsi-mq if it has been enabled

2018-01-26 Thread Bart Van Assche
On Fri, 2018-01-26 at 08:58 +0100, Christoph Hellwig wrote: > scsi_debug already always uses scsi-mq if enabled. The somewhat > misnamed sdebug_mq_active variable is only used for decoding > multiqueue tags. That being said the blk_mq_unique_tag* helpers > should be safe to use even without blk-m

[PATCH] scsi_debug: Simplify request tag decoding

2018-01-26 Thread Bart Van Assche
Since commit 64d513ac31bd ("scsi: use host wide tags by default") all SCSI requests have a tag, whether or not scsi-mq is enabled. Additionally, it is safe to use blk_mq_unique_tag() and blk_mq_unique_tag_to_hwq() for legacy SCSI queues. Since this means that the sdebug_mq_active variable is superf

Re: [PATCH 2/3] virtio-scsi: Add FC transport class

2018-01-26 Thread Steffen Maier
On 12/18/2017 09:31 AM, Hannes Reinecke wrote: On 12/15/2017 07:08 PM, Steffen Maier wrote: On 12/14/2017 11:11 AM, Hannes Reinecke wrote: When a device announces an 'FC' protocol we should be pulling in the FC transport class to have the rports etc setup correctly. It took some time for me t

Re: [PATCH 3/3] virtio_scsi: Implement 'native LUN' feature

2018-01-26 Thread Steffen Maier
On 01/26/2018 03:15 PM, Steffen Maier wrote: On 12/18/2017 08:48 AM, Hannes Reinecke wrote: On 12/15/2017 07:17 PM, Steffen Maier wrote: On 12/14/2017 11:11 AM, Hannes Reinecke wrote: @@ -524,10 +532,16 @@ static void virtio_scsi_init_hdr(struct virtio_device *vdev,     int t

Mishandling SCSI status CONDITION MET

2018-01-26 Thread Douglas Gilbert
Summary: CONDITION MET is a GOOD status but the mid-level logs it as if it were an error. If you scan recent SPC and SBC drafts you will find only two commands that yield the SCSI status CONDITION MET: PRE-FETCH(10) and PRE_FETCH(16). Those commands are like READ but don't return the data instead

Re: [PATCH] qla2xxx: Avoid triggering undefined behavior in qla2x00_mbx_completion()

2018-01-26 Thread Madhani, Himanshu
> On Jan 25, 2018, at 8:24 AM, Bart Van Assche wrote: > > A left shift must shift less than the bit width of the left argument. > Avoid triggering undefined behavior if ha->mbx_count == 32. > > This patch avoids that UBSAN reports the following complaint: > > UBSAN: Undefined behaviour in driv

[PATCH v2 12/19] lpfc: Indicate CONF support in NVMe PRLI

2018-01-26 Thread James Smart
Revise the NVME PRLI to indicate CONF support. Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_els.c | 3 ++- drivers/scsi/lpfc/lpfc_hw4.h | 6 +++--- drivers/scsi/lpfc/lpfc_nportdisc.c | 3 --- 3 files changed, 5 insertions(+), 7 deletions(-) diff

[PATCH v2 05/19] lpfc: Add WQ Full Logic for NVME Target

2018-01-26 Thread James Smart
I/O conditions on the nvme target may have the driver submitting to a full hardware wq. The hardware wq is a shared resource among all nvme controllers. When the driver hit a full wq, it failed the io posting back to the nvme-fc transport, which then escalated it into errors. Correct by maintainin

[PATCH v2 04/19] lpfc: correct debug counters for abort

2018-01-26 Thread James Smart
Existing code was using the wrong field for the completion status when comparing whether to increment abort statistics Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_nvmet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/l

[PATCH v2 02/19] lpfc: Increase CQ and WQ sizes for SCSI

2018-01-26 Thread James Smart
Increased CQ and WQ sizes for SCSI FCP, matching those used for NVMe development. Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc.h | 1 + drivers/scsi/lpfc/lpfc_hw4.h | 3 +++ drivers/scsi/lpfc/lpfc_init.c | 30 ++ drivers/s

[PATCH v2 03/19] lpfc: move placement of target destroy on driver detach

2018-01-26 Thread James Smart
Ensure nvme localports/targetports are torn down before dismantling the adapter sli interface on driver detachment. This aids leaving interfaces live while nvme may be making callbacks to abort it. Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_init.c | 14 +++

[PATCH v2 01/19] lpfc: Fix frequency of Release WQE CQEs

2018-01-26 Thread James Smart
The driver controls when the hardware sends completions that communicate consumption of elements from the WQ. This is done by setting a WQEC bit on a WQE. The current driver sets it on every Nth WQE posting. However, the driver isn't clearing the bit if the WQE is reused. Thus, if the queue depth

[PATCH v2 08/19] lpfc: Fix RQ empty firmware trap

2018-01-26 Thread James Smart
When nvme target deferred receive logic waits for exchange resources, the corresponding receive buffer is not replenished with the hardware. This can result in a lack of asynchronous receive buffer resources in the hardware, resulting in a "2885 Port Status Event: ... error 1=0x52004a01 ..." messag

[PATCH v2 11/19] lpfc: Fix issue_lip if link is disabled

2018-01-26 Thread James Smart
The driver ignored checks on whether the link should be kept administratively down after a link bounce. Correct the checks. Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_attr.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/scsi/lpfc/lpfc_at

[PATCH v2 00/19] lpfc updates for 11.4.0.7

2018-01-26 Thread James Smart
This patch set provides a number of fixes for the driver. The patches were cut against the Martin's 4.16/scsi-queue tree. There are no outside dependencies and are expected to be pulled via Martins tree. v2: respin patch 14 "lpfc: Validate adapter support for SRIU option" for snippet that

[PATCH v2 06/19] lpfc: Fix PRLI handling when topology type changes

2018-01-26 Thread James Smart
The lpfc driver does not discover a target when the topology changes from switched-fabric to direct-connect. The target rejects the PRLI from the initiator in direct-connect as the driver is using the old S_ID from the switched topology. The driver was inappropriately clearing the VP bit to regist

[PATCH v2 17/19] lpfc: Fix nonrecovery of NVME controller after cable swap.

2018-01-26 Thread James Smart
In a test that is doing large numbers of cable swaps on the target, the nvme controllers wouldn't reconnect. During the cable swaps, the targets n_port_id would change. This information was passed to the nvme-fc transport, in the new remoteport registration. However, the nvme-fc transport didn't u

[PATCH v2 07/19] lpfc: Fix IO failure during hba reset testing with nvme io.

2018-01-26 Thread James Smart
A stress test repeatedly resetting the adapter while performing io would eventually report I/O failures and missing nvme namespaces. The driver was setting the nvmefc_fcp_req->private pointer to NULL during the IO completion routine before upcalling done(). If the transport was also running an abo

[PATCH v2 19/19] lpfc: Update 11.4.0.7 modified files for 2018 Copyright

2018-01-26 Thread James Smart
Updated Copyright in files updated 11.4.0.7 Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc.h | 2 +- drivers/scsi/lpfc/lpfc_attr.c | 2 +- drivers/scsi/lpfc/lpfc_crtn.h | 2 +- drivers/scsi/lpfc/lpfc_els.c | 2 +- drivers/scsi/lpfc/lp

[PATCH v2 14/19] lpfc: Validate adapter support for SRIU option

2018-01-26 Thread James Smart
When using the special option to suppress the response iu, ensure the adapter fully supports the feature by checking feature flags from the adapter and validating the support when formatting the WQE. Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- v2: Add missing snippet that chang

[PATCH v2 15/19] lpfc: Fix header inclusion in lpfc_nvmet

2018-01-26 Thread James Smart
The driver was inappropriately pulling in the nvme host's nvme.h header. What it really needed was the standard header. Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_nvmet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/lpf

[PATCH v2 10/19] lpfc: Fix soft lockup in lpfc worker thread during LIP testing

2018-01-26 Thread James Smart
During link bounce testing in a point-to-point topology, the host may enter a soft lockup on the lpfc_worker thread: Call Trace: lpfc_work_done+0x1f3/0x1390 [lpfc] lpfc_do_work+0x16f/0x180 [lpfc] kthread+0xc7/0xe0 ret_from_fork+0x3f/0x70 The driver was simultaneously settin

[PATCH v2 16/19] lpfc: Treat SCSI Write operation Underruns as an error

2018-01-26 Thread James Smart
Currently, write underruns (mismatch of amount transferred vs scsi status and its residual) detected by the adapter are not being flagged as an error. Its expected the target controls the data transfer and would appropriately set the RSP values. Only read underruns are treated as errors. Revise t

[PATCH v2 09/19] lpfc: Allow set of maximum outstanding SCSI cmd limit for a target parameter

2018-01-26 Thread James Smart
Make the attribute writeable. Remove the ramp up to logic as its unnecessary, simply set depth. Add debug message if depth changed, possibly reducing limit, yet our outstanding count has yet to catch up with it. Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_a

[PATCH v2 18/19] lpfc: update driver version to 11.4.0.7

2018-01-26 Thread James Smart
Update the driver version to 11.4.0.7 Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h index c232bf0e8998..6f4092cb9

[PATCH v2 13/19] lpfc: Fix SCSI io host reset causing kernel crash

2018-01-26 Thread James Smart
During SCSI error handling escalation to host reset, the SCSI io routines were moved off the txcmplq, but the individual io's ON_CMPLQ flag wasn't cleared. Thus, a background thread saw the io and attempted to access it as if on the txcmplq. Clear the flag upon removal. Signed-off-by: Dick Kenne

[PATCH 02/13] lpfc: Rework sli4 doorbell infrastructure

2018-01-26 Thread James Smart
Up until now, all SLI-4 devices had the same doorbells at the same bar locations. With newer hardware, there are now independent EQ and CQ doorbells and the bar locations differ. Prepare the code for new hardwre by separating the eq/cq doorbell into separate components. The components can be set b

[PATCH 04/13] lpfc: Add push-to-adapter support to sli4

2018-01-26 Thread James Smart
New if_type=6 adapters support and additional BAR that provides apertures to allow direct WQE to adapter push support - termed Direct Packet Push (DPP). WQ creation differs slightly to ask for a WQ to be DPP-ized. When submitting a WQE to a DPP WQ, it is submitted to the host memory for the WQ norm

[PATCH 05/13] lpfc: Add PCI Ids for if_type=6 hardware

2018-01-26 Thread James Smart
Add PCI ids for the new G7 adapter Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_hw.h | 1 + drivers/scsi/lpfc/lpfc_ids.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h index bdc1f184f67a..d07

[PATCH 03/13] lpfc: Add SLI-4 if_type=6 support to the code base

2018-01-26 Thread James Smart
New hardware supports a SLI-4 interface, but with a new if_type variant of 6. If_type=6 has a different PCI BAR map, separate EQ/CQ doorbells, and some changes in doorbell formats. Add the changes for the if_type into headers, adapter initialization and control flows. Add new eq and cq handlers.

[PATCH 00/13] lpfc new hardware patches for 12.0.0.0

2018-01-26 Thread James Smart
This patch set adds support for Broadcom's new G7 product that supports G4G FC. The patches were cut against the Martin's 4.16/scsi-queue tree. The patches are dependent (layered on top of) the lpfc 11.4.0.7 patchset that was recently posted. See: https://www.spinics.net/lists/linux-scsi/msg116

[PATCH 07/13] lpfc: Add if_type=6 support for cycling valid bits

2018-01-26 Thread James Smart
Traditional SLI4 required the driver to clear Valid bits on EQEs and CQEs after consuming them. The new if_type=6 hardware will cycle the value for what is valid on each queue itteration. The driver no longer has to touch the valid bits. This also means all the cpu cache dirtying and perhaps flush

[PATCH 06/13] lpfc: Add 64G link speed support

2018-01-26 Thread James Smart
The G7 adapter supports 64G link speeds. Add support to the driver. In addition, a small cleanup to replace the odd bitmap logic with a switch case. Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc.h | 14 +++-- drivers/scsi/lpfc/lpfc_attr.c| 61

[PATCH 01/13] lpfc: Rework lpfc to allow different sli4 cq and eq handlers

2018-01-26 Thread James Smart
Up until now, an SLI-4 device had no variance in the way it handled its EQs and CQs. With newer hardware, there are now differences in doorbells and some differences in how entries are valid. Prepare the code for new hardwre by creating a sli4-based callout table that can be set based on if_type.

[PATCH 09/13] lpfc: Add embedded data pointers for enhanced performance

2018-01-26 Thread James Smart
The current driver isn't taking advantage of a performance hint whereby the initial data buffer descriptor can be placed in the WQE as well as the SGL. Add the logic to detect support for the feature and to use it when supported. Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drive

[PATCH 11/13] lpfc: Work around NVME cmd iu SGL type

2018-01-26 Thread James Smart
The hardware offload for NVME commands was created when the FC-NVME standard was setting SGL Descriptor Type to SGL Data Block Descriptor (0h) and SGL Descriptor Sub Type to Address (0h). A late change in NVMe-over-Fabrics obsoleted these values, creating a transport SGL descriptor type with new v

[PATCH 08/13] lpfc: Enable fw download on if_type=6 devices

2018-01-26 Thread James Smart
Current code is very explicit in what it allows to be downloaded. The driver checking prevented G7 firmware download. The driver checking is unnecessary as the device will validate what it receives. Revise the firmware download interface checking. Added a little debug support in case there is stil

[PATCH 10/13] lpfc: Fix nvme embedded io length on new hardware

2018-01-26 Thread James Smart
Newer hardware more strictly enforces buffer lenghts, causing an mis-set value to be identified. Older hardware won't catch it. The difference is benign on old hardware. Set the right embedded buffer length for nvme ios. Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/l

[PATCH 12/13] lpfc: update driver version to 12.0.0.0

2018-01-26 Thread James Smart
Update the driver version to 12.0.0.0 Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h index 3b04ecb17a38..830dc36ab

[PATCH 13/13] lpfc: Update 12.0.0.0 modified files for 2018 Copyright

2018-01-26 Thread James Smart
Updated Copyright in files updated 12.0.0.0 Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_bsg.c | 2 +- drivers/scsi/lpfc/lpfc_ct.c | 2 +- drivers/scsi/lpfc/lpfc_debugfs.c | 2 +- drivers/scsi/lpfc/lpfc_debugfs.h | 2 +- drivers/scsi/lpfc/lpfc_hw.h

[PATCH resend 0/6] Fix cdrom autoclose

2018-01-26 Thread Michal Suchanek
Hello, there is cdrom autoclose feature that is supposed to close the tray, wait for the disc to become ready, and then open the device. This used to work in ancient times. Then in old times there was a hack in util-linux which worked around the breakage which probably resulted from swi

Re: [PATCH resend 0/6] Fix cdrom autoclose

2018-01-26 Thread James Bottomley
On Fri, 2018-01-26 at 17:58 +0100, Michal Suchanek wrote: > First time I did not get any feedback for the patches. This is likely because no-one who might inspect the code saw the patches ... what list are they going to?  I'm on the block, scsi and ide mailing lists and I only saw a doc patch the

Re: [LSF/MM TOPIC] Patch Submission process and Handling Internal Conflict

2018-01-26 Thread Goldwyn Rodrigues
On 01/24/2018 01:05 PM, James Bottomley wrote: > I've got two community style topics, which should probably be discussed > in the plenary > > 1. Patch Submission Process > > Today we don't have a uniform patch submission process across Storage, > Filesystems and MM.  The question is should we (

[LSF/MM ATTEND] I would like to attend to discuss several matters

2018-01-26 Thread Lee Duncan
I am interested in attending to help discuss all things storage. In particular, I am very interested in the "Patch Submission process and Handling Internal Conflict" proposed by James, and in "Improving Asynchronous SCSI Disk Probing" proposed by Bart. Lastly, I am also interested in discussing b

Re: [PATCH 3/3] virtio_scsi: Implement 'native LUN' feature

2018-01-26 Thread Hannes Reinecke
On 01/26/2018 03:15 PM, Steffen Maier wrote: > On 12/18/2017 08:48 AM, Hannes Reinecke wrote: >> On 12/15/2017 07:17 PM, Steffen Maier wrote: >>> On 12/14/2017 11:11 AM, Hannes Reinecke wrote: The 'native LUN' feature allows virtio-scsi to pass in the LUN numbers from the underlying stora

[PATCH resend 2/6] cdrom: factor out common open_for_* code

2018-01-26 Thread Michal Suchanek
The open_for_audio and open_for_data copies are bitrotten in different ways already and will need to update the autoclose logic in both. Signed-off-by: Michal Suchanek --- drivers/cdrom/cdrom.c | 100 ++ 1 file changed, 36 insertions(+), 64 deletio