aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi
diff options
context:
space:
mode:
authorJames Bottomley <JBottomley@Parallels.com>2012-05-21 07:17:30 -0400
committerJames Bottomley <JBottomley@Parallels.com>2012-05-21 07:17:30 -0400
commite34693336564f02b3e2cc09d8b872aef22a154e9 (patch)
tree09f51f10f9406042f9176e39b4dc8de850ba712e /include/scsi
parent76b311fdbdd2e16e5d39cd496a67aa1a1b948914 (diff)
parentde2eb4d5c5c25e8fb75d1e19092f24b83cb7d8d5 (diff)
Merge tag 'isci-for-3.5' into misc
isci update for 3.5 1/ Rework remote-node-context (RNC) handling for proper management of the silicon state machine in error handling and hot-plug conditions. Further details below, suffice to say if the RNC is mismanaged the silicon state machines may lock up. 2/ Refactor the initialization code to be reused for suspend/resume support 3/ Miscellaneous bug fixes to address discovery issues and hardware compatibility. RNC rework details from Jeff Skirvin: In the controller, devices as they appear on a SAS domain (or direct-attached SATA devices) are represented by memory structures known as "Remote Node Contexts" (RNCs). These structures are transferred from main memory to the controller using a set of register commands; these commands include setting up the context ("posting"), removing the context ("invalidating"), and commands to control the scheduling of commands and connections to that remote device ("suspensions" and "resumptions"). There is a similar path to control RNC scheduling from the protocol engine, which interprets the results of command and data transmission and reception. In general, the controller chooses among non-suspended RNCs to find one that has work requiring scheduling the transmission of command and data frames to a target. Likewise, when a target tries to return data back to the initiator, the state of the RNC is used by the controller to determine how to treat the incoming request. As an example, if the RNC is in the state "TX/RX Suspended", incoming SSP connection requests from the target will be rejected by the controller hardware. When an RNC is "TX Suspended", it will not be selected by the controller hardware to start outgoing command or data operations (with certain priority-based exceptions). As mentioned above, there are two sources for management of the RNC states: commands from driver software, and the result of transmission and reception conditions of commands and data signaled by the controller hardware. As an example of the latter, if an outgoing SSP command ends with a OPEN_REJECT(BAD_DESTINATION) status, the RNC state will transition to the "TX Suspended" state, and this is signaled by the controller hardware in the status to the completion of the pending command as well as signaled in a controller hardware event. Examples of the former are included in the patch changelogs. Driver software is required to suspend the RNC in a "TX/RX Suspended" condition before any outstanding commands can be terminated. Failure to guarantee this can lead to a complete hardware hang condition. Earlier versions of the driver software did not guarantee that an RNC was correctly managed before I/O termination, and so operated in an unsafe way. Further, the driver performed unnecessary contortions to preserve the remote device command state and so was more complicated than it needed to be. A simplifying driver assumption is that once an I/O has entered the error handler path without having completed in the target, the requirement on the driver is that all use of the sas_task must end. Beyond that, recovery of operation is dependent on libsas and other components to reset, rediscover and reconfigure the device before normal operation can restart. In the driver, this simplifying assumption meant that the RNC management could be reduced to entry into the suspended state, terminating the targeted I/O request, and resuming the RNC as needed for device-specific management such as an SSP Abort Task or LUN Reset Management request.
Diffstat (limited to 'include/scsi')
-rw-r--r--include/scsi/libsas.h40
-rw-r--r--include/scsi/sas.h1
-rw-r--r--include/scsi/sas_ata.h4
3 files changed, 39 insertions, 6 deletions
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index 5f5ed1b8b41b..f4f1c96dca72 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -217,11 +217,29 @@ struct domain_device {
217 struct kref kref; 217 struct kref kref;
218}; 218};
219 219
220struct sas_discovery_event { 220struct sas_work {
221 struct list_head drain_node;
221 struct work_struct work; 222 struct work_struct work;
223};
224
225static inline void INIT_SAS_WORK(struct sas_work *sw, void (*fn)(struct work_struct *))
226{
227 INIT_WORK(&sw->work, fn);
228 INIT_LIST_HEAD(&sw->drain_node);
229}
230
231struct sas_discovery_event {
232 struct sas_work work;
222 struct asd_sas_port *port; 233 struct asd_sas_port *port;
223}; 234};
224 235
236static inline struct sas_discovery_event *to_sas_discovery_event(struct work_struct *work)
237{
238 struct sas_discovery_event *ev = container_of(work, typeof(*ev), work.work);
239
240 return ev;
241}
242
225struct sas_discovery { 243struct sas_discovery {
226 struct sas_discovery_event disc_work[DISC_NUM_EVENTS]; 244 struct sas_discovery_event disc_work[DISC_NUM_EVENTS];
227 unsigned long pending; 245 unsigned long pending;
@@ -244,7 +262,7 @@ struct asd_sas_port {
244 struct list_head destroy_list; 262 struct list_head destroy_list;
245 enum sas_linkrate linkrate; 263 enum sas_linkrate linkrate;
246 264
247 struct work_struct work; 265 struct sas_work work;
248 266
249/* public: */ 267/* public: */
250 int id; 268 int id;
@@ -270,10 +288,17 @@ struct asd_sas_port {
270}; 288};
271 289
272struct asd_sas_event { 290struct asd_sas_event {
273 struct work_struct work; 291 struct sas_work work;
274 struct asd_sas_phy *phy; 292 struct asd_sas_phy *phy;
275}; 293};
276 294
295static inline struct asd_sas_event *to_asd_sas_event(struct work_struct *work)
296{
297 struct asd_sas_event *ev = container_of(work, typeof(*ev), work.work);
298
299 return ev;
300}
301
277/* The phy pretty much is controlled by the LLDD. 302/* The phy pretty much is controlled by the LLDD.
278 * The class only reads those fields. 303 * The class only reads those fields.
279 */ 304 */
@@ -333,10 +358,17 @@ struct scsi_core {
333}; 358};
334 359
335struct sas_ha_event { 360struct sas_ha_event {
336 struct work_struct work; 361 struct sas_work work;
337 struct sas_ha_struct *ha; 362 struct sas_ha_struct *ha;
338}; 363};
339 364
365static inline struct sas_ha_event *to_sas_ha_event(struct work_struct *work)
366{
367 struct sas_ha_event *ev = container_of(work, typeof(*ev), work.work);
368
369 return ev;
370}
371
340enum sas_ha_state { 372enum sas_ha_state {
341 SAS_HA_REGISTERED, 373 SAS_HA_REGISTERED,
342 SAS_HA_DRAINING, 374 SAS_HA_DRAINING,
diff --git a/include/scsi/sas.h b/include/scsi/sas.h
index a577a833603d..be3eb0bf1ac0 100644
--- a/include/scsi/sas.h
+++ b/include/scsi/sas.h
@@ -103,6 +103,7 @@ enum sas_dev_type {
103}; 103};
104 104
105enum sas_protocol { 105enum sas_protocol {
106 SAS_PROTOCOL_NONE = 0,
106 SAS_PROTOCOL_SATA = 0x01, 107 SAS_PROTOCOL_SATA = 0x01,
107 SAS_PROTOCOL_SMP = 0x02, 108 SAS_PROTOCOL_SMP = 0x02,
108 SAS_PROTOCOL_STP = 0x04, 109 SAS_PROTOCOL_STP = 0x04,
diff --git a/include/scsi/sas_ata.h b/include/scsi/sas_ata.h
index cdccd2eb7b6c..77670e823ed8 100644
--- a/include/scsi/sas_ata.h
+++ b/include/scsi/sas_ata.h
@@ -37,7 +37,7 @@ static inline int dev_is_sata(struct domain_device *dev)
37} 37}
38 38
39int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy); 39int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy);
40int sas_ata_init_host_and_port(struct domain_device *found_dev); 40int sas_ata_init(struct domain_device *dev);
41void sas_ata_task_abort(struct sas_task *task); 41void sas_ata_task_abort(struct sas_task *task);
42void sas_ata_strategy_handler(struct Scsi_Host *shost); 42void sas_ata_strategy_handler(struct Scsi_Host *shost);
43void sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q, 43void sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q,
@@ -52,7 +52,7 @@ static inline int dev_is_sata(struct domain_device *dev)
52{ 52{
53 return 0; 53 return 0;
54} 54}
55static inline int sas_ata_init_host_and_port(struct domain_device *found_dev) 55static inline int sas_ata_init(struct domain_device *dev)
56{ 56{
57 return 0; 57 return 0;
58} 58}