net/cxgbe: add devargs to control filtermode and filtermask
[dpdk.git] / doc / guides / nics / cxgbe.rst
1 .. SPDX-License-Identifier: BSD-3-Clause
2    Copyright(c) 2014-2018 Chelsio Communications.
3    All rights reserved.
4
5 CXGBE Poll Mode Driver
6 ======================
7
8 The CXGBE PMD (**librte_pmd_cxgbe**) provides poll mode driver support
9 for **Chelsio Terminator** 10/25/40/100 Gbps family of adapters. CXGBE PMD
10 has support for the latest Linux and FreeBSD operating systems.
11
12 CXGBEVF PMD provides poll mode driver support for SR-IOV Virtual functions
13 and has support for the latest Linux operating systems.
14
15 More information can be found at `Chelsio Communications Official Website
16 <http://www.chelsio.com>`_.
17
18 Features
19 --------
20
21 CXGBE and CXGBEVF PMD has support for:
22
23 - Multiple queues for TX and RX
24 - Receiver Side Steering (RSS)
25   Receiver Side Steering (RSS) on IPv4, IPv6, IPv4-TCP/UDP, IPv6-TCP/UDP.
26   For 4-tuple, enabling 'RSS on TCP' and 'RSS on TCP + UDP' is supported.
27 - VLAN filtering
28 - Checksum offload
29 - Promiscuous mode
30 - All multicast mode
31 - Port hardware statistics
32 - Jumbo frames
33 - Flow API - Support for both Wildcard (LE-TCAM) and Exact (HASH) match filters.
34
35 Limitations
36 -----------
37
38 The Chelsio Terminator series of devices provide two/four ports but
39 expose a single PCI bus address, thus, librte_pmd_cxgbe registers
40 itself as a PCI driver that allocates one Ethernet device per detected
41 port.
42
43 For this reason, one cannot whitelist/blacklist a single port without
44 whitelisting/blacklisting the other ports on the same device.
45
46 .. _t5-nics:
47
48 Supported Chelsio T5 NICs
49 -------------------------
50
51 - 1G NICs: T502-BT
52 - 10G NICs: T520-BT, T520-CR, T520-LL-CR, T520-SO-CR, T540-CR
53 - 40G NICs: T580-CR, T580-LP-CR, T580-SO-CR
54 - Other T5 NICs: T522-CR
55
56 .. _t6-nics:
57
58 Supported Chelsio T6 NICs
59 -------------------------
60
61 - 25G NICs: T6425-CR, T6225-CR, T6225-LL-CR, T6225-SO-CR
62 - 100G NICs: T62100-CR, T62100-LP-CR, T62100-SO-CR
63
64 Supported SR-IOV Chelsio NICs
65 -----------------------------
66
67 SR-IOV virtual functions are supported on all the Chelsio NICs listed
68 in :ref:`t5-nics` and :ref:`t6-nics`.
69
70 Prerequisites
71 -------------
72
73 - Requires firmware version **1.24.11.0** and higher. Visit
74   `Chelsio Download Center <http://service.chelsio.com>`_ to get latest firmware
75   bundled with the latest Chelsio Unified Wire package.
76
77   For Linux, installing and loading the latest cxgb4 kernel driver from the
78   Chelsio Unified Wire package should get you the latest firmware. More
79   information can be obtained from the User Guide that is bundled with the
80   Chelsio Unified Wire package.
81
82   For FreeBSD, the latest firmware obtained from the Chelsio Unified Wire
83   package must be manually flashed via cxgbetool available in FreeBSD source
84   repository.
85
86   Instructions on how to manually flash the firmware are given in section
87   :ref:`linux-installation` for Linux and section :ref:`freebsd-installation`
88   for FreeBSD.
89
90 Pre-Installation Configuration
91 ------------------------------
92
93 Config File Options
94 ~~~~~~~~~~~~~~~~~~~
95
96 The following options can be modified in the ``.config`` file. Please note that
97 enabling debugging options may affect system performance.
98
99 - ``CONFIG_RTE_LIBRTE_CXGBE_PMD`` (default **y**)
100
101   Toggle compilation of librte_pmd_cxgbe driver.
102
103   .. note::
104
105      This controls compilation of both CXGBE and CXGBEVF PMD.
106
107 Runtime Options
108 ~~~~~~~~~~~~~~~
109
110 The following ``devargs`` options can be enabled at runtime. They must
111 be passed as part of EAL arguments. For example,
112
113 .. code-block:: console
114
115    testpmd -w 02:00.4,keep_ovlan=1 -- -i
116
117 Common Runtime Options
118 ^^^^^^^^^^^^^^^^^^^^^^
119
120 - ``keep_ovlan`` (default **0**)
121
122   Toggle behavior to keep/strip outer VLAN in Q-in-Q packets. If
123   enabled, the outer VLAN tag is preserved in Q-in-Q packets. Otherwise,
124   the outer VLAN tag is stripped in Q-in-Q packets.
125
126 - ``tx_mode_latency`` (default **0**)
127
128   When set to 1, Tx doesn't wait for max number of packets to get
129   coalesced and sends the packets immediately at the end of the
130   current Tx burst. When set to 0, Tx waits across multiple Tx bursts
131   until the max number of packets have been coalesced. In this case,
132   Tx only sends the coalesced packets to hardware once the max
133   coalesce limit has been reached.
134
135 CXGBE VF Only Runtime Options
136 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
137
138 - ``force_link_up`` (default **0**)
139
140   When set to 1, CXGBEVF PMD always forces link as up for all VFs on
141   underlying Chelsio NICs. This enables multiple VFs on the same NIC
142   to send traffic to each other even when the physical link is down.
143
144 CXGBE PF Only Runtime Options
145 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
146
147 - ``filtermode`` (default **0**)
148
149   Apart from the 4-tuple (IP src/dst addresses and TCP/UDP src/dst port
150   addresses), there are only 40-bits available to match other fields in
151   packet headers. So, ``filtermode`` devarg allows user to dynamically
152   select a 40-bit supported match field combination for LETCAM (wildcard)
153   filters.
154
155   Default value of **0** makes driver pick the combination configured in
156   the firmware configuration file on the adapter.
157
158   The supported flags and their corresponding values are shown in table below.
159   These flags can be OR'd to create 1 of the multiple supported combinations
160   for LETCAM filters.
161
162         ==================      ======
163         FLAG                    VALUE
164         ==================      ======
165         Physical Port           0x1
166         PFVF                    0x2
167         Destination MAC         0x4
168         Ethertype               0x8
169         Inner VLAN              0x10
170         Outer VLAN              0x20
171         IP TOS                  0x40
172         IP Protocol             0x80
173         ==================      ======
174
175   The supported ``filtermode`` combinations and their corresponding OR'd
176   values are shown in table below.
177
178         +-----------------------------------+-----------+
179         | FILTERMODE COMBINATIONS           |   VALUE   |
180         +===================================+===========+
181         | Protocol, TOS, Outer VLAN, Port   |     0xE1  |
182         +-----------------------------------+-----------+
183         | Protocol, TOS, Outer VLAN         |     0xE0  |
184         +-----------------------------------+-----------+
185         | Protocol, TOS, Inner VLAN, Port   |     0xD1  |
186         +-----------------------------------+-----------+
187         | Protocol, TOS, Inner VLAN         |     0xD0  |
188         +-----------------------------------+-----------+
189         | Protocol, TOS, PFVF, Port         |     0xC3  |
190         +-----------------------------------+-----------+
191         | Protocol, TOS, PFVF               |     0xC2  |
192         +-----------------------------------+-----------+
193         | Protocol, TOS, Port               |     0xC1  |
194         +-----------------------------------+-----------+
195         | Protocol, TOS                     |     0xC0  |
196         +-----------------------------------+-----------+
197         | Protocol, Outer VLAN, Port        |     0xA1  |
198         +-----------------------------------+-----------+
199         | Protocol, Outer VLAN              |     0xA0  |
200         +-----------------------------------+-----------+
201         | Protocol, Inner VLAN, Port        |     0x91  |
202         +-----------------------------------+-----------+
203         | Protocol, Inner VLAN              |     0x90  |
204         +-----------------------------------+-----------+
205         | Protocol, Ethertype, DstMAC, Port |     0x8D  |
206         +-----------------------------------+-----------+
207         | Protocol, Ethertype, DstMAC       |     0x8C  |
208         +-----------------------------------+-----------+
209         | Protocol, Ethertype, Port         |     0x89  |
210         +-----------------------------------+-----------+
211         | Protocol, Ethertype               |     0x88  |
212         +-----------------------------------+-----------+
213         | Protocol, DstMAC, PFVF, Port      |     0x87  |
214         +-----------------------------------+-----------+
215         | Protocol, DstMAC, PFVF            |     0x86  |
216         +-----------------------------------+-----------+
217         | Protocol, DstMAC, Port            |     0x85  |
218         +-----------------------------------+-----------+
219         | Protocol, DstMAC                  |     0x84  |
220         +-----------------------------------+-----------+
221         | Protocol, PFVF, Port              |     0x83  |
222         +-----------------------------------+-----------+
223         | Protocol, PFVF                    |     0x82  |
224         +-----------------------------------+-----------+
225         | Protocol, Port                    |     0x81  |
226         +-----------------------------------+-----------+
227         | Protocol                          |     0x80  |
228         +-----------------------------------+-----------+
229         | TOS, Outer VLAN, Port             |     0x61  |
230         +-----------------------------------+-----------+
231         | TOS, Outer VLAN                   |     0x60  |
232         +-----------------------------------+-----------+
233         | TOS, Inner VLAN, Port             |     0x51  |
234         +-----------------------------------+-----------+
235         | TOS, Inner VLAN                   |     0x50  |
236         +-----------------------------------+-----------+
237         | TOS, Ethertype, DstMAC, Port      |     0x4D  |
238         +-----------------------------------+-----------+
239         | TOS, Ethertype, DstMAC            |     0x4C  |
240         +-----------------------------------+-----------+
241         | TOS, Ethertype, Port              |     0x49  |
242         +-----------------------------------+-----------+
243         | TOS, Ethertype                    |     0x48  |
244         +-----------------------------------+-----------+
245         | TOS, DstMAC, PFVF, Port           |     0x47  |
246         +-----------------------------------+-----------+
247         | TOS, DstMAC, PFVF                 |     0x46  |
248         +-----------------------------------+-----------+
249         | TOS, DstMAC, Port                 |     0x45  |
250         +-----------------------------------+-----------+
251         | TOS, DstMAC                       |     0x44  |
252         +-----------------------------------+-----------+
253         | TOS, PFVF, Port                   |     0x43  |
254         +-----------------------------------+-----------+
255         | TOS, PFVF                         |     0x42  |
256         +-----------------------------------+-----------+
257         | TOS, Port                         |     0x41  |
258         +-----------------------------------+-----------+
259         | TOS                               |     0x40  |
260         +-----------------------------------+-----------+
261         | Outer VLAN, Inner VLAN, Port      |     0x31  |
262         +-----------------------------------+-----------+
263         | Outer VLAN, Ethertype, Port       |     0x29  |
264         +-----------------------------------+-----------+
265         | Outer VLAN, Ethertype             |     0x28  |
266         +-----------------------------------+-----------+
267         | Outer VLAN, DstMAC, Port          |     0x25  |
268         +-----------------------------------+-----------+
269         | Outer VLAN, DstMAC                |     0x24  |
270         +-----------------------------------+-----------+
271         | Outer VLAN, Port                  |     0x21  |
272         +-----------------------------------+-----------+
273         | Outer VLAN                        |     0x20  |
274         +-----------------------------------+-----------+
275         | Inner VLAN, Ethertype, Port       |     0x19  |
276         +-----------------------------------+-----------+
277         | Inner VLAN, Ethertype             |     0x18  |
278         +-----------------------------------+-----------+
279         | Inner VLAN, DstMAC, Port          |     0x15  |
280         +-----------------------------------+-----------+
281         | Inner VLAN, DstMAC                |     0x14  |
282         +-----------------------------------+-----------+
283         | Inner VLAN, Port                  |     0x11  |
284         +-----------------------------------+-----------+
285         | Inner VLAN                        |     0x10  |
286         +-----------------------------------+-----------+
287         | Ethertype, DstMAC, Port           |     0xD   |
288         +-----------------------------------+-----------+
289         | Ethertype, DstMAC                 |     0xC   |
290         +-----------------------------------+-----------+
291         | Ethertype, PFVF, Port             |     0xB   |
292         +-----------------------------------+-----------+
293         | Ethertype, PFVF                   |     0xA   |
294         +-----------------------------------+-----------+
295         | Ethertype, Port                   |     0x9   |
296         +-----------------------------------+-----------+
297         | Ethertype                         |     0x8   |
298         +-----------------------------------+-----------+
299         | DstMAC, PFVF, Port                |     0x7   |
300         +-----------------------------------+-----------+
301         | DstMAC, PFVF                      |     0x6   |
302         +-----------------------------------+-----------+
303         | DstMAC, Port                      |     0x5   |
304         +-----------------------------------+-----------+
305         | Destination MAC                   |     0x4   |
306         +-----------------------------------+-----------+
307         | PFVF, Port                        |     0x3   |
308         +-----------------------------------+-----------+
309         | PFVF                              |     0x2   |
310         +-----------------------------------+-----------+
311         | Physical Port                     |     0x1   +
312         +-----------------------------------+-----------+
313
314   For example, to enable matching ``ethertype`` field in Ethernet
315   header, and ``protocol`` field in IPv4 header, the ``filtermode``
316   combination must be given as:
317
318   .. code-block:: console
319
320      testpmd -w 02:00.4,filtermode=0x88 -- -i
321
322 - ``filtermask`` (default **0**)
323
324   ``filtermask`` devarg works similar to ``filtermode``, but is used
325   to configure a filter mode combination for HASH (exact-match) filters.
326
327   .. note::
328
329      The combination chosen for ``filtermask`` devarg **must be a subset** of
330      the combination chosen for ``filtermode`` devarg.
331
332   Default value of **0** makes driver pick the combination configured in
333   the firmware configuration file on the adapter.
334
335   Note that the filter rule will only be inserted in HASH region, if the
336   rule contains **all** the fields specified in the ``filtermask`` combination.
337   Otherwise, the filter rule will get inserted in LETCAM region.
338
339   The same combination list explained in the tables in ``filtermode`` devarg
340   section earlier applies for ``filtermask`` devarg, as well.
341
342   For example, to enable matching only protocol field in IPv4 header, the
343   ``filtermask`` combination must be given as:
344
345   .. code-block:: console
346
347      testpmd -w 02:00.4,filtermode=0x88,filtermask=0x80 -- -i
348
349 .. _driver-compilation:
350
351 Driver compilation and testing
352 ------------------------------
353
354 Refer to the document :ref:`compiling and testing a PMD for a NIC <pmd_build_and_test>`
355 for details.
356
357 Linux
358 -----
359
360 .. _linux-installation:
361
362 Linux Installation
363 ~~~~~~~~~~~~~~~~~~
364
365 Steps to manually install the latest firmware from the downloaded Chelsio
366 Unified Wire package for Linux operating system are as follows:
367
368 #. Load the kernel module:
369
370    .. code-block:: console
371
372       modprobe cxgb4
373
374 #. Use ifconfig to get the interface name assigned to Chelsio card:
375
376    .. code-block:: console
377
378       ifconfig -a | grep "00:07:43"
379
380    Example output:
381
382    .. code-block:: console
383
384       p1p1      Link encap:Ethernet  HWaddr 00:07:43:2D:EA:C0
385       p1p2      Link encap:Ethernet  HWaddr 00:07:43:2D:EA:C8
386
387 #. Install cxgbtool:
388
389    .. code-block:: console
390
391       cd <path_to_uwire>/tools/cxgbtool
392       make install
393
394 #. Use cxgbtool to load the firmware config file onto the card:
395
396    .. code-block:: console
397
398       cxgbtool p1p1 loadcfg <path_to_uwire>/src/network/firmware/t5-config.txt
399
400 #. Use cxgbtool to load the firmware image onto the card:
401
402    .. code-block:: console
403
404       cxgbtool p1p1 loadfw <path_to_uwire>/src/network/firmware/t5fw-*.bin
405
406 #. Unload and reload the kernel module:
407
408    .. code-block:: console
409
410       modprobe -r cxgb4
411       modprobe cxgb4
412
413 #. Verify with ethtool:
414
415    .. code-block:: console
416
417       ethtool -i p1p1 | grep "firmware"
418
419    Example output:
420
421    .. code-block:: console
422
423       firmware-version: 1.24.11.0, TP 0.1.23.2
424
425 Running testpmd
426 ~~~~~~~~~~~~~~~
427
428 This section demonstrates how to launch **testpmd** with Chelsio
429 devices managed by librte_pmd_cxgbe in Linux operating system.
430
431 #. Load the kernel module:
432
433    .. code-block:: console
434
435       modprobe cxgb4
436
437 #. Get the PCI bus addresses of the interfaces bound to cxgb4 driver:
438
439    .. code-block:: console
440
441       dmesg | tail -2
442
443    Example output:
444
445    .. code-block:: console
446
447       cxgb4 0000:02:00.4 p1p1: renamed from eth0
448       cxgb4 0000:02:00.4 p1p2: renamed from eth1
449
450    .. note::
451
452       Both the interfaces of a Chelsio 2-port adapter are bound to the
453       same PCI bus address.
454
455 #. Unload the kernel module:
456
457    .. code-block:: console
458
459       modprobe -ar cxgb4 csiostor
460
461 #. Running testpmd
462
463    Follow instructions available in the document
464    :ref:`compiling and testing a PMD for a NIC <pmd_build_and_test>`
465    to run testpmd.
466
467    .. note::
468
469       Currently, CXGBE PMD only supports the binding of PF4 for Chelsio NICs.
470
471    Example output:
472
473    .. code-block:: console
474
475       [...]
476       EAL: PCI device 0000:02:00.4 on NUMA socket -1
477       EAL:   probe driver: 1425:5401 rte_cxgbe_pmd
478       EAL:   PCI memory mapped at 0x7fd7c0200000
479       EAL:   PCI memory mapped at 0x7fd77cdfd000
480       EAL:   PCI memory mapped at 0x7fd7c10b7000
481       PMD: rte_cxgbe_pmd: fw: 1.24.11.0, TP: 0.1.23.2
482       PMD: rte_cxgbe_pmd: Coming up as MASTER: Initializing adapter
483       Interactive-mode selected
484       Configuring Port 0 (socket 0)
485       Port 0: 00:07:43:2D:EA:C0
486       Configuring Port 1 (socket 0)
487       Port 1: 00:07:43:2D:EA:C8
488       Checking link statuses...
489       PMD: rte_cxgbe_pmd: Port0: passive DA port module inserted
490       PMD: rte_cxgbe_pmd: Port1: passive DA port module inserted
491       Port 0 Link Up - speed 10000 Mbps - full-duplex
492       Port 1 Link Up - speed 10000 Mbps - full-duplex
493       Done
494       testpmd>
495
496    .. note::
497
498       Flow control pause TX/RX is disabled by default and can be enabled via
499       testpmd. Refer section :ref:`flow-control` for more details.
500
501 Configuring SR-IOV Virtual Functions
502 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
503
504 This section demonstrates how to enable SR-IOV virtual functions
505 on Chelsio NICs and demonstrates how to run testpmd with SR-IOV
506 virtual functions.
507
508 #. Load the kernel module:
509
510    .. code-block:: console
511
512       modprobe cxgb4
513
514 #. Get the PCI bus addresses of the interfaces bound to cxgb4 driver:
515
516    .. code-block:: console
517
518       dmesg | tail -2
519
520    Example output:
521
522    .. code-block:: console
523
524       cxgb4 0000:02:00.4 p1p1: renamed from eth0
525       cxgb4 0000:02:00.4 p1p2: renamed from eth1
526
527    .. note::
528
529       Both the interfaces of a Chelsio 2-port adapter are bound to the
530       same PCI bus address.
531
532 #. Use ifconfig to get the interface name assigned to Chelsio card:
533
534    .. code-block:: console
535
536       ifconfig -a | grep "00:07:43"
537
538    Example output:
539
540    .. code-block:: console
541
542       p1p1      Link encap:Ethernet  HWaddr 00:07:43:2D:EA:C0
543       p1p2      Link encap:Ethernet  HWaddr 00:07:43:2D:EA:C8
544
545 #. Bring up the interfaces:
546
547    .. code-block:: console
548
549       ifconfig p1p1 up
550       ifconfig p1p2 up
551
552 #. Instantiate SR-IOV Virtual Functions. PF0..3 can be used for
553    SR-IOV VFs. Multiple VFs can be instantiated on each of PF0..3.
554    To instantiate one SR-IOV VF on each PF0 and PF1:
555
556    .. code-block:: console
557
558       echo 1 > /sys/bus/pci/devices/0000\:02\:00.0/sriov_numvfs
559       echo 1 > /sys/bus/pci/devices/0000\:02\:00.1/sriov_numvfs
560
561 #. Get the PCI bus addresses of the virtual functions:
562
563    .. code-block:: console
564
565       lspci | grep -i "Chelsio" | grep -i "VF"
566
567    Example output:
568
569    .. code-block:: console
570
571       02:01.0 Ethernet controller: Chelsio Communications Inc T540-CR Unified Wire Ethernet Controller [VF]
572       02:01.1 Ethernet controller: Chelsio Communications Inc T540-CR Unified Wire Ethernet Controller [VF]
573
574 #. Running testpmd
575
576    Follow instructions available in the document
577    :ref:`compiling and testing a PMD for a NIC <pmd_build_and_test>`
578    to bind virtual functions and run testpmd.
579
580    Example output:
581
582    .. code-block:: console
583
584       [...]
585       EAL: PCI device 0000:02:01.0 on NUMA socket 0
586       EAL:   probe driver: 1425:5803 net_cxgbevf
587       PMD: rte_cxgbe_pmd: Firmware version: 1.24.11.0
588       PMD: rte_cxgbe_pmd: TP Microcode version: 0.1.23.2
589       PMD: rte_cxgbe_pmd: Chelsio rev 0
590       PMD: rte_cxgbe_pmd: No bootstrap loaded
591       PMD: rte_cxgbe_pmd: No Expansion ROM loaded
592       PMD: rte_cxgbe_pmd:  0000:02:01.0 Chelsio rev 0 1G/10GBASE-SFP
593       EAL: PCI device 0000:02:01.1 on NUMA socket 0
594       EAL:   probe driver: 1425:5803 net_cxgbevf
595       PMD: rte_cxgbe_pmd: Firmware version: 1.24.11.0
596       PMD: rte_cxgbe_pmd: TP Microcode version: 0.1.23.2
597       PMD: rte_cxgbe_pmd: Chelsio rev 0
598       PMD: rte_cxgbe_pmd: No bootstrap loaded
599       PMD: rte_cxgbe_pmd: No Expansion ROM loaded
600       PMD: rte_cxgbe_pmd:  0000:02:01.1 Chelsio rev 0 1G/10GBASE-SFP
601       Configuring Port 0 (socket 0)
602       Port 0: 06:44:29:44:40:00
603       Configuring Port 1 (socket 0)
604       Port 1: 06:44:29:44:40:10
605       Checking link statuses...
606       Done
607       testpmd>
608
609 FreeBSD
610 -------
611
612 .. _freebsd-installation:
613
614 FreeBSD Installation
615 ~~~~~~~~~~~~~~~~~~~~
616
617 Steps to manually install the latest firmware from the downloaded Chelsio
618 Unified Wire package for FreeBSD operating system are as follows:
619
620 #. Load the kernel module:
621
622    .. code-block:: console
623
624       kldload if_cxgbe
625
626 #. Use dmesg to get the t5nex instance assigned to the Chelsio card:
627
628    .. code-block:: console
629
630       dmesg | grep "t5nex"
631
632    Example output:
633
634    .. code-block:: console
635
636       t5nex0: <Chelsio T520-CR> irq 16 at device 0.4 on pci2
637       cxl0: <port 0> on t5nex0
638       cxl1: <port 1> on t5nex0
639       t5nex0: PCIe x8, 2 ports, 14 MSI-X interrupts, 31 eq, 13 iq
640
641    In the example above, a Chelsio T520-CR card is bound to a t5nex0 instance.
642
643 #. Install cxgbetool from FreeBSD source repository:
644
645    .. code-block:: console
646
647       cd <path_to_FreeBSD_source>/tools/tools/cxgbetool/
648       make && make install
649
650 #. Use cxgbetool to load the firmware image onto the card:
651
652    .. code-block:: console
653
654       cxgbetool t5nex0 loadfw <path_to_uwire>/src/network/firmware/t5fw-*.bin
655
656 #. Unload and reload the kernel module:
657
658    .. code-block:: console
659
660       kldunload if_cxgbe
661       kldload if_cxgbe
662
663 #. Verify with sysctl:
664
665    .. code-block:: console
666
667       sysctl -a | grep "t5nex" | grep "firmware"
668
669    Example output:
670
671    .. code-block:: console
672
673       dev.t5nex.0.firmware_version: 1.24.11.0
674
675 Running testpmd
676 ~~~~~~~~~~~~~~~
677
678 This section demonstrates how to launch **testpmd** with Chelsio
679 devices managed by librte_pmd_cxgbe in FreeBSD operating system.
680
681 #. Change to DPDK source directory where the target has been compiled in
682    section :ref:`driver-compilation`:
683
684    .. code-block:: console
685
686       cd <DPDK-source-directory>
687
688 #. Copy the contigmem kernel module to /boot/kernel directory:
689
690    .. code-block:: console
691
692       cp x86_64-native-freebsd-clang/kmod/contigmem.ko /boot/kernel/
693
694 #. Add the following lines to /boot/loader.conf:
695
696    .. code-block:: console
697
698       # reserve 2 x 1G blocks of contiguous memory using contigmem driver
699       hw.contigmem.num_buffers=2
700       hw.contigmem.buffer_size=1073741824
701       # load contigmem module during boot process
702       contigmem_load="YES"
703
704    The above lines load the contigmem kernel module during boot process and
705    allocate 2 x 1G blocks of contiguous memory to be used for DPDK later on.
706    This is to avoid issues with potential memory fragmentation during later
707    system up time, which may result in failure of allocating the contiguous
708    memory required for the contigmem kernel module.
709
710 #. Restart the system and ensure the contigmem module is loaded successfully:
711
712    .. code-block:: console
713
714       reboot
715       kldstat | grep "contigmem"
716
717    Example output:
718
719    .. code-block:: console
720
721       2    1 0xffffffff817f1000 3118     contigmem.ko
722
723 #. Repeat step 1 to ensure that you are in the DPDK source directory.
724
725 #. Load the cxgbe kernel module:
726
727    .. code-block:: console
728
729       kldload if_cxgbe
730
731 #. Get the PCI bus addresses of the interfaces bound to t5nex driver:
732
733    .. code-block:: console
734
735       pciconf -l | grep "t5nex"
736
737    Example output:
738
739    .. code-block:: console
740
741       t5nex0@pci0:2:0:4: class=0x020000 card=0x00001425 chip=0x54011425 rev=0x00
742
743    In the above example, the t5nex0 is bound to 2:0:4 bus address.
744
745    .. note::
746
747       Both the interfaces of a Chelsio 2-port adapter are bound to the
748       same PCI bus address.
749
750 #. Unload the kernel module:
751
752    .. code-block:: console
753
754       kldunload if_cxgbe
755
756 #. Set the PCI bus addresses to hw.nic_uio.bdfs kernel environment parameter:
757
758    .. code-block:: console
759
760       kenv hw.nic_uio.bdfs="2:0:4"
761
762    This automatically binds 2:0:4 to nic_uio kernel driver when it is loaded in
763    the next step.
764
765    .. note::
766
767       Currently, CXGBE PMD only supports the binding of PF4 for Chelsio NICs.
768
769 #. Load nic_uio kernel driver:
770
771    .. code-block:: console
772
773       kldload ./x86_64-native-freebsd-clang/kmod/nic_uio.ko
774
775 #. Start testpmd with basic parameters:
776
777    .. code-block:: console
778
779       ./x86_64-native-freebsd-clang/app/testpmd -l 0-3 -n 4 -w 0000:02:00.4 -- -i
780
781    Example output:
782
783    .. code-block:: console
784
785       [...]
786       EAL: PCI device 0000:02:00.4 on NUMA socket 0
787       EAL:   probe driver: 1425:5401 rte_cxgbe_pmd
788       EAL:   PCI memory mapped at 0x8007ec000
789       EAL:   PCI memory mapped at 0x842800000
790       EAL:   PCI memory mapped at 0x80086c000
791       PMD: rte_cxgbe_pmd: fw: 1.24.11.0, TP: 0.1.23.2
792       PMD: rte_cxgbe_pmd: Coming up as MASTER: Initializing adapter
793       Interactive-mode selected
794       Configuring Port 0 (socket 0)
795       Port 0: 00:07:43:2D:EA:C0
796       Configuring Port 1 (socket 0)
797       Port 1: 00:07:43:2D:EA:C8
798       Checking link statuses...
799       PMD: rte_cxgbe_pmd: Port0: passive DA port module inserted
800       PMD: rte_cxgbe_pmd: Port1: passive DA port module inserted
801       Port 0 Link Up - speed 10000 Mbps - full-duplex
802       Port 1 Link Up - speed 10000 Mbps - full-duplex
803       Done
804       testpmd>
805
806 .. note::
807
808    Flow control pause TX/RX is disabled by default and can be enabled via
809    testpmd. Refer section :ref:`flow-control` for more details.
810
811 Sample Application Notes
812 ------------------------
813
814 .. _flow-control:
815
816 Enable/Disable Flow Control
817 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
818
819 Flow control pause TX/RX is disabled by default and can be enabled via
820 testpmd as follows:
821
822 .. code-block:: console
823
824    testpmd> set flow_ctrl rx on tx on 0 0 0 0 mac_ctrl_frame_fwd off autoneg on 0
825    testpmd> set flow_ctrl rx on tx on 0 0 0 0 mac_ctrl_frame_fwd off autoneg on 1
826
827 To disable again, run:
828
829 .. code-block:: console
830
831    testpmd> set flow_ctrl rx off tx off 0 0 0 0 mac_ctrl_frame_fwd off autoneg off 0
832    testpmd> set flow_ctrl rx off tx off 0 0 0 0 mac_ctrl_frame_fwd off autoneg off 1
833
834 Jumbo Mode
835 ~~~~~~~~~~
836
837 There are two ways to enable sending and receiving of jumbo frames via testpmd.
838 One method involves using the **mtu** command, which changes the mtu of an
839 individual port without having to stop the selected port. Another method
840 involves stopping all the ports first and then running **max-pkt-len** command
841 to configure the mtu of all the ports with a single command.
842
843 - To configure each port individually, run the mtu command as follows:
844
845   .. code-block:: console
846
847      testpmd> port config mtu 0 9000
848      testpmd> port config mtu 1 9000
849
850 - To configure all the ports at once, stop all the ports first and run the
851   max-pkt-len command as follows:
852
853   .. code-block:: console
854
855      testpmd> port stop all
856      testpmd> port config all max-pkt-len 9000