summaryrefslogtreecommitdiffstats
path: root/src/spdk/dpdk/doc/guides/nics/cxgbe.rst
blob: 54a4c138998c58f15d4af3863d971aa1fa8ad916 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
.. SPDX-License-Identifier: BSD-3-Clause
   Copyright(c) 2014-2018 Chelsio Communications.
   All rights reserved.

CXGBE Poll Mode Driver
======================

The CXGBE PMD (**librte_pmd_cxgbe**) provides poll mode driver support
for **Chelsio Terminator** 10/25/40/100 Gbps family of adapters. CXGBE PMD
has support for the latest Linux and FreeBSD operating systems.

CXGBEVF PMD provides poll mode driver support for SR-IOV Virtual functions
and has support for the latest Linux operating systems.

More information can be found at `Chelsio Communications Official Website
<http://www.chelsio.com>`_.

Features
--------

CXGBE and CXGBEVF PMD has support for:

- Multiple queues for TX and RX
- Receiver Side Steering (RSS)
  Receiver Side Steering (RSS) on IPv4, IPv6, IPv4-TCP/UDP, IPv6-TCP/UDP.
  For 4-tuple, enabling 'RSS on TCP' and 'RSS on TCP + UDP' is supported.
- VLAN filtering
- Checksum offload
- Promiscuous mode
- All multicast mode
- Port hardware statistics
- Jumbo frames
- Flow API - Support for both Wildcard (LE-TCAM) and Exact (HASH) match filters.

Limitations
-----------

The Chelsio Terminator series of devices provide two/four ports but
expose a single PCI bus address, thus, librte_pmd_cxgbe registers
itself as a PCI driver that allocates one Ethernet device per detected
port.

For this reason, one cannot whitelist/blacklist a single port without
whitelisting/blacklisting the other ports on the same device.

.. _t5-nics:

Supported Chelsio T5 NICs
-------------------------

- 1G NICs: T502-BT
- 10G NICs: T520-BT, T520-CR, T520-LL-CR, T520-SO-CR, T540-CR
- 40G NICs: T580-CR, T580-LP-CR, T580-SO-CR
- Other T5 NICs: T522-CR

.. _t6-nics:

Supported Chelsio T6 NICs
-------------------------

- 25G NICs: T6425-CR, T6225-CR, T6225-LL-CR, T6225-SO-CR
- 100G NICs: T62100-CR, T62100-LP-CR, T62100-SO-CR

Supported SR-IOV Chelsio NICs
-----------------------------

SR-IOV virtual functions are supported on all the Chelsio NICs listed
in :ref:`t5-nics` and :ref:`t6-nics`.

Prerequisites
-------------

- Requires firmware version **1.24.11.0** and higher. Visit
  `Chelsio Download Center <http://service.chelsio.com>`_ to get latest firmware
  bundled with the latest Chelsio Unified Wire package.

  For Linux, installing and loading the latest cxgb4 kernel driver from the
  Chelsio Unified Wire package should get you the latest firmware. More
  information can be obtained from the User Guide that is bundled with the
  Chelsio Unified Wire package.

  For FreeBSD, the latest firmware obtained from the Chelsio Unified Wire
  package must be manually flashed via cxgbetool available in FreeBSD source
  repository.

  Instructions on how to manually flash the firmware are given in section
  :ref:`linux-installation` for Linux and section :ref:`freebsd-installation`
  for FreeBSD.

Pre-Installation Configuration
------------------------------

Config File Options
~~~~~~~~~~~~~~~~~~~

The following options can be modified in the ``.config`` file. Please note that
enabling debugging options may affect system performance.

- ``CONFIG_RTE_LIBRTE_CXGBE_PMD`` (default **y**)

  Toggle compilation of librte_pmd_cxgbe driver.

  .. note::

     This controls compilation of both CXGBE and CXGBEVF PMD.

Runtime Options
~~~~~~~~~~~~~~~

The following ``devargs`` options can be enabled at runtime. They must
be passed as part of EAL arguments. For example,

.. code-block:: console

   testpmd -w 02:00.4,keep_ovlan=1 -- -i

Common Runtime Options
^^^^^^^^^^^^^^^^^^^^^^

- ``keep_ovlan`` (default **0**)

  Toggle behavior to keep/strip outer VLAN in Q-in-Q packets. If
  enabled, the outer VLAN tag is preserved in Q-in-Q packets. Otherwise,
  the outer VLAN tag is stripped in Q-in-Q packets.

- ``tx_mode_latency`` (default **0**)

  When set to 1, Tx doesn't wait for max number of packets to get
  coalesced and sends the packets immediately at the end of the
  current Tx burst. When set to 0, Tx waits across multiple Tx bursts
  until the max number of packets have been coalesced. In this case,
  Tx only sends the coalesced packets to hardware once the max
  coalesce limit has been reached.

CXGBE VF Only Runtime Options
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

- ``force_link_up`` (default **0**)

  When set to 1, CXGBEVF PMD always forces link as up for all VFs on
  underlying Chelsio NICs. This enables multiple VFs on the same NIC
  to send traffic to each other even when the physical link is down.

CXGBE PF Only Runtime Options
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

- ``filtermode`` (default **0**)

  Apart from the 4-tuple (IP src/dst addresses and TCP/UDP src/dst port
  addresses), there are only 40-bits available to match other fields in
  packet headers. So, ``filtermode`` devarg allows user to dynamically
  select a 40-bit supported match field combination for LETCAM (wildcard)
  filters.

  Default value of **0** makes driver pick the combination configured in
  the firmware configuration file on the adapter.

  The supported flags and their corresponding values are shown in table below.
  These flags can be OR'd to create 1 of the multiple supported combinations
  for LETCAM filters.

        ==================      ======
        FLAG                    VALUE
        ==================      ======
        Physical Port           0x1
        PFVF                    0x2
        Destination MAC         0x4
        Ethertype               0x8
        Inner VLAN              0x10
        Outer VLAN              0x20
        IP TOS                  0x40
        IP Protocol             0x80
        ==================      ======

  The supported ``filtermode`` combinations and their corresponding OR'd
  values are shown in table below.

        +-----------------------------------+-----------+
        | FILTERMODE COMBINATIONS           |   VALUE   |
        +===================================+===========+
        | Protocol, TOS, Outer VLAN, Port   |     0xE1  |
        +-----------------------------------+-----------+
        | Protocol, TOS, Outer VLAN         |     0xE0  |
        +-----------------------------------+-----------+
        | Protocol, TOS, Inner VLAN, Port   |     0xD1  |
        +-----------------------------------+-----------+
        | Protocol, TOS, Inner VLAN         |     0xD0  |
        +-----------------------------------+-----------+
        | Protocol, TOS, PFVF, Port         |     0xC3  |
        +-----------------------------------+-----------+
        | Protocol, TOS, PFVF               |     0xC2  |
        +-----------------------------------+-----------+
        | Protocol, TOS, Port               |     0xC1  |
        +-----------------------------------+-----------+
        | Protocol, TOS                     |     0xC0  |
        +-----------------------------------+-----------+
        | Protocol, Outer VLAN, Port        |     0xA1  |
        +-----------------------------------+-----------+
        | Protocol, Outer VLAN              |     0xA0  |
        +-----------------------------------+-----------+
        | Protocol, Inner VLAN, Port        |     0x91  |
        +-----------------------------------+-----------+
        | Protocol, Inner VLAN              |     0x90  |
        +-----------------------------------+-----------+
        | Protocol, Ethertype, DstMAC, Port |     0x8D  |
        +-----------------------------------+-----------+
        | Protocol, Ethertype, DstMAC       |     0x8C  |
        +-----------------------------------+-----------+
        | Protocol, Ethertype, Port         |     0x89  |
        +-----------------------------------+-----------+
        | Protocol, Ethertype               |     0x88  |
        +-----------------------------------+-----------+
        | Protocol, DstMAC, PFVF, Port      |     0x87  |
        +-----------------------------------+-----------+
        | Protocol, DstMAC, PFVF            |     0x86  |
        +-----------------------------------+-----------+
        | Protocol, DstMAC, Port            |     0x85  |
        +-----------------------------------+-----------+
        | Protocol, DstMAC                  |     0x84  |
        +-----------------------------------+-----------+
        | Protocol, PFVF, Port              |     0x83  |
        +-----------------------------------+-----------+
        | Protocol, PFVF                    |     0x82  |
        +-----------------------------------+-----------+
        | Protocol, Port                    |     0x81  |
        +-----------------------------------+-----------+
        | Protocol                          |     0x80  |
        +-----------------------------------+-----------+
        | TOS, Outer VLAN, Port             |     0x61  |
        +-----------------------------------+-----------+
        | TOS, Outer VLAN                   |     0x60  |
        +-----------------------------------+-----------+
        | TOS, Inner VLAN, Port             |     0x51  |
        +-----------------------------------+-----------+
        | TOS, Inner VLAN                   |     0x50  |
        +-----------------------------------+-----------+
        | TOS, Ethertype, DstMAC, Port      |     0x4D  |
        +-----------------------------------+-----------+
        | TOS, Ethertype, DstMAC            |     0x4C  |
        +-----------------------------------+-----------+
        | TOS, Ethertype, Port              |     0x49  |
        +-----------------------------------+-----------+
        | TOS, Ethertype                    |     0x48  |
        +-----------------------------------+-----------+
        | TOS, DstMAC, PFVF, Port           |     0x47  |
        +-----------------------------------+-----------+
        | TOS, DstMAC, PFVF                 |     0x46  |
        +-----------------------------------+-----------+
        | TOS, DstMAC, Port                 |     0x45  |
        +-----------------------------------+-----------+
        | TOS, DstMAC                       |     0x44  |
        +-----------------------------------+-----------+
        | TOS, PFVF, Port                   |     0x43  |
        +-----------------------------------+-----------+
        | TOS, PFVF                         |     0x42  |
        +-----------------------------------+-----------+
        | TOS, Port                         |     0x41  |
        +-----------------------------------+-----------+
        | TOS                               |     0x40  |
        +-----------------------------------+-----------+
        | Outer VLAN, Inner VLAN, Port      |     0x31  |
        +-----------------------------------+-----------+
        | Outer VLAN, Ethertype, Port       |     0x29  |
        +-----------------------------------+-----------+
        | Outer VLAN, Ethertype             |     0x28  |
        +-----------------------------------+-----------+
        | Outer VLAN, DstMAC, Port          |     0x25  |
        +-----------------------------------+-----------+
        | Outer VLAN, DstMAC                |     0x24  |
        +-----------------------------------+-----------+
        | Outer VLAN, Port                  |     0x21  |
        +-----------------------------------+-----------+
        | Outer VLAN                        |     0x20  |
        +-----------------------------------+-----------+
        | Inner VLAN, Ethertype, Port       |     0x19  |
        +-----------------------------------+-----------+
        | Inner VLAN, Ethertype             |     0x18  |
        +-----------------------------------+-----------+
        | Inner VLAN, DstMAC, Port          |     0x15  |
        +-----------------------------------+-----------+
        | Inner VLAN, DstMAC                |     0x14  |
        +-----------------------------------+-----------+
        | Inner VLAN, Port                  |     0x11  |
        +-----------------------------------+-----------+
        | Inner VLAN                        |     0x10  |
        +-----------------------------------+-----------+
        | Ethertype, DstMAC, Port           |     0xD   |
        +-----------------------------------+-----------+
        | Ethertype, DstMAC                 |     0xC   |
        +-----------------------------------+-----------+
        | Ethertype, PFVF, Port             |     0xB   |
        +-----------------------------------+-----------+
        | Ethertype, PFVF                   |     0xA   |
        +-----------------------------------+-----------+
        | Ethertype, Port                   |     0x9   |
        +-----------------------------------+-----------+
        | Ethertype                         |     0x8   |
        +-----------------------------------+-----------+
        | DstMAC, PFVF, Port                |     0x7   |
        +-----------------------------------+-----------+
        | DstMAC, PFVF                      |     0x6   |
        +-----------------------------------+-----------+
        | DstMAC, Port                      |     0x5   |
        +-----------------------------------+-----------+
        | Destination MAC                   |     0x4   |
        +-----------------------------------+-----------+
        | PFVF, Port                        |     0x3   |
        +-----------------------------------+-----------+
        | PFVF                              |     0x2   |
        +-----------------------------------+-----------+
        | Physical Port                     |     0x1   +
        +-----------------------------------+-----------+

  For example, to enable matching ``ethertype`` field in Ethernet
  header, and ``protocol`` field in IPv4 header, the ``filtermode``
  combination must be given as:

  .. code-block:: console

     testpmd -w 02:00.4,filtermode=0x88 -- -i

- ``filtermask`` (default **0**)

  ``filtermask`` devarg works similar to ``filtermode``, but is used
  to configure a filter mode combination for HASH (exact-match) filters.

  .. note::

     The combination chosen for ``filtermask`` devarg **must be a subset** of
     the combination chosen for ``filtermode`` devarg.

  Default value of **0** makes driver pick the combination configured in
  the firmware configuration file on the adapter.

  Note that the filter rule will only be inserted in HASH region, if the
  rule contains **all** the fields specified in the ``filtermask`` combination.
  Otherwise, the filter rule will get inserted in LETCAM region.

  The same combination list explained in the tables in ``filtermode`` devarg
  section earlier applies for ``filtermask`` devarg, as well.

  For example, to enable matching only protocol field in IPv4 header, the
  ``filtermask`` combination must be given as:

  .. code-block:: console

     testpmd -w 02:00.4,filtermode=0x88,filtermask=0x80 -- -i

.. _driver-compilation:

Driver compilation and testing
------------------------------

Refer to the document :ref:`compiling and testing a PMD for a NIC <pmd_build_and_test>`
for details.

Linux
-----

.. _linux-installation:

Linux Installation
~~~~~~~~~~~~~~~~~~

Steps to manually install the latest firmware from the downloaded Chelsio
Unified Wire package for Linux operating system are as follows:

#. Load the kernel module:

   .. code-block:: console

      modprobe cxgb4

#. Use ifconfig to get the interface name assigned to Chelsio card:

   .. code-block:: console

      ifconfig -a | grep "00:07:43"

   Example output:

   .. code-block:: console

      p1p1      Link encap:Ethernet  HWaddr 00:07:43:2D:EA:C0
      p1p2      Link encap:Ethernet  HWaddr 00:07:43:2D:EA:C8

#. Install cxgbtool:

   .. code-block:: console

      cd <path_to_uwire>/tools/cxgbtool
      make install

#. Use cxgbtool to load the firmware config file onto the card:

   .. code-block:: console

      cxgbtool p1p1 loadcfg <path_to_uwire>/src/network/firmware/t5-config.txt

#. Use cxgbtool to load the firmware image onto the card:

   .. code-block:: console

      cxgbtool p1p1 loadfw <path_to_uwire>/src/network/firmware/t5fw-*.bin

#. Unload and reload the kernel module:

   .. code-block:: console

      modprobe -r cxgb4
      modprobe cxgb4

#. Verify with ethtool:

   .. code-block:: console

      ethtool -i p1p1 | grep "firmware"

   Example output:

   .. code-block:: console

      firmware-version: 1.24.11.0, TP 0.1.23.2

Running testpmd
~~~~~~~~~~~~~~~

This section demonstrates how to launch **testpmd** with Chelsio
devices managed by librte_pmd_cxgbe in Linux operating system.

#. Load the kernel module:

   .. code-block:: console

      modprobe cxgb4

#. Get the PCI bus addresses of the interfaces bound to cxgb4 driver:

   .. code-block:: console

      dmesg | tail -2

   Example output:

   .. code-block:: console

      cxgb4 0000:02:00.4 p1p1: renamed from eth0
      cxgb4 0000:02:00.4 p1p2: renamed from eth1

   .. note::

      Both the interfaces of a Chelsio 2-port adapter are bound to the
      same PCI bus address.

#. Unload the kernel module:

   .. code-block:: console

      modprobe -ar cxgb4 csiostor

#. Running testpmd

   Follow instructions available in the document
   :ref:`compiling and testing a PMD for a NIC <pmd_build_and_test>`
   to run testpmd.

   .. note::

      Currently, CXGBE PMD only supports the binding of PF4 for Chelsio NICs.

   Example output:

   .. code-block:: console

      [...]
      EAL: PCI device 0000:02:00.4 on NUMA socket -1
      EAL:   probe driver: 1425:5401 rte_cxgbe_pmd
      EAL:   PCI memory mapped at 0x7fd7c0200000
      EAL:   PCI memory mapped at 0x7fd77cdfd000
      EAL:   PCI memory mapped at 0x7fd7c10b7000
      PMD: rte_cxgbe_pmd: fw: 1.24.11.0, TP: 0.1.23.2
      PMD: rte_cxgbe_pmd: Coming up as MASTER: Initializing adapter
      Interactive-mode selected
      Configuring Port 0 (socket 0)
      Port 0: 00:07:43:2D:EA:C0
      Configuring Port 1 (socket 0)
      Port 1: 00:07:43:2D:EA:C8
      Checking link statuses...
      PMD: rte_cxgbe_pmd: Port0: passive DA port module inserted
      PMD: rte_cxgbe_pmd: Port1: passive DA port module inserted
      Port 0 Link Up - speed 10000 Mbps - full-duplex
      Port 1 Link Up - speed 10000 Mbps - full-duplex
      Done
      testpmd>

   .. note::

      Flow control pause TX/RX is disabled by default and can be enabled via
      testpmd. Refer section :ref:`flow-control` for more details.

Configuring SR-IOV Virtual Functions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This section demonstrates how to enable SR-IOV virtual functions
on Chelsio NICs and demonstrates how to run testpmd with SR-IOV
virtual functions.

#. Load the kernel module:

   .. code-block:: console

      modprobe cxgb4

#. Get the PCI bus addresses of the interfaces bound to cxgb4 driver:

   .. code-block:: console

      dmesg | tail -2

   Example output:

   .. code-block:: console

      cxgb4 0000:02:00.4 p1p1: renamed from eth0
      cxgb4 0000:02:00.4 p1p2: renamed from eth1

   .. note::

      Both the interfaces of a Chelsio 2-port adapter are bound to the
      same PCI bus address.

#. Use ifconfig to get the interface name assigned to Chelsio card:

   .. code-block:: console

      ifconfig -a | grep "00:07:43"

   Example output:

   .. code-block:: console

      p1p1      Link encap:Ethernet  HWaddr 00:07:43:2D:EA:C0
      p1p2      Link encap:Ethernet  HWaddr 00:07:43:2D:EA:C8

#. Bring up the interfaces:

   .. code-block:: console

      ifconfig p1p1 up
      ifconfig p1p2 up

#. Instantiate SR-IOV Virtual Functions. PF0..3 can be used for
   SR-IOV VFs. Multiple VFs can be instantiated on each of PF0..3.
   To instantiate one SR-IOV VF on each PF0 and PF1:

   .. code-block:: console

      echo 1 > /sys/bus/pci/devices/0000\:02\:00.0/sriov_numvfs
      echo 1 > /sys/bus/pci/devices/0000\:02\:00.1/sriov_numvfs

#. Get the PCI bus addresses of the virtual functions:

   .. code-block:: console

      lspci | grep -i "Chelsio" | grep -i "VF"

   Example output:

   .. code-block:: console

      02:01.0 Ethernet controller: Chelsio Communications Inc T540-CR Unified Wire Ethernet Controller [VF]
      02:01.1 Ethernet controller: Chelsio Communications Inc T540-CR Unified Wire Ethernet Controller [VF]

#. Running testpmd

   Follow instructions available in the document
   :ref:`compiling and testing a PMD for a NIC <pmd_build_and_test>`
   to bind virtual functions and run testpmd.

   Example output:

   .. code-block:: console

      [...]
      EAL: PCI device 0000:02:01.0 on NUMA socket 0
      EAL:   probe driver: 1425:5803 net_cxgbevf
      PMD: rte_cxgbe_pmd: Firmware version: 1.24.11.0
      PMD: rte_cxgbe_pmd: TP Microcode version: 0.1.23.2
      PMD: rte_cxgbe_pmd: Chelsio rev 0
      PMD: rte_cxgbe_pmd: No bootstrap loaded
      PMD: rte_cxgbe_pmd: No Expansion ROM loaded
      PMD: rte_cxgbe_pmd:  0000:02:01.0 Chelsio rev 0 1G/10GBASE-SFP
      EAL: PCI device 0000:02:01.1 on NUMA socket 0
      EAL:   probe driver: 1425:5803 net_cxgbevf
      PMD: rte_cxgbe_pmd: Firmware version: 1.24.11.0
      PMD: rte_cxgbe_pmd: TP Microcode version: 0.1.23.2
      PMD: rte_cxgbe_pmd: Chelsio rev 0
      PMD: rte_cxgbe_pmd: No bootstrap loaded
      PMD: rte_cxgbe_pmd: No Expansion ROM loaded
      PMD: rte_cxgbe_pmd:  0000:02:01.1 Chelsio rev 0 1G/10GBASE-SFP
      Configuring Port 0 (socket 0)
      Port 0: 06:44:29:44:40:00
      Configuring Port 1 (socket 0)
      Port 1: 06:44:29:44:40:10
      Checking link statuses...
      Done
      testpmd>

FreeBSD
-------

.. _freebsd-installation:

FreeBSD Installation
~~~~~~~~~~~~~~~~~~~~

Steps to manually install the latest firmware from the downloaded Chelsio
Unified Wire package for FreeBSD operating system are as follows:

#. Load the kernel module:

   .. code-block:: console

      kldload if_cxgbe

#. Use dmesg to get the t5nex instance assigned to the Chelsio card:

   .. code-block:: console

      dmesg | grep "t5nex"

   Example output:

   .. code-block:: console

      t5nex0: <Chelsio T520-CR> irq 16 at device 0.4 on pci2
      cxl0: <port 0> on t5nex0
      cxl1: <port 1> on t5nex0
      t5nex0: PCIe x8, 2 ports, 14 MSI-X interrupts, 31 eq, 13 iq

   In the example above, a Chelsio T520-CR card is bound to a t5nex0 instance.

#. Install cxgbetool from FreeBSD source repository:

   .. code-block:: console

      cd <path_to_FreeBSD_source>/tools/tools/cxgbetool/
      make && make install

#. Use cxgbetool to load the firmware image onto the card:

   .. code-block:: console

      cxgbetool t5nex0 loadfw <path_to_uwire>/src/network/firmware/t5fw-*.bin

#. Unload and reload the kernel module:

   .. code-block:: console

      kldunload if_cxgbe
      kldload if_cxgbe

#. Verify with sysctl:

   .. code-block:: console

      sysctl -a | grep "t5nex" | grep "firmware"

   Example output:

   .. code-block:: console

      dev.t5nex.0.firmware_version: 1.24.11.0

Running testpmd
~~~~~~~~~~~~~~~

This section demonstrates how to launch **testpmd** with Chelsio
devices managed by librte_pmd_cxgbe in FreeBSD operating system.

#. Change to DPDK source directory where the target has been compiled in
   section :ref:`driver-compilation`:

   .. code-block:: console

      cd <DPDK-source-directory>

#. Copy the contigmem kernel module to /boot/kernel directory:

   .. code-block:: console

      cp x86_64-native-freebsd-clang/kmod/contigmem.ko /boot/kernel/

#. Add the following lines to /boot/loader.conf:

   .. code-block:: console

      # reserve 2 x 1G blocks of contiguous memory using contigmem driver
      hw.contigmem.num_buffers=2
      hw.contigmem.buffer_size=1073741824
      # load contigmem module during boot process
      contigmem_load="YES"

   The above lines load the contigmem kernel module during boot process and
   allocate 2 x 1G blocks of contiguous memory to be used for DPDK later on.
   This is to avoid issues with potential memory fragmentation during later
   system up time, which may result in failure of allocating the contiguous
   memory required for the contigmem kernel module.

#. Restart the system and ensure the contigmem module is loaded successfully:

   .. code-block:: console

      reboot
      kldstat | grep "contigmem"

   Example output:

   .. code-block:: console

      2    1 0xffffffff817f1000 3118     contigmem.ko

#. Repeat step 1 to ensure that you are in the DPDK source directory.

#. Load the cxgbe kernel module:

   .. code-block:: console

      kldload if_cxgbe

#. Get the PCI bus addresses of the interfaces bound to t5nex driver:

   .. code-block:: console

      pciconf -l | grep "t5nex"

   Example output:

   .. code-block:: console

      t5nex0@pci0:2:0:4: class=0x020000 card=0x00001425 chip=0x54011425 rev=0x00

   In the above example, the t5nex0 is bound to 2:0:4 bus address.

   .. note::

      Both the interfaces of a Chelsio 2-port adapter are bound to the
      same PCI bus address.

#. Unload the kernel module:

   .. code-block:: console

      kldunload if_cxgbe

#. Set the PCI bus addresses to hw.nic_uio.bdfs kernel environment parameter:

   .. code-block:: console

      kenv hw.nic_uio.bdfs="2:0:4"

   This automatically binds 2:0:4 to nic_uio kernel driver when it is loaded in
   the next step.

   .. note::

      Currently, CXGBE PMD only supports the binding of PF4 for Chelsio NICs.

#. Load nic_uio kernel driver:

   .. code-block:: console

      kldload ./x86_64-native-freebsd-clang/kmod/nic_uio.ko

#. Start testpmd with basic parameters:

   .. code-block:: console

      ./x86_64-native-freebsd-clang/app/testpmd -l 0-3 -n 4 -w 0000:02:00.4 -- -i

   Example output:

   .. code-block:: console

      [...]
      EAL: PCI device 0000:02:00.4 on NUMA socket 0
      EAL:   probe driver: 1425:5401 rte_cxgbe_pmd
      EAL:   PCI memory mapped at 0x8007ec000
      EAL:   PCI memory mapped at 0x842800000
      EAL:   PCI memory mapped at 0x80086c000
      PMD: rte_cxgbe_pmd: fw: 1.24.11.0, TP: 0.1.23.2
      PMD: rte_cxgbe_pmd: Coming up as MASTER: Initializing adapter
      Interactive-mode selected
      Configuring Port 0 (socket 0)
      Port 0: 00:07:43:2D:EA:C0
      Configuring Port 1 (socket 0)
      Port 1: 00:07:43:2D:EA:C8
      Checking link statuses...
      PMD: rte_cxgbe_pmd: Port0: passive DA port module inserted
      PMD: rte_cxgbe_pmd: Port1: passive DA port module inserted
      Port 0 Link Up - speed 10000 Mbps - full-duplex
      Port 1 Link Up - speed 10000 Mbps - full-duplex
      Done
      testpmd>

.. note::

   Flow control pause TX/RX is disabled by default and can be enabled via
   testpmd. Refer section :ref:`flow-control` for more details.

Sample Application Notes
------------------------

.. _flow-control:

Enable/Disable Flow Control
~~~~~~~~~~~~~~~~~~~~~~~~~~~

Flow control pause TX/RX is disabled by default and can be enabled via
testpmd as follows:

.. code-block:: console

   testpmd> set flow_ctrl rx on tx on 0 0 0 0 mac_ctrl_frame_fwd off autoneg on 0
   testpmd> set flow_ctrl rx on tx on 0 0 0 0 mac_ctrl_frame_fwd off autoneg on 1

To disable again, run:

.. code-block:: console

   testpmd> set flow_ctrl rx off tx off 0 0 0 0 mac_ctrl_frame_fwd off autoneg off 0
   testpmd> set flow_ctrl rx off tx off 0 0 0 0 mac_ctrl_frame_fwd off autoneg off 1

Jumbo Mode
~~~~~~~~~~

There are two ways to enable sending and receiving of jumbo frames via testpmd.
One method involves using the **mtu** command, which changes the mtu of an
individual port without having to stop the selected port. Another method
involves stopping all the ports first and then running **max-pkt-len** command
to configure the mtu of all the ports with a single command.

- To configure each port individually, run the mtu command as follows:

  .. code-block:: console

     testpmd> port config mtu 0 9000
     testpmd> port config mtu 1 9000

- To configure all the ports at once, stop all the ports first and run the
  max-pkt-len command as follows:

  .. code-block:: console

     testpmd> port stop all
     testpmd> port config all max-pkt-len 9000