From 47508028c768414a708e05cf49d6a81f0ceb7976 Mon Sep 17 00:00:00 2001 From: Michal Berger Date: Mon, 1 Feb 2021 19:48:09 +0100 Subject: [PATCH] pkgdep/git: Add support for installing irdma driver Signed-off-by: Michal Berger Change-Id: Ifd174eaa88fe28588c66fafeef8a3bb7c24164f4 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6234 Tested-by: SPDK CI Jenkins Community-CI: Mellanox Build Bot Reviewed-by: Karol Latecki Reviewed-by: Monica Kenguva Reviewed-by: Jim Harris Reviewed-by: Tomasz Zawadzki --- test/common/config/pkgdep/git | 75 ++++++++++++++++++++++++++++++++++ test/common/config/vm_setup.sh | 2 +- 2 files changed, 76 insertions(+), 1 deletion(-) diff --git a/test/common/config/pkgdep/git b/test/common/config/pkgdep/git index 72940c4cd..4e0d6c9b4 100644 --- a/test/common/config/pkgdep/git +++ b/test/common/config/pkgdep/git @@ -390,7 +390,79 @@ function install_igb_uio() { sudo depmod } +function install_irdma() { + local RDMA_CORE_VERSION=27.0 + local RDMA_CORE=https://github.com/linux-rdma/rdma-core/releases/download/v$RDMA_CORE_VERSION/rdma-core-$RDMA_CORE_VERSION.tar.gz + + if [[ $ID != fedora ]]; then + echo "Installation of the irdma can be attempted only on Fedora" + return 0 + fi + + # Install extra dependencies needed by the rdma-core-27.0 + install ninja-build pandoc perl-generators valgrind-devel python-docutils libnl3 libnl3-devel + + rm -rf "$GIT_REPOS/irdma-$IRDMA_VERSION" + rm -rf "$GIT_REPOS/rdma-core-$RDMA_CORE_VERSION" + + curl -L -o- "$IRDMA_DRIVER" | tar -C "$GIT_REPOS" -xzf - + [[ -e $GIT_REPOS/irdma-$IRDMA_VERSION/build.sh ]] + + ( + cd "$GIT_REPOS/irdma-$IRDMA_VERSION" + "$GIT_REPOS/irdma-$IRDMA_VERSION/build.sh" + ) + + # Fetch and build the rdma-core irdma depends on + curl -L -o- "$RDMA_CORE" | tar -C "$GIT_REPOS" -xzf - + [[ -e $GIT_REPOS/irdma-$IRDMA_VERSION/libirdma-$RDMA_CORE_VERSION.patch ]] + + patch --dir="$GIT_REPOS/rdma-core-$RDMA_CORE_VERSION" -p2 \ + < "$GIT_REPOS/irdma-$IRDMA_VERSION/libirdma-$RDMA_CORE_VERSION.patch" + + # Note that paths and the name of the package are hardcoded into .spec, hence they need to stay like this. + [[ -e $GIT_REPOS/rdma-core-$RDMA_CORE_VERSION/redhat/rdma-core.spec ]] + mkdir -p "$HOME/rpmbuild/"{SOURCES,SPECS} + cp "$GIT_REPOS/rdma-core-$RDMA_CORE_VERSION/redhat/rdma-core.spec" "$HOME/rpmbuild/SPECS" + + # Re-package the source + tar -czf "$HOME/rpmbuild/SOURCES/rdma-core-$RDMA_CORE_VERSION.tgz" -C "$GIT_REPOS" "rdma-core-$RDMA_CORE_VERSION" + + # Build the rpms + ( + cd "$HOME/rpmbuild/SPECS" + # Make sure stock ninja-build is used + PATH="/usr/bin:$PATH" rpmbuild -ba rdma-core.spec + ) + + # Now, don't install the packages since this will, most likely, conflict with packages already installed + # in the system. Instead, simply inform user what the next step is and note what potential issues it may + # have with the installation. + + shopt -s nullglob + local rpms=("$HOME/rpmbuild/RPMS/x86_64/"*.rpm) + shopt -u nullglob + ((${#rpms[@]} > 0)) + + cat <<-EOF + + INFO: rdma-core-$RDMA_CORE_VERSION was successfully built, following packages are + available for installation: + + $(printf ' - %s\n' "${rpms[@]##*/}") + + Note that installing the above packages may raise conflicts with their + potentially newer versions already installed on the system. Dependent + packages may be uninstalled during the process as well. Please, run the + following command to finish the installation: + + $package_manager install [--allowerasing] $HOME/rpmbuild/RPMS/x86_64/*.rpm + + EOF +} + GIT_VERSION=2.25.1 +IRDMA_VERSION=1.2.21 : ${GIT_REPO_SPDK=https://github.com/spdk/spdk.git} export GIT_REPO_SPDK : ${GIT_REPO_DPDK=https://github.com/spdk/dpdk.git} @@ -413,6 +485,8 @@ export DRIVER_LOCATION_QAT export GIT_REPO_GIT : ${GIT_REPO_DPDK_KMODS=http://dpdk.org/git/dpdk-kmods} export GIT_REPO_DPDK_KMODS +: ${IRDMA_DRIVER=https://downloadmirror.intel.com/29751/eng/irdma-$IRDMA_VERSION.tgz} +export IRDMA_DRIVER GIT_REPOS=${GIT_REPOS:-$HOME} gcc_version=$(gcc -dumpversion) gcc_version=${gcc_version%%.*} @@ -431,6 +505,7 @@ if [[ $OSID == freebsd ]]; then else jobs=$(($(nproc) * 2)) sources+=( + install_irdma install_libiscsi install_nvmecli install_qat diff --git a/test/common/config/vm_setup.sh b/test/common/config/vm_setup.sh index d43aef981..b67d4172d 100755 --- a/test/common/config/vm_setup.sh +++ b/test/common/config/vm_setup.sh @@ -44,7 +44,7 @@ function usage() { echo " -h --help" echo " -u --upgrade Run $package_manager upgrade" echo " -i --install-deps Install $package_manager based dependencies" - echo " -t --test-conf List of test configurations to enable (${CONF})" + echo " -t --test-conf List of test configurations to enable (${CONF},irdma)" echo " -c --conf-path Path to configuration file" echo " -d --dir-git Path to where git sources should be saved" echo " -s --disable-tsocks Disable use of tsocks"