diff options
-rw-r--r-- | drivers/scsi/ibmvscsi/ibmvscsi.c | 59 | ||||
-rw-r--r-- | drivers/scsi/ibmvscsi/viosrp.h | 14 |
2 files changed, 71 insertions, 2 deletions
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c index 2ed46b8efedf..822fbc32a2ae 100644 --- a/drivers/scsi/ibmvscsi/ibmvscsi.c +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c | |||
@@ -94,6 +94,7 @@ static int abort_timeout = 60; | |||
94 | static int reset_timeout = 60; | 94 | static int reset_timeout = 60; |
95 | static int max_requests = IBMVSCSI_MAX_REQUESTS_DEFAULT; | 95 | static int max_requests = IBMVSCSI_MAX_REQUESTS_DEFAULT; |
96 | static int max_events = IBMVSCSI_MAX_REQUESTS_DEFAULT + 2; | 96 | static int max_events = IBMVSCSI_MAX_REQUESTS_DEFAULT + 2; |
97 | static int fast_fail = 1; | ||
97 | 98 | ||
98 | static struct scsi_transport_template *ibmvscsi_transport_template; | 99 | static struct scsi_transport_template *ibmvscsi_transport_template; |
99 | 100 | ||
@@ -114,6 +115,8 @@ module_param_named(init_timeout, init_timeout, int, S_IRUGO | S_IWUSR); | |||
114 | MODULE_PARM_DESC(init_timeout, "Initialization timeout in seconds"); | 115 | MODULE_PARM_DESC(init_timeout, "Initialization timeout in seconds"); |
115 | module_param_named(max_requests, max_requests, int, S_IRUGO); | 116 | module_param_named(max_requests, max_requests, int, S_IRUGO); |
116 | MODULE_PARM_DESC(max_requests, "Maximum requests for this adapter"); | 117 | MODULE_PARM_DESC(max_requests, "Maximum requests for this adapter"); |
118 | module_param_named(fast_fail, fast_fail, int, S_IRUGO | S_IWUSR); | ||
119 | MODULE_PARM_DESC(fast_fail, "Enable fast fail. [Default=1]"); | ||
117 | 120 | ||
118 | /* ------------------------------------------------------------ | 121 | /* ------------------------------------------------------------ |
119 | * Routines for the event pool and event structs | 122 | * Routines for the event pool and event structs |
@@ -863,6 +866,60 @@ static int send_srp_login(struct ibmvscsi_host_data *hostdata) | |||
863 | }; | 866 | }; |
864 | 867 | ||
865 | /** | 868 | /** |
869 | * fast_fail_rsp: - Handle response to MAD enable fast fail | ||
870 | * @evt_struct: srp_event_struct with the response | ||
871 | * | ||
872 | * Used as a "done" callback by when sending enable fast fail. Gets called | ||
873 | * by ibmvscsi_handle_crq() | ||
874 | */ | ||
875 | static void fast_fail_rsp(struct srp_event_struct *evt_struct) | ||
876 | { | ||
877 | struct ibmvscsi_host_data *hostdata = evt_struct->hostdata; | ||
878 | u8 status = evt_struct->xfer_iu->mad.fast_fail.common.status; | ||
879 | |||
880 | if (status == VIOSRP_MAD_NOT_SUPPORTED) | ||
881 | dev_err(hostdata->dev, "fast_fail not supported in server\n"); | ||
882 | else if (status == VIOSRP_MAD_FAILED) | ||
883 | dev_err(hostdata->dev, "fast_fail request failed\n"); | ||
884 | else if (status != VIOSRP_MAD_SUCCESS) | ||
885 | dev_err(hostdata->dev, "error 0x%X enabling fast_fail\n", status); | ||
886 | |||
887 | send_srp_login(hostdata); | ||
888 | } | ||
889 | |||
890 | /** | ||
891 | * init_host - Start host initialization | ||
892 | * @hostdata: ibmvscsi_host_data of host | ||
893 | * | ||
894 | * Returns zero if successful. | ||
895 | */ | ||
896 | static int enable_fast_fail(struct ibmvscsi_host_data *hostdata) | ||
897 | { | ||
898 | int rc; | ||
899 | unsigned long flags; | ||
900 | struct viosrp_fast_fail *fast_fail_mad; | ||
901 | struct srp_event_struct *evt_struct; | ||
902 | |||
903 | if (!fast_fail) | ||
904 | return send_srp_login(hostdata); | ||
905 | |||
906 | evt_struct = get_event_struct(&hostdata->pool); | ||
907 | BUG_ON(!evt_struct); | ||
908 | |||
909 | init_event_struct(evt_struct, fast_fail_rsp, VIOSRP_MAD_FORMAT, info_timeout); | ||
910 | |||
911 | fast_fail_mad = &evt_struct->iu.mad.fast_fail; | ||
912 | memset(fast_fail_mad, 0, sizeof(*fast_fail_mad)); | ||
913 | fast_fail_mad->common.type = VIOSRP_ENABLE_FAST_FAIL; | ||
914 | fast_fail_mad->common.length = sizeof(*fast_fail_mad); | ||
915 | |||
916 | spin_lock_irqsave(hostdata->host->host_lock, flags); | ||
917 | rc = ibmvscsi_send_srp_event(evt_struct, hostdata, info_timeout * 2); | ||
918 | spin_unlock_irqrestore(hostdata->host->host_lock, flags); | ||
919 | return rc; | ||
920 | } | ||
921 | |||
922 | /** | ||
866 | * adapter_info_rsp: - Handle response to MAD adapter info request | 923 | * adapter_info_rsp: - Handle response to MAD adapter info request |
867 | * @evt_struct: srp_event_struct with the response | 924 | * @evt_struct: srp_event_struct with the response |
868 | * | 925 | * |
@@ -903,7 +960,7 @@ static void adapter_info_rsp(struct srp_event_struct *evt_struct) | |||
903 | } | 960 | } |
904 | } | 961 | } |
905 | 962 | ||
906 | send_srp_login(hostdata); | 963 | enable_fast_fail(hostdata); |
907 | } | 964 | } |
908 | 965 | ||
909 | /** | 966 | /** |
diff --git a/drivers/scsi/ibmvscsi/viosrp.h b/drivers/scsi/ibmvscsi/viosrp.h index 204604501ad8..f5a9c26d1da8 100644 --- a/drivers/scsi/ibmvscsi/viosrp.h +++ b/drivers/scsi/ibmvscsi/viosrp.h | |||
@@ -86,7 +86,14 @@ enum viosrp_mad_types { | |||
86 | VIOSRP_EMPTY_IU_TYPE = 0x01, | 86 | VIOSRP_EMPTY_IU_TYPE = 0x01, |
87 | VIOSRP_ERROR_LOG_TYPE = 0x02, | 87 | VIOSRP_ERROR_LOG_TYPE = 0x02, |
88 | VIOSRP_ADAPTER_INFO_TYPE = 0x03, | 88 | VIOSRP_ADAPTER_INFO_TYPE = 0x03, |
89 | VIOSRP_HOST_CONFIG_TYPE = 0x04 | 89 | VIOSRP_HOST_CONFIG_TYPE = 0x04, |
90 | VIOSRP_ENABLE_FAST_FAIL = 0x08, | ||
91 | }; | ||
92 | |||
93 | enum viosrp_mad_status { | ||
94 | VIOSRP_MAD_SUCCESS = 0x00, | ||
95 | VIOSRP_MAD_NOT_SUPPORTED = 0xF1, | ||
96 | VIOSRP_MAD_FAILED = 0xF7, | ||
90 | }; | 97 | }; |
91 | 98 | ||
92 | /* | 99 | /* |
@@ -127,11 +134,16 @@ struct viosrp_host_config { | |||
127 | u64 buffer; | 134 | u64 buffer; |
128 | }; | 135 | }; |
129 | 136 | ||
137 | struct viosrp_fast_fail { | ||
138 | struct mad_common common; | ||
139 | }; | ||
140 | |||
130 | union mad_iu { | 141 | union mad_iu { |
131 | struct viosrp_empty_iu empty_iu; | 142 | struct viosrp_empty_iu empty_iu; |
132 | struct viosrp_error_log error_log; | 143 | struct viosrp_error_log error_log; |
133 | struct viosrp_adapter_info adapter_info; | 144 | struct viosrp_adapter_info adapter_info; |
134 | struct viosrp_host_config host_config; | 145 | struct viosrp_host_config host_config; |
146 | struct viosrp_fast_fail fast_fail; | ||
135 | }; | 147 | }; |
136 | 148 | ||
137 | union viosrp_iu { | 149 | union viosrp_iu { |