From 94067e8baff677273e9b4f1403e56eca3998e914 Mon Sep 17 00:00:00 2001 From: Michal Berger Date: Wed, 14 Oct 2020 11:45:40 +0200 Subject: [PATCH] scripts/setup: Check if DPDK drivers are in place If they are not, there's no point to continue setup on FreeBSD. Change-Id: I6d94712f1507c0597fbd569ff73c52f262ab9df9 Signed-off-by: Michal Berger Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4658 Tested-by: SPDK CI Jenkins Reviewed-by: Tomasz Zawadzki Reviewed-by: Jim Harris --- scripts/setup.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/scripts/setup.sh b/scripts/setup.sh index 940189573..b692175d6 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -89,6 +89,20 @@ function check_for_driver() { return 0 } +function check_for_driver_freebsd() { + # Check if dpdk drivers (nic_uio, contigmem) are in the kernel's module path. + local search_paths path driver + IFS=";" read -ra search_paths < <(kldconfig -rU) + + for driver in contigmem.ko nic_uio.ko; do + for path in "${search_paths[@]}"; do + [[ -f $path/$driver ]] && continue 2 + done + return 1 + done + return 0 +} + function pci_dev_echo() { local bdf="$1" shift @@ -651,6 +665,10 @@ function configure_freebsd_pci() { } function configure_freebsd() { + if ! check_for_driver_freebsd; then + echo "DPDK drivers (contigmem and/or nic_uio) are missing, aborting" >&2 + return 1 + fi configure_freebsd_pci # If contigmem is already loaded but the HUGEMEM specified doesn't match the # previous value, unload contigmem so that we can reload with the new value.