Blame SOURCES/gen_config_group.sh

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