Finn Thain [Sun, 3 Jan 2016 05:05:34 +0000 (16:05 +1100)]
atari_NCR5380: Set do_abort() timeouts
Use timeouts in do_abort() in atari_NCR5380.c instead of infinite loops.
Also fix the kernel-doc comment. Keep the two core driver forks in sync.
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>
Finn Thain [Sun, 3 Jan 2016 05:05:33 +0000 (16:05 +1100)]
ncr5380: Fix bus phase in do_abort()
NCR5380_poll_politely() returns either 0 (success) or -ETIMEDOUT. However,
in do_abort(), the return value is incorrectly taken to be the status
register value. This means that the bus is put into DATA OUT phase instead
of MESSAGE OUT. Fix this.
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>
Finn Thain [Sun, 3 Jan 2016 05:05:32 +0000 (16:05 +1100)]
ncr5380: Fix !REQ timeout in do_abort()
NCR5380_poll_politely() never returns -1. That means do_abort() can fail
to handle a timeout after waiting for the target to negate REQ. Fix this
and cleanup other NCR5380_poll_politely() call sites.
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>
Finn Thain [Sun, 3 Jan 2016 05:05:31 +0000 (16:05 +1100)]
ncr5380: Add missing break after case MESSAGE_REJECT
MESSAGE REJECT does not imply DISCONNECT: the target is about to enter
MESSAGE IN or MESSAGE OUT phase.
This bug fix comes from atari_NCR5380.c. Unfortunately it never made it
into the original NCR5380.c core driver.
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>
Hannes Reinecke [Sun, 3 Jan 2016 05:05:30 +0000 (16:05 +1100)]
ncr5380: Remove references to linked commands
Some old drivers partially implemented support for linked commands using
a "proposed" next_link pointer in struct scsi_cmnd that never actually
existed. Remove this 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> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Finn Thain [Sun, 3 Jan 2016 05:05:29 +0000 (16:05 +1100)]
ncr5380: Drop DEF_SCSI_QCMD macro
Remove the DEF_SCSI_QCMD macro (already removed from atari_NCR5380.c). The
lock provided by DEF_SCSI_QCMD is only needed for queue data structures.
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>
Finn Thain [Sun, 3 Jan 2016 05:05:28 +0000 (16:05 +1100)]
ncr5380: Add missing lock in eh_abort_handler
The host spin lock needs to be acquired by NCR5380_abort() before it calls
NCR5380_select(). This patch doesn't actually fix the EH issues in this
driver but it does avoid this:
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>
Finn Thain [Sun, 3 Jan 2016 05:05:27 +0000 (16:05 +1100)]
ncr5380: Fix NCR5380_transfer_pio() result
According to the SCSI-2 draft revision 10L, atari_NCR5380.c is correct
when it says that the phase lines are valid up until ACK is negated
following the transmission of the last byte in MESSAGE IN phase. This is
true for all information transfer phases, from target to initiator.
Sample the phase bits in STATUS_REG so that NCR5380_transfer_pio() can
return the correct result. The return value is presently unused (perhaps
because of bugs like this) but this change at least fixes the caller's
phase variable, which is passed by reference.
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>
Finn Thain [Sun, 3 Jan 2016 05:05:26 +0000 (16:05 +1100)]
ncr5380: Rework disconnect versus poll logic
The atari_NCR5380.c and NCR5380.c core drivers differ in their handling of
target disconnection. This is partly because atari_NCR5380.c had all of
the polling and sleeping removed to become entirely interrupt-driven, and
it is partly because of damage done to NCR5380.c after atari_NCR5380.c was
forked. See commit 37cd23b44929 ("Linux 2.1.105") in history/history.git.
The polling changes that were made in v2.1.105 are questionable at best:
if REQ is not already asserted when NCR5380_transfer_pio() is invoked, and
if the expected phase is DATA IN or DATA OUT, the function will schedule
main() to execute after USLEEP_SLEEP jiffies and then return. The problems
here are the expected REQ timing and the sleep interval*. Avoid this issue
by using NCR5380_poll_politely() instead of scheduling main().
The atari_NCR5380.c core driver requires the use of the chip interrupt and
always permits target disconnection. It sets the cmd->device->disconnect
flag when a device disconnects, but never tests this flag.
The NCR5380.c core driver permits disconnection only when
instance->irq != NO_IRQ. It sets the cmd->device->disconnect flag when
a device disconnects and it tests this flag in a couple of places:
1. During NCR5380_information_transfer(), following COMMAND OUT phase,
if !cmd->device->disconnect, the initiator will take a guess as to
whether or not the target will then choose to go to MESSAGE IN phase
and disconnect. If the driver guesses "yes", it will schedule main()
to execute after USLEEP_SLEEP jiffies and then return there.
Unfortunately the driver may guess "yes" even after it has denied
the target the disconnection privilege. When the target does not
disconnect, the sleep can be beneficial, assuming the sleep interval
is appropriate (mostly it is not*).
And even if the driver guesses "yes" correctly, and the target would
then disconnect, the driver still has to go through the MESSAGE IN
phase in order to get to BUS FREE phase. The main loop can do nothing
useful until BUS FREE, and sleeping just delays the phase transition.
2. If !cmd->device->disconnect and REQ is not already asserted when
NCR5380_information_transfer() is invoked, the function polls for REQ
for USLEEP_POLL jiffies. If REQ is not asserted, it then schedules
main() to execute after USLEEP_SLEEP jiffies and returns.
The idea is apparently to yeild the CPU while waiting for REQ.
This is conditional upon !cmd->device->disconnect, but there seems
to be no rhyme or reason for that. For example, the flag may be
unset because disconnection privilege was denied because the driver
has no IRQ. Or the flag may be unset because the device has never
needed to disconnect before. Or if the flag is set, disconnection
may have no relevance to the present bus phase.
Another deficiency of the existing algorithm is as follows. When the
driver has no IRQ, it prevents disconnection, and generally polls and
sleeps more than it would normally. Now, if the driver is going to poll
anyway, why not allow the target to disconnect? That way the driver can do
something useful with the bus instead of polling unproductively!
Avoid this pointless latency, complexity and guesswork by using
NCR5380_poll_politely() instead of scheduling main().
* For g_NCR5380, the time intervals for USLEEP_SLEEP and USLEEP_POLL are
200 ms and 10 ms, respectively. They are 20 ms and 200 ms respectively
for the other NCR5380 drivers. There doesn't seem to be any reason for
this discrepancy. The timing seems to have no relation to the type of
adapter. Bizarrely, the timing in g_NCR5380 seems to relate only to one
particular type of target device. This patch attempts to solve the
problem for all NCR5380 drivers and all target devices.
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>
Finn Thain [Sun, 3 Jan 2016 05:05:25 +0000 (16:05 +1100)]
ncr5380: Implement NCR5380_dma_xfer_len and remove LIMIT_TRANSFERSIZE macro
Follow the example of the atari_NCR5380.c core driver and adopt the
NCR5380_dma_xfer_len() hook. Implement NCR5380_dma_xfer_len() for dtc.c
and g_NCR5380.c to take care of the limitations of these cards. Keep the
default for drivers using PSEUDO_DMA.
Eliminate the unused macro LIMIT_TRANSFERSIZE.
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>
Finn Thain [Sun, 3 Jan 2016 05:05:24 +0000 (16:05 +1100)]
ncr5380: Always retry arbitration and selection
If NCR5380_select() returns -1, it means arbitration was lost or selection
failed and should be retried. If the main loop simply terminates when there
are still commands on the issue queue, they will remain queued until they
expire.
Fix this by clearing the 'done' flag after selection failure or lost
arbitration.
The "else break" clause in NCR5380_main() that gets removed here appears
to be a vestige of a long-gone loop that iterated over host instances.
See commit 491447e1fcff ("[PATCH] next NCR5380 updates") in
history/history.git.
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>
Finn Thain [Sun, 3 Jan 2016 05:05:23 +0000 (16:05 +1100)]
ncr5380: Eliminate selecting state
Linux v2.1.105 changed the algorithm for polling for the BSY signal
in NCR5380_select() and NCR5380_main().
Presently, this code has a bug. Back then, NCR5380_set_timer(hostdata, 1)
meant reschedule main() after sleeping for 10 ms. Repeated 25 times this
provided the recommended 250 ms selection time-out delay. This got broken
when HZ became configurable.
We could fix this but there's no need to reschedule the main loop. This
BSY polling presently happens when the NCR5380_main() work queue item
calls NCR5380_select(), which in turn schedules NCR5380_main(), which
calls NCR5380_select() again, and so on.
This algorithm is a deviation from the simpler one in atari_NCR5380.c.
The extra complexity and state is pointless. There's no reason to
stop selection half-way and return to to the main loop when the main
loop can do nothing useful until selection completes.
So just poll for BSY. We can sleep while polling now that we have a
suitable workqueue.
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>
Finn Thain [Sun, 3 Jan 2016 05:05:22 +0000 (16:05 +1100)]
ncr5380: Sleep when polling, if possible
When in process context, sleep during polling if doing so won't add
significant latency. In interrupt context or if the lock is held, poll
briefly then give up. Keep both core drivers in sync.
Calibrate busy-wait iterations to allow for variation in chip register
access times between different 5380 hardware implementations.
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>
Finn Thain [Sun, 3 Jan 2016 05:05:21 +0000 (16:05 +1100)]
ncr5380: Introduce unbound workqueue
Allocate a work queue that will permit busy waiting and sleeping. This
means NCR5380_init() can potentially fail, so add this error path.
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>
Commit 8b801ead3d7a ("[ARM] rpc: update Acorn SCSI drivers to modern ecard
interfaces") neglected to remove a request_region() call in cumana_1.c.
Commit eda32612f7b2 ("[PATCH] give all LLDD driver a ->release method") in
history/history.git added some pointless release_region() calls in dtc.c,
pas16.c and t128.c.
Fix these issues.
Signed-off-by: Finn Thain <fthain@telegraphics.com.au> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Finn Thain [Sun, 3 Jan 2016 05:05:19 +0000 (16:05 +1100)]
ncr5380: Eliminate USLEEP_WAITLONG delay
Linux 2.1.105 introduced the USLEEP_WAITLONG delay, apparently "needed for
Mustek scanners". It is intended to stall the issue queue for 5 seconds.
There are a number of problems with this.
1. Only g_NCR5380 enables the delay, which implies that the other five
drivers using the NCR5380.c core driver remain incompatible with
Mustek scanners.
2. The delay is not implemented by atari_NCR5380.c, which is problematic
for re-unifying the two core driver forks.
3. The delay is implemented using NCR5380_set_timer() which makes it
unreliable. A new command queued by the mid-layer cancels the delay.
4. The delay is applied indiscriminately in several situations in which
NCR5380_select() returns -1. These are-- reselection by the target,
failure of the target to assert BSY, and failure of the target to
assert REQ. It's clear from the comments that USLEEP_WAITLONG is not
relevant to the reselection case. And reportedly, these scanners do
not disconnect.
5. atari_NCR5380.c was forked before Linux 2.1.105, so it was spared some
of the damage done to NCR5380.c. In this case, the atari_NCR5380.c core
driver was more standard-compliant and may not have needed any
workaround like the USLEEP_WAITLONG kludge. The compliance issue was
addressed in the previous patch.
If these scanners still don't work, we need a better solution. Retrying
selection until EH aborts a command offers equivalent robustness. Bugs in
the existing driver prevent EH working correctly but this is addressed in
a subsequent patch. Remove USLEEP_WAITLONG.
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>
Finn Thain [Sun, 3 Jan 2016 05:05:18 +0000 (16:05 +1100)]
ncr5380: Keep BSY asserted when entering SELECTION phase
NCR5380.c is not compliant with the SCSI-2 standard (at least, not with
the draft revision 10L that I have to refer to). The selection algorithm
in atari_NCR5380.c is correct, so use that.
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>
Finn Thain [Sun, 3 Jan 2016 05:05:17 +0000 (16:05 +1100)]
ncr5380: Proceed with next command after NCR5380_select() calls scsi_done
If a target disappears from the SCSI bus, NCR5380_select() may
subsequently fail with a time-out. In this situation, scsi_done is
called and NCR5380_select() returns 0. Both hostdata->connected and
hostdata->selecting are NULL and the main loop should proceed with
the next command in the issue queue. Clarify this logic.
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>
Finn Thain [Sun, 3 Jan 2016 05:05:16 +0000 (16:05 +1100)]
ncr5380: Always escalate bad target time-out in NCR5380_select()
Remove the restart_select and targets_present variables introduced in
Linux v1.1.38. The former was used only for a questionable debug printk
and the latter "so we can call a select failure a retryable condition".
Well, retrying select failure in general is a different problem to a
target that doesn't assert BSY. We need to handle these two cases
differently; the latter case can be left to the SCSI ML.
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>
Finn Thain [Sun, 3 Jan 2016 05:05:15 +0000 (16:05 +1100)]
ncr5380: Use return instead of goto in NCR5380_select()
The "failed" label in NCR5380_select() is not helpful. Some failures
return 0, others -1. Use return instead of goto to improve clarity and
brevity, like atari_NCR5380.c does. Fix the relevant comments.
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>
Finn Thain [Sun, 3 Jan 2016 05:05:14 +0000 (16:05 +1100)]
ncr5380: Remove redundant register writes
Remove the duplicate write to the Select Enable Register that appeared
in v1.1.38.
Also remove the redundant write to Initiator Command Register prior to
calling do_abort().
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>
Finn Thain [Sun, 3 Jan 2016 05:05:13 +0000 (16:05 +1100)]
ncr5380: Remove unused hostdata->aborted flag
The aborted flag was introduced in v1.1.38 but never used. Remove it.
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>
Finn Thain [Sun, 3 Jan 2016 05:05:12 +0000 (16:05 +1100)]
ncr5380: Simplify bus reset handlers
Make use of do_reset() in the bus reset handler in atari_NCR5380.c. The
version in NCR5380.c already does so. Keep them in sync.
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>
Finn Thain [Sun, 3 Jan 2016 05:05:11 +0000 (16:05 +1100)]
atari_NCR5380: Remove RESET_BOOT, CONFIG_ATARI_SCSI_TOSHIBA_DELAY and CONFIG_ATARI_SCSI_RESET_BOOT
The atari_NCR5380.c core driver now takes care of bus reset upon driver
initialization if required (same as NCR5380.c). Move the Toshiba CD-ROM
support into the core driver, enabled with a host flag, so that all
NCR5380 drivers can make use of it.
Drop the RESET_BOOT macros and the ATARI_SCSI_RESET_BOOT and
ATARI_SCSI_TOSHIBA_DELAY Kconfig symbols, which are now redundant.
Remove the atari_scsi_reset_boot(), mac_scsi_reset_boot() and
sun3_scsi_reset_boot() routines. None of this duplicated code is needed
now that all drivers can use NCR5380_maybe_reset_bus().
This brings atari_scsi, mac_scsi and sun3_scsi into line with all of the
other NCR5380 drivers.
The bus reset may raise an interrupt. That would be new behaviour for
atari_scsi only when CONFIG_ATARI_SCSI_RESET_BOOT=n. The ST DMA interrupt
is not assigned to atari_scsi at this stage, so
CONFIG_ATARI_SCSI_RESET_BOOT=y may well be problematic already.
Regardless, do_reset() now raises and clears the interrupt within
local_irq_save/restore which should avoid problems.
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>
Finn Thain [Sun, 3 Jan 2016 05:05:10 +0000 (16:05 +1100)]
atari_NCR5380: Reset bus on driver initialization if required
Merge the bus reset code from NCR5380.c into atari_NCR5380.c. This allows
for removal of a lot of duplicated code conditional on the RESET_BOOT
macro (in the next patch).
The atari_NCR5380.c fork lacks the do_reset() and NCR5380_poll_politely()
routines from NCR5380.c, so introduce them. They are indispensible. Keep
the two implementations in sync.
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>
Finn Thain [Sun, 3 Jan 2016 05:05:09 +0000 (16:05 +1100)]
ncr5380: Move NCR53C400-specific code
Move board-specific code like this,
NCR5380_write(C400_CONTROL_STATUS_REG, CSR_BASE);
from the core driver to the board driver. Eliminate the NCR53C400 macro
from the core driver. Removal of all macros like this one will be
necessary in order to have one core driver that can support all kinds of
boards.
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>
Finn Thain [Sun, 3 Jan 2016 05:05:08 +0000 (16:05 +1100)]
ncr5380: Split NCR5380_init() into two functions
This patch splits the NCR5380_init() function into two parts, similar
to the scheme used with atari_NCR5380.c. This avoids two problems.
Firstly, NCR5380_init() may perform a bus reset, which would cause the
chip to assert IRQ. The chip is unable to mask its bus reset interrupt.
Drivers can't call request_irq() before calling NCR5380_init(), because
initialization must happen before the interrupt handler executes. If
driver initialization causes an interrupt it may be problematic on some
platforms. To avoid that, first move the bus reset code into
NCR5380_maybe_reset_bus().
Secondly, NCR5380_init() contains some board-specific interrupt setup code
for the NCR53C400 that does not belong in the core driver. In moving this
code, better not re-order interrupt initialization and bus reset. Again,
the solution is to move the bus reset code into NCR5380_maybe_reset_bus().
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>
Finn Thain [Sun, 3 Jan 2016 05:05:07 +0000 (16:05 +1100)]
ncr5380: Remove NCR5380_instance_name macro
This macro makes the code cryptic. Remove it.
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>
Finn Thain [Sun, 3 Jan 2016 05:05:06 +0000 (16:05 +1100)]
ncr5380: Remove NCR5380_local_declare and NCR5380_setup macros
The NCR5380_local_declare and NCR5380_setup macros exist to define and
initialize a particular local variable, to provide the address of the
chip registers needed for the driver's implementation of its
NCR5380_read/write register access macros.
In cumana_1 and macscsi, these macros generate pointless code like this,
struct Scsi_Host *_instance;
_instance = instance;
In pas16, the use of NCR5380_read/write in pas16_hw_detect() requires that
the io_port local variable has been defined and initialized, but the
NCR5380_local_declare and NCR5380_setup macros can't be used for that
purpose because the Scsi_Host struct has not yet been instantiated.
Moreover, these macros were removed from atari_NCR5380.c long ago and
now they constitute yet another discrepancy between the two core driver
forks.
Remove these "optimizations".
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>
Finn Thain [Sun, 3 Jan 2016 05:05:05 +0000 (16:05 +1100)]
ncr5380: Remove more pointless macros
ASM macro is never defined. rtrc in pas16.c is not used.
NCR5380_map_config, do_NCR5380_intr, do_t128_intr and do_pas16_intr
are unused. NCR_NOT_SET harms readability. Remove them.
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>
Finn Thain [Sun, 3 Jan 2016 05:05:04 +0000 (16:05 +1100)]
ncr5380: Eliminate PDEBUG*, TDEBUG* and DTCDEBUG* macros
Replace {P,T,DTC}DEBUG_INIT with NDEBUG_INIT. Remove dead debugging
code, including code that's conditional upon *DEBUG_TRANSFER.
Signed-off-by: Finn Thain <fthain@telegraphics.com.au> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
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>
Finn Thain [Sun, 3 Jan 2016 05:05:02 +0000 (16:05 +1100)]
atari_scsi: Fix SCSI host ID setting
The NVRAM location of this byte is 16, as documented in
http://toshyp.atari.org/en/004009.html
This was confirmed by Michael Schmitz, by setting the SCSI host ID
under EmuTOS and then checking the value in /proc/driver/nvram and
/dev/nvram under Linux.
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>
Manoj Kumar [Mon, 14 Dec 2015 21:07:43 +0000 (15:07 -0600)]
cxlflash: Enable device id for future IBM CXL adapter
This drop enables a future card with a device id of 0x0600 to be
recognized by the cxlflash driver.
As per the design, the Accelerator Function Unit (AFU) for this new IBM
CXL Flash Adapter retains the same host interface as the previous
generation. For the early prototypes of the new card, the driver with
this change behaves exactly as the driver prior to this behaved with the
earlier generation card. Therefore, no card specific programming has
been added. These card specific changes can be staged in later if
needed.
Signed-off-by: Manoj N. Kumar <manoj@linux.vnet.ibm.com> Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com> Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Manoj Kumar [Mon, 14 Dec 2015 21:07:23 +0000 (15:07 -0600)]
cxlflash: Resolve oops in wait_port_offline
If an async error interrupt is generated, and the error requires the FC
link to be reset, it cannot be performed in the interrupt context. So a
work element is scheduled to complete the link reset in a process
context. If either an EEH event or an escalation occurs in between when
the interrupt is generated and the scheduled work is started, the MMIO
space may no longer be available. This will cause an oops in the worker
thread.
To prevent the problem space area from being unmapped, when there is
pending work, a mapcount (using the kref mechanism) is held. The
mapcount is released only when the work is completed. The last
reference release is tied to the unmapping service.
Signed-off-by: Manoj N. Kumar <manoj@linux.vnet.ibm.com> Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com> Reviewed-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Manoj Kumar [Mon, 14 Dec 2015 21:07:02 +0000 (15:07 -0600)]
cxlflash: Fix to resolve cmd leak after host reset
After a few iterations of resetting the card, either during EEH
recovery, or a host_reset the following is seen in the logs. cxlflash
0008:00: cxlflash_queuecommand: could not get a free command
At every reset of the card, the commands that are outstanding are being
leaked. No effort is being made to reap these commands. A few more
resets later, the above error message floods the logs and the card is
rendered totally unusable as no free commands are available.
Iterated through the 'cmd' queue and printed out the 'free' counter and
found that on each reset certain commands were in-use and stayed in-use
through subsequent resets.
To resolve this issue, when the card is reset, reap all the commands
that are active/outstanding.
Signed-off-by: Manoj N. Kumar <manoj@linux.vnet.ibm.com> Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com> Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Uma Krishnan [Mon, 14 Dec 2015 21:06:33 +0000 (15:06 -0600)]
cxlflash: Removed driver date print
Having a date for the driver requires it to be updated quite
often. Removing the date which is not necessary. Also made
use of the existing symbol to print the driver name.
Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com> Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Matthew R. Ochs [Mon, 14 Dec 2015 20:55:44 +0000 (14:55 -0600)]
cxlflash: Fix to avoid virtual LUN failover failure
Applications which use virtual LUN's that are backed by a physical LUN
over both adapter ports may experience an I/O failure in the event of a
link loss (e.g. cable pull).
Virtual LUNs may be accessed through one or both ports of the adapter.
This access is encoded in the translation entries that comprise the
virtual LUN and used by the AFU for load-balancing I/O and handling
failover scenarios. In a link loss scenario, even though the AFU is able
to maintain connectivity to the LUN, it is up to the application to
retry the failed I/O. When applications are unaware of the virtual LUN's
underlying topology, they are unable to make a sound decision of when to
retry an I/O and therefore are forced to make their reaction to a failed
I/O absolute. The result is either a failure to retry I/O or increased
latency for scenarios where a retry is pointless.
To remedy this scenario, provide feedback back to the application on
virtual LUN creation as to which ports the LUN may be accessed. LUN's
spanning both ports are candidates for a retry in a presence of an I/O
failure.
Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com> Acked-by: Manoj Kumar <manoj@linux.vnet.ibm.com> Reviewed-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Manoj Kumar [Mon, 14 Dec 2015 20:55:09 +0000 (14:55 -0600)]
cxlflash: Fix to escalate LINK_RESET also on port 1
The original fix to escalate a 'login timed out' error to a LINK_RESET
was only made for one of the two ports on the card. This fix resolves
the same issue for the second port (port 1).
Signed-off-by: Manoj N. Kumar <manoj@linux.vnet.ibm.com> Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com> Reviewed-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
K. Y. Srinivasan [Wed, 23 Dec 2015 21:15:51 +0000 (13:15 -0800)]
storvsc: Tighten up the interrupt path
On the interrupt path, we repeatedly establish the pointer to the
storvsc_device. While the compiler does inline get_in_stor_device() (and
other static functions) in the call chain in the interrupt path, the
compiler is repeatedly inlining the call to get_in_stor_device() each
time it is invoked. The return value of get_in_stor_device() can be
cached in the interrupt path since there is higher level serialization
in place to ensure correct handling when the module unload races with
the processing of an incoming message from the host. Optimize this code
path by caching the pointer to storvsc_device and passing it as an
argument.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Long Li <longli@microsoft.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Hannes Reinecke <hare@suse.com> Tested-by: Alex Ng <alexng@microsoft.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
K. Y. Srinivasan [Wed, 23 Dec 2015 21:15:50 +0000 (13:15 -0800)]
storvsc: Refactor the code in storvsc_channel_init()
The function storvsc_channel_init() repeatedly interacts with the host
to extract various channel properties. Refactor this code to eliminate
code repetition.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Long Li <longli@microsoft.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Hannes Reinecke <hare@suse.com> Tested-by: Alex Ng <alexng@microsoft.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
K. Y. Srinivasan [Wed, 23 Dec 2015 21:15:49 +0000 (13:15 -0800)]
storvsc: Properly support Fibre Channel devices
For FC devices managed by this driver, atttach the appropriate transport
template. This will allow us to create the appropriate sysfs files for
these devices. With this we can publish the wwn for both the port and the node.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Long Li <longli@microsoft.com> Tested-by: Alex Ng <alexng@microsoft.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
K. Y. Srinivasan [Wed, 23 Dec 2015 21:15:48 +0000 (13:15 -0800)]
storvsc: Fix a bug in the layout of the hv_fc_wwn_packet
The hv_fc_wwn_packet is exchanged over vmbus. Make the definition in
Linux match the Windows definition.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Long Li <longli@microsoft.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Tested-by: Alex Ng <alexng@microsoft.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Wilfried Weissmann <Wilfried.Weissmann@gmx.at> Reviewed-by: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Tomas Henzl [Wed, 23 Dec 2015 13:21:47 +0000 (14:21 +0100)]
mpt3sas: A correction in unmap_resources
It might happen that we try to free an already freed pointer.
Reported-by: Maurizio Lombardi <mlombard@redhat.com> Signed-off-by: Tomas Henzl <thenzl@redhat.com> Acked-by: Chaitra P B <chaitra.basappa@avagotech.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Don Brace [Tue, 22 Dec 2015 16:36:48 +0000 (10:36 -0600)]
hpsa: Add box and bay information for enclosure devices
Adding a new method to display enclosure device information.
Reviewed-by: Justin Lindley <justin.lindley@pmcs.com> Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com> Reviewed-by: Scott Teel <scott.teel@pmcs.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Don Brace <don.brace@pmcs.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Don Brace [Tue, 22 Dec 2015 16:36:42 +0000 (10:36 -0600)]
hpsa: Change SAS transport devices to bus 0.
SAS transport places devices on bus 0 but driver was setting the bus to
3.
Reviewed-by: Justin Lindley <justin.lindley@pmcs.com> Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com> Reviewed-by: Scott Teel <scott.teel@pmcs.com> Reviewed-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Don Brace <don.brace@pmcs.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Don Brace [Tue, 22 Dec 2015 16:36:36 +0000 (10:36 -0600)]
hpsa: fix path_info_show
Left off some changes from Rasmus Villemoes where he changed snprintf to
scnprintf.
Suggested-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Reviewed-by: Justin Lindley <justin.lindley@pmcs.com> Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com> Reviewed-by: Scott Teel <scott.teel@pmcs.com> Reviewed-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Don Brace <don.brace@pmcs.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Colin Ian King [Sun, 6 Dec 2015 22:19:40 +0000 (22:19 +0000)]
cciss: print max outstanding commands as a hex value
The max outstanding commands is being printed with a 0x prefix to
suggest it is a hex value, when in fact the integer decimal %d format
specifier is being used and this is a bit confusing. Use %x instead to
match the proceeding 0x prefix.
Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
scsi_debug: Increase the reported optimal transfer length
The OPTIMAL TRANSFER LENGTH reported by scsi_debug is 64 blocks which
translates to 32KB with the default logical block size. That's much
lower than what real storage devices typically report (256KB to 1MB).
Bump the optimal transfer length to 1024 blocks.
Acked-by: Douglas Gilbert <dgilbert@interlog.com> Reviewed-by: Ewan Milne <emilne@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Wed, 16 Dec 2015 23:12:08 +0000 (18:12 -0500)]
lpfc: Update version to 11.0.0.10 for upstream patch set
Update version to 11.0.0.10 for upstream patch set
Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com> Signed-off-by: James Smart <james.smart@avagotech.com> Reviewed-by: Hannes Reinicke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Punit Vara [Wed, 16 Dec 2015 23:12:07 +0000 (18:12 -0500)]
lpfc: Use kzalloc instead of kmalloc
This patch is to the lpfc_els.c which resolves following warning
reported by coccicheck:
WARNING: kzalloc should be used for rdp_context, instead of
kmalloc/memset
Signed-off-by: Punit Vara <punitvara@gmail.com> Signed-off-by: James Smart <james.smart@avagotech.com> Reviewed-by: Hannes Reinicke <hare@suse.de> Reviewed-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com> Reviewed-by: Sebastian Herbszt <herbszt@gmx.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Markus Elfring [Wed, 16 Dec 2015 23:12:06 +0000 (18:12 -0500)]
lpfc: Delete unnecessary checks before the function call "mempool_destroy"
The mempool_destroy() function tests whether its argument is NULL
and then returns immediately. Thus the test around the calls is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: James Smart <james.smart@avagotech.com> Reviewed-by: Hannes Reinicke <hare@suse.de> Reviewed-by: Sebastian Herbszt <herbszt@gmx.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Wed, 16 Dec 2015 23:12:05 +0000 (18:12 -0500)]
lpfc: Add logging for misconfigured optics.
Add logging for misconfigured optics acqe reported by fw.
Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com> Signed-off-by: James Smart <james.smart@avagotech.com> Reviewed-by: Hannes Reinicke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Wed, 16 Dec 2015 23:12:04 +0000 (18:12 -0500)]
lpfc: Fix external loopback failure.
Fix external loopback failure.
Rx sequence reassembly was incorrect.
Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com> Signed-off-by: James Smart <james.smart@avagotech.com> Reviewed-by: Hannes Reinicke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Wed, 16 Dec 2015 23:12:03 +0000 (18:12 -0500)]
lpfc: Fix mbox reuse in PLOGI completion
Fix mbox reuse in PLOGI completion. Moved allocations so that buffer
properly init'd.
Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com> Signed-off-by: James Smart <james.smart@avagotech.com> Reviewed-by: Hannes Reinicke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Wed, 16 Dec 2015 23:12:02 +0000 (18:12 -0500)]
lpfc: Use new FDMI speed definitions for 10G, 25G and 40G FCoE.
Use new FDMI speed definitions for 10G, 25G and 40G FCoE.
Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com> Signed-off-by: James Smart <james.smart@avagotech.com> Reviewed-by: Hannes Reinicke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Wed, 16 Dec 2015 23:12:01 +0000 (18:12 -0500)]
lpfc: Make write check error processing more resilient
Make write check error processing more resilient.
Checks to catch writes that fw reports weren't fully complete yet SCSI
status indicated fine needed correction.
Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com> Signed-off-by: James Smart <james.smart@avagotech.com> Reviewed-by: Hannes Reinicke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Wed, 16 Dec 2015 23:12:00 +0000 (18:12 -0500)]
lpfc: Fix RDP ACC being too long.
Fix RDP ACC being too long.
Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com> Signed-off-by: James Smart <james.smart@avagotech.com> Reviewed-by: Hannes Reinicke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Wed, 16 Dec 2015 23:11:59 +0000 (18:11 -0500)]
lpfc: Fix RDP Speed reporting.
Fix RDP Speed reporting.
Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com> Signed-off-by: James Smart <james.smart@avagotech.com> Reviewed-by: Hannes Reinicke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Wed, 16 Dec 2015 23:11:58 +0000 (18:11 -0500)]
lpfc: Modularize and cleanup FDMI code in driver
Modularize, cleanup, add comments - for FDMI code in driver
Note: I don't like the comments with leading # - but as we have a lot if
present, I'm deferring to handle it in one big fix later.
Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com> Signed-off-by: James Smart <james.smart@avagotech.com> Reviewed-by: Hannes Reinicke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Wed, 16 Dec 2015 23:11:57 +0000 (18:11 -0500)]
lpfc: Fix crash in fcp command completion path.
Fix crash in fcp command completion path.
Missed null check.
Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com> Signed-off-by: James Smart <james.smart@avagotech.com> Reviewed-by: Hannes Reinicke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Wed, 16 Dec 2015 23:11:56 +0000 (18:11 -0500)]
lpfc: Fix driver crash when module parameter lpfc_fcp_io_channel set to 16
Fix driver crash when module parameter lpfc_fcp_io_channel set to 16
Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com> Signed-off-by: James Smart <james.smart@avagotech.com> Reviewed-by: Hannes Reinicke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Wed, 16 Dec 2015 23:11:55 +0000 (18:11 -0500)]
lpfc: Fix RegLogin failed error seen on Lancer FC during port bounce
Fix RegLogin failed error seen on Lancer FC during port bounce
Fix the statemachine and ref counting.
Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com> Signed-off-by: James Smart <james.smart@avagotech.com> Reviewed-by: Hannes Reinicke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Wed, 16 Dec 2015 23:11:53 +0000 (18:11 -0500)]
lpfc: Fix the FLOGI discovery logic to comply with T11 standards
Fix the FLOGI discovery logic to comply with T11 standards
We weren't properly setting fabric parameters, such as R_A_TOV and E_D_TOV,
when we registered the vfi object in default configs and pt2pt configs.
Revise to now pass service params with the values to the firmware and
ensure they are reset on link bounce. Required reworking the call sequence
in the discovery threads.
Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com> Signed-off-by: James Smart <james.smart@avagotech.com> Reviewed-by: Hannes Reinicke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
James Smart [Wed, 16 Dec 2015 23:11:52 +0000 (18:11 -0500)]
lpfc: Fix FCF Infinite loop in lpfc_sli4_fcf_rr_next_index_get.
Fix FCF Infinite loop in lpfc_sli4_fcf_rr_next_index_get.
Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com> Signed-off-by: James Smart <james.smart@avagotech.com> Reviewed-by: Hannes Reinicke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Fri, 11 Dec 2015 12:03:21 +0000 (20:03 +0800)]
hisi_sas: use platform_get_irq()
It is preferred that drivers use platform_get_irq() instead of
irq_of_parse_and_map(), so replace.
Signed-off-by: John Garry <john.garry@huawei.com> Acked-by: Rob Herring <robh@kernel.org> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dan Carpenter [Wed, 9 Dec 2015 10:48:36 +0000 (13:48 +0300)]
hisi_sas: fix error codes in hisi_sas_task_prep()
There were a couple cases where the error codes weren't set and also I
changed the success return to "return 0;" which is the same as
"return rc;" but more explicit.
Fixes: 42e7a69368a5 ('hisi_sas: Add ssp command functio') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Tested-by: John Garry <john.garry@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
If char is signed and one of these bytes happen to have a value outside
the ascii range, the corresponding output will consist of "ffffff"
followed by the two hex chars that were actually intended. One way to
fix it would be to change the casts to (u8*) aka
(unsigned char*), but it is much simpler (and generates smaller code)
to use the %ph extension which was created for such short hexdumps.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Acked-by: Boaz Harrosh <ooo@electrozaur.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Long Li [Fri, 4 Dec 2015 08:07:24 +0000 (00:07 -0800)]
storvsc: add logging for error/warning messages
Introduce a logging level for storvsc to log certain error/warning
messages. Those messages are helpful in some environments,
e.g. Microsoft Azure, for customer support and troubleshooting purposes.
Signed-off-by: Long Li <longli@microsoft.com> Acked-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Josh Boyer [Thu, 3 Dec 2015 13:27:59 +0000 (08:27 -0500)]
VMW_PVSCSI: Fix the issue of DMA-API related warnings.
The driver is missing calls to pci_dma_mapping_error() after
performing the DMA mapping, which caused DMA-API warning to
show up in dmesg's output. Though that happens only when
DMA_API_DEBUG option is enabled. This change fixes the issue
and makes pvscsi_map_buffers() function more robust.
Signed-off-by: Arvind Kumar <arvindkumar@vmware.com> Cc: Josh Boyer <jwboyer@fedoraproject.org> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Josh Boyer <jwboyer@fedoraproject.org> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Geliang Tang [Thu, 3 Dec 2015 21:18:49 +0000 (15:18 -0600)]
cxlflash: drop unlikely before IS_ERR_OR_NULL
IS_ERR_OR_NULL already contain an unlikely compiler flag. Drop it.
Signed-off-by: Geliang Tang <geliangtang@163.com> Acked-by: Manoj Kumar <manoj@linux.vnet.ibm.com> Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dan Carpenter [Wed, 2 Dec 2015 23:26:28 +0000 (17:26 -0600)]
cxlflash: a couple off by one bugs
The "> MAX_CONTEXT" should be ">= MAX_CONTEXT". Otherwise we go one
step beyond the end of the cfg->ctx_tbl[] array.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Manoj Kumar <manoj@linux.vnet.ibm.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Hannes Reinecke [Thu, 3 Dec 2015 06:57:35 +0000 (07:57 +0100)]
scsi_dh_alua: Remove stale variables
With commit 83ea0e5e3501 ("scsi_dh_alua: use scsi_vpd_tpg_id()") these
variables became obsolete, but weren't removed.
[mkp: Fixed checkpatch warning]
Signed-off-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Anil Gurumurthy [Thu, 26 Nov 2015 08:54:00 +0000 (03:54 -0500)]
bfa: Fix for crash when bfa_itnim is NULL
Fix a very corner case when the port gets disconnected and the BFA and
FCS layers clean up references to the IT nexus. During this window if a
task management command is issued by the SCSI-ML and ends up referencing
a NULL itnim, it could lead to a crash.
Signed-off-by: Sudarsana Kalluru <sudarsana.kalluru@qlogic.com> Signed-off-by: Anil Gurumurthy <anil.gurumurthy@qlogic.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Hannes Reinecke [Tue, 1 Dec 2015 09:16:58 +0000 (10:16 +0100)]
scsi_dh_alua: use scsi_vpd_tpg_id()
Use the common function 'scsi_vpd_tpg_id()' instead of open-coding
it in scsi_dh_alua.
[mkp: Applied by hand]
Signed-off-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Hannes Reinecke [Tue, 1 Dec 2015 09:16:57 +0000 (10:16 +0100)]
scsi: Add scsi_vpd_tpg_id()
Implement scsi_vpd_tpg_id() to extract the target
port group id and the relative port id from
SCSI VPD page 0x83.
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Hannes Reinecke [Tue, 1 Dec 2015 09:16:56 +0000 (10:16 +0100)]
scsi: export 'wwid' to sysfs
Use scsi_vpd_lun_id() to export the world-wide unique id (wwid) to
sysfs. Note that this is the 'best' wwid according to the rules in
scsi_vpd_lun_id(), not every possible wwid presented by the drive.
Signed-off-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Hannes Reinecke [Tue, 1 Dec 2015 09:16:55 +0000 (10:16 +0100)]
scsi: Add scsi_vpd_lun_id()
Add a function scsi_vpd_lun_id() to return a unique device
identifcation based on the designation descriptors of
VPD page 0x83.
As devices might implement several descriptors the order
of preference is:
- NAA IEE Registered Extended
- EUI-64 based 16-byte
- EUI-64 based 12-byte
- NAA IEEE Registered
- NAA IEEE Extended
A SCSI name string descriptor is preferred to all of them
if the identification is longer than 16 bytes.
The returned unique device identification will be formatted
as a SCSI Name string to avoid clashes between different
designator types.
[mkp: Fixed up kernel doc comment from Johannes]
Signed-off-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Ewan Milne <emilne@redhat.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Hannes Reinecke [Tue, 1 Dec 2015 09:16:54 +0000 (10:16 +0100)]
scsi_dh_alua: simplify sense code handling
Most sense code is already handled in the generic
code, so we shouldn't be adding special cases here.
However, when doing so we need to check for
unit attention whenever we're sending an internal
command.
Signed-off-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Ewan Milne <emilne@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Hannes Reinecke [Tue, 1 Dec 2015 09:16:53 +0000 (10:16 +0100)]
scsi_dh_alua: rework alua_check_tpgs() to return the tpgs mode
Instead of returning an error code in alua_check_tpgs() we should
rather return the tpgs mode directly and have a cleaner syntax.
Signed-off-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Hannes Reinecke [Tue, 1 Dec 2015 09:16:52 +0000 (10:16 +0100)]
scsi_dh_alua: use unaligned access macros
Use 'get_unaligned_XX' and 'put_unaligned_XX' instead of
open-coding it.
Signed-off-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Hannes Reinecke [Tue, 1 Dec 2015 09:16:51 +0000 (10:16 +0100)]
scsi_dh_alua: use flag for RTPG extended header
We should be using a flag when RTPG extended header is not
supported, that saves us sending RTPG twice for older arrays.
Signed-off-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Hannes Reinecke [Tue, 1 Dec 2015 09:16:50 +0000 (10:16 +0100)]
scsi: remove scsi_show_sense_hdr()
Last caller is gone, so remove it.
Signed-off-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Hannes Reinecke [Tue, 1 Dec 2015 09:16:49 +0000 (10:16 +0100)]
scsi_dh_alua: fixup description of stpg_endio()
Fixup copy-and-paste error in the description of stpg_endio().
Signed-off-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Hannes Reinecke [Tue, 1 Dec 2015 09:16:48 +0000 (10:16 +0100)]
scsi_dh_alua: return standard SCSI return codes in submit_rtpg
Fixup submit_rtpg() to always return a standard SCSI return code.
Signed-off-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Ewan Milne <emilne@redhat.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Hannes Reinecke [Tue, 1 Dec 2015 09:16:47 +0000 (10:16 +0100)]
scsi_dh_alua: use standard logging functions
Use standard logging functions instead of hand-crafted ones.
Signed-off-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Ewan Milne <emilne@redhat.com> Reviewed-by: Bart Van Assche <bvanassche@sandisk.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Hannes Reinecke [Tue, 1 Dec 2015 09:16:46 +0000 (10:16 +0100)]
scsi_dh_alua: sanitze sense code handling
The only check for a valid sense code is calling scsi_normalize_sense()
and check the return value. So drop the pointless checks and rely on
scsi_normalize_sense() to figure out if the sense code is valid.
With that we can also remove the 'senselen' field.
Signed-off-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.com> Reviewed-by: Bart van Assche <bvanassche@sandisk.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Hannes Reinecke [Tue, 1 Dec 2015 09:16:45 +0000 (10:16 +0100)]
scsi_dh_alua: improved logging
Issue different logging messages if ALUA is not supported
or the TPGS setting is invalid.
Signed-off-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Hannes Reinecke [Tue, 1 Dec 2015 09:16:44 +0000 (10:16 +0100)]
scsi_dh_alua: Use vpd_pg83 information
The SCSI device now has the VPD page 0x83 information attached,
so there is no need to query it again.
[mkp: Fixed a checkpatch warning]
Signed-off-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Hannes Reinecke [Tue, 1 Dec 2015 09:16:43 +0000 (10:16 +0100)]
scsi_dh_alua: Disable ALUA handling for non-disk devices
Non-disk devices might support ALUA, but the firmware
implementation is untested and frequently broken.
As we're don't actually need it disable ALUA support
for non-disk device for now.
Signed-off-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Hannes Reinecke [Tue, 1 Dec 2015 09:16:42 +0000 (10:16 +0100)]
scsi: ignore errors from scsi_dh_add_device()
device handler initialisation might fail due to a number of
reasons. But as device_handlers are optional this shouldn't
cause us to disable the device entirely.
So just ignore errors from scsi_dh_add_device().
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Hannes Reinecke [Tue, 1 Dec 2015 09:16:41 +0000 (10:16 +0100)]
scsi_dh: move 'dh_state' sysfs attribute to generic code
As scsi_dh.c is now always compiled in we should be moving
the 'dh_state' attribute to the generic code.
Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.com> Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Fix a smatch warning:
drivers/scsi/mvsas/mv_sas.c:740 mvs_task_prep() warn: curly braces intended?
The code is correct, the indention is misleading. When the device is not
ready we want to return SAS_PHY_DOWN. But current indentation makes it
look like we only do so in the else branch of if (mvi_dev).
Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Colin Ian King [Sat, 28 Nov 2015 16:33:56 +0000 (16:33 +0000)]
scsi: ufs: fix spelling mistake in error message
Minor issue, fix spelling mistake, Intialization -> Initialization
Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Ching Huang <ching2048@areca.com.tw> Reviewed-by: Tomas Henzl <thenzl@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Ching Huang [Thu, 26 Nov 2015 11:41:15 +0000 (19:41 +0800)]
arcmsr: Split dma resource allocation to a new function
Split dma resource allocation and io register assignment from get_config
to a new function arcmsr_alloc_io_queue.
Signed-off-by: Ching Huang <ching2048@areca.com.tw> Reviewed-by: Tomas Henzl <thenzl@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>