Skip to content

DPDK ​

DPDK 的组件名称为 dpdk, 相关内核选项为

ini
# Power management and ACPI options
# -> CPU Frequency scaling
CONFIG_CPU_FREQ=y

# File systems
# -> Pseudo filesystems
# -> HugeTLB file system support
CONFIG_HUGETLBFS=y

# Power management and ACPI options
# -> Device power management core functionality
CONFIG_PM=y

# Device Drivers
# -> VHOST drivers
CONFIG_VHOST_MENU=y
# Device Drivers
# -> VHOST drivers
# -> Host kernel accelerator for virtio net
CONFIG_VHOST_NET=y

# File systems
# -> Pseudo filesystems
# -> /proc file system support
# -> Enable /proc page monitoring
CONFIG_PROC_PAGE_MONITOR=y

# Device Drivers
# -> Userspace I/O drivers
CONFIG_UIO=y
# Device Drivers
# -> Userspace I/O drivers
# -> Generic driver for PCI 2.3 and PCI Express cards
CONFIG_UIO_PCI_GENERIC=y

# Device Drivers
# -> VFIO Non-Privileged userspace driver framework
CONFIG_VFIO=y
# Device Drivers
# -> VFIO Non-Privileged userspace driver framework
# -> VFIO No-IOMMU support
CONFIG_VFIO_NOIOMMU=y
# Device Drivers
# -> VFIO Non-Privileged userspace driver framework
# -> Generic VFIO support for any PCI device
CONFIG_VFIO_PCI=y

检查工具为

bash
#!/bin/bash

source ./kernel_config_utils.sh

dpdk_check() {
    local arch="$(uname -m)"
    local is_error

    is_error="false"
    if [  "$(kernel_version_cmp "$KERNEL_VERSION" "v4.19")" -lt "0" ]; then
        echo "DPDK need kernel version '$KERNEL_VERSION' >= 'v4.19'"
        return 1
    fi
    if ! kernel_config_check CONFIG_CPU_FREQ cpufreq; then
        is_error="true"
    fi
    if ! kernel_config_check CONFIG_HUGETLBFS; then
        is_error="true"
    fi
    if ! kernel_config_check CONFIG_IOMMU_API; then
        is_error="true"
    fi
    if ! kernel_config_check CONFIG_MMU; then
        is_error="true"
    fi
    if [ "$arch" == "riscv64" ]; then
        if ! kernel_config_check CONFIG_OF; then
            is_error="true"
        fi
    fi
    if ! kernel_config_check CONFIG_PM; then
        is_error="true"
    fi
    if ! kernel_config_check CONFIG_VHOST vhost; then
        is_error="true"
    fi
    if ! kernel_config_check CONFIG_VHOST_MENU; then
        is_error="true"
    fi
    if ! kernel_config_check CONFIG_VHOST_NET vhost_net; then
        is_error="true"
    fi

    if ! kernel_config_check CONFIG_PROC_PAGE_MONITOR; then
        is_error="true"
    fi
    if ! kernel_config_check CONFIG_UIO uio; then
        is_error="true"
    fi
    if ! kernel_config_check CONFIG_UIO_PCI_GENERIC uio_pci_generic; then
        is_error="true"
    fi
    if ! kernel_config_check CONFIG_VFIO vfio; then
        is_error="true"
    fi
    if ! kernel_config_check CONFIG_VFIO_NOIOMMU; then
        is_error="true"
    fi
    if ! kernel_config_check CONFIG_VFIO_PCI vfio_pci; then
        is_error="true"
    fi
    if [ "$is_error" == "true" ]; then
        return 1
    fi

    return 0
}