2 Copyright (C) Cavium networks Ltd. 2016.
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions
9 * Redistributions of source code must retain the above copyright
10 notice, this list of conditions and the following disclaimer.
11 * Redistributions in binary form must reproduce the above copyright
12 notice, this list of conditions and the following disclaimer in
13 the documentation and/or other materials provided with the
15 * Neither the name of Cavium networks nor the names of its
16 contributors may be used to endorse or promote products derived
17 from this software without specific prior written permission.
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 ThunderX NICVF Poll Mode Driver
32 ===============================
34 The ThunderX NICVF PMD (**librte_pmd_thunderx_nicvf**) provides poll mode driver
35 support for the inbuilt NIC found in the **Cavium ThunderX** SoC family
36 as well as their virtual functions (VF) in SR-IOV context.
38 More information can be found at `Cavium Networks Official Website
39 <http://www.cavium.com/ThunderX_ARM_Processors.html>`_.
44 Features of the ThunderX PMD are:
46 - Multiple queues for TX and RX
47 - Receive Side Scaling (RSS)
48 - Packet type information
52 - Port hardware statistics
54 - Link state information
55 - Scattered and gather for TX and RX
60 Supported ThunderX SoCs
61 -----------------------
66 - Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup the basic DPDK environment.
68 Pre-Installation Configuration
69 ------------------------------
74 The following options can be modified in the ``config`` file.
75 Please note that enabling debugging options may affect system performance.
77 - ``CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD`` (default ``n``)
79 By default it is enabled only for defconfig_arm64-thunderx-* config.
80 Toggle compilation of the ``librte_pmd_thunderx_nicvf`` driver.
82 - ``CONFIG_RTE_LIBRTE_THUNDERX_NICVF_DEBUG_INIT`` (default ``n``)
84 Toggle display of initialization related messages.
86 - ``CONFIG_RTE_LIBRTE_THUNDERX_NICVF_DEBUG_RX`` (default ``n``)
88 Toggle display of receive fast path run-time message
90 - ``CONFIG_RTE_LIBRTE_THUNDERX_NICVF_DEBUG_TX`` (default ``n``)
92 Toggle display of transmit fast path run-time message
94 - ``CONFIG_RTE_LIBRTE_THUNDERX_NICVF_DEBUG_DRIVER`` (default ``n``)
96 Toggle display of generic debugging messages
98 - ``CONFIG_RTE_LIBRTE_THUNDERX_NICVF_DEBUG_MBOX`` (default ``n``)
100 Toggle display of PF mailbox related run-time check messages
105 To compile the ThunderX NICVF PMD for Linux arm64 gcc target, run the
106 following “make” command:
108 .. code-block:: console
110 cd <DPDK-source-directory>
111 make config T=arm64-thunderx-linuxapp-gcc install
116 .. _thunderx_testpmd_example:
121 This section demonstrates how to launch ``testpmd`` with ThunderX NIC VF device
122 managed by ``librte_pmd_thunderx_nicvf`` in the Linux operating system.
124 #. Load ``vfio-pci`` driver:
126 .. code-block:: console
130 .. _thunderx_vfio_noiommu:
132 #. Enable **VFIO-NOIOMMU** mode (optional):
134 .. code-block:: console
136 echo 1 > /sys/module/vfio/parameters/enable_unsafe_noiommu_mode
140 **VFIO-NOIOMMU** is required only when running in VM context and should not be enabled otherwise.
141 See also :ref:`SR-IOV: Prerequisites and sample Application Notes <thunderx_sriov_example>`.
143 #. Bind the ThunderX NIC VF device to ``vfio-pci`` loaded in the previous step:
145 Setup VFIO permissions for regular users and then bind to ``vfio-pci``:
147 .. code-block:: console
149 ./tools/dpdk_nic_bind.py --bind vfio-pci 0002:01:00.2
151 #. Start ``testpmd`` with basic parameters:
153 .. code-block:: console
155 ./arm64-thunderx-linuxapp-gcc/app/testpmd -c 0xf -n 4 -w 0002:01:00.2 \
156 -- -i --disable-hw-vlan-filter --crc-strip --no-flush-rx \
161 .. code-block:: console
165 PMD: rte_nicvf_pmd_init(): librte_pmd_thunderx nicvf version 1.0
168 EAL: probe driver: 177d:11 rte_nicvf_pmd
169 EAL: using IOMMU type 1 (Type 1)
170 EAL: PCI memory mapped at 0x3ffade50000
171 EAL: Trying to map BAR 4 that contains the MSI-X table.
172 Trying offsets: 0x40000000000:0x0000, 0x10000:0x1f0000
173 EAL: PCI memory mapped at 0x3ffadc60000
174 PMD: nicvf_eth_dev_init(): nicvf: device (177d:11) 2:1:0:2
175 PMD: nicvf_eth_dev_init(): node=0 vf=1 mode=tns-bypass sqs=false
176 loopback_supported=true
177 PMD: nicvf_eth_dev_init(): Port 0 (177d:11) mac=a6:c6:d9:17:78:01
178 Interactive-mode selected
179 Configuring Port 0 (socket 0)
182 PMD: nicvf_dev_configure(): Configured ethdev port0 hwcap=0x0
183 Port 0: A6:C6:D9:17:78:01
184 Checking link statuses...
185 Port 0 Link Up - speed 10000 Mbps - full-duplex
189 .. _thunderx_sriov_example:
191 SR-IOV: Prerequisites and sample Application Notes
192 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
194 Current ThunderX NIC PF/VF kernel modules maps each physical Ethernet port
195 automatically to virtual function (VF) and presented them as PCIe-like SR-IOV device.
196 This section provides instructions to configure SR-IOV with Linux OS.
198 #. Verify PF devices capabilities using ``lspci``:
200 .. code-block:: console
206 .. code-block:: console
208 0002:01:00.0 Ethernet controller: Cavium Networks Device a01e (rev 01)
210 Capabilities: [100 v1] Alternative Routing-ID Interpretation (ARI)
212 Capabilities: [180 v1] Single Root I/O Virtualization (SR-IOV)
214 Kernel driver in use: thunder-nic
219 Unless ``thunder-nic`` driver is in use make sure your kernel config includes ``CONFIG_THUNDER_NIC_PF`` setting.
221 #. Verify VF devices capabilities and drivers using ``lspci``:
223 .. code-block:: console
229 .. code-block:: console
231 0002:01:00.1 Ethernet controller: Cavium Networks Device 0011 (rev 01)
233 Capabilities: [100 v1] Alternative Routing-ID Interpretation (ARI)
235 Kernel driver in use: thunder-nicvf
238 0002:01:00.2 Ethernet controller: Cavium Networks Device 0011 (rev 01)
240 Capabilities: [100 v1] Alternative Routing-ID Interpretation (ARI)
242 Kernel driver in use: thunder-nicvf
247 Unless ``thunder-nicvf`` driver is in use make sure your kernel config includes ``CONFIG_THUNDER_NIC_VF`` setting.
249 #. Verify PF/VF bind using ``dpdk_nic_bind.py``:
251 .. code-block:: console
253 ./tools/dpdk_nic_bind.py --status
257 .. code-block:: console
260 0002:01:00.0 'Device a01e' if= drv=thunder-nic unused=vfio-pci
261 0002:01:00.1 'Device 0011' if=eth0 drv=thunder-nicvf unused=vfio-pci
262 0002:01:00.2 'Device 0011' if=eth1 drv=thunder-nicvf unused=vfio-pci
265 #. Load ``vfio-pci`` driver:
267 .. code-block:: console
271 #. Bind VF devices to ``vfio-pci`` using ``dpdk_nic_bind.py``:
273 .. code-block:: console
275 ./tools/dpdk_nic_bind.py --bind vfio-pci 0002:01:00.1
276 ./tools/dpdk_nic_bind.py --bind vfio-pci 0002:01:00.2
278 #. Verify VF bind using ``dpdk_nic_bind.py``:
280 .. code-block:: console
282 ./tools/dpdk_nic_bind.py --status
286 .. code-block:: console
289 0002:01:00.1 'Device 0011' drv=vfio-pci unused=
290 0002:01:00.2 'Device 0011' drv=vfio-pci unused=
292 0002:01:00.0 'Device a01e' if= drv=thunder-nic unused=vfio-pci
295 #. Pass VF device to VM context (PCIe Passthrough):
297 The VF devices may be passed through to the guest VM using qemu or
298 virt-manager or virsh etc.
299 ``librte_pmd_thunderx_nicvf`` or ``thunder-nicvf`` should be used to bind
300 the VF devices in the guest VM in :ref:`VFIO-NOIOMMU <thunderx_vfio_noiommu>` mode.
302 Example qemu guest launch command:
304 .. code-block:: console
306 sudo qemu-system-aarch64 -name vm1 \
307 -machine virt,gic_version=3,accel=kvm,usb=off \
309 -smp 4,sockets=1,cores=8,threads=1 \
310 -nographic -nodefaults \
311 -kernel <kernel image> \
312 -append "root=/dev/vda console=ttyAMA0 rw hugepagesz=512M hugepages=3" \
313 -device vfio-pci,host=0002:01:00.1 \
314 -drive file=<rootfs.ext3>,if=none,id=disk1,format=raw \
315 -device virtio-blk-device,scsi=off,drive=disk1,id=virtio-disk1,bootindex=1 \
316 -netdev tap,id=net0,ifname=tap0,script=/etc/qemu-ifup_thunder \
317 -device virtio-net-device,netdev=net0 \
321 #. Refer to section :ref:`Running testpmd <thunderx_testpmd_example>` for instruction
322 how to launch ``testpmd`` application.
330 The ThunderX SoC family NICs strip the CRC for every packets coming into the
331 host interface. So, CRC will be stripped even when the
332 ``rxmode.hw_strip_crc`` member is set to 0 in ``struct rte_eth_conf``.
334 Maximum packet length
335 ~~~~~~~~~~~~~~~~~~~~~
337 The ThunderX SoC family NICs support a maximum of a 9K jumbo frame. The value
338 is fixed and cannot be changed. So, even when the ``rxmode.max_rx_pkt_len``
339 member of ``struct rte_eth_conf`` is set to a value lower than 9200, frames
340 up to 9200 bytes can still reach the host interface.
342 Maximum packet segments
343 ~~~~~~~~~~~~~~~~~~~~~~~
345 The ThunderX SoC family NICs support up to 12 segments per packet when working
346 in scatter/gather mode. So, setting MTU will result with ``EINVAL`` when the
347 frame size does not fit in the maximum number of segments.
350 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
352 The ThunderX SoC family NICs has 128VFs and each VF has 8/8 queues
353 for RX/TX respectively. Current driver implementation has one to one mapping
354 between physical port and VF hence only limited VFs can be used.