librdmacm: replace query_route call with separate queries
PATCH 5/37 librdmacm: replace query_route call with separate queries
To support other address families and multiple path records, replace the query_route call with specific query calls to obtain only the desired information.
---
src/cma.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 60 insertions(+), 9 deletions(-)
src/cma.c +60 -9
@@ -161,6 +161,7 @@ static struct cma_device *cma_dev_array;static int cma_dev_cnt;static pthread_mutex_t mut =PTHREAD_MUTEX_INITIALIZER ;static int abi_ver =RDMA_USER_CM_MAX_ABI_VERSION ; +int af_ib_support;#define container_of (ptr, type, field) \ ((type *) ((void *)ptr - offsetof(type, field)))
@@ -627,7 +628,7 @@ static int ucma_query_route(struct rdma_cm_id *id)struct cma_id_private *id_priv;void *msg;int ret, size, i; - +CMA_CREATE_MSG_CMD_RESP (msg, cmd, resp,UCMA_CMD_QUERY_ROUTE , size); id_priv = container_of(id, struct cma_id_private, id); cmd->id = id_priv->handle;
@@ -1060,7 +1061,10 @@ int rdma_listen(struct rdma_cm_id *id, int backlog)if (ret != size)return (ret >=0 ) ?ERR (ENODATA ) :-1 ; -return ucma_query_route (id); +if (af_ib_support) +return ucma_query_addr (id); +else +return ucma_query_route (id); }int rdma_accept (struct rdma_cm_id *id,struct rdma_conn_param *conn_param)
@@ -1326,6 +1330,57 @@ int rdma_ack_cm_event(struct rdma_cm_event *event)return 0 ; } +static void ucma_process_addr_resolved (struct cma_event *evt) +{ +if (af_ib_support) { + evt->event.status =ucma_query_addr (&evt->id_priv->id); +if (!evt->event.status && + evt->id_priv->id.verbs->device->transport_type ==IBV_TRANSPORT_IB ) + evt->event.status =ucma_query_gid (&evt->id_priv->id); + }else { + evt->event.status =ucma_query_route (&evt->id_priv->id); + } + +if (evt->event.status) + evt->event.event =RDMA_CM_EVENT_ADDR_ERROR ; +} + +static void ucma_process_route_resolved (struct cma_event *evt) +{ +if (evt->id_priv->id.verbs->device->transport_type !=IBV_TRANSPORT_IB ) +return ; + +if (af_ib_support) + evt->event.status =ucma_query_path (&evt->id_priv->id); +else + evt->event.status =ucma_query_route (&evt->id_priv->id); + +if (evt->event.status) + evt->event.event =RDMA_CM_EVENT_ROUTE_ERROR ; +} + +static int ucma_query_req_info (struct rdma_cm_id *id) +{ +int ret; + +if (!af_ib_support) +return ucma_query_route (id); + + ret =ucma_query_addr (id); +if (ret) +return ret; + + ret =ucma_query_gid (id); +if (ret) +return ret; + + ret =ucma_query_path (id); +if (ret) +return ret; + +return 0 ; +} +static int ucma_process_conn_req (struct cma_event *evt,uint32_t handle) {
@@ -1344,7 +1399,7 @@ static int ucma_process_conn_req(struct cma_event *evt, evt->event.id = &id_priv->id; id_priv->handle = handle; - ret =ucma_query_route (&id_priv->id); + ret =ucma_query_req_info (&id_priv->id);if (ret) {rdma_destroy_id (&id_priv->id); goto err;
@@ -1473,14 +1528,10 @@ retry:switch (resp->event) {case RDMA_CM_EVENT_ADDR_RESOLVED : - evt->event.status =ucma_query_route (&evt->id_priv->id); -if (evt->event.status) - evt->event.event =RDMA_CM_EVENT_ADDR_ERROR ; +ucma_process_addr_resolved (evt);break ;case RDMA_CM_EVENT_ROUTE_RESOLVED : - evt->event.status =ucma_query_route (&evt->id_priv->id); -if (evt->event.status) - evt->event.event =RDMA_CM_EVENT_ROUTE_ERROR ; +ucma_process_route_resolved (evt);break ;case RDMA_CM_EVENT_CONNECT_REQUEST : evt->id_priv = (void *) (uintptr_t ) resp->uid;
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): D81E70C032A3452B9FD00D7EB445F6CF-Zpru7NauK7drdx17CPfAsdBPR1lH4CV8@public.gmane.org
Hey Sean,
You define global int af_ib_support. It never gets set to non-zero. Was this debug code or does it get set somewhere else that I'm missing?
Steve.
Quoted 131 lines · Sean Hefty
To support other address families and multiple path records, replace the
query_routecall with specific query calls to obtain only the desired information.Signed-off-by Sean Hefty <[email protected]>---
src/cma.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 60 insertions(+), 9 deletions(-)src/cma.c +60
-10@@ -161,6 +161,7 @@ static struct cma_device *cma_dev_array;static int cma_dev_cnt;static pthread_mutex_t mut =PTHREAD_MUTEX_INITIALIZER ;static int abi_ver =RDMA_USER_CM_MAX_ABI_VERSION ; +int af_ib_support;#define container_of (ptr, type, field) \ ((type *) ((void *)ptr - offsetof(type, field)))@@ -627,7 +628,7 @@ static int ucma_query_route(struct rdma_cm_id *id)struct cma_id_private *id_priv;void *msg;int ret, size, i; - +CMA_CREATE_MSG_CMD_RESP (msg, cmd, resp,UCMA_CMD_QUERY_ROUTE , size); id_priv = container_of(id, struct cma_id_private, id); cmd->id = id_priv->handle;@@ -1060,7 +1061,10 @@ int rdma_listen(struct rdma_cm_id *id, int backlog)if (ret != size)return (ret >=0 ) ?ERR (ENODATA ) :-1 ; -return ucma_query_route (id); +if (af_ib_support) +return ucma_query_addr (id); +else +return ucma_query_route (id); }int rdma_accept (struct rdma_cm_id *id,struct rdma_conn_param *conn_param)@@ -1326,6 +1330,57 @@ int rdma_ack_cm_event(struct rdma_cm_event *event)return 0 ; } +static void ucma_process_addr_resolved (struct cma_event *evt) +{ +if (af_ib_support) { + evt->event.status =ucma_query_addr (&evt->id_priv->id); +if (!evt->event.status && + evt->id_priv->id.verbs->device->transport_type ==IBV_TRANSPORT_IB ) + evt->event.status =ucma_query_gid (&evt->id_priv->id); + }else { + evt->event.status =ucma_query_route (&evt->id_priv->id); + } + +if (evt->event.status) + evt->event.event =RDMA_CM_EVENT_ADDR_ERROR ; +} + +static void ucma_process_route_resolved (struct cma_event *evt) +{ +if (evt->id_priv->id.verbs->device->transport_type !=IBV_TRANSPORT_IB ) +return ; + +if (af_ib_support) + evt->event.status =ucma_query_path (&evt->id_priv->id); +else + evt->event.status =ucma_query_route (&evt->id_priv->id); + +if (evt->event.status) + evt->event.event =RDMA_CM_EVENT_ROUTE_ERROR ; +} + +static int ucma_query_req_info (struct rdma_cm_id *id) +{ +int ret; + +if (!af_ib_support) +return ucma_query_route (id); + + ret =ucma_query_addr (id); +if (ret) +return ret; + + ret =ucma_query_gid (id); +if (ret) +return ret; + + ret =ucma_query_path (id); +if (ret) +return ret; + +return 0 ; +} +static int ucma_process_conn_req (struct cma_event *evt,uint32_t handle) {@@ -1344,7 +1399,7 @@ static int ucma_process_conn_req(struct cma_event *evt, evt->event.id = &id_priv->id; id_priv->handle = handle; - ret =ucma_query_route (&id_priv->id); + ret =ucma_query_req_info (&id_priv->id);if (ret) {rdma_destroy_id (&id_priv->id); goto err;@@ -1473,14 +1528,10 @@ retry:switch (resp->event) {case RDMA_CM_EVENT_ADDR_RESOLVED : - evt->event.status =ucma_query_route (&evt->id_priv->id); -if (evt->event.status) - evt->event.event =RDMA_CM_EVENT_ADDR_ERROR ; +ucma_process_addr_resolved (evt);break ;case RDMA_CM_EVENT_ROUTE_RESOLVED : - evt->event.status =ucma_query_route (&evt->id_priv->id); -if (evt->event.status) - evt->event.event =RDMA_CM_EVENT_ROUTE_ERROR ; +ucma_process_route_resolved (evt);break ;case RDMA_CM_EVENT_CONNECT_REQUEST : evt->id_priv = (void *) (uintptr_t ) resp->uid; --
Quoted 4 lines
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 2 lines
You define global int
af_ib_support. It never gets set to non-zero. Was this debug code or does it get set somewhere else that I'm missing?
It doesn't get set until a later patch in the series, once all the needed infrastructure is in place.
- Sean
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 053733AA9B7B4EBFB94A54DEF34DC73A-Zpru7NauK7drdx17CPfAsdBPR1lH4CV8@public.gmane.org
Quoted 8 lines · Sean Hefty
Quoted 3 lines
You define global int
af_ib_support. It never gets set to non-zero. Was this debug code or does it get set somewhere else that I'm missing?It doesn't get set until a later patch in the series, once all the needed infrastructure is in place.
Ok I see it. It allows you to only enable this if the kernel CMA modules support it.
I reviewed the whole series, but only at a high level. There are LOTS of changes. :)
The query gid stuff looks ok to me though.
If you update the series with the iwarp gid changes, I'll review that too.
Thanks,
Steve.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html