[openib-general] [PATCH] kDAPL CM: Handle async destruction during address translation phase of connect
Hal Rosenstock
halr at voltaire.com
Sat Jul 16 06:11:50 PDT 2005
Handle async destruction during address translation phase of connect.
Also, fix an error path in dapl_ib_connect.
Minor changes to dapl_ib_cm_remote_addr in preparation for ATS support
for reverse translation (remote GID -> IP address)
Signed-off-by: Hal Rosenstock <halr at voltaire.com>
Index: dapl_openib_cm.c
===================================================================
--- dapl_openib_cm.c (revision 2866)
+++ dapl_openib_cm.c (working copy)
@@ -318,6 +318,11 @@ static void dapl_path_comp_handler(u64 r
int status;
enum dat_event_number event;
+ if (cm_ctx->destroy) {
+ kfree(cm_ctx);
+ return;
+ }
+
if (rec_num <= 0) {
printk(KERN_ERR "dapl_path_comp_handler: path resolution "
"failed %d retry %d!!!\n", rec_num, cm_ctx->retries + 1);
@@ -347,6 +352,7 @@ static void dapl_path_comp_handler(u64 r
cm_ctx->param.primary_path = &cm_ctx->dapl_path;
cm_ctx->param.alternate_path = NULL;
+ cm_ctx->in_callback = 0;
status = ib_send_cm_req(cm_ctx->cm_id, &cm_ctx->param);
if (status) {
@@ -367,6 +373,11 @@ static void dapl_rt_comp_handler(u64 req
int status;
enum dat_event_number event;
+ if (cm_ctx->destroy) {
+ kfree(cm_ctx);
+ return;
+ }
+
if (rec_num <= 0) {
printk(KERN_ERR "dapl_rt_comp_handler: rec num %d retry %d\n",
rec_num, cm_ctx->retries + 1);
@@ -484,6 +495,7 @@ int dapl_ib_connect(struct dapl_ep *ep,
cm_ctx->dapl_comp.fn = &dapl_rt_comp_handler;
cm_ctx->dapl_comp.context = cm_ctx;
cm_ctx->retries = 0;
+ cm_ctx->in_callback = 1;
status =
ib_at_route_by_ip(((struct sockaddr_in *)remote_ia_address)->
sin_addr.s_addr, 0, 0, 0, &cm_ctx->dapl_rt,
@@ -491,7 +503,7 @@ int dapl_ib_connect(struct dapl_ep *ep,
if (status < 0) {
dapl_dbg_log(DAPL_DBG_TYPE_ERR, " ib_at_route_by_ip failed "
"with status %d\n", status);
- dapl_destroy_cm_id(cm_ctx); /* ??? */
+ kfree(cm_ctx);
return -EAGAIN;
}
@@ -834,29 +846,28 @@ reject:
return status;
}
-/*
- * ib_cm_get_remote_gid
- */
-static int ib_cm_get_remote_gid(struct dapl_cm_ctx *cm_ctx, u8 *remote_gid)
+static int ib_cm_get_remote_gid(struct dapl_cm_ctx *cm_ctx,
+ union ib_gid *remote_gid)
{
return -ENOSYS; /* for now!!! */
}
+/*
+ * Get IP address corresponding to remote GID
+ */
int dapl_ib_cm_remote_addr(struct dapl_ia *ia, struct dapl_cm_ctx *cm_ctx,
struct sockaddr_in6 *remote_ia_address)
{
- int rc;
+ int status;
union ib_gid remote_gid;
- rc = ib_cm_get_remote_gid(cm_ctx, (u8 *) &remote_gid);
- if (rc < 0)
- return rc;
+ status = ib_cm_get_remote_gid(cm_ctx, &remote_gid);
+ if (status < 0)
+ return status;
- if (!memcmp(&ia->hca->gid, &remote_gid, 16)) {
+ if (!memcmp(&ia->hca->gid, &remote_gid, sizeof ia->hca->gid))
memcpy(remote_ia_address, &ia->hca->hca_address,
sizeof *remote_ia_address);
- return 0;
- }
return 0;
}
More information about the general
mailing list