2. CXGBE Poll Mode Driver

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

More information can be found at Chelsio Communications Official Website.

2.1. Features

CXGBE PMD has support for:

  • Multiple queues for TX and RX
  • Receiver Side Steering (RSS)
  • VLAN filtering
  • Checksum offload
  • Promiscuous mode
  • All multicast mode
  • Port hardware statistics
  • Jumbo frames

2.2. Limitations

The Chelsio T5 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.

2.3. 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

2.4. Prerequisites

  • Requires firmware version 1.13.32.0 and higher. Visit Chelsio Download Center 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 Linux Installation for Linux and section FreeBSD Installation for FreeBSD.

2.5. Pre-Installation Configuration

2.5.1. 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.

  • CONFIG_RTE_LIBRTE_CXGBE_DEBUG (default n)

    Toggle display of generic debugging messages.

  • CONFIG_RTE_LIBRTE_CXGBE_DEBUG_REG (default n)

    Toggle display of registers related run-time check messages.

  • CONFIG_RTE_LIBRTE_CXGBE_DEBUG_MBOX (default n)

    Toggle display of firmware mailbox related run-time check messages.

  • CONFIG_RTE_LIBRTE_CXGBE_DEBUG_TX (default n)

    Toggle display of transmission data path run-time check messages.

  • CONFIG_RTE_LIBRTE_CXGBE_DEBUG_RX (default n)

    Toggle display of receiving data path run-time check messages.

2.5.2. Driver Compilation

To compile CXGBE PMD for Linux x86_64 gcc target, run the following “make” command:

cd <DPDK-source-directory>
make config T=x86_64-native-linuxapp-gcc install

To compile CXGBE PMD for FreeBSD x86_64 clang target, run the following “gmake” command:

cd <DPDK-source-directory>
gmake config T=x86_64-native-bsdapp-clang install

2.6. Linux

2.6.1. Linux Installation

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

  1. Load the kernel module:

    modprobe cxgb4
    
  2. Use ifconfig to get the interface name assigned to Chelsio card:

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

    Example output:

    p1p1      Link encap:Ethernet  HWaddr 00:07:43:2D:EA:C0
    p1p2      Link encap:Ethernet  HWaddr 00:07:43:2D:EA:C8
    
  3. Install cxgbtool:

    cd <path_to_uwire>/tools/cxgbtool
    make install
    
  4. Use cxgbtool to load the firmware config file onto the card:

    cxgbtool p1p1 loadcfg <path_to_uwire>/src/network/firmware/t5-config.txt
    
  5. Use cxgbtool to load the firmware image onto the card:

    cxgbtool p1p1 loadfw <path_to_uwire>/src/network/firmware/t5fw-*.bin
    
  6. Unload and reload the kernel module:

    modprobe -r cxgb4
    modprobe cxgb4
    
  7. Verify with ethtool:

    ethtool -i p1p1 | grep "firmware"
    

    Example output:

    firmware-version: 1.13.32.0, TP 0.1.4.8
    

2.6.2. Running testpmd

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

  1. Change to DPDK source directory where the target has been compiled in section Driver Compilation:

    cd <DPDK-source-directory>
    
  2. Load the kernel module:

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

    dmesg | tail -2
    

    Example output:

    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 T5 2-port adapter are bound to the same PCI bus address.

  4. Unload the kernel module:

    modprobe -ar cxgb4 csiostor
    
  5. Request huge pages:

    echo 1024 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages/nr_hugepages
    
  6. Mount huge pages:

    mkdir /mnt/huge
    mount -t hugetlbfs nodev /mnt/huge
    
  7. Load igb_uio or vfio-pci driver:

    insmod ./x86_64-native-linuxapp-gcc/kmod/igb_uio.ko
    

    or

    modprobe vfio-pci
    
  8. Bind the Chelsio T5 adapters to igb_uio or vfio-pci loaded in the previous step:

    ./tools/dpdk_nic_bind.py --bind igb_uio 0000:02:00.4
    

    or

    Setup VFIO permissions for regular users and then bind to vfio-pci:

    sudo chmod a+x /dev/vfio
    
    sudo chmod 0666 /dev/vfio/*
    
    ./tools/dpdk_nic_bind.py --bind vfio-pci 0000:02:00.4
    

    Note

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

  9. Start testpmd with basic parameters:

    ./x86_64-native-linuxapp-gcc/app/testpmd -c 0xf -n 4 -w 0000:02:00.4 -- -i
    

    Example output:

    [...]
    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.13.32.0, TP: 0.1.4.8
    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 Enable/Disable Flow Control for more details.

2.7. FreeBSD

2.7.1. FreeBSD Installation

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

  1. Load the kernel module:

    kldload if_cxgbe
    
  2. Use dmesg to get the t5nex instance assigned to the Chelsio card:

    dmesg | grep "t5nex"
    

    Example output:

    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.

  3. Install cxgbetool from FreeBSD source repository:

    cd <path_to_FreeBSD_source>/tools/tools/cxgbetool/
    make && make install
    
  4. Use cxgbetool to load the firmware image onto the card:

    cxgbetool t5nex0 loadfw <path_to_uwire>/src/network/firmware/t5fw-*.bin
    
  5. Unload and reload the kernel module:

    kldunload if_cxgbe
    kldload if_cxgbe
    
  6. Verify with sysctl:

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

    Example output:

    dev.t5nex.0.firmware_version: 1.13.32.0
    

2.7.2. Running testpmd

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

  1. Change to DPDK source directory where the target has been compiled in section Driver Compilation:

    cd <DPDK-source-directory>
    
  2. Copy the contigmem kernel module to /boot/kernel directory:

    cp x86_64-native-bsdapp-clang/kmod/contigmem.ko /boot/kernel/
    
  3. Add the following lines to /boot/loader.conf:

    # 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.

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

    reboot
    kldstat | grep "contigmem"
    

    Example output:

    2    1 0xffffffff817f1000 3118     contigmem.ko
    
  5. Repeat step 1 to ensure that you are in the DPDK source directory.

  6. Load the cxgbe kernel module:

    kldload if_cxgbe
    
  7. Get the PCI bus addresses of the interfaces bound to t5nex driver:

    pciconf -l | grep "t5nex"
    

    Example output:

    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 T5 2-port adapter are bound to the same PCI bus address.

  8. Unload the kernel module:

    kldunload if_cxgbe
    
  9. Set the PCI bus addresses to hw.nic_uio.bdfs kernel environment parameter:

    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 T5 NICs.

  10. Load nic_uio kernel driver:

    kldload ./x86_64-native-bsdapp-clang/kmod/nic_uio.ko
    
  11. Start testpmd with basic parameters:

    ./x86_64-native-bsdapp-clang/app/testpmd -c 0xf -n 4 -w 0000:02:00.4 -- -i
    

    Example output:

    [...]
    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.13.32.0, TP: 0.1.4.8
    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 Enable/Disable Flow Control for more details.

2.8. Sample Application Notes

2.8.1. Enable/Disable Flow Control

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

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:

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

2.8.2. 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:

    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:

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