summaryrefslogtreecommitdiffstats
path: root/kiro-rdma.h
diff options
context:
space:
mode:
authorTimo Dritschler <timo.dritschler@kit.edu>2014-05-09 18:20:11 +0200
committerTimo Dritschler <timo.dritschler@kit.edu>2014-05-09 18:20:11 +0200
commitb39079922bb4288dee30dfcb89a0fa0d20e81632 (patch)
treebb9dd4bc6ec302ce696661b7066ac825866cc43c /kiro-rdma.h
parent18ae33837ee1451dddf265198b51ef3483e2029b (diff)
downloadkiro-b39079922bb4288dee30dfcb89a0fa0d20e81632.tar.gz
kiro-b39079922bb4288dee30dfcb89a0fa0d20e81632.tar.bz2
kiro-b39079922bb4288dee30dfcb89a0fa0d20e81632.tar.xz
kiro-b39079922bb4288dee30dfcb89a0fa0d20e81632.zip
Restructured kiro-server implementation to make it a bit more modular
Added interface to kiro-client to access the memory allocated for communication Added new 'kiro_destroy_connection' to kiro-rdma package Changed interface of 'kiro_destroy_connection_context' and updated server and client accordingly Started to implement a more visual testing routine in test-server Made test-client use commandline arguments for address and port Updated Makefile
Diffstat (limited to 'kiro-rdma.h')
-rw-r--r--kiro-rdma.h50
1 files changed, 41 insertions, 9 deletions
diff --git a/kiro-rdma.h b/kiro-rdma.h
index 25040c8..696c880 100644
--- a/kiro-rdma.h
+++ b/kiro-rdma.h
@@ -156,20 +156,52 @@ static void kiro_destroy_rdma_memory (struct kiro_rdma_mem *krm)
}
-static void kiro_destroy_connection_context (struct kiro_connection_context *ctx)
+static void kiro_destroy_connection_context (struct kiro_connection_context **ctx)
{
if(!ctx)
return;
+
+ if(!(*ctx))
+ return;
+
+ if((*ctx)->cf_mr_recv)
+ kiro_destroy_rdma_memory((*ctx)->cf_mr_recv);
+ if((*ctx)->cf_mr_send)
+ kiro_destroy_rdma_memory((*ctx)->cf_mr_send);
+
+ //The RDMA-Memory Region normally contains allocated memory from the USER that has
+ //just been 'registered' for RDMA. DON'T free it! Just deregister it. The user is
+ //responsible for freeing this memory.
+ if((*ctx)->rdma_mr)
+ {
+ if((*ctx)->rdma_mr->mr)
+ ibv_dereg_mr((*ctx)->rdma_mr->mr);
+
+ free((*ctx)->rdma_mr);
+ (*ctx)->rdma_mr = NULL;
+ }
+
+ free(*ctx);
+ *ctx = NULL;
+}
+
+
+static void kiro_destroy_connection (struct kiro_connection **conn)
+{
+ if(!(*conn))
+ return;
+
+ if(!(*conn)->id)
+ return;
- if(ctx->cf_mr_recv)
- kiro_destroy_rdma_memory(ctx->cf_mr_recv);
- if(ctx->cf_mr_send)
- kiro_destroy_rdma_memory(ctx->cf_mr_send);
- if(ctx->rdma_mr)
- kiro_destroy_rdma_memory(ctx->rdma_mr);
+ rdma_disconnect((*conn)->id);
+ struct kiro_connection_context *ctx = (struct kiro_connection_context *)((*conn)->id->context);
+ if(ctx)
+ kiro_destroy_connection_context(&ctx);
- free(ctx);
- ctx = NULL;
+ rdma_destroy_ep((*conn)->id);
+ free(*conn);
+ *conn = NULL;
}