From: Bart Van Assche <bvanassche-HInyCGIudOg@public.gmane.org>
To: Roland Dreier <roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
linux-rdma <linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: IB/cma: Make timeout dependent on the subnet timeout
Date: Tue, 22 Apr 2014 15:16:37 +0200 [thread overview]
Message-ID: <53566BB5.5030203@acm.org> (raw)
The default RDMA/CM timeout and retry values are too large for small IB
networks and make the SRP initiator reconnect mechanism unnecessary slow.
Hence make the CM timeout dependent on the subnet timeout in IB networks.
Signed-off-by: Bart Van Assche <bvanassche-HInyCGIudOg@public.gmane.org>
Cc: Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
drivers/infiniband/core/cma.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 199958d..95528e1 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -60,7 +60,6 @@ MODULE_AUTHOR("Sean Hefty");
MODULE_DESCRIPTION("Generic RDMA CM Agent");
MODULE_LICENSE("Dual BSD/GPL");
-#define CMA_CM_RESPONSE_TIMEOUT 20
#define CMA_MAX_CM_RETRIES 15
#define CMA_CM_MRA_SETTING (IB_CM_MRA_FLAG_DELAY | 24)
#define CMA_IBOE_PACKET_LIFETIME 18
@@ -2728,6 +2727,15 @@ out:
return ret;
}
+static u8 cma_get_ib_subnet_timeout(struct rdma_cm_id *id)
+{
+ struct ib_port_attr attr;
+ int ret;
+
+ ret = ib_query_port(id->device, id->port_num, &attr);
+ return ret == 0 ? attr.subnet_timeout : 18;
+}
+
static int cma_resolve_ib_udp(struct rdma_id_private *id_priv,
struct rdma_conn_param *conn_param)
{
@@ -2735,6 +2743,7 @@ static int cma_resolve_ib_udp(struct rdma_id_private *id_priv,
struct ib_cm_id *id;
void *private_data;
int offset, ret;
+ u8 cm_response_timeout = cma_get_ib_subnet_timeout(&id_priv->id) + 2;
memset(&req, 0, sizeof req);
offset = cma_user_data_offset(id_priv);
@@ -2771,7 +2780,7 @@ static int cma_resolve_ib_udp(struct rdma_id_private *id_priv,
req.path = id_priv->id.route.path_rec;
req.service_id = rdma_get_service_id(&id_priv->id, cma_dst_addr(id_priv));
- req.timeout_ms = 1 << (CMA_CM_RESPONSE_TIMEOUT - 8);
+ req.timeout_ms = 1 << max(cm_response_timeout - 8, 0);
req.max_cm_retries = CMA_MAX_CM_RETRIES;
ret = ib_send_cm_sidr_req(id_priv->cm_id.ib, &req);
@@ -2792,6 +2801,7 @@ static int cma_connect_ib(struct rdma_id_private *id_priv,
void *private_data;
struct ib_cm_id *id;
int offset, ret;
+ u8 cm_response_timeout = cma_get_ib_subnet_timeout(&id_priv->id) + 2;
memset(&req, 0, sizeof req);
offset = cma_user_data_offset(id_priv);
@@ -2839,8 +2849,8 @@ static int cma_connect_ib(struct rdma_id_private *id_priv,
req.flow_control = conn_param->flow_control;
req.retry_count = min_t(u8, 7, conn_param->retry_count);
req.rnr_retry_count = min_t(u8, 7, conn_param->rnr_retry_count);
- req.remote_cm_response_timeout = CMA_CM_RESPONSE_TIMEOUT;
- req.local_cm_response_timeout = CMA_CM_RESPONSE_TIMEOUT;
+ req.remote_cm_response_timeout = cm_response_timeout;
+ req.local_cm_response_timeout = cm_response_timeout;
req.max_cm_retries = CMA_MAX_CM_RETRIES;
req.srq = id_priv->srq ? 1 : 0;
--
1.8.4.5
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next reply other threads:[~2014-04-22 13:16 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-22 13:16 Bart Van Assche [this message]
[not found] ` <53566BB5.5030203-HInyCGIudOg@public.gmane.org>
2014-04-22 18:41 ` IB/cma: Make timeout dependent on the subnet timeout Hefty, Sean
[not found] ` <1828884A29C6694DAF28B7E6B8A82373992F2F15-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-04-23 12:30 ` Hal Rosenstock
[not found] ` <5357B25D.2000108-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2014-04-23 12:46 ` Bart Van Assche
[not found] ` <5357B626.8050209-HInyCGIudOg@public.gmane.org>
2014-04-23 12:55 ` Hal Rosenstock
[not found] ` <5357B83A.5070000-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2014-04-23 14:34 ` Weiny, Ira
2014-04-23 13:44 ` Hefty, Sean
[not found] ` <1828884A29C6694DAF28B7E6B8A82373992F32A2-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-04-24 7:39 ` Or Gerlitz
[not found] ` <5358BF9D.4030409-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2014-04-25 2:59 ` Hefty, Sean
[not found] ` <1828884A29C6694DAF28B7E6B8A82373992F4F6E-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-04-25 16:21 ` Bart Van Assche
[not found] ` <535A8BA6.4090603-HInyCGIudOg@public.gmane.org>
2014-04-25 16:56 ` Hefty, Sean
[not found] ` <1828884A29C6694DAF28B7E6B8A82373992F50A6-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-04-25 17:47 ` Bart Van Assche
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53566BB5.5030203@acm.org \
--to=bvanassche-hinycgiudog@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox