1219820SjeffLIBSDP - A User Level Socket Switch for Seemless Migration to SDP 
2219820Sjeff-----------------------------------------------------------------
3219820Sjeff
4219820SjeffOVERVIEW:
5219820Sjeff---------
6219820Sjefflibsdp is a LD_PRELOAD-able library that can be used to migrate existing
7219820Sjeffapplications use InfiniBand Sockets Direct Protocol (SDP) instead of
8219820SjeffTCP sockets, transparently and without recompilations. To setup libsdp
9219820Sjeffplease follow the instructions below.
10219820Sjeff
11219820SjeffSETUP:
12219820Sjeff------
13219820Sjefflibsdp.so isn't setup automatically. it can be used in one of 2 ways:
14219820Sjeff1) LD_PRELOAD environment variable. Setting this to the name of the
15219820Sjeff   library you want to use will cause it to be preloaded.
16219820Sjeff2) Adding the name of the library into /etc/ld.so.preload. This will
17219820Sjeff   cause the library to be preloaded for every executable that is linked
18219820Sjeff   with libc.
19219820Sjeff
20219820SjeffThe library should be installed in a directory in which the dynamic loader
21219820Sjeffsearches for shared libraries (as specified by LD_LIBRARY_PATH,
22219820Sjeff/etc/ld.so.conf, etc). Alternatively, you can specify the full path to the 
23219820Sjefflibrary that you want to use in LD_PRELOAD or /etc/ld.so.preload as described 
24219820Sjeffabove.
25219820Sjeff
26219820SjeffThe last option cant be used if you have multiple library versions
27219820Sjeff(e.g. 64/32 bit) and want the linker to select between them automatically.
28219820SjeffThe best way to handle such case is to use LD_LIBRARY_PATH to point to both the
29219820Sjefflib (the 32 bit version) and lib64 directories and LD_RELOAD the libsdp.so.
30219820SjeffThis way the correct 32/64bit libsdp.so will be selected. 
31219820SjeffFor example running ssh over SDP with OFED distribution from bash this can be written:
32219820SjeffLD_LIBRARY_PATH=/usr/local/ofed/lib64:/usr/local/ofed/lib LD_PRELOAD=libsdp.so ssh
33219820Sjeff
34219820SjeffCONFIGURATION:
35219820Sjeff--------------
36219820Sjefflibsdp supports two modes of configuration:
37219820Sjeff* simple operation where it converts all calls to socket(2) with a family
38219820Sjeff  of AF_INET(6) and a type of SOCK_STREAM into family of AF_INET_SDP. 
39219820Sjeff* selective mode where it uses a configuration file to select which sockets
40219820Sjeff  will be using SDP and which will not.
41219820Sjeff
42219820SjeffFor real world applications where communication with X, authentication, 
43219820SjeffDNS and other servers connected through TCP is required the selective mode
44219820Sjeffis required.
45219820Sjeff
46219820SjeffSimple mode will be selected in one of the following conditions:
47219820Sjeff* the environment variable SIMPLE_LIBSDP to a non-empty value
48219820Sjeff* no configuration file is defined or is un-readble
49219820Sjeff* the configuration file does not include any address family rule
50219820Sjeff
51219820SjeffFor information on how to configure libsdp, see libsdp.conf, which is installed
52219820Sjeffin $(sysconfdir) (usually /usr/local/etc or /etc). The user can further control
53219820Sjeffthe file to be used for configuration by setting the environment variable:
54219820SjeffLIBSDP_CONFIG_FILE
55219820Sjeff
56219820SjeffLIMITATIONS:
57219820Sjeff------------
58219820Sjeff1. Applications statically linked with libc will not allow dynamic pre-loading
59219820Sjeff   to port these applications to use SDP one needs to replace specific socket 
60219820Sjeff   calls (within the application) with AF_INET_SDP and recompile.
61219820Sjeff2. If for some reason the dynamic linker fail to pre-load libc before the 
62219820Sjeff   libsdp.so is initialized or it does not support RTDL_NEXT, libsdp will 
63219820Sjeff   fail to find the libc socket API. To overcome this situation a simple 
64219820Sjeff   implementation of hijacking "socket" call is provided in libsdp_sys.
65219820Sjeff   This partial implementation does not support any configuration and is 
66219820Sjeff   limited to i386 architecture.
67219820Sjeff3. Non-blocking connect in "both" mode defaults to SDP. Specific rules might be
68219820Sjeff   needed for applications to operate properly.
69