aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.c59
-rw-r--r--drivers/scsi/ibmvscsi/viosrp.h14
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;
94static int reset_timeout = 60; 94static int reset_timeout = 60;
95static int max_requests = IBMVSCSI_MAX_REQUESTS_DEFAULT; 95static int max_requests = IBMVSCSI_MAX_REQUESTS_DEFAULT;
96static int max_events = IBMVSCSI_MAX_REQUESTS_DEFAULT + 2; 96static int max_events = IBMVSCSI_MAX_REQUESTS_DEFAULT + 2;
97static int fast_fail = 1;
97 98
98static struct scsi_transport_template *ibmvscsi_transport_template; 99static 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);
114MODULE_PARM_DESC(init_timeout, "Initialization timeout in seconds"); 115MODULE_PARM_DESC(init_timeout, "Initialization timeout in seconds");
115module_param_named(max_requests, max_requests, int, S_IRUGO); 116module_param_named(max_requests, max_requests, int, S_IRUGO);
116MODULE_PARM_DESC(max_requests, "Maximum requests for this adapter"); 117MODULE_PARM_DESC(max_requests, "Maximum requests for this adapter");
118module_param_named(fast_fail, fast_fail, int, S_IRUGO | S_IWUSR);
119MODULE_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 */
875static 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 */
896static 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
93enum 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
137struct viosrp_fast_fail {
138 struct mad_common common;
139};
140
130union mad_iu { 141union 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
137union viosrp_iu { 149union viosrp_iu {