From fe750c248be58b76479836639fbd0c4617210aa5 Mon Sep 17 00:00:00 2001 From: Benoît Ganne Date: Mon, 25 Mar 2019 11:41:34 +0100 Subject: Add RDMA ibverb driver plugin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RDMA ibverb is a userspace API to efficiently rx/tx packets. This is an initial, unoptimized driver targeting Mellanox cards. Next steps should include batching, multiqueue and additional cards. Change-Id: I0309c7a543f75f2f9317eaf63ca502ac7a093ef9 Signed-off-by: Benoît Ganne --- build/external/Makefile | 32 ++++++++++--------- build/external/deb/debian/rules | 1 - build/external/packages.mk | 6 ++-- build/external/packages/dpdk.mk | 60 +++++++++++++++++------------------- build/external/packages/rdma-core.mk | 46 +++++++++++++++++++++++++++ 5 files changed, 94 insertions(+), 51 deletions(-) create mode 100644 build/external/packages/rdma-core.mk (limited to 'build') diff --git a/build/external/Makefile b/build/external/Makefile index a1352a69cbf..084d694e88c 100644 --- a/build/external/Makefile +++ b/build/external/Makefile @@ -31,11 +31,18 @@ include packages.mk include packages/nasm.mk include packages/ipsec-mb.mk include packages/dpdk.mk +include packages/rdma-core.mk .PHONY: clean clean: @rm -rf $(B) $(I) +.PHONY: install +install: dpdk-install rdma-core-install + +.PHONY: config +config: dpdk-config rdma-core-config + ############################################################################## # .deb packaging ############################################################################## @@ -62,11 +69,6 @@ build-deb: $(DEV_DEB) install-deb: ifneq ($(INSTALLED_VER),$(DEB_VER)-$(PKG_SUFFIX)) - @echo "==========================================================" - @echo " Out of date vpp-ext-deps package installed." - @echo " Installed: $(INSTALLED_VER)" - @echo " Needed: $(DEB_VER)-$(PKG_SUFFIX)" - @echo "==========================================================" @make $(DEV_DEB) @sudo dpkg -i $(DEV_DEB) else @@ -78,9 +80,9 @@ endif check-deb: ifneq ($(INSTALLED_VER),$(DEB_VER)-$(PKG_SUFFIX)) @echo "==========================================================" - @echo " Outdated DPDK package detected:" - @echo " Installed: vpp-ext-deps $(INSTALLED_VER)" - @echo " Current: vpp-ext-deps $(DEB_VER)-$(PKG_SUFFIX)" + @echo " Out of date vpp-ext-deps package installed." + @echo " Installed: $(INSTALLED_VER)" + @echo " Needed: $(DEB_VER)-$(PKG_SUFFIX)" @echo "" @echo " Please upgrade by invoking 'make install-ext-deps'" @echo " from the top level directory." @@ -115,16 +117,16 @@ ifneq ($(INSTALLED_RPM_VER),$(RPM_VER)-$(PKG_SUFFIX)) sudo rpm -Uih --force $(DEV_RPM) else @echo "==========================================================" - @echo " Up-to-date DPDK package already installed" + @echo " Up-to-date vpp-ext-deps package already installed" @echo "==========================================================" endif check-rpm: ifneq ($(INSTALLED_RPM_VER),$(RPM_VER)-$(PKG_SUFFIX)) @echo "==========================================================" - @echo " Outdated DPDK package detected:" - @echo " Installed: vpp-ext-deps $(INSTALLED_RPM_VER)" - @echo " Current: vpp-ext-deps $(RPM_VER)-$(PKG_SUFFIX)" + @echo " Out of date vpp-ext-deps package installed." + @echo " Installed: $(INSTALLED_RPM_VER)" + @echo " Needed: $(RPM_VER)-$(PKG_SUFFIX)" @echo "" @echo " Please upgrade by invoking 'make install-ext-deps'" @echo " from the top level directory." @@ -140,9 +142,9 @@ endif ebuild-build: ifeq ($(INSTALLED_VER)$(INSTALLED_RPM_VER),) @echo "==========================================================" - @echo "Building DPDK from source. Consider installing development" - @echo "package by invoking 'make install-ext-deps' from the" - @echo "top level directory" + @echo "Building vpp-ext-deps from source. Consider installing" + @echo "development package by invoking 'make install-ext-deps'" + @echo "from the top level directory" @echo "==========================================================" make config else diff --git a/build/external/deb/debian/rules b/build/external/deb/debian/rules index 6393f82716b..2b1157e5e48 100755 --- a/build/external/deb/debian/rules +++ b/build/external/deb/debian/rules @@ -20,7 +20,6 @@ override_dh_clean: make $(MAKE_ARGS) clean override_dh_auto_configure: - make $(MAKE_ARGS) config override_dh_install: make $(MAKE_ARGS) install diff --git a/build/external/packages.mk b/build/external/packages.mk index 4056b2f63b5..005c2a958b2 100644 --- a/build/external/packages.mk +++ b/build/external/packages.mk @@ -31,12 +31,12 @@ $1_install_log ?= $(B)/$1.install.log downloads/$($1_tarball): mkdir -p downloads @if [ -e $(DL_CACHE_DIR)/$($1_tarball) ] ; \ - then cp $(DL_CACHE_DIR)/$($1_tarball) downloads/ ; \ + then cp $(DL_CACHE_DIR)/$($1_tarball) $$@ ; \ else \ echo "Downloading $($1_url)" ; \ - curl -o downloads/$($1_tarball) -LO $($1_url) ; \ + curl -o $$@ -LO $($1_url) ; \ fi - @rm -f $(B)/.download.ok + @rm -f $(B)/.$1.download.ok $(B)/.$1.download.ok: downloads/$($1_tarball) @mkdir -p $(B) diff --git a/build/external/packages/dpdk.mk b/build/external/packages/dpdk.mk index 68c27678931..ae9d9c5df95 100644 --- a/build/external/packages/dpdk.mk +++ b/build/external/packages/dpdk.mk @@ -167,9 +167,7 @@ define set fi endef -all: build - -$(B)/custom-config: $(B)/.patch.ok Makefile +$(B)/custom-config: $(B)/.dpdk-patch.ok Makefile @echo --- generating custom config from $(DPDK_SOURCE)/config/defconfig_$(DPDK_TARGET) --- @cpp -undef -ffreestanding -x assembler-with-cpp $(DPDK_SOURCE)/config/defconfig_$(DPDK_TARGET) $@ $(call set,RTE_MACHINE,$(DPDK_MACHINE)) @@ -230,18 +228,19 @@ $(B)/custom-config: $(B)/.patch.ok Makefile $(call set,RTE_LIBRTE_DPAA_PMD,n) $(call set,RTE_LIBRTE_PMD_DPAA_SEC,n) $(call set,RTE_LIBRTE_PMD_DPAA_EVENTDEV,n) - @rm -f .config.ok + @rm -f .dpdk-config.ok + +DPDK_DOWNLOADS = $(CURDIR)/downloads/$(DPDK_TARBALL) -$(CURDIR)/$(DPDK_TARBALL): +$(DPDK_DOWNLOADS): + mkdir -p downloads @if [ -e $(DPDK_DOWNLOAD_DIR)/$(DPDK_TARBALL) ] ; \ - then cp $(DPDK_DOWNLOAD_DIR)/$(DPDK_TARBALL) $(CURDIR) ; \ - else curl -o $(CURDIR)/$(DPDK_TARBALL) -LO $(DPDK_TAR_URL) ; \ + then cp $(DPDK_DOWNLOAD_DIR)/$(DPDK_TARBALL) $@ ; \ + else curl -o $@ -LO $(DPDK_TAR_URL) ; \ fi - @rm -f $(B)/.download.ok + @rm -f $(B)/.dpdk-download.ok -DPDK_DOWNLOADS = $(CURDIR)/$(DPDK_TARBALL) - -$(B)/.download.ok: $(DPDK_DOWNLOADS) +$(B)/.dpdk-download.ok: $(DPDK_DOWNLOADS) @mkdir -p $(B) @openssl md5 $< | cut -f 2 -d " " - > $(B)/$(DPDK_TARBALL).md5sum @([ "$$(<$(B)/$(DPDK_TARBALL).md5sum)" = "$(DPDK_$(DPDK_VERSION)_TARBALL_MD5_CKSUM)" ] || \ @@ -249,18 +248,18 @@ $(B)/.download.ok: $(DPDK_DOWNLOADS) rm $(B)/$(DPDK_TARBALL).md5sum && false )) @touch $@ -.PHONY: download -download: $(B)/.download.ok +.PHONY: dpdk-download +dpdk-download: $(B)/.dpdk-download.ok -$(B)/.extract.ok: $(B)/.download.ok +$(B)/.dpdk-extract.ok: $(B)/.dpdk-download.ok @echo --- extracting $(DPDK_TARBALL) --- - @tar --directory $(B) --extract --file $(CURDIR)/$(DPDK_TARBALL) + @tar --directory $(B) --extract --file $(DPDK_DOWNLOADS) @touch $@ -.PHONY: extract -extract: $(B)/.extract.ok +.PHONY: dpdk-extract +dpdk-extract: $(B)/.dpdk-extract.ok -$(B)/.patch.ok: $(B)/.extract.ok +$(B)/.dpdk-patch.ok: $(B)/.dpdk-extract.ok ifneq ($(wildcard $(CURDIR)/patches/dpdk_$(DPDK_VERSION)/*.patch),) @echo --- patching --- @for f in $(CURDIR)/patches/dpdk_$(DPDK_VERSION)/*.patch ; do \ @@ -270,26 +269,23 @@ ifneq ($(wildcard $(CURDIR)/patches/dpdk_$(DPDK_VERSION)/*.patch),) endif @touch $@ -.PHONY: patch -patch: $(B)/.patch.ok +.PHONY: dpdk-patch +dpdk-patch: $(B)/.dpdk-patch.ok -$(B)/.config.ok: $(B)/.patch.ok $(B)/custom-config +$(B)/.dpdk-config.ok: $(B)/.dpdk-patch.ok $(B)/custom-config @make $(DPDK_MAKE_ARGS) config @touch $@ -.PHONY: config -config: $(B)/.config.ok +.PHONY: dpdk-config +dpdk-config: $(B)/.dpdk-config.ok -.PHONY: build-dpdk -build-dpdk: $(DPDK_BUILD_DEPS) - @if [ ! -e $(B)/.config.ok ] ; then echo 'Please run "make config" first' && false ; fi +$(B)/.dpdk-build.ok: dpdk-config $(DPDK_BUILD_DEPS) + @if [ ! -e $(B)/.dpdk-config.ok ] ; then echo 'Please run "make config" first' && false ; fi @make $(DPDK_MAKE_ARGS) install - -$(B)/.build.ok: build-dpdk @touch $@ -.PHONY: build -build: $(B)/.build.ok +.PHONY: dpdk-build +dpdk-build: $(B)/.dpdk-build.ok -.PHONY: install -install: $(B)/.build.ok +.PHONY: dpdk-install +dpdk-install: $(B)/.dpdk-build.ok diff --git a/build/external/packages/rdma-core.mk b/build/external/packages/rdma-core.mk new file mode 100644 index 00000000000..0e8c878034e --- /dev/null +++ b/build/external/packages/rdma-core.mk @@ -0,0 +1,46 @@ +# Copyright (c) 2018 Cisco and/or its affiliates. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +rdma-core_version := 23 +rdma-core_tarball := rdma-core-$(rdma-core_version).tar.gz +rdma-core_tarball_md5sum_22.1 := dde4d30e3db20893408ae51041117034 +rdma-core_tarball_md5sum_23 := c78575735c4a71609c1a214ea16cd8dc +rdma-core_tarball_md5sum := $(rdma-core_tarball_md5sum_$(rdma-core_version)) +rdma-core_tarball_strip_dirs := 1 +rdma-core_url := http://github.com/linux-rdma/rdma-core/releases/download/v$(rdma-core_version)/$(rdma-core_tarball) + +RDMA_FILES := include/infiniband/verbs.h \ + include/infiniband/verbs_api.h \ + include/infiniband/ib_user_ioctl_verbs.h \ + include/rdma/ib_user_verbs.h \ + lib/statics/libibverbs.a \ + lib/statics/libmlx5.a + +define rdma-core_config_cmds + cd $(rdma-core_build_dir) && \ + cmake -G Ninja $(rdma-core_src_dir) \ + -DENABLE_STATIC=1 -DENABLE_RESOLVE_NEIGH=0 -DNO_PYVERBS=1 -DENABLE_VALGRIND=0 \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DCMAKE_C_FLAGS=-fPIC > $(rdma-core_config_log) +endef + +define rdma-core_build_cmds + cmake --build $(rdma-core_build_dir) -- libibverbs.a libmlx5.a > $(rdma-core_build_log) +endef + +define rdma-core_install_cmds + mkdir -p $(rdma-core_install_dir) + tar -C $(rdma-core_build_dir) --xform='s|/statics/|/|' -hc $(RDMA_FILES) | tar -C $(rdma-core_install_dir) -xv > $(rdma-core_install_log) +endef + +$(eval $(call package,rdma-core)) -- cgit 1.2.3-korg