| 1 |
# Introduction |
| 2 |
|
| 3 |
libibverbs is a library that allows programs to use RDMA "verbs" for |
| 4 |
direct access to RDMA (currently InfiniBand and iWARP) hardware from |
| 5 |
userspace. For more information on RDMA verbs, see the InfiniBand |
| 6 |
Architecture Specification vol. 1, especially chapter 11, and the RDMA |
| 7 |
Consortium's RDMA Protocol Verbs Specification. |
| 8 |
|
| 9 |
# Using libibverbs |
| 10 |
|
| 11 |
### Device nodes |
| 12 |
|
| 13 |
The verbs library expects special character device files named |
| 14 |
/dev/infiniband/uverbsN to be created. When you load the kernel |
| 15 |
modules, including both the low-level driver for your IB hardware as |
| 16 |
well as the ib_uverbs module, you should see one or more uverbsN |
| 17 |
entries in /sys/class/infiniband_verbs in addition to the |
| 18 |
/dev/infiniband/uverbsN character device files. |
| 19 |
|
| 20 |
To create the appropriate character device files automatically with |
| 21 |
udev, a rule like |
| 22 |
|
| 23 |
KERNEL="uverbs*", NAME="infiniband/%k" |
| 24 |
|
| 25 |
can be used. This will create device nodes named |
| 26 |
|
| 27 |
/dev/infiniband/uverbs0 |
| 28 |
|
| 29 |
and so on. Since the RDMA userspace verbs should be safe for use by |
| 30 |
non-privileged users, you may want to add an appropriate MODE or GROUP |
| 31 |
to your udev rule. |
| 32 |
|
| 33 |
### Permissions |
| 34 |
|
| 35 |
To use IB verbs from userspace, a process must be able to access the |
| 36 |
appropriate /dev/infiniband/uverbsN special device file. You can |
| 37 |
check the permissions on this file with the command |
| 38 |
|
| 39 |
ls -l /dev/infiniband/uverbs* |
| 40 |
|
| 41 |
Make sure that the permissions on these files are such that the |
| 42 |
user/group that your verbs program runs as can access the device file. |
| 43 |
|
| 44 |
To use IB verbs from userspace, a process must also have permission to |
| 45 |
tell the kernel to lock sufficient memory for all of your registered |
| 46 |
memory regions as well as the memory used internally by IB resources |
| 47 |
such as queue pairs (QPs) and completion queues (CQs). To check your |
| 48 |
resource limits, use the command |
| 49 |
|
| 50 |
ulimit -l |
| 51 |
|
| 52 |
(or "limit memorylocked" for csh-like shells). |
| 53 |
|
| 54 |
If you see a small number such as 32 (the units are KB) then you will |
| 55 |
need to increase this limit. This is usually done for ordinary users |
| 56 |
via the file /etc/security/limits.conf. More configuration may be |
| 57 |
necessary if you are logging in via OpenSSH and your sshd is |
| 58 |
configured to use privilege separation. |
| 59 |
|
| 60 |
# Debugging |
| 61 |
|
| 62 |
### Enabling debug prints |
| 63 |
|
| 64 |
Library and providers debug prints can be enabled using the `VERBS_LOG_LEVEL` |
| 65 |
environment variable, the output shall be written to the file provided in the |
| 66 |
`VERBS_LOG_FILE` environment variable. When the library is compiled in debug |
| 67 |
mode and no file is provided the output will be written to stderr. |
| 68 |
|
| 69 |
Note: some of the debug prints are only available when the library is compiled |
| 70 |
in debug mode. |
| 71 |
|
| 72 |
The following table describes the expected behavior when VERBS_LOG_LEVEL is set: |
| 73 |
| | Release | Debug | |
| 74 |
|-----------------|---------------------------------|------------------------------------------------| |
| 75 |
| Regular prints | Output to VERBS_LOG_FILE if set | Output to VERBS_LOG_FILE, or stderr if not set | |
| 76 |
| Datapath prints | Compiled out, no output | Output to VERBS_LOG_FILE, or stderr if not set | |