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