OSDN Git Service

android-x86/kernel.git
7 years agoscsi: libfc: Replace ->rport_flush_queue callback with function call
Hannes Reinecke [Tue, 18 Oct 2016 08:01:46 +0000 (10:01 +0200)]
scsi: libfc: Replace ->rport_flush_queue callback with function call

The ->rport_flush_queue callback only ever had a single
implementation, so we can as well call it directly and
drop the callback.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: Replace ->rport_recv_req callback with function call
Hannes Reinecke [Tue, 18 Oct 2016 08:01:45 +0000 (10:01 +0200)]
scsi: libfc: Replace ->rport_recv_req callback with function call

The ->rport_recv_req callback only ever had one implementation,
so we can as well call it directly and drop the callback.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: Replace ->rport_logoff callback with function call
Hannes Reinecke [Tue, 18 Oct 2016 08:01:44 +0000 (10:01 +0200)]
scsi: libfc: Replace ->rport_logoff callback with function call

The ->rport_logoff callback only ever had one implementation,
so we can as well call it directly and drop the callback.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Reviewed-by: Chad Dupuis <chad.dupuis@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: Replace ->rport_login callback with function call
Hannes Reinecke [Tue, 18 Oct 2016 08:01:43 +0000 (10:01 +0200)]
scsi: libfc: Replace ->rport_login callback with function call

The ->rport_login callback only ever had one implementation,
so we can as well call it directly and drop the callback.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: Replace ->rport_create callback with function call
Hannes Reinecke [Tue, 18 Oct 2016 08:01:42 +0000 (10:01 +0200)]
scsi: libfc: Replace ->rport_create callback with function call

The ->rport_create callback only ever had a single implementation,
so we can as well call it directly and drop the callback.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: scsi_transport_fc: rename 'fc_rport_create' to 'fc_remote_port_create'
Hannes Reinecke [Tue, 18 Oct 2016 08:01:41 +0000 (10:01 +0200)]
scsi: scsi_transport_fc: rename 'fc_rport_create' to 'fc_remote_port_create'

Required for the next patch.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: Replace ->rport_lookup callback with function call
Hannes Reinecke [Tue, 18 Oct 2016 08:01:40 +0000 (10:01 +0200)]
scsi: libfc: Replace ->rport_lookup callback with function call

The ->rport_lookup callback only ever had a single implementation,
so we can as well call it directly and drop the callback.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: Replace ->rport_destroy callback with function call
Hannes Reinecke [Tue, 18 Oct 2016 08:01:39 +0000 (10:01 +0200)]
scsi: libfc: Replace ->rport_destroy callback with function call

The ->rport_destroy callback only ever had one implementation,
so we can as well call it directly and drop the callback.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: Replace ->exch_seq_send callback with function call
Hannes Reinecke [Tue, 18 Oct 2016 08:01:38 +0000 (10:01 +0200)]
scsi: libfc: Replace ->exch_seq_send callback with function call

The ->exch_seq_send callback only ever had one implementation,
so we can call the function directly and drop the callback.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: Replace ->lport_recv with function call
Hannes Reinecke [Tue, 18 Oct 2016 08:01:37 +0000 (10:01 +0200)]
scsi: libfc: Replace ->lport_recv with function call

The ->lport_recv callback only ever had one implementation,
so call the function directly and remove the callback.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: Replace ->lport_reset callback with function call
Hannes Reinecke [Tue, 18 Oct 2016 08:01:36 +0000 (10:01 +0200)]
scsi: libfc: Replace ->lport_reset callback with function call

The ->lport_reset callback only ever had one implementation,
which already is exported. So remove it and use the function
directly.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: Replace ->seq_els_rsp_send callback with function call
Hannes Reinecke [Tue, 18 Oct 2016 08:01:35 +0000 (10:01 +0200)]
scsi: libfc: Replace ->seq_els_rsp_send callback with function call

The 'seq_els_rsp_send' callback only ever had one implementation,
so we might as well drop it and use the function directly.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: ibmvscsis: Issues from Dan Carpenter/Smatch
Michael Cyr [Thu, 13 Oct 2016 16:02:43 +0000 (11:02 -0500)]
scsi: ibmvscsis: Issues from Dan Carpenter/Smatch

Signed-off-by: Michael Cyr <mikecyr@us.ibm.com>
Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
Tested-by: Steven Royer <seroyer@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: ibmvscsis: Return correct partition name/# to client
Michael Cyr [Thu, 13 Oct 2016 16:02:42 +0000 (11:02 -0500)]
scsi: ibmvscsis: Return correct partition name/# to client

Signed-off-by: Michael Cyr <mikecyr@us.ibm.com>
Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
Tested-by: Steven Royer <seroyer@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: ibmvscsis: Clean up properly if target_submit_cmd/tmr fails
Michael Cyr [Thu, 13 Oct 2016 16:02:41 +0000 (11:02 -0500)]
scsi: ibmvscsis: Clean up properly if target_submit_cmd/tmr fails

Signed-off-by: Michael Cyr <mikecyr@us.ibm.com>
Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
Tested-by: Steven Royer <seroyer@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: ibmvscsis: Synchronize cmds at remove time
Michael Cyr [Thu, 13 Oct 2016 16:02:40 +0000 (11:02 -0500)]
scsi: ibmvscsis: Synchronize cmds at remove time

This patch adds code to disconnect from the client, which will make sure
any outstanding commands have been completed, before continuing on with
the remove operation.

Signed-off-by: Michael Cyr <mikecyr@us.ibm.com>
Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
Tested-by: Steven Royer <seroyer@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: ibmvscsis: Synchronize cmds at tpg_enable_store time
Michael Cyr [Thu, 13 Oct 2016 16:02:39 +0000 (11:02 -0500)]
scsi: ibmvscsis: Synchronize cmds at tpg_enable_store time

This patch changes the way the IBM vSCSI server driver manages its
Command/Response Queue (CRQ).  We used to register the CRQ with phyp at
probe time.  Now we wait until tpg_enable_store.  Similarly, when
tpg_enable_store is called to "disable" (i.e. the stored value is 0),
we unregister the queue with phyp.

One consquence to this is that we have no need for the PART_UP_WAIT_ENAB
state, since we can't get an Init Message from the client in our CRQ if
we're waiting to be enabled, since we haven't registered the queue yet.

Signed-off-by: Michael Cyr <mikecyr@us.ibm.com>
Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
Tested-by: Steven Royer <seroyer@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: ibmvscsis: Rearrange functions for future patches
Michael Cyr [Thu, 13 Oct 2016 16:02:38 +0000 (11:02 -0500)]
scsi: ibmvscsis: Rearrange functions for future patches

This patch reorders functions in a manner necessary for a follow-on
patch.  It also makes some minor styling changes (mostly removing extra
spaces) and fixes some typos.

There are no code changes in this patch, with one exception: due to the
reordering of the functions, I needed to explicitly declare a function
at the top of the file.  However, this will be removed in the next patch,
since the code requiring the predeclaration will be removed.

Signed-off-by: Michael Cyr <mikecyr@us.ibm.com>
Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
Tested-by: Steven Royer <seroyer@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: g_NCR5380: add HAS_IOPORT_MAP dependency
Arnd Bergmann [Tue, 18 Oct 2016 15:18:06 +0000 (17:18 +0200)]
scsi: g_NCR5380: add HAS_IOPORT_MAP dependency

The driver was changed to call ioport_map, which breaks platforms that
cannot provide this function:

drivers/scsi/g_NCR5380.o: In function `generic_NCR5380_init_one.constprop.0':
g_NCR5380.c:(.text.generic_NCR5380_init_one.constprop.0+0x388): undefined reference to `ioport_map'

This adds a Kconfig dependency.

Fixes: 04c40f82ccc5 ("scsi: g_NCR5380: Merge g_NCR5380 and g_NCR5380_mmio drivers")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: fcoe: Fixup missing initialisation in fcoe_dcb_create()
Hannes Reinecke [Tue, 18 Oct 2016 06:39:16 +0000 (08:39 +0200)]
scsi: fcoe: Fixup missing initialisation in fcoe_dcb_create()

Found by 0-day robot.

Fixes: a99ac6e715bc ("scsi: fcoe: set default TC priority")
Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: lpfc: Use %zd format string for size_t
Arnd Bergmann [Mon, 17 Oct 2016 12:35:46 +0000 (14:35 +0200)]
scsi: lpfc: Use %zd format string for size_t

A recent bugfix introduced a harmless warning in the lpfc driver:

drivers/scsi/lpfc/lpfc_init.c: In function 'lpfc_write_firmware':
drivers/scsi/lpfc/lpfc_logmsg.h:56:45: error: format '%ld' expects argument of type 'long int', but argument 9 has type 'size_t {aka const unsigned int}' [-Werror=format=]

'size_t' is always the same width as 'long' in the kernel, but the
compiler doesn't know that. The %z modifier is what the standard expects
to be used here, and this shuts up the warning.

Fixes: 679053c651fb ("scsi: lpfc: Fix fw download on SLI-4 FC adapters")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Acked-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: fcoe: filter out frames from invalid vlans
Hannes Reinecke [Thu, 13 Oct 2016 13:11:00 +0000 (15:11 +0200)]
scsi: fcoe: filter out frames from invalid vlans

Any multicase address is set on all interfaces, the base interface
and any VLAN interfaces on top of this. So we might receive frames
which are not destined for us.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: fcoe: correct sending FIP VLAN packets on VLAN 0
Hannes Reinecke [Thu, 13 Oct 2016 13:10:59 +0000 (15:10 +0200)]
scsi: fcoe: correct sending FIP VLAN packets on VLAN 0

The FIP VLAN frame consists of an ethernet header followed
by the FIP VLAN frame, so we need to skip the ethernet header
if we want to check the FIP opcode.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: fcoe: FIP debugging
Hannes Reinecke [Thu, 13 Oct 2016 13:10:58 +0000 (15:10 +0200)]
scsi: fcoe: FIP debugging

Add additional statements for debugging FIP frames.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: fcoe: catch invalid values for the 'enabled' attribute
Hannes Reinecke [Thu, 13 Oct 2016 13:10:57 +0000 (15:10 +0200)]
scsi: fcoe: catch invalid values for the 'enabled' attribute

The 'enabled' sysfs attribute only accepts the values '0' and '1',
so we should error out any other values.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: fcoe: set default TC priority
Hannes Reinecke [Thu, 13 Oct 2016 13:10:56 +0000 (15:10 +0200)]
scsi: fcoe: set default TC priority

If DCB is not enabled or compiled in we still should be setting
a sane default priority. So put FCoE frames in priority class
'interactive' and FIP frames in priority class 'besteffort'.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: Check xid when looking up REC exchanges
Hannes Reinecke [Thu, 13 Oct 2016 13:10:55 +0000 (15:10 +0200)]
scsi: libfc: Check xid when looking up REC exchanges

We currently can only lookup the local xid, so we need
to reject REC with empty rxid.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: wait for E_D_TOV when out-of-order sequence is received
Hannes Reinecke [Thu, 13 Oct 2016 13:10:54 +0000 (15:10 +0200)]
scsi: libfc: wait for E_D_TOV when out-of-order sequence is received

When detecting an out-of-order sequence we should be waiting for
E_D_TOV before trying to abort the sequence.
The response might still be stuck in the queue somewhere.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: reset timeout on queue full
Hannes Reinecke [Thu, 13 Oct 2016 13:10:53 +0000 (15:10 +0200)]
scsi: libfc: reset timeout on queue full

When we're receiving a timeout we should be checking for queue
full status; if there are still some packets pending we should
be resetting the counter to ensure we're not missing out any
packets which are still queued.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: Do not drop out-of-order frames
Hannes Reinecke [Thu, 13 Oct 2016 13:10:52 +0000 (15:10 +0200)]
scsi: libfc: Do not drop out-of-order frames

When receiving packets from the network we cannot guarantee any
frame ordering, so we should be receiving all valid frames and
let the upper layers deal with it.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: don't fail sequence abort for completed exchanges
Hannes Reinecke [Thu, 13 Oct 2016 13:10:51 +0000 (15:10 +0200)]
scsi: libfc: don't fail sequence abort for completed exchanges

If a sequence should be aborted the exchange might already
be completed (eg if the response is still queued in the rx
queue), so this shouldn't considered as an error.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: quarantine timed out xids
Hannes Reinecke [Thu, 13 Oct 2016 13:10:50 +0000 (15:10 +0200)]
scsi: libfc: quarantine timed out xids

When a sequence times out we have no idea what happened to the
frame. And we do not know if we will ever receive the frame.
Hence we cannot re-use the xid as we would risk data corruption
if the xid had been re-used and the timed out frame would be
received after that.
So we need to quarantine the xid until the lport is reset.
Yes, I know this will (eventually) deplete the xid pool.
But for now it's the safest method.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: safeguard against invalid exchange index
Hannes Reinecke [Thu, 13 Oct 2016 13:10:49 +0000 (15:10 +0200)]
scsi: libfc: safeguard against invalid exchange index

The cached exchange index might be invalid, in which case
we should drop down to allocate a new one.
And we should not try to access an invalid exchange when
responding to a BA_ABTS.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: Clarify ramp-down messages
Hannes Reinecke [Thu, 13 Oct 2016 13:10:48 +0000 (15:10 +0200)]
scsi: libfc: Clarify ramp-down messages

When the queue depth is reduced we should print out the reason
for this; it might be due to a queue full condition.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: Return LS_RJT_BUSY for PRLI in status PLOGI
Hannes Reinecke [Thu, 13 Oct 2016 13:10:47 +0000 (15:10 +0200)]
scsi: libfc: Return LS_RJT_BUSY for PRLI in status PLOGI

Occasionally it might happen that we receive a PRLI while we're still
waiting for our PLOGI response. In that case we should return
'busy' LS status instead of 'plogi required' LS status.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: Rework PRLI handling
Hannes Reinecke [Thu, 13 Oct 2016 13:10:46 +0000 (15:10 +0200)]
scsi: libfc: Rework PRLI handling

PRLI is only required if the port is acting as an initiator; ports
which support target functionality only do not need to send PRLI.
At the same time the PRLI state is only used if the port initiated
a PRLI transfer; if we received a PRLI request we should _not_
change the state as this would cause our PRLI response to be dropped.
And when we receive a PRLI response we need to check if an image
pair has been established; if not the remote port cannot act as a
target for us and we need to disable target functionality.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: Implement RTV responder
Hannes Reinecke [Thu, 13 Oct 2016 13:10:45 +0000 (15:10 +0200)]
scsi: libfc: Implement RTV responder

The libfc stack generates an RTV request, so we should be implementing
an RTV responder, too.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: use error code for fc_rport_error()
Hannes Reinecke [Thu, 13 Oct 2016 13:10:44 +0000 (15:10 +0200)]
scsi: libfc: use error code for fc_rport_error()

We only ever use the 'fp' argument for fc_rport_error() to
encapsulate the error code, so we can as well do away with that
and pass the error directly.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: do not overwrite DID_TIME_OUT status
Hannes Reinecke [Thu, 13 Oct 2016 13:10:43 +0000 (15:10 +0200)]
scsi: libfc: do not overwrite DID_TIME_OUT status

When a command is aborted it might already have the DID_TIME_OUT
status set, so we shouldn't be overwriting that.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: fcoe: make R_A_TOV and E_D_TOV configurable
Hannes Reinecke [Thu, 13 Oct 2016 13:10:42 +0000 (15:10 +0200)]
scsi: fcoe: make R_A_TOV and E_D_TOV configurable

The user might want to modify the values for R_A_TOV and E_D_TOV,
so add new module parameters 'e_d_tov' and 'r_a_tov' for the
'fcoe' modules and allow to modify them via sysfs attributes.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: sanitize E_D_TOV and R_A_TOV setting
Hannes Reinecke [Thu, 13 Oct 2016 13:10:41 +0000 (15:10 +0200)]
scsi: libfc: sanitize E_D_TOV and R_A_TOV setting

When setting the FCP timeout we need to ensure a lower boundary
for E_D_TOV and R_A_TOV, otherwise we'd be getting spurious I/O
issues due to the fcp timer firing too early.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: use configured rport E_D_TOV
Hannes Reinecke [Thu, 13 Oct 2016 13:10:40 +0000 (15:10 +0200)]
scsi: libfc: use configured rport E_D_TOV

If fc_rport_error_retry() is attempting to retry the remote
port state we should be waiting for the configured e_d_tov
value rather than the default.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: use configured lport R_A_TOV
Hannes Reinecke [Thu, 13 Oct 2016 13:10:39 +0000 (15:10 +0200)]
scsi: libfc: use configured lport R_A_TOV

We should be using the configured R_A_TOV value when sending the
exchange.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: spurious I/O error under high load
Hannes Reinecke [Thu, 13 Oct 2016 13:10:38 +0000 (15:10 +0200)]
scsi: libfc: spurious I/O error under high load

If a command times out libfc is sending an REC, which also
might fail (due to frames being lost or something).
If no data has been transferred we can simply retry
the command, but the current code sets a state of FC_ERROR,
which then is being translated into DID_ERROR, resulting
in an I/O error.
So to handle this properly we need to set a separate
state FC_TRANS_RESET and mapping it onto DID_SOFT_RETRY.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: additional debugging messages
Hannes Reinecke [Thu, 13 Oct 2016 13:10:37 +0000 (15:10 +0200)]
scsi: libfc: additional debugging messages

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: Revert "[SCSI] libfc: use offload EM instance again instead jumping...
Martin K. Petersen [Fri, 14 Oct 2016 20:37:29 +0000 (16:37 -0400)]
scsi: libfc: Revert "[SCSI] libfc: use offload EM instance again instead jumping to next EM"

This reverts commit 3e22760d4db6fd89e0be46c3d132390a251da9c6.

This revert came about because of efforts by Ewan Milne, Curtis Taylor
and I.  In researching this issue, significant performance issues were
seen on large CPU count systems using the software FCOE stack.  Hannes
also weighed in.

The same was not apparent on much smaller low count CPU systems.  The
behavior introduced by commit 3e22760d4db6fd89e0be46c3d132390a251da9c6
lands sup with large count CPU systems seeing continual
blk_requeue_request() calls due to ML_QUEUE_HOST_BUSY.

fc_exch_alloc() used to try all the available exchange managers in the
list for an available exchange id, but this was changed in 2010 so that
if the first matched exchange manager couldn't allocate one, it fails
and we end up returning host busy.  This was due to commit:

Setting the ddp_min module parameter to fcoe to 128MB prevents the
->match function from permitting the use of the offload exchange manager
for the frame, and we no longer see the problem with host busy status,
since it uses the larger non-offloaded pool.

Reverting commit 3e22760d4db6fd89e0be46c3d132390a251da9c6 was tested to
also prevent the host busy issue due to failing allocations.

Suggested-by: Ewan Milne <emilne@redhat.com>
Suggested-by: Curtis Taylor <cjt@us.ibm.com>
Tested-by: Laurence Oberman <loberman@redhat.com>
Signed-off-by: Laurence Oberman <loberman@redhat.com>
7 years agoscsi: lpfc: lpfc version changed to 11.2.0.2
James Smart [Thu, 13 Oct 2016 22:06:18 +0000 (15:06 -0700)]
scsi: lpfc: lpfc version changed to 11.2.0.2

lpfc version changed to 11.2.0.2

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: lpfc: Fix fw download on SLI-4 FC adapters
James Smart [Thu, 13 Oct 2016 22:06:17 +0000 (15:06 -0700)]
scsi: lpfc: Fix fw download on SLI-4 FC adapters

Fix fw download on SLI-4 FC adapters

Driver performs a quick validation of magic numbers in the fw
download image. Driver needed to be updated for more recent
magic numbers.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: lpfc: Synchronize link speed with boot driver
James Smart [Thu, 13 Oct 2016 22:06:16 +0000 (15:06 -0700)]
scsi: lpfc: Synchronize link speed with boot driver

Synchronize link speed with boot driver

Link speed settings set by the boot driver are reported by the hw.
Driver will attempt to read them, and if set, will respect their
values.
The driver can override the settings with its own if instructed by
user space (via bsg), with the new values being picked up by the
boot driver.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: lpfc: Correct panics with eh_timeout and eh_deadline
James Smart [Thu, 13 Oct 2016 22:06:15 +0000 (15:06 -0700)]
scsi: lpfc: Correct panics with eh_timeout and eh_deadline

Correct panics with eh_timeout and eh_deadline

We were having double completions on our SLI-3 version of adapters.
Solved by clearing our command pointer before calling scsi_done.

The eh paths potentially ran simulatenously and would see the non-null
value and invoke scsi_done again.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: lpfc: Fix lost target in pt-to-pt connect
James Smart [Thu, 13 Oct 2016 22:06:14 +0000 (15:06 -0700)]
scsi: lpfc: Fix lost target in pt-to-pt connect

Fix lost target in pt-to-pt connect

Change reject code to something that allows a retry

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: lpfc: Revise strings with full lpfc parameter name
James Smart [Thu, 13 Oct 2016 22:06:13 +0000 (15:06 -0700)]
scsi: lpfc: Revise strings with full lpfc parameter name

Revise strings with full lpfc parameter name

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: lpfc: Code cleanup for lpfc_sriov_nr_virtfn parameter
James Smart [Thu, 13 Oct 2016 22:06:12 +0000 (15:06 -0700)]
scsi: lpfc: Code cleanup for lpfc_sriov_nr_virtfn parameter

Code cleanup for lpfc_sriov_nr_virtfn parameter

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: lpfc: Code cleanup for lpfc_max_scsicmpl_time parameter
James Smart [Thu, 13 Oct 2016 22:06:11 +0000 (15:06 -0700)]
scsi: lpfc: Code cleanup for lpfc_max_scsicmpl_time parameter

Code cleanup for lpfc_max_scsicmpl_time parameter

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: lpfc: Code cleanup for lpfc_topology parameter
James Smart [Thu, 13 Oct 2016 22:06:10 +0000 (15:06 -0700)]
scsi: lpfc: Code cleanup for lpfc_topology parameter

Code cleanup for lpfc_topology parameter

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: lpfc: Code cleanup for lpfc_aer_support parameter
James Smart [Thu, 13 Oct 2016 22:06:09 +0000 (15:06 -0700)]
scsi: lpfc: Code cleanup for lpfc_aer_support parameter

Code cleanup for lpfc_aer_support parameter

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: lpfc: Code cleanup for lpfc_enable_rrq parameter
James Smart [Thu, 13 Oct 2016 22:06:08 +0000 (15:06 -0700)]
scsi: lpfc: Code cleanup for lpfc_enable_rrq parameter

Code cleanup for lpfc_enable_rrq parameter

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: lpfc: Code clean up for lpfc_iocb_cnt parameter
James Smart [Thu, 13 Oct 2016 22:06:07 +0000 (15:06 -0700)]
scsi: lpfc: Code clean up for lpfc_iocb_cnt parameter

Code clean up for lpfc_iocb_cnt parameter

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: lpfc: Make lpfc_prot_xxx params per hba parameters
James Smart [Thu, 13 Oct 2016 22:06:06 +0000 (15:06 -0700)]
scsi: lpfc: Make lpfc_prot_xxx params per hba parameters

Make lpfc_prot_mask and lpfc_prot_guard per hba parameters

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: lpfc: Set driver environment data on adapter
James Smart [Thu, 13 Oct 2016 22:06:05 +0000 (15:06 -0700)]
scsi: lpfc: Set driver environment data on adapter

Set driver environment data on adapter

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: lpfc: Fix sg_reset on SCSI device causing kernel crash
James Smart [Thu, 13 Oct 2016 22:06:04 +0000 (15:06 -0700)]
scsi: lpfc: Fix sg_reset on SCSI device causing kernel crash

Fix sg_reset on SCSI device causing kernel crash

Driver could reference stale node pointers in task mgmt call.
Changed to use resetting cmd and look up node pointer in task mgmt
function.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: lpfc: Correct embedded io wq element size
James Smart [Thu, 13 Oct 2016 22:06:03 +0000 (15:06 -0700)]
scsi: lpfc: Correct embedded io wq element size

Correct embedded io wq element size. Embedded element sizes are
128 byte elements

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: lpfc: Fix few small typos in lpfc_scsi.c
Milan P. Gandhi [Thu, 13 Oct 2016 22:06:02 +0000 (15:06 -0700)]
scsi: lpfc: Fix few small typos in lpfc_scsi.c

This patch does a cleanup and fixes few small typos in lpfc_scsi.c

Signed-off-by: Milan P. Gandhi <mgandhi@redhat.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoMAINTAINERS: Changing maintainer for ufs DWC.
Joao Pinto [Fri, 14 Oct 2016 15:59:23 +0000 (16:59 +0100)]
MAINTAINERS: Changing maintainer for ufs DWC.

I am going to leave Synopsys and so this patch changes the Maintainer
for UFS Synopsys' specific drivers to my colleagues Manjunath and Prabu.

Signed-off-by: Joao Pinto <jpinto@synopsys.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoMAINTAINERS: Remove defunct iss storage mailing list
Javier Martinez Canillas [Thu, 13 Oct 2016 16:57:41 +0000 (13:57 -0300)]
MAINTAINERS: Remove defunct iss storage mailing list

It appears that the mailing list email address doesn't exist anymore:

<iss_storagedev@hp.com>: host smtp.hp.com[15.73.96.116] said: 550 5.1.1
    <iss_storagedev@hp.com>: Recipient address rejected: User unknown in
    virtual alias table (in reply to RCPT TO command)

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: hpsa: Remove unneeded void pointer cast
Javier Martinez Canillas [Thu, 13 Oct 2016 16:10:08 +0000 (13:10 -0300)]
scsi: hpsa: Remove unneeded void pointer cast

It's not necessary to cast the result of kmalloc, since void pointers
are promoted to any other type. This also fixes following coccinelle
warning:

casting value returned by memory allocation function to (BIG_IOCTL_Command_struct *) is useless.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: mptscsih: Remove bogus interpretation of request->ioprio
Christoph Hellwig [Thu, 13 Oct 2016 08:46:41 +0000 (10:46 +0200)]
scsi: mptscsih: Remove bogus interpretation of request->ioprio

Having an I/O priority does not mean we should send all requests as HEAD
OF QUEUE tags.

Reported-by: Adam Manzanares <adam.manzanares@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: ncr5380: Suppress unhelpful "interrupt without IRQ bit" message
Finn Thain [Mon, 10 Oct 2016 04:46:53 +0000 (00:46 -0400)]
scsi: ncr5380: Suppress unhelpful "interrupt without IRQ bit" message

If a NCR5380 host instance ends up on a shared interrupt line then
this printk will be a problem. It is already a problem on some Mac
models: when testing mac_scsi on a PowerBook 180 I found that PDMA
transfers (but not PIO transfers) cause the message to be logged.

These spurious interrupts don't appear to come from the DRQ signal from
the 5380. And they don't happen at all on the Mac LC III. A comment in
the NetBSD source code mentions this mystery. Testing seems to show
that we can safely ignore these interrupts.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Tested-by: Ondrej Zary <linux@rainbow-software.org>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: ncr5380: Use correct types for DMA routines
Finn Thain [Mon, 10 Oct 2016 04:46:53 +0000 (00:46 -0400)]
scsi: ncr5380: Use correct types for DMA routines

Apply prototypes to get consistent function signatures for the DMA
functions implemented in the board-specific drivers. To avoid using
macros to alter actual parameters, some of those functions are reworked
slightly.

This is a step toward the goal of passing the board-specific routines
to the core driver using an ops struct (as in a platform driver or
library module).

This also helps fix some inconsistent types: where the core driver uses
ints (cmd->SCp.this_residual and hostdata->dma_len) for keeping track of
transfers, certain board-specific routines used unsigned long.

While we are fixing these function signatures, pass the hostdata pointer
to DMA routines instead of a Scsi_Host pointer, for shorter and faster
code.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Tested-by: Ondrej Zary <linux@rainbow-software.org>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: ncr5380: Expedite register polling
Finn Thain [Mon, 10 Oct 2016 04:46:53 +0000 (00:46 -0400)]
scsi: ncr5380: Expedite register polling

Avoid the call to NCR5380_poll_politely2() when possible. The call is
easily short-circuited on the PIO fast path, using the inline wrapper.
This requires that the NCR5380_read macro be made available before
any #include "NCR5380.h" so a few declarations have to be moved too.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Tested-by: Ondrej Zary <linux@rainbow-software.org>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: ncr5380: Pass hostdata pointer to register polling routines
Finn Thain [Mon, 10 Oct 2016 04:46:53 +0000 (00:46 -0400)]
scsi: ncr5380: Pass hostdata pointer to register polling routines

Pass a NCR5380_hostdata struct pointer to the board-specific routines
instead of a Scsi_Host struct pointer. This reduces pointer chasing in
the PIO and PDMA fast paths. The old way was a mistake because it is
slow and the board-specific code is not concerned with the mid-layer.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Tested-by: Ondrej Zary <linux@rainbow-software.org>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: ncr5380: Use correct types for device register accessors
Finn Thain [Mon, 10 Oct 2016 04:46:53 +0000 (00:46 -0400)]
scsi: ncr5380: Use correct types for device register accessors

For timeout values adopt unsigned long, which is the type of jiffies etc.

For chip register values and bit masks pass u8, which is the return type
of readb, inb etc.

For device register offsets adopt unsigned int, as it is suitable for
adding to base addresses.

Pass the NCR5380_hostdata pointer to the board-specific routines instead
of the Scsi_Host pointer. The board-specific code is concerned with
hardware and not with SCSI protocol or the mid-layer.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Tested-by: Ondrej Zary <linux@rainbow-software.org>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: ncr5380: Store IO ports and addresses in host private data
Finn Thain [Mon, 10 Oct 2016 04:46:53 +0000 (00:46 -0400)]
scsi: ncr5380: Store IO ports and addresses in host private data

The various 5380 drivers inconsistently store register pointers
either in the Scsi_Host struct "legacy crap" area or in special,
board-specific members of the NCR5380_hostdata struct. Uniform
use of the latter struct makes for simpler and faster code (see
the following patches) and helps to reduce use of the
NCR5380_implementation_fields macro.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Tested-by: Ondrej Zary <linux@rainbow-software.org>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: ncr5380: Improve hostdata struct member alignment and cache-ability
Finn Thain [Mon, 10 Oct 2016 04:46:53 +0000 (00:46 -0400)]
scsi: ncr5380: Improve hostdata struct member alignment and cache-ability

Re-order struct members so that hot data lies at the beginning of the
struct and cold data at the end. Improve the comments while we're here.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Tested-by: Ondrej Zary <linux@rainbow-software.org>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: ncr5380: Increase register polling limit
Finn Thain [Mon, 10 Oct 2016 04:46:52 +0000 (00:46 -0400)]
scsi: ncr5380: Increase register polling limit

If NCR5380_poll_politely() is called under irq lock, the polling time
limit is clamped to avoid a spike in interrupt latency. When not under
irq lock, the same polling time limit acts as the worst case delay
between schedule() calls.

During PDMA (under irq lock) I've found that the 10 ms time limit is
sometimes too short, and leads to the error message,
sd 0:0:0:0: [sda] tag#1 macscsi_pread: !REQ and !ACK

This particular target identifies itself as a QUANTUM DAYTONA514S. It
seems to be slower to assert ACK than the other targets I've tested.
This patch solves the problem by increasing the polling timeout.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Tested-by: Ondrej Zary <linux@rainbow-software.org>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: ncr5380: Simplify register polling limit
Finn Thain [Mon, 10 Oct 2016 04:46:52 +0000 (00:46 -0400)]
scsi: ncr5380: Simplify register polling limit

When polling a device register under irq lock the polling loop terminates
after a given number of jiffies. Make this timeout independent of the HZ
setting.

All 5380 drivers benefit from this patch, which optimizes the PIO fast
path, because they all use PIO transfers (for phases other than DATA IN
and DATA OUT). Some cards support only PIO transfers (even for DATA
phases). CPU cycles are scarce on some of these systems, so a small
improvement here makes a big difference.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Tested-by: Ondrej Zary <linux@rainbow-software.org>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: atari_scsi: Make device register accessors re-entrant
Finn Thain [Mon, 10 Oct 2016 04:46:52 +0000 (00:46 -0400)]
scsi: atari_scsi: Make device register accessors re-entrant

This patch fixes an old bug: accesses to device registers from the
interrupt handler (after reselection, DMA completion etc.) could mess
up a device register access elsewhere, if the latter takes place outside
of an irq lock (during selection etc.).

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: cumana_1: Remove unused cumanascsi_setup() function
Finn Thain [Mon, 10 Oct 2016 04:46:52 +0000 (00:46 -0400)]
scsi: cumana_1: Remove unused cumanascsi_setup() function

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: g_NCR5380: Merge g_NCR5380 and g_NCR5380_mmio drivers
Ondrej Zary [Mon, 10 Oct 2016 04:46:52 +0000 (00:46 -0400)]
scsi: g_NCR5380: Merge g_NCR5380 and g_NCR5380_mmio drivers

Merge the port-mapped IO and memory-mapped IO support (with the help of
ioport_map) into the g_NCR5380 module and delete g_NCR5380_mmio.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Tested-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: ufshcd: Fix possible unclocked register access
Subhash Jadavani [Fri, 7 Oct 2016 04:48:22 +0000 (21:48 -0700)]
scsi: ufshcd: Fix possible unclocked register access

Vendor specific setup_clocks callback may require the clocks managed by
ufshcd driver to be ON. So if the vendor specific setup_clocks callback
is called while the required clocks are turned off, it could result into
unclocked register access.

To prevent possible unclock register access, this change adds one more
argument to setup_clocks callback to let it know whether it is called
pre/post the clock changes by core driver.

Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Reviewed-by: Kiwoong Kim <kwmad.kim@samsung.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: fcoe: Harden CVL handling when we have not logged into the fabric.
Chad Dupuis [Fri, 30 Sep 2016 09:01:20 +0000 (11:01 +0200)]
scsi: fcoe: Harden CVL handling when we have not logged into the fabric.

If we haven't logged into the fabric yet we want to be a little more nuanced
with our CVL handling than what we've been:

- If the FCF has been selected, check the source MAC to make sure the frame is
from the FCF we've selected.
- If a FCF is selected and the CVL is from the FCF but we have not logged in
yet, then reset everything and go back to solicitation.

Signed-off-by: Chad Dupuis <chad.dupuis@cavium.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: don't advance state machine for incoming FLOGI
Hannes Reinecke [Fri, 30 Sep 2016 09:01:19 +0000 (11:01 +0200)]
scsi: libfc: don't advance state machine for incoming FLOGI

When we receive an FLOGI but have already sent our own we should
not advance the state machine but rather wait for our FLOGI to
return before continuing with PLOGI.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: Do not login if the port is already started
Hannes Reinecke [Fri, 30 Sep 2016 09:01:18 +0000 (11:01 +0200)]
scsi: libfc: Do not login if the port is already started

When the port is already started we don't need to login; that
will only confuse the state machine.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: Do not drop down to FLOGI for fc_rport_login()
Hannes Reinecke [Fri, 30 Sep 2016 09:01:17 +0000 (11:01 +0200)]
scsi: libfc: Do not drop down to FLOGI for fc_rport_login()

When fc_rport_login() is called while the rport is not
in RPORT_ST_INIT, RPORT_ST_READY, or RPORT_ST_DELETE
login is already in progress and there's no need to
drop down to FLOGI; doing so will only confuse the
other side.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: Do not take rdata->rp_mutex when processing a -FC_EX_CLOSED ELS response.
Chad Dupuis [Fri, 30 Sep 2016 09:01:16 +0000 (11:01 +0200)]
scsi: libfc: Do not take rdata->rp_mutex when processing a -FC_EX_CLOSED ELS response.

When an ELS response handler receives a -FC_EX_CLOSED, the rdata->rp_mutex is
already held which can lead to a deadlock condition like the following stack trace:

[<ffffffffa04d8f18>] fc_rport_plogi_resp+0x28/0x200 [libfc]
[<ffffffffa04cfa1a>] fc_invoke_resp+0x6a/0xe0 [libfc]
[<ffffffffa04d0c08>] fc_exch_mgr_reset+0x1b8/0x280 [libfc]
[<ffffffffa04d87b3>] fc_rport_logoff+0x43/0xd0 [libfc]
[<ffffffffa04ce73d>] fc_disc_stop+0x6d/0xf0 [libfc]
[<ffffffffa04ce7ce>] fc_disc_stop_final+0xe/0x20 [libfc]
[<ffffffffa04d55f7>] fc_fabric_logoff+0x17/0x70 [libfc]

The other ELS handlers need to follow the FLOGI response handler and simply do
a kref_put against the fc_rport_priv struct and exit when receving a
-FC_EX_CLOSED response.

Signed-off-by: Chad Dupuis <chad.dupuis@cavium.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: Fixup disc_mutex handling
Hannes Reinecke [Fri, 30 Sep 2016 09:01:15 +0000 (11:01 +0200)]
scsi: libfc: Fixup disc_mutex handling

The list of attached 'rdata' remote port structures is RCU
protected, so there is no need to take the 'disc_mutex' when
traversing it.
Rather we should be using rcu_read_lock() and kref_get_unless_zero()
to validate the entries.
We need, however, take the disc_mutex when deleting an entry;
otherwise we risk clashes with list_add.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: Revisit kref handling
Hannes Reinecke [Fri, 30 Sep 2016 09:01:14 +0000 (11:01 +0200)]
scsi: libfc: Revisit kref handling

The kref handling in fc_rport is a mess. This patch updates
the kref handling according to the following rules:

- Take a reference whenever scheduling a workqueue
- Take a reference whenever an ELS command is send
- Drop the reference at the end of the workqueue function
- Drop the reference at the end of handling ELS replies
- Take a reference when allocating an rport
- Drop the reference when removing an rport

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: hisi_sas: Add v2 hw support for different refclk
John Garry [Tue, 4 Oct 2016 11:11:11 +0000 (19:11 +0800)]
scsi: hisi_sas: Add v2 hw support for different refclk

The hip06 D03 and hip07 D05 boards have different reference clock
frequencies for the SAS controller.

Register PHY_CTRL needs to be programmed differently according to this
frequency, so add support for this.

The default register setting in PHY_CTRL is for 50MHz, so only update
this register when the refclk frequency is 66MHz.

For ACPI we expect the _RST handler to set the correct value for
PHY_CTRL (we're forced to take different approach for DT and ACPI as
ACPI does not support fixed-clock device).

Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: hisi_sas: Add device tree support for hip07
John Garry [Tue, 4 Oct 2016 11:11:10 +0000 (19:11 +0800)]
scsi: hisi_sas: Add device tree support for hip07

Chipset hip07 incorporates v2 hw.

Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: devicetree: bindings: hisi_sas: add hip07 support
John Garry [Tue, 4 Oct 2016 11:11:09 +0000 (19:11 +0800)]
scsi: devicetree: bindings: hisi_sas: add hip07 support

Add support for hip07 chipset to hisi_sas controller.

Chipset hip07 has v2 hw.

Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: fnic: Use time64_t to represent trace timestamps
Deepa Dinamani [Sat, 1 Oct 2016 23:48:14 +0000 (16:48 -0700)]
scsi: fnic: Use time64_t to represent trace timestamps

Trace timestamps use struct timespec and CURRENT_TIME which are not
y2038 safe.  These timestamps are only part of the trace log on the
machine and are not shared with the fnic.  Replace then with y2038 safe
struct timespec64 and ktime_get_real_ts64(), respectively.

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Cc: Hiral Patel <hiralpat@cisco.com>
Cc: Suma Ramars <sramars@cisco.com>
Cc: Brian Uchino <buchino@cisco.com>
Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: ipr: Use pci_irq_allocate_vectors
Christoph Hellwig [Sun, 11 Sep 2016 13:31:24 +0000 (15:31 +0200)]
scsi: ipr: Use pci_irq_allocate_vectors

Switch the ipr driver to use pci_alloc_irq_vectors.  We need to two
calls to pci_alloc_irq_vectors as ipr only supports multiple MSI-X
vectors, but not multiple MSI vectors.

Otherwise this cleans up a lot of cruft and allows to use a common
request_irq loop for irq types, which happens to only iterate over a
single line in the non MSI-X case.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: arcmsr: Use pci_alloc_irq_vectors
Christoph Hellwig [Sun, 11 Sep 2016 13:31:23 +0000 (15:31 +0200)]
scsi: arcmsr: Use pci_alloc_irq_vectors

Switch the arcmsr driver to use pci_alloc_irq_vectors.  We need to two
calls to pci_alloc_irq_vectors as arcmsr only supports multiple MSI-X
vectors, but not multiple MSI vectors.

Otherwise this cleans up a lot of cruft and allows to use a common
request_irq loop for irq types, which happens to only iterate over a
single line in the non MSI-X case.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Ching Huang <ching2048@areca.com.tw>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoMerge tag 'iommu-fixes-v4.9-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Tue, 8 Nov 2016 18:07:13 +0000 (10:07 -0800)]
Merge tag 'iommu-fixes-v4.9-rc4' of git://git./linux/kernel/git/joro/iommu

Pull IOMMU fixes from Joerg Roedel:

 - Four patches from Robin Murphy fix several issues with the recently
   merged generic DT-bindings support for arm-smmu drivers

 - A fix for a dead-lock issue in the VT-d driver, which shows up on
   iommu hotplug

* tag 'iommu-fixes-v4.9-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
  iommu/vt-d: Fix dead-locks in disable_dmar_iommu() path
  iommu/arm-smmu: Fix out-of-bounds dereference
  iommu/arm-smmu: Check that iommu_fwspecs are ours
  iommu/arm-smmu: Don't inadvertently reject multiple SMMUv3s
  iommu/arm-smmu: Work around ARM DMA configuration

7 years agoiommu/vt-d: Fix dead-locks in disable_dmar_iommu() path
Joerg Roedel [Tue, 8 Nov 2016 14:08:26 +0000 (15:08 +0100)]
iommu/vt-d: Fix dead-locks in disable_dmar_iommu() path

It turns out that the disable_dmar_iommu() code-path tried
to get the device_domain_lock recursivly, which will
dead-lock when this code runs on dmar removal. Fix both
code-paths that could lead to the dead-lock.

Fixes: 55d940430ab9 ('iommu/vt-d: Get rid of domain->iommu_lock')
Signed-off-by: Joerg Roedel <jroedel@suse.de>
7 years agoiommu/arm-smmu: Fix out-of-bounds dereference
Robin Murphy [Mon, 7 Nov 2016 18:25:09 +0000 (18:25 +0000)]
iommu/arm-smmu: Fix out-of-bounds dereference

When we iterate a master's config entries, what we generally care
about is the entry's stream map index, rather than the entry index
itself, so it's nice to have the iterator automatically assign the
former from the latter. Unfortunately, booting with KASAN reveals
the oversight that using a simple comma operator results in the
entry index being dereferenced before being checked for validity,
so we always access one element past the end of the fwspec array.

Flip things around so that the check always happens before the index
may be dereferenced.

Fixes: adfec2e709d2 ("iommu/arm-smmu: Convert to iommu_fwspec")
Reported-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
7 years agoiommu/arm-smmu: Check that iommu_fwspecs are ours
Robin Murphy [Wed, 2 Nov 2016 17:31:32 +0000 (17:31 +0000)]
iommu/arm-smmu: Check that iommu_fwspecs are ours

We seem to have forgotten to check that iommu_fwspecs actually belong to
us before we go ahead and dereference their private data. Oops.

Fixes: 021bb8420d44 ("iommu/arm-smmu: Wire up generic configuration support")
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
7 years agoiommu/arm-smmu: Don't inadvertently reject multiple SMMUv3s
Robin Murphy [Thu, 3 Nov 2016 17:39:07 +0000 (17:39 +0000)]
iommu/arm-smmu: Don't inadvertently reject multiple SMMUv3s

We now delay installing our per-bus iommu_ops until we know an SMMU has
successfully probed, as they don't serve much purpose beforehand, and
doing so also avoids fights between multiple IOMMU drivers in a single
kernel. However, the upshot of passing the return value of bus_set_iommu()
back from our probe function is that if there happens to be more than
one SMMUv3 device in a system, the second and subsequent probes will
wind up returning -EBUSY to the driver core and getting torn down again.

Avoid re-setting ops if ours are already installed, so that any genuine
failures stand out.

Fixes: 08d4ca2a672b ("iommu/arm-smmu: Support non-PCI devices with SMMUv3")
CC: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
CC: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
7 years agoiommu/arm-smmu: Work around ARM DMA configuration
Robin Murphy [Mon, 17 Oct 2016 11:06:21 +0000 (12:06 +0100)]
iommu/arm-smmu: Work around ARM DMA configuration

The 32-bit ARM DMA configuration code predates the IOMMU core's default
domain functionality, and instead relies on allocating its own domains
and attaching any devices using the generic IOMMU binding to them.
Unfortunately, it does this relatively early on in the creation of the
device, before we've seen our add_device callback, which leads us to
attempt to operate on a half-configured master.

To avoid a crash, check for this situation on attach, but refuse to
play, as there's nothing we can do. This at least allows VFIO to keep
working for people who update their 32-bit DTs to the generic binding,
albeit with a few (innocuous) warnings from the DMA layer on boot.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
7 years agoMerge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Linus Torvalds [Mon, 7 Nov 2016 18:16:23 +0000 (10:16 -0800)]
Merge tag 'arm64-fixes' of git://git./linux/kernel/git/arm64/linux

Pull arm64 fix from Will Deacon:
 "It's been pretty quiet on the fixes side of things for us, but Artem
  reported a build failure introduced during the merge window that
  appears with older GCCs that do not support asm goto. The fix is
  bigger than I'd like, but it's a mechnical move of some constants to
  break an include dependency between atomic.h and jump_label.h when
  !HAVE_JUMP_LABEL.

  Summary:

   - Fix build failure on compilers without asm goto"

* tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
  arm64: Fix circular include of asm/lse.h through linux/jump_label.h