From c80423a5bd9c301873b713eb379d56a0d0b07d8f Mon Sep 17 00:00:00 2001 From: Arlin Davis Date: Mon, 24 Jun 2013 14:19:22 -0700 Subject: [PATCH] cma: add DAPL_CM_TOS environment variable to enable passing a TOS to the RDMA CM Signed-off-by Matthew Finlay Acked-by: Arlin Davis --- dapl/openib_cma/cm.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/dapl/openib_cma/cm.c b/dapl/openib_cma/cm.c index d90783c..ab0501f 100644 --- a/dapl/openib_cma/cm.c +++ b/dapl/openib_cma/cm.c @@ -79,7 +79,7 @@ struct dapl_pdata_hdr { static void dapli_addr_resolve(struct dapl_cm_id *conn) { - int ret; + int ret, tos; #ifdef DAPL_DBG struct rdma_addr *ipaddr = &conn->cm_id->route.addr; #endif @@ -90,6 +90,16 @@ static void dapli_addr_resolve(struct dapl_cm_id *conn) ntohl(((struct sockaddr_in *) &ipaddr->dst_addr)->sin_addr.s_addr)); + tos = dapl_os_get_env_val("DAPL_CM_TOS", 0); + if (tos) { + ret = rdma_set_option(conn->cm_id,RDMA_OPTION_ID,RDMA_OPTION_ID_TOS,&tos,sizeof(uint8_t)); + if (ret) { + dapl_log(DAPL_DBG_TYPE_ERR, + " dapl_cma_connect: failed to set TOS ERR 0x%x %s\n", + ret, strerror(errno)); + } + } + ret = rdma_resolve_route(conn->cm_id, conn->route_timeout); if (ret) { dapl_log(DAPL_DBG_TYPE_ERR, -- 2.41.0