Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 302550
b: refs/heads/master
c: 6f48844
h: refs/heads/master
v: v3
  • Loading branch information
Jeff Skirvin authored and Dan Williams committed May 17, 2012
1 parent aa18076 commit d0056b5
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fc25f79af321c01a739150ba2c09435cf977a63d
refs/heads/master: 6f48844e3f16b7d8a1f9a1a11bd9a11089a5292f
26 changes: 25 additions & 1 deletion trunk/drivers/scsi/isci/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -1548,6 +1548,29 @@ static void sci_port_failed_state_enter(struct sci_base_state_machine *sm)
isci_port_hard_reset_complete(iport, SCI_FAILURE_TIMEOUT);
}

void sci_port_set_hang_detection_timeout(struct isci_port *iport, u32 timeout)
{
int phy_index;
u32 phy_mask = iport->active_phy_mask;

if (timeout)
++iport->hang_detect_users;
else if (iport->hang_detect_users > 1)
--iport->hang_detect_users;
else
iport->hang_detect_users = 0;

if (timeout || (iport->hang_detect_users == 0)) {
for (phy_index = 0; phy_index < SCI_MAX_PHYS; phy_index++) {
if ((phy_mask >> phy_index) & 1) {
writel(timeout,
&iport->phy_table[phy_index]
->link_layer_registers
->link_layer_hang_detection_timeout);
}
}
}
}
/* --------------------------------------------------------------------------- */

static const struct sci_base_state sci_port_state_table[] = {
Expand Down Expand Up @@ -1596,6 +1619,7 @@ void sci_port_construct(struct isci_port *iport, u8 index,

iport->started_request_count = 0;
iport->assigned_device_count = 0;
iport->hang_detect_users = 0;

iport->reserved_rni = SCU_DUMMY_INDEX;
iport->reserved_tag = SCI_CONTROLLER_INVALID_IO_TAG;
Expand Down Expand Up @@ -1733,7 +1757,7 @@ void isci_port_formed(struct asd_sas_phy *phy)
struct isci_host *ihost = phy->ha->lldd_ha;
struct isci_phy *iphy = to_iphy(phy);
struct asd_sas_port *port = phy->port;
struct isci_port *iport;
struct isci_port *iport = NULL;
unsigned long flags;
int i;

Expand Down
5 changes: 5 additions & 0 deletions trunk/drivers/scsi/isci/port.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ struct isci_port {
u16 reserved_tag;
u32 started_request_count;
u32 assigned_device_count;
u32 hang_detect_users;
u32 not_ready_reason;
struct isci_phy *phy_table[SCI_MAX_PHYS];
struct isci_host *owning_controller;
Expand Down Expand Up @@ -269,6 +270,10 @@ void sci_port_get_attached_sas_address(
struct isci_port *iport,
struct sci_sas_address *sas_address);

void sci_port_set_hang_detection_timeout(
struct isci_port *isci_port,
u32 timeout);

void isci_port_formed(struct asd_sas_phy *);
void isci_port_deformed(struct asd_sas_phy *);

Expand Down
7 changes: 7 additions & 0 deletions trunk/drivers/scsi/isci/remote_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,13 @@ static inline void sci_remote_device_decrement_request_count(struct isci_remote_
idev->started_request_count--;
}

static inline void isci_dev_set_hang_detection_timeout(
struct isci_remote_device *idev,
u32 timeout)
{
sci_port_set_hang_detection_timeout(idev->owning_port, timeout);
}

enum sci_status sci_remote_device_frame_handler(
struct isci_remote_device *idev,
u32 frame_index);
Expand Down
15 changes: 14 additions & 1 deletion trunk/drivers/scsi/isci/remote_node_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,15 @@ static void sci_remote_node_context_tx_rx_suspended_state_enter(struct sci_base_
sci_remote_node_context_continue_state_transitions(rnc);
}

static void sci_remote_node_context_await_suspend_state_exit(
struct sci_base_state_machine *sm)
{
struct sci_remote_node_context *rnc
= container_of(sm, typeof(*rnc), sm);

isci_dev_set_hang_detection_timeout(rnc_to_dev(rnc), 0);
}

static const struct sci_base_state sci_remote_node_context_state_table[] = {
[SCI_RNC_INITIAL] = {
.enter_state = sci_remote_node_context_initial_state_enter,
Expand All @@ -338,7 +347,9 @@ static const struct sci_base_state sci_remote_node_context_state_table[] = {
[SCI_RNC_TX_RX_SUSPENDED] = {
.enter_state = sci_remote_node_context_tx_rx_suspended_state_enter,
},
[SCI_RNC_AWAIT_SUSPENSION] = { },
[SCI_RNC_AWAIT_SUSPENSION] = {
.exit_state = sci_remote_node_context_await_suspend_state_exit,
},
};

void sci_remote_node_context_construct(struct sci_remote_node_context *rnc,
Expand Down Expand Up @@ -513,6 +524,8 @@ enum sci_status sci_remote_node_context_suspend(struct sci_remote_node_context *
if (suspend_type == SCI_SOFTWARE_SUSPENSION) {
sci_remote_device_post_request(rnc_to_dev(sci_rnc),
SCU_CONTEXT_COMMAND_POST_RNC_SUSPEND_TX);
isci_dev_set_hang_detection_timeout(rnc_to_dev(sci_rnc),
0x00000001);
}

sci_change_state(&sci_rnc->sm, SCI_RNC_AWAIT_SUSPENSION);
Expand Down

0 comments on commit d0056b5

Please sign in to comment.