Blame SOURCES/gen_config_group.sh

8f5e58
#!/bin/bash
8f5e58
8f5e58
source configlib.sh
8f5e58
8f5e58
# Generates arch configurations in the current directory based on
8f5e58
# 1. an dpdk.spec file
8f5e58
# 2. an expanded dpdk tree
8f5e58
8f5e58
if (( $# != 2 )); then
8f5e58
    echo "$0: dpdk.spec dpdk_tree" >&2
8f5e58
    exit 1
8f5e58
fi
8f5e58
8f5e58
DPDKSPEC="$1"
8f5e58
DPDKDIR="$2"
8f5e58
8f5e58
# accumulate all arch + name triples
8f5e58
DPDK_CONF_MACH_ARCH=()
8f5e58
for arch in $(grep %define\ machine_arch "$DPDKSPEC" | sed 's@%define machine_arch @@')
8f5e58
do
8f5e58
    DPDK_CONF_MACH_ARCH+=($arch)
8f5e58
done
8f5e58
8f5e58
DPDK_CONF_MACH_TMPL=()
8f5e58
for tmpl in $(grep %define\ machine_tmpl "$DPDKSPEC" | sed 's@%define machine_tmpl @@')
8f5e58
do
8f5e58
    DPDK_CONF_MACH_TMPL+=($tmpl)
8f5e58
done
8f5e58
8f5e58
DPDK_CONF_MACH=()
8f5e58
for mach in $(grep %define\ machine\  "$DPDKSPEC" | sed 's@%define machine @@')
8f5e58
do
8f5e58
    DPDK_CONF_MACH+=($mach)
8f5e58
done
8f5e58
8f5e58
DPDK_TARGETS=()
8f5e58
for ((i=0; i < ${#DPDK_CONF_MACH[@]}; i++));
8f5e58
do
8f5e58
    DPDK_TARGETS+=("${DPDK_CONF_MACH_ARCH[$i]}-${DPDK_CONF_MACH_TMPL[$i]}-linuxapp-gcc")
8f5e58
    echo "DPDK-target: ${DPDK_TARGETS[$i]}"
8f5e58
done
8f5e58
8f5e58
OUTPUT_DIR=$(pwd)
8f5e58
pushd "$DPDKDIR"
8f5e58
for ((i=0; i < ${#DPDK_TARGETS[@]}; i++));
8f5e58
do
8f5e58
    echo "For ${DPDK_TARGETS[$i]}:"
8f5e58
8f5e58
    echo "     a. Generating initial config"
8f5e58
    echo "        make V=1 T=${DPDK_TARGETS[$i]} O=${DPDK_TARGETS[$i]}"
8f5e58
    make V=1 T=${DPDK_TARGETS[$i]} O=${DPDK_TARGETS[$i]} -j8 config
8f5e58
    ORIG_SHA=""
8f5e58
    OUTDIR="${DPDK_TARGETS[$i]}"
8f5e58
8f5e58
    echo "     b. calculating and applying sha"
8f5e58
    calc_sha ORIG_SHA "${OUTDIR}/.config"
8f5e58
    if [ "$ORIG_SHA" == "" ]; then
8f5e58
        echo "ERROR: Unable to get sha for arch ${DPDK_TARGETS[$i]}"
8f5e58
        exit 1
8f5e58
    fi
8f5e58
    echo "# -*- cfg-sha: ${ORIG_SHA}" > ${OUTDIR}/.config.new
8f5e58
    cat "${OUTDIR}/.config" >> "${OUTDIR}/.config.new"
8f5e58
    cp "${OUTDIR}/.config" "${OUTDIR}/.config.orig"
8f5e58
    mv -f "${OUTDIR}/.config.new" "${OUTDIR}/.config"
8f5e58
8f5e58
    echo "     c. setting initial configurations"
8f5e58
    # these are the original setconf values from dpdk.spec
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_MACHINE "\\\"${DPDK_CONF_MACH[$i]}\\\""
8f5e58
8f5e58
    # Enable automatic driver loading from this path
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_EAL_PMD_PATH '"/usr/lib64/dpdk-pmds"'
8f5e58
8f5e58
    # Disable DPDK libraries not needed
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_TIMER n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_CFGFILE n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_JOBSTATS n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_LPM n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_ACL n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_POWER n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_SCHED n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_DISTRIBUTOR n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_REORDER n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_PORT n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_TABLE n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_PIPELINE n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_KNI n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_CRYPTODEV n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_SECURITY n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_FLOW_CLASSIFY n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_BBDEV n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_COMPRESSDEV n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_BPF n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOOL n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_DPAA_MEMPOOL n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_DPAA2_MEMPOOL n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_CFGFILE n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_EFD n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_FLOW_CLASSIFY n
8f5e58
8f5e58
    # Disable all eventdevs
8f5e58
    for eventdev in $(grep _EVENTDEV= "${OUTDIR}/.config" | sed 's@=\(y\|n\)@@g')
8f5e58
    do
8f5e58
        set_conf "${OUTDIR}" $eventdev n
8f5e58
    done
8f5e58
8f5e58
    # Disable all rawdevs
8f5e58
    for rawdev in $(grep _RAWDEV= "${OUTDIR}/.config" | sed 's@=\(y\|n\)@@g')
8f5e58
    do
8f5e58
        set_conf "${OUTDIR}" $rawdev n
8f5e58
    done
8f5e58
8f5e58
    # Disable virtio user
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_VIRTIO_USER n
8f5e58
8f5e58
    # Enable vhost numa as libnuma dep is ok
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_VHOST_NUMA y
8f5e58
8f5e58
    # start by disabling ALL PMDs
8f5e58
    for pmd in $(grep _PMD= "${OUTDIR}/.config" | sed 's@=\(y\|n\)@@g')
8f5e58
    do
8f5e58
        set_conf "${OUTDIR}" $pmd n
8f5e58
    done
8f5e58
8f5e58
    # PMDs which have their own naming scheme
8f5e58
    # the default for this was 'n' at one point.  Make sure we keep it
8f5e58
    # as such
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_PMD_QAT n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_PMD_OCTEONTX_ZIPVF n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_PMD_VHOST n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_PMD_KNI n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_PMD_XENVIRT n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_PMD_NULL n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_PMD_SKELETON_EVENTDEV n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_PMD_PCAP n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_PMD_BOND n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_PMD_AF_PACKET n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_PMD_SOFTNIC n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_PMD_DPAA_SEC n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_COMMON_DPAAX n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_PMD_CAAM_JR n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_PMD_CAAM_JR_BE n
8f5e58
8f5e58
    # whitelist of enabled PMDs
8f5e58
    # Soft PMDs to enable
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_PMD_RING y
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_PMD_VHOST y
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_VIRTIO_PMD y
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_PMD_TAP y
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_PMD_FAILSAFE y
8f5e58
8f5e58
8f5e58
    # start by disabling all buses
8f5e58
    for bus in $(grep _BUS= "${OUTDIR}/.config" | sed 's@=\(y\|n\)@@g')
8f5e58
    do
8f5e58
        set_conf "${OUTDIR}" $bus n
8f5e58
    done
8f5e58
8f5e58
    # blacklist buses that don't conform to std naming
8f5e58
    # May override VMBUS later in arch specific section
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_VMBUS n
8f5e58
8f5e58
    # whitelist buses
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_PCI_BUS y
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_VDEV_BUS y
8f5e58
8f5e58
8f5e58
    # Disable some other miscellanous items related to test apps
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_TEST_BBDEV n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_APP_CRYPTO_PERF n
8f5e58
8f5e58
    # Disable kernel modules
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_EAL_IGB_UIO n
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_KNI_KMOD n
8f5e58
8f5e58
    # Disable experimental stuff
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_NEXT_ABI n
8f5e58
8f5e58
    # Build DPDK as shared library
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_BUILD_SHARED_LIB y
8f5e58
8f5e58
    # Compile the PMD test application
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_TEST_PMD y
8f5e58
8f5e58
    # Arch specific
8f5e58
    set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_I40E_PMD y
8f5e58
    case "${DPDK_CONF_MACH_ARCH[i]}" in
8f5e58
    x86_64)
8f5e58
        # Hw PMD
8f5e58
        set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_BNXT_PMD y
8f5e58
        set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_ENIC_PMD y
8f5e58
        set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_MLX4_PMD y
8f5e58
        set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_MLX4_DLOPEN_DEPS y
8f5e58
        set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_MLX5_PMD y
8f5e58
        set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_MLX5_DLOPEN_DEPS y
8f5e58
        set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_NFP_PMD y
8f5e58
        set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_QEDE_PMD y
8f5e58
        # Sw PMD
8f5e58
        set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_NETVSC_PMD y
8f5e58
        set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_VDEV_NETVSC_PMD y
8f5e58
        # Bus
8f5e58
        set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_VMBUS y
8f5e58
        ;&
8f5e58
    arm64)
8f5e58
        set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_IXGBE_PMD y
8f5e58
        set_conf "${OUTDIR}" CONFIG_RTE_LIBRTE_IGB_PMD y
8f5e58
        ;;
8f5e58
    esac
8f5e58
8f5e58
    cp "${OUTDIR}/.config" "${OUTPUT_DIR}/${DPDK_TARGETS[$i]}-config"
8f5e58
done
8f5e58
popd >/dev/null
8f5e58
8f5e58
echo -n "For each arch ( "
8f5e58
for ((i=0; i < ${#DPDK_CONF_MACH_ARCH[@]}; i++));
8f5e58
do
8f5e58
    echo -n "${DPDK_CONF_MACH_ARCH[i]} "
8f5e58
done
8f5e58
echo "):"
8f5e58
echo "1. ensure you enable the requisite hw"