[openib-general] [PATCH 2/3] RDMA CM: allowing userspace querying for IP information before a device is known
Sean Hefty
sean.hefty at intel.com
Thu Mar 30 18:05:05 PST 2006
Currently, the userspace library cannot query for address/routing information
unless the underlying cm_id has been bound to a device. This functionality
is needed in order to obtain address/port information after binding, but before
a local device has been assigned.
Signed-off-by: Sean Hefty <sean.hefty at intel.com>
---
Index: ucma.c
===================================================================
--- ucma.c (revision 6063)
+++ ucma.c (working copy)
@@ -465,11 +465,7 @@ static ssize_t ucma_query_route(struct u
if (IS_ERR(ctx))
return PTR_ERR(ctx);
- if (!ctx->cm_id->device) {
- ret = -ENODEV;
- goto out;
- }
-
+ memset(&resp, 0, sizeof resp);
addr = &ctx->cm_id->route.addr.src_addr;
memcpy(&resp.src_addr, addr, addr->sa_family == AF_INET ?
sizeof(struct sockaddr_in) :
@@ -478,6 +474,9 @@ static ssize_t ucma_query_route(struct u
memcpy(&resp.dst_addr, addr, addr->sa_family == AF_INET ?
sizeof(struct sockaddr_in) :
sizeof(struct sockaddr_in6));
+ if (!ctx->cm_id->device)
+ goto out;
+
resp.node_guid = ctx->cm_id->device->node_guid;
resp.port_num = ctx->cm_id->port_num;
switch (rdma_node_get_transport(ctx->cm_id->device->node_type)) {
@@ -487,11 +486,11 @@ static ssize_t ucma_query_route(struct u
break;
}
+out:
if (copy_to_user((void __user *)(unsigned long)cmd.response,
&resp, sizeof(resp)))
ret = -EFAULT;
-out:
ucma_put_ctx(ctx);
return ret;
}
More information about the general
mailing list