]> git.karo-electronics.de Git - linux-beck.git/log
linux-beck.git
9 years agoscsi_debug: add Report supported opcodes+tmfs; Compare and write
Douglas Gilbert [Tue, 25 Nov 2014 02:27:12 +0000 (21:27 -0500)]
scsi_debug: add Report supported opcodes+tmfs; Compare and write

The Report supported operation codes command is very closely integrated
into the table driven parser and very useful for testing it. Its cdb
masks form the basis of the 'strict' parameter's checks. The Report
supported TMFs command is a simple extension. The Compare and write
command may even be useful, as it should be atomic due to the read-write
lock that the driver uses on its backing store (ram).

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoscsi_debug: change SCSI command parser to table driven
Douglas Gilbert [Tue, 25 Nov 2014 01:46:29 +0000 (20:46 -0500)]
scsi_debug: change SCSI command parser to table driven

The existing 'big switch' parser in queuecommand() is changed to
a table driven parser. The old and new queuecommand() were moved
in the source so diff would not shuffle them. Apart from the new
tables most other changes are refactoring existing response code
to be more easily called out of the table parser. The 'strict'
parameter is added so that cdb_s can be checked for non-zero
values in parts of the cdb that are reserved. Some other changes
include: tweak request sense response when D_SENSE differs; support
NDOB in Write Same(16); and fix crash in Get LBA Status when LBP
was inactive.

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoscsi_debug: add Capacity Changed Unit Attention
Douglas Gilbert [Tue, 25 Nov 2014 01:27:51 +0000 (20:27 -0500)]
scsi_debug: add Capacity Changed Unit Attention

Via sysfs the virtual_gb scsi_debug parameter can be changed while
LUs are in use. If that changes, the 'Capacity data has changed'
Unit Attention is queued on all LUs.

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoscsi_debug: append inject error flags onto scsi_cmnd object
Douglas Gilbert [Tue, 25 Nov 2014 01:18:02 +0000 (20:18 -0500)]
scsi_debug: append inject error flags onto scsi_cmnd object

The way the existing scsi_debug command parser associated various
inject error flags to a command was difficult to replicate in the
table driven parser. This patch adds infrastructure to append those
flags to the end of a scsi_cmnd object with the cmd_size host
template option.

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoscsi_debug: pinpoint invalid field in sense data
Douglas Gilbert [Tue, 25 Nov 2014 04:04:47 +0000 (23:04 -0500)]
scsi_debug: pinpoint invalid field in sense data

Use Sense Key Specific field in the sense data of an ILLEGAL REQUEST
to optionally pinpoint the location of the problem field. This may
be either in the cdb or the associated parameter list.

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agowd719x: Add firmware documentation
Ondrej Zary [Mon, 24 Nov 2014 22:24:42 +0000 (23:24 +0100)]
wd719x: Add firmware documentation

Add documentation and script to obtain required firmware.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agowd719x: Introduce Western Digital WD7193/7197/7296 PCI SCSI card driver
Ondrej Zary [Mon, 24 Nov 2014 22:24:41 +0000 (23:24 +0100)]
wd719x: Introduce Western Digital WD7193/7197/7296 PCI SCSI card driver

Introduce wd719x, a driver for Western Digital WD7193, WD7197 and WD7296 PCI
SCSI controllers based on WD33C296A chip.
Tested with WD7193 card.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoeeprom-93cx6: Add (read-only) support for 8-bit mode
Ondrej Zary [Mon, 24 Nov 2014 22:24:40 +0000 (23:24 +0100)]
eeprom-93cx6: Add (read-only) support for 8-bit mode

Add read-only support for EEPROMs configured in 8-bit mode (ORG pin connected
to GND).
This will be used by wd719x driver.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoesas2r: fix an oversight in setting return value
Tomas Henzl [Sun, 16 Nov 2014 13:35:34 +0000 (14:35 +0100)]
esas2r: fix an oversight in setting return value

The patch moves an error code assigment to a 'default' case
in the previous switch statement.

Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Acked-by: Bradley Grove <bgrove@attotech.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoesas2r: fix an error path in esas2r_ioctl_handler
Tomas Henzl [Sun, 16 Nov 2014 13:35:33 +0000 (14:35 +0100)]
esas2r: fix an error path in esas2r_ioctl_handler

Is seems strange to manipulate nvram_semaphore when in this place,
this patch fixes it.

Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Acked-by: Bradley Grove <bgrove@attotech.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoesas2r: fir error handling in do_fm_api
Tomas Henzl [Sun, 16 Nov 2014 13:35:32 +0000 (14:35 +0100)]
esas2r: fir error handling in do_fm_api

This patch fixes an error path and rearranges error handling.

Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Acked-by: Bradley Grove <bgrove@attotech.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agotmscsim: replace by am53c974 driver
Hannes Reinecke [Mon, 24 Nov 2014 14:37:30 +0000 (15:37 +0100)]
tmscsim: replace by am53c974 driver

The am53c974 is a re-implementation of the tmscsim driver,
and provides the same functionality.
So remove the tmscsim driver and make am53c974 an alias to tmscsim.

Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoesp_scsi: enable CONFIG2_FENAB for am53c974
Hannes Reinecke [Mon, 24 Nov 2014 14:37:29 +0000 (15:37 +0100)]
esp_scsi: enable CONFIG2_FENAB for am53c974

CONFIG2_FENAB ('feature enable') changed definition between chip
revisions, from 'Latch SCSI Phase' to 'Latch SCSI Phase, display
chip ID upon reset, and enable 24 bit addresses'.
So only enable it for am53c974 where we know what it's doing.

Acked-by: David S. Miller <davem@davemloft.net>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoesp_scsi: let DMA driver provide a config2 value
Paolo Bonzini [Mon, 24 Nov 2014 14:37:28 +0000 (15:37 +0100)]
esp_scsi: let DMA driver provide a config2 value

On PCscsi, the FENAB configuration also enables 24-bit DMA
transfer lengths (and provides the chip id in TCHI after reset).
We want to be able to enable this parameter from the DMA driver.

Check if the caller of scsi_esp_register provided a value for esp->config2.
If this is the case, assume this is not an ESP100, skip the detection
phase and leave esp->config2 untouched.  It will be used in esp_reset_esp.

Reviewed-by: Hannes Reinecke <hare@suse.de>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoesp_scsi: correctly detect am53c974
Hannes Reinecke [Mon, 24 Nov 2014 14:37:27 +0000 (15:37 +0100)]
esp_scsi: correctly detect am53c974

The am53c974 returns the same ID as the FAS236, but implements
things slightly differently. So detect the am53c974 by checking
for ESP_CONFIG4 register.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoam53c974: BLAST residual handling
Hannes Reinecke [Mon, 24 Nov 2014 14:37:26 +0000 (15:37 +0100)]
am53c974: BLAST residual handling

The am53c974 has an design issue where a single byte might be
left in the SCSI FIFO after a DMA transfer.
As the handling code is currently untested add a WARN_ON()
statement here.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoam53c974: add new driver
Hannes Reinecke [Mon, 24 Nov 2014 14:37:25 +0000 (15:37 +0100)]
am53c974: add new driver

This patch adds a new implementation for the Tekram DC-390T /
AMD AM53c974 SCSI controller, based on the generic
esp_scsi infrastructure.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoesp_scsi: use FIFO for command submission
Hannes Reinecke [Mon, 24 Nov 2014 14:37:24 +0000 (15:37 +0100)]
esp_scsi: use FIFO for command submission

Using DMA for command submission has the drawback that it might
generate additional DMA completion interrupts after the command
has been submitted to the device.
Additionally the am53c974 has a design flaw causing it
to generate spurious interrupts even though DMA completion
interrupts are not enabled.
This can be avoided by using the FIFO for command submission.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoesp_scsi: read status registers
Hannes Reinecke [Mon, 24 Nov 2014 14:37:23 +0000 (15:37 +0100)]
esp_scsi: read status registers

A read to ESP_INTRPT will clear ESP_STATUS and ESP_SSTEP. So read
all status registers in one go to avoid losing information.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoesp_scsi: debug event and command
Hannes Reinecke [Mon, 24 Nov 2014 14:37:22 +0000 (15:37 +0100)]
esp_scsi: debug event and command

Add new debug definitions for event and command logging.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoesp_scsi: convert to dev_printk
Hannes Reinecke [Mon, 24 Nov 2014 14:37:21 +0000 (15:37 +0100)]
esp_scsi: convert to dev_printk

Use dev_printk functions for correct device annotations.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoesp_scsi: make number of tags configurable
Hannes Reinecke [Mon, 24 Nov 2014 14:37:20 +0000 (15:37 +0100)]
esp_scsi: make number of tags configurable

Add a field 'num_tags' to the esp structure to allow drivers
to overwrite the number of avialable tags if required.
Default is ESP_DEFAULT_TAGS.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoesp_scsi: spellcheck 'driver'
Hannes Reinecke [Mon, 24 Nov 2014 14:37:19 +0000 (15:37 +0100)]
esp_scsi: spellcheck 'driver'

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agovmw_pscsi: simplify ->change_queue_depth
Christoph Hellwig [Thu, 13 Nov 2014 14:14:43 +0000 (15:14 +0100)]
vmw_pscsi: simplify ->change_queue_depth

Remove overly verbose debugging output that pokes into mid-layer internal
structures that looks like copy & paste from the mpt2/3 drivers.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Reviewed-by: Hannes Reinecke <hare@suse.de>
9 years agompt3sas: simplify ->change_queue_depth
Christoph Hellwig [Thu, 13 Nov 2014 14:13:20 +0000 (15:13 +0100)]
mpt3sas: simplify ->change_queue_depth

Merge two functions, and remove overly verbose debugging output that pokes
into mid-layer internal structures.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Reviewed-by: Hannes Reinecke <hare@suse.de>
9 years agompt2sas: simplify ->change_queue_depth
Christoph Hellwig [Thu, 13 Nov 2014 14:11:59 +0000 (15:11 +0100)]
mpt2sas: simplify ->change_queue_depth

Merge two functions, and remove overly verbose debugging output that pokes
into mid-layer internal structures.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Reviewed-by: Hannes Reinecke <hare@suse.de>
9 years agoscsi: drop reason argument from ->change_queue_depth
Christoph Hellwig [Thu, 13 Nov 2014 14:08:42 +0000 (15:08 +0100)]
scsi: drop reason argument from ->change_queue_depth

Drop the now unused reason argument from the ->change_queue_depth method.
Also add a return value to scsi_adjust_queue_depth, and rename it to
scsi_change_queue_depth now that it can be used as the default
->change_queue_depth implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Reviewed-by: Hannes Reinecke <hare@suse.de>
9 years agoscsi: don't allow setting of queue_depth bigger than can_queue
Christoph Hellwig [Thu, 13 Nov 2014 13:27:41 +0000 (14:27 +0100)]
scsi: don't allow setting of queue_depth bigger than can_queue

We won't ever queue more commands than the host allows.  Instead of
letting drivers either reject or ignore this case handle it in
common code.  Note that various driver use internal constant or
variables that are assigned to both shost->can_queue and checked
in ->change_queue_depth - I did remove those checks as well.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Reviewed-by: Hannes Reinecke <hare@suse.de>
9 years agoscsi: avoid ->change_queue_depth indirection for queue full tracking
Christoph Hellwig [Thu, 13 Nov 2014 13:25:11 +0000 (14:25 +0100)]
scsi: avoid ->change_queue_depth indirection for queue full tracking

All drivers use the implementation for ramping the queue up and down, so
instead of overloading the change_queue_depth method call the
implementation diretly if the driver opts into it by setting the
track_queue_depth flag in the host template.

Note that a few drivers validated the new queue depth in their
change_queue_depth method, but as we never go over the queue depth
set during slave_configure or the sysfs file this isn't nessecary
and can safely be removed.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Venkatesh Srinivas <venkateshs@google.com>
9 years agolpfc: remove queue_depth events
Christoph Hellwig [Thu, 13 Nov 2014 11:42:04 +0000 (12:42 +0100)]
lpfc: remove queue_depth events

James Smart said the userspace to consume these events never emerged.  Given
that these get in the way of the following patches remove support for them.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Acked-by: James Smart <james.smart@emulex.com>
9 years agomegaraid_sas: do not process IOCTLs and SCSI commands during driver removal
Sumit.Saxena@avagotech.com [Mon, 17 Nov 2014 09:54:08 +0000 (15:24 +0530)]
megaraid_sas: do not process IOCTLs and SCSI commands during driver removal

Do not process any SCSI and IOCTL command further (return them with
appropriate return values to callers), while driver removal is in
progress or PCI shutdown is invoked.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agomegaraid_sas: dndinaness related bug fixes
Sumit.Saxena@avagotech.com [Mon, 17 Nov 2014 09:54:28 +0000 (15:24 +0530)]
megaraid_sas: dndinaness related bug fixes

This patch addresses few endianness related bug fixes.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agomegaraid_sas: corrected return of wait_event from abort frame path
Sumit.Saxena@avagotech.com [Mon, 17 Nov 2014 09:54:23 +0000 (15:24 +0530)]
megaraid_sas: corrected return of wait_event from abort frame path

Corrected wait_event() call which was waiting for wrong completion
status (0xFF).

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agomegaraid_sas: make HBA operational after LD_MAP_SYNC DCMD in OCR path
Sumit.Saxena@avagotech.com [Mon, 17 Nov 2014 09:54:18 +0000 (15:24 +0530)]
megaraid_sas: make HBA operational after LD_MAP_SYNC DCMD in OCR path

In OCR(Online Controller Reset) path, driver sets adapter state to
MEGASAS_HBA_OPERATIONAL before getting new RAID map.  There will be a small
window where IO will come from OS with old RAID map. This patch will update
adapter state to MEGASAS_HBA_OPERATIONAL, only after driver has new RAID
map to avoid any IOs getting build using old RAID map.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agomegaraid_sas: online Firmware upgrade support for Extended VD feature
Sumit.Saxena@avagotech.com [Mon, 17 Nov 2014 09:54:13 +0000 (15:24 +0530)]
megaraid_sas: online Firmware upgrade support for Extended VD feature

In OCR (Online Controller Reset) path, driver sets adapter state to
MEGASAS_HBA_OPERATIONAL before getting new RAID map.  There will be a small
window where IO will come from OS with old RAID map.  This patch will
update adapter state to MEGASAS_HBA_OPERATIONAL, only after driver has new
RAID map to avoid any IOs getting build using old RAID map.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agomegaraid_sas: update MAINTAINERS and copyright information for megaraid drivers
Sumit.Saxena@avagotech.com [Mon, 17 Nov 2014 09:54:03 +0000 (15:24 +0530)]
megaraid_sas: update MAINTAINERS and copyright information for megaraid drivers

Update MAINTAINERS list and copyright information for megaraid_sas driver.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agomegaraid_sas: driver version upgrade and remove some meta data of driver
Sumit.Saxena@avagotech.com [Mon, 17 Nov 2014 09:53:58 +0000 (15:23 +0530)]
megaraid_sas: driver version upgrade and remove some meta data of driver

Update driver version and remove some meta data (release date and extended
version) about megaraid_sas driver.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agozfcp: auto port scan resiliency
Martin Peschke [Thu, 13 Nov 2014 13:59:48 +0000 (14:59 +0100)]
zfcp: auto port scan resiliency

This patch improves the Fibre Channel port scan behaviour of the zfcp lldd.
Without it the zfcp device driver may churn up the storage area network by
excessive scanning and scan bursts, particularly in big virtual server
environments, potentially resulting in interference of virtual servers and
reduced availability of storage connectivity.

The two main issues as to the zfcp device drivers automatic port scan in
virtual server environments are frequency and simultaneity.
On the one hand, there is no point in allowing lots of ports scans
in a row. It makes sense, though, to make sure that a scan is conducted
eventually if there has been any indication for potential SAN changes.
On the other hand, lots of virtual servers receiving the same indication
for a SAN change had better not attempt to conduct a scan instantly,
that is, at the same time.

Hence this patch has a two-fold approach for better port scanning:
the introduction of a rate limit to amend frequency issues, and the
introduction of a short random backoff to amend simultaneity issues.
Both approaches boil down to deferred port scans, with delays
comprising parts for both approaches.

The new port scan behaviour is summarised best by:

                                               NEW:    NEW:
                          no_auto_port_rescan  random  rate    flush
                                               backoff limit   =wait

adapter resume/thaw       yes                  yes     no      yes*
adapter online (user)     no                   yes     no      yes*
port rescan (user)        no                   no      no      yes
adapter recovery (user)   yes                  yes     yes     no
adapter recovery (other)  yes                  yes     yes     no
incoming ELS              yes                  yes     yes     no
incoming ELS lost         yes                  yes     yes     no

Implementation is straight-forward by converting an existing worker to
a delayed worker. But care is needed whenever that worker is going to be
flushed (in order to make sure work has been completed), since a flush
operation cancels the timer set up for deferred execution (see * above).

There is a small race window whenever a port scan work starts
running up to the point in time of storing the time stamp for that port
scan. The impact is negligible. Closing that gap isn't trivial, though, and
would the destroy the beauty of a simple work-to-delayed-work conversion.

Signed-off-by: Martin Peschke <mpeschke@linux.vnet.ibm.com>
Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agozfcp: bring back unit sysfs attributes for automatic LUN scan
Steffen Maier [Thu, 13 Nov 2014 13:59:47 +0000 (14:59 +0100)]
zfcp: bring back unit sysfs attributes for automatic LUN scan

Through sysfs attributes, zfcp unit objects
provide a trigger for manual LUN recovery
and export information for problem determination.

With commit
f8210e34887e1feb977a9b6b8caa086855af40c9
"[SCSI] zfcp: Allow midlayer to scan for LUNs when running in NPIV mode"
and when attaching SCSI devices through this new optional method,
no more zfcp unit objects are allocated for such SCSI devices.
Hence, the above-mentioned trigger and information were missing.

The information and context is located in SCSI transport device data since
b62a8d9b45b971a67a0f8413338c230e3117dff5
"[SCSI] zfcp: Use SCSI device data zfcp_scsi_dev instead of zfcp_unit"
57c237731b92fadc7d44824276313ec330b1989b
"[SCSI] zfcp: Add zfcp private struct as SCSI device driver data"
Hence, introduce the trigger and the information unconditionally
for all SCSI devices attached through zfcp.

We prefix the attribute names with 'zfcp_' to prevent collisions and
to avoid mix-ups such as with the common 'state' attribute.

Since some of the new attribute views do not need zfcp_port
in the ZFCP_DEFINE_SCSI_ATTR helper macro, remove zfcp_port
to avoid compiler warnings on unused variable.
It's easy to open code the conversion from zfcp_scsi_dev to zfcp_port
for the two already existing attributes hba_id and wwpn.

Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
Reviewed-by: Martin Peschke <mpeschke@linux.vnet.ibm.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agobfa: replace 2 kzalloc/copy_from_user by memdup_user
Fabian Frederick [Fri, 14 Nov 2014 18:49:58 +0000 (19:49 +0100)]
bfa: replace 2 kzalloc/copy_from_user by memdup_user

This patch also removes unnecessary printk(KERN_INFO

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Acked-by: Anil Gurumurthy <anil.gurumurthy@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agozfcp: remove access control tables interface (port leftovers)
Martin Peschke [Thu, 13 Nov 2014 13:59:46 +0000 (14:59 +0100)]
zfcp: remove access control tables interface (port leftovers)

This patch removes some leftovers for commit
663e0890e31cb85f0cca5ac1faaee0d2d52880b5
"[SCSI] zfcp: remove access control tables interface".

The "access denied" case for ports is gone, as well.
The corresponding flag was cleared, but never set.
So clean it up.

Sysfs flag is kept, though, for backward-compatibility.
Now it returns always 0.

Signed-off-by: Martin Peschke <mpeschke@linux.vnet.ibm.com>
Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agovirtio_scsi: support multi hw queue of blk-mq
Ming Lei [Sat, 15 Nov 2014 03:47:14 +0000 (11:47 +0800)]
virtio_scsi: support multi hw queue of blk-mq

Since virtio_scsi has supported multi virtqueue already,
it is natural to map the virtque to hw-queue of blk-mq.

Signed-off-by: Ming Lei <ming.lei@canonical.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agohpsa: remove spin lock around command allocation
Stephen M. Cameron [Fri, 14 Nov 2014 23:27:29 +0000 (17:27 -0600)]
hpsa: remove spin lock around command allocation

It is already using atomic test_and_set_bit to do the
allocation.

There is some microscopic chance of starvation, but it is
so microscopic that it should never happen in reality.

Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Webb Scales <webbnh@hp.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agohpsa: always call pci_set_master after pci_enable_device
Robert Elliott [Fri, 14 Nov 2014 23:27:24 +0000 (17:27 -0600)]
hpsa: always call pci_set_master after pci_enable_device

If the kernel is booted with the reset_device parameter, which
is done for kdump, then the driver needs to call pci_set_master
after pci_enable_device to reenable bus mastering (since
the preceding pci_disable_device call disables bus mastering).

Also, place that after pci_request_regions both in the
kdump code and the normal pci_init code.

Remove the comment summarizing what pci_set_master
does, with the incomplete commentary on the impact of
pci_disable_device.

Signed-off-by: Robert Elliott <elliott@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agohpsa: Convert SCSI LLD ->queuecommand() for host_lock less operation
Nicholas Bellinger [Fri, 14 Nov 2014 23:27:19 +0000 (17:27 -0600)]
hpsa: Convert SCSI LLD ->queuecommand() for host_lock less operation

There isn't anything in hpsa that requires the host lock to be held
during queuecommand.

Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Reviewed-by: Stephen M. Cameron <stephenmcameron@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agohpsa: do not be so noisy about check conditions
Stephen M. Cameron [Fri, 14 Nov 2014 23:27:14 +0000 (17:27 -0600)]
hpsa: do not be so noisy about check conditions

We were printing a lot of useless information before ultimately
just passing things up to the SCSI mid layer.  Just let the
midlayer handle it without LLD chatter.

Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Stephen M. Cameron <stephenmcameron@gmail.com>
Reviewed-by: Joe Handzik <joseph.t.handzik@hp.com>
Reviewed-by: Scott Teel <scott.teel@hp.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agohpsa: use atomics for commands_outstanding
Stephen M. Cameron [Fri, 14 Nov 2014 23:27:09 +0000 (17:27 -0600)]
hpsa: use atomics for commands_outstanding

Use atomics for commands_outstanding instead of protecting with spin locks.

Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Stephen M. Cameron <stephenmcameron@gmail.com>
Reviewed-by: Joe Handzik <joseph.t.handzik@hp.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agohpsa: get rid of type/attribute/direction bit field where possible
Stephen M. Cameron [Fri, 14 Nov 2014 23:27:04 +0000 (17:27 -0600)]
hpsa: get rid of type/attribute/direction bit field where possible

Using bit fields for hardware command fields isn't portable and
relies on assumptions about how the compiler lays out the bits.
We can fix this in the driver's internal command structure, but the
ioctl interface we can't change because it is part of the
userland ABI.

Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Webb Scales <webb.scales@hp.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agohpsa: fix endianness issue with scatter gather elements
Stephen M. Cameron [Fri, 14 Nov 2014 23:26:59 +0000 (17:26 -0600)]
hpsa: fix endianness issue with scatter gather elements

The hardware needs little endian scatter gather addresses and
lengths but we were not bothering to convert from cpu byte
order as we should have been.  On Intel, this is all just
a bunch of no-ops macros, but it makes the code endian-clean(er).

Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Robert Elliott <elliott@hp.com>
Reviewed-by: Webb Scales <webbnh@hp.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agohpsa: fix allocation sizes for CISS_REPORT_LUNs commands
Stephen M. Cameron [Fri, 14 Nov 2014 23:26:54 +0000 (17:26 -0600)]
hpsa: fix allocation sizes for CISS_REPORT_LUNs commands

We were allocating roughly double the amount of memory
we should be due to ReportLUNdata and ExtendedReportLUNdata
containing a non-zero sized array but adding extra memory
to allocate as if the array were zero sized.

Track the logical and physical sizes separately.
Allocate the memory based on the specific data
structure sizes.

Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Webb Scales <webb.scales@hp.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agohpsa: remove 'action required' phrasing
Stephen M. Cameron [Fri, 14 Nov 2014 23:26:48 +0000 (17:26 -0600)]
hpsa: remove 'action required' phrasing

In the case of LUN data changing, the driver will
auto rescan and so it's not even true that "action" is
"required".

Remove "action required" phrases from warning messages and
replace with description phrases.

Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Stephen M. Cameron <stephenmcameron@gmail.com>
Reviewed-by: Joe Handzik <joseph.t.handzik@hp.com>
Reviewed-by: Webb Scales <webb.scales@hp.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agohpsa: correct off-by-one sizing of chained SG block
Webb Scales [Fri, 14 Nov 2014 23:26:43 +0000 (17:26 -0600)]
hpsa: correct off-by-one sizing of chained SG block

Correct the size calculation of the chained SG block

Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Webb Scales <webbnh@hp.com>
Reviewed-by: Stephen M. Cameron <stephenmcameron@gmail.com>
Reviewed-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agohpsa: fix a couple pci id table mistakes
Stephen M. Cameron [Fri, 14 Nov 2014 23:26:38 +0000 (17:26 -0600)]
hpsa: fix a couple pci id table mistakes

Fix a couple of pci id table mistakes:
Subdevice ID 0x3323 missing from product[] table
(another name for HP Smart Storage 1210m)
Bogus 0x1925 subdevice id removed from hpsa_pci_device_id[] (no such thing.)

Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Webb Scales <webbnh@hp.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agohpsa: remove dev_warn prints from RAID-1ADM
Robert Elliott [Fri, 14 Nov 2014 23:26:33 +0000 (17:26 -0600)]
hpsa: remove dev_warn prints from RAID-1ADM

RAID-1ADM is unusable with dev_warn called on every command.

Signed-off-by: Robert Elliott <elliott@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Stephen M. Cameron <stephenmcameron@gmail.com>
Reviewed-by: Webb Scales <webbnh@hp.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agohpsa: Clean up warnings from sparse.
Don Brace [Fri, 14 Nov 2014 23:26:27 +0000 (17:26 -0600)]
hpsa: Clean up warnings from sparse.

Clean up issues reported when running sparse.

Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Webb Scales <webb.scales@hp.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoatari_NCR5380: Fix "transfered" typo
Finn Thain [Wed, 12 Nov 2014 05:12:23 +0000 (16:12 +1100)]
atari_NCR5380: Fix "transfered" typo

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoatari_NCR5380: Remove RESET_RUN_DONE macro
Finn Thain [Wed, 12 Nov 2014 05:12:22 +0000 (16:12 +1100)]
atari_NCR5380: Remove RESET_RUN_DONE macro

There's no need to run the cmd->done callback for aborted commands. Remove
the old EH code and the RESET_RUN_DONE macro.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoatari_NCR5380: Move static co-routine variables to host data
Finn Thain [Wed, 12 Nov 2014 05:12:21 +0000 (16:12 +1100)]
atari_NCR5380: Move static co-routine variables to host data

Unlike NCR5380.c, the atari_NCR5380.c core driver is limited to a single
instance because co-routine state is stored globally.

Fix this by removing the static scsi host pointer. For the co-routine,
obtain this pointer from the work_struct pointer instead. For the interrupt
handler, obtain it from the dev_id argument.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoatari_NCR5380: Move static TagAlloc array to host data
Finn Thain [Wed, 12 Nov 2014 05:12:20 +0000 (16:12 +1100)]
atari_NCR5380: Move static TagAlloc array to host data

The atari_NCR5380.c core driver keeps some per-host data in a static
variable which limits the driver to a single instance. Fix this by moving
TagAlloc to the hostdata struct.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoatari_NCR5380: Introduce FLAG_TAGGED_QUEUING
Finn Thain [Wed, 12 Nov 2014 05:12:19 +0000 (16:12 +1100)]
atari_NCR5380: Introduce FLAG_TAGGED_QUEUING

The static variable setup_use_tagged_queuing is declared in mac_scsi.c,
sun3_scsi.c and atari_scsi.c and doesn't belong in the core driver.
None of the other NCR5380 drivers suffer from this layering issue which
makes merging the core drivers more difficult and will likely hinder plans
for future use of platform data to configure the driver.

Replace the static variable with a host flag. This way it can be reported
along with the other flags.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoatari_NCR5380: Merge from NCR5380.c
Finn Thain [Wed, 12 Nov 2014 05:12:18 +0000 (16:12 +1100)]
atari_NCR5380: Merge from NCR5380.c

The NCR5380.c core driver has moved on since the atari_NCR5380.c fork.
Some of those changes are also relevant to atari_NCR5380.c so apply them
there as well.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agosun3_scsi: Adopt atari_NCR5380 core driver and remove sun3_NCR5380.c
Finn Thain [Wed, 12 Nov 2014 05:12:17 +0000 (16:12 +1100)]
sun3_scsi: Adopt atari_NCR5380 core driver and remove sun3_NCR5380.c

Given the preceding changes to atari_NCR5380.c, this patch should not change
behaviour of the sun3_scsi and sun3_scsi_vme modules.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoatari_NCR5380: Merge from sun3_NCR5380.c
Finn Thain [Wed, 12 Nov 2014 05:12:16 +0000 (16:12 +1100)]
atari_NCR5380: Merge from sun3_NCR5380.c

There is very little difference between the sun3_NCR5380.c core driver
and atari_NCR5380.c. The former is a fork of the latter.

Merge the sun3_NCR5380.c core driver into atari_NCR5380.c so that
sun3_scsi.c can adopt the latter and the former can be deleted.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoatari_NCR5380: Refactor Falcon locking
Finn Thain [Wed, 12 Nov 2014 05:12:15 +0000 (16:12 +1100)]
atari_NCR5380: Refactor Falcon locking

Simplify falcon_release_lock_if_possible() by making callers responsible for
disabling local IRQ's, which they must do anyway to correctly synchronize
the ST DMA "lock" with core driver data structures. Move this
synchronization logic to the core driver with which it is tightly coupled.

Other LLD's like sun3_scsi and mac_scsi that can make use of this core
driver can just stub out the NCR5380_acquire_dma_irq() and
NCR5380_release_dma_irq() calls so the compiler will eliminate the
ST DMA code.

Remove a redundant local_irq_save/restore pair (irq's are disabled for
interrupt handlers these days). Revise the locking for
atari_scsi_bus_reset(): use local_irq_save/restore() instead of
atari_turnoff/turnon_irq(). There is no guarantee that atari_scsi still
holds the ST DMA lock during EH, so atari_turnoff/turnon_irq() could
end up dropping an IDE or floppy interrupt.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoatari_NCR5380: Refactor Falcon special cases
Finn Thain [Wed, 12 Nov 2014 05:12:14 +0000 (16:12 +1100)]
atari_NCR5380: Refactor Falcon special cases

Make the atari_NCR5380.c core driver usable by sun3_scsi, mac_scsi and
others by moving some of the Falcon-specific code out of the core driver:
!IS_A_TT, atari_read_overruns and falcon_dont_release. Replace these with
hostdata variables and flags. FLAG_CHECK_LAST_BYTE_SENT is unused in
atari_NCR5380.c so don't set it.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoncr5380: Remove ENABLE_IRQ/DISABLE_IRQ macros
Finn Thain [Wed, 12 Nov 2014 05:12:13 +0000 (16:12 +1100)]
ncr5380: Remove ENABLE_IRQ/DISABLE_IRQ macros

atari_NCR5380.c enables its IRQ when it is already enabled. Sun3 doesn't
use the ENABLE_IRQ/DISABLE_IRQ cruft. Remove it.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agosun3_scsi: Move macro definitions
Finn Thain [Wed, 12 Nov 2014 05:12:12 +0000 (16:12 +1100)]
sun3_scsi: Move macro definitions

The #defines in sun3_scsi.h are intended to influence subsequent #includes
in sun3_scsi.c. IMHO, that's too convoluted.

Move sun3_scsi.h macro definitions to sun3_scsi.c, consistent with other
NCR5380 drivers.

Omit the unused NCR5380_local_declare() and NCR5380_setup() macros.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agosun3_scsi: Convert to platform device
Finn Thain [Thu, 13 Nov 2014 01:21:28 +0000 (12:21 +1100)]
sun3_scsi: Convert to platform device

Convert sun3_scsi to platform device and eliminate scsi_register().

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoatari_scsi: Remove header
Finn Thain [Wed, 12 Nov 2014 05:12:10 +0000 (16:12 +1100)]
atari_scsi: Remove header

The #defines in atari_scsi.h are intended to influence subsequent #includes
in atari_scsi.c. IMHO, that's too convoluted.

Remove atari_scsi.h by moving those macro definitions to atari_scsi.c,
consistent with other NCR5380 drivers.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoatari_scsi: Convert to platform device
Finn Thain [Wed, 12 Nov 2014 05:12:09 +0000 (16:12 +1100)]
atari_scsi: Convert to platform device

Convert atari_scsi to platform device and eliminate scsi_register().

Validate __setup options later on so that module options are checked as well.

Remove the comment about the scsi mid-layer disabling the host irq as it
is no longer true (AFAICT). Also remove the obsolete slow interrupt stuff
(IRQ_TYPE_SLOW == 0 anyway).

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoatari_scsi: Fix atari_scsi deadlocks on Falcon
Finn Thain [Wed, 12 Nov 2014 05:12:08 +0000 (16:12 +1100)]
atari_scsi: Fix atari_scsi deadlocks on Falcon

Don't disable irqs when waiting for the ST DMA "lock"; its release may
require an interrupt.

Introduce stdma_try_lock() for use in soft irq context. atari_scsi now tells
the SCSI mid-layer to defer queueing a command if the ST DMA lock is not
available, as per Michael's patch:
http://marc.info/?l=linux-m68k&m=139095335824863&w=2

The falcon_got_lock variable is race prone: we can't disable IRQs while
waiting to acquire the lock, so after acquiring it there must be some
interval during which falcon_got_lock remains false. Introduce
stdma_is_locked_by() to replace falcon_got_lock.

The falcon_got_lock tests in the EH handlers are incorrect these days. It
can happen that an EH handler is called after a command completes normally.
Remove these checks along with falcon_got_lock.

Also remove the complicated and racy fairness wait queues. If fairness is an
issue (when SCSI competes with IDE for the ST DMA interrupt), the solution
is likely to be a lower value for host->can_queue.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agomac_scsi: Convert to platform device
Finn Thain [Wed, 12 Nov 2014 05:12:07 +0000 (16:12 +1100)]
mac_scsi: Convert to platform device

Convert mac_scsi to platform device and eliminate scsi_register().

Platform resources for chip registers now follow the documentation. This
should fix issues with the Mac IIci (and possibly other models too).

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agomac_scsi: Cleanup PDMA code
Finn Thain [Wed, 12 Nov 2014 05:12:06 +0000 (16:12 +1100)]
mac_scsi: Cleanup PDMA code

Fix whitespace, remove pointless volatile qualifiers and improve code style
by use of INPUT_DATA_REG and OUTPUT_DATA_REG macros.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agomac_scsi: Add module option to Kconfig
Finn Thain [Wed, 12 Nov 2014 05:12:05 +0000 (16:12 +1100)]
mac_scsi: Add module option to Kconfig

Allow mac_scsi to be built as a module. Replace the old validation of
__setup options with code that validates both module and __setup options.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agomac_scsi: Remove header
Finn Thain [Wed, 12 Nov 2014 05:12:04 +0000 (16:12 +1100)]
mac_scsi: Remove header

The #defines in mac_scsi.h are intended to influence subsequent #includes in
mac_scsi.c. IMHO, that's too convoluted.

Remove mac_scsi.h by moving those macro definitions to mac_scsi.c,
consistent with other NCR5380 drivers.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agodmx3191d: Use NO_IRQ
Finn Thain [Wed, 12 Nov 2014 05:12:03 +0000 (16:12 +1100)]
dmx3191d: Use NO_IRQ

Testing shows that the Domex 3191D card never asserts its IRQ. Hence it is
non-functional with Linux (worse, the EH bugs in the core driver are fatal
but that's a problem for another patch). Perhaps the DT-536 chip needs
special setup? I can't find documentation for it. The NetBSD driver uses
polling apparently because of this issue.

Set host->irq = NO_IRQ so the core driver will prevent targets from
disconnecting. Don't request host->irq.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoncr5380: Drop legacy scsi.h include
Finn Thain [Wed, 12 Nov 2014 05:12:02 +0000 (16:12 +1100)]
ncr5380: Drop legacy scsi.h include

Convert Scsi_Cmnd to struct scsi_cmnd and drop the #include "scsi.h".
The sun3_NCR5380.c core driver already uses struct scsi_cmnd so converting
the other core drivers reduces the diff which makes them easier to unify.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoncr5380: Remove *_RELEASE macros
Finn Thain [Wed, 12 Nov 2014 05:12:01 +0000 (16:12 +1100)]
ncr5380: Remove *_RELEASE macros

The *_RELEASE macros don't tell me anything. In some cases the version in
the macro contradicts the version in the comments. Anyway, the Linux kernel
version is sufficient information. Remove these macros to improve readability.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoncr5380: Remove pointless compiler command line override macros
Finn Thain [Wed, 12 Nov 2014 05:12:00 +0000 (16:12 +1100)]
ncr5380: Remove pointless compiler command line override macros

Compile-time override of scsi host defaults is pointless for drivers that
provide module parameters and __setup options for that. Too many macros make
the code hard to read so remove them.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoncr5380: Move static PDMA spin counters to host data
Finn Thain [Wed, 12 Nov 2014 05:11:59 +0000 (16:11 +1100)]
ncr5380: Move static PDMA spin counters to host data

Static variables from dtc.c and pas16.c should not appear in the core
NCR5380.c driver. Aside from being a layering issue this worsens the
divergence between the three core driver variants (atari_NCR5380.c and
sun3_NCR5380.c don't support PSEUDO_DMA) and it can mean multiple hosts
share the same counters.

Fix this by making the pseudo DMA spin counters in the core more generic.
This also avoids the abuse of the {DTC,PAS16}_PUBLIC_RELEASE macros, so
they can be removed.

oak.c doesn't use PDMA and hence it doesn't use the counters and hence it
needs no write_info() method. Remove it.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoncr5380: Cleanup host info() methods
Finn Thain [Wed, 12 Nov 2014 05:11:58 +0000 (16:11 +1100)]
ncr5380: Cleanup host info() methods

If the host->info() method is not set, then host->name is used by default.
For atari_scsi, that is exactly the same text. So remove the redundant
info() method. Keep sun3_scsi.c in line with atari_scsi.

Some NCR5380 drivers return an empty string from the info() method
(arm/cumana_1.c arm/oak.c mac_scsi.c) while other drivers use the default
(dmx3191d dtc.c g_NCR5380.c pas16.c t128.c).

Implement a common info() method to replace a lot of duplicated code which
the various drivers use to announce the same information.

This replaces most of the (deprecated) show_info() output and all of the
NCR5380_print_info() output. This also eliminates a bunch of code in
g_NCR5380 which just duplicates functionality in the core driver.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoncr5380: Remove NCR5380_STATS
Finn Thain [Wed, 12 Nov 2014 05:11:57 +0000 (16:11 +1100)]
ncr5380: Remove NCR5380_STATS

The NCR5380_STATS option is only enabled by g_NCR5380 yet it adds
clutter to all three core drivers. The atari_NCR5380.c and sun3_NCR5380.c
core drivers have a slightly different implementation of the
NCR5380_STATS option.

Out of all ten NCR5380 drivers, only one of them (g_NCR5380) actually
has the code to report on the collected stats. Aside from being unreadable,
that code seems to be broken because there's no initialization of timebase.
sun3_NCR5380.c and atari_NCR5380.c have the timebase initialization but
lack the code to report the stats.

Remove all of this code to improve readability and reduce divergence
between the three core drivers.

This patch and the next one completely eliminate the PRINTP and ANDP
pre-processor abuse.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoncr5380: Fix SCSI_IRQ_NONE bugs
Finn Thain [Wed, 12 Nov 2014 05:11:56 +0000 (16:11 +1100)]
ncr5380: Fix SCSI_IRQ_NONE bugs

Oak scsi doesn't use any IRQ, but it sets irq = IRQ_NONE rather than
SCSI_IRQ_NONE. Problem is, the core NCR5380 driver expects SCSI_IRQ_NONE
if it is to issue IDENTIFY commands that prevent target disconnection.
And, as Geert points out, IRQ_NONE is part of enum irqreturn.

Other drivers, when they can't get an IRQ or can't use one, will set
host->irq = SCSI_IRQ_NONE (that is, 255). But when they exit they will
attempt to free IRQ 255 which was never requested.

Fix these bugs by using NO_IRQ in place of SCSI_IRQ_NONE and IRQ_NONE.
That means IRQ 0 is no longer probed by ISA drivers but I don't think
this matters.

Setting IRQ = 255 for these ISA drivers is understood to mean no IRQ.
This remains supported so as to avoid breaking existing ISA setups (which
can be difficult to get working) and because existing documentation
(SANE, TLDP etc) describes this usage for the ISA NCR5380 driver options.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoncr5380: Remove duplicate comments
Finn Thain [Wed, 12 Nov 2014 05:11:55 +0000 (16:11 +1100)]
ncr5380: Remove duplicate comments

The LIMIT_TRANSFERSIZE, PSEUDO_DMA, PARITY and UNSAFE options are all
documented in the core drivers where they are used. The same goes for the
chip databook reference. Remove the duplicate comments.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoncr5380: Remove redundant AUTOSENSE macro
Finn Thain [Wed, 12 Nov 2014 05:11:54 +0000 (16:11 +1100)]
ncr5380: Remove redundant AUTOSENSE macro

Every NCR5380 driver sets AUTOSENSE so it need not be optional (and the
mid-layer expects it). Remove this redundant macro to improve readability.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoncr5380: Cleanup TAG_NEXT and TAG_NONE macros
Finn Thain [Wed, 12 Nov 2014 05:11:53 +0000 (16:11 +1100)]
ncr5380: Cleanup TAG_NEXT and TAG_NONE macros

Both atari_NCR5380.c and sun3_NCR5380.c core drivers #undef TAG_NONE and
then redefine it. But the original definition is unused because NCR5380.c
lacks support for tagged queueing. So just define it once.

The TAG_NEXT macro only appears in the arguments to NCR5380_select() calls.
But that routine doesn't use its tag argument as the tag was already
assigned in NCR5380_main(). So remove the unused argument and the macro.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoncr5380: Remove more useless prototypes
Finn Thain [Wed, 12 Nov 2014 05:11:52 +0000 (16:11 +1100)]
ncr5380: Remove more useless prototypes

Make use of the host template static initializer instead of assigning
handlers at run-time. Move __maybe_unused qualifiers from declarations
to definitions. Move the atari_scsi_bus_reset() wrapper after the
definition of NCR5380_bus_reset(). All of the host template handler
prototypes are now redundant so remove them.

The write_info() handler is only relevant to drivers using PSEUDO_DMA so
this patch fixes the compiler warning in atari_NCR5380.c and sun3_NCR5380.c:

  CC      drivers/scsi/atari_scsi.o
  drivers/scsi/NCR5380.h:329: warning: 'NCR5380_write_info' declared 'static' but never defined

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoncr5380: Remove useless prototypes
Finn Thain [Wed, 12 Nov 2014 05:11:51 +0000 (16:11 +1100)]
ncr5380: Remove useless prototypes

Add missing static qualifiers and remove the now pointless prototypes. The
NCR5380_* prototypes are all declared in NCR5380.h and renamed using macros.
Further declarations are redundant (some are completely unused). Remove
them.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoncr5380: Remove unused macros
Finn Thain [Wed, 12 Nov 2014 05:11:50 +0000 (16:11 +1100)]
ncr5380: Remove unused macros

Some macros are never evaluated (i.e. FOO, USLEEP, SCSI2 and USE_WRAPPER;
and in some drivers, NCR5380_intr and NCR5380_proc_info). DRIVER_SETUP
serves no purpose anymore. Remove these macro definitions.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoncr5380: Fix compiler warnings and __setup options
Finn Thain [Wed, 12 Nov 2014 05:11:49 +0000 (16:11 +1100)]
ncr5380: Fix compiler warnings and __setup options

Some __setup() options mentioned in Documentation/scsi don't work because
a few lines of code went missing sometime since Linux 2.4. Fix the options
and thus fix some compiler warnings for both the non-modular case,

    CC      drivers/scsi/dtc.o
drivers/scsi/dtc.c:176:20: warning: 'dtc_setup' defined but not used [-Wunused-function]

and the modular case,

    CC [M]  drivers/scsi/pas16.o
drivers/scsi/pas16.c:335:20: warning: 'pas16_setup' defined but not used [-Wunused-function]
    CC [M]  drivers/scsi/t128.o
drivers/scsi/t128.c:147:20: warning: 't128_setup' defined but not used [-Wunused-function]

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoncr5380: Remove unused hostdata fields
Finn Thain [Wed, 12 Nov 2014 05:11:48 +0000 (16:11 +1100)]
ncr5380: Remove unused hostdata fields

Remove unused fields from hostdata structs declared with the
NCR5380_implementation_fields macro.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoncr5380: Use printk() not pr_debug()
Finn Thain [Wed, 12 Nov 2014 05:11:47 +0000 (16:11 +1100)]
ncr5380: Use printk() not pr_debug()

Having defined NDEBUG, and having set the console log level, I'd like to see
some output. Don't use pr_debug(), it's annoying to have to define DEBUG as
well.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoFnic: Fnic Driver crashed with NULL pointer reference
Hiral Shah [Mon, 10 Nov 2014 20:54:36 +0000 (12:54 -0800)]
Fnic: Fnic Driver crashed with NULL pointer reference

When issuing I/O request, if the I/O completes before returning from
fnic_queuecommand(), we may be referencing scsi_cmnd structure that may
be freed by interrupt handler. Acquring IO lock would synchronize
fnic_queuecommand and interrupt handler.

- Increment fnic version from 1.6.0.15 to 1.6.0.16

Signed-off-by: Hiral Shah <hishah@cisco.com>
Signed-off-by: Sesidhar Baddela <sebaddel@cisco.com>
Signed-off-by: Anil Chintalapati <achintal@cisco.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoFnic: For Standalone C series, "sending VLAN request" message seen even if the link...
Hiral Shah [Mon, 10 Nov 2014 20:54:35 +0000 (12:54 -0800)]
Fnic: For Standalone C series, "sending VLAN request" message seen even if the link is down

When physical link between standalone C series and switch is down,
the fip timer is not turned off and timer expiration will keep sending
vlan request.

It can be fixed by stopping the fip_timer and
it will be restarted automatically when Link is up.

- Increment fnic version from 1.6.0.14 to 1.6.0.15

Signed-off-by: Hiral Shah <hishah@cisco.com>
Signed-off-by: Sesidhar Baddela <sebaddel@cisco.com>
Signed-off-by: Anil Chintalapati <achintal@cisco.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoFnic: Improper resue of exchange Ids
Hiral Shah [Mon, 10 Nov 2014 20:54:34 +0000 (12:54 -0800)]
Fnic: Improper resue of exchange Ids

IOs belonging to an rport are aborted with Internal terminate option
when rport goes offline. Any new IO issued to the rport during this
time can reuse the terminated exchange which will cause inconsistent
state of the exchange between local port and remote port.

fc_rport_priv is set to RPORT_ST_DELETE before exchanges are aborted by
libfc. Not issuing amy more I/O requests when RPORT_ST_DELETE is set,
will avoid inconsistent state of the exchange between local port and
remote port.

- Increment fnic version from 1.6.0.13 to 1.6.0.14

Signed-off-by: Hiral Shah <hishah@cisco.com>
Signed-off-by: Sesidhar Baddela <sebaddel@cisco.com>
Signed-off-by: Anil Chintalapati <achintal@cisco.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoFnic: Memcopy only mimumum of data or trace buffer
Hiral Shah [Mon, 10 Nov 2014 20:54:33 +0000 (12:54 -0800)]
Fnic: Memcopy only mimumum of data or trace buffer

In case of receive path, we do not have eth header or fcoe header available
when we take a trace so we fill the fc trace buffer with 0xff for both
values. We copy only mimimum of received data or trace buffer size -
fc header - eth and fcoe header

- Increment fnic version from 1.6.0.12 to 1.6.0.13

Signed-off-by: Hiral Shah <hishah@cisco.com>
Signed-off-by: Sesidhar Baddela <sebaddel@cisco.com>
Signed-off-by: Anil Chintalapati <achintal@cisco.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoFnic: Not probing all the vNICS via fnic_probe on boot
Hiral Shah [Mon, 10 Nov 2014 20:54:32 +0000 (12:54 -0800)]
Fnic: Not probing all the vNICS via fnic_probe on boot

In fnic_dev_wait, Wait for finish to complete at least three times in two
seconds while loop before returning -ETIMEDOUT as sometime
schedule_timeout_uninterruptible takes more than two seconds to wake up.

- Increment fnic version from 1.6.0.11 to 1.6.0.12

Signed-off-by: Hiral Shah <hishah@cisco.com>
Signed-off-by: Sesidhar Baddela <sebaddel@cisco.com>
Signed-off-by: Anil Chintalapati <achintal@cisco.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agobnx2fc: fix an error code in _bnx2fc_create()
Dan Carpenter [Tue, 4 Nov 2014 10:37:59 +0000 (13:37 +0300)]
bnx2fc: fix an error code in _bnx2fc_create()

We should be returning an error code here instead of success.  Either
-ENODEV or -ENOMEM would work.  There is also a failure message in
printk().

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Chad Dupuis <chad.dupuis@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agobnx2fc: check IS_ERR() instead of NULL
Dan Carpenter [Tue, 4 Nov 2014 10:37:17 +0000 (13:37 +0300)]
bnx2fc: check IS_ERR() instead of NULL

The bnx2fc_if_create() function returns NULL on failure, it never
returns an error pointer.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Chad Dupuis <chad.dupuis@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoIB/srp: Fix a race condition triggered by destroying a queue pair
Bart Van Assche [Tue, 21 Oct 2014 16:00:35 +0000 (18:00 +0200)]
IB/srp: Fix a race condition triggered by destroying a queue pair

At least LID reassignment can trigger a race condition in the SRP
initiator driver, namely the receive completion handler trying to
post a request on a QP during or after QP destruction and before
the CQ's have been destroyed. Avoid this race by modifying a QP
into the error state and by waiting until all receive completions
have been processed before destroying a QP.

Reported-by: Max Gurtuvoy <maxg@mellanox.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>