Blame SOURCES/gen_config_group.sh

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