OFED is having new structure based on linux kernel code + backports
and packaging. Here is detailed information.
http://lists.openfabrics.org/pipermail/ewg/2011-December/017156.html
This patches are the lustre build improvements to support OFED 3.5,
3.x whatever future OFED release.
Signed-off-by: Shuichi Ihara <sihara@ddn.com>
Change-Id: Id4ffc39bc7fc24cc591bf6fb47e9b0e662993bda
Reviewed-on: http://review.whamcloud.com/3011
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Brian J. Murrell <brian.murrell@intel.com>
Reviewed-by: Liang Zhen <liang.zhen@intel.com>
Reviewed-by: Isaac Huang <he.huang@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
-# LB_CONFIG_OFED_BACKPORTS
-# include any OFED backport headers in all compile commands
-# NOTE: this does only include the backport paths, not the OFED headers
-# adding the OFED headers is done in the lnet portion
-AC_DEFUN([LB_CONFIG_OFED_BACKPORTS],
-[AC_MSG_CHECKING([whether to use any OFED backport headers])
+AC_DEFUN([LB_CONFIG_COMPAT_RDMA],
+[AC_MSG_CHECKING([whether to use Compat RDMA])
# set default
AC_ARG_WITH([o2ib],
AC_HELP_STRING([--with-o2ib=path],
# set default
AC_ARG_WITH([o2ib],
AC_HELP_STRING([--with-o2ib=path],
- [build o2iblnd against path]),
+ [build o2iblnd against path]),
[
case $with_o2ib in
yes) O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
[
case $with_o2ib in
yes) O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
+ compatrdma_found=false
+ if $o2ib_found; then
+ if test \( -f ${O2IBPATH}/include/linux/compat-2.6.h \); then
+ compatrdma_found=true
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(HAVE_COMPAT_RDMA, 1, [compat rdma found])
+ else
+ AC_MSG_RESULT([no])
+ fi
+ fi
+fi
+])
+
+#
+# LB_CONFIG_OFED_BACKPORTS
+#
+# include any OFED backport headers in all compile commands
+# NOTE: this does only include the backport paths, not the OFED headers
+# adding the OFED headers is done in the lnet portion
+AC_DEFUN([LB_CONFIG_OFED_BACKPORTS],
+[AC_MSG_CHECKING([whether to use any OFED backport headers])
+if test $ENABLEO2IB -eq 0; then
+ AC_MSG_RESULT([no])
+else
if ! $o2ib_found; then
AC_MSG_RESULT([no])
case $ENABLEO2IB in
if ! $o2ib_found; then
AC_MSG_RESULT([no])
case $ENABLEO2IB in
*) AC_MSG_ERROR([internal error]);;
esac
else
*) AC_MSG_ERROR([internal error]);;
esac
else
- if test -f $O2IBPATH/config.mk; then
- . $O2IBPATH/config.mk
- elif test -f $O2IBPATH/ofed_patch.mk; then
- . $O2IBPATH/ofed_patch.mk
+ if ! $compatrdma_found; then
+ if test -f $O2IBPATH/config.mk; then
+ . $O2IBPATH/config.mk
+ elif test -f $O2IBPATH/ofed_patch.mk; then
+ . $O2IBPATH/ofed_patch.mk
+ fi
fi
if test -n "$BACKPORT_INCLUDES"; then
OFED_BACKPORT_PATH="$O2IBPATH/${BACKPORT_INCLUDES/*\/kernel_addons/kernel_addons}/"
fi
if test -n "$BACKPORT_INCLUDES"; then
OFED_BACKPORT_PATH="$O2IBPATH/${BACKPORT_INCLUDES/*\/kernel_addons/kernel_addons}/"
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
# 2.6.28
LC_MODULE_LOADING
# 2.6.28
LC_MODULE_LOADING
# it's ugly to be doing anything with OFED outside of the lnet module, but
# this has to be done here so that the backports path is set before all of
# the LN_PROG_LINUX checks are done
# it's ugly to be doing anything with OFED outside of the lnet module, but
# this has to be done here so that the backports path is set before all of
# the LN_PROG_LINUX checks are done
+# compare two versions $1 and $2. if $1 < $2, return 0 otherwise return 1.
+compare_version () {
+ [[ $1 == $2 ]] && return 1
+ local IFS=.
+ local i val1=($1) val2=($2)
+
+ # padding zero to val1 if it needs
+ for ((i=${#val1[@]}; i<${#val2[@]}; i++)); do
+ val1[i]=0
+ done
+ for ((i=0; i<${#val1[@]}; i++)); do
+ [[ -z ${val2[i]} ]] && return 1
+
+ if [[ ${val1[i]} < ${val2[i]} ]]; then
+ return 0
+ elif [[ ${val1[i]} > ${val2[i]} ]]; then
+ return 1
+ fi
+ done
+}
+
uniqify() {
echo $(echo "$*" | xargs -n 1 | sort -u)
uniqify() {
echo $(echo "$*" | xargs -n 1 | sort -u)
local location="http://www.openfabrics.org/downloads/OFED/ofed-${OFED_BASE_VERSION}/"
local location="http://www.openfabrics.org/downloads/OFED/ofed-${OFED_BASE_VERSION}/"
+ if [[ $OFED_VERSION = *-rc[0-9] ]]; then
+ local Mmv
+ Mmv=${OFED_VERSION%%-*}
+ location="http://www.openfabrics.org/downloads/OFED/ofed-${Mmv}/"
+ fi
+
if [[ $OFED_VERSION = daily-* ]]; then
local Mmv daily
OFED_VERSION=${OFED_VERSION/daily-/}
if [[ $OFED_VERSION = daily-* ]]; then
local Mmv daily
OFED_VERSION=${OFED_VERSION/daily-/}
build_kernel_ib() {
local linux="$1"
build_kernel_ib() {
local linux="$1"
+ local kib_prefix="$2"
+ local kib_rpm="$3"
- # build kernel-ib{,-devel}
+ # build kernel-ib{,-devel}/compat-rdma{,-devel}
local K_SRC="K_SRC"
# ofed 1.3 had a bug in the rpm spec
if [ "$OFED_VERSION" = "1.3" ]; then
K_SRC="KSRC"
fi
local K_SRC="K_SRC"
# ofed 1.3 had a bug in the rpm spec
if [ "$OFED_VERSION" = "1.3" ]; then
K_SRC="KSRC"
fi
- local OFED_CORE="--with-core-mod --with-ipoib-mod --with-sdp-mod --with-user_mad-mod --with-user_access-mod --with-addr_trans-mod --with-rds-mod --with-madeye-mod"
+ local OFED_CORE="--with-core-mod --with-ipoib-mod --with-sdp-mod --with-user_mad-mod --with-user_access-mod --with-addr_trans-mod"
local OFED_HARDWARE="--with-mthca-mod --with-mlx4-mod --with-mlx4_en-mod --with-cxgb3-mod --with-nes-mod"
local OFED_HARDWARE="--with-mthca-mod --with-mlx4-mod --with-mlx4_en-mod --with-cxgb3-mod --with-nes-mod"
+
+ if compare_version $OFED_VERSION 3.0; then
+ OFED_CORE="$OFED_CORE --with-madeye-mod --with-rds-mod"
+ else
+ OFED_HARDWARE="$OFED_HARDWARE --with-cxgb4-mod"
+ fi
+
# some I/B drivers are architecture dependent and kernel-ib's configure
# does not figure it out for us ~sigh~
case "$TARGET_ARCH" in
# some I/B drivers are architecture dependent and kernel-ib's configure
# does not figure it out for us ~sigh~
case "$TARGET_ARCH" in
# assume we are just rebuilding the SRPM
local BUILD_TYPE=${BUILD_TYPE:-"--rebuild"}
# assume we are just rebuilding the SRPM
local BUILD_TYPE=${BUILD_TYPE:-"--rebuild"}
- local SOURCE="${TOPDIR}/OFED/SRPMS/ofa_kernel-*.src.rpm"
+ local SOURCE="${TOPDIR}/OFED/SRPMS/${kib_prefix}-*.src.rpm"
# but switch to building from the SPEC if we need to apply patches
if ls ${TOPDIR}/lustre/build/patches/ofed/* >/dev/null; then
BUILD_TYPE="-bb"
rpm --define "_topdir ${TOPDIR}" -ivh $SOURCE
# but switch to building from the SPEC if we need to apply patches
if ls ${TOPDIR}/lustre/build/patches/ofed/* >/dev/null; then
BUILD_TYPE="-bb"
rpm --define "_topdir ${TOPDIR}" -ivh $SOURCE
- SOURCE="${TOPDIR}/SPECS/ofa_kernel.spec"
+ SOURCE="${TOPDIR}/SPECS/${kib_prefix}.spec"
local file ed_fragment1 ed_fragment2 n=1
for file in $(ls ${TOPDIR}/lustre/build/patches/ofed/*.patch); do
ed_fragment1="$ed_fragment1
local file ed_fragment1 ed_fragment2 n=1
for file in $(ls ${TOPDIR}/lustre/build/patches/ofed/*.patch); do
ed_fragment1="$ed_fragment1
fi
local linuxrelease=$(find_linux_release "$linux")
fi
local linuxrelease=$(find_linux_release "$linux")
+ if compare_version $OFED_VERSION 3.0; then
+ local OFA_KERNEL_RELEASE=$(echo -n ${linuxrelease} | sed -e 's/-/_/g')
+ fi
if ! $RPMBUILD $BUILD_TYPE --define 'build_kernel_ib 1' --define 'build_kernel_ib_devel 1' \
${FIND_REQUIRES:+--define "__find_requires $FIND_REQUIRES"} \
--define "_topdir ${TOPDIR}" --target ${TARGET_ARCH} \
if ! $RPMBUILD $BUILD_TYPE --define 'build_kernel_ib 1' --define 'build_kernel_ib_devel 1' \
${FIND_REQUIRES:+--define "__find_requires $FIND_REQUIRES"} \
--define "_topdir ${TOPDIR}" --target ${TARGET_ARCH} \
${OFA_KERNEL_RELEASE:+--define "_release $OFA_KERNEL_RELEASE"} \
--define "configure_options --without-quilt $OFED_CORE $OFED_HARDWARE $OFED_ISCSI" \
${SOURCE} 2>&1; then
${OFA_KERNEL_RELEASE:+--define "_release $OFA_KERNEL_RELEASE"} \
--define "configure_options --without-quilt $OFED_CORE $OFED_HARDWARE $OFED_ISCSI" \
${SOURCE} 2>&1; then
- fatal 1 "Error building kernel-ib"
+ fatal 1 "Error building ${kib_rpm}"
build_ofed() {
local linux="$1"
local ofed_version="$2"
build_ofed() {
local linux="$1"
local ofed_version="$2"
+ local kib_prefix
+ local kib_rpm
# if an ofed version is given, then it means use OFED proper,
# not any vendor specific "inkernel" version
# if an ofed version is given, then it means use OFED proper,
# not any vendor specific "inkernel" version
+ elif compare_version $OFED_VERSION 3.0; then
+ kib_prefix="ofa_kernel"
+ kib_rpm="kernel-ib"
+ else
+ kib_prefix="compat-rdma"
+ kib_rpm="compat-rdma"
+ # build kernel-ib/compat-rdma
if $USE_BUILD_CACHE && [ -n "$REUSEBUILD" ]; then
local REUSE_SIGNATURE=$({ echo "$ofed_version";
echo "$(find_linux_release ${linux})";
if $USE_BUILD_CACHE && [ -n "$REUSEBUILD" ]; then
local REUSE_SIGNATURE=$({ echo "$ofed_version";
echo "$(find_linux_release ${linux})";
create_rpmbuild_dirs
fi
# build it
create_rpmbuild_dirs
fi
# build it
- build_kernel_ib "${linux}"
+ build_kernel_ib "${linux}" "${kib_prefix}" "${kib_rpm}"
if [ -z "$REUSE_SIGNATURE" ]; then
echo "No reuse signature was caculated so not storing the built ofed"
if [ -z "$REUSE_SIGNATURE" ]; then
echo "No reuse signature was caculated so not storing the built ofed"
fi
pushd "$TOPDIR" >/dev/null
fi
pushd "$TOPDIR" >/dev/null
- rm -rf kernel-ib-devel
- mkdir kernel-ib-devel
- cd kernel-ib-devel
+ rm -rf ${kib_rpm}-devel
+ mkdir ${kib_rpm}-devel
+ cd ${kib_rpm}-devel
# the actual ofed RPMs don't have the -rc$n or -$date string appened that
# might be present on the file
local linuxrelease=$(find_linux_release "$linux")
ofed_version=$(echo $ofed_version |
sed -re 's/-(20[0-9]{6,6}-[0-9]{4,4}|rc[0-9]*)$//')
# the actual ofed RPMs don't have the -rc$n or -$date string appened that
# might be present on the file
local linuxrelease=$(find_linux_release "$linux")
ofed_version=$(echo $ofed_version |
sed -re 's/-(20[0-9]{6,6}-[0-9]{4,4}|rc[0-9]*)$//')
- local rpm=$(ls $TOPDIR/RPMS/*/kernel-ib-devel-${ofed_version}-${linuxrelease//-/_}.*.rpm)
+ local rpm=$(ls $TOPDIR/RPMS/*/${kib_rpm}-devel-${ofed_version}-${linuxrelease//-/_}.*.rpm)
if ! rpm2cpio < $rpm | cpio -id; then
if ! rpm2cpio < $rpm | cpio -id; then
- fatal 1 "could not unpack the kernel-ib-devel rpm."
+ fatal 1 "could not unpack the ${kib_rpm}-devel rpm."
- CONFIGURE_FLAGS="--with-o2ib=$(pwd)/usr/src/ofa_kernel ${CONFIGURE_FLAGS}"
+ CONFIGURE_FLAGS="--with-o2ib=$(pwd)/usr/src/${kib_prefix} ${CONFIGURE_FLAGS}"
-static inline wait_queue_head_t *sk_sleep(struct sock *sk)
+static inline wait_queue_head_t *cfs_sk_sleep(struct sock *sk)
+#else
+#define cfs_sk_sleep(sk) sk_sleep(sk)
#endif
#ifdef HAVE_INIT_NET
#endif
#ifdef HAVE_INIT_NET
newsock->ops = sock->ops;
set_current_state(TASK_INTERRUPTIBLE);
newsock->ops = sock->ops;
set_current_state(TASK_INTERRUPTIBLE);
- add_wait_queue(sk_sleep(sock->sk), &wait);
+ add_wait_queue(cfs_sk_sleep(sock->sk), &wait);
rc = sock->ops->accept(sock, newsock, O_NONBLOCK);
if (rc == -EAGAIN) {
rc = sock->ops->accept(sock, newsock, O_NONBLOCK);
if (rc == -EAGAIN) {
rc = sock->ops->accept(sock, newsock, O_NONBLOCK);
}
rc = sock->ops->accept(sock, newsock, O_NONBLOCK);
}
- remove_wait_queue(sk_sleep(sock->sk), &wait);
+ remove_wait_queue(cfs_sk_sleep(sock->sk), &wait);
set_current_state(TASK_RUNNING);
if (rc != 0)
set_current_state(TASK_RUNNING);
if (rc != 0)
void
libcfs_sock_abort_accept (struct socket *sock)
{
void
libcfs_sock_abort_accept (struct socket *sock)
{
- wake_up_all(sk_sleep(sock->sk));
+ wake_up_all(cfs_sk_sleep(sock->sk));
}
EXPORT_SYMBOL(libcfs_sock_abort_accept);
}
EXPORT_SYMBOL(libcfs_sock_abort_accept);
#include <linux/version.h>
#include <linux/pci.h>
#include <linux/gfp.h>
#include <linux/version.h>
#include <linux/pci.h>
#include <linux/gfp.h>
+ #ifdef HAVE_COMPAT_RDMA
+ #include <linux/compat-2.6.h>
+ #endif
#include <rdma/rdma_cm.h>
#include <rdma/ib_cm.h>
#include <rdma/ib_verbs.h>
#include <rdma/rdma_cm.h>
#include <rdma/ib_cm.h>
#include <rdma/ib_verbs.h>
if test $ENABLEO2IB -ne 0; then
AC_MSG_CHECKING([if rdma_create_id wants four args])
LB_LINUX_TRY_COMPILE([
if test $ENABLEO2IB -ne 0; then
AC_MSG_CHECKING([if rdma_create_id wants four args])
LB_LINUX_TRY_COMPILE([
+ #ifdef HAVE_COMPAT_RDMA
+ #include <linux/compat-2.6.h>
+ #endif
#include <rdma/rdma_cm.h>
],[
rdma_create_id(NULL, NULL, 0, 0);
#include <rdma/rdma_cm.h>
],[
rdma_create_id(NULL, NULL, 0, 0);
#include <lnet/lib-lnet.h>
#include <lnet/lnet-sysctl.h>
#include <lnet/lib-lnet.h>
#include <lnet/lnet-sysctl.h>
+#ifdef HAVE_COMPAT_RDMA
+#include <linux/compat-2.6.h>
+#endif
#include <rdma/rdma_cm.h>
#include <rdma/ib_cm.h>
#include <rdma/ib_verbs.h>
#include <rdma/rdma_cm.h>
#include <rdma/ib_cm.h>
#include <rdma/ib_verbs.h>