aboutsummaryrefslogtreecommitdiff
path: root/include/scsi/scsi_transport_sas.h
AgeCommit message (Collapse)Author
2013-05-10[SCSI] sas: unify the pointlessly separated enums sas_dev_type and ↵James Bottomley
sas_device_type These enums have been separate since the dawn of SAS, mainly because the latter is a procotol only enum and the former includes additional state for libsas. The dichotomy causes endless confusion about which one you should use where and leads to pointless warnings like this: drivers/scsi/mvsas/mv_sas.c: In function 'mvs_update_phyinfo': drivers/scsi/mvsas/mv_sas.c:1162:34: warning: comparison between 'enum sas_device_type' and 'enum sas_dev_type' [-Wenum-compare] Fix by eliminating one of them. The one kept is effectively the sas.h one, but call it sas_device_type and make sure the enums are all properly namespaced with the SAS_ prefix. Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2012-12-01[SCSI] scsi_transport_sas: add 12GB definitions for mpt3sasSreekanth Reddy
[jejb: split this core change into a separate patch] Signed-off-by: Sreekanth Reddy <Sreekanth.Reddy@lsi.com> Reviewed-by: Nagalakshmi Nandigama <Nagalakshmi.Nandigama@lsi.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2012-02-29[SCSI] libsas: fix sas_find_local_phy(), take phy referencesDan Williams
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>
2012-02-19[SCSI] libsas: perform sas-transport resets in shost->workq contextDan Williams
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>
2012-02-19[SCSI] libsas: prevent domain rediscovery competing with ata error handlingDan Williams
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>
2010-02-08[SCSI] scsi_transport_sas: add support for transport layer retries (TLR)James Bottomley
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>
2008-04-19SCSI: convert struct class_device to struct deviceTony Jones
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>
2008-01-11[SCSI] libsas: add host SMP processingJames Bottomley
This adds support for host side SMP processing, via a separate SMP interpreter file. Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-11[SCSI] libsas: Convert sas_proto users to sas_protocolDarrick J. Wong
sparse complains about the mixing of enums in libsas. Since the underlying numeric values of both enums are the same, combine them to get rid of the warning. Signed-off-by: Darrick J. Wong <djwong@us.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2007-07-20[SCSI] scsi_transport_sas: add destructor for bsgJames Bottomley
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>
2007-07-18[SCSI] transport_sas: add SAS management protocol supportFUJITA Tomonori
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>
2007-07-18[SCSI] libsas, aic94xx: fix dma mapping cockups with ATAJames Bottomley
This one was noticed by Gilbert Wu of Adaptec: The libata core actually does the DMA mapping for you, so there has to be an exception in the device drivers that *don't* do dma mapping for ATA commands. However, since we've already done this, libsas must now dma map any ATA commands that it wishes to issue ... and yes, this is a horrible mess. Additionally, the test in aic94xx for ATA protocols isn't quite right. Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-01-27[SCSI] libsas: Clean up discovery failure handler codeDarrick J. Wong
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>
2007-01-13[SCSI] libsas: Add a sysfs knob to enable/disable a phyDarrick J. Wong
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>
2006-11-22[PATCH] aic94xx: handle REQ_DEVICE_RESETDarrick J. Wong
This patch implements a REQ_DEVICE_RESET handler for the aic94xx driver. Like the earlier REQ_TASK_ABORT patch, this patch defers the device reset to the Scsi_Host's workqueue, which has the added benefit of ensuring that the device reset does not happen at the same time that the abort tmfs are being processed. After the phy reset, the busted drive should go away and be re-detected later, which is indeed what I've seen on both a x260 and a x206m. Signed-off-by: Darrick J. Wong <djwong@us.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2006-09-07[SCSI] scsi_transport_sas: make minimum and maximum linkrate settable quantitiesJames Bottomley
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>
2006-09-07[SCSI] SAS: consolidate linkspeed definitionsJames Bottomley
At the moment we have two separate linkspeed enumerations covering roughly the same values. This patch consolidates on a single one enum sas_linkspeed in scsi_transport_sas.h and uses it everywhere in the aic94xx driver. Eventually I'll get around to removing the duplicated fields in asd_sas_phy and sas_phy ... Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2006-08-27[SCSI] scsi_transport_sas: remove local_attached flagJames Bottomley
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>
2006-07-12[SCSI] scsi_transport_sas: add expander backlinkJames Bottomley
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>
2006-07-09[SCSI] scsi_transport_sas: add unindexed portsJames Bottomley
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>
2006-06-28[SCSI] scsi_transport_sas: introduce a sas_port entityJames Bottomley
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>
2006-03-19[SCSI] eliminate rphy allocation in favour of expander/end device allocationJames Bottomley
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>
2006-03-14[SCSI] add preliminary expander support to the sas transport classJames Bottomley
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>
2006-03-06[PATCH] convert aic94xx over to using the sas transport end deviceJames Bottomley
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>
2006-03-02[SCSI] add 6.0 Gbit phy definitions to the sas transport classJames Bottomley
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>
2006-02-27[SCSI] sas: add support for enclosure and bad ID rphy attributesChristoph Hellwig
Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-10-28[SCSI] sas: add support for PHY resetsChristoph Hellwig
Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-10-28[SCSI] sas: add flag for locally attached PHYsChristoph Hellwig
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>
2005-10-28[SCSI] scsi_transport_sas: support link error attributesChristoph Hellwig
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>
2005-09-09[SCSI] SAS transport classChristoph Hellwig
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>