]> git.openfabrics.org - ~shefty/librdmacm.git/commitdiff
rsockets: Add support for existing UDP apps
authorSean Hefty <sean.hefty@intel.com>
Wed, 9 Jan 2013 22:54:47 +0000 (14:54 -0800)
committerSean Hefty <sean.hefty@intel.com>
Wed, 9 Jan 2013 22:54:47 +0000 (14:54 -0800)
Support for existing UDP applications is done via the rspreload
library.  However, when the preload library is loaded, socket
calls used by rsockets get intercepted and converted into
rsocket calls.

The preload library was able to handle this for TCP rsockets
by using a per thread variable and checking for recursive calls
coming from rsockets back into the preload library.  The preload
library would direct such calls to the real socket calls.

The problem is more complex for UDP rsockets, which can invoke
socket calls from an internal rsocket thread.  The result is that
the preload library intercepts socket calls that originate from
the rsocket library which are not recursive.

Although, this is really a problem with the preload library,
the simplest solution is for rsockets to fully initialize the
library when allocating the first rsocket, versus deferring
initialization until required.  The preload library can then
detect the recursive calls.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
src/cma.h
src/rsocket.c

index 7135a612467aae848e6d627be9dc89ec326eab44..bdd6a8586b3282114eb18e50859a19cdd4d9a2c3 100644 (file)
--- a/src/cma.h
+++ b/src/cma.h
@@ -158,6 +158,7 @@ static inline int ERR(int err)
 }
 
 int ucma_init();
+void ucma_ib_init();
 extern int af_ib_support;
 
 #define RAI_ROUTEONLY          0x01000000
index 7be42cabdb5fd0f7a34a66d44077bae780eaf395..9b6c6673aa945e0c1e057f7239df16b14a3d48e3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008-2012 Intel Corporation.  All rights reserved.
+ * Copyright (c) 2008-2013 Intel Corporation.  All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -452,6 +452,10 @@ void rs_configure(void)
        if (init)
                goto out;
 
+       if (ucma_init())
+               goto out;
+       ucma_ib_init();
+
        if ((f = fopen(RS_CONF_DIR "/polling_time", "r"))) {
                (void) fscanf(f, "%u", &polling_time);
                fclose(f);