NVIDIA Accelerated IO (XLIO) Documentation Rev 3.40.2

XLIO Run

In this page we show how to run a simple network benchmarking test and compare the running results using the kernel’s network stack and that of XLIO.

Before running a user application, you must set the library libxlio.so into the environment variable LD_PRELOAD.

Note

If LD_PRELOAD is assigned with libxlio.so without a path, then libxlio.so is read from a known library path under your distributions’ OS. Otherwise, it is read from the specified path.

As a result, an XLIO header message should precede your running application.

Copy
Copied!
            

XLIO INFO : --------------------------------------------------------------------------- XLIO INFO : XLIO_VERSION: X.Y.Z-R Release built on MM DD YYYY HH:mm:ss XLIO INFO : Cmd Line: sockperf server -i 11.4.3.3 XLIO INFO : OFED Version: MLNX_OFED_LINUX-X.X-X.X.X.X: XLIO INFO : --------------------------------------------------------------------------- XLIO INFO : Log Level INFO [XLIO_TRACELEVEL] XLIO INFO : ---------------------------------------------------------------------------

Followed by the application output, please note that:

  • The XLIO version is shown

  • The command line indicates your application’s name (in the above example: sockperf)

The appearance of the XLIO header indicates that the XLIO library is loaded with your application.

For examples on how to run XLIO, see Using sockperf with XLIO section.

  • Check that ld is able to find the libxlio library:

    Copy
    Copied!
                

    ld -lxlio –verbose

  • Set the UID bit to enforce user ownership:

    • RHEL:

      Copy
      Copied!
                  

      sudo chmod u+s /usr/lib64/libxlio* sudo chmod u+s /sbin/sysctl

    • Ubuntu:

      Copy
      Copied!
                  

      sudo chmod u+s /usr/lib/libxlio* sudo chmod u+s /sbin/sysctl

  • Grant CAP_NET_RAW privileges to application:

    Copy
    Copied!
                

    sudo setcap cap_net_raw,cap_net_admin+ep  /usr/bin/sockperf

  • Launch the application as described in Using sockperf with XLIO section.

libxlio.so is limited to DEBUG log level. In case it is required to run XLIO with detailed logging higher than DEBUG level, use a library called libxlio-debug.so that comes with OFED installation.

Before running your application, set the library libxlio-debug.so into the environment variable LD_PRELOAD (instead of libxlio.so).

Example:

Copy
Copied!
            

$ LD_PRELOAD=libxlio-debug.so sockperf server -i 11.4.3.3

Note

libxlio-debug.so is located in the same library path as libxlio.so under your distribution’s OS.

For example, in RHEL8.x x86_64, the libxlio.so is located in /usr/lib64/libxlio-debug.so.

Note

If you need to compile XLIO with a log level higher than DEBUG run “configure” with the following parameter:

Copy
Copied!
            

./configure --enable-opt-log=none

XLIO can be loaded using Dynamically Loaded (DL) libraries. These libraries are not automatically loaded at program link time or start-up as with LD_PRELOAD. Instead, there is an API for opening a library, looking up symbols, handling errors, and closing the library.

The example below demonstrates how to load socket() function. Similarly, users should load all other network-related functions as declared in sock-redirect.h:

Copy
Copied!
            

#include <stdlib.h> #include <stdio.h> #include <dlfcn.h> #include <arpa/inet.h> #include <sys/socket.h>   typedef int (*socket_fptr_t) (int __domain, int __type, int __protocol);   int main(int argc, const char** argv) { void* lib_handle; socket_fptr_t xlio_socket; int fd;   lib_handle = dlopen("libxlio.so", RTLD_LAZY); if (!lib_handle) { printf("FAILED to load libxlio.so\n"); exit(1); }   xlio_socket = (socket_fptr_t)dlsym(lib_handle, "socket"); if (xlio_socket == NULL) { printf("FAILED to load socket()\n"); exit(1); }   fd = xlio_socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (fd < 0) { printf("FAILED open socket()\n"); exit(1); }   printf("socket creation succeeded fd = %d\n", fd); close(fd); dlclose(lib_handle); return 0; }

For more information, please refer to dlopen man page.

For a complete example that includes all the necessary functions, see sockperf’s xlio-redirect.h and xlio_socket-redirect.cpp files.

© Copyright 2025, NVIDIA. Last updated on Feb 24, 2025.