mlx: fix typos and inaccuracies in docs
[dpdk.git] / doc / guides / nics / mlx4.rst
1 ..  BSD LICENSE
2     Copyright 2012-2015 6WIND S.A.
3
4     Redistribution and use in source and binary forms, with or without
5     modification, are permitted provided that the following conditions
6     are met:
7
8     * Redistributions of source code must retain the above copyright
9     notice, this list of conditions and the following disclaimer.
10     * Redistributions in binary form must reproduce the above copyright
11     notice, this list of conditions and the following disclaimer in
12     the documentation and/or other materials provided with the
13     distribution.
14     * Neither the name of 6WIND S.A. nor the names of its
15     contributors may be used to endorse or promote products derived
16     from this software without specific prior written permission.
17
18     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21     A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22     OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24     LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26     THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28     OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
30 MLX4 poll mode driver library
31 =============================
32
33 The MLX4 poll mode driver library (**librte_pmd_mlx4**) implements support
34 for **Mellanox ConnectX-3** and **Mellanox ConnectX-3 Pro** 10/40 Gbps adapters
35 as well as their virtual functions (VF) in SR-IOV context.
36
37 Information and documentation about this family of adapters can be found on
38 the `Mellanox website <http://www.mellanox.com>`_. Help is also provided by
39 the `Mellanox community <http://community.mellanox.com/welcome>`_.
40
41 There is also a `section dedicated to this poll mode driver
42 <http://www.mellanox.com/page/products_dyn?product_family=209&mtag=pmd_for_dpdk>`_.
43
44 .. note::
45
46    Due to external dependencies, this driver is disabled by default. It must
47    be enabled manually by setting ``CONFIG_RTE_LIBRTE_MLX4_PMD=y`` and
48    recompiling DPDK.
49
50 .. warning::
51
52    ``CONFIG_RTE_BUILD_COMBINE_LIBS`` with ``CONFIG_RTE_BUILD_SHARED_LIB``
53    is not supported and thus the compilation will fail with this configuration.
54
55 Implementation details
56 ----------------------
57
58 Most Mellanox ConnectX-3 devices provide two ports but expose a single PCI
59 bus address, thus unlike most drivers, librte_pmd_mlx4 registers itself as a
60 PCI driver that allocates one Ethernet device per detected port.
61
62 For this reason, one cannot white/blacklist a single port without also
63 white/blacklisting the others on the same device.
64
65 Besides its dependency on libibverbs (that implies libmlx4 and associated
66 kernel support), librte_pmd_mlx4 relies heavily on system calls for control
67 operations such as querying/updating the MTU and flow control parameters.
68
69 For security reasons and robustness, this driver only deals with virtual
70 memory addresses. The way resources allocations are handled by the kernel
71 combined with hardware specifications that allow it to handle virtual memory
72 addresses directly ensure that DPDK applications cannot access random
73 physical memory (or memory that does not belong to the current process).
74
75 This capability allows the PMD to coexist with kernel network interfaces
76 which remain functional, although they stop receiving unicast packets as
77 long as they share the same MAC address.
78
79 Compiling librte_pmd_mlx4 causes DPDK to be linked against libibverbs.
80
81 Features
82 --------
83
84 - RSS, also known as RCA, is supported. In this mode the number of
85   configured RX queues must be a power of two.
86 - VLAN filtering is supported.
87 - Link state information is provided.
88 - Promiscuous mode is supported.
89 - All multicast mode is supported.
90 - Multiple MAC addresses (unicast, multicast) can be configured.
91 - Scattered packets are supported for TX and RX.
92 - Inner L3/L4 (IP, TCP and UDP) TX/RX checksum offloading and validation.
93 - Outer L3 (IP) TX/RX checksum offloading and validation for VXLAN frames.
94 - Secondary process TX is supported.
95
96 Limitations
97 -----------
98
99 - RSS hash key cannot be modified.
100 - RSS RETA cannot be configured
101 - RSS always includes L3 (IPv4/IPv6) and L4 (UDP/TCP). They cannot be
102   dissociated.
103 - Hardware counters are not implemented (they are software counters).
104 - Secondary process RX is not supported.
105
106 Configuration
107 -------------
108
109 Compilation options
110 ~~~~~~~~~~~~~~~~~~~
111
112 These options can be modified in the ``.config`` file.
113
114 - ``CONFIG_RTE_LIBRTE_MLX4_PMD`` (default **n**)
115
116   Toggle compilation of librte_pmd_mlx4 itself.
117
118 - ``CONFIG_RTE_LIBRTE_MLX4_DEBUG`` (default **n**)
119
120   Toggle debugging code and stricter compilation flags. Enabling this option
121   adds additional run-time checks and debugging messages at the cost of
122   lower performance.
123
124 - ``CONFIG_RTE_LIBRTE_MLX4_SGE_WR_N`` (default **4**)
125
126   Number of scatter/gather elements (SGEs) per work request (WR). Lowering
127   this number improves performance but also limits the ability to receive
128   scattered packets (packets that do not fit a single mbuf). The default
129   value is a safe tradeoff.
130
131 - ``CONFIG_RTE_LIBRTE_MLX4_MAX_INLINE`` (default **0**)
132
133   Amount of data to be inlined during TX operations. Improves latency but
134   lowers throughput.
135
136 - ``CONFIG_RTE_LIBRTE_MLX4_TX_MP_CACHE`` (default **8**)
137
138   Maximum number of cached memory pools (MPs) per TX queue. Each MP from
139   which buffers are to be transmitted must be associated to memory regions
140   (MRs). This is a slow operation that must be cached.
141
142   This value is always 1 for RX queues since they use a single MP.
143
144 - ``CONFIG_RTE_LIBRTE_MLX4_SOFT_COUNTERS`` (default **1**)
145
146   Toggle software counters. No counters are available if this option is
147   disabled since hardware counters are not supported.
148
149 Environment variables
150 ~~~~~~~~~~~~~~~~~~~~~
151
152 - ``MLX4_INLINE_RECV_SIZE``
153
154   A nonzero value enables inline receive for packets up to that size. May
155   significantly improve performance in some cases but lower it in
156   others. Requires careful testing.
157
158 Run-time configuration
159 ~~~~~~~~~~~~~~~~~~~~~~
160
161 - The only constraint when RSS mode is requested is to make sure the number
162   of RX queues is a power of two. This is a hardware requirement.
163
164 - librte_pmd_mlx4 brings kernel network interfaces up during initialization
165   because it is affected by their state. Forcing them down prevents packets
166   reception.
167
168 - **ethtool** operations on related kernel interfaces also affect the PMD.
169
170 Kernel module parameters
171 ~~~~~~~~~~~~~~~~~~~~~~~~
172
173 The **mlx4_core** kernel module has several parameters that affect the
174 behavior and/or the performance of librte_pmd_mlx4. Some of them are described
175 below.
176
177 - **num_vfs** (integer or triplet, optionally prefixed by device address
178   strings)
179
180   Create the given number of VFs on the specified devices.
181
182 - **log_num_mgm_entry_size** (integer)
183
184   Device-managed flow steering (DMFS) is required by DPDK applications. It is
185   enabled by using a negative value, the last four bits of which have a
186   special meaning.
187
188   - **-1**: force device-managed flow steering (DMFS).
189   - **-7**: configure optimized steering mode to improve performance with the
190     following limitation: VLAN filtering is not supported with this mode.
191     This is the recommended mode in case VLAN filter is not needed.
192
193 Prerequisites
194 -------------
195
196 This driver relies on external libraries and kernel drivers for resources
197 allocations and initialization. The following dependencies are not part of
198 DPDK and must be installed separately:
199
200 - **libibverbs**
201
202   User space verbs framework used by librte_pmd_mlx4. This library provides
203   a generic interface between the kernel and low-level user space drivers
204   such as libmlx4.
205
206   It allows slow and privileged operations (context initialization, hardware
207   resources allocations) to be managed by the kernel and fast operations to
208   never leave user space.
209
210 - **libmlx4**
211
212   Low-level user space driver library for Mellanox ConnectX-3 devices,
213   it is automatically loaded by libibverbs.
214
215   This library basically implements send/receive calls to the hardware
216   queues.
217
218 - **Kernel modules** (mlnx-ofed-kernel)
219
220   They provide the kernel-side verbs API and low level device drivers that
221   manage actual hardware initialization and resources sharing with user
222   space processes.
223
224   Unlike most other PMDs, these modules must remain loaded and bound to
225   their devices:
226
227   - mlx4_core: hardware driver managing Mellanox ConnectX-3 devices.
228   - mlx4_en: Ethernet device driver that provides kernel network interfaces.
229   - mlx4_ib: InifiniBand device driver.
230   - ib_uverbs: user space driver for verbs (entry point for libibverbs).
231
232 - **Firmware update**
233
234   Mellanox OFED releases include firmware updates for ConnectX-3 adapters.
235
236   Because each release provides new features, these updates must be applied to
237   match the kernel modules and libraries they come with.
238
239 .. note::
240
241    Both libraries are BSD and GPL licensed. Linux kernel modules are GPL
242    licensed.
243
244 Currently supported by DPDK:
245
246 - Mellanox OFED **3.1**.
247 - Firmware version **2.35.5100** and higher.
248 - Supported architectures:  **x86_64** and **POWER8**.
249
250 Getting Mellanox OFED
251 ~~~~~~~~~~~~~~~~~~~~~
252
253 While these libraries and kernel modules are available on OpenFabrics
254 Alliance's `website <https://www.openfabrics.org/>`_ and provided by package
255 managers on most distributions, this PMD requires Ethernet extensions that
256 may not be supported at the moment (this is a work in progress).
257
258 `Mellanox OFED
259 <http://www.mellanox.com/page/products_dyn?product_family=26&mtag=linux_sw_drivers>`_
260 includes the necessary support and should be used in the meantime. For DPDK,
261 only libibverbs, libmlx4, mlnx-ofed-kernel packages and firmware updates are
262 required from that distribution.
263
264 .. note::
265
266    Several versions of Mellanox OFED are available. Installing the version
267    this DPDK release was developed and tested against is strongly
268    recommended. Please check the `prerequisites`_.
269
270 Usage example
271 -------------
272
273 This section demonstrates how to launch **testpmd** with Mellanox ConnectX-3
274 devices managed by librte_pmd_mlx4.
275
276 #. Load the kernel modules:
277
278    .. code-block:: console
279
280       modprobe -a ib_uverbs mlx4_en mlx4_core mlx4_ib
281
282    Alternatively if MLNX_OFED is fully installed, the following script can
283    be run:
284
285    .. code-block:: console
286
287       /etc/init.d/openibd restart
288
289    .. note::
290
291       User space I/O kernel modules (uio and igb_uio) are not used and do
292       not have to be loaded.
293
294 #. Make sure Ethernet interfaces are in working order and linked to kernel
295    verbs. Related sysfs entries should be present:
296
297    .. code-block:: console
298
299       ls -d /sys/class/net/*/device/infiniband_verbs/uverbs* | cut -d / -f 5
300
301    Example output:
302
303    .. code-block:: console
304
305       eth2
306       eth3
307       eth4
308       eth5
309
310 #. Optionally, retrieve their PCI bus addresses for whitelisting:
311
312    .. code-block:: console
313
314       {
315           for intf in eth2 eth3 eth4 eth5;
316           do
317               (cd "/sys/class/net/${intf}/device/" && pwd -P);
318           done;
319       } |
320       sed -n 's,.*/\(.*\),-w \1,p'
321
322    Example output:
323
324    .. code-block:: console
325
326       -w 0000:83:00.0
327       -w 0000:83:00.0
328       -w 0000:84:00.0
329       -w 0000:84:00.0
330
331    .. note::
332
333       There are only two distinct PCI bus addresses because the Mellanox
334       ConnectX-3 adapters installed on this system are dual port.
335
336 #. Request huge pages:
337
338    .. code-block:: console
339
340       echo 1024 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages/nr_hugepages
341
342 #. Start testpmd with basic parameters:
343
344    .. code-block:: console
345
346       testpmd -c 0xff00 -n 4 -w 0000:83:00.0 -w 0000:84:00.0 -- --rxq=2 --txq=2 -i
347
348    Example output:
349
350    .. code-block:: console
351
352       [...]
353       EAL: PCI device 0000:83:00.0 on NUMA socket 1
354       EAL:   probe driver: 15b3:1007 librte_pmd_mlx4
355       PMD: librte_pmd_mlx4: PCI information matches, using device "mlx4_0" (VF: false)
356       PMD: librte_pmd_mlx4: 2 port(s) detected
357       PMD: librte_pmd_mlx4: port 1 MAC address is 00:02:c9:b5:b7:50
358       PMD: librte_pmd_mlx4: port 2 MAC address is 00:02:c9:b5:b7:51
359       EAL: PCI device 0000:84:00.0 on NUMA socket 1
360       EAL:   probe driver: 15b3:1007 librte_pmd_mlx4
361       PMD: librte_pmd_mlx4: PCI information matches, using device "mlx4_1" (VF: false)
362       PMD: librte_pmd_mlx4: 2 port(s) detected
363       PMD: librte_pmd_mlx4: port 1 MAC address is 00:02:c9:b5:ba:b0
364       PMD: librte_pmd_mlx4: port 2 MAC address is 00:02:c9:b5:ba:b1
365       Interactive-mode selected
366       Configuring Port 0 (socket 0)
367       PMD: librte_pmd_mlx4: 0x867d60: TX queues number update: 0 -> 2
368       PMD: librte_pmd_mlx4: 0x867d60: RX queues number update: 0 -> 2
369       Port 0: 00:02:C9:B5:B7:50
370       Configuring Port 1 (socket 0)
371       PMD: librte_pmd_mlx4: 0x867da0: TX queues number update: 0 -> 2
372       PMD: librte_pmd_mlx4: 0x867da0: RX queues number update: 0 -> 2
373       Port 1: 00:02:C9:B5:B7:51
374       Configuring Port 2 (socket 0)
375       PMD: librte_pmd_mlx4: 0x867de0: TX queues number update: 0 -> 2
376       PMD: librte_pmd_mlx4: 0x867de0: RX queues number update: 0 -> 2
377       Port 2: 00:02:C9:B5:BA:B0
378       Configuring Port 3 (socket 0)
379       PMD: librte_pmd_mlx4: 0x867e20: TX queues number update: 0 -> 2
380       PMD: librte_pmd_mlx4: 0x867e20: RX queues number update: 0 -> 2
381       Port 3: 00:02:C9:B5:BA:B1
382       Checking link statuses...
383       Port 0 Link Up - speed 10000 Mbps - full-duplex
384       Port 1 Link Up - speed 40000 Mbps - full-duplex
385       Port 2 Link Up - speed 10000 Mbps - full-duplex
386       Port 3 Link Up - speed 40000 Mbps - full-duplex
387       Done
388       testpmd>