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 -----------------------
67 - Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup the basic DPDK environment.
69 Pre-Installation Configuration
70 ------------------------------
75 The following options can be modified in the ``config`` file.
76 Please note that enabling debugging options may affect system performance.
78 - ``CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD`` (default ``n``)
80 By default it is enabled only for defconfig_arm64-thunderx-* config.
81 Toggle compilation of the ``librte_pmd_thunderx_nicvf`` driver.
83 - ``CONFIG_RTE_LIBRTE_THUNDERX_NICVF_DEBUG_INIT`` (default ``n``)
85 Toggle display of initialization related messages.
87 - ``CONFIG_RTE_LIBRTE_THUNDERX_NICVF_DEBUG_RX`` (default ``n``)
89 Toggle display of receive fast path run-time message
91 - ``CONFIG_RTE_LIBRTE_THUNDERX_NICVF_DEBUG_TX`` (default ``n``)
93 Toggle display of transmit fast path run-time message
95 - ``CONFIG_RTE_LIBRTE_THUNDERX_NICVF_DEBUG_DRIVER`` (default ``n``)
97 Toggle display of generic debugging messages
99 - ``CONFIG_RTE_LIBRTE_THUNDERX_NICVF_DEBUG_MBOX`` (default ``n``)
101 Toggle display of PF mailbox related run-time check messages
106 To compile the ThunderX NICVF PMD for Linux arm64 gcc target, run the
107 following “make” command:
109 .. code-block:: console
111 cd <DPDK-source-directory>
112 make config T=arm64-thunderx-linuxapp-gcc install
117 .. _thunderx_testpmd_example:
122 This section demonstrates how to launch ``testpmd`` with ThunderX NIC VF device
123 managed by ``librte_pmd_thunderx_nicvf`` in the Linux operating system.
125 #. Load ``vfio-pci`` driver:
127 .. code-block:: console
131 .. _thunderx_vfio_noiommu:
133 #. Enable **VFIO-NOIOMMU** mode (optional):
135 .. code-block:: console
137 echo 1 > /sys/module/vfio/parameters/enable_unsafe_noiommu_mode
141 **VFIO-NOIOMMU** is required only when running in VM context and should not be enabled otherwise.
142 See also :ref:`SR-IOV: Prerequisites and sample Application Notes <thunderx_sriov_example>`.
144 #. Bind the ThunderX NIC VF device to ``vfio-pci`` loaded in the previous step:
146 Setup VFIO permissions for regular users and then bind to ``vfio-pci``:
148 .. code-block:: console
150 ./tools/dpdk-devbind.py --bind vfio-pci 0002:01:00.2
152 #. Start ``testpmd`` with basic parameters:
154 .. code-block:: console
156 ./arm64-thunderx-linuxapp-gcc/app/testpmd -c 0xf -n 4 -w 0002:01:00.2 \
157 -- -i --disable-hw-vlan-filter --crc-strip --no-flush-rx \
162 .. code-block:: console
166 PMD: rte_nicvf_pmd_init(): librte_pmd_thunderx nicvf version 1.0
169 EAL: probe driver: 177d:11 rte_nicvf_pmd
170 EAL: using IOMMU type 1 (Type 1)
171 EAL: PCI memory mapped at 0x3ffade50000
172 EAL: Trying to map BAR 4 that contains the MSI-X table.
173 Trying offsets: 0x40000000000:0x0000, 0x10000:0x1f0000
174 EAL: PCI memory mapped at 0x3ffadc60000
175 PMD: nicvf_eth_dev_init(): nicvf: device (177d:11) 2:1:0:2
176 PMD: nicvf_eth_dev_init(): node=0 vf=1 mode=tns-bypass sqs=false
177 loopback_supported=true
178 PMD: nicvf_eth_dev_init(): Port 0 (177d:11) mac=a6:c6:d9:17:78:01
179 Interactive-mode selected
180 Configuring Port 0 (socket 0)
183 PMD: nicvf_dev_configure(): Configured ethdev port0 hwcap=0x0
184 Port 0: A6:C6:D9:17:78:01
185 Checking link statuses...
186 Port 0 Link Up - speed 10000 Mbps - full-duplex
190 .. _thunderx_sriov_example:
192 SR-IOV: Prerequisites and sample Application Notes
193 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
195 Current ThunderX NIC PF/VF kernel modules maps each physical Ethernet port
196 automatically to virtual function (VF) and presented them as PCIe-like SR-IOV device.
197 This section provides instructions to configure SR-IOV with Linux OS.
199 #. Verify PF devices capabilities using ``lspci``:
201 .. code-block:: console
207 .. code-block:: console
209 0002:01:00.0 Ethernet controller: Cavium Networks Device a01e (rev 01)
211 Capabilities: [100 v1] Alternative Routing-ID Interpretation (ARI)
213 Capabilities: [180 v1] Single Root I/O Virtualization (SR-IOV)
215 Kernel driver in use: thunder-nic
220 Unless ``thunder-nic`` driver is in use make sure your kernel config includes ``CONFIG_THUNDER_NIC_PF`` setting.
222 #. Verify VF devices capabilities and drivers using ``lspci``:
224 .. code-block:: console
230 .. code-block:: console
232 0002:01:00.1 Ethernet controller: Cavium Networks Device 0011 (rev 01)
234 Capabilities: [100 v1] Alternative Routing-ID Interpretation (ARI)
236 Kernel driver in use: thunder-nicvf
239 0002:01:00.2 Ethernet controller: Cavium Networks Device 0011 (rev 01)
241 Capabilities: [100 v1] Alternative Routing-ID Interpretation (ARI)
243 Kernel driver in use: thunder-nicvf
248 Unless ``thunder-nicvf`` driver is in use make sure your kernel config includes ``CONFIG_THUNDER_NIC_VF`` setting.
250 #. Verify PF/VF bind using ``dpdk-devbind.py``:
252 .. code-block:: console
254 ./tools/dpdk-devbind.py --status
258 .. code-block:: console
261 0002:01:00.0 'Device a01e' if= drv=thunder-nic unused=vfio-pci
262 0002:01:00.1 'Device 0011' if=eth0 drv=thunder-nicvf unused=vfio-pci
263 0002:01:00.2 'Device 0011' if=eth1 drv=thunder-nicvf unused=vfio-pci
266 #. Load ``vfio-pci`` driver:
268 .. code-block:: console
272 #. Bind VF devices to ``vfio-pci`` using ``dpdk-devbind.py``:
274 .. code-block:: console
276 ./tools/dpdk-devbind.py --bind vfio-pci 0002:01:00.1
277 ./tools/dpdk-devbind.py --bind vfio-pci 0002:01:00.2
279 #. Verify VF bind using ``dpdk-devbind.py``:
281 .. code-block:: console
283 ./tools/dpdk-devbind.py --status
287 .. code-block:: console
290 0002:01:00.1 'Device 0011' drv=vfio-pci unused=
291 0002:01:00.2 'Device 0011' drv=vfio-pci unused=
293 0002:01:00.0 'Device a01e' if= drv=thunder-nic unused=vfio-pci
296 #. Pass VF device to VM context (PCIe Passthrough):
298 The VF devices may be passed through to the guest VM using qemu or
299 virt-manager or virsh etc.
300 ``librte_pmd_thunderx_nicvf`` or ``thunder-nicvf`` should be used to bind
301 the VF devices in the guest VM in :ref:`VFIO-NOIOMMU <thunderx_vfio_noiommu>` mode.
303 Example qemu guest launch command:
305 .. code-block:: console
307 sudo qemu-system-aarch64 -name vm1 \
308 -machine virt,gic_version=3,accel=kvm,usb=off \
310 -smp 4,sockets=1,cores=8,threads=1 \
311 -nographic -nodefaults \
312 -kernel <kernel image> \
313 -append "root=/dev/vda console=ttyAMA0 rw hugepagesz=512M hugepages=3" \
314 -device vfio-pci,host=0002:01:00.1 \
315 -drive file=<rootfs.ext3>,if=none,id=disk1,format=raw \
316 -device virtio-blk-device,scsi=off,drive=disk1,id=virtio-disk1,bootindex=1 \
317 -netdev tap,id=net0,ifname=tap0,script=/etc/qemu-ifup_thunder \
318 -device virtio-net-device,netdev=net0 \
322 #. Refer to section :ref:`Running testpmd <thunderx_testpmd_example>` for instruction
323 how to launch ``testpmd`` application.
331 The ThunderX SoC family NICs strip the CRC for every packets coming into the
332 host interface. So, CRC will be stripped even when the
333 ``rxmode.hw_strip_crc`` member is set to 0 in ``struct rte_eth_conf``.
335 Maximum packet length
336 ~~~~~~~~~~~~~~~~~~~~~
338 The ThunderX SoC family NICs support a maximum of a 9K jumbo frame. The value
339 is fixed and cannot be changed. So, even when the ``rxmode.max_rx_pkt_len``
340 member of ``struct rte_eth_conf`` is set to a value lower than 9200, frames
341 up to 9200 bytes can still reach the host interface.
343 Maximum packet segments
344 ~~~~~~~~~~~~~~~~~~~~~~~
346 The ThunderX SoC family NICs support up to 12 segments per packet when working
347 in scatter/gather mode. So, setting MTU will result with ``EINVAL`` when the
348 frame size does not fit in the maximum number of segments.
351 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
353 The ThunderX SoC family NICs has 128VFs and each VF has 8/8 queues
354 for RX/TX respectively. Current driver implementation has one to one mapping
355 between physical port and VF hence only limited VFs can be used.