History log of /drivers/scsi/scsi_transport_sas.c
Revision Date Author Comments
16d3db1b298529e6aec4a4cf0f56225d9e0bc641 31-Jan-2012 Dan Williams <dan.j.williams@intel.com> [SCSI] scsi_transport_sas: 'enable' phys on reset

If userspace requests a phy reset, treat that as a request for the phy
to be enabled since that is the effect on hardware.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
f41a0c441c3fe43e79ebeb75584dbb5bfa83e5cd 22-Dec-2011 Dan Williams <dan.j.williams@intel.com> [SCSI] libsas: fix sas_find_local_phy(), take phy references

In the direct-attached case this routine returns the phy on which this
device was first discovered. Which is broken if we want to support
wide-targets, as this phy reference can become stale even though the
port is still active.

In the expander-attached case this routine tries to lookup the phy by
scanning the attached sas addresses of the parent expander, and BUG_ONs
if it can't find it. However since eh and the libsas workqueue run
independently we can still be attempting device recovery via eh after
libsas has recorded the device as detached. This is even easier to hit
now that eh is blocked while device domain rediscovery takes place, and
that libata is fed more timed out commands increasing the chances that
it will try to recover the ata device.

Arrange for dev->phy to always point to a last known good phy, it may be
stale after the port is torn down, but it will catch up for wide port
reconfigurations, and never be NULL.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
0b3e09da1350397f3f8b6fd839ab455b0b587451 20-Dec-2011 Dan Williams <dan.j.williams@intel.com> [SCSI] libsas: perform sas-transport resets in shost->workq context

Extend the sas transport class to allow transport users to attach extra
data to a sas_phy (->hostdata). Use this area in libsas to move resets
to workq context in preparation for scheduling ata device resets through
libata-eh.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
87c8331fcf72e501c3a3c0cdc5c9391ec72f7cf2 18-Nov-2011 Dan Williams <dan.j.williams@intel.com> [SCSI] libsas: prevent domain rediscovery competing with ata error handling

libata error handling provides for a timeout for link recovery. libsas
must not rescan for previously known devices in this interval otherwise
it may remove a device that is simply waiting for its link to recover.
Let libata-eh make the determination of when the link is stable and
prevent libsas (host workqueue) from taking action while this
determination is pending.

Using a mutex (ha->disco_mutex) to flush and disable revalidation while
eh is running requires any discovery action that may block on eh be
moved to its own context outside the lock. Probing ATA devices
explicitly waits on ata-eh and the cache-flush-io issued during device
removal may also pend awaiting eh completion. Essentially any rphy
add/remove activity needs to run outside the lock.

This adds two new cleanup states for sas_unregister_domain_devices()
'allocated-but-not-probed', and 'flagged-for-destruction'. In the
'allocated-but-not-probed' state dev->rphy points to a rphy that is
known to have not been through a sas_rphy_add() event. At domain
teardown check if this device is still pending probe and cleanup
accordingly. Similarly if a device has already been queued for removal
then sas_unregister_domain_devices has nothing to do.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2fc62e2ac350b8f574e0a09170b350a8f2fa4a02 21-Sep-2011 Dan Williams <dan.j.williams@intel.com> [SCSI] libsas: disable scanning lun > 0 on ata devices

Currently mvsas and pm8001 have custom ->slave_alloc implementations to
achieve this. Uplevel it for all libsas drivers as isci encounters problems
with atapi devices when scanning past lun0.

Just do what Darrick suggested [1], and limit the scan for ata devices.

[1] http://marc.info/?l=linux-scsi&m=116604101119861&w=2

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
7eaceaccab5f40bbfda044629a6298616aeaed50 10-Mar-2011 Jens Axboe <jaxboe@fusionio.com> block: remove per-queue plugging

Code has been converted over to the new explicit on-stack plugging,
and delay users have been converted to use the new API for that.
So lets kill off the old plugging along with aops->sync_page().

Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
0f88009d5cfae890bd3466126d1622ad4f16b798 18-Jan-2010 James Bottomley <James.Bottomley@suse.de> [SCSI] scsi_transport_sas: add support for transport layer retries (TLR)

The mpt2sas driver wants to use transport layer retries (TLR) so the
simplest thing to do seems to be to add the enabling flags and checks
to the SAS transport class, since they're a SAS specific protocol
feature.

Signed-off-by: James Bottomley <James.Bottomley@suse.de>
af901ca181d92aac3a7dc265144a9081a86d8f39 14-Nov-2009 André Goddard Rosa <andre.goddard@gmail.com> tree-wide: fix assorted typos all over the place

That is "success", "unknown", "through", "performance", "[re|un]mapping"
, "access", "default", "reasonable", "[con]currently", "temperature"
, "channel", "[un]used", "application", "example","hierarchy", "therefore"
, "[over|under]flow", "contiguous", "threshold", "enough" and others.

Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
a4a8b064dd06d30d007e46445d17575e2875c340 28-Jul-2009 James Bottomley <James.Bottomley@HansenPartnership.com> [SCSI] scsi_transport_sas: fix incorrect duplicate setup of max_phys

There are two setup places for max_phys in scsi_transport_sas.c; one
incorrectly places a NULL into host_attrs instead of port_attrs. Remove it.

Reported-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
93bdcba5a7e55307e27671594c3cd8b4669b9e7a 17-Jun-2009 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> scsi_transport_sas: needs to call blk_end_request_all for SMP requests

We need to call blk_end_request_all to complete SMP requests properly.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
9934c8c04561413609d2bc38c6b9f268cba774a4 08-May-2009 Tejun Heo <tj@kernel.org> block: implement and enforce request peek/start/fetch

Till now block layer allowed two separate modes of request execution.
A request is always acquired from the request queue via
elv_next_request(). After that, drivers are free to either dequeue it
or process it without dequeueing. Dequeue allows elv_next_request()
to return the next request so that multiple requests can be in flight.

Executing requests without dequeueing has its merits mostly in
allowing drivers for simpler devices which can't do sg to deal with
segments only without considering request boundary. However, the
benefit this brings is dubious and declining while the cost of the API
ambiguity is increasing. Segment based drivers are usually for very
old or limited devices and as converting to dequeueing model isn't
difficult, it doesn't justify the API overhead it puts on block layer
and its more modern users.

Previous patches converted all block low level drivers to dequeueing
model. This patch completes the API transition by...

* renaming elv_next_request() to blk_peek_request()

* renaming blkdev_dequeue_request() to blk_start_request()

* adding blk_fetch_request() which is combination of peek and start

* disallowing completion of queued (not started) requests

* applying new API to all LLDs

Renamings are for consistency and to break out of tree code so that
it's apparent that out of tree drivers need updating.

[ Impact: block request issue API cleanup, no functional change ]

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Mike Miller <mike.miller@hp.com>
Cc: unsik Kim <donari75@gmail.com>
Cc: Paul Clements <paul.clements@steeleye.com>
Cc: Tim Waugh <tim@cyberelk.net>
Cc: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Laurent Vivier <Laurent@lvivier.info>
Cc: Jeff Garzik <jgarzik@pobox.com>
Cc: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Adrian McMenamin <adrian@mcmen.demon.co.uk>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: Borislav Petkov <petkovbb@googlemail.com>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Alex Dubov <oakad@yahoo.com>
Cc: Pierre Ossman <drzeus@drzeus.cx>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Markus Lidel <Markus.Lidel@shadowconnect.com>
Cc: Stefan Weinhuber <wein@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Pete Zaitcev <zaitcev@redhat.com>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
71610f55fa4db63dbf5385929a47c9fb2451f332 03-Dec-2008 Kay Sievers <kay.sievers@vrfy.org> [SCSI] struct device - replace bus_id with dev_name(), dev_set_name()

[jejb: limit ioctl to returning 20 characters to avoid overrun
on long device names and add a few more conversions]
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
cadbd4a5e36dde7e6c49b587b2c419103c0b7218 04-Jul-2008 Harvey Harrison <harvey.harrison@gmail.com> [SCSI] replace __FUNCTION__ with __func__

[jejb: fixed up a ton of missed conversions.

All of you are on notice this has happened, driver trees will now
need to be rebased]

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Cc: SCSI List <linux-scsi@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
75ad23bc0fcb4f992a5d06982bf0857ab1738e9e 29-Apr-2008 Nick Piggin <npiggin@suse.de> block: make queue flags non-atomic

We can save some atomic ops in the IO path, if we clearly define
the rules of how to modify the queue flags.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
93c20a59af4624aedf53f8320606b355aa951bc1 18-Apr-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] scsi_transport_sas: fix the lifetime of sas bsg objects

scsi_transport_sas calls blk_cleanup_queue too early for bsg
queues. If a user holds a sas_host, end_device, or expander device
open, remove the device, then send a request to it, we get a kernel
crash. We need to call blk_cleanup_queue in the release callback as we
do with scsi devices.

This patch moves blk_cleanup_queue to sas_expander_release and
sas_end_device_release from sas_bsg_remove. sas_host can't use the
release callback in struct device so use bsg's release callback.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
97f46ae45c70857e459b7f8df1fc2807e7bd90a9 18-Apr-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] bsg: add release callback support

This patch adds release callback support, which is called when a bsg
device goes away. bsg_register_queue() takes a pointer to a callback
function. This feature is useful for stuff like sas_host that can't
use the release callback in struct device.

If a caller doesn't need bsg's release callback, it can call
bsg_register_queue() with NULL pointer (e.g. scsi devices can use
release callback in struct device so they don't need bsg's callback).

With this patch, bsg uses kref for refcounts on bsg devices instead of
get/put_device in fops->open/release. bsg calls put_device and the
caller's release callback (if it was registered) in kref_put's
release.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
ee959b00c335d7780136c5abda37809191fe52c3 22-Feb-2008 Tony Jones <tonyj@suse.de> SCSI: convert struct class_device to struct device

It's big, but there doesn't seem to be a way to split it up smaller...

Signed-off-by: Tony Jones <tonyj@suse.de>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Cc: Roland Dreier <rolandd@cisco.com>
Cc: Sean Hefty <sean.hefty@intel.com>
Cc: Hal Rosenstock <hal.rosenstock@gmail.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
b1c118121ae37285ddc0a7a908999196bb35fb0b 03-Feb-2008 Joe Perches <joe@perches.com> drivers/scsi/: Spelling fixes

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Acked-by: James Smart <james.smart@emulex.com>
Acked-by: Darrick J. Wong <djwong@us.ibm.com>
Acked-by: David Somayajulu <david.somayajulu@qlogic.com>
Acked-by: Mark Salyzyn <mark_salyzyn@adaptec.com>
Signed-off-by: Adrian Bunk <bunk@kernel.org>
2d507a01dac338831266b44ccbb01c69e84606ed 29-Dec-2007 James Bottomley <James.Bottomley@HansenPartnership.com> [SCSI] libsas, bsg: pass errors through correctly

Currently in BSG, errors returned in req->errors aren't passed back to
the calling programme (either via SG_IO or via read/write). Fix this,
while preserving the SCSI convention of returning status in
req->errors.

Now update libsas to return errors correctly instead of to ignore
them.

Acked-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
eb44820c28bc9a042e1157b41c677018a8fdfc74 03-Nov-2007 Rob Landley <rob@landley.net> [SCSI] Add Documentation and integrate into docbook build

Add Documentation/DocBook/scsi_midlayer.tmpl, add to Makefile, and update
lots of kerneldoc comments in drivers/scsi/*.

Updated with comments from Stefan Richter, Stephen M. Cameron,
James Bottomley and Randy Dunlap.

Signed-off-by: Rob Landley <rob@landley.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
39dca558a5b52b63e49bc234a7e887be092aa690 21-Jul-2007 James Bottomley <James.Bottomley@steeleye.com> [SCSI] bsg: make class backlinks

Currently, bsg doesn't make class backlinks (a process whereby you'd get
a link to bsg in the device directory in the same way you get one for
sg). This is because the bsg device is uninitialised, so the class
device has nothing it can attach to. The fix is to make the bsg device
point to the cdevice of the entity creating the bsg, necessitating
changing the bsg_register_queue() prototype into a form that takes the
generic device.

Acked-by: FUJITA Tomonori <tomof@acm.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
b6aff66953a29e40e0683be9b39c369ade143a5b 20-Jul-2007 James Bottomley <James.Bottomley@steeleye.com> [SCSI] scsi_transport_sas: add destructor for bsg

There's currently no destructor for the bsg components. If you insert
and remove the module, you see the bsg devices building up and up. This
patch adds the destructor in the correct place in the transport class so
that the bsg and request queue are removed just before the device
destruction.

Acked-by: FUJITA Tomonori <tomof@acm.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
7aa68e80bd481faae1234bc2a7e4bcc9348f98b4 08-Jul-2007 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] transport_sas: add SAS management protocol support

The sas transport class attaches one bsg device to every SAS object
(host, device, expander, etc). LLDs can define a function to handle
SMP requests via sas_function_template::smp_handler.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
1b3c3714cb4767d00f507cc6854d3339d82c5b9d 17-Feb-2007 Uwe Kleine-König <zeisberg@informatik.uni-freiburg.de> Fix typos concerning hierarchy

heirarchical, hierachical -> hierarchical
heirarchy, hierachy -> hierarchy

Signed-off-by: Uwe Kleine-König <zeisberg@informatik.uni-freiburg.de>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
21434966462d57145c861b43f6206d945ac57630 26-Jan-2007 Darrick J. Wong <djwong@us.ibm.com> [SCSI] libsas: Check return values of sysfs_create_link

Get rid of: "warning: ignoring return value of sysfs_create_link..."

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
6f63caae2172e97e528b58319480217b0b36542e 26-Jan-2007 Darrick J. Wong <djwong@us.ibm.com> [SCSI] libsas: Clean up discovery failure handler code

sas_rphy_delete does two things: it removes the sas_rphy from the transport
layer and frees the sas_rphy. This can be broken down into two functions,
sas_rphy_remove and sas_rphy_free; sas_rphy_remove is of interest to
sas_discover_root_expander because it calls functions that require
sas_rphy_add as a prerequisite and can fail (namely sas_discover_expander).
In that case, sas_discover_root_expander needs to be able to undo the effects
of sas_rphy_add yet leave the job of freeing the sas_rphy to the caller of
sas_discover_root_expander.

This patch also removes some unnecessary code from sas_discover_end_dev
to eliminate an unnecessary cycle of sas_notify_lldd_gone/found for SAS
devices, thus eliminating a sas_rphy_remove call (and fixing a race condition
where a SCSI target scan can come in between the gone and found call).
It also moves the sas_rphy_free calls into sas_discover_domain and
sas_ex_discover_end_dev to complement the sas_rphy_allocation via
sas_get_port_device.

This patch does not change the semantics of sas_rphy_delete.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
86b9c4c16a1589d05959af2d96d52a4352c6306e 17-Jan-2007 Alexis Bruemmer <alexisb@us.ibm.com> [SCSI] aic94xx: fix typos and update verison number

fix typos and bump version number

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Acked-by: Alexis Bruemmer <alexisb@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
fe3b5bfe73ace420709f0cfb198b0ffc704bd38b 11-Jan-2007 Darrick J. Wong <djwong@us.ibm.com> [SCSI] libsas: sysfs phy control attributes should not be S_IWUGO

Allowing the phy reset controls to be world-triggerable does not seem like
a terribly good idea because SAS devices can be disrupted (and ATA devices
are really disrupted) by a phy reset. By default only root should be able
to do things like that.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
c8490f3a77805d04321d9e44486a679801a035b8 11-Jan-2007 Darrick J. Wong <djwong@us.ibm.com> [SCSI] libsas: Use SCAN_WILD_CARD instead of ~0

Magic number cleanup.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
acbf167d4ad8c27f9743a4b539d51ae9535bf21c 11-Jan-2007 Darrick J. Wong <djwong@us.ibm.com> [SCSI] libsas: Add a sysfs knob to enable/disable a phy

This patch lets a user arbitrarily enable or disable a phy via sysfs.
Potential applications include shutting down a phy to replace one
lane of wide port, and (more importantly) providing a method for the
libata SATL to control the phy.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
f6a570333e554b48ad589e7137c77c57809eee81 18-Oct-2006 Al Viro <viro@zeniv.linux.org.uk> [PATCH] severing module.h->sched.h

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
d24e1eeb3a16e4944288c2f3bf082e1513f4b425 07-Sep-2006 James Bottomley <James.Bottomley@steeleye.com> [SCSI] scsi_transport_sas: make minimum and maximum linkrate settable quantities

According to SPEC, the minimum_linkrate and maximum_linkrate should be
settable by the user. This patch introduces a callback that allows the
sas class to pass these settings on to the driver.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
f4ad7b5807385ad1fed0347d966e51a797cd1013 25-Aug-2006 James Bottomley <James.Bottomley@steeleye.com> [SCSI] scsi_transport_sas: remove local_attached flag

This flag denotes local attachment of the phy. There are two problems
with it:

1) It's actually redundant ... you can get the same information simply
by seeing whether a host is the phys parent
2) we condition a lot of phy parameters on it on the false assumption
that we can only control local phys. I'm wiring up phy resets in the
aic94xx now, and it will be able to reset non-local phys as well.

I fixed 2) by moving the local check into the reset and stats function
of the mptsas, since that seems to be the only HBA that can't
(currently) control non-local phys.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
e8bf39417b578a11e2ee2cd16e794a5b2d40757b 11-Jul-2006 James Bottomley <James.Bottomley@steeleye.com> [SCSI] scsi_transport_sas: kill the use of channel

Using the port_id for the channel is completely unnecessary since the
host_id/target_id are constructed to be globally unique. Also move
the mptsas driver on to virtual channel 1 for its raid devices.

Acked-by: "Moore, Eric" <Eric.Moore@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
a0e1b6ef3b851fe6f1dcc259432e83de79ce5e7f 09-Jul-2006 James Bottomley <James.Bottomley@steeleye.com> [SCSI] scsi_transport_sas: add expander backlink

This patch adds the ability to add a backlink to a particular port. The
idea is to represent properly ports on expanders that are used
specifically for linking to the parent device in the topology.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
c9fefeb26457b87f4a767faefcf77321bb90db52 02-Jul-2006 James Bottomley <James.Bottomley@steeleye.com> [SCSI] scsi_transport_sas: add unindexed ports

Some SAS HBAs don't want to go to the trouble of tracking port numbers,
so they'd simply like to say "add this port and give it a number".
This is especially beneficial from the hotplug point of view, since
tracking ports and the available number space can be a real pain.

The current implementation uses an incrementing number per expander to
add the port on. However, since there can never be more ports than
there are phys, a later implementation will try to be more intelligent
about this.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
65c92b09acf0218b64f1c7ba4fdabeb8b732c876 28-Jun-2006 James Bottomley <James.Bottomley@steeleye.com> [SCSI] scsi_transport_sas: introduce a sas_port entity

this patch introduces a port object, separates out ports and phys,
with ports becoming the primary objects of the tree.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
c5943d36aebb79589ac3983eec418bbeca897573 12-Jun-2006 James Bottomley <James.Bottomley@steeleye.com> [SCSI] scsi_transport_sas: fix panic in sas_free_rphy

This is a hold over from the end device/expander conversion. Apparently
the rphy list pointer is never initialised, so list_del() on the
uninitialised pointer can panic the system

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
6391a11375de5e2bb1eb8481e54619761dc65d9f 09-Jun-2006 Tobias Klauser <tklauser@nuerscht.ch> [SCSI] drivers/scsi: Use ARRAY_SIZE macro

Use ARRAY_SIZE macro instead of sizeof(x)/sizeof(x[0]) and remove
duplicates of the macro.

Signed-off-by: Tobias Klauser <tklauser@nuerscht.ch>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
9f434d4f84a235f6b61aec6e691d6b07bc46fc24 18-May-2006 Eric Moore <eric.moore@lsil.com> [SCSI] scsi_transport_sas: make write attrs writeable

A couple write attributes in sas transport layer have a small
bug that prevents them from being written to. Those
attributes are the link_reset and write_reset. This is due
the store field being set to NULL.

Signed-off-by: Eric Moore <Eric.Moore@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
6d99a3f372181160a56d7b1ee3259dbe03663f0d 19-May-2006 James Bottomley <James.Bottomley@steeleye.com> [SCSI] scsi_transport_sas; fix user_scan

the user_scan() callback currently has the potential to identify the
wrong device in the presence of expanders. This is because it finds
the first device with a matching target_id, which might be an
expander. Fix this by making it look specifically for end devices.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
7676f83aeb774e7a3abe6af06ec92b29488b5b79 14-Apr-2006 James Bottomley <James.Bottomley@steeleye.com> [SCSI] scsi_transport_sas: don't scan a non-existent end device

Any end device that can't support any of the scanning protocols
shouldn't be scanned, so set its id to -1 to prevent
scsi_scan_target() being called for it.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
d6159c17c2c76963a8067d1e1ac3c4c36c05e674 28-Mar-2006 James Bottomley <James.Bottomley@steeleye.com> [SCSI] expose sas internal class for the domain transport

necessary to make the domain class use the internal structures

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
92aab6464be735139f9ea38fd039c3b84c722630 27-Mar-2006 Mike Anderson <andmike@us.ibm.com> [SCSI] sas transport: ref count update

Fix puts so that release functions will be called.

Signed-off-by: Mike Anderson <andmike@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2f8600dff2b140096a7df781884e918a16aa90e0 18-Mar-2006 James Bottomley <James.Bottomley@steeleye.com> [SCSI] eliminate rphy allocation in favour of expander/end device allocation

This allows the removal of the contained flag and also does a bit of
class renaming (sas_rphy->sas_device).

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
79cb1819e231f811211133a09a5382cb89d7ec67 13-Mar-2006 James Bottomley <James.Bottomley@steeleye.com> [SCSI] add preliminary expander support to the sas transport class

This patch makes expanders appear as labelled objects with properties in
the SAS tree.

I've also modified the phy code to make expander phys appear labelled by
host number, expander number and phy index.

So, for my current config, you see something like this in sysfs:

/sys/class/scsi_host/host1/device/phy-1:4/expander-1:0/phy-1-0:12/rphy-1:0-12/target1:0:1

And the expander properties are:

jejb@sparkweed> cd /sys/class/sas_expander/expander-1\:0/
jejb@sparkweed> for f in *; do echo -n $f ": "; cat $f; done
component_id : 29024
component_revision_id : 4
component_vendor_id : VITESSE
device : cat: device: Is a directory
level : 0
product_id : VSC7160 Eval Brd
product_rev : 4
uevent : cat: uevent: Permission denied
vendor_id : VITESSE

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
db82f8410ed7546792358964aa5f8dafff1c70a2 10-Mar-2006 James Bottomley <jejb@mulgrave.il.steeleye.com> [SCSI] add missing transport_container_unregister in sas class

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
42ab03609cca4ef5079e248296f015650c626899 04-Mar-2006 James Bottomley <James.Bottomley@steeleye.com> [PATCH] convert aic94xx over to using the sas transport end device

Begin introducing the concept of sas remote devices that have an rphy
embedded. The first one (this) is a simple end device. All that an
end device really does is have port mode page parameters contained.
The next and more complex piece will be expander remote devices.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
dd9fbb52134693f1394a928c05d5f3cd3fdaf6e0 02-Mar-2006 James Bottomley <James.Bottomley@steeleye.com> [SCSI] make some sas class properties optional

aic94xx doesn't have a use for the bay or enclosure identifiers.
Also, I think it's not going to need a get_linkerrors(), so wire up
all of these exported properties as conditional on the underlying
function support.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
7e6dff62dad539cbd608bb3b8b833193d13f00ac 02-Mar-2006 James Bottomley <James.Bottomley@steeleye.com> [SCSI] add 6.0 Gbit phy definitions to the sas transport class

I don't think these exist in silicon yet, but the aic94xx driver has a
register setting for them.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
a012564136a665f8d63443c057ba368572b483df 16-Feb-2006 Christoph Hellwig <hch@lst.de> [SCSI] sas: add support for enclosure and bad ID rphy attributes

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
24669f75a3231fa37444977c92d1f4838bec1233 16-Jan-2006 Jes Sorensen <jes@sgi.com> [SCSI] SCSI core kmalloc2kzalloc

Change the core SCSI code to use kzalloc rather than kmalloc+memset
where possible.

Signed-off-by: Jes Sorensen <jes@sgi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
d99ca4180fe44ae7f409fc73f1a09f270b8d458a 27-Jan-2006 Moore, Eric <Eric.Moore@lsil.com> [SCSI] scsi_transport_sas.c: display port identifier

This patch displays the port identifier on
the folder attribute; located in the middle digit.

/sys/class/sas_rphy/rphy-%x:%x:%x

The port identifier is basically the unique identifier
for each sas domain.

Signed-off-by: Eric Moore <Eric.Moore@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
e6bc863cf25f30ed8e2a4d41b76d5688f8efaee9 14-Jan-2006 Moore, Eric <Eric.Moore@lsil.com> [SCSI] scsi_transport_sas: mapping the rphy channel equal to the port identifier

We will be mapping the RAID volumes in mptsas to a reserved
channel that
is one larger than the anticapated number of ports on the direct
attached host
adapter.

Signed-off-by: Eric Moore <Eric.Moore@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
e02f3f59225d8c3b2a0ad0dc941a09865e27da61 13-Jan-2006 Christoph Hellwig <hch@lst.de> [SCSI] remove target parent limitiation

When James Smart fixed the issue of the userspace scan atributes
crashing the system with the FC transport class he added a patch to
let the transport class check if the parent is valid for a given
transport class.

When adding support for the integrated raid of fusion sas devices
we ran into a problem with that, as it didn't allow adding virtual
raid volumes without the transport class knowing about it.

So this patch adds a user_scan attribute instead, that takes over from
scsi_scan_host_selected if the transport class sets it and thus lets
the transport class control the user-initiated scanning. As this
plugs the hole about user-initiated scanning the target_parent hook
goes away and we rely on callers of the scanning routines to do
something sensible.

For SAS this meant I had to switch from a spinlock to a mutex to
synchronize the topology linked lists, in FC they were completely
unsynchronized which seems wrong.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
d4054239929479907f20b9d68c905589125ad343 04-Jan-2006 Christoph Hellwig <hch@lst.de> [SCSI] sas: fix removal of devices behind expanders

We need to iterate over all children when removing and expander, else
stale objects will be around after host removal. This fixes the oops
Eric Moore saw when removing and reloading mptsas.

Also don't try the scsi_remove_target call unless operating on an end
device. The current unconditional call is harmless but confusing.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
33b114e935a2202206e224dd2c695cee5a5986bf 11-Jan-2006 Christoph Hellwig <hch@lst.de> [SCSI] sas: clear parent->rphy in sas_rphy_delete

We need to clear the backpointer on rphy removal, else we'll run into
problems with host removal after a device has been hot unplugged.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
8c65b4a60450590e79a28e9717ceffa9e4debb3f 07-Nov-2005 Tim Schmielau <tim@physik3.uni-rostock.de> [PATCH] fix remaining missing includes

Fix more include file problems that surfaced since I submitted the previous
fix-missing-includes.patch. This should now allow not to include sched.h
from module.h, which is done by a followup patch.

Signed-off-by: Tim Schmielau <tim@physik3.uni-rostock.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
07ba3a954714da10cbd3f6249d93ac2c1df72c4f 19-Oct-2005 Christoph Hellwig <hch@lst.de> [SCSI] sas: add support for PHY resets

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
ac01bbbd3b7ebfca64357aed12cf476b16abe3ce 19-Oct-2005 Christoph Hellwig <hch@lst.de> [SCSI] sas: add flag for locally attached PHYs

Add a flag to mark a PHY as attached to the HBA as opposed to beeing on
an expander. This is needed because various features are only supported
on those. This is a crude hack, the proper fix would be to use
different classes for host-attached vs expander phys. I'm looking into
that.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
c3ee74c4e91017169c7f1fa74a57ba8502ec49c3 19-Sep-2005 Christoph Hellwig <hch@lst.de> [SCSI] scsi_transport_sas: support link error attributes

For now supporting the ->get_linkerrors method is mandatory. I'll
probably be beaten to implement the .show_foo variables and different
types of attributes soon..

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
fe8b2304e54552cea113318e2f66c45628130fdc 25-Sep-2005 Christoph Hellwig <hch@lst.de> [SCSI] sas: fix remote phy removal

Brown paperbag bug: sas_rphy_delete was ordered completely
wrong. Fix it up to be the same order as sas_phy_delete or
fc_rport_terminate and fix rphy objects that leaked after module
removal.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
37be6eeb4990c05fc7dd683ceaf1501d46ebe9a4 10-Sep-2005 James Bottomley <James.Bottomley@steeleye.com> [SCSI] SAS transport class: fixup prototype of sas_host_setup

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
c7ebbbce366c02e5657ac6b6059933fe0353b175 09-Sep-2005 Christoph Hellwig <hch@lst.de> [SCSI] SAS transport class

The SAS transport class contains common code to deal with SAS HBAs, an
aproximated representation of SAS topologies in the driver model,
and various sysfs attributes to expose these topologies and managment
interfaces to userspace.

In addition to the basic SCSI core objects this transport class introduces
two additional intermediate objects: The SAS PHY as represented by struct
sas_phy defines an "outgoing" PHY on a SAS HBA or Expander, and the SAS
remote PHY represented by struct sas_rphy defines an "incoming" PHY on a
SAS Expander or end device. Note that this is purely a software concept, the
underlying hardware for a PHY and a remote PHY is the exactly the same.

There is no concept of a SAS port in this code, users can see what PHYs
form a wide port based on the port_identifier attribute, which is the same
for all PHYs in a port.

This submission doesn't handle hot-plug addition or removal of SAS devices
and thus doesn't do scanning in a workqueue yet, that will be added in
phase2 after this submission. In a third phase I will add additional
managment infrastructure.

I think this submission is ready for 2.6.14, but additional comments are
of course very welcome.

I'd like to thanks James Smart a lot for his very useful input on the
design.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>