diff options
Diffstat (limited to 'drivers/scsi/ibmvscsi/ibmvscsi.c')
-rw-r--r-- | drivers/scsi/ibmvscsi/ibmvscsi.c | 59 |
1 files changed, 58 insertions, 1 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 | /** |