aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/ibmvscsi/ibmvscsi.c
diff options
context:
space:
mode:
authorRobert Jennings <rcj@linux.vnet.ibm.com>2009-06-08 17:19:07 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2009-06-08 19:05:20 -0400
commitc1988e3123751fd425fbae99d5c1776608e965a9 (patch)
tree01ebad88b7799665097a96b4b8f0da447c0e4ee2 /drivers/scsi/ibmvscsi/ibmvscsi.c
parent3507e13fcba6b97501891a410ec8ef9f1f188620 (diff)
[SCSI] ibmvscsi: Enable fast fail feature
A new mode of error reporting, fast fail, has been added to the VIOS which allows failover to happen more quickly. If this new fast fail mode is enabled on the VIOS and the vSCSI client supports the mode, the VIOS will not return MEDIUM error on path failures, but rather return VIOSRP_ADAPTER_FAIL in the crq response, which ibmvscsi will translate to DID_ERROR. This new mode can be enabled for single path configurations as well, so it is the new default error reporting mode. A module parameter is provided to disable this new behavior on the off chance it causes a problem on some old VIOS version. Signed-off-by: Brian King <brking@linux.vnet.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/ibmvscsi/ibmvscsi.c')
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.c59
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;
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/**