Commit 94067e8b authored by Michal Berger's avatar Michal Berger Committed by Jim Harris
Browse files

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: default avatarMichal Berger <michalx.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4658


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent c90dac7a
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -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.