Skip to content

Commit

Permalink
Merge pull request #35 from patrickmacarthur/migrate-to-rdma-core
Browse files Browse the repository at this point in the history
Migrate to rdma-core (#28)
  • Loading branch information
patrickmacarthur authored Jul 1, 2018
2 parents 3f89794 + 6ae2cf0 commit 720a821
Show file tree
Hide file tree
Showing 12 changed files with 2,133 additions and 198 deletions.
17 changes: 11 additions & 6 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ ccan_libccan_la_SOURCES = \
ccan/str/str.h

lib_LTLIBRARIES = src/liburdma/liburdma.la
EXTRA_src_liburdma_liburdma_la_SOURCES = \
rdma-core/17/infiniband/kern-abi.h \
rdma-core/17/infiniband/driver.h \
rdma-core/18/infiniband/kern-abi.h \
rdma-core/18/infiniband/driver.h
src_liburdma_liburdma_la_SOURCES = \
src/liburdma/driver.c \
src/liburdma/interface.c \
Expand All @@ -79,9 +84,9 @@ src_liburdma_liburdma_la_SOURCES = \
src/util/util.c \
src/util/util.h
src_liburdma_liburdma_la_CFLAGS = $(DPDK_CFLAGS)
src_liburdma_liburdma_la_CPPFLAGS = -Durdma_confdir='"$(sysconfdir)/rdma"' -I$(srcdir)/include -I$(srcdir)/src/util $(LIBNL3_CFLAGS) $(JSON_C_CFLAGS) $(DPDK_CPPFLAGS)
src_liburdma_liburdma_la_CPPFLAGS = -Durdma_confdir='"$(sysconfdir)/rdma"' -I$(srcdir)/rdma-core/@ibverbs_pabi_version@ -I$(srcdir)/include -I$(srcdir)/src/util $(LIBNL3_CFLAGS) $(JSON_C_CFLAGS) $(DPDK_CPPFLAGS)
src_liburdma_liburdma_la_LDFLAGS = -avoid-version \
-release @IBV_DEVICE_LIBRARY_EXTENSION@ $(DPDK_LDFLAGS)
-release @IBV_DEVICE_LIBRARY_EXTENSION@ $(LDFLAGS) $(DPDK_LDFLAGS)
src_liburdma_liburdma_la_LIBADD = $(LIBNL3_LIBS) $(JSON_C_LIBS) $(DPDK_LIBS)
verbsconfdir = $(sysconfdir)/libibverbs.d
dist_verbsconf_DATA = src/liburdma/urdma.driver
Expand Down Expand Up @@ -140,8 +145,8 @@ src_kvstore_server_kvstore_server_SOURCES = \
src/util/util.c \
src/util/util.h
src_kvstore_server_kvstore_server_CFLAGS = $(DPDK_CFLAGS)
src_kvstore_server_kvstore_server_CPPFLAGS = -I$(srcdir)/include -I$(srcdir)/src/util -I$(srcdir)/src/liburdma $(DPDK_CPPFLAGS)
src_kvstore_server_kvstore_server_LDFLAGS = $(DPDK_LDFLAGS)
src_kvstore_server_kvstore_server_CPPFLAGS = -I$(srcdir)/include -I$(srcdir)/src/util -I$(srcdir)/src/liburdma $(CPPFLAGS) $(DPDK_CPPFLAGS)
src_kvstore_server_kvstore_server_LDFLAGS = $(LDFLAGS) $(DPDK_LDFLAGS)
src_kvstore_server_kvstore_server_LDADD = src/liburdma/liburdma.la $(DPDK_LIBS) -lm

bin_PROGRAMS += src/kvstore_client/kvstore_client
Expand All @@ -152,8 +157,8 @@ src_kvstore_client_kvstore_client_SOURCES = \
src/util/util.c \
src/util/util.h
src_kvstore_client_kvstore_client_CFLAGS = $(DPDK_CFLAGS)
src_kvstore_client_kvstore_client_CPPFLAGS = -I$(srcdir)/include -I$(srcdir)/src/util -I$(srcdir)/src/liburdma $(DPDK_CPPFLAGS)
src_kvstore_client_kvstore_client_LDFLAGS = $(DPDK_LDFLAGS)
src_kvstore_client_kvstore_client_CPPFLAGS = -I$(srcdir)/include -I$(srcdir)/src/util -I$(srcdir)/src/liburdma $(CPPFLAGS) $(DPDK_CPPFLAGS)
src_kvstore_client_kvstore_client_LDFLAGS = $(LDFLAGS) $(DPDK_LDFLAGS)
src_kvstore_client_kvstore_client_LDADD = src/liburdma/liburdma.la $(DPDK_LIBS) -lm

check_PROGRAMS = tests/binheap tests/list_test
Expand Down
103 changes: 103 additions & 0 deletions config/rdma_core.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Userspace Software iWARP library for DPDK
#
# Authors: Patrick MacArthur <patrick@patrickmacarthur.net>
#
# Copyright (c) 2018, University of New Hampshire
#
# This software is available to you under a choice of one of two
# licenses. You may choose to be licensed under the terms of the GNU
# General Public License (GPL) Version 2, available from the file
# COPYING in the main directory of this source tree, or the
# BSD license below:
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# - Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# - Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# - Neither the name of IBM nor the names of its contributors may be
# used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

# _URDMA_FUNC_VERBS_INIT_AND_ALLOC_CONTEXT()
# -----------------------------------------
# Checks how many arguments the verbs_init_and_alloc_context macro
# takes. Defines HAVE_VERBS_INIT_AND_ALLOC_CONTEXT to the number of
# arguments that the macro takes if it exists; otherwise, aborts.
AC_DEFUN([_URDMA_FUNC_VERBS_INIT_AND_ALLOC_CONTEXT],
[
AC_CACHE_CHECK([number of arguments verbs_init_and_alloc_context takes],
[dpdk_cv_func_verbs_init_and_alloc_context],
[old_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="-I${srcdir} -I${srcdir}/rdma-core/${ibverbs_pabi_version} ${CPPFLAGS}"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <infiniband/driver.h>]],
[verbs_init_and_alloc_context@{:@@:}@;])],
[[# No-argument case is invalid and means we didn't find a prototype]]
[dpdk_cv_func_verbs_init_and_alloc_context=no],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <infiniband/driver.h>]],
[[struct foo { struct verbs_context bar; } *baz; verbs_init_and_alloc_context@{:@NULL, NULL, baz, bar, 0@:}@;]])],
[dpdk_cv_func_verbs_init_and_alloc_context=5],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <infiniband/driver.h>]],
[[struct foo { struct verbs_context bar; } *baz; verbs_init_and_alloc_context@{:@NULL, NULL, baz, bar@:}@;]])],
[dpdk_cv_func_verbs_init_and_alloc_context=4],
[dpdk_cv_func_verbs_init_and_alloc_context=no])])])])
if test "x$dpdk_cv_func_verbs_init_and_alloc_context" = "xno"; then
AC_MSG_ERROR([Colud not determine; check your rdma-core installation])
else
AC_DEFINE_UNQUOTED([HAVE_VERBS_INIT_AND_ALLOC_CONTEXT],
[${dpdk_cv_func_verbs_init_and_alloc_context}],
[Define to number of arguments taken by verbs_init_and_alloc_context])
CPPFLAGS="${old_CPPFLAGS}"
fi
]) # _URDMA_FUNC_VERBS_INIT_AND_ALLOC_CONTEXT

# URDMA_LIB_IBVERBS_PROV([MIN_VERSION], [MAX_VERSION])
# -------------------------
# Checks that we have rdma-core, and checks that the version is within
# the supported range.
# Note that this macro will abort if a suitable libibverbs is
# not found; fixing this would take more effort than it is worth.
# Defines the C preprocessor symbol IBVERBS_PABI_VERSION to the version
# of rdma-core that was found.
AC_DEFUN([URDMA_LIB_IBVERBS_PROV],
[
ibverbs_pabi_version=
min=$1
max=$2
for pabi_version in `seq "${max}" -1 "${min}"`
do
AC_SEARCH_LIBS([verbs_register_driver_${pabi_version}],
[ibverbs],
[ibverbs_pabi_version=${pabi_version}; break], [])
done
if test "x$ibverbs_pabi_version" = x; then
AC_MSG_ERROR([urdma requires rdma-core >= MIN_VERSION])
fi
AC_DEFINE_UNQUOTED([IBVERBS_PABI_VERSION], [${ibverbs_pabi_version}],
[Define to rdma-core private ABI version])
AC_SUBST([ibverbs_pabi_version])
if test $ibverbs_pabi_version -ge 17; then
_URDMA_FUNC_VERBS_INIT_AND_ALLOC_CONTEXT
fi
IBV_DEVICE_LIBRARY_EXTENSION=rdmav${ibverbs_pabi_version}
AC_SUBST([IBV_DEVICE_LIBRARY_EXTENSION])
]) # URDMA_LIB_IBVERBS_PROV
19 changes: 1 addition & 18 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -142,24 +142,7 @@ AC_ARG_ENABLE([werror], [AS_HELP_STRING([--enable-werror],
esac])
AC_SUBST([EXTRA_CFLAGS])

AC_SEARCH_LIBS([verbs_register_driver], [ibverbs], [], [AC_MSG_ERROR([dnl
urdma requires libibverbs >= 1.2.0])])

AC_MSG_CHECKING([for ibverbs driver library extension])
dummy=if$$
cat <<IBV_VERSION > $dummy.c
#include <infiniband/driver.h>
IBV_DEVICE_LIBRARY_EXTENSION
IBV_VERSION
IBV_DEVICE_LIBRARY_EXTENSION=`$CC $CPPFLAGS -E $dummy.c 2> /dev/null | tail -1`
rm -f $dummy.c
if test $IBV_DEVICE_LIBRARY_EXTENSION = IBV_DEVICE_LIBRARY_EXTENSION; then
AC_MSG_RESULT([not defined])
AC_MSG_ERROR([libibverbs does not define IBV_DEVICE_LIBRARY_EXTENSION])
else
AC_MSG_RESULT([$IBV_DEVICE_LIBRARY_EXTENSION])
fi
AC_SUBST([IBV_DEVICE_LIBRARY_EXTENSION])
URDMA_LIB_IBVERBS_PROV([17], [18])

AC_SEARCH_LIBS([rdma_create_id], [rdmacm], [], [AC_MSG_ERROR([dnl
urdma requires librdmacm])])
Expand Down
Loading

0 comments on commit 720a821

Please sign in to comment.