2 Copyright 2015 Chelsio Communications.
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 Chelsio Communications 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 CXGBE Poll Mode Driver
32 ======================
34 The CXGBE PMD (**librte_pmd_cxgbe**) provides poll mode driver support
35 for **Chelsio T5** 10/40 Gbps family of adapters. CXGBE PMD has support
36 for the latest Linux and FreeBSD operating systems.
38 More information can be found at `Chelsio Communications Official Website
39 <http://www.chelsio.com>`_.
44 CXGBE PMD has support for:
46 - Multiple queues for TX and RX
47 - Receiver Side Steering (RSS)
52 - Port hardware statistics
58 The Chelsio T5 devices provide two/four ports but expose a single PCI bus
59 address, thus, librte_pmd_cxgbe registers itself as a
60 PCI driver that allocates one Ethernet device per detected port.
62 For this reason, one cannot whitelist/blacklist a single port without
63 whitelisting/blacklisting the other ports on the same device.
65 Supported Chelsio T5 NICs
66 -------------------------
69 - 10G NICs: T520-BT, T520-CR, T520-LL-CR, T520-SO-CR, T540-CR
70 - 40G NICs: T580-CR, T580-LP-CR, T580-SO-CR
71 - Other T5 NICs: T522-CR
76 - Requires firmware version **1.13.32.0** and higher. Visit
77 `Chelsio Download Center <http://service.chelsio.com>`_ to get latest firmware
78 bundled with the latest Chelsio Unified Wire package.
80 For Linux, installing and loading the latest cxgb4 kernel driver from the
81 Chelsio Unified Wire package should get you the latest firmware. More
82 information can be obtained from the User Guide that is bundled with the
83 Chelsio Unified Wire package.
85 For FreeBSD, the latest firmware obtained from the Chelsio Unified Wire
86 package must be manually flashed via cxgbetool available in FreeBSD source
89 Instructions on how to manually flash the firmware are given in section
90 :ref:`linux-installation` for Linux and section :ref:`freebsd-installation`
93 Pre-Installation Configuration
94 ------------------------------
99 The following options can be modified in the ``.config`` file. Please note that
100 enabling debugging options may affect system performance.
102 - ``CONFIG_RTE_LIBRTE_CXGBE_PMD`` (default **y**)
104 Toggle compilation of librte_pmd_cxgbe driver.
106 - ``CONFIG_RTE_LIBRTE_CXGBE_DEBUG`` (default **n**)
108 Toggle display of generic debugging messages.
110 - ``CONFIG_RTE_LIBRTE_CXGBE_DEBUG_REG`` (default **n**)
112 Toggle display of registers related run-time check messages.
114 - ``CONFIG_RTE_LIBRTE_CXGBE_DEBUG_MBOX`` (default **n**)
116 Toggle display of firmware mailbox related run-time check messages.
118 - ``CONFIG_RTE_LIBRTE_CXGBE_DEBUG_TX`` (default **n**)
120 Toggle display of transmission data path run-time check messages.
122 - ``CONFIG_RTE_LIBRTE_CXGBE_DEBUG_RX`` (default **n**)
124 Toggle display of receiving data path run-time check messages.
126 .. _driver-compilation:
131 To compile CXGBE PMD for Linux x86_64 gcc target, run the following "make"
134 .. code-block:: console
136 cd <DPDK-source-directory>
137 make config T=x86_64-native-linuxapp-gcc install
139 To compile CXGBE PMD for FreeBSD x86_64 clang target, run the following "gmake"
142 .. code-block:: console
144 cd <DPDK-source-directory>
145 gmake config T=x86_64-native-bsdapp-clang install
150 .. _linux-installation:
155 Steps to manually install the latest firmware from the downloaded Chelsio
156 Unified Wire package for Linux operating system are as follows:
158 #. Load the kernel module:
160 .. code-block:: console
164 #. Use ifconfig to get the interface name assigned to Chelsio card:
166 .. code-block:: console
168 ifconfig -a | grep "00:07:43"
172 .. code-block:: console
174 p1p1 Link encap:Ethernet HWaddr 00:07:43:2D:EA:C0
175 p1p2 Link encap:Ethernet HWaddr 00:07:43:2D:EA:C8
179 .. code-block:: console
181 cd <path_to_uwire>/tools/cxgbtool
184 #. Use cxgbtool to load the firmware config file onto the card:
186 .. code-block:: console
188 cxgbtool p1p1 loadcfg <path_to_uwire>/src/network/firmware/t5-config.txt
190 #. Use cxgbtool to load the firmware image onto the card:
192 .. code-block:: console
194 cxgbtool p1p1 loadfw <path_to_uwire>/src/network/firmware/t5fw-*.bin
196 #. Unload and reload the kernel module:
198 .. code-block:: console
203 #. Verify with ethtool:
205 .. code-block:: console
207 ethtool -i p1p1 | grep "firmware"
211 .. code-block:: console
213 firmware-version: 1.13.32.0, TP 0.1.4.8
218 This section demonstrates how to launch **testpmd** with Chelsio T5
219 devices managed by librte_pmd_cxgbe in Linux operating system.
221 #. Change to DPDK source directory where the target has been compiled in
222 section :ref:`driver-compilation`:
224 .. code-block:: console
226 cd <DPDK-source-directory>
228 #. Load the kernel module:
230 .. code-block:: console
234 #. Get the PCI bus addresses of the interfaces bound to cxgb4 driver:
236 .. code-block:: console
242 .. code-block:: console
244 cxgb4 0000:02:00.4 p1p1: renamed from eth0
245 cxgb4 0000:02:00.4 p1p2: renamed from eth1
249 Both the interfaces of a Chelsio T5 2-port adapter are bound to the
250 same PCI bus address.
252 #. Unload the kernel module:
254 .. code-block:: console
256 modprobe -ar cxgb4 csiostor
258 #. Request huge pages:
260 .. code-block:: console
262 echo 1024 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages/nr_hugepages
266 .. code-block:: console
269 mount -t hugetlbfs nodev /mnt/huge
271 #. Load igb_uio or vfio-pci driver:
273 .. code-block:: console
275 insmod ./x86_64-native-linuxapp-gcc/kmod/igb_uio.ko
279 .. code-block:: console
283 #. Bind the Chelsio T5 adapters to igb_uio or vfio-pci loaded in the previous
286 .. code-block:: console
288 ./tools/dpdk_nic_bind.py --bind igb_uio 0000:02:00.4
292 Setup VFIO permissions for regular users and then bind to vfio-pci:
294 .. code-block:: console
296 sudo chmod a+x /dev/vfio
298 sudo chmod 0666 /dev/vfio/*
300 ./tools/dpdk_nic_bind.py --bind vfio-pci 0000:02:00.4
304 Currently, CXGBE PMD only supports the binding of PF4 for Chelsio T5 NICs.
306 #. Start testpmd with basic parameters:
308 .. code-block:: console
310 ./x86_64-native-linuxapp-gcc/app/testpmd -c 0xf -n 4 -w 0000:02:00.4 -- -i
314 .. code-block:: console
317 EAL: PCI device 0000:02:00.4 on NUMA socket -1
318 EAL: probe driver: 1425:5401 rte_cxgbe_pmd
319 EAL: PCI memory mapped at 0x7fd7c0200000
320 EAL: PCI memory mapped at 0x7fd77cdfd000
321 EAL: PCI memory mapped at 0x7fd7c10b7000
322 PMD: rte_cxgbe_pmd: fw: 1.13.32.0, TP: 0.1.4.8
323 PMD: rte_cxgbe_pmd: Coming up as MASTER: Initializing adapter
324 Interactive-mode selected
325 Configuring Port 0 (socket 0)
326 Port 0: 00:07:43:2D:EA:C0
327 Configuring Port 1 (socket 0)
328 Port 1: 00:07:43:2D:EA:C8
329 Checking link statuses...
330 PMD: rte_cxgbe_pmd: Port0: passive DA port module inserted
331 PMD: rte_cxgbe_pmd: Port1: passive DA port module inserted
332 Port 0 Link Up - speed 10000 Mbps - full-duplex
333 Port 1 Link Up - speed 10000 Mbps - full-duplex
339 Flow control pause TX/RX is disabled by default and can be enabled via
340 testpmd. Refer section :ref:`flow-control` for more details.
345 .. _freebsd-installation:
350 Steps to manually install the latest firmware from the downloaded Chelsio
351 Unified Wire package for FreeBSD operating system are as follows:
353 #. Load the kernel module:
355 .. code-block:: console
359 #. Use dmesg to get the t5nex instance assigned to the Chelsio card:
361 .. code-block:: console
367 .. code-block:: console
369 t5nex0: <Chelsio T520-CR> irq 16 at device 0.4 on pci2
370 cxl0: <port 0> on t5nex0
371 cxl1: <port 1> on t5nex0
372 t5nex0: PCIe x8, 2 ports, 14 MSI-X interrupts, 31 eq, 13 iq
374 In the example above, a Chelsio T520-CR card is bound to a t5nex0 instance.
376 #. Install cxgbetool from FreeBSD source repository:
378 .. code-block:: console
380 cd <path_to_FreeBSD_source>/tools/tools/cxgbetool/
383 #. Use cxgbetool to load the firmware image onto the card:
385 .. code-block:: console
387 cxgbetool t5nex0 loadfw <path_to_uwire>/src/network/firmware/t5fw-*.bin
389 #. Unload and reload the kernel module:
391 .. code-block:: console
396 #. Verify with sysctl:
398 .. code-block:: console
400 sysctl -a | grep "t5nex" | grep "firmware"
404 .. code-block:: console
406 dev.t5nex.0.firmware_version: 1.13.32.0
411 This section demonstrates how to launch **testpmd** with Chelsio T5
412 devices managed by librte_pmd_cxgbe in FreeBSD operating system.
414 #. Change to DPDK source directory where the target has been compiled in
415 section :ref:`driver-compilation`:
417 .. code-block:: console
419 cd <DPDK-source-directory>
421 #. Copy the contigmem kernel module to /boot/kernel directory:
423 .. code-block:: console
425 cp x86_64-native-bsdapp-clang/kmod/contigmem.ko /boot/kernel/
427 #. Add the following lines to /boot/loader.conf:
429 .. code-block:: console
431 # reserve 2 x 1G blocks of contiguous memory using contigmem driver
432 hw.contigmem.num_buffers=2
433 hw.contigmem.buffer_size=1073741824
434 # load contigmem module during boot process
437 The above lines load the contigmem kernel module during boot process and
438 allocate 2 x 1G blocks of contiguous memory to be used for DPDK later on.
439 This is to avoid issues with potential memory fragmentation during later
440 system up time, which may result in failure of allocating the contiguous
441 memory required for the contigmem kernel module.
443 #. Restart the system and ensure the contigmem module is loaded successfully:
445 .. code-block:: console
448 kldstat | grep "contigmem"
452 .. code-block:: console
454 2 1 0xffffffff817f1000 3118 contigmem.ko
456 #. Repeat step 1 to ensure that you are in the DPDK source directory.
458 #. Load the cxgbe kernel module:
460 .. code-block:: console
464 #. Get the PCI bus addresses of the interfaces bound to t5nex driver:
466 .. code-block:: console
468 pciconf -l | grep "t5nex"
472 .. code-block:: console
474 t5nex0@pci0:2:0:4: class=0x020000 card=0x00001425 chip=0x54011425 rev=0x00
476 In the above example, the t5nex0 is bound to 2:0:4 bus address.
480 Both the interfaces of a Chelsio T5 2-port adapter are bound to the
481 same PCI bus address.
483 #. Unload the kernel module:
485 .. code-block:: console
489 #. Set the PCI bus addresses to hw.nic_uio.bdfs kernel environment parameter:
491 .. code-block:: console
493 kenv hw.nic_uio.bdfs="2:0:4"
495 This automatically binds 2:0:4 to nic_uio kernel driver when it is loaded in
500 Currently, CXGBE PMD only supports the binding of PF4 for Chelsio T5 NICs.
502 #. Load nic_uio kernel driver:
504 .. code-block:: console
506 kldload ./x86_64-native-bsdapp-clang/kmod/nic_uio.ko
508 #. Start testpmd with basic parameters:
510 .. code-block:: console
512 ./x86_64-native-bsdapp-clang/app/testpmd -c 0xf -n 4 -w 0000:02:00.4 -- -i
516 .. code-block:: console
519 EAL: PCI device 0000:02:00.4 on NUMA socket 0
520 EAL: probe driver: 1425:5401 rte_cxgbe_pmd
521 EAL: PCI memory mapped at 0x8007ec000
522 EAL: PCI memory mapped at 0x842800000
523 EAL: PCI memory mapped at 0x80086c000
524 PMD: rte_cxgbe_pmd: fw: 1.13.32.0, TP: 0.1.4.8
525 PMD: rte_cxgbe_pmd: Coming up as MASTER: Initializing adapter
526 Interactive-mode selected
527 Configuring Port 0 (socket 0)
528 Port 0: 00:07:43:2D:EA:C0
529 Configuring Port 1 (socket 0)
530 Port 1: 00:07:43:2D:EA:C8
531 Checking link statuses...
532 PMD: rte_cxgbe_pmd: Port0: passive DA port module inserted
533 PMD: rte_cxgbe_pmd: Port1: passive DA port module inserted
534 Port 0 Link Up - speed 10000 Mbps - full-duplex
535 Port 1 Link Up - speed 10000 Mbps - full-duplex
541 Flow control pause TX/RX is disabled by default and can be enabled via
542 testpmd. Refer section :ref:`flow-control` for more details.
544 Sample Application Notes
545 ------------------------
549 Enable/Disable Flow Control
550 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
552 Flow control pause TX/RX is disabled by default and can be enabled via
555 .. code-block:: console
557 testpmd> set flow_ctrl rx on tx on 0 0 0 0 mac_ctrl_frame_fwd off autoneg on 0
558 testpmd> set flow_ctrl rx on tx on 0 0 0 0 mac_ctrl_frame_fwd off autoneg on 1
560 To disable again, run:
562 .. code-block:: console
564 testpmd> set flow_ctrl rx off tx off 0 0 0 0 mac_ctrl_frame_fwd off autoneg off 0
565 testpmd> set flow_ctrl rx off tx off 0 0 0 0 mac_ctrl_frame_fwd off autoneg off 1
570 There are two ways to enable sending and receiving of jumbo frames via testpmd.
571 One method involves using the **mtu** command, which changes the mtu of an
572 individual port without having to stop the selected port. Another method
573 involves stopping all the ports first and then running **max-pkt-len** command
574 to configure the mtu of all the ports with a single command.
576 - To configure each port individually, run the mtu command as follows:
578 .. code-block:: console
580 testpmd> port config mtu 0 9000
581 testpmd> port config mtu 1 9000
583 - To configure all the ports at once, stop all the ports first and run the
584 max-pkt-len command as follows:
586 .. code-block:: console
588 testpmd> port stop all
589 testpmd> port config all max-pkt-len 9000