You can control the behavior of VMA by configuring:
- The libvma.conf file
- VMA configuration parameters, which are Linux OS environment variables
- VMA extra API
The installation process creates a default configuration file, /etc/libvma.conf, in which you can define and change the following settings:
- The target applications or processes to which the configured control settings apply. By default, VMA control settings apply to all applications.
- The transport protocol to be used for the created sockets.
- The IP addresses and ports in which you want to offload.
By default, the configuration file allows VMA to offload everything except for the DNS server-side protocol (UDP, port 53) which will be handled by the OS.
In the libvma.conf file:
- You can define different VMA control statements for different processes in a single configuration file. Control statements are always applied to the preceding target process statement in the configuration file.
- Comments start with # and cause the entire line after it to be ignored.
- Any beginning whitespace is skipped.
- Any line that is empty is skipped.
- It is recommended to add comments when making configuration changes.
The following sections describe configuration options in libvma.conf. For a sample libvma.conf file, see Example of VMA Configuration.
Configuring Target Application or Process
The target process statement specifies the process to which all control statements that appear between this statement and the next target process statement apply.
Each statement specifies a matching rule that all its sub-expressions must evaluate as true (logical and) to apply.
If not provided (default), the statement matches all programs.
The format of the target process statement is:
Define the program name (not including the path) to which the control statements appearing below this statement apply.
Specify the process ID to which the control statements appearing below this statement apply.
You must also set the VMA_APPLICATION_ID environment variable to the same value as user-defined-id.
Configuring Socket Transport Control
Use socket control statements to specify when libvma will offload AF_INET/SOCK_STREAM or AF_INET/SOCK_DATAGRAM sockets (currently SOCK_RAW is not supported).
Each control statement specifies a matching rule that all its sub-expressions must evaluate as true (logical and) to apply. Statements are evaluated in order of definition according to "first-match".
Socket control statements use the following format:
Define the mode of transport:
The default is vma.
Specify one of the following roles:
You can specify the local address the server is bind to or the remote server address the client connects to.
The syntax for address matching is:
Define the port range as:
Port range: 0-65536
Example of VMA Configuration
To set the following:
- Apply the rules to program tcp_lat with ID B1
- Use VMA by TCP clients connecting to machines that belong to subnet 192.168.1.*
- Use OS when TCP server listens to port 5001 of any machine
In libvma.conf, configure:
You must also set the VMA parameter:
VMA Configuration Parameters
VMA configuration parameters are Linux OS environment variables that are controlled with system environment variables.
It is recommended that you set these parameters prior to loading the application with VMA. You can set the parameters in a system file, which can be run manually or automatically.
All the parameters have defaults that can be modified.
On default startup, the VMA library prints the VMA version information, as well as the configuration parameters being used and their values to stderr.
VMA always logs the values of the following parameters, even when they are equal to the default value:
For all other parameters, VMA logs the parameter values only when they are not equal to the default value.
The VMA version information, parameters, and values are subject to change.
Configuration Parameters Values
The following table lists the VMA configuration parameters and their possible values.
|VMA Configuration Parameter||Description and Examples|
PANIC = 0 – Panic level logging.
ERROR = 1 – Runtime errors in VMA.
WARN = WARNING = 2– Runtime warning that does not disrupt the application workflow.
INFO = INFORMATION = 3– General information passed to the user of the application.
DETAILS – Greater general information passed to the user of the application.
DEBUG = 4 – High-level insight to the operations performed in VMA.
FINE = FUNC = 5 – Low-level runtime logging of activity.
FINER = FUNC_ALL = 6 – Very low-level runtime logging of activity. This logging level drastically lowers application performance. We recommend that you use this level with the VMA_LOG_FILE parameter.
Provides additional logging details on each log line.
Redirects all VMA logging to a specific user-defined file.
Sets the full path to the VMA configuration file.
Uses a color scheme when logging; red for errors and warnings, and dim for very low level debugs.
Calculates the VMA CPU usage during polling hardware loops. This information is available through VMA stats utility.
Specifies a group of rules from libvma.conf for VMA to apply.
When enabled, the VMA handler is called when an interrupt signal is sent to the process.
When enabled, a print backtrace is performed, if a segmentation fault occurs.
Maximum number of sockets monitored by the VMA statistics mechanism.
Redirects socket statistics to a specific user-defined file.
Sets the directory path for VMA to create the shared memory files for vma_stats.
Sets the directory path for VMA to write files used by vmad.
Limits the number of TCP SYN packets that VMA handles per second for each listen socket.
Number of TCP LWIP segments allocation for each VMA process.
Number of global Tx data buffer elements allocation.
Number of Work Request Elements allocated in all transmit QP's. The number of QP's can change according to the number of network offloaded interfaces.
Controls the number of aggregated Work Requests Elements before receiving a completion signal (CQ entry) from the hardware. Previously this number was hard coded as 64.
Max send inline data set for QP.
Sets the initial value used internally by the VMA to control multicast loopback packet behavior during transmission. An application that calls setsockopt() with IP_MULTICAST_LOOP overwrites the initial value set by this parameter.
Returns value 'OK' on all send operations that are performed on a non-blocked udp socket. This is the OS default behavior. The datagram sent is silently dropped inside the VMA or the network stack.
Accelerates an offloaded send operation by optimizing the cache. Different values give an optimized send rate on different machines. We recommend that you adjust this parameter to your specific hardware.
The number of Rx data buffer elements allocated for the processes. These data buffers are used by all QPs on all HCAs, as determined by the VMA_QP_LOGIC.
The number of Work Request Elements allocated in all received QPs.
Number of Work Request Elements and RX buffers to batch before recycling.
The minimum value in bytes used per socket by the VMA when applications call to setsockopt(SO_RCVBUF).
The number of times to unsuccessfully poll an Rx for VMA packets before going to sleep.
Once the VMA has gone to sleep, if it is in blocked mode, it waits for an interrupt; if it is in non-blocked mode, it returns -1.
VMA maps all UDP sockets as potential Offloaded-capable. Only after ADD_MEMBERSHIP is set, the offload starts working and the CQ polling starts VMA.
Defines the ratio between VMA CQ poll and OS FD poll.
Disable with 0
Defines timestamp conversion method.
Currently only UDP RX flow is supported.
Default value: 3 (Sync to system time)
When an application is running with multiple threads on a limited number of cores, there is a need for each thread polling inside VMA (read, readv, recv, and recvfrom) to yield the CPU to another polling thread so as not to starve them from processing incoming packets.
The size of the receive buffer to prefetch into the cache while processing ingress packets.
Socket's receive path CQ drain logic rate control.
Enables TCP RX polling during TXP TX operation for faster TCP ACK reception
Controls the number of TCP streams to perform GRO (generic receive offload) simultaneously.
Uses only 3 tuple rules for TCP, instead of using 5 tuple rules.
|This parameter is relevant in case the application uses connected UDP sockets. 3 tuple rules are used in hardware flow steering rule when the parameter is enabled, and in 5 tuple flow steering rule when it is disabled. Enabling this option can reduce hardware flow steering resources. However, when it is disabled, the application might see benefits in latency and cycles per packet. Default: 1 (Enable)|
Uses only L2 rules for Ethernet Multicast.
The duration in micro-seconds (usec) in which to poll the hardware on Rx path before blocking for an interrupt (when waiting and also when calling select(), poll(), or epoll_wait()).
This enables polling the OS file descriptors while the user thread calls select(), poll(), or epoll_wait(), and VMA is busy in the offloaded socket polling loop. This results in a single poll of the non-offloaded sockets every VMA_SELECT_POLL_RATIO offloaded socket (CQ) polls.
In select(), poll(), or epoll_wait()forces the VMA to check the non-offloaded sockets even though an offloaded socket has a ready packet that was found while polling.
The maximum size of the array while polling the CQs in the VMA.
Internal VMA thread safety which checks that the CQ is drained at least once every N milliseconds. This mechanism allows VMA to progress the TCP stack even when the application does not access its socket (so it does not provide a context to VMA). If the CQ was already drained by the application receive socket API calls, this thread goes back to sleep without any processing.
Each time the VMA's internal thread starts its CQ draining, it stops when it reaches this maximum value.
Enable CQ interrupt moderation.
Number of packets to hold before generating interrupt.
Period in microseconds for holding the packet before generating interrupt.
Maximum count value to use in the adaptive interrupt moderation algorithm.
Maximum period value to use in the adaptive interrupt moderation algorithm.
Frequency of interrupt moderation adaptation.
Desired interrupts rate per second for each ring (CQ).
If disabled (default), the CQ does not try to compensate for each poll on the receive path. It uses a "debt" to remember how many WRE are missing from each QP, so that it can fill it when buffers become available.
The number of spare receive buffer CQ holds that can be allowed for filling up QP while full receive buffers are being processed inside VMA.
Creates all sockets as offloaded/not-offloaded by default.
Default: 1 (Enabled)
Control VMA internal thread wakeup timer resolution (in milliseconds).
Controls VMA internal TCP timer resolution (fast timer) (in milliseconds). Minimum value is the internal thread wakeup timer resolution (VMA_TIMER_RESOLUTION_MSEC).
Does all TCP control flows in the internal thread.
Default: 0 (disabled)
Currently, LWIP is not supporting RTTM and PAWS mechanisms.
Default: 0 (disabled)
If set, it disables the Nagle algorithm option for each TCP socket during initialization. Meaning that TCP segments are always sent as soon as possible, even if there is only a small amount of data.
If set, it disables the delayed acknowledge ability. Meaning that TCP will respond after every packet.
Handles missing support or error cases in Socket API or functionality by VMA.
For TCP fd, avoid system calls for the supported options of: ioctl, fcntl, getsockopt, setsockopt.
By default VMA is ready for multi-threaded applications, meaning it is thread-safe.
Default: 1 (Multi with spin lock)
Enables batching of returning Rx buffers and pulling Tx buffers per socket.
This replaces the VMA_HUGETBL parameter logic.
OFED will also try to allocate QP & CQ memory accordingly:
To override OFED use: (MLX_QP_ALLOC_TYPE, MLX_CQ_ALLOC_TYPE).
Controls VMA fork support. Setting this flag on will cause VMA to call ibv_fork_init() function. ibv_fork_init() initializes libibverbs's data structures to handle fork() function calls correctly and avoid data corruption.
Size of each Rx and Tx data buffer (Maximum Transfer Unit).
Default: 0 (following interface actual MTU)
Defines the max TCP payload size that can be sent without IP fragmentation.
When this parameter is enabled, VMA handles the duplicated file descriptor (oldfd), as if it is closed (clear internal data structures) and only then forwards the call to the OS.
Controls which CPU core(s) the VMA internal thread is serviced on. The CPU set should be provided as either a hexadecimal value that represents a bitmask or as a comma delimited of values (ranges are ok). Both the bitmask and comma delimited list methods are identical to what is supported by the taskset command. See the man page on taskset for additional information.
The -1 value disables the Internal Thread Affinity setting by VMA.
0x00000001 – Run on processor 0
Comma delimited examples:
0,4,8 – Run on processors 0,4, and 8
Selects a CPUSET for VMA internal thread (For further information, see man page of cpuset).
Wakes up the internal thread for each packet that the CQ receives.
Selects the internal thread policy when handling TCP timers.
This parameter indicates the time of delay the first packet is send after receiving the multicast JOINED event from the SM.
VMA will send UC ARP in case neigh state is NUD_STALE.
This parameter indicates number of msec to wait between every UC ARP.
Indicates number of retries to restart NEIGH state machine if NEIGH receives ERROR event.
Enables/disables BlueFlame usage of the card.
When this parameter is enabled, VMA operates in SocketXtreme mode. SocketXtreme mode brings down latency, eliminating copy operations and increasing throughput, thus allowing applications to further utilize true kernel bypass architecture.
Default: 0 (Disabled)
This parameter triggers dummy packet sent from getsockname() to warm up the caches.
VMA_SPEC sets all the required configuration parameters of VMA. Usually, no additional configuration is required.
VMA predefined specification profile for latency:
Beta Level Features Configuration Parameters
The following table lists configuration parameters and their possible values for new VMA Beta level features. The parameters below are disabled by default.
These VMA features are still experimental and subject to changes. They can help improve performance of multithread applications.
We recommend altering these parameters in a controlled environment until reaching the best performance tuning.
|VMA Configuration Parameter||Description and Examples|
Ring allocation logic is used to separate the traffic into different rings.
The logic options are:
This feature might decrease performance for applications which their main processing loop is based on select() and/or poll().
Ring migration ratio is used with the "ring per thread" logic in order to decide when it is beneficial to replace the socket's ring with the ring allocated for the current thread.
Limits the number of rings that can be allocated per interface.
VMA_RX_BUFS might need to be adjusted in order to have enough buffers for all rings in the system. Each ring consumes VMA_RX_WRE buffers.
Use a value of 0 for an unlimited number of rings.
VMA can use the on-device-memory to store the egress packet if it does not fit into the BF inline buffer. This improves application egress latency by reducing the PCI transactions.
TCP congestion control algorithm.
Loading VMA Dynamically
VMA 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:
For more information, please refer to dlopen man page.