openwrt/staging/blogic.git
5 years agoscsi: remove the SCSI OSD library
Christoph Hellwig [Thu, 8 Nov 2018 08:28:20 +0000 (09:28 +0100)]
scsi: remove the SCSI OSD library

Now that all the users are gone the SCSI OSD library can be removed as
well.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: fs: remove exofs
Christoph Hellwig [Tue, 29 Jan 2019 08:32:30 +0000 (09:32 +0100)]
scsi: fs: remove exofs

This was an example for using the SCSI OSD protocol, which we're trying
to remove.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: bsg-lib: handle bidi requests without block layer help
Christoph Hellwig [Tue, 29 Jan 2019 08:32:03 +0000 (09:32 +0100)]
scsi: bsg-lib: handle bidi requests without block layer help

We can just stash away the second request in struct bsg_job instead of
using the block layer req->next_rq field, allowing for the eventual removal
of the latter.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: bsg: refactor bsg_ioctl
Christoph Hellwig [Fri, 9 Nov 2018 19:12:25 +0000 (20:12 +0100)]
scsi: bsg: refactor bsg_ioctl

Move all actual functionality into helpers, just leaving the dispatch in
this function.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Tested-by: Benjamin Block <bblock@linux.ibm.com>
Tested-by: Avri Altman <avri.altman@wdc.com>
Acked-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: mpt3sas: Update driver version to 27.102.00.00
Suganath Prabu S [Tue, 29 Jan 2019 12:14:43 +0000 (07:14 -0500)]
scsi: mpt3sas: Update driver version to 27.102.00.00

Updated driver version to 27.102.00.00 from 27.101.00.00.

Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: mpt3sas: Add support for ATLAS PCIe switch
Suganath Prabu S [Tue, 29 Jan 2019 12:14:42 +0000 (07:14 -0500)]
scsi: mpt3sas: Add support for ATLAS PCIe switch

Add Atlas PCIe Switch Management Port device PNPID,
Vendor Id: 0x1000
device Id: 0x00B2

This device is based on MPI 2.6 spec and it exposes one SES device to
accept management commands for the PCIe switch.

Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: mpt3sas: Add support for NVMe Switch Adapter
Suganath Prabu S [Tue, 29 Jan 2019 12:14:41 +0000 (07:14 -0500)]
scsi: mpt3sas: Add support for NVMe Switch Adapter

Added device ID for NVMe Switch Adapter (Ambrosia).
VID: 0x1000
DID: 0x02B1

Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: mpt3sas: Rename mpi endpoint device ID macro.
Suganath Prabu S [Tue, 29 Jan 2019 12:14:40 +0000 (07:14 -0500)]
scsi: mpt3sas: Rename mpi endpoint device ID macro.

MPI Endpoint is a PCIe switch based on MPI2.

Renaming device ID macro from MPI2_MFGPAGE_DEVID_SAS2308_MPI_EP to
MPI2_MFGPAGE_DEVID_SWITCH_MPI_EP.

Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: megaraid_sas: Add support for DEVICE_LIST DCMD in driver
Shivasharan S [Tue, 29 Jan 2019 09:38:14 +0000 (01:38 -0800)]
scsi: megaraid_sas: Add support for DEVICE_LIST DCMD in driver

This patch adds support for the new DEVICE_LIST DCMD.

Driver currently sends two separate DCMDs for getting the list of PDs and
LDs that are exposed to host.  The new DCMD provides a single interface to
get a list of both PDs and LDs that are exposed to the host.  Based on the
list of target IDs that are returned by this DCMD, driver will add the
devices (PD/LD) to SML.  Driver will check for FW support for this new DCMD
and based on the support will either send the new DCMD or will fall back to
the earlier method of sending two separate DCMDs for PD and LD list.

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: megaraid_sas: Rework device add code in AEN path
Shivasharan S [Tue, 29 Jan 2019 09:38:13 +0000 (01:38 -0800)]
scsi: megaraid_sas: Rework device add code in AEN path

In preparation of adding support for the DEVICE_LIST DCMD, this patch
refactors the code in the AEN event handling path.  Add new function to
update the PD and LD list in driver.  Move the code to scan PD and VD
channels into separate function.

Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: megaraid_sas: Rework code to get PD and LD list
Shivasharan S [Tue, 29 Jan 2019 09:38:12 +0000 (01:38 -0800)]
scsi: megaraid_sas: Rework code to get PD and LD list

During FW init, combine the code to get the PD and LD list from FW into a
single function.  This patch is in preparation for adding support for
HOST_DEVICE_LIST DCMD.

Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: MAINTAINERS: Update dwc driver maintainer to Pedro Sousa
Joao Pinto [Wed, 30 Jan 2019 17:48:13 +0000 (18:48 +0100)]
scsi: MAINTAINERS: Update dwc driver maintainer to Pedro Sousa

Currently I am managing the Synopsys drivers & tools team (full-time)
and so I am passing the DWC UFS driver maintenance to Pedro Sousa.

Signed-off-by: Joao Pinto <joao.pinto@synopsys.com>
Cc: Pedro Sousa <pedrom.sousa@synopsys.com>
Cc: Marc Gonzalez <marc.w.gonzalez@free.fr>
Cc: Alex Lemberg <Alex.Lemberg@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: MAINTAINERS: Add reviewers for UFS patches
Marc Gonzalez [Mon, 4 Feb 2019 12:11:10 +0000 (13:11 +0100)]
scsi: MAINTAINERS: Add reviewers for UFS patches

According to git log and the linux-scsi archives, Vinayak has been inactive
for several years. Removing him as maintainer will make the
get_maintainer.pl script generate an extensive list of recipients.  Add
three reviewers as well to vet future UFS patches.

Signed-off-by: Marc Gonzalez <marc.w.gonzalez@free.fr>
Acked-by: Joao Pinto <jpinto@synopsys.com>
Acked-by: Avri Altman <avri.altman@wdc.com>
Acked-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: aacraid: clean up some indentation and formatting issues
Colin Ian King [Sat, 2 Feb 2019 10:40:52 +0000 (10:40 +0000)]
scsi: aacraid: clean up some indentation and formatting issues

There are several issues with badly indented statements. Fix these
and clean up the formatting.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Mahesh Rajashekhara <mahesh.rajashekhara@microchip.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: sd: Improve sd_print_capacity()
Damien Le Moal [Wed, 30 Jan 2019 07:07:34 +0000 (16:07 +0900)]
scsi: sd: Improve sd_print_capacity()

There is no need to call twice string_get_size() when the capacity messages
are not going to be printed. Reverse the message output condition to return
early and avoid executing string_get_size() when it is not necessary.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: ufs: Print uic error history in time order
Stanley Chu [Mon, 28 Jan 2019 14:04:26 +0000 (22:04 +0800)]
scsi: ufs: Print uic error history in time order

uic errors are currently printed out of time order.

Make things more readable by printing logs in time order, and printing
"No record" if history is empty.

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Reviewed-by: Bean Huo <beanhuo@micron.com>
Tested-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target/iscsi: Simplify iscsit_handle_text_cmd()
Bart Van Assche [Fri, 25 Jan 2019 18:34:58 +0000 (10:34 -0800)]
scsi: target/iscsi: Simplify iscsit_handle_text_cmd()

Treat text_in and padding as a single buffer instead of two buffers.

Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target/iscsi: Simplify iscsit_dump_data_payload()
Bart Van Assche [Fri, 25 Jan 2019 18:34:57 +0000 (10:34 -0800)]
scsi: target/iscsi: Simplify iscsit_dump_data_payload()

Use a single loop to dump immediate data, padding and digest instead of
using separate rx_data() calls for each type of data.

Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target/iscsi: Avoid iscsit_release_commands_from_conn() deadlock
Bart Van Assche [Fri, 25 Jan 2019 18:34:56 +0000 (10:34 -0800)]
scsi: target/iscsi: Avoid iscsit_release_commands_from_conn() deadlock

When using SCSI passthrough in combination with the iSCSI target driver
then cmd->t_state_lock may be obtained from interrupt context. Hence, all
code that obtains cmd->t_state_lock from thread context must disable
interrupts first. This patch avoids that lockdep reports the following:

WARNING: inconsistent lock state
4.18.0-dbg+ #1 Not tainted
--------------------------------
inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-W} usage.
iscsi_ttx/1800 [HC1[1]:SC0[2]:HE0:SE0] takes:
000000006e7b0ceb (&(&cmd->t_state_lock)->rlock){?...}, at: target_complete_cmd+0x47/0x2c0 [target_core_mod]
{HARDIRQ-ON-W} state was registered at:
 lock_acquire+0xd2/0x260
 _raw_spin_lock+0x32/0x50
 iscsit_close_connection+0x97e/0x1020 [iscsi_target_mod]
 iscsit_take_action_for_connection_exit+0x108/0x200 [iscsi_target_mod]
 iscsi_target_rx_thread+0x180/0x190 [iscsi_target_mod]
 kthread+0x1cf/0x1f0
 ret_from_fork+0x24/0x30
irq event stamp: 1281
hardirqs last  enabled at (1279): [<ffffffff970ade79>] __local_bh_enable_ip+0xa9/0x160
hardirqs last disabled at (1281): [<ffffffff97a008a5>] interrupt_entry+0xb5/0xd0
softirqs last  enabled at (1278): [<ffffffff977cd9a1>] lock_sock_nested+0x51/0xc0
softirqs last disabled at (1280): [<ffffffffc07a6e04>] ip6_finish_output2+0x124/0xe40 [ipv6]

other info that might help us debug this:
Possible unsafe locking scenario:

      CPU0
      ----
 lock(&(&cmd->t_state_lock)->rlock);
 <Interrupt>
   lock(&(&cmd->t_state_lock)->rlock);

*** DEADLOCK ***

3 locks held by iscsi_ttx/1800:
*0: 00000000c3b711b7 (sk_lock-AF_INET6){+.+.}, at: tcp_sendmsg+0x1e/0x50
*1: 00000000fa81046f (rcu_read_lock){....}, at: inet6_csk_xmit+0xc7/0x2e0 [ipv6]
*2: 00000000c091d70d (rcu_read_lock_bh){....}, at: ip6_finish_output2+0x124/0xe40 [ipv6]

stack backtrace:
CPU: 0 PID: 1800 Comm: iscsi_ttx Not tainted 4.18.0-dbg+ #1
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.0.0-prebuilt.qemu-project.org 04/01/2014
Call Trace:
<IRQ>
dump_stack+0xa4/0xf5
print_usage_bug+0x25b/0x27b
mark_lock+0x70f/0x7b0
__lock_acquire+0xbc2/0x1b50
lock_acquire+0xd2/0x260
_raw_spin_lock_irqsave+0x4a/0x60
target_complete_cmd+0x47/0x2c0 [target_core_mod]
target_complete_cmd_with_length+0x70/0xa0 [target_core_mod]
pscsi_req_done+0x335/0x530 [target_core_pscsi]
__blk_mq_end_request+0xa5/0x140
scsi_end_request+0x112/0x320 [scsi_mod]
scsi_io_completion+0x183/0xa30 [scsi_mod]
scsi_finish_command+0x1c0/0x280 [scsi_mod]
scsi_softirq_done+0x19a/0x230 [scsi_mod]
__blk_mq_complete_request_remote+0x2f/0x40
flush_smp_call_function_queue+0x12a/0x220
generic_smp_call_function_single_interrupt+0x13/0x30
smp_call_function_single_interrupt+0x7a/0x350
call_function_single_interrupt+0xf/0x20
</IRQ>
RIP: 0010:__asan_load4+0x1e/0x80
debug_lockdep_rcu_enabled+0x26/0x40
ip6_finish_output2+0x15a/0xe40 [ipv6]
ip6_finish_output+0x308/0x440 [ipv6]
ip6_output+0x11d/0x3b0 [ipv6]
ip6_xmit+0x639/0xc50 [ipv6]
inet6_csk_xmit+0x198/0x2e0 [ipv6]
__tcp_transmit_skb+0xc1b/0x15b0
tcp_write_xmit+0x42e/0x1f20
__tcp_push_pending_frames+0x59/0x150
tcp_push+0x189/0x270
tcp_sendmsg_locked+0x7b9/0x1680
tcp_sendmsg+0x2c/0x50
inet_sendmsg+0x71/0x250
sock_sendmsg+0x4c/0x60
tx_data+0x12b/0x1f0 [iscsi_target_mod]
iscsit_send_tx_data+0x77/0xe0 [iscsi_target_mod]
iscsit_xmit_pdu+0x2c5/0x740 [iscsi_target_mod]
iscsit_response_queue+0x941/0xd40 [iscsi_target_mod]
iscsi_target_tx_thread+0x23b/0x350 [iscsi_target_mod]
kthread+0x1cf/0x1f0
ret_from_fork+0x24/0x30

Fixes: 064cdd2d91c2 ("target: Fix race between iscsi-target connection shutdown + ABORT_TASK")
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target/iscsi: Rename a function and a function pointer
Bart Van Assche [Fri, 25 Jan 2019 18:34:55 +0000 (10:34 -0800)]
scsi: target/iscsi: Rename a function and a function pointer

Having both a function and a function pointer member with the same
name (iscsit_release_cmd) is confusing. Hence rename the function pointer
member.

Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target/iscsi: Fix spelling of "unsolicited"
Bart Van Assche [Fri, 25 Jan 2019 18:34:54 +0000 (10:34 -0800)]
scsi: target/iscsi: Fix spelling of "unsolicited"

Change "unsoliticed" into "unsolicited".

Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target/iscsi: Convert comments about locking into runtime checks
Bart Van Assche [Fri, 25 Jan 2019 18:34:53 +0000 (10:34 -0800)]
scsi: target/iscsi: Convert comments about locking into runtime checks

Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target/iscsi: Remove an incorrect comment
Bart Van Assche [Fri, 25 Jan 2019 18:34:52 +0000 (10:34 -0800)]
scsi: target/iscsi: Remove an incorrect comment

The single iscsit_start_nopin_response_timer() caller does not hold any
locks. Hence remove the comment above this function.

Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: RDMA/srpt: Fix a credit leak for aborted commands
Bart Van Assche [Fri, 25 Jan 2019 18:34:51 +0000 (10:34 -0800)]
scsi: RDMA/srpt: Fix a credit leak for aborted commands

Make sure that the next time a response is sent to the initiator that the
credit it had allocated for the aborted request gets freed.

Cc: Doug Ledford <dledford@redhat.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Mike Christie <mchristi@redhat.com>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Christoph Hellwig <hch@lst.de>
Fixes: 131e6abc674e ("target: Add TFO->abort_task for aborted task resources release") # v3.15
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: RDMA/srpt: Rework I/O context allocation
Bart Van Assche [Fri, 25 Jan 2019 18:34:50 +0000 (10:34 -0800)]
scsi: RDMA/srpt: Rework I/O context allocation

Instead of maintaining a list of free I/O contexts, use an sbitmap data
structure to track which I/O contexts are in use and which are free. This
makes the ib_srpt driver more consistent with other LIO drivers.

Cc: Doug Ledford <dledford@redhat.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Mike Christie <mchristi@redhat.com>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: RDMA/srpt: Fix handling of TMF submission failure
Bart Van Assche [Fri, 25 Jan 2019 18:34:49 +0000 (10:34 -0800)]
scsi: RDMA/srpt: Fix handling of TMF submission failure

If submitting a TMF to the target core fails, send the "FUNCTION REJECTED"
response to the initiator.

Reviewed-by: Hannes Reinecke <hare@suse.com>
Cc: Doug Ledford <dledford@redhat.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: RDMA/srpt: Fix handling of command / TMF submission failure
Bart Van Assche [Fri, 25 Jan 2019 18:34:48 +0000 (10:34 -0800)]
scsi: RDMA/srpt: Fix handling of command / TMF submission failure

If submitting an SRP IU to the target core fails, send the SCSI response
"BUSY" to the initiator instead of not sending any response.

Reviewed-by: Hannes Reinecke <hare@suse.com>
Cc: Doug Ledford <dledford@redhat.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target/core: Add target_send_busy()
Bart Van Assche [Fri, 25 Jan 2019 18:34:47 +0000 (10:34 -0800)]
scsi: target/core: Add target_send_busy()

Introduce a function that sends the SCSI status "BUSY" back to the
initiator. The next patch will add a call to this function in the srpt
target driver.

Reviewed-by: Hannes Reinecke <hare@suse.com>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target/core: Inline transport_lun_remove_cmd()
Bart Van Assche [Fri, 25 Jan 2019 18:34:46 +0000 (10:34 -0800)]
scsi: target/core: Inline transport_lun_remove_cmd()

Remove the code that clears .se_lun from transport_cmd_check_stop_to_fabric()
such that the transport_lun_remove_cmd() call can be moved into
target_release_cmd_kref(). Because this guarantees that
transport_lun_remove_cmd() will be called exactly once, it is safe to change
the cmpxchg() call into a test of se_cmd.lun_ref_active. Inline
transport_lun_remove_cmd() because it is not worth to keep it as a separate
function.

Reviewed-by: Hannes Reinecke <hare@suse.com>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target/core: Simplify the LUN RESET implementation
Bart Van Assche [Fri, 25 Jan 2019 18:34:45 +0000 (10:34 -0800)]
scsi: target/core: Simplify the LUN RESET implementation

Due to the task management handling rework it is safe to wait for a TMF
that is not in the active state. Hence remove the CMD_T_ACTIVE test from
core_tmr_drain_tmr_list(). Additionally, call __target_check_io_state()
instead of open coding it.

Reviewed-by: Hannes Reinecke <hare@suse.com>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target/core: Remove several state tests from the TMF code
Bart Van Assche [Fri, 25 Jan 2019 18:34:44 +0000 (10:34 -0800)]
scsi: target/core: Remove several state tests from the TMF code

Whether or not a session is being torn down does not affect whether or not
SCSI commands are in the task set. Hence remove the "tearing down" checks
from the TMF code. The TRANSPORT_ISTATE_PROCESSING check is left out
because it is now safe to wait for a command that is in that state. The
CMD_T_PRE_EXECUTE is left out because abort processing is postponed until
after commands have left the pre-execute state since the patch that makes
TMF processing synchronous.

See also commit 1c21a48055a6 ("target: Avoid early CMD_T_PRE_EXECUTE
failures during ABORT_TASK").

Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target/core: Remove the write_pending_status() callback function
Bart Van Assche [Fri, 25 Jan 2019 18:34:43 +0000 (10:34 -0800)]
scsi: target/core: Remove the write_pending_status() callback function

Due to the patch that makes TMF handling synchronous the
write_pending_status() callback function is no longer called.  Hence remove
it.

Acked-by: Felipe Balbi <balbi@ti.com>
Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
Reviewed-by: Andy Grover <agrover@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Mike Christie <mchristi@redhat.com>
Cc: Himanshu Madhani <himanshu.madhani@qlogic.com>
Cc: Quinn Tran <quinn.tran@qlogic.com>
Cc: Saurav Kashyap <saurav.kashyap@qlogic.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Juergen Gross <jgross@suse.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: csiostor: Remove set but not used variable 'pln'
YueHaibing [Fri, 25 Jan 2019 01:57:19 +0000 (01:57 +0000)]
scsi: csiostor: Remove set but not used variable 'pln'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/scsi/csiostor/csio_attr.c: In function 'csio_fcoe_free_vnp':
drivers/scsi/csiostor/csio_attr.c:500:21: warning:
 variable 'pln' set but not used [-Wunused-but-set-variable]

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Varun Prakash <varun@chelsio.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Add new FC-NVMe enable BIT to enable FC-NVMe feature
Giridhar Malavali [Wed, 30 Jan 2019 17:50:44 +0000 (09:50 -0800)]
scsi: qla2xxx: Add new FC-NVMe enable BIT to enable FC-NVMe feature

This patch adds new BIT detection to enable FC-NVMe feature in the driver.

[mkp: fixed Giridhar's SoB]

Signed-off-by: Giridhar Malavali <gmalavali@marvell.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hisi_sas: Add missing seq_printf() call in hisi_sas_show_row_32()
John Garry [Fri, 25 Jan 2019 14:22:39 +0000 (22:22 +0800)]
scsi: hisi_sas: Add missing seq_printf() call in hisi_sas_show_row_32()

This call must have been missed when I reworked the debugfs feature for
upstreaming, so add it back.

Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hisi_sas: Fix to only call scsi_get_prot_op() for non-NULL scsi_cmnd
John Garry [Fri, 25 Jan 2019 14:22:38 +0000 (22:22 +0800)]
scsi: hisi_sas: Fix to only call scsi_get_prot_op() for non-NULL scsi_cmnd

A NULL-pointer dereference was introduced for TMF SSP commands from the
upstreaming reworking.

Fix this by relocating the scsi_get_prot_op() callsite.

Fixes: d6a9000b81be ("scsi: hisi_sas: Add support for DIF feature for v2 hw")
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hisi_sas: Some misc tidy-up
John Garry [Fri, 25 Jan 2019 14:22:37 +0000 (22:22 +0800)]
scsi: hisi_sas: Some misc tidy-up

Sparse detected some problems in the driver, so tidy them up.

Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hisi_sas: Correct memory allocation size for DQ debugfs
Luo Jiaxing [Fri, 25 Jan 2019 14:22:36 +0000 (22:22 +0800)]
scsi: hisi_sas: Correct memory allocation size for DQ debugfs

Some sizes we allocate for debugfs structure are incorrect, so fix them.

Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hisi_sas: Fix losing directly attached disk when hot-plug
Xiaofei Tan [Fri, 25 Jan 2019 14:22:35 +0000 (22:22 +0800)]
scsi: hisi_sas: Fix losing directly attached disk when hot-plug

Hot-plugging SAS wire of direct hard disk backplane may cause disk lost. We
have done this test with several types of SATA disk from different venders,
and only two models from Seagate has this problem, ST4000NM0035-1V4107 and
ST3000VM002-1ET166.

The root cause is that the disk doesn't send D2H frame after OOB finished.
SAS controller will issue phyup interrupt only when D2H frame is received,
otherwise, will be waiting there all the time.

When this issue happen, we can find the disk again with link reset.  To fix
this issue, we setup an timer after OOB finished. If the PHY is not up in
20s, do link reset. Notes: the 20s is an experience value.

Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hisi_sas: Reject setting programmed minimum linkrate > 1.5G
Luo Jiaxing [Fri, 25 Jan 2019 14:22:34 +0000 (22:22 +0800)]
scsi: hisi_sas: Reject setting programmed minimum linkrate > 1.5G

The SAS controller cannot support a programmed minimum linkrate of > 1.5G
(it will always negotiate to 1.5G at least), so just reject it.

This solves a strange situation where the PHY negotiated linkrate may be
less than the programmed minimum linkrate.

Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hisi_sas: Remove unused parameter of function hisi_sas_alloc()
Xiang Chen [Fri, 25 Jan 2019 14:22:33 +0000 (22:22 +0800)]
scsi: hisi_sas: Remove unused parameter of function hisi_sas_alloc()

In function hisi_sas_alloc(), parameter shost is not used, so remove it.

Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hisi_sas: remove the check of sas_dev status in hisi_sas_I_T_nexus_reset()
Xiang Chen [Fri, 25 Jan 2019 14:22:32 +0000 (22:22 +0800)]
scsi: hisi_sas: remove the check of sas_dev status in hisi_sas_I_T_nexus_reset()

When issing a hardreset to a SATA device when running IO, it is possible
that abnormal CQs of the device are returned. Then enter error handler, it
doesn't enter function hisi_sas_abort_task() as there is no timeout IO, and
it doesn't set device as HISI_SAS_DEV_EH. So when hardreset by libata
later, it actually doesn't issue hardreset as there is a check to judge
whether device is in error.

For this situation, actually need to hardreset the device to recover.
So remove the check of sas_dev status in hisi_sas_I_T_nexus_reset().

Before we add the check to avoid the endless loop of reset for
directly-attached SATA device at probe time, actually we flutter it for
it, so it is not necessary to add the check now.

Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hisi_sas: shutdown axi bus to avoid exception CQ returned
Xiang Chen [Fri, 25 Jan 2019 14:22:31 +0000 (22:22 +0800)]
scsi: hisi_sas: shutdown axi bus to avoid exception CQ returned

When injecting 2 bit ECC error, it will cause fatal AXI interrupts. Before
the recovery of SAS controller reset, the internal of SAS controller is in
error. If CQ interrupts return at the time, actually it is exception CQ
interrupt, and it may cause resource release in disorder.

To avoid the exception situation, shutdown AXI bus after fatal AXI
interrupt. In SAS controller reset, it will restart AXI bus. For later
version of v3 hw, hardware will shutdown AXI bus for this situation, so
just fix current ver of v3 hw.

Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hisi_sas: send primitive NOTIFY to SSP situation only
Xiang Chen [Fri, 25 Jan 2019 14:22:30 +0000 (22:22 +0800)]
scsi: hisi_sas: send primitive NOTIFY to SSP situation only

Send primitive NOTIFY to SSP situation only, or it causes underflow issue
when sending IO. Also rename hisi_sas_hw.sl_notify() to hisi_sas_hw.
sl_notify_ssp().

Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hisi_sas: Add debugfs ITCT file and add file operations
Luo Jiaxing [Fri, 25 Jan 2019 14:22:29 +0000 (22:22 +0800)]
scsi: hisi_sas: Add debugfs ITCT file and add file operations

This patch creates debugfs file for ITCT and adds file operations.

Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hisi_sas: Fix type casting and missing static qualifier in debugfs code
John Garry [Fri, 25 Jan 2019 14:22:28 +0000 (22:22 +0800)]
scsi: hisi_sas: Fix type casting and missing static qualifier in debugfs code

Sparse can detect some type casting issues in the debugfs code, so fix it
up.

Also a missing static qualifier is added to hisi_sas_debugfs_to_reg_name().

Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hisi_sas: No need to check return value of debugfs_create functions
John Garry [Fri, 25 Jan 2019 14:22:27 +0000 (22:22 +0800)]
scsi: hisi_sas: No need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the return
value. The function can work or not, but the code logic should never do
something different based on this.

Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: pcmcia: nsp_cs: Remove unnecessary parentheses
Nathan Chancellor [Mon, 10 Dec 2018 23:55:40 +0000 (16:55 -0700)]
scsi: pcmcia: nsp_cs: Remove unnecessary parentheses

Clang warns:

drivers/scsi/pcmcia/nsp_cs.c:1137:27: warning: equality comparison with
extraneous parentheses [-Wparentheses-equality]
                if ((tmpSC->SCp.Message == MSG_COMMAND_COMPLETE)) {
                     ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/pcmcia/nsp_cs.c:1137:27: note: remove extraneous
parentheses around the comparison to silence this warning
                if ((tmpSC->SCp.Message == MSG_COMMAND_COMPLETE)) {
                    ~                   ^                      ~
drivers/scsi/pcmcia/nsp_cs.c:1137:27: note: use '=' to turn this
equality comparison into an assignment
                if ((tmpSC->SCp.Message == MSG_COMMAND_COMPLETE)) {
                                        ^~
                                        =
1 warning generated.

Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: nsp32: Remove unnecessary self assignment in nsp32_set_sync_entry
Nathan Chancellor [Mon, 10 Dec 2018 23:51:56 +0000 (16:51 -0700)]
scsi: nsp32: Remove unnecessary self assignment in nsp32_set_sync_entry

Clang warns:

drivers/scsi/nsp32.c:2444:14: warning: explicitly assigning value of
variable of type 'unsigned char' to itself [-Wself-assign]
        offset      = offset;
        ~~~~~~      ^

Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Acked-by: GOTO Masanori <gotom@debian.or.jp>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: prefix header search paths with $(srctree)/
Masahiro Yamada [Fri, 25 Jan 2019 07:09:04 +0000 (16:09 +0900)]
scsi: prefix header search paths with $(srctree)/

Currently, the Kbuild core manipulates header search paths in a crazy way
[1].

To fix this mess, I want all Makefiles to add explicit $(srctree)/ to the
search paths in the srctree. Some Makefiles are already written in that
way, but not all. The goal of this work is to make the notation consistent,
and finally get rid of the gross hacks.

Having whitespaces after -I does not matter since commit 48f6e3cf5bc6
("kbuild: do not drop -I without parameter").

[1]: https://patchwork.kernel.org/patch/9632347/

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: remove unneeded header search paths
Masahiro Yamada [Fri, 25 Jan 2019 07:09:03 +0000 (16:09 +0900)]
scsi: remove unneeded header search paths

I was able to build without these extra header search paths.

Especially, the header search path -I. in kernel Makefiles is always
suspicious; it allows the compiler to search for headers in the top of
$(srctree), where obviously no header file exists.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: fnic: Remove set but not used variable 'vdev'
YueHaibing [Fri, 25 Jan 2019 02:00:14 +0000 (10:00 +0800)]
scsi: fnic: Remove set but not used variable 'vdev'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/scsi/fnic/vnic_wq.c: In function 'vnic_wq_alloc_bufs':
drivers/scsi/fnic/vnic_wq.c:50:19: warning:
 variable 'vdev' set but not used [-Wunused-but-set-variable]

drivers/scsi/fnic/vnic_rq.c: In function 'vnic_rq_alloc_bufs':
drivers/scsi/fnic/vnic_rq.c:30:19: warning:
 variable 'vdev' set but not used [-Wunused-but-set-variable]

Never used since introduction.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: sd: Protect against READ(6) or WRITE(6) with zero block transfer length
Bart Van Assche [Wed, 23 Jan 2019 19:12:37 +0000 (11:12 -0800)]
scsi: sd: Protect against READ(6) or WRITE(6) with zero block transfer length

Since the READ(6) and WRITE(6) commands interpret a zero in the transfer
length field in the CDB as 256 logical blocks, avoid submitting such
commands.

Cc: Douglas Gilbert <dgilbert@interlog.com>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Christoph Hellwig <hch@lst.de>
Reported-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Douglas Gilbert <dgilbert@interlog.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: libsas: Remove scsi_to_u32()
Bart Van Assche [Wed, 23 Jan 2019 19:08:05 +0000 (11:08 -0800)]
scsi: libsas: Remove scsi_to_u32()

Since the function scsi_to_u32() is identical to get_unaligned_be32(),
change all scsi_to_u32() calls into get_unaligned_be32() calls.

Cc: Jian Luo <luojian5@huawei.com>
Cc: John Garry <john.garry@huawei.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: John Garry <john.garry@huawei.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hpsa: clean up two indentation issues
Colin Ian King [Tue, 22 Jan 2019 15:18:30 +0000 (15:18 +0000)]
scsi: hpsa: clean up two indentation issues

There are two statements that are indented incorrectly. Fix these.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: no need to check return value of debugfs_create functions
Greg Kroah-Hartman [Tue, 22 Jan 2019 15:09:06 +0000 (16:09 +0100)]
scsi: qla2xxx: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the return
value.  The function can work or not, but the code logic should never do
something different based on this.

Cc: qla2xxx-upstream@qlogic.com
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qedf: no need to check return value of debugfs_create functions
Greg Kroah-Hartman [Tue, 22 Jan 2019 15:09:05 +0000 (16:09 +0100)]
scsi: qedf: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the return
value.  The function can work or not, but the code logic should never do
something different based on this.

Cc: QLogic-Storage-Upstream@cavium.com
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Manish Rangankar <mrangankar@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: no need to check return value of debugfs_create functions
Greg Kroah-Hartman [Tue, 22 Jan 2019 15:09:04 +0000 (16:09 +0100)]
scsi: lpfc: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the return
value.  The function can work or not, but the code logic should never do
something different based on this.

Cc: James Smart <james.smart@broadcom.com>
Cc: Dick Kennedy <dick.kennedy@broadcom.com>
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: snic: no need to check return value of debugfs_create functions
Greg Kroah-Hartman [Tue, 22 Jan 2019 15:09:03 +0000 (16:09 +0100)]
scsi: snic: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the return
value.  The function can work or not, but the code logic should never do
something different based on this.

Cc: Karan Tilak Kumar <kartilak@cisco.com>
Cc: Sesidhar Baddela <sebaddel@cisco.com>
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: fnic: no need to check return value of debugfs_create functions
Greg Kroah-Hartman [Tue, 22 Jan 2019 15:09:02 +0000 (16:09 +0100)]
scsi: fnic: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the return
value.  The function can work or not, but the code logic should never do
something different based on this.

Cc: Satish Kharat <satishkh@cisco.com>
Cc: Sesidhar Baddela <sebaddel@cisco.com>
Cc: Karan Tilak Kumar <kartilak@cisco.com>
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: csiostor: no need to check return value of debugfs_create functions
Greg Kroah-Hartman [Tue, 22 Jan 2019 15:09:01 +0000 (16:09 +0100)]
scsi: csiostor: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the return
value.  The function can work or not, but the code logic should never do
something different based on this.

Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Varun Prakash <varun@chelsio.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Cc: Oza Pawandeep <poza@codeaurora.org>
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: bfa: no need to check return value of debugfs_create functions
Greg Kroah-Hartman [Tue, 22 Jan 2019 15:09:00 +0000 (16:09 +0100)]
scsi: bfa: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the return
value.  The function can work or not, but the code logic should never do
something different based on this.

[mkp: removed unused label]

Cc: Anil Gurumurthy <anil.gurumurthy@qlogic.com>
Cc: Sudarsana Kalluru <sudarsana.kalluru@qlogic.com>
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: MAINTAINERS: Move FCoE to Hannes Reinecke
Johannes Thumshirn [Mon, 28 Jan 2019 11:06:34 +0000 (12:06 +0100)]
scsi: MAINTAINERS: Move FCoE to Hannes Reinecke

I'll be moving on to different things in the storage stack and Hannes
agreed to take over FCoE.

Cc: Hannes Reinecke <hare@suse.de>
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Acked-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: fcoe: remove unneeded fcoe_ctlr_destroy_store export
Greg Kroah-Hartman [Tue, 22 Jan 2019 14:28:18 +0000 (15:28 +0100)]
scsi: fcoe: remove unneeded fcoe_ctlr_destroy_store export

There's no need to export fcoe_ctlr_destroy_store as a symbol, so remove
the EXPORT_SYMBOL() line for it.

Cc: Johannes Thumshirn <jth@kernel.org>
Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: fcoe: convert to use BUS_ATTR_WO
Greg Kroah-Hartman [Tue, 22 Jan 2019 14:27:35 +0000 (15:27 +0100)]
scsi: fcoe: convert to use BUS_ATTR_WO

We are trying to get rid of BUS_ATTR() and the usage of that in the fcoe
driver can be trivially converted to use BUS_ATTR_WO(), so use that
instead.

Cc: Johannes Thumshirn <jth@kernel.org>
Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: arcmsr: Update driver version to v1.40.00.10-20190116
Ching Huang [Fri, 18 Jan 2019 03:01:49 +0000 (11:01 +0800)]
scsi: arcmsr: Update driver version to v1.40.00.10-20190116

From Ching Huang <ching2048@areca.com.tw>

Update driver version to v1.40.00.10-20190116.

Signed-off-by: Ching Huang <ching2048@areca.com.tw>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: arcmsr: Fix suspend/resume of ACB_ADAPTER_TYPE_B part 2
Ching Huang [Fri, 18 Jan 2019 02:58:51 +0000 (10:58 +0800)]
scsi: arcmsr: Fix suspend/resume of ACB_ADAPTER_TYPE_B part 2

From Ching Huang <ching2048@areca.com.tw>

For ACB_ADAPTER_TYPE_B controller, the read/write after hibernate and
resume may sometimes result in 'isr get an illegal ccb command' in
/var/log/messages. This patch fixes it.

Signed-off-by: Ching Huang <ching2048@areca.com.tw>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: arcmsr: Use dma_alloc_coherent to replace dma_zalloc_coherent
Ching Huang [Fri, 18 Jan 2019 02:53:41 +0000 (10:53 +0800)]
scsi: arcmsr: Use dma_alloc_coherent to replace dma_zalloc_coherent

From Ching Huang <ching2048@areca.com.tw>

dma_zalloc_coherent will be phased out. Use dma_alloc_coherent instead.

Signed-off-by: Ching Huang <ching2048@areca.com.tw>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: fnic: Update fnic driver version to 1.6.0.47
Satish Kharat [Fri, 18 Jan 2019 22:51:45 +0000 (14:51 -0800)]
scsi: fnic: Update fnic driver version to 1.6.0.47

Update fnic driver to version 1.6.0.47.

Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: fnic: Enable fnic devcmd2 interface
Satish Kharat [Fri, 18 Jan 2019 22:51:44 +0000 (14:51 -0800)]
scsi: fnic: Enable fnic devcmd2 interface

This patch adds changes to check if fnic devcmd2 interface is exported by
the firmware. If devcmd2 interfaces is exported, driver starts using it
else falls back to fnic devcmd1 interface.

Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: fnic: Adding devcmd2 init and posting interfaces
Satish Kharat [Fri, 18 Jan 2019 22:51:43 +0000 (14:51 -0800)]
scsi: fnic: Adding devcmd2 init and posting interfaces

This patch adds fnic devcmd2 interfaces for initialization and posting
commands to fw.

Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: fnic: Add devcmd2 initialization helpers
Satish Kharat [Fri, 18 Jan 2019 22:51:42 +0000 (14:51 -0800)]
scsi: fnic: Add devcmd2 initialization helpers

This patch adds the devcmd2 wq initalization and devcmd2 ring allocation
helper interfaces used by devcmd2 init.

[mkp: typos]
Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: fnic: fnic devcmd2 controller definitions
Satish Kharat [Fri, 18 Jan 2019 22:51:41 +0000 (14:51 -0800)]
scsi: fnic: fnic devcmd2 controller definitions

This patch adds the fnic devcmd2 controller definitions.

Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: fnic: fnic devcmd2 interface definitions
Satish Kharat [Fri, 18 Jan 2019 22:51:40 +0000 (14:51 -0800)]
scsi: fnic: fnic devcmd2 interface definitions

This patch adds the fnic devcmd2 command structre and the command result
structure definitions.

Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: fnic: Impose upper limit on max. # of CQs processed per intr
Satish Kharat [Tue, 15 Jan 2019 01:09:29 +0000 (17:09 -0800)]
scsi: fnic: Impose upper limit on max. # of CQs processed per intr

Impose an upper limit on the max number of CQ entries (corresponding to the
copy wq) processed in an interrupt.  Use module parameter to set the limit.

Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: fnic: RQ enable and then post descriptors
Satish Kharat [Tue, 15 Jan 2019 01:09:28 +0000 (17:09 -0800)]
scsi: fnic: RQ enable and then post descriptors

Do RQ enable before posting descriptor. This is needed for later hw
revisions.

Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: fnic: delaying vnic dev enable till after req intr
Satish Kharat [Tue, 15 Jan 2019 01:09:27 +0000 (17:09 -0800)]
scsi: fnic: delaying vnic dev enable till after req intr

Doing vnic_device_enable before this could cause interrupts to happen
before they are setup.

Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: fnic: Warn when calling done for IO not issued to fw
Satish Kharat [Tue, 15 Jan 2019 01:09:26 +0000 (17:09 -0800)]
scsi: fnic: Warn when calling done for IO not issued to fw

The change is to print warning when scsi done is called for an IO that has
not yet been issued to the fw. Also adding sc and tag to debug print when
IO is cleaned up.

Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: fnic: fnic stats for max CQs processed and ISR time
Satish Kharat [Tue, 15 Jan 2019 01:09:25 +0000 (17:09 -0800)]
scsi: fnic: fnic stats for max CQs processed and ISR time

This change is to add fnic stats for the max number of CQs (corresponding
to copy WQ) processed in a given interrupt, max time taken by the ISR.

Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: fnic: Add port speed stat to fnic debug stats
Satish Kharat [Tue, 15 Jan 2019 01:09:24 +0000 (17:09 -0800)]
scsi: fnic: Add port speed stat to fnic debug stats

This patch adds the current fnic port speed stat to fnic debug stats.

Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: fnic: use fnic_lock to guard fnic->state_flags
Satish Kharat [Tue, 15 Jan 2019 01:09:23 +0000 (17:09 -0800)]
scsi: fnic: use fnic_lock to guard fnic->state_flags

Need to use fnic_lock as well as host lock in that order to set state
flags.

[mkp: typos]
Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: fnic: vnic_rq_clean change BUG_ON to WARN_ON
Satish Kharat [Tue, 15 Jan 2019 01:09:22 +0000 (17:09 -0800)]
scsi: fnic: vnic_rq_clean change BUG_ON to WARN_ON

rq->ctrl not enabled when this is called is bad but not fatal and can
continue.

Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: fnic: change fnic queue depth to 256
Satish Kharat [Tue, 15 Jan 2019 01:09:21 +0000 (17:09 -0800)]
scsi: fnic: change fnic queue depth to 256

This patch changes the default lun queuedepth for fnic to 256.

Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: fnic: support to display 20G port speed
Satish Kharat [Tue, 15 Jan 2019 01:09:20 +0000 (17:09 -0800)]
scsi: fnic: support to display 20G port speed

This patch is to add fnic 20G port speed display in sysfs.

[mkp: typo]

Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: core: Remove an atomic instruction from the hot path
Bart Van Assche [Wed, 16 Jan 2019 00:50:03 +0000 (16:50 -0800)]
scsi: core: Remove an atomic instruction from the hot path

From scsi_init_command(), a function called by scsi_mq_prep_fn():

/* zero out the cmd, except for the embedded scsi_request */
memset((char *)cmd + sizeof(cmd->req), 0,
sizeof(*cmd) - sizeof(cmd->req) + dev->host->hostt->cmd_size);

In other words, scsi_mq_prep_fn() clears scsi_cmnd.flags. Hence move the
clear_bit() call into the else branch, the only branch in which this code
is necessary.

See also commit f1342709d18a ("scsi: Do not rely on blk-mq for double
completions").

Cc: Keith Busch <keith.busch@intel.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: sd: Rename 'SCpnt' into 'cmd'
Bart Van Assche [Wed, 16 Jan 2019 00:50:02 +0000 (16:50 -0800)]
scsi: sd: Rename 'SCpnt' into 'cmd'

This patch makes the source code more uniform and does not change any
functionality.

Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ bvanassche: extracted this patch from a larger patch ]
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: sd: Clean up sd_setup_read_write_cmnd()
Martin K. Petersen [Wed, 16 Jan 2019 00:50:01 +0000 (16:50 -0800)]
scsi: sd: Clean up sd_setup_read_write_cmnd()

Rework sd_setup_read_write_cmnd() so it becomes more readable. Put all the
sanity checking at the head of the function and sanitize the logged error
messages. Move the legacy SCSI logging calls to the end of the functions
and reduce conditional nesting.

Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ bvanassche: ported this patch from kernel v4.11 to kernel v5.0 ]
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: sd: Create helper functions for read/write commands
Martin K. Petersen [Wed, 16 Jan 2019 00:50:00 +0000 (16:50 -0800)]
scsi: sd: Create helper functions for read/write commands

Create a helper function for each of the 6, 10, 16 and 32-byte READ/WRITE
variants and use those when setting up reads and writes.

Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ bvanassche: ported this patch from kernel v4.11 to kernel v5.0 and made
  function names shorter. ]
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: sd: Simplify misaligned I/O check
Martin K. Petersen [Wed, 16 Jan 2019 00:49:59 +0000 (16:49 -0800)]
scsi: sd: Simplify misaligned I/O check

Avoid open coding the checks for the supported logical block sizes and use
a mask to check for misaligned I/O. Use our helper functions to scale lba
and block count.

Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ bvanassche: ported this patch from kernel v4.11 to kernel v5.0 ]
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: sd: Be consistent about blocks vs. sectors
Martin K. Petersen [Wed, 16 Jan 2019 00:49:58 +0000 (16:49 -0800)]
scsi: sd: Be consistent about blocks vs. sectors

We have had several bugs due mixing sector and logical block size
terminology. In the block layer, a sector is a 512-byte unit regardless of
the logical block size of the underlying device. But the term "sector" is
still widely used in sd.c when referring to logical block sized units.

We previously introduced helper functions such as sectors_to_logical() and
logical_to_sectors() to make the distinction clear. Use these to make the
code in sd.c consistent wrt. logical blocks and block layer sectors.

Use "lba" to describe a logical block address and "nr_blocks" when counting
logical blocks. SBC uses "TRANSFER LENGTH" to describe the latter but this
term was avoided to prevent confusion with the very similar DMA transfer
size (->transfersize) which is counted in bytes.

Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ bvanassche: ported this patch from kernel v4.11 to kernel v5.0 ]
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: sd: Remove a local variable
Bart Van Assche [Wed, 16 Jan 2019 00:49:57 +0000 (16:49 -0800)]
scsi: sd: Remove a local variable

This patch does not change any functionality.

Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ bvanassche: extracted this patch from a larger patch ]
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: ufs: Remove select of phy-qcom-ufs from ufs-qcom
Evan Green [Fri, 11 Jan 2019 23:31:59 +0000 (15:31 -0800)]
scsi: ufs: Remove select of phy-qcom-ufs from ufs-qcom

CONFIG_SCSI_UFS_QCOM selects CONFIG_PHY_QCOM_UFS, assuming that this was
the only possible PHY driver Qualcomm's UFS controller would use. But in
SDM845, the UFS driver is bundled into phy-qcom-qmp, and phy-qcom-ufs is
unused.

Remove the select, since for SDM845 it adds useless drivers to the build.

Signed-off-by: Evan Green <evgreen@chromium.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: doc: remove reference to tmscsim.txt file
Otto Sabart [Wed, 9 Jan 2019 19:08:56 +0000 (20:08 +0100)]
scsi: doc: remove reference to tmscsim.txt file

The tmscsim.txt doc file was removed in c121107d0f84.

Fixes: c121107d0f84 ("scsi: documentation: Obsolete documentation references")
Signed-off-by: Otto Sabart <ottosabart@seberm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: libsas: Support SATA PHY connection rate unmatch fixing during discovery
John Garry [Fri, 4 Jan 2019 16:01:28 +0000 (00:01 +0800)]
scsi: libsas: Support SATA PHY connection rate unmatch fixing during discovery

   +----------+             +----------+
   |          |             |          |
   |          |--- 3.0 G ---|          |--- 6.0 G --- SAS  disk
   |          |             |          |
   |          |--- 3.0 G ---|          |--- 6.0 G --- SAS  disk
   |initiator |             |          |
   | device   |--- 3.0 G ---| Expander |--- 6.0 G --- SAS  disk
   |          |             |          |
   |          |--- 3.0 G ---|          |--- 6.0 G --- SATA disk  -->failed to connect
   |          |             |          |
   |          |             |          |--- 6.0 G --- SATA disk  -->failed to connect
   |          |             |          |
   +----------+             +----------+

According to Serial Attached SCSI - 1.1 (SAS-1.1):
If an expander PHY attached to a SATA PHY is using a physical link rate
greater than the maximum connection rate supported by the pathway from an
STP initiator port, a management application client should use the SMP PHY
CONTROL function (see 10.4.3.10) to set the PROGRAMMED MAXIMUM PHYSICAL
LINK RATE field of the expander PHY to the maximum connection rate
supported by the pathway from that STP initiator port.

Currently libsas does not support checking if this condition occurs, nor
rectifying when it does.

Such a condition is not at all common, however it has been seen on some
pre-silicon environments where the initiator PHY only supports a 1.5 Gbit
maximum linkrate, mated with 12G expander PHYs and 3/6G SATA phy.

This patch adds support for checking and rectifying this condition during
initial device discovery only.

We do support checking min pathway connection rate during revalidation phase,
when new devices can be detected in the topology. However we do not
support in the case of the the user reprogramming PHY linkrates, such that
min pathway condition is not met/maintained.

A note on root port PHY rates:
The libsas root port PHY rates calculation is broken. Libsas sets the
rates (min, max, and current linkrate) of a root port to the same linkrate
of the first PHY member of that same port. In doing so, it assumes that
all other PHYs which subsequently join the port to have the same
negotiated linkrate, when they could actually be different.

In practice this doesn't happen, as initiator and expander PHYs are
normally initialised with consistent min/max linkrates.

This has not caused an issue so far, so leave alone for now.

Tested-by: Jian Luo <luojian5@huawei.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: libsas: Check SMP PHY control function result
John Garry [Fri, 4 Jan 2019 16:01:27 +0000 (00:01 +0800)]
scsi: libsas: Check SMP PHY control function result

Currently the SMP PHY control execution result is checked, however the
function result for the command is not.

As such, we may be missing all potential errors, like SMP FUNCTION FAILED,
INVALID REQUEST FRAME LENGTH, etc., meaning the PHY control request has
failed.

In some scenarios we need to ensure the function result is accepted, so add
a check for this.

Tested-by: Jian Luo <luojian5@huawei.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: libsas: Fix some indentation in libsas.h
John Garry [Fri, 4 Jan 2019 16:01:26 +0000 (00:01 +0800)]
scsi: libsas: Fix some indentation in libsas.h

Currently much indentation in this file is done with whitespaces instead of
tabs, which can make reading difficult, so fix this up.

Some other little minor tidy-up is done, but this file still has many other
checkpatch warnings (generally linelength > 80 or function arguments have
no identifier names).

All libsas code can be audited for checkpatch issues later.

Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Fix DMA error when the DIF sg buffer crosses 4GB boundary
Giridhar Malavali [Fri, 21 Dec 2018 17:33:45 +0000 (09:33 -0800)]
scsi: qla2xxx: Fix DMA error when the DIF sg buffer crosses 4GB boundary

When SGE buffer containing DIF information crosses 4G boundary, it results
in DMA error. This patch fixes this issue by calculating SGE buffer size
and if it crosses 4G boundary, driver will split it into multiple SGE
buffers to avoid DMA error.

Signed-off-by: Giridhar Malavali <gmalavali@marvell.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Add protection mask module parameters
Martin K. Petersen [Fri, 21 Dec 2018 17:33:44 +0000 (09:33 -0800)]
scsi: qla2xxx: Add protection mask module parameters

Allow user to selectively enable/disable DIF/DIX protection
capabilities mask.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: aic7xxx: aic79xx: mark expected switch fall-through
Gustavo A. R. Silva [Wed, 28 Nov 2018 04:26:19 +0000 (22:26 -0600)]
scsi: aic7xxx: aic79xx: mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where
we are expecting to fall through.

Notice that, in some cases, I replaced "FALLTHROUGH" with a "fall through"
annotation and then placed it at the bottom of the corresponding switch
case, which is what GCC is expecting to find.

Addresses-Coverity-ID: 114961 ("Missing break in switch")
Addresses-Coverity-ID: 114962 ("Missing break in switch")
Addresses-Coverity-ID: 114963 ("Missing break in switch")
Addresses-Coverity-ID: 114964 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: bfa: bfa_ioc: Mark expected switch fall-throughs
Gustavo A. R. Silva [Wed, 28 Nov 2018 04:27:32 +0000 (22:27 -0600)]
scsi: bfa: bfa_ioc: Mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where
we are expecting to fall through.

Notice that, in this particular case, I replaced "!!! fall through !!!"
comment with "fall through" annotations, which is what GCC is expecting to
find.

Addresses-Coverity-ID: 146155 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: Sudarsana Kalluru <Sudarsana.Kalluru@qlogic.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>