aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/ulp
diff options
context:
space:
mode:
authorVu Pham <vuhuong@mellanox.com>2013-10-26 08:31:27 -0400
committerRoland Dreier <roland@purestorage.com>2013-11-08 17:43:15 -0500
commit7bb312e4a2f323fa460bbf9f33eeb00b5dabdb6b (patch)
tree68a03b84df702841512a2e786bf7ec3a8b3d30a5 /drivers/infiniband/ulp
parent959f58544b7f20c92d5eb43d1232c96c15c01bfb (diff)
IB/srp: Make transport layer retry count configurable
Allow the InfiniBand RC retry count to be configured by the user as an option in the target login string. Reducing this retry count allows to reduce the path failover time. Signed-off-by: Vu Pham <vu@mellanox.com> [ bvanassche: Rewrote patch description / changed default retry count ] Signed-off-by: Bart Van Assche <bvanassche@acm.org> Acked-by: David Dillow <dillowda@ornl.gov> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband/ulp')
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.c24
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.h1
2 files changed, 24 insertions, 1 deletions
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index f93baf8254c4..11ebf3e7646a 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -390,7 +390,7 @@ static int srp_send_req(struct srp_target_port *target)
390 req->param.responder_resources = 4; 390 req->param.responder_resources = 4;
391 req->param.remote_cm_response_timeout = 20; 391 req->param.remote_cm_response_timeout = 20;
392 req->param.local_cm_response_timeout = 20; 392 req->param.local_cm_response_timeout = 20;
393 req->param.retry_count = 7; 393 req->param.retry_count = target->tl_retry_count;
394 req->param.rnr_retry_count = 7; 394 req->param.rnr_retry_count = 7;
395 req->param.max_cm_retries = 15; 395 req->param.max_cm_retries = 15;
396 396
@@ -1907,6 +1907,14 @@ static ssize_t show_comp_vector(struct device *dev,
1907 return sprintf(buf, "%d\n", target->comp_vector); 1907 return sprintf(buf, "%d\n", target->comp_vector);
1908} 1908}
1909 1909
1910static ssize_t show_tl_retry_count(struct device *dev,
1911 struct device_attribute *attr, char *buf)
1912{
1913 struct srp_target_port *target = host_to_target(class_to_shost(dev));
1914
1915 return sprintf(buf, "%d\n", target->tl_retry_count);
1916}
1917
1910static ssize_t show_cmd_sg_entries(struct device *dev, 1918static ssize_t show_cmd_sg_entries(struct device *dev,
1911 struct device_attribute *attr, char *buf) 1919 struct device_attribute *attr, char *buf)
1912{ 1920{
@@ -1934,6 +1942,7 @@ static DEVICE_ATTR(zero_req_lim, S_IRUGO, show_zero_req_lim, NULL);
1934static DEVICE_ATTR(local_ib_port, S_IRUGO, show_local_ib_port, NULL); 1942static DEVICE_ATTR(local_ib_port, S_IRUGO, show_local_ib_port, NULL);
1935static DEVICE_ATTR(local_ib_device, S_IRUGO, show_local_ib_device, NULL); 1943static DEVICE_ATTR(local_ib_device, S_IRUGO, show_local_ib_device, NULL);
1936static DEVICE_ATTR(comp_vector, S_IRUGO, show_comp_vector, NULL); 1944static DEVICE_ATTR(comp_vector, S_IRUGO, show_comp_vector, NULL);
1945static DEVICE_ATTR(tl_retry_count, S_IRUGO, show_tl_retry_count, NULL);
1937static DEVICE_ATTR(cmd_sg_entries, S_IRUGO, show_cmd_sg_entries, NULL); 1946static DEVICE_ATTR(cmd_sg_entries, S_IRUGO, show_cmd_sg_entries, NULL);
1938static DEVICE_ATTR(allow_ext_sg, S_IRUGO, show_allow_ext_sg, NULL); 1947static DEVICE_ATTR(allow_ext_sg, S_IRUGO, show_allow_ext_sg, NULL);
1939 1948
@@ -1949,6 +1958,7 @@ static struct device_attribute *srp_host_attrs[] = {
1949 &dev_attr_local_ib_port, 1958 &dev_attr_local_ib_port,
1950 &dev_attr_local_ib_device, 1959 &dev_attr_local_ib_device,
1951 &dev_attr_comp_vector, 1960 &dev_attr_comp_vector,
1961 &dev_attr_tl_retry_count,
1952 &dev_attr_cmd_sg_entries, 1962 &dev_attr_cmd_sg_entries,
1953 &dev_attr_allow_ext_sg, 1963 &dev_attr_allow_ext_sg,
1954 NULL 1964 NULL
@@ -2073,6 +2083,7 @@ enum {
2073 SRP_OPT_ALLOW_EXT_SG = 1 << 10, 2083 SRP_OPT_ALLOW_EXT_SG = 1 << 10,
2074 SRP_OPT_SG_TABLESIZE = 1 << 11, 2084 SRP_OPT_SG_TABLESIZE = 1 << 11,
2075 SRP_OPT_COMP_VECTOR = 1 << 12, 2085 SRP_OPT_COMP_VECTOR = 1 << 12,
2086 SRP_OPT_TL_RETRY_COUNT = 1 << 13,
2076 SRP_OPT_ALL = (SRP_OPT_ID_EXT | 2087 SRP_OPT_ALL = (SRP_OPT_ID_EXT |
2077 SRP_OPT_IOC_GUID | 2088 SRP_OPT_IOC_GUID |
2078 SRP_OPT_DGID | 2089 SRP_OPT_DGID |
@@ -2094,6 +2105,7 @@ static const match_table_t srp_opt_tokens = {
2094 { SRP_OPT_ALLOW_EXT_SG, "allow_ext_sg=%u" }, 2105 { SRP_OPT_ALLOW_EXT_SG, "allow_ext_sg=%u" },
2095 { SRP_OPT_SG_TABLESIZE, "sg_tablesize=%u" }, 2106 { SRP_OPT_SG_TABLESIZE, "sg_tablesize=%u" },
2096 { SRP_OPT_COMP_VECTOR, "comp_vector=%u" }, 2107 { SRP_OPT_COMP_VECTOR, "comp_vector=%u" },
2108 { SRP_OPT_TL_RETRY_COUNT, "tl_retry_count=%u" },
2097 { SRP_OPT_ERR, NULL } 2109 { SRP_OPT_ERR, NULL }
2098}; 2110};
2099 2111
@@ -2257,6 +2269,15 @@ static int srp_parse_options(const char *buf, struct srp_target_port *target)
2257 target->comp_vector = token; 2269 target->comp_vector = token;
2258 break; 2270 break;
2259 2271
2272 case SRP_OPT_TL_RETRY_COUNT:
2273 if (match_int(args, &token) || token < 2 || token > 7) {
2274 pr_warn("bad tl_retry_count parameter '%s' (must be a number between 2 and 7)\n",
2275 p);
2276 goto out;
2277 }
2278 target->tl_retry_count = token;
2279 break;
2280
2260 default: 2281 default:
2261 pr_warn("unknown parameter or missing value '%s' in target creation request\n", 2282 pr_warn("unknown parameter or missing value '%s' in target creation request\n",
2262 p); 2283 p);
@@ -2311,6 +2332,7 @@ static ssize_t srp_create_target(struct device *dev,
2311 target->cmd_sg_cnt = cmd_sg_entries; 2332 target->cmd_sg_cnt = cmd_sg_entries;
2312 target->sg_tablesize = indirect_sg_entries ? : cmd_sg_entries; 2333 target->sg_tablesize = indirect_sg_entries ? : cmd_sg_entries;
2313 target->allow_ext_sg = allow_ext_sg; 2334 target->allow_ext_sg = allow_ext_sg;
2335 target->tl_retry_count = 7;
2314 2336
2315 ret = srp_parse_options(buf, target); 2337 ret = srp_parse_options(buf, target);
2316 if (ret) 2338 if (ret)
diff --git a/drivers/infiniband/ulp/srp/ib_srp.h b/drivers/infiniband/ulp/srp/ib_srp.h
index e641088c14dc..84d821b24ec7 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.h
+++ b/drivers/infiniband/ulp/srp/ib_srp.h
@@ -157,6 +157,7 @@ struct srp_target_port {
157 unsigned int scsi_id; 157 unsigned int scsi_id;
158 unsigned int sg_tablesize; 158 unsigned int sg_tablesize;
159 int comp_vector; 159 int comp_vector;
160 int tl_retry_count;
160 161
161 struct ib_sa_path_rec path; 162 struct ib_sa_path_rec path;
162 __be16 orig_dgid[8]; 163 __be16 orig_dgid[8];