--- /dev/null
+EXTRA_CFLAGS += $(OPENIB_KERNEL_EXTRA_CFLAGS) \
+ $(KERNEL_MEMTRACK_CFLAGS) \
+ $(KERNEL_NFS_FS_CFLAGS) \
+ -I$(CWD)/include \
+ -I$(CWD)/drivers/infiniband/ulp/ipoib \
+ -I$(CWD)/drivers/infiniband/debug \
+ -I$(CWD)/drivers/net/ethernet/chelsio/cxgb3 \
+ -I$(CWD)/drivers/net/ethernet/chelsio/cxgb4 \
+ -I$(CWD)/net/rds \
+ -I$(CWD)/drivers/net/ethernet/mellanox/mlx4 \
+ -I$(CWD)/drivers/infiniband/hw/mlx4 \
+ -DCOMPAT_BASE_TREE="\"$(shell cat compat_base_tree)\"" \
+ -DCOMPAT_BASE_TREE_VERSION="\"$(shell cat compat_base_tree_version)\"" \
+ -DCOMPAT_PROJECT="\"Compat-rdma\"" \
+ -DCOMPAT_VERSION="\"$(shell cat compat_version)\""
+
+obj-y := compat/
+obj-$(CONFIG_INFINIBAND) += drivers/infiniband/
+obj-$(CONFIG_CHELSIO_T3) += drivers/net/ethernet/chelsio/cxgb3/
+obj-$(CONFIG_CHELSIO_T4) += drivers/net/ethernet/chelsio/cxgb4/
+obj-$(CONFIG_MLX4_CORE) += drivers/net/ethernet/mellanox/mlx4/
+obj-$(CONFIG_RDS) += net/rds/
+obj-$(CONFIG_MEMTRACK) += drivers/infiniband/debug/
+obj-$(CONFIG_SUNRPC_XPRT_RDMA) += net/sunrpc/
+obj-$(CONFIG_SUNRPC_XPRT_RDMA) += net/sunrpc/auth_gss/
+obj-$(CONFIG_SUNRPC_XPRT_RDMA) += net/sunrpc/xprtrdma/
+obj-$(CONFIG_SUNRPC_XPRT_RDMA) += fs/nfs/
+obj-$(CONFIG_SUNRPC_XPRT_RDMA) += fs/lockd/
+obj-$(CONFIG_SUNRPC_XPRT_RDMA) += fs/exportfs/
+obj-$(CONFIG_SUNRPC_XPRT_RDMA) += fs/nfs_common/
+obj-$(CONFIG_SUNRPC_XPRT_RDMA) += fs/nfsd/
--- /dev/null
+#
+# Copyright (c) 2012 Mellanox Technologies. All rights reserved.
+#
+# This Software is licensed under one of the following licenses:
+#
+# 1) under the terms of the "Common Public License 1.0" a copy of which is
+# available from the Open Source Initiative, see
+# http://www.opensource.org/licenses/cpl.php.
+#
+# 2) under the terms of the "The BSD License" a copy of which is
+# available from the Open Source Initiative, see
+# http://www.opensource.org/licenses/bsd-license.php.
+#
+# 3) under the terms of the "GNU General Public License (GPL) Version 2" a
+# copy of which is available from the Open Source Initiative, see
+# http://www.opensource.org/licenses/gpl-license.php.
+#
+# Licensee has the right to choose one of the above licenses.
+#
+# Redistributions of source code must retain the above copyright
+# notice and one of the license notices.
+#
+# Redistributions in binary form must reproduce both the above copyright
+# notice, one of the license notices in the documentation
+# and/or other materials provided with the distribution.
+#
+#
+
+%{!?configure_options: %define configure_options %{nil}}
+
+# %{!?MEMTRACK: %define MEMTRACK 0}
+%define MEMTRACK %(if ( echo %{configure_options} | grep "with-memtrack" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define MADEYE %(if ( echo %{configure_options} | grep "with-madeye-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+
+%{!?KVERSION: %define KVERSION %(uname -r)}
+%define krelver %(echo -n %{KVERSION} | sed -e 's/-/_/g')
+
+%{!?build_kernel_ib: %define build_kernel_ib 0}
+%{!?build_kernel_ib_devel: %define build_kernel_ib_devel 0}
+
+# Select packages to build
+%{!?modprobe_update: %define modprobe_update %(if ( echo %{configure_options} | grep "without-modprobe" > /dev/null ); then echo -n '0'; else echo -n '1'; fi)}
+
+# Kernel module packages to be included into compat-rdma
+%define build_mthca %(if ( echo %{configure_options} | grep "with-mthca-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define build_qib %(if ( echo %{configure_options} | grep "with-qib-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define build_ipath %(if ( echo %{configure_options} | grep "with-ipath_inf-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define build_ehca %(if ( echo %{configure_options} | grep "with-ehca-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define build_ipoib %(if ( echo %{configure_options} | grep "with-ipoib-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define build_sdp %(if ( echo %{configure_options} | grep "with-sdp-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define build_srp %(if ( echo %{configure_options} | grep "with-srp-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define build_srpt %(if ( echo %{configure_options} | grep "with-srp-target-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define build_iser %(if ( echo %{configure_options} | grep "with-iser-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define build_oiscsi %(if ( echo %{configure_options} | grep "with-iscsi-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define build_rds %(if ( echo %{configure_options} | grep "with-rds-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define build_cxgb3 %(if ( echo %{configure_options} | grep "with-cxgb3-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define build_cxgb4 %(if ( echo %{configure_options} | grep "with-cxgb4-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define build_nes %(if ( echo %{configure_options} | grep "with-nes-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define build_mlx4 %(if ( echo %{configure_options} | grep "with-mlx4-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define build_mlx4_en %(if ( echo %{configure_options} | grep "with-mlx4_en-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define build_qlgc_vnic %(if ( echo %{configure_options} | grep "with-qlgc_vnic-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define build_nfsrdma %(if ( echo %{configure_options} | grep "with-nfsrdma-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+
+%{!?LIB_MOD_DIR: %define LIB_MOD_DIR /lib/modules/%{KVERSION}/updates}
+
+%{!?RDMA_CONF_DIR: %define RDMA_CONF_DIR /etc/infiniband}
+%{!?MLXNET_CONF_DIR: %define MLXNET_CONF_DIR /etc/mlxethernet}
+
+%{!?K_SRC: %define K_SRC /lib/modules/%{KVERSION}/build}
+
+%{!?KERNEL_SOURCES: %define KERNEL_SOURCES /lib/modules/%{KVERSION}/source}
+
+# Do not include srp.h if it exist in the kernel
+%define include_srp_h %(if [ -e %{KERNEL_SOURCES}/include/scsi/srp.h ]; then echo -n 0; else echo -n 1; fi )
+%define include_rdma %(if [ -d %{KERNEL_SOURCES}/include/rdma ]; then echo -n 1; else echo -n 0; fi )
+
+%define include_udev_rules %(eval `grep udev_rules /etc/udev/udev.conf | grep -v '^#'` ; if test -d $udev_rules; then echo -n 1; else echo -n 0; fi)
+
+# Disable debugging
+%define debug_package %{nil}
+%define __check_files %{nil}
+
+# Disable brp-lib64-linux
+%ifarch x86_64 ia64
+%define __arch_install_post %{nil}
+%endif
+
+%{!?_name: %define _name compat-rdma}
+%{!?_version: %define _version @VERSION@}
+%{!?_release: %define _release @RELEASE@}
+
+Name: %{_name}
+Version: %{_version}
+Release: %{_release}
+License: GPL/BSD
+Url: http://openfabrics.org/
+Group: System Environment/Base
+Source: %{_name}-%{_version}.tgz
+BuildRoot: %{?build_root:%{build_root}}%{!?build_root:/var/tmp/OFED}
+Vendor: OpenFabrics
+Requires: coreutils
+Requires: kernel
+Requires: pciutils
+Requires: grep
+Requires: perl
+Requires: procps
+Requires: module-init-tools
+Summary: Infiniband Driver and ULPs kernel modules
+%description
+InfiniBand "verbs", Access Layer and ULPs
+
+%package -n compat-rdma-devel
+Requires: coreutils
+Requires: kernel
+Requires: pciutils
+Requires: compat-rdma
+Version: %{_version}
+Release: %{krelver}
+Summary: Infiniband Driver and ULPs kernel modules sources
+Group: System Environment/Libraries
+%description -n compat-rdma-devel
+Core, HW and ULPs kernel modules sources
+
+%prep
+%setup -n %{_name}-%{_version}
+
+%build
+rm -rf $RPM_BUILD_ROOT
+cd $RPM_BUILD_DIR/%{_name}-%{_version}
+
+%if %{build_kernel_ib_devel}
+# Save clean sources for compat-rdma-devel
+mkdir -p $RPM_BUILD_DIR/src
+cp -a $RPM_BUILD_DIR/%{_name}-%{_version} $RPM_BUILD_DIR/src/
+%endif
+
+./configure --prefix=%{_prefix} --kernel-version %{KVERSION} --kernel-sources %{K_SRC} --modules-dir %{LIB_MOD_DIR} %{configure_options}
+
+%if %{build_kernel_ib_devel}
+# Copy InfniBand include files after applying backport patches (if required)
+mkdir -p $RPM_BUILD_DIR/src/%{_name}
+cp -a $RPM_BUILD_DIR/%{_name}-%{_version}/include/ $RPM_BUILD_DIR/src/%{_name}
+cp -a $RPM_BUILD_DIR/%{_name}-%{_version}/configure.mk.kernel $RPM_BUILD_DIR/src/%{_name}
+cp -a $RPM_BUILD_DIR/%{_name}-%{_version}/config.mk $RPM_BUILD_DIR/src/%{_name}
+sed -i -e "s@\${CWD}@%{_prefix}/src/%{_name}@g" $RPM_BUILD_DIR/src/%{_name}/config.mk
+%endif
+
+%if %{build_kernel_ib}
+%if %{build_srpt}
+if [ -f /usr/local/include/scst/Module.symvers ]; then
+ cat /usr/local/include/scst/Module.symvers >> ./Module.symvers
+fi
+%endif
+export INSTALL_MOD_DIR=updates
+make kernel
+%endif
+
+%install
+%if %{build_kernel_ib_devel}
+mkdir -p $RPM_BUILD_ROOT/%{_prefix}/src
+cp -a $RPM_BUILD_DIR/src/%{_name}-%{_version} $RPM_BUILD_ROOT/%{_prefix}/src
+cp -a $RPM_BUILD_DIR/src/%{_name} $RPM_BUILD_ROOT/%{_prefix}/src
+rm -rf $RPM_BUILD_DIR/src
+
+# Support external modules include dir for backward compatibility
+cd $RPM_BUILD_ROOT/%{_prefix}/src/
+ln -s %{_name} openib
+cd -
+%endif
+
+%if %{build_kernel_ib}
+make install_kernel MODULES_DIR=%{LIB_MOD_DIR} INSTALL_MOD_PATH=$RPM_BUILD_ROOT INSTALL_MOD_DIR=updates KERNELRELEASE=%{KVERSION}
+%endif
+
+%if %{build_kernel_ib_devel}
+modsyms=`find $RPM_BUILD_DIR/%{_name}-%{_version} -name Module.symvers -o -name Modules.symvers`
+if [ -n "$modsyms" ]; then
+ for modsym in $modsyms
+ do
+ cat $modsym >> $RPM_BUILD_ROOT/%{_prefix}/src/%{_name}/Module.symvers
+ done
+else
+ ./ofed_scripts/create_Module.symvers.sh
+ cp ./Module.symvers $RPM_BUILD_ROOT/%{_prefix}/src/%{_name}/Module.symvers
+fi
+%endif
+
+INFO=${RPM_BUILD_ROOT}%{RDMA_CONF_DIR}/info
+/bin/rm -f ${INFO}
+mkdir -p ${RPM_BUILD_ROOT}%{RDMA_CONF_DIR}
+touch ${INFO}
+
+cat >> ${INFO} << EOFINFO
+#!/bin/bash
+
+echo prefix=%{_prefix}
+echo Kernel=%{KVERSION}
+echo
+echo "Configure options: %{configure_options}"
+echo
+EOFINFO
+
+chmod +x ${INFO} > /dev/null 2>&1
+
+# Copy infiniband configuration
+install -d $RPM_BUILD_ROOT/%{RDMA_CONF_DIR}
+install -m 0644 $RPM_BUILD_DIR/%{_name}-%{_version}/ofed_scripts/openib.conf $RPM_BUILD_ROOT/%{RDMA_CONF_DIR}
+
+# Install openib service script
+install -d $RPM_BUILD_ROOT/etc/init.d
+install -m 0755 $RPM_BUILD_DIR/%{_name}-%{_version}/ofed_scripts/openibd $RPM_BUILD_ROOT/etc/init.d
+install -d $RPM_BUILD_ROOT/sbin
+install -m 0755 $RPM_BUILD_DIR/%{_name}-%{_version}/ofed_scripts/sysctl_perf_tuning $RPM_BUILD_ROOT/sbin
+
+%if %{build_mlx4}
+install -d $RPM_BUILD_ROOT/%{_bindir}
+install -m 0755 $RPM_BUILD_DIR/%{_name}-%{_version}/ofed_scripts/ibdev2netdev $RPM_BUILD_ROOT/%{_bindir}
+%endif
+
+%if %{build_mlx4_en}
+install -d $RPM_BUILD_ROOT/sbin
+install -m 0755 $RPM_BUILD_DIR/%{_name}-%{_version}/ofed_scripts/connectx_port_config $RPM_BUILD_ROOT/sbin
+touch $RPM_BUILD_ROOT/%{RDMA_CONF_DIR}/connectx.conf
+%endif
+
+%if %{build_qib}
+install -m 0644 $RPM_BUILD_DIR/%{_name}-%{_version}/ofed_scripts/truescale.cmds $RPM_BUILD_ROOT/%{RDMA_CONF_DIR}
+%endif
+
+%if %{build_ipoib}
+%if %{modprobe_update}
+install -d $RPM_BUILD_ROOT/etc/modprobe.d
+install -m 0644 $RPM_BUILD_DIR/%{_name}-%{_version}/ofed_scripts/ib_ipoib.conf $RPM_BUILD_ROOT/etc/modprobe.d
+%endif
+%endif
+
+%if %{build_sdp}
+%if %{modprobe_update}
+install -d $RPM_BUILD_ROOT/etc/modprobe.d
+install -m 0644 $RPM_BUILD_DIR/%{_name}-%{_version}/ofed_scripts/ib_sdp.conf $RPM_BUILD_ROOT/etc/modprobe.d
+%endif
+%endif
+
+%if %{include_udev_rules}
+install -d $RPM_BUILD_ROOT/etc/udev/rules.d
+install -m 0644 $RPM_BUILD_DIR/%{_name}-%{_version}/ofed_scripts/90-ib.rules $RPM_BUILD_ROOT/etc/udev/rules.d
+case "$(udevinfo -V 2> /dev/null | awk '{print $NF}' 2> /dev/null)" in
+0[1-4]*)
+sed -i -e 's/KERNEL==/KERNEL=/g' $RPM_BUILD_ROOT/etc/udev/rules.d/90-ib.rules
+;;
+esac
+%endif
+
+%clean
+#Remove installed driver after rpm build finished
+rm -rf $RPM_BUILD_ROOT
+rm -rf $RPM_BUILD_DIR/%{_name}-%{_version}
+
+%pre
+
+%pre -n compat-rdma-devel
+
+%post
+if [ $1 -ge 1 ]; then # 1 : This package is being installed or reinstalled
+count_ib_ports()
+{
+ local cnt=0
+ local tmp_cnt=0
+
+ tmp_cnt=$(/sbin/lspci -n | grep "15b3:" | wc -l | tr -d '[:space:]') # Mellanox HCAs
+ cnt=$[ $cnt + 2*${tmp_cnt} ]
+
+ tmp_cnt=$(/sbin/lspci -n | grep -E "1fc1:|1077:7220" | wc -l | tr -d '[:space:]') # QLogic SDR and DDR HCA
+ cnt=$[ $cnt + ${tmp_cnt} ]
+
+ tmp_cnt=$(/sbin/lspci -n | grep -E "1077:7322" | wc -l | tr -d '[:space:]') # QLogic QDR HCA
+ cnt=$[ $cnt + 2*${tmp_cnt} ]
+ return $cnt
+}
+
+count_ib_ports
+ports_num=$?
+
+# Set default number of ports to 2 if no HCAs found
+if [ $ports_num -eq 0 ]; then
+ ports_num=2
+fi
+#############################################################################################################
+# Modules configuration #
+#############################################################################################################
+
+%if ! %{include_udev_rules}
+ if [ -e /etc/udev/udev.rules ]; then
+ perl -ni -e 'if (/\# Infiniband devices \#$/) { $filter = 1 }' -e 'if (!$filter) { print }' -e 'if (/\# End Infiniband devices \#$/){ $filter = 0 }' /etc/udev/udev.rules
+ cat >> /etc/udev/udev.rules << EOF
+# Infiniband devices #
+KERNEL="umad*", NAME="infiniband/%k"
+KERNEL="issm*", NAME="infiniband/%k"
+KERNEL="ucm*", NAME="infiniband/%k", MODE="0666"
+KERNEL="uverbs*", NAME="infiniband/%k", MODE="0666"
+KERNEL="uat", NAME="infiniband/%k", MODE="0666"
+KERNEL="ucma", NAME="infiniband/%k", MODE="0666"
+KERNEL="rdma_cm", NAME="infiniband/%k", MODE="0666"
+# End Infiniband devices #
+EOF
+ fi
+%endif
+
+%if %{modprobe_update}
+%if %{build_ipoib}
+for (( i=0 ; i < $ports_num ; i++ ))
+do
+cat >> /etc/modprobe.d/ib_ipoib.conf << EOF
+alias ib${i} ib_ipoib
+EOF
+done
+%endif
+%endif
+
+ /sbin/depmod %{KVERSION}
+
+#############################################################################################################
+
+
+if [[ -f /etc/redhat-release || -f /etc/rocks-release ]]; then
+perl -i -ne 'if (m@^#!/bin/bash@) {
+ print q@#!/bin/bash
+#
+# Bring up/down openib
+#
+# chkconfig: 2345 05 95
+# description: Activates/Deactivates InfiniBand Driver to \
+# start at boot time.
+#
+### BEGIN INIT INFO
+# Provides: openibd
+### END INIT INFO
+@;
+ } else {
+ print;
+ }' /etc/init.d/openibd
+
+ if ! ( /sbin/chkconfig --del openibd > /dev/null 2>&1 ); then
+ true
+ fi
+ if ! ( /sbin/chkconfig --add openibd > /dev/null 2>&1 ); then
+ true
+ fi
+fi
+
+if [ -f /etc/SuSE-release ]; then
+ local_fs='$local_fs'
+ openiscsi=''
+ %if %{build_oiscsi}
+ openiscsi='open-iscsi'
+ %endif
+ perl -i -ne "if (m@^#!/bin/bash@) {
+ print q@#!/bin/bash
+### BEGIN INIT INFO
+# Provides: openibd
+# Required-Start: $local_fs
+# Required-Stop: opensmd $openiscsi
+# Default-Start: 2 3 5
+# Default-Stop: 0 1 2 6
+# Description: Activates/Deactivates InfiniBand Driver to \
+# start at boot time.
+### END INIT INFO
+@;
+ } else {
+ print;
+ }" /etc/init.d/openibd
+
+ if ! ( /sbin/insserv openibd > /dev/null 2>&1 ); then
+ true
+ fi
+fi
+
+if [ -f /etc/debian_version ]; then
+ local_fs='$local_fs'
+ openiscsi=''
+ %if %{build_oiscsi}
+ openiscsi='open-iscsi'
+ %endif
+ perl -i -ne "if (m@^#!/bin/bash@) {
+ print q@#!/bin/bash
+### BEGIN INIT INFO
+# Provides: openibd
+# Required-Start: $local_fs
+# Required-Stop: opensmd $openiscsi
+# Default-Start: 2 3 5
+# Default-Stop: 0 1 2 6
+# Description: Activates/Deactivates InfiniBand Driver to \
+# start at boot time.
+### END INIT INFO
+@;
+ } else {
+ print;
+ }" /etc/init.d/openibd
+
+ if ! ( /usr/sbin/update-rc.d openibd defaults > /dev/null 2>&1 ); then
+ true
+ fi
+fi
+
+%if %{build_kernel_ib}
+ echo >> %{RDMA_CONF_DIR}/openib.conf
+ echo "# Load UCM module" >> %{RDMA_CONF_DIR}/openib.conf
+ echo "UCM_LOAD=no" >> %{RDMA_CONF_DIR}/openib.conf
+ echo >> %{RDMA_CONF_DIR}/openib.conf
+ echo "# Load RDMA_CM module" >> %{RDMA_CONF_DIR}/openib.conf
+ echo "RDMA_CM_LOAD=yes" >> %{RDMA_CONF_DIR}/openib.conf
+ echo >> %{RDMA_CONF_DIR}/openib.conf
+ echo "# Load RDMA_UCM module" >> %{RDMA_CONF_DIR}/openib.conf
+ echo "RDMA_UCM_LOAD=yes" >> %{RDMA_CONF_DIR}/openib.conf
+ echo >> %{RDMA_CONF_DIR}/openib.conf
+ echo "# Increase ib_mad thread priority" >> %{RDMA_CONF_DIR}/openib.conf
+ echo "RENICE_IB_MAD=no" >> %{RDMA_CONF_DIR}/openib.conf
+ echo >> %{RDMA_CONF_DIR}/openib.conf
+ echo "# Run sysctl performance tuning script" >> %{RDMA_CONF_DIR}/openib.conf
+ echo "RUN_SYSCTL=yes" >> %{RDMA_CONF_DIR}/openib.conf
+%endif
+
+%if %{build_mthca}
+ echo >> %{RDMA_CONF_DIR}/openib.conf
+ echo "# Load MTHCA" >> %{RDMA_CONF_DIR}/openib.conf
+ echo "MTHCA_LOAD=yes" >> %{RDMA_CONF_DIR}/openib.conf
+%endif
+
+%if %{build_qib}
+ echo >> %{RDMA_CONF_DIR}/openib.conf
+ echo "# Load QIB" >> %{RDMA_CONF_DIR}/openib.conf
+ echo "QIB_LOAD=yes" >> %{RDMA_CONF_DIR}/openib.conf
+%endif
+
+%if %{build_ipath}
+ echo >> %{RDMA_CONF_DIR}/openib.conf
+ echo "# Load IPATH" >> %{RDMA_CONF_DIR}/openib.conf
+ echo "IPATH_LOAD=yes" >> %{RDMA_CONF_DIR}/openib.conf
+%endif
+
+%if %{build_ehca}
+ echo >> %{RDMA_CONF_DIR}/openib.conf
+ echo "# Load eHCA" >> %{RDMA_CONF_DIR}/openib.conf
+ echo "EHCA_LOAD=yes" >> %{RDMA_CONF_DIR}/openib.conf
+%endif
+
+%if %{build_mlx4}
+ echo >> %{RDMA_CONF_DIR}/openib.conf
+ echo "# Load MLX4 modules" >> %{RDMA_CONF_DIR}/openib.conf
+ echo "MLX4_LOAD=yes" >> %{RDMA_CONF_DIR}/openib.conf
+%endif
+
+%if %{build_mlx4_en}
+ echo >> %{RDMA_CONF_DIR}/openib.conf
+ echo "# Load MLX4_EN module" >> %{RDMA_CONF_DIR}/openib.conf
+ echo "MLX4_EN_LOAD=yes" >> %{RDMA_CONF_DIR}/openib.conf
+%endif
+
+%if %{build_cxgb3}
+ echo >> %{RDMA_CONF_DIR}/openib.conf
+ echo "# Load CXGB3 modules" >> %{RDMA_CONF_DIR}/openib.conf
+ echo "CXGB3_LOAD=yes" >> %{RDMA_CONF_DIR}/openib.conf
+%endif
+
+%if %{build_cxgb4}
+ echo >> %{RDMA_CONF_DIR}/openib.conf
+ echo "# Load CXGB4 modules" >> %{RDMA_CONF_DIR}/openib.conf
+ echo "CXGB4_LOAD=yes" >> %{RDMA_CONF_DIR}/openib.conf
+%endif
+
+%if %{build_nes}
+ echo >> %{RDMA_CONF_DIR}/openib.conf
+ echo "# Load NES modules" >> %{RDMA_CONF_DIR}/openib.conf
+ echo "NES_LOAD=yes" >> %{RDMA_CONF_DIR}/openib.conf
+%endif
+
+%if %{build_ipoib}
+ echo >> %{RDMA_CONF_DIR}/openib.conf
+ echo "# Load IPoIB" >> %{RDMA_CONF_DIR}/openib.conf
+ echo "IPOIB_LOAD=yes" >> %{RDMA_CONF_DIR}/openib.conf
+ echo >> %{RDMA_CONF_DIR}/openib.conf
+ echo "# Enable IPoIB Connected Mode" >> %{RDMA_CONF_DIR}/openib.conf
+ echo "SET_IPOIB_CM=yes" >> %{RDMA_CONF_DIR}/openib.conf
+%endif
+
+%if %{build_sdp}
+ echo >> %{RDMA_CONF_DIR}/openib.conf
+ echo "# Load SDP module" >> %{RDMA_CONF_DIR}/openib.conf
+ echo "SDP_LOAD=yes" >> %{RDMA_CONF_DIR}/openib.conf
+%endif
+
+%if %{build_srp}
+ echo >> %{RDMA_CONF_DIR}/openib.conf
+ echo "# Load SRP module" >> %{RDMA_CONF_DIR}/openib.conf
+ echo "SRP_LOAD=no" >> %{RDMA_CONF_DIR}/openib.conf
+%endif
+
+%if %{build_srpt}
+ echo >> %{RDMA_CONF_DIR}/openib.conf
+ echo "# Load SRP Target module" >> %{RDMA_CONF_DIR}/openib.conf
+ echo "SRPT_LOAD=no" >> %{RDMA_CONF_DIR}/openib.conf
+%endif
+
+%if %{build_iser}
+ echo >> %{RDMA_CONF_DIR}/openib.conf
+ echo "# Load ISER module" >> %{RDMA_CONF_DIR}/openib.conf
+ echo "ISER_LOAD=no" >> %{RDMA_CONF_DIR}/openib.conf
+%endif
+
+%if %{build_rds}
+ echo >> %{RDMA_CONF_DIR}/openib.conf
+ echo "# Load RDS module" >> %{RDMA_CONF_DIR}/openib.conf
+ echo "RDS_LOAD=no" >> %{RDMA_CONF_DIR}/openib.conf
+%endif
+
+%if %{build_qlgc_vnic}
+ echo >> %{RDMA_CONF_DIR}/openib.conf
+ echo "# Load QLogic VNIC module" >> %{RDMA_CONF_DIR}/openib.conf
+ echo "QLGC_VNIC_LOAD=yes" >> %{RDMA_CONF_DIR}/openib.conf
+%endif
+
+fi # 1 : closed
+# END of post
+
+%post -n compat-rdma-devel
+
+%preun
+if [ $1 = 0 ]; then # 1 : Erase, not upgrade
+ if [[ -f /etc/redhat-release || -f /etc/rocks-release ]]; then
+ if ! ( /sbin/chkconfig --del openibd > /dev/null 2>&1 ); then
+ true
+ fi
+ fi
+ if [ -f /etc/SuSE-release ]; then
+ if ! ( /sbin/insserv -r openibd > /dev/null 2>&1 ); then
+ true
+ fi
+ fi
+ if [ -f /etc/debian_version ]; then
+ if ! ( /usr/sbin/update-rc.d openibd remove > /dev/null 2>&1 ); then
+ true
+ fi
+ fi
+fi
+
+%postun
+if [ $1 = 0 ]; then # 1 : Erase, not upgrade
+ # Clean /etc/modprobe.d/ofed.conf
+ # Remove previous configuration if exist
+ /sbin/depmod %{KVERSION}
+
+# Clean udev.rules
+%if ! %{include_udev_rules}
+ if [ -e /etc/udev/udev.rules ]; then
+ perl -ni -e 'if (/\# Infiniband devices \#$/) { $filter = 1 }' -e 'if (!$filter) { print }' -e 'if (/\# End Infiniband devices \#$/){ $filter = 0 }' /etc/udev/udev.rules
+ fi
+%endif
+
+# Clean sysctl.conf
+if [ -f /etc/sysctl.conf ]; then
+perl -ni -e 'if (/\#\# OFED Network tuning parameters \#\#$/) { $filter = 1 }' -e 'if (!$filter) { print }' -e 'if (/\#\# END of OFED parameters \#\#$/){ $filter = 0 }' /etc/sysctl.conf
+fi
+
+fi
+
+%postun -n compat-rdma-devel
+
+%files
+%defattr(-,root,root,-)
+%dir %{RDMA_CONF_DIR}
+%config(noreplace) %{RDMA_CONF_DIR}/openib.conf
+%{RDMA_CONF_DIR}/info
+/etc/init.d/openibd
+/sbin/sysctl_perf_tuning
+%if %{include_udev_rules}
+/etc/udev/rules.d/90-ib.rules
+%endif
+%{LIB_MOD_DIR}
+%if %{build_qib}
+%config(noreplace) %{RDMA_CONF_DIR}/truescale.cmds
+%endif
+%if %{build_ipoib}
+%if %{modprobe_update}
+/etc/modprobe.d/ib_ipoib.conf
+%endif
+%endif
+%if %{build_sdp}
+%if %{modprobe_update}
+/etc/modprobe.d/ib_sdp.conf
+%endif
+%endif
+%if %{build_mlx4}
+%{_bindir}/ibdev2netdev
+%endif
+%if %{build_mlx4_en}
+/sbin/connectx_port_config
+%config(noreplace) %{RDMA_CONF_DIR}/connectx.conf
+%endif
+
+%files -n compat-rdma-devel
+%defattr(-,root,root,-)
+%dir %{_prefix}/src
+%{_prefix}/src/%{_name}-%{_version}
+%{_prefix}/src/%{_name}
+%{_prefix}/src/openib
+
+%changelog
+* Thu Feb 16 2012 Vladimir Sokolovsky <vlad@mellanox.com>
+- Created spec file for compat-rdma
+r compat-rdma
--- /dev/null
+#!/bin/bash
+#
+# Copyright (c) 2006 Mellanox Technologies. All rights reserved.
+#
+# This Software is licensed under one of the following licenses:
+#
+# 1) under the terms of the "Common Public License 1.0" a copy of which is
+# available from the Open Source Initiative, see
+# http://www.opensource.org/licenses/cpl.php.
+#
+# 2) under the terms of the "The BSD License" a copy of which is
+# available from the Open Source Initiative, see
+# http://www.opensource.org/licenses/bsd-license.php.
+#
+# 3) under the terms of the "GNU General Public License (GPL) Version 2" a
+# copy of which is available from the Open Source Initiative, see
+# http://www.opensource.org/licenses/gpl-license.php.
+#
+# Licensee has the right to choose one of the above licenses.
+#
+# Redistributions of source code must retain the above copyright
+# notice and one of the license notices.
+#
+# Redistributions in binary form must reproduce both the above copyright
+# notice, one of the license notices in the documentation
+# and/or other materials provided with the distribution.
+#
+# $Id: configure 9097 2006-08-24 06:39:09Z vlad $
+#
+
+usage()
+{
+cat << EOF
+\`configure' configures variables for kernel modules compilation
+
+Usage: `basename $0` [options]
+
+ --prefix=PREFIX for userspace components []
+ --build_root=BUILD_ROOT root directory to build RPM packages
+ --kernel-version=VERSION make for this kernel [$(uname -r)]
+ --modules-dir=DIR modules directory [/lib/modules/$(uname -r)]
+ --kernel-sources=DIR make for this kernel [/lib/modules/$(uname -r)/build]
+
+ Kernel modules configuration:
+
+ --with-core-mod make CONFIG_INFINIBAND=m [no]
+ --without-core-mod [yes]
+
+ --with-ipoib-mod make CONFIG_INFINIBAND_IPOIB=m [no]
+ --without-ipoib-mod [yes]
+
+ --with-ipoib-cm make CONFIG_INFINIBAND_IPOIB_CM=y [yes]
+ --without-ipoib-cm [no]
+
+ --with-ipoib_debug-mod make CONFIG_INFINIBAND_IPOIB_DEBUG=y [yes]
+ --without-ipoib_debug-mod [no]
+
+ --with-ipoib_debug_data-mod make CONFIG_INFINIBAND_IPOIB_DEBUG_DATA=y [no]
+ --without-ipoib_debug_data-mod [yes]
+
+ --with-sdp-mod make CONFIG_INFINIBAND_SDP=m [no]
+ --without-sdp-mod [yes]
+
+ --with-sdp_debug-mod make CONFIG_INFINIBAND_SDP_DEBUG=y [yes]
+ --without-sdp_debug-mod [no]
+
+ --with-sdp_debug_data-mod make CONFIG_INFINIBAND_SDP_DEBUG_DATA=y [no]
+ --without-sdp_debug_data-mod [yes]
+
+ --with-srp-mod make CONFIG_INFINIBAND_SRP=m [no]
+ --without-srp-mod [yes]
+
+ --with-srp-target-mod make CONFIG_INFINIBAND_SRPT=m [no]
+ --without-srp-target-mod [yes]
+
+ --with-user_mad-mod make CONFIG_INFINIBAND_USER_MAD=m [no]
+ --without-user_mad-mod [yes]
+
+ --with-user_access-mod make CONFIG_INFINIBAND_USER_ACCESS=m [no]
+ --without-user_access-mod [yes]
+
+ --with-addr_trans-mod make CONFIG_INFINIBAND_ADDR_TRANS=y [no]
+ --without-addr_trans-mod [yes]
+
+ --with-mthca-mod make CONFIG_INFINIBAND_MTHCA=m [no]
+ --without-mthca-mod [yes]
+
+ --with-mthca_debug-mod make CONFIG_INFINIBAND_MTHCA_DEBUG=y [yes]
+ --without-mthca_debug-mod [no]
+
+ --with-mlx4-mod make CONFIG_MLX4_CORE=y CONFIG_MLX4_INFINIBAND=y [no]
+ --without-mlx4-mod [yes]
+
+ --with-mlx4_core-mod make CONFIG_MLX4_CORE=y [no]
+ --without-mlx4_core-mod [yes]
+
+ --with-mlx4_en-mod make CONFIG_MLX4_EN=y [no]
+ --without-mlx4_en-mod [yes]
+
+ --with-mlx4_inf-mod make CONFIG_MLX4_INFINIBAND=y [no]
+ --without-mlx4_inf-mod [yes]
+
+ --with-mlx4_debug-mod make CONFIG_MLX4_DEBUG=y [yes]
+ --without-mlx4_debug-mod [no]
+
+ --with-ipath_inf-mod make CONFIG_INFINIBAND_IPATH=m [no]
+ --without-ipath_inf-mod [yes]
+
+ --with-qib-mod make CONFIG_INFINIBAND_QIB=m [no]
+ --without-qib-mod [yes]
+
+ --with-iser-mod make CONFIG_INFINIBAND_ISER=m [no]
+ --without-iser-mod [yes]
+
+ --with-ehca-mod make CONFIG_INFINIBAND_EHCA=m [no]
+ --without-ehca-mod [yes]
+
+ --with-rds-mod make CONFIG_RDS=m [no]
+ --without-rds-mod [no]
+
+ --with-rds_debug-mod make CONFIG_RDS_DEBUG=y [no]
+ --without-rds_debug-mod [yes]
+
+ --with-madeye-mod make CONFIG_INFINIBAND_MADEYE=m [no]
+ --without-madeye-mod [yes]
+
+ --with-qlgc_vnic-mod make CONFIG_INFINIBAND_QLGC_VNIC=m [no]
+ --without-qlgc_vnic-mod [yes]
+
+ --with-qlgc_vnic_stats-mod make CONFIG_INFINIBAND_QLGC_VNIC_STATS=y [no]
+ --without-qlgc_vnic_stats-mod [yes]
+
+ --with-cxgb3-mod make CONFIG_INFINIBAND_CXGB3=m [no]
+ --without-cxgb3-mod [yes]
+
+ --with-cxgb3_debug-mod make CONFIG_INFINIBAND_CXGB3_DEBUG=y [no]
+ --without-cxgb3_debug-mod [yes]
+
+ --with-cxgb4-mod make CONFIG_INFINIBAND_CXGB4=m [no]
+ --without-cxgb4-mod [yes]
+
+ --with-nes-mod make CONFIG_INFINIBAND_NES=m [no]
+ --without-nes-mod [yes]
+
+ --with-nes_debug-mod make CONFIG_INFINIBAND_NES_DEBUG=y [no]
+ --without-nes_debug-mod [yes]
+
+ --with-memtrack enable momory tracking [no]
+ --without-memtrack disable memory tracking [yes]
+
+ --with-debug-info make CONFIG_DEBUG_INFO=y [yes]
+ --without-debug-info [no]
+
+ --with-nfsrdma-mod make CONFIG_SUNRPC_XPRT_RDMA=m [no]
+ --without-nfsrdma-mod [yes]
+
+ --help - print out options
+
+
+EOF
+
+# Currently not supported options
+# --with-sdp-zcopy make CONFIG_INFINIBAND_SDP_SEND_ZCOPY=y CONFIG_INFINIBAND_SDP_RECV_ZCOPY=y [no]
+# --without-sdp-zcopy [yes]
+}
+
+# Execute command w/ echo and exit if it fail
+ex()
+{
+ echo "$@"
+ if ! "$@"; then
+ printf "\nFailed executing $@\n\n"
+ exit 1
+ fi
+}
+
+# Compare 2 kernel versions
+check_kerver()
+{
+ local kver=$1
+ local min_kver=$2
+ shift 2
+
+ kver_a=$(echo -n ${kver} | cut -d '.' -f 1)
+ kver_b=$(echo -n ${kver} | cut -d '.' -f 2)
+ kver_c=$(echo -n ${kver} | cut -d '.' -f 3 | cut -d '-' -f 1 | tr -d [:alpha:][:punct:])
+
+ min_kver_a=$(echo -n ${min_kver} | cut -d '.' -f 1)
+ min_kver_b=$(echo -n ${min_kver} | cut -d '.' -f 2)
+ min_kver_c=$(echo -n ${min_kver} | cut -d '.' -f 3 | cut -d '-' -f 1 | tr -d [:alpha:][:punct:])
+
+ if [ ${kver_a} -lt ${min_kver_a} ] ||
+ [[ ${kver_a} -eq ${min_kver_a} && ${kver_b} -lt ${min_kver_b} ]] ||
+ [[ ${kver_a} -eq ${min_kver_a} && ${kver_b} -eq ${min_kver_b} && ${kver_c} -lt ${min_kver_c} ]]; then
+ return 1
+ fi
+
+ return 0
+}
+
+main()
+{
+ ofed_patch_params=
+ # Parsing parameters
+ while [ ! -z "$1" ]
+ do
+ case $1 in
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p | -p)
+ shift
+ prefix=$1
+ PREFIX="--prefix ${prefix}"
+ ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=* | -p=*)
+ prefix=`expr "x$1" : 'x[^=]*=\(.*\)'`
+ PREFIX="--prefix ${prefix}"
+ ;;
+ -kernel-version | --kernel-version | --kern-ver | --ker-ver)
+ ofed_patch_params="$ofed_patch_params $1"
+ shift
+ ofed_patch_params="$ofed_patch_params $1"
+ KVERSION=$1
+ ;;
+ -kernel-version=* | --kernel-version=* | --kern-ver=* | --ker-ver=*)
+ ofed_patch_params="$ofed_patch_params $1"
+ KVERSION=`expr "x$1" : 'x[^=]*=\(.*\)'`
+ ;;
+ -modules-dir | --modules-dir | --mod-dir)
+ shift
+ MODULES_DIR=$1
+ ;;
+ -modules-dir=* | --modules-dir=* | --mod-dir=*)
+ MODULES_DIR=`expr "x$1" : 'x[^=]*=\(.*\)'`
+ ;;
+ -kernel-sources | --kernel-sources | --kernel-src | --kern-src | --ker-src)
+ shift
+ KSRC=$1
+ ;;
+ -kernel-sources=* | --kernel-sources=* | --kernel-src=* | --kern-src=* | --ker-src=*)
+ KSRC=`expr "x$1" : 'x[^=]*=\(.*\)'`
+ ;;
+ -with-quilt | --with-quilt)
+ ofed_patch_params="$ofed_patch_params $1"
+ if [ ! -z "$2" ] && [ "`echo -n $2 | cut -c 1`" != '-' ]; then
+ shift
+ ofed_patch_params="$ofed_patch_params $1"
+ fi
+ ;;
+ -with-quilt=* | --with-quilt=*)
+ ofed_patch_params="$ofed_patch_params $1"
+ ;;
+ --without-quilt)
+ ofed_patch_params="$ofed_patch_params $1"
+ ;;
+ -with-patchdir | --with-patchdir)
+ ofed_patch_params="$ofed_patch_params $1"
+ shift
+ ofed_patch_params="$ofed_patch_params $1"
+ ;;
+ -with-patchdir=* | --with-patchdir=*)
+ ofed_patch_params="$ofed_patch_params $1"
+ ;;
+ --without-patch)
+ ofed_patch_params="$ofed_patch_params $1"
+ ;;
+ --with-kernel-fixes)
+ ofed_patch_params="$ofed_patch_params $1"
+ ;;
+ --without-kernel-fixes)
+ ofed_patch_params="$ofed_patch_params $1"
+ ;;
+ --with-hpage-patch)
+ ofed_patch_params="$ofed_patch_params $1"
+ ;;
+ --without-hpage-patch)
+ ofed_patch_params="$ofed_patch_params $1"
+ ;;
+ --with-backport-patches)
+ ofed_patch_params="$ofed_patch_params $1"
+ ;;
+ --without-backport-patches)
+ ofed_patch_params="$ofed_patch_params $1"
+ ;;
+ --with-memtrack)
+ CONFIG_MEMTRACK="m"
+ ;;
+ --without-memtrack)
+ CONFIG_MEMTRACK=
+ ;;
+ --with-debug-info)
+ CONFIG_DEBUG_INFO="y"
+ ;;
+ --without-debug-info)
+ CONFIG_DEBUG_INFO=
+ ;;
+ --with-core-mod)
+ CONFIG_INFINIBAND="m"
+ ;;
+ --without-core-mod)
+ CONFIG_INFINIBAND=
+ ;;
+ --with-ipoib-mod)
+ CONFIG_INFINIBAND_IPOIB="m"
+ CONFIG_INFINIBAND_IPOIB_CM="y"
+ CONFIG_INFINIBAND_IPOIB_DEBUG="y"
+ ;;
+ --without-ipoib-mod)
+ CONFIG_INFINIBAND_IPOIB=
+ ;;
+ --with-ipoib-cm)
+ CONFIG_INFINIBAND_IPOIB_CM="y"
+ ;;
+ --without-ipoib-cm)
+ CONFIG_INFINIBAND_IPOIB_CM=
+ ;;
+ --with-ipoib_debug-mod)
+ CONFIG_INFINIBAND_IPOIB_DEBUG="y"
+ ;;
+ --without-ipoib_debug-mod)
+ CONFIG_INFINIBAND_IPOIB_DEBUG=
+ ;;
+ --with-ipoib_debug_data-mod)
+ CONFIG_INFINIBAND_IPOIB_DEBUG_DATA="y"
+ ;;
+ --without-ipoib_debug_data-mod)
+ CONFIG_INFINIBAND_IPOIB_DEBUG_DATA=
+ ;;
+ --with-sdp-mod)
+ CONFIG_INFINIBAND_SDP="m"
+ CONFIG_INFINIBAND_SDP_DEBUG="y"
+ ;;
+ --without-sdp-mod)
+ CONFIG_INFINIBAND_SDP=
+ ;;
+ --with-sdp-zcopy)
+ CONFIG_INFINIBAND_SDP_SEND_ZCOPY="y"
+ CONFIG_INFINIBAND_SDP_RECV_ZCOPY="y"
+ ;;
+ --without-sdp-zcopy)
+ CONFIG_INFINIBAND_SDP_SEND_ZCOPY=
+ CONFIG_INFINIBAND_SDP_RECV_ZCOPY=
+ ;;
+ --with-sdp_debug-mod)
+ CONFIG_INFINIBAND_SDP_DEBUG="y"
+ ;;
+ --without-sdp_debug-mod)
+ CONFIG_INFINIBAND_SDP_DEBUG=
+ ;;
+ --with-sdp_debug_data-mod)
+ CONFIG_INFINIBAND_SDP_DEBUG_DATA="y"
+ ;;
+ --without-sdp_debug_data-mod)
+ CONFIG_INFINIBAND_SDP_DEBUG_DATA=
+ ;;
+ --with-srp-mod)
+ CONFIG_INFINIBAND_SRP="m"
+ ;;
+ --without-srp-mod)
+ CONFIG_INFINIBAND_SRP=
+ ;;
+ --with-srp-target-mod)
+ CONFIG_INFINIBAND_SRPT="m"
+ ;;
+ --without-srp-target-mod)
+ CONFIG_INFINIBAND_SRPT=
+ ;;
+ --with-user_mad-mod)
+ CONFIG_INFINIBAND_USER_MAD="m"
+ ;;
+ --without-user_mad-mod)
+ CONFIG_INFINIBAND_USER_MAD=
+ ;;
+ --with-user_access-mod)
+ CONFIG_INFINIBAND_USER_ACCESS="m"
+ CONFIG_INFINIBAND_USER_MEM=y
+ ;;
+ --without-user_access-mod)
+ CONFIG_INFINIBAND_USER_ACCESS=
+ CONFIG_INFINIBAND_USER_MEM=
+ ;;
+ --with-addr_trans-mod)
+ CONFIG_INFINIBAND_ADDR_TRANS=y
+ ;;
+ --without-addr_trans-mod)
+ CONFIG_INFINIBAND_ADDR_TRANS=
+ ;;
+ --with-mthca-mod)
+ CONFIG_INFINIBAND_MTHCA="m"
+ CONFIG_INFINIBAND_MTHCA_DEBUG="y"
+ ;;
+ --without-mthca-mod)
+ CONFIG_INFINIBAND_MTHCA=
+ ;;
+ --with-mthca_debug-mod)
+ CONFIG_INFINIBAND_MTHCA_DEBUG="y"
+ ;;
+ --without-mthca_debug-mod)
+ CONFIG_INFINIBAND_MTHCA_DEBUG=
+ ;;
+ --with-mlx4-mod)
+ CONFIG_MLX4_CORE="m"
+ CONFIG_MLX4_INFINIBAND="m"
+ CONFIG_MLX4_DEBUG="y"
+ ;;
+ --with-mlx4_core-mod)
+ CONFIG_MLX4_CORE="m"
+ ;;
+ --without-mlx4_core-mod)
+ CONFIG_MLX4_CORE=
+ ;;
+ -without-mlx4-mod)
+ CONFIG_MLX4_CORE=
+ CONFIG_MLX4_INFINIBAND=
+ CONFIG_MLX4_DEBUG=
+ ;;
+ --with-mlx4_en-mod)
+ CONFIG_MLX4_CORE="m"
+ CONFIG_MLX4_EN="m"
+ ;;
+ --without-mlx4_en-mod)
+ CONFIG_MLX4_EN=
+ ;;
+ --with-mlx4_inf-mod)
+ CONFIG_MLX4_CORE="m"
+ CONFIG_MLX4_INFINIBAND="m"
+ ;;
+ --without-mlx4_inf-mod)
+ CONFIG_MLX4_INFINIBAND=
+ ;;
+ --with-mlx4_debug-mod)
+ CONFIG_MLX4_DEBUG="y"
+ ;;
+ --without-mlx4_debug-mod)
+ CONFIG_MLX4_DEBUG=
+ ;;
+ --with-ipath_inf-mod)
+ CONFIG_INFINIBAND_IPATH="m"
+ ;;
+ --without-ipath_inf-mod)
+ CONFIG_INFINIBAND_IPATH=
+ ;;
+ --with-qib-mod)
+ CONFIG_INFINIBAND_QIB="m"
+ ;;
+ --without-qib-mod)
+ CONFIG_INFINIBAND_QIB=
+ ;;
+ --with-iser-mod)
+ CONFIG_INFINIBAND_ISER="m"
+ ;;
+ --with-iscsi-mod)
+ CONFIG_SCSI_ISCSI_ATTRS="m"
+ CONFIG_ISCSI_TCP="m"
+ ;;
+ --without-iser-mod)
+ CONFIG_INFINIBAND_ISER=
+ CONFIG_SCSI_ISCSI_ATTRS=
+ CONFIG_ISCSI_TCP=
+ ;;
+ --with-ehca-mod)
+ CONFIG_INFINIBAND_EHCA="m"
+ CONFIG_INFINIBAND_EHCA_SCALING="y"
+ ;;
+ --without-ehca-mod)
+ CONFIG_INFINIBAND_EHCA=
+ CONFIG_INFINIBAND_EHCA_SCALING=
+ ;;
+ --with-rds-mod)
+ CONFIG_RDS="m"
+ CONFIG_RDS_RDMA="m"
+ CONFIG_RDS_TCP="m"
+ ;;
+ --without-rds-mod)
+ CONFIG_RDS=
+ CONFIG_RDS_RDMA=
+ CONFIG_RDS_TCP=
+ ;;
+ --with-rds_debug-mod)
+ CONFIG_RDS_DEBUG="y"
+ ;;
+ --without-rds_debug-mod)
+ CONFIG_RDS_DEBUG=
+ ;;
+ --with-madeye-mod)
+ CONFIG_INFINIBAND_MADEYE=m
+ ;;
+ --without-madeye-mod)
+ CONFIG_INFINIBAND_MADEYE=
+ ;;
+ --with-qlgc_vnic-mod)
+ CONFIG_INFINIBAND_QLGC_VNIC="m"
+ ;;
+ --without-qlgc_vnic-mod)
+ CONFIG_INFINIBAND_QLGC_VNIC=
+ ;;
+ --with-qlgc_vnic_stats-mod)
+ CONFIG_INFINIBAND_QLGC_VNIC_STATS="y"
+ ;;
+ --without-qlgc_vnic_stats-mod)
+ CONFIG_INFINIBAND_QLGC_VNIC_STATS=
+ ;;
+ --with-cxgb3-mod)
+ CONFIG_INFINIBAND_CXGB3="m"
+ CONFIG_CHELSIO_T3="m"
+ ;;
+ --without-cxgb3-mod)
+ CONFIG_INFINIBAND_CXGB3=
+ CONFIG_CHELSIO_T3=
+ ;;
+ --with-cxgb3_debug-mod)
+ CONFIG_INFINIBAND_CXGB3_DEBUG="y"
+ ;;
+ --without-cxgb3_debug-mod)
+ CONFIG_INFINIBAND_CXGB3_DEBUG=
+ ;;
+ --with-cxgb4-mod)
+ CONFIG_INFINIBAND_CXGB4="m"
+ CONFIG_CHELSIO_T4="m"
+ ;;
+ --without-cxgb4-mod)
+ CONFIG_INFINIBAND_CXGB4=
+ CONFIG_CHELSIO_T4=
+ ;;
+ --with-nes-mod)
+ CONFIG_INFINIBAND_NES="m"
+ ;;
+ --without-nes-mod)
+ CONFIG_INFINIBAND_NES=
+ ;;
+ --with-nes_debug-mod)
+ CONFIG_INFINIBAND_NES_DEBUG="y"
+ ;;
+ --without-nes_debug-mod)
+ CONFIG_INFINIBAND_NES_DEBUG=
+ ;;
+ --with-nfsrdma-mod)
+ CONFIG_SUNRPC_XPRT_RDMA="m"
+ CONFIG_NFSD_RDMA="y"
+ ;;
+ --without-nfsrdma-mod)
+ CONFIG_SUNRPC_XPRT_RDMA=
+ CONFIG_NFSD_RDMA=
+ ;;
+ --with-modprobe|--without-modprobe)
+ ;;
+ -h | --help)
+ usage
+ exit 0
+ ;;
+ --with*)
+ echo
+ echo "Unsupported or unused parameter: $1"
+ echo
+ ;;
+ *)
+ echo
+ echo "Unsupported parameter $1"
+ echo
+ ;;
+ esac
+ shift
+
+ done
+
+#Set default values
+KVERSION=${KVERSION:-$(uname -r)}
+MIN_KVERSION="2.6.5"
+MODULES_DIR=${MODULES_DIR:-/lib/modules/${KVERSION}/updates}
+KSRC=${KSRC:-/lib/modules/${KVERSION}/build}
+
+ARCH=${ARCH:-$(uname -m)}
+
+# Additional parameters to be passed to configure command
+CWD=$(pwd)
+CONFIG="configure.mk.kernel"
+
+mkdir -p ${CWD}/include/linux
+AUTOCONF_H="${CWD}/include/linux/autoconf.h"
+
+CONFIG_MEMTRACK=${CONFIG_MEMTRACK:-''}
+CONFIG_DEBUG_INFO=${CONFIG_DEBUG_INFO:-'y'}
+CONFIG_INFINIBAND=${CONFIG_INFINIBAND:-''}
+CONFIG_INFINIBAND_IPOIB=${CONFIG_INFINIBAND_IPOIB:-''}
+CONFIG_INFINIBAND_IPOIB_CM=${CONFIG_INFINIBAND_IPOIB_CM:-''}
+CONFIG_INFINIBAND_SDP=${CONFIG_INFINIBAND_SDP:-''}
+CONFIG_INFINIBAND_SRP=${CONFIG_INFINIBAND_SRP:-''}
+CONFIG_INFINIBAND_SRPT=${CONFIG_INFINIBAND_SRPT:-''}
+
+CONFIG_INFINIBAND_USER_MAD=${CONFIG_INFINIBAND_USER_MAD:-''}
+CONFIG_INFINIBAND_USER_ACCESS=${CONFIG_INFINIBAND_USER_ACCESS:-''}
+CONFIG_INFINIBAND_ADDR_TRANS=${CONFIG_INFINIBAND_ADDR_TRANS:-''}
+CONFIG_INFINIBAND_USER_MEM=${CONFIG_INFINIBAND_USER_MEM:-''}
+CONFIG_INFINIBAND_MTHCA=${CONFIG_INFINIBAND_MTHCA:-''}
+
+CONFIG_MLX4_CORE=${CONFIG_MLX4_CORE:-''}
+CONFIG_MLX4_EN=${CONFIG_MLX4_EN:-''}
+CONFIG_MLX4_INFINIBAND=${CONFIG_MLX4_INFINIBAND:-''}
+CONFIG_MLX4_DEBUG=${CONFIG_MLX4_DEBUG:-''}
+
+CONFIG_INFINIBAND_IPOIB_DEBUG=${CONFIG_INFINIBAND_IPOIB_DEBUG:-''}
+CONFIG_INFINIBAND_ISER=${CONFIG_INFINIBAND_ISER:-''}
+CONFIG_SCSI_ISCSI_ATTRS=${CONFIG_SCSI_ISCSI_ATTRS:-''}
+CONFIG_ISCSI_TCP=${CONFIG_ISCSI_TCP:-''}
+CONFIG_INFINIBAND_EHCA=${CONFIG_INFINIBAND_EHCA:-''}
+CONFIG_INFINIBAND_EHCA_SCALING=${CONFIG_INFINIBAND_EHCA_SCALING:-''}
+CONFIG_RDS=${CONFIG_RDS:-''}
+CONFIG_RDS_RDMA=${CONFIG_RDS_RDMA:-''}
+CONFIG_RDS_TCP=${CONFIG_RDS_TCP:-''}
+CONFIG_RDS_DEBUG=${CONFIG_RDS_DEBUG:-''}
+CONFIG_INFINIBAND_MADEYE=${CONFIG_INFINIBAND_MADEYE:-''}
+CONFIG_INFINIBAND_QLGC_VNIC=${CONFIG_INFINIBAND_QLGC_VNIC:-''}
+CONFIG_INFINIBAND_CXGB3=${CONFIG_INFINIBAND_CXGB3:-''}
+CONFIG_CHELSIO_T3=${CONFIG_CHELSIO_T3:-''}
+CONFIG_INFINIBAND_CXGB4=${CONFIG_INFINIBAND_CXGB4:-''}
+CONFIG_CHELSIO_T4=${CONFIG_CHELSIO_T4:-''}
+CONFIG_INFINIBAND_NES=${CONFIG_INFINIBAND_NES:-''}
+
+CONFIG_SUNRPC_XPRT_RDMA=${CONFIG_SUNRPC_XPRT_RDMA:-''}
+CONFIG_SUNRPC=${CONFIG_SUNRPC:-''}
+CONFIG_SUNRPC_GSS=${CONFIG_SUNRPC_GSS:-''}
+CONFIG_RPCSEC_GSS_KRB5=${CONFIG_RPCSEC_GSS_KRB5:-''}
+CONFIG_RPCSEC_GSS_SPKM3=${CONFIG_RPCSEC_GSS_SPKM3:-''}
+
+CONFIG_NFS_FS=${CONFIG_NFS_FS:-''}
+CONFIG_NFS_V3=${CONFIG_NFS_V3:-''}
+CONFIG_NFS_V3_ACL=${CONFIG_NFS_V3_ACL:-''}
+CONFIG_NFS_V4=${CONFIG_NFS_V4:-''}
+CONFIG_NFS_ACL_SUPPORT=${CONFIG_NFS_ACL_SUPPORT:-''}
+CONFIG_NFS_DIRECTIO=${CONFIG_NFS_DIRECTIO:-''}
+
+CONFIG_EXPORTFS=${CONFIG_EXPORTFS:-''}
+
+CONFIG_LOCKD=${CONFIG_LOCKD:-''}
+CONFIG_LOCKD_V4=${CONFIG_LOCKD_V4:-''}
+
+CONFIG_NFSD=${CONFIG_NFSD:-''}
+CONFIG_NFSD_V2_ACL=${CONFIG_NFSD_V2_ACL:-''}
+CONFIG_NFSD_V3=${CONFIG_NFSD_V3:-''}
+CONFIG_NFSD_V3_ACL=${CONFIG_NFSD_V3_ACL:-''}
+CONFIG_NFSD_V4=${CONFIG_NFSD_V4:-''}
+CONFIG_NFSD_RDMA=${CONFIG_NFSD_RDMA:-''}
+
+CONFIG_INFINIBAND_IPOIB_DEBUG_DATA=${CONFIG_INFINIBAND_IPOIB_DEBUG_DATA:-''}
+CONFIG_INFINIBAND_SDP_SEND_ZCOPY=${CONFIG_INFINIBAND_SDP_SEND_ZCOPY:-''}
+CONFIG_INFINIBAND_SDP_RECV_ZCOPY=${CONFIG_INFINIBAND_SDP_RECV_ZCOPY:-''}
+CONFIG_INFINIBAND_SDP_DEBUG=${CONFIG_INFINIBAND_SDP_DEBUG:-''}
+CONFIG_INFINIBAND_SDP_DEBUG_DATA=${CONFIG_INFINIBAND_SDP_DEBUG_DATA:-''}
+CONFIG_INFINIBAND_IPATH=${CONFIG_INFINIBAND_IPATH:-''}
+CONFIG_INFINIBAND_QIB=${CONFIG_INFINIBAND_QIB:-''}
+CONFIG_INFINIBAND_MTHCA_DEBUG=${CONFIG_INFINIBAND_MTHCA_DEBUG:-''}
+CONFIG_INFINIBAND_QLGC_VNIC_STATS=${CONFIG_INFINIBAND_QLGC_VNIC_STATS:-''}
+CONFIG_INFINIBAND_CXGB3_DEBUG=${CONFIG_INFINIBAND_CXGB3_DEBUG:-''}
+CONFIG_INFINIBAND_NES_DEBUG=${CONFIG_INFINIBAND_NES_DEBUG:-''}
+CONFIG_INFINIBAND_AMSO1100=${CONFIG_INFINIBAND_AMSO1100:-''}
+
+ # Check for minimal supported kernel version
+ if ! check_kerver ${KVERSION} ${MIN_KVERSION}; then
+ echo "Kernel version ${KVERSION} is less then supported kernel ${MIN_KVERSION}. Exiting..."
+ exit 1
+ fi
+
+ if [ ! -e .backports_applied ]; then
+ echo ".backports_applied does not exist. running ofed_patch.sh"
+ ex ${CWD}/ofed_scripts/ofed_patch.sh ${ofed_patch_params}
+ fi
+
+ # Create configure.mk
+ /bin/rm -f ${CWD}/${CONFIG}
+ cat >> ${CWD}/${CONFIG} << EOFCONFIG
+# Current working directory
+CWD=${CWD}
+
+# Kernel level
+KVERSION=${KVERSION}
+ARCH=${ARCH}
+MODULES_DIR=${MODULES_DIR}
+KSRC=${KSRC}
+KLIB_BUILD=${KSRC}
+
+AUTOCONF_H=${AUTOCONF_H}
+
+WITH_MAKE_PARAMS=${WITH_MAKE_PARAMS}
+
+CONFIG_MEMTRACK=${CONFIG_MEMTRACK}
+CONFIG_DEBUG_INFO=${CONFIG_DEBUG_INFO}
+CONFIG_INFINIBAND=${CONFIG_INFINIBAND}
+CONFIG_INFINIBAND_IPOIB=${CONFIG_INFINIBAND_IPOIB}
+CONFIG_INFINIBAND_IPOIB_CM=${CONFIG_INFINIBAND_IPOIB_CM}
+CONFIG_INFINIBAND_SDP=${CONFIG_INFINIBAND_SDP}
+CONFIG_INFINIBAND_SRP=${CONFIG_INFINIBAND_SRP}
+CONFIG_INFINIBAND_SRPT=${CONFIG_INFINIBAND_SRPT}
+
+CONFIG_INFINIBAND_USER_MAD=${CONFIG_INFINIBAND_USER_MAD}
+CONFIG_INFINIBAND_USER_ACCESS=${CONFIG_INFINIBAND_USER_ACCESS}
+CONFIG_INFINIBAND_ADDR_TRANS=${CONFIG_INFINIBAND_ADDR_TRANS}
+CONFIG_INFINIBAND_USER_MEM=${CONFIG_INFINIBAND_USER_MEM}
+CONFIG_INFINIBAND_MTHCA=${CONFIG_INFINIBAND_MTHCA}
+
+CONFIG_MLX4_CORE=${CONFIG_MLX4_CORE}
+CONFIG_MLX4_EN=${CONFIG_MLX4_EN}
+CONFIG_MLX4_INFINIBAND=${CONFIG_MLX4_INFINIBAND}
+CONFIG_MLX4_DEBUG=${CONFIG_MLX4_DEBUG}
+
+CONFIG_INFINIBAND_IPOIB_DEBUG=${CONFIG_INFINIBAND_IPOIB_DEBUG}
+CONFIG_INFINIBAND_ISER=${CONFIG_INFINIBAND_ISER}
+CONFIG_SCSI_ISCSI_ATTRS=${CONFIG_SCSI_ISCSI_ATTRS}
+CONFIG_ISCSI_TCP=${CONFIG_ISCSI_TCP}
+CONFIG_INFINIBAND_EHCA=${CONFIG_INFINIBAND_EHCA}
+CONFIG_INFINIBAND_EHCA_SCALING=${CONFIG_INFINIBAND_EHCA_SCALING}
+CONFIG_RDS=${CONFIG_RDS}
+CONFIG_RDS_RDMA=${CONFIG_RDS_RDMA}
+CONFIG_RDS_TCP=${CONFIG_RDS_TCP}
+CONFIG_RDS_DEBUG=${CONFIG_RDS_DEBUG}
+CONFIG_INFINIBAND_MADEYE=${CONFIG_INFINIBAND_MADEYE}
+CONFIG_INFINIBAND_QLGC_VNIC=${CONFIG_INFINIBAND_QLGC_VNIC}
+CONFIG_INFINIBAND_CXGB3=${CONFIG_INFINIBAND_CXGB3}
+CONFIG_CHELSIO_T3=${CONFIG_CHELSIO_T3}
+CONFIG_INFINIBAND_CXGB4=${CONFIG_INFINIBAND_CXGB4}
+CONFIG_CHELSIO_T4=${CONFIG_CHELSIO_T4}
+CONFIG_INFINIBAND_NES=${CONFIG_INFINIBAND_NES}
+
+CONFIG_SUNRPC_XPRT_RDMA=${CONFIG_SUNRPC_XPRT_RDMA}
+CONFIG_SUNRPC=${CONFIG_SUNRPC}
+CONFIG_SUNRPC_GSS=${CONFIG_SUNRPC_GSS}
+CONFIG_RPCSEC_GSS_KRB5=${CONFIG_RPCSEC_GSS_KRB5}
+CONFIG_RPCSEC_GSS_SPKM3=${CONFIG_RPCSEC_GSS_SPKM3}
+
+CONFIG_NFS_FS=${CONFIG_NFS_FS}
+CONFIG_NFS_V3=${CONFIG_NFS_V3}
+CONFIG_NFS_V3_ACL=${CONFIG_NFS_V3_ACL}
+CONFIG_NFS_V4=${CONFIG_NFS_V4}
+CONFIG_NFS_ACL_SUPPORT=${CONFIG_NFS_ACL_SUPPORT}
+CONFIG_NFS_DIRECTIO=${CONFIG_NFS_DIRECTIO}
+CONFIG_EXPORTFS=${CONFIG_EXPORTFS}
+CONFIG_LOCKD=${CONFIG_LOCKD}
+CONFIG_LOCKD_V4=${CONFIG_LOCKD_V4}
+CONFIG_NFSD=${CONFIG_NFSD}
+CONFIG_NFSD_V2_ACL=${CONFIG_NFSD_V2_ACL}
+CONFIG_NFSD_V3=${CONFIG_NFSD_V3}
+CONFIG_NFSD_V3_ACL=${CONFIG_NFSD_V3_ACL}
+CONFIG_NFSD_V4=${CONFIG_NFSD_V4}
+CONFIG_NFSD_RDMA=${CONFIG_NFSD_RDMA}
+
+CONFIG_INFINIBAND_IPOIB_DEBUG_DATA=${CONFIG_INFINIBAND_IPOIB_DEBUG_DATA}
+CONFIG_INFINIBAND_SDP_SEND_ZCOPY=${CONFIG_INFINIBAND_SDP_SEND_ZCOPY}
+CONFIG_INFINIBAND_SDP_RECV_ZCOPY=${CONFIG_INFINIBAND_SDP_RECV_ZCOPY}
+CONFIG_INFINIBAND_SDP_DEBUG=${CONFIG_INFINIBAND_SDP_DEBUG}
+CONFIG_INFINIBAND_SDP_DEBUG_DATA=${CONFIG_INFINIBAND_SDP_DEBUG_DATA}
+CONFIG_INFINIBAND_IPATH=${CONFIG_INFINIBAND_IPATH}
+CONFIG_INFINIBAND_QIB=${CONFIG_INFINIBAND_QIB}
+CONFIG_INFINIBAND_MTHCA_DEBUG=${CONFIG_INFINIBAND_MTHCA_DEBUG}
+CONFIG_INFINIBAND_QLGC_VNIC_STATS=${CONFIG_INFINIBAND_QLGC_VNIC_STATS}
+CONFIG_INFINIBAND_CXGB3_DEBUG=${CONFIG_INFINIBAND_CXGB3_DEBUG}
+CONFIG_INFINIBAND_NES_DEBUG=${CONFIG_INFINIBAND_NES_DEBUG}
+CONFIG_INFINIBAND_AMSO1100=${CONFIG_INFINIBAND_AMSO1100}
+
+EOFCONFIG
+ echo "Created ${CONFIG}:"
+ cat ${CWD}/${CONFIG}
+
+# Create autoconf.h
+if [ "X${CONFIG_MEMTRACK}" == "Xm" ]; then
+ DEFINE_MEMTRACK="#undef CONFIG_MEMTRACK\n#define CONFIG_MEMTRACK 1"
+else
+ DEFINE_MEMTRACK="#undef CONFIG_MEMTRACK"
+fi
+if [ "X${CONFIG_DEBUG_INFO}" == "Xy" ]; then
+ DEFINE_DEBUG_INFO="#undef CONFIG_DEBUG_INFO\n#define CONFIG_DEBUG_INFO 1"
+else
+ DEFINE_DEBUG_INFO="#undef CONFIG_DEBUG_INFO"
+fi
+if [ "X${CONFIG_INFINIBAND}" == "Xm" ]; then
+ DEFINE_INFINIBAND="#undef CONFIG_INFINIBAND\n#define CONFIG_INFINIBAND 1"
+else
+ DEFINE_INFINIBAND="#undef CONFIG_INFINIBAND"
+fi
+if [ "X${CONFIG_INFINIBAND_IPOIB}" == "Xm" ]; then
+ DEFINE_INFINIBAND_IPOIB="#undef CONFIG_INFINIBAND_IPOIB\n#define CONFIG_INFINIBAND_IPOIB 1"
+else
+ DEFINE_INFINIBAND_IPOIB="#undef CONFIG_INFINIBAND_IPOIB"
+fi
+if [ "X${CONFIG_INFINIBAND_IPOIB_CM}" == "Xy" ]; then
+ DEFINE_INFINIBAND_IPOIB_CM="#undef CONFIG_INFINIBAND_IPOIB_CM\n#define CONFIG_INFINIBAND_IPOIB_CM 1"
+else
+ DEFINE_INFINIBAND_IPOIB_CM="#undef CONFIG_INFINIBAND_IPOIB_CM"
+fi
+if [ "X${CONFIG_INFINIBAND_SDP}" == "Xm" ]; then
+ DEFINE_INFINIBAND_SDP="#undef CONFIG_INFINIBAND_SDP\n#define CONFIG_INFINIBAND_SDP 1"
+else
+ DEFINE_INFINIBAND_SDP="#undef CONFIG_INFINIBAND_SDP"
+fi
+if [ "X${CONFIG_INFINIBAND_SRP}" == "Xm" ]; then
+ DEFINE_INFINIBAND_SRP="#undef CONFIG_INFINIBAND_SRP\n#define CONFIG_INFINIBAND_SRP 1"
+else
+ DEFINE_INFINIBAND_SRP="#undef CONFIG_INFINIBAND_SRP"
+fi
+if [ "X${CONFIG_INFINIBAND_SRPT}" == "Xm" ]; then
+ DEFINE_INFINIBAND_SRPT="#undef CONFIG_INFINIBAND_SRPT\n#define CONFIG_INFINIBAND_SRPT 1"
+else
+ DEFINE_INFINIBAND_SRPT="#undef CONFIG_INFINIBAND_SRP"
+fi
+if [ "X${CONFIG_INFINIBAND_USER_MAD}" == "Xm" ]; then
+ DEFINE_INFINIBAND_USER_MAD="#undef CONFIG_INFINIBAND_USER_MAD\n#define CONFIG_INFINIBAND_USER_MAD 1"
+else
+ DEFINE_INFINIBAND_USER_MAD="#undef CONFIG_INFINIBAND_USER_MAD"
+fi
+if [ "X${CONFIG_INFINIBAND_USER_ACCESS}" == "Xm" ]; then
+ DEFINE_INFINIBAND_USER_ACCESS="#undef CONFIG_INFINIBAND_USER_ACCESS\n#define CONFIG_INFINIBAND_USER_ACCESS 1"
+else
+ DEFINE_INFINIBAND_USER_ACCESS="#undef CONFIG_INFINIBAND_USER_ACCESS"
+fi
+if [ "X${CONFIG_INFINIBAND_ADDR_TRANS}" == "Xy" ]; then
+ DEFINE_INFINIBAND_ADDR_TRANS="#undef CONFIG_INFINIBAND_ADDR_TRANS\n#define CONFIG_INFINIBAND_ADDR_TRANS 1"
+else
+ DEFINE_INFINIBAND_ADDR_TRANS="#undef CONFIG_INFINIBAND_ADDR_TRANS"
+fi
+if [ "X${CONFIG_INFINIBAND_USER_MEM}" == "Xy" ]; then
+ DEFINE_INFINIBAND_USER_MEM="#undef CONFIG_INFINIBAND_USER_MEM\n#define CONFIG_INFINIBAND_USER_MEM 1"
+else
+ DEFINE_INFINIBAND_USER_MEM="#undef CONFIG_INFINIBAND_USER_MEM"
+fi
+if [ "X${CONFIG_INFINIBAND_MTHCA}" == "Xm" ]; then
+ DEFINE_INFINIBAND_MTHCA="#undef CONFIG_INFINIBAND_MTHCA\n#define CONFIG_INFINIBAND_MTHCA 1"
+else
+ DEFINE_INFINIBAND_MTHCA="#undef CONFIG_INFINIBAND_MTHCA"
+fi
+if [ "X${CONFIG_MLX4_CORE}" == "Xm" ]; then
+ DEFINE_MLX4_CORE="#undef CONFIG_MLX4_CORE\n#define CONFIG_MLX4_CORE 1"
+else
+ DEFINE_MLX4_CORE="#undef CONFIG_MLX4_CORE"
+fi
+if [ "X${CONFIG_MLX4_EN}" == "Xm" ]; then
+ DEFINE_MLX4_EN="#undef CONFIG_MLX4_EN\n#define CONFIG_MLX4_EN 1"
+else
+ DEFINE_MLX4_EN="#undef CONFIG_MLX4_EN"
+fi
+if [ "X${CONFIG_MLX4_INFINIBAND}" == "Xm" ]; then
+ DEFINE_MLX4_INFINIBAND="#undef CONFIG_MLX4_INFINIBAND\n#define CONFIG_MLX4_INFINIBAND 1"
+else
+ DEFINE_MLX4_INFINIBAND="#undef CONFIG_MLX4_INFINIBAND"
+fi
+if [ "X${CONFIG_MLX4_DEBUG}" == "Xy" ]; then
+ DEFINE_MLX4_DEBUG="#undef CONFIG_MLX4_DEBUG\n#define CONFIG_MLX4_DEBUG 1"
+else
+ DEFINE_MLX4_DEBUG="#undef CONFIG_MLX4_DEBUG"
+fi
+if [ "X${CONFIG_INFINIBAND_IPOIB_DEBUG}" == "Xy" ]; then
+ DEFINE_INFINIBAND_IPOIB_DEBUG="#undef CONFIG_INFINIBAND_IPOIB_DEBUG\n#define CONFIG_INFINIBAND_IPOIB_DEBUG 1"
+else
+ DEFINE_INFINIBAND_IPOIB_DEBUG="#undef CONFIG_INFINIBAND_IPOIB_DEBUG"
+fi
+if [ "X${CONFIG_INFINIBAND_ISER}" == "Xm" ]; then
+ DEFINE_INFINIBAND_ISER="#undef CONFIG_INFINIBAND_ISER\n#define CONFIG_INFINIBAND_ISER 1"
+ DEFINE_SCSI_ISCSI_ATTRS="#undef CONFIG_SCSI_ISCSI_ATTRS\n#define CONFIG_SCSI_ISCSI_ATTRS 1"
+ DEFINE_ISCSI_TCP="#undef CONFIG_ISCSI_TCP\n#define CONFIG_ISCSI_TCP 1"
+else
+ DEFINE_INFINIBAND_ISER="#undef CONFIG_INFINIBAND_ISER"
+ DEFINE_SCSI_ISCSI_ATTRS="#undef CONFIG_SCSI_ISCSI_ATTRS"
+ DEFINE_ISCSI_TCP="#undef CONFIG_ISCSI_TCP"
+fi
+if [ "X${CONFIG_INFINIBAND_EHCA}" == "Xm" ]; then
+ DEFINE_INFINIBAND_EHCA="#undef CONFIG_INFINIBAND_EHCA\n#define CONFIG_INFINIBAND_EHCA 1"
+else
+ DEFINE_INFINIBAND_EHCA="#undef CONFIG_INFINIBAND_EHCA"
+fi
+if [ "X${CONFIG_INFINIBAND_EHCA_SCALING}" == "Xy" ]; then
+ DEFINE_INFINIBAND_EHCA_SCALING="#undef CONFIG_INFINIBAND_EHCA_SCALING\n#define CONFIG_INFINIBAND_EHCA_SCALING 1"
+else
+ DEFINE_INFINIBAND_EHCA_SCALING="#undef CONFIG_INFINIBAND_EHCA_SCALING"
+fi
+if [ "X${CONFIG_RDS}" == "Xm" ]; then
+ DEFINE_RDS="#undef CONFIG_RDS\n#define CONFIG_RDS 1"
+ DEFINE_RDS_RDMA="#undef CONFIG_RDS_RDMA\n#define CONFIG_RDS_RDMA 1"
+ DEFINE_RDS_TCP="#undef CONFIG_RDS_TCP\n#define CONFIG_RDS_TCP 1"
+else
+ DEFINE_RDS="#undef CONFIG_RDS"
+ DEFINE_RDS_RDMA="#undef CONFIG_RDS_RDMA"
+ DEFINE_RDS_TCP="#undef CONFIG_RDS_TCP"
+fi
+if [ "X${CONFIG_RDS_DEBUG}" == "Xy" ]; then
+ DEFINE_RDS_DEBUG="#undef CONFIG_RDS_DEBUG\n#define CONFIG_RDS_DEBUG 1"
+else
+ DEFINE_RDS_DEBUG="#undef CONFIG_RDS_DEBUG"
+fi
+if [ "X${CONFIG_INFINIBAND_MADEYE}" == "Xm" ]; then
+ DEFINE_INFINIBAND_MADEYE="#undef CONFIG_INFINIBAND_MADEYE\n#define CONFIG_INFINIBAND_MADEYE 1"
+else
+ DEFINE_INFINIBAND_MADEYE="#undef CONFIG_INFINIBAND_MADEYE"
+fi
+if [ "X${CONFIG_INFINIBAND_IPOIB_DEBUG_DATA}" == "Xy" ]; then
+ DEFINE_INFINIBAND_IPOIB_DEBUG_DATA="#undef CONFIG_INFINIBAND_IPOIB_DEBUG_DATA\n#define CONFIG_INFINIBAND_IPOIB_DEBUG_DATA 1"
+else
+ DEFINE_INFINIBAND_IPOIB_DEBUG_DATA="#undef CONFIG_INFINIBAND_IPOIB_DEBUG_DATA"
+fi
+if [ "X${CONFIG_INFINIBAND_SDP_SEND_ZCOPY}" == "Xy" ]; then
+ DEFINE_INFINIBAND_SDP_SEND_ZCOPY="#undef CONFIG_INFINIBAND_SDP_SEND_ZCOPY\n#define CONFIG_INFINIBAND_SDP_SEND_ZCOPY 1"
+else
+ DEFINE_INFINIBAND_SDP_SEND_ZCOPY="#undef CONFIG_INFINIBAND_SDP_SEND_ZCOPY"
+fi
+if [ "X${CONFIG_INFINIBAND_SDP_RECV_ZCOPY}" == "Xy" ]; then
+ DEFINE_INFINIBAND_SDP_RECV_ZCOPY="#undef CONFIG_INFINIBAND_SDP_RECV_ZCOPY\n#define CONFIG_INFINIBAND_SDP_RECV_ZCOPY 1"
+else
+ DEFINE_INFINIBAND_SDP_RECV_ZCOPY="#undef CONFIG_INFINIBAND_SDP_RECV_ZCOPY"
+fi
+if [ "X${CONFIG_INFINIBAND_SDP_DEBUG}" == "Xy" ]; then
+ DEFINE_INFINIBAND_SDP_DEBUG="#undef CONFIG_INFINIBAND_SDP_DEBUG\n#define CONFIG_INFINIBAND_SDP_DEBUG 1"
+else
+ DEFINE_INFINIBAND_SDP_DEBUG="#undef CONFIG_INFINIBAND_SDP_DEBUG"
+fi
+if [ "X${CONFIG_INFINIBAND_SDP_DEBUG_DATA}" == "Xy" ]; then
+ DEFINE_INFINIBAND_SDP_DEBUG_DATA="#undef CONFIG_INFINIBAND_SDP_DEBUG_DATA\n#define CONFIG_INFINIBAND_SDP_DEBUG_DATA 1"
+else
+ DEFINE_INFINIBAND_SDP_DEBUG_DATA="#undef CONFIG_INFINIBAND_SDP_DEBUG_DATA"
+fi
+if [ "X${CONFIG_INFINIBAND_IPATH}" == "Xm" ]; then
+ DEFINE_INFINIBAND_IPATH="#undef CONFIG_INFINIBAND_IPATH\n#define CONFIG_INFINIBAND_IPATH 1"
+else
+ DEFINE_INFINIBAND_IPATH="#undef CONFIG_INFINIBAND_IPATH"
+fi
+if [ "X${CONFIG_INFINIBAND_QIB}" == "Xm" ]; then
+ DEFINE_INFINIBAND_QIB="#undef CONFIG_INFINIBAND_QIB\n#define CONFIG_INFINIBAND_QIB 1"
+else
+ DEFINE_INFINIBAND_QIB="#undef CONFIG_INFINIBAND_QIB"
+fi
+if [ "X${CONFIG_INFINIBAND_MTHCA_DEBUG}" == "Xy" ]; then
+ DEFINE_INFINIBAND_MTHCA_DEBUG="#undef CONFIG_INFINIBAND_MTHCA_DEBUG\n#define CONFIG_INFINIBAND_MTHCA_DEBUG 1"
+else
+ DEFINE_INFINIBAND_MTHCA_DEBUG="#undef CONFIG_INFINIBAND_MTHCA_DEBUG"
+fi
+if [ "X${CONFIG_INFINIBAND_QLGC_VNIC}" == "Xm" ]; then
+ DEFINE_INFINIBAND_QLGC_VNIC="#undef CONFIG_INFINIBAND_QLGC_VNIC\n#define CONFIG_INFINIBAND_QLGC_VNIC 1"
+else
+ DEFINE_INFINIBAND_QLGC_VNIC="#undef CONFIG_INFINIBAND_QLGC_VNIC"
+fi
+if [ "X${CONFIG_INFINIBAND_QLGC_VNIC_STATS}" == "Xy" ]; then
+ DEFINE_INFINIBAND_QLGC_VNIC_STATS="#undef CONFIG_INFINIBAND_QLGC_VNIC_STATS\n#define CONFIG_INFINIBAND_QLGC_VNIC_STATS 1"
+else
+ DEFINE_INFINIBAND_QLGC_VNIC_STATS="#undef CONFIG_INFINIBAND_QLGC_VNIC_STATS"
+fi
+if [ "X${CONFIG_INFINIBAND_CXGB3}" == "Xm" ]; then
+ DEFINE_INFINIBAND_CXGB3="#undef CONFIG_INFINIBAND_CXGB3\n#define CONFIG_INFINIBAND_CXGB3 1"
+else
+ DEFINE_INFINIBAND_CXGB3="#undef CONFIG_INFINIBAND_CXGB3"
+fi
+if [ "X${CONFIG_INFINIBAND_CXGB3_DEBUG}" == "Xy" ]; then
+ DEFINE_INFINIBAND_CXGB3_DEBUG="#undef CONFIG_INFINIBAND_CXGB3_DEBUG\n#define CONFIG_INFINIBAND_CXGB3_DEBUG 1"
+else
+ DEFINE_INFINIBAND_CXGB3_DEBUG="#undef CONFIG_INFINIBAND_CXGB3_DEBUG"
+fi
+if [ "X${CONFIG_CHELSIO_T3}" == "Xm" ]; then
+ DEFINE_CHELSIO_T3="#undef CONFIG_CHELSIO_T3\n#define CONFIG_CHELSIO_T3 1"
+else
+ DEFINE_CHELSIO_T3="#undef CONFIG_CHELSIO_T3"
+fi
+if [ "X${CONFIG_INFINIBAND_CXGB4}" == "Xm" ]; then
+ DEFINE_INFINIBAND_CXGB4="#undef CONFIG_INFINIBAND_CXGB4\n#define CONFIG_INFINIBAND_CXGB4 1"
+else
+ DEFINE_INFINIBAND_CXGB4="#undef CONFIG_INFINIBAND_CXGB4"
+fi
+if [ "X${CONFIG_CHELSIO_T4}" == "Xm" ]; then
+ DEFINE_CHELSIO_T4="#undef CONFIG_CHELSIO_T4\n#define CONFIG_CHELSIO_T4 1"
+else
+ DEFINE_CHELSIO_T4="#undef CONFIG_CHELSIO_T4"
+fi
+if [ "X${CONFIG_INFINIBAND_NES}" == "Xm" ]; then
+ DEFINE_INFINIBAND_NES="#undef CONFIG_INFINIBAND_NES\n#define CONFIG_INFINIBAND_NES 1"
+else
+ DEFINE_INFINIBAND_NES="#undef CONFIG_INFINIBAND_NES"
+fi
+if [ "X${CONFIG_INFINIBAND_NES_DEBUG}" == "Xy" ]; then
+ DEFINE_INFINIBAND_NES_DEBUG="#undef CONFIG_INFINIBAND_NES_DEBUG\n#define CONFIG_INFINIBAND_NES_DEBUG 1"
+else
+ DEFINE_INFINIBAND_NES_DEBUG="#undef CONFIG_INFINIBAND_NES_DEBUG"
+fi
+if [ "X${CONFIG_INFINIBAND_AMSO1100}" == "Xm" ]; then
+ DEFINE_INFINIBAND_AMSO1100="#undef CONFIG_INFINIBAND_AMSO1100\n#define CONFIG_INFINIBAND_AMSO1100 1"
+else
+ DEFINE_INFINIBAND_AMSO1100="#undef CONFIG_INFINIBAND_AMSO1100"
+fi
+if [ "X${CONFIG_SUNRPC_XPRT_RDMA}" == "Xm" ]; then
+ DEFINE_SUNRPC_XPRT_RDMA="#undef CONFIG_SUNRPC_XPRT_RDMA\n#define CONFIG_SUNRPC_XPRT_RDMA 1"
+ DEFINE_SUNRPC="#undef CONFIG_SUNRPC\n#define CONFIG_SUNRPC 1"
+ DEFINE_SUNRPC_GSS="#undef CONFIG_SUNRPC_GSS\n#define CONFIG_SUNRPC_GSS 1"
+ DEFINE_RPCSEC_GSS_KRB5="#undef CONFIG_RPCSEC_GSS_KRB5\n#define CONFIG_RPCSEC_GSS_KRB5 1"
+ DEFINE_RPCSEC_GSS_SPKM3="#undef CONFIG_RPCSEC_GSS_SPKM3\n#define CONFIG_RPCSEC_GSS_SPKM3 1"
+ DEFINE_NFS_FS="#undef CONFIG_NFS_FS\n#define CONFIG_NFS_FS 1"
+ DEFINE_NFS_V3="#undef CONFIG_NFS_V3\n#define CONFIG_NFS_V3 1"
+ DEFINE_NFS_V3_ACL="#undef CONFIG_NFS_V3_ACL\n#define CONFIG_NFS_V3_ACL 1"
+ DEFINE_NFS_V4="#undef CONFIG_NFS_V4\n#define CONFIG_NFS_V4 1"
+ DEFINE_NFS_ACL_SUPPORT="#undef CONFIG_NFS_ACL_SUPPORT\n#define CONFIG_NFS_ACL_SUPPORT 1"
+ DEFINE_NFS_DIRECTIO="#undef CONFIG_NFS_DIRECTIO\n#define CONFIG_NFS_DIRECTIO 1"
+ DEFINE_EXPORTFS="#undef CONFIG_EXPORTFS\n#define CONFIG_EXPORTFS 1"
+ DEFINE_LOCKD="#undef CONFIG_LOCKD\n#define CONFIG_LOCKD 1"
+ DEFINE_LOCKD_V4="#undef CONFIG_LOCKD_V4\n#define CONFIG_LOCKD_V4 1"
+ DEFINE_NFSD="#undef CONFIG_NFSD\n#define CONFIG_NFSD 1"
+ DEFINE_NFSD_V2_ACL="#undef CONFIG_NFSD_V2_ACL\n#define CONFIG_NFSD_V2_ACL 1"
+ DEFINE_NFSD_V3="#undef CONFIG_NFSD_V3\n#define CONFIG_NFSD_V3 1"
+ DEFINE_NFSD_V3_ACL="#undef CONFIG_NFSD_V3_ACL\n#define CONFIG_NFSD_V3_ACL 1"
+ DEFINE_NFSD_V4="#undef CONFIG_NFSD_V4\n#define CONFIG_NFSD_V4 1"
+ DEFINE_NFSD_RDMA="#undef CONFIG_NFSD_RDMA\n#define CONFIG_NFSD_RDMA 1"
+else
+ DEFINE_SUNRPC_XPRT_RDMA="/* CONFIG_SUNRPC_XPRT_RDMA is not set */"
+ DEFINE_SUNRPC="/* CONFIG_SUNRPC is not set */"
+ DEFINE_SUNRPC_GSS="/* CONFIG_SUNRPC_GSS is not set */"
+ DEFINE_RPCSEC_GSS_KRB5="/* CONFIG_RPCSEC_GSS_KRB5 is not set */"
+ DEFINE_RPCSEC_GSS_SPKM3="/* CONFIG_RPCSEC_GSS_SPKM3 is not set */"
+ DEFINE_NFS_FS="/* CONFIG_NFS_FS is not set */"
+ DEFINE_NFS_V3="/* CONFIG_NFS_V3 is not set */"
+ DEFINE_NFS_V3_ACL="/* CONFIG_NFS_V3_ACL is not set */"
+ DEFINE_NFS_V4="/* CONFIG_NFS_V4 is not set */"
+ DEFINE_NFS_ACL_SUPPORT="/* CONFIG_NFS_ACL_SUPPORT is not set */"
+ DEFINE_NFS_DIRECTIO="/* CONFIG_NFS_DIRECTIO is not set */"
+ DEFINE_EXPORTFS="/* CONFIG_EXPORTFS is not set */"
+ DEFINE_LOCKD="/* CONFIG_LOCKD is not set */"
+ DEFINE_LOCKD_V4="/* CONFIG_LOCKD_V4 is not set */"
+ DEFINE_NFSD="/* CONFIG_NFSD is not set */"
+ DEFINE_NFSD_V2_ACL="/* CONFIG_NFSD_V2_ACL is not set */"
+ DEFINE_NFSD_V3="/* CONFIG_NFSD_V3 is not set */"
+ DEFINE_NFSD_V3_ACL="/* CONFIG_NFSD_V3_ACL is not set */"
+ DEFINE_NFSD_V4="/* CONFIG_NFSD_V4 is not set */"
+ DEFINE_NFSD_RDMA="/* CONFIG_NFSD_RDMA is not set */"
+fi
+cat >> ${AUTOCONF_H} << EOFAUTOCONF
+#ifndef __OFED_BUILD__
+#include_next <linux/autoconf.h>
+$(echo -e "${DEFINE_INFINIBAND}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_IPOIB}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_IPOIB_CM}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_SDP}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_SRP}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_SRPT}" | grep -v undef)
+
+$(echo -e "${DEFINE_INFINIBAND_USER_MAD}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_USER_ACCESS}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_ADDR_TRANS}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_USER_MEM}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_MTHCA}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_QLGC_VNIC}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_CXGB3}" | grep -v undef)
+$(echo -e "${DEFINE_CHELSIO_T3}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_CXGB4}" | grep -v undef)
+$(echo -e "${DEFINE_CHELSIO_T4}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_NES}" | grep -v undef)
+
+$(echo -e "${DEFINE_SUNRPC_XPRT_RDMA}" | grep -v undef)
+$(echo -e "${DEFINE_SUNRPC}" | grep -v undef)
+$(echo -e "${DEFINE_SUNRPC_GSS}" | grep -v undef)
+$(echo -e "${DEFINE_RPCSEC_GSS_KRB5}" | grep -v undef)
+$(echo -e "${DEFINE_RPCSEC_GSS_SPKM3}" | grep -v undef)
+$(echo -e "${DEFINE_NFS_FS}" | grep -v undef)
+$(echo -e "${DEFINE_NFS_V3}" | grep -v undef)
+$(echo -e "${DEFINE_NFS_V3_ACL}" | grep -v undef)
+$(echo -e "${DEFINE_NFS_V4}" | grep -v undef)
+$(echo -e "${DEFINE_NFS_ACL_SUPPORT}" | grep -v undef)
+$(echo -e "${DEFINE_NFS_DIRECTIO}" | grep -v undef)
+$(echo -e "${DEFINE_EXPORTFS}" | grep -v undef)
+$(echo -e "${DEFINE_LOCKD}" | grep -v undef)
+$(echo -e "${DEFINE_LOCKD_V4}" | grep -v undef)
+$(echo -e "${DEFINE_NFSD}" | grep -v undef)
+$(echo -e "${DEFINE_NFSD_V2_ACL}" | grep -v undef)
+$(echo -e "${DEFINE_NFSD_V3}" | grep -v undef)
+$(echo -e "${DEFINE_NFSD_V3_ACL}" | grep -v undef)
+$(echo -e "${DEFINE_NFSD_V4}" | grep -v undef)
+$(echo -e "${DEFINE_NFSD_RDMA}" | grep -v undef)
+
+$(echo -e "${DEFINE_INFINIBAND_IPOIB_DEBUG}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_ISER}" | grep -v undef)
+$(echo -e "${DEFINE_SCSI_ISCSI_ATTRS}" | grep -v undef)
+$(echo -e "${DEFINE_ISCSI_TCP}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_EHCA}" | grep -v undef)
+$(echo -e "${DEFINE_RDS}" | grep -v undef)
+$(echo -e "${DEFINE_RDS_RDMA}" | grep -v undef)
+$(echo -e "${DEFINE_RDS_TCP}" | grep -v undef)
+$(echo -e "${DEFINE_RDS_DEBUG}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_QLGC_VNIC_STATS}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_CXGB3_DEBUG}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_NES_DEBUG}" | grep -v undef)
+
+$(echo -e "${DEFINE_MLX4_CORE}" | grep -v undef)
+$(echo -e "${DEFINE_MLX4_EN}" | grep -v undef)
+$(echo -e "${DEFINE_MLX4_INFINIBAND}" | grep -v undef)
+$(echo -e "${DEFINE_MLX4_ETHERNET}" | grep -v undef)
+$(echo -e "${DEFINE_MLX4_DEBUG}" | grep -v undef)
+
+$(echo -e "${DEFINE_INFINIBAND_IPOIB_DEBUG_DATA}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_SDP_SEND_ZCOPY}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_SDP_RECV_ZCOPY}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_SDP_DEBUG}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_SDP_DEBUG_DATA}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_IPATH}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_QIB}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_MTHCA_DEBUG}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_MADEYE}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_AMSO1100}" | grep -v undef)
+#else
+#undef CONFIG_MEMTRACK
+#undef CONFIG_DEBUG_INFO
+#undef CONFIG_INFINIBAND
+#undef CONFIG_INFINIBAND_IPOIB
+#undef CONFIG_INFINIBAND_IPOIB_CM
+#undef CONFIG_INFINIBAND_SDP
+#undef CONFIG_INFINIBAND_SRP
+#undef CONFIG_INFINIBAND_SRPT
+
+#undef CONFIG_INFINIBAND_USER_MAD
+#undef CONFIG_INFINIBAND_USER_ACCESS
+#undef CONFIG_INFINIBAND_ADDR_TRANS
+#undef CONFIG_INFINIBAND_USER_MEM
+#undef CONFIG_INFINIBAND_MTHCA
+
+#undef CONFIG_MLX4_CORE
+#undef CONFIG_MLX4_DEBUG
+#undef CONFIG_MLX4_EN
+#undef CONFIG_MLX4_INFINIBAND
+
+#undef CONFIG_INFINIBAND_IPOIB_DEBUG
+#undef CONFIG_INFINIBAND_ISER
+#undef CONFIG_INFINIBAND_EHCA
+#undef CONFIG_INFINIBAND_EHCA_SCALING
+#undef CONFIG_RDS
+#undef CONFIG_RDS_RDMA
+#undef CONFIG_RDS_TCP
+#undef CONFIG_RDS_DEBUG
+#undef CONFIG_INFINIBAND_MADEYE
+#undef CONFIG_INFINIBAND_QLGC_VNIC
+#undef CONFIG_INFINIBAND_QLGC_VNIC_STATS
+#undef CONFIG_INFINIBAND_CXGB3
+#undef CONFIG_INFINIBAND_CXGB3_DEBUG
+#undef CONFIG_CHELSIO_T3
+#undef CONFIG_INFINIBAND_CXGB4
+#undef CONFIG_CHELSIO_T4
+#undef CONFIG_INFINIBAND_NES
+#undef CONFIG_INFINIBAND_NES_DEBUG
+
+#undef CONFIG_SUNRPC_XPRT_RDMA
+#undef CONFIG_SUNRPC
+#undef CONFIG_SUNRPC_GSS
+#undef CONFIG_RPCSEC_GSS_KRB5
+#undef CONFIG_RPCSEC_GSS_SPKM3
+#undef CONFIG_NFS_FS
+#undef CONFIG_NFS_V3
+#undef CONFIG_NFS_V3_ACL
+#undef CONFIG_NFS_V4
+#undef CONFIG_NFS_ACL_SUPPORT
+#undef CONFIG_NFS_DIRECTIO
+#undef CONFIG_EXPORTFS
+#undef CONFIG_LOCKD
+#undef CONFIG_LOCKD_V4
+#undef CONFIG_NFSD
+#undef CONFIG_NFSD_V2_ACL
+#undef CONFIG_NFSD_V3
+#undef CONFIG_NFSD_V3_ACL
+#undef CONFIG_NFSD_V4
+#undef CONFIG_NFSD_RDMA
+
+#undef CONFIG_INFINIBAND_IPOIB_DEBUG_DATA
+#undef CONFIG_INFINIBAND_SDP_SEND_ZCOPY
+#undef CONFIG_INFINIBAND_SDP_RECV_ZCOPY
+#undef CONFIG_INFINIBAND_SDP_DEBUG
+#undef CONFIG_INFINIBAND_SDP_DEBUG_DATA
+#undef CONFIG_INFINIBAND_IPATH
+#undef CONFIG_INFINIBAND_QIB
+#undef CONFIG_INFINIBAND_MTHCA_DEBUG
+#undef CONFIG_INFINIBAND_AMSO1100
+
+$(echo -e "${DEFINE_INFINIBAND}")
+$(echo -e "${DEFINE_INFINIBAND_IPOIB}")
+$(echo -e "${DEFINE_INFINIBAND_IPOIB_CM}")
+$(echo -e "${DEFINE_INFINIBAND_SDP}")
+$(echo -e "${DEFINE_INFINIBAND_SRP}")
+$(echo -e "${DEFINE_INFINIBAND_SRPT}")
+
+$(echo -e "${DEFINE_INFINIBAND_USER_MAD}")
+$(echo -e "${DEFINE_INFINIBAND_USER_ACCESS}")
+$(echo -e "${DEFINE_INFINIBAND_ADDR_TRANS}")
+$(echo -e "${DEFINE_INFINIBAND_USER_MEM}")
+$(echo -e "${DEFINE_INFINIBAND_MTHCA}")
+$(echo -e "${DEFINE_INFINIBAND_QLGC_VNIC}")
+$(echo -e "${DEFINE_INFINIBAND_CXGB3}")
+$(echo -e "${DEFINE_CHELSIO_T3}")
+$(echo -e "${DEFINE_INFINIBAND_CXGB4}")
+$(echo -e "${DEFINE_CHELSIO_T4}")
+$(echo -e "${DEFINE_INFINIBAND_NES}")
+
+$(echo -e "${DEFINE_SUNRPC_XPRT_RDMA}")
+$(echo -e "${DEFINE_SUNRPC}")
+$(echo -e "${DEFINE_SUNRPC_GSS}")
+$(echo -e "${DEFINE_RPCSEC_GSS_KRB5}")
+$(echo -e "${DEFINE_RPCSEC_GSS_SPKM3}")
+$(echo -e "${DEFINE_NFS_FS}")
+$(echo -e "${DEFINE_NFS_V3}")
+$(echo -e "${DEFINE_NFS_V3_ACL}")
+$(echo -e "${DEFINE_NFS_V4}")
+$(echo -e "${DEFINE_NFS_ACL_SUPPORT}")
+$(echo -e "${DEFINE_NFS_DIRECTIO}")
+$(echo -e "${DEFINE_EXPORTFS}")
+$(echo -e "${DEFINE_LOCKD}")
+$(echo -e "${DEFINE_LOCKD_V4}")
+$(echo -e "${DEFINE_NFSD}")
+$(echo -e "${DEFINE_NFSD_V2_ACL}")
+$(echo -e "${DEFINE_NFSD_V3}")
+$(echo -e "${DEFINE_NFSD_V3_ACL}")
+$(echo -e "${DEFINE_NFSD_V4}")
+$(echo -e "${DEFINE_NFSD_RDMA}")
+
+$(echo -e "${DEFINE_INFINIBAND_IPOIB_DEBUG}")
+$(echo -e "${DEFINE_INFINIBAND_ISER}")
+$(echo -e "${DEFINE_SCSI_ISCSI_ATTRS}")
+$(echo -e "${DEFINE_ISCSI_TCP}")
+$(echo -e "${DEFINE_INFINIBAND_EHCA}")
+$(echo -e "${DEFINE_RDS}")
+$(echo -e "${DEFINE_RDS_RDMA}")
+$(echo -e "${DEFINE_RDS_TCP}")
+$(echo -e "${DEFINE_RDS_DEBUG}")
+$(echo -e "${DEFINE_INFINIBAND_QLGC_VNIC_STATS}")
+$(echo -e "${DEFINE_INFINIBAND_CXGB3_DEBUG}")
+$(echo -e "${DEFINE_INFINIBAND_NES_DEBUG}")
+
+$(echo -e "${DEFINE_MLX4_CORE}")
+$(echo -e "${DEFINE_MLX4_EN}")
+$(echo -e "${DEFINE_MLX4_INFINIBAND}")
+$(echo -e "${DEFINE_MLX4_ETHERNET}")
+$(echo -e "${DEFINE_MLX4_DEBUG}")
+
+$(echo -e "${DEFINE_INFINIBAND_IPOIB_DEBUG_DATA}")
+$(echo -e "${DEFINE_INFINIBAND_SDP_SEND_ZCOPY}")
+$(echo -e "${DEFINE_INFINIBAND_SDP_RECV_ZCOPY}")
+$(echo -e "${DEFINE_INFINIBAND_SDP_DEBUG}")
+$(echo -e "${DEFINE_INFINIBAND_SDP_DEBUG_DATA}")
+$(echo -e "${DEFINE_INFINIBAND_IPATH}")
+$(echo -e "${DEFINE_INFINIBAND_QIB}")
+$(echo -e "${DEFINE_INFINIBAND_MTHCA_DEBUG}")
+$(echo -e "${DEFINE_INFINIBAND_MADEYE}")
+$(echo -e "${DEFINE_INFINIBAND_AMSO1100}")
+#endif
+
+EOFAUTOCONF
+
+ echo "Created ${AUTOCONF_H}:"
+ cat ${AUTOCONF_H}
+}
+
+main $@
--- /dev/null
+PHONY += all kernel install_kernel install clean clean_kernel
+
+all:
+.PHONY: $(PHONY)
+
+.DELETE_ON_ERROR:
+
+# These exported as they are used by the scripts
+# to check config and compat autoconf
+export CONFIG_CHECK=.$(COMPAT_CONFIG)_md5sum.txt
+
+include ./configure.mk.kernel
+include ./config.mk
+
+export CREL=$(shell cat $(CWD)/compat_version)
+export CREL_PRE:=.compat_autoconf_
+export CREL_CHECK:=$(CREL_PRE)$(CREL)
+
+DEPMOD = /sbin/depmod
+INSTALL_MOD_DIR ?= $(shell test -f /etc/redhat-release && echo extra/ofa_kernel || echo updates)
+
+ifeq ($(CONFIG_MEMTRACK),m)
+ export KERNEL_MEMTRACK_CFLAGS = -include $(CWD)/drivers/infiniband/debug/mtrack.h
+else
+ export KERNEL_MEMTRACK_CFLAGS =
+endif
+
+export OPEN_ISCSI_MODULES = iscsi_tcp.ko libiscsi.ko scsi_transport_iscsi.ko
+
+configure.mk.kernel:
+ @echo Please run ./configure
+ @exit 1
+
+all: kernel
+
+install: install_kernel
+install_kernel: install_modules
+
+autoconf_h=$(shell /bin/ls -1 $(KSRC)/include/*/autoconf.h | head -1)
+kconfig_h=$(shell /bin/ls -1 $(KSRC)/include/*/kconfig.h | head -1)
+
+ifneq ($(kconfig_h),)
+KCONFIG_H = -include $(kconfig_h)
+endif
+
+V ?= 1
+
+#########################
+# make kernel #
+#########################
+#NB: The LINUXINCLUDE value comes from main kernel Makefile
+# with local directories prepended. This eventually affects
+# CPPFLAGS in the kernel Makefile
+kernel:
+ @echo "Building kernel modules"
+ @echo "Kernel version: $(KVERSION)"
+ @echo "Modules directory: $(INSTALL_MOD_PATH)/$(MODULES_DIR)"
+ @echo "Kernel sources: $(KSRC)"
+ env CWD=$(CWD) BACKPORT_INCLUDES=$(BACKPORT_INCLUDES) \
+ $(MAKE) -C $(KSRC) SUBDIRS="$(CWD)" \
+ V=$(V) $(WITH_MAKE_PARAMS) \
+ CONFIG_MEMTRACK=$(CONFIG_MEMTRACK) \
+ CONFIG_DEBUG_INFO=$(CONFIG_DEBUG_INFO) \
+ CONFIG_INFINIBAND=$(CONFIG_INFINIBAND) \
+ CONFIG_INFINIBAND_IPOIB=$(CONFIG_INFINIBAND_IPOIB) \
+ CONFIG_INFINIBAND_IPOIB_CM=$(CONFIG_INFINIBAND_IPOIB_CM) \
+ CONFIG_INFINIBAND_SDP=$(CONFIG_INFINIBAND_SDP) \
+ CONFIG_INFINIBAND_SRP=$(CONFIG_INFINIBAND_SRP) \
+ CONFIG_INFINIBAND_SRPT=$(CONFIG_INFINIBAND_SRPT) \
+ CONFIG_INFINIBAND_USER_MAD=$(CONFIG_INFINIBAND_USER_MAD) \
+ CONFIG_INFINIBAND_USER_ACCESS=$(CONFIG_INFINIBAND_USER_ACCESS) \
+ CONFIG_INFINIBAND_USER_MEM=$(CONFIG_INFINIBAND_USER_MEM) \
+ CONFIG_INFINIBAND_ADDR_TRANS=$(CONFIG_INFINIBAND_ADDR_TRANS) \
+ CONFIG_INFINIBAND_MTHCA=$(CONFIG_INFINIBAND_MTHCA) \
+ CONFIG_INFINIBAND_IPOIB_DEBUG=$(CONFIG_INFINIBAND_IPOIB_DEBUG) \
+ CONFIG_INFINIBAND_ISER=$(CONFIG_INFINIBAND_ISER) \
+ CONFIG_SCSI_ISCSI_ATTRS=$(CONFIG_SCSI_ISCSI_ATTRS) \
+ CONFIG_ISCSI_TCP=$(CONFIG_ISCSI_TCP) \
+ CONFIG_INFINIBAND_EHCA=$(CONFIG_INFINIBAND_EHCA) \
+ CONFIG_INFINIBAND_EHCA_SCALING=$(CONFIG_INFINIBAND_EHCA_SCALING) \
+ CONFIG_RDS=$(CONFIG_RDS) \
+ CONFIG_RDS_RDMA=$(CONFIG_RDS_RDMA) \
+ CONFIG_RDS_TCP=$(CONFIG_RDS_TCP) \
+ CONFIG_RDS_DEBUG=$(CONFIG_RDS_DEBUG) \
+ CONFIG_INFINIBAND_IPOIB_DEBUG_DATA=$(CONFIG_INFINIBAND_IPOIB_DEBUG_DATA) \
+ CONFIG_INFINIBAND_SDP_SEND_ZCOPY=$(CONFIG_INFINIBAND_SDP_SEND_ZCOPY) \
+ CONFIG_INFINIBAND_SDP_RECV_ZCOPY=$(CONFIG_INFINIBAND_SDP_RECV_ZCOPY) \
+ CONFIG_INFINIBAND_SDP_DEBUG=$(CONFIG_INFINIBAND_SDP_DEBUG) \
+ CONFIG_INFINIBAND_SDP_DEBUG_DATA=$(CONFIG_INFINIBAND_SDP_DEBUG_DATA) \
+ CONFIG_INFINIBAND_IPATH=$(CONFIG_INFINIBAND_IPATH) \
+ CONFIG_INFINIBAND_QIB=$(CONFIG_INFINIBAND_QIB) \
+ CONFIG_INFINIBAND_MTHCA_DEBUG=$(CONFIG_INFINIBAND_MTHCA_DEBUG) \
+ CONFIG_INFINIBAND_MADEYE=$(CONFIG_INFINIBAND_MADEYE) \
+ CONFIG_INFINIBAND_QLGC_VNIC=$(CONFIG_INFINIBAND_QLGC_VNIC) \
+ CONFIG_INFINIBAND_QLGC_VNIC_DEBUG=$(CONFIG_INFINIBAND_QLGC_VNIC_DEBUG) \
+ CONFIG_INFINIBAND_QLGC_VNIC_STATS=$(CONFIG_INFINIBAND_QLGC_VNIC_STATS) \
+ CONFIG_CHELSIO_T3=$(CONFIG_CHELSIO_T3) \
+ CONFIG_INFINIBAND_CXGB3=$(CONFIG_INFINIBAND_CXGB3) \
+ CONFIG_INFINIBAND_CXGB3_DEBUG=$(CONFIG_INFINIBAND_CXGB3_DEBUG) \
+ CONFIG_CHELSIO_T4=$(CONFIG_CHELSIO_T4) \
+ CONFIG_INFINIBAND_CXGB4=$(CONFIG_INFINIBAND_CXGB4) \
+ CONFIG_INFINIBAND_NES=$(CONFIG_INFINIBAND_NES) \
+ CONFIG_INFINIBAND_NES_DEBUG=$(CONFIG_INFINIBAND_NES_DEBUG) \
+ CONFIG_MLX4_CORE=$(CONFIG_MLX4_CORE) \
+ CONFIG_MLX4_EN=$(CONFIG_MLX4_EN) \
+ CONFIG_MLX4_INFINIBAND=$(CONFIG_MLX4_INFINIBAND) \
+ CONFIG_MLX4_ETHERNET=$(CONFIG_MLX4_ETHERNET) \
+ CONFIG_MLX4_DEBUG=$(CONFIG_MLX4_DEBUG) \
+ CONFIG_INFINIBAND_AMSO1100=$(CONFIG_INFINIBAND_AMSO1100) \
+ CONFIG_SUNRPC_XPRT_RDMA=$(CONFIG_SUNRPC_XPRT_RDMA) \
+ CONFIG_NFSD_RDMA=$(CONFIG_NFSD_RDMA) \
+ LINUXINCLUDE=' \
+ -D__OFED_BUILD__ \
+ -DCOMPAT_BASE_TREE="\"$(shell cat compat_base_tree)\"" \
+ -DCOMPAT_BASE_TREE_VERSION="\"$(shell cat compat_base_tree_version)\"" \
+ -DCOMPAT_PROJECT="\"Compat-rdma\"" \
+ -DCOMPAT_VERSION="\"$(shell cat compat_version)\"" \
+ -include $(autoconf_h) \
+ -include $(CWD)/include/linux/autoconf.h \
+ $(KCONFIG_H) \
+ -include ../include/linux/compat-2.6.h \
+ $(BACKPORT_INCLUDES) \
+ $(KERNEL_MEMTRACK_CFLAGS) \
+ $(KERNEL_NFS_FS_CFLAGS) \
+ $(OPENIB_KERNEL_EXTRA_CFLAGS) \
+ -I$(CWD)/include \
+ -I$(CWD)/drivers/infiniband/debug \
+ -I/usr/local/include/scst \
+ -I$(CWD)/drivers/infiniband/ulp/srpt \
+ -I$(CWD)/drivers/net/ethernet/chelsio/cxgb3 \
+ -I$(CWD)/drivers/net/ethernet/chelsio/cxgb4 \
+ $$(if $$(CONFIG_XEN),-D__XEN_INTERFACE_VERSION__=$$(CONFIG_XEN_INTERFACE_VERSION)) \
+ $$(if $$(CONFIG_XEN),-I$$(srctree)/arch/x86/include/mach-xen) \
+ -I$$(srctree)/arch/$$(SRCARCH)/include \
+ -Iarch/$$(SRCARCH)/include/generated -Iinclude \
+ $$(if $$(KBUILD_SRC),-Iinclude2 -I$$(srctree)/include) \
+ -I$$(srctree)/arch/$$(SRCARCH)/include \
+ ' \
+ modules
+
+
+#########################
+# Install kernel #
+#########################
+install_modules:
+ @echo "Installing kernel modules"
+
+ $(MAKE) -C $(KSRC) SUBDIRS="$(CWD)" \
+ INSTALL_MOD_PATH=$(INSTALL_MOD_PATH) \
+ INSTALL_MOD_DIR=$(INSTALL_MOD_DIR) \
+ $(WITH_MAKE_PARAMS) modules_install;
+ if [ ! -n "$(INSTALL_MOD_PATH)" ]; then $(DEPMOD) $(KVERSION);fi;
+
+clean: clean_kernel
+
+clean_kernel:
+ $(MAKE) -C $(KSRC) SUBDIRS="$(CWD)" $(WITH_MAKE_PARAMS) clean
+
+help:
+ @echo
+ @echo kernel: build kernel modules
+ @echo all: build kernel modules
+ @echo
+ @echo install_kernel: install kernel modules under $(INSTALL_MOD_PATH)/$(MODULES_DIR)
+ @echo install: run install_kernel
+ @echo
+ @echo clean: delete kernel modules binaries
+ @echo clean_kernel: delete kernel modules binaries
+ @echo
--- /dev/null
+KERNEL=="umad*", NAME="infiniband/%k"
+KERNEL=="issm*", NAME="infiniband/%k"
+KERNEL=="ucm*", NAME="infiniband/%k", MODE="0666"
+KERNEL=="uverbs*", NAME="infiniband/%k", MODE="0666"
+KERNEL=="ucma", NAME="infiniband/%k", MODE="0666"
+KERNEL=="rdma_cm", NAME="infiniband/%k", MODE="0666"
--- /dev/null
+EXTRA_CFLAGS += $(OPENIB_KERNEL_EXTRA_CFLAGS) \
+ $(KERNEL_MEMTRACK_CFLAGS) \
+ $(KERNEL_NFS_FS_CFLAGS) \
+ -I$(CWD)/include \
+ -I$(CWD)/drivers/infiniband/ulp/ipoib \
+ -I$(CWD)/drivers/infiniband/debug \
+ -I$(CWD)/drivers/net/cxgb3 \
+ -I$(CWD)/drivers/net/cxgb4 \
+ -I$(CWD)/net/rds \
+ -I$(CWD)/drivers/net/mlx4 \
+ -I$(CWD)/drivers/infiniband/hw/mlx4
+
+obj-$(CONFIG_INFINIBAND) += drivers/infiniband/
+obj-$(CONFIG_CHELSIO_T3) += drivers/net/cxgb3/
+obj-$(CONFIG_CHELSIO_T4) += drivers/net/cxgb4/
+obj-$(CONFIG_MLX4_CORE) += drivers/net/mlx4/
+obj-$(CONFIG_RDS) += net/rds/
+obj-$(CONFIG_MEMTRACK) += drivers/infiniband/debug/
+obj-$(CONFIG_SUNRPC_XPRT_RDMA) += net/sunrpc/xprtrdma/
--- /dev/null
+#!/bin/bash
+# This script check ofed_kernel compilation with kernel from kernel.org
+
+usage()
+{
+cat << EOF
+
+ Usage: `basename $0` -g|--git <ofed kernel git url>
+ -k|--kernel <kernel version>
+ [-b|--branch <git branch>]
+
+EOF
+}
+
+if [ -z "$1" ]; then
+ usage
+ exit 1
+fi
+
+while [ ! -z "$1" ]
+do
+ case "$1" in
+ -g | --git)
+ giturl=$2
+ shift 2
+ ;;
+ -k | --kernel)
+ kernel=$2
+ shift 2
+ ;;
+ -b | --branch)
+ head=$2
+ shift 2
+ ;;
+ -h | --help)
+ usage
+ exit 0
+ ;;
+ *)
+ echo
+ echo Wrong parameter $1
+ echo
+ usage
+ exit 1
+ ;;
+ esac
+done
+
+if [ -z "$giturl" ] || [ -z "$kernel" ]; then
+ usage
+ exit 1
+fi
+
+tmpdir=${tmpdir:-${HOME}/tmp}
+arch=${arch:-$(uname -m)}
+kernels=${kernels:-${HOME}/kernel.org/$arch}
+korgurl="ftp://ftp.eu.kernel.org/pub/linux/kernel/v2.6"
+project=ofed_kernel
+log=${tmpdir}/${project}-${kernel}.log
+
+core_options="--with-core-mod --with-user_mad-mod --with-user_access-mod \
+ --with-addr_trans-mod"
+
+if [ -z "$configure_options" ]; then
+ configure_options=" \
+ --with-mthca-mod --with-mthca_debug-mod \
+ --with-mlx4-mod --with-mlx4_debug-mod --with-ipoib-mod \
+ --with-ipoib_debug-mod --with-sdp-mod --with-sdp_debug-mod \
+ --with-rds-mod --with-cxgb3-mod --with-cxgb4-mod \
+ --with-nes-mod \
+ ${custom_options} \
+ "
+fi
+
+rm -f $log
+mkdir -p $tmpdir
+mkdir -p $kernels
+
+ex()
+{
+ echo "$@" | tee -a $log
+ eval "$@" >> $log 2>&1
+ status=$?
+ if [ $status -ne 0 ]; then
+ echo Failed executing:
+ echo "$@"
+ echo
+ echo "See $log"
+ exit $status
+ fi
+}
+
+echo LOG: $log
+
+# Prepare kernel sources
+pushd $kernels
+if [ ! -d linux-$kernel ]; then
+ if [ ! -f linux-${kernel}.tar.bz2 ]; then
+ ex wget $korgurl/linux-${kernel}.tar.bz2
+ fi
+ ex tar xjf linux-${kernel}.tar.bz2
+ pushd linux-${kernel}
+ ex make defconfig prepare scripts
+ popd
+ popd
+fi
+
+# Check ofed_kernel compilation
+cd $tmpdir
+rm -rf $tmpdir/$project-$kernel
+
+ex git clone -q -s -n $giturl $tmpdir/$project-$kernel
+pushd $tmpdir/$project-$kernel
+head=${head:-`git show-ref -s -h -- HEAD | head -1`}
+
+ex git checkout $head `git ls-tree -r --name-only $head \
+ ofed_scripts/ofed_checkout.sh
+ `
+ex ofed_scripts/ofed_checkout.sh $head
+
+ex ./configure ${core_options} ${configure_options} \
+ --kernel-version=$kernel \
+ --kernel-sources=$kernels/linux-${kernel}
+ex make
+
+cat << EOF
+
+Passed $kernel
+
+EOF
--- /dev/null
+Documentation/infiniband/
+drivers/base/attribute_container.c
+drivers/base/transport_class.c
+drivers/infiniband/
+drivers/net/ethernet/chelsio/cxgb3/
+drivers/net/ethernet/chelsio/cxgb4/
+drivers/net/ethernet/mellanox/mlx4/
+drivers/scsi/iscsi_tcp.c
+drivers/scsi/iscsi_tcp.h
+drivers/scsi/libiscsi.c
+drivers/scsi/scsi_transport_iscsi.c
+fs/exportfs/
+fs/lockd/
+fs/nfs/
+fs/nfs_common/
+fs/nfsd/
+include/linux/mlx4/
+include/rdma/
+include/scsi/srp.h
+kernel/kfifo.c
+lib/klist.c
+net/rds/
+include/linux/rds.h
+net/sunrpc/
--- /dev/null
+#!/bin/bash
+#
+# Copyright (c) 2006 Mellanox Technologies. All rights reserved.
+#
+# This Software is licensed under one of the following licenses:
+#
+# 1) under the terms of the "Common Public License 1.0" a copy of which is
+# available from the Open Source Initiative, see
+# http://www.opensource.org/licenses/cpl.php.
+#
+# 2) under the terms of the "The BSD License" a copy of which is
+# available from the Open Source Initiative, see
+# http://www.opensource.org/licenses/bsd-license.php.
+#
+# 3) under the terms of the "GNU General Public License (GPL) Version 2" a
+# copy of which is available from the Open Source Initiative, see
+# http://www.opensource.org/licenses/gpl-license.php.
+#
+# Licensee has the right to choose one of the above licenses.
+#
+# Redistributions of source code must retain the above copyright
+# notice and one of the license notices.
+#
+# Redistributions in binary form must reproduce both the above copyright
+# notice, one of the license notices in the documentation
+# and/or other materials provided with the distribution.
+#
+# $Id: configure 9097 2006-08-24 06:39:09Z vlad $
+#
+
+usage()
+{
+cat << EOF
+\`configure' configures variables for kernel modules compilation
+
+Usage: `basename $0` [options]
+
+ --prefix=PREFIX for userspace components []
+ --build_root=BUILD_ROOT root directory to build RPM packages
+ --kernel-version=VERSION make for this kernel [$(uname -r)]
+ --modules-dir=DIR modules directory [/lib/modules/$(uname -r)]
+ --kernel-sources=DIR make for this kernel [/lib/modules/$(uname -r)/build]
+
+ Kernel modules configuration:
+
+ --with-core-mod make CONFIG_INFINIBAND=m [no]
+ --without-core-mod [yes]
+
+ --with-ipoib-mod make CONFIG_INFINIBAND_IPOIB=m [no]
+ --without-ipoib-mod [yes]
+
+ --with-ipoib-cm make CONFIG_INFINIBAND_IPOIB_CM=y [yes]
+ --without-ipoib-cm [no]
+
+ --with-ipoib_debug-mod make CONFIG_INFINIBAND_IPOIB_DEBUG=y [yes]
+ --without-ipoib_debug-mod [no]
+
+ --with-ipoib_debug_data-mod make CONFIG_INFINIBAND_IPOIB_DEBUG_DATA=y [no]
+ --without-ipoib_debug_data-mod [yes]
+
+ --with-sdp-mod make CONFIG_INFINIBAND_SDP=m [no]
+ --without-sdp-mod [yes]
+
+ --with-sdp_debug-mod make CONFIG_INFINIBAND_SDP_DEBUG=y [yes]
+ --without-sdp_debug-mod [no]
+
+ --with-sdp_debug_data-mod make CONFIG_INFINIBAND_SDP_DEBUG_DATA=y [no]
+ --without-sdp_debug_data-mod [yes]
+
+ --with-srp-mod make CONFIG_INFINIBAND_SRP=m [no]
+ --without-srp-mod [yes]
+
+ --with-srp-target-mod make CONFIG_INFINIBAND_SRPT=m [no]
+ --without-srp-target-mod [yes]
+
+ --with-user_mad-mod make CONFIG_INFINIBAND_USER_MAD=m [no]
+ --without-user_mad-mod [yes]
+
+ --with-user_access-mod make CONFIG_INFINIBAND_USER_ACCESS=m [no]
+ --without-user_access-mod [yes]
+
+ --with-addr_trans-mod make CONFIG_INFINIBAND_ADDR_TRANS=y [no]
+ --without-addr_trans-mod [yes]
+
+ --with-mthca-mod make CONFIG_INFINIBAND_MTHCA=m [no]
+ --without-mthca-mod [yes]
+
+ --with-mthca_debug-mod make CONFIG_INFINIBAND_MTHCA_DEBUG=y [yes]
+ --without-mthca_debug-mod [no]
+
+ --with-mlx4-mod make CONFIG_MLX4_CORE=y CONFIG_MLX4_INFINIBAND=y [no]
+ --without-mlx4-mod [yes]
+
+ --with-mlx4_core-mod make CONFIG_MLX4_CORE=y [no]
+ --without-mlx4_core-mod [yes]
+
+ --with-mlx4_en-mod make CONFIG_MLX4_EN=y [no]
+ --without-mlx4_en-mod [yes]
+
+ --with-mlx4_inf-mod make CONFIG_MLX4_INFINIBAND=y [no]
+ --without-mlx4_inf-mod [yes]
+
+ --with-mlx4_debug-mod make CONFIG_MLX4_DEBUG=y [yes]
+ --without-mlx4_debug-mod [no]
+
+ --with-ipath_inf-mod make CONFIG_INFINIBAND_IPATH=m [no]
+ --without-ipath_inf-mod [yes]
+
+ --with-qib-mod make CONFIG_INFINIBAND_QIB=m [no]
+ --without-qib-mod [yes]
+
+ --with-iser-mod make CONFIG_INFINIBAND_ISER=m [no]
+ --without-iser-mod [yes]
+
+ --with-ehca-mod make CONFIG_INFINIBAND_EHCA=m [no]
+ --without-ehca-mod [yes]
+
+ --with-rds-mod make CONFIG_RDS=m [no]
+ --without-rds-mod [no]
+
+ --with-rds_debug-mod make CONFIG_RDS_DEBUG=y [no]
+ --without-rds_debug-mod [yes]
+
+ --with-madeye-mod make CONFIG_INFINIBAND_MADEYE=m [no]
+ --without-madeye-mod [yes]
+
+ --with-qlgc_vnic-mod make CONFIG_INFINIBAND_QLGC_VNIC=m [no]
+ --without-qlgc_vnic-mod [yes]
+
+ --with-qlgc_vnic_stats-mod make CONFIG_INFINIBAND_QLGC_VNIC_STATS=y [no]
+ --without-qlgc_vnic_stats-mod [yes]
+
+ --with-cxgb3-mod make CONFIG_INFINIBAND_CXGB3=m [no]
+ --without-cxgb3-mod [yes]
+
+ --with-cxgb3_debug-mod make CONFIG_INFINIBAND_CXGB3_DEBUG=y [no]
+ --without-cxgb3_debug-mod [yes]
+
+ --with-cxgb4-mod make CONFIG_INFINIBAND_CXGB4=m [no]
+ --without-cxgb4-mod [yes]
+
+ --with-nes-mod make CONFIG_INFINIBAND_NES=m [no]
+ --without-nes-mod [yes]
+
+ --with-nes_debug-mod make CONFIG_INFINIBAND_NES_DEBUG=y [no]
+ --without-nes_debug-mod [yes]
+
+ --with-memtrack enable momory tracking [no]
+ --without-memtrack disable memory tracking [yes]
+
+ --with-debug-info make CONFIG_DEBUG_INFO=y [yes]
+ --without-debug-info [no]
+
+ --with-nfsrdma-mod make CONFIG_SUNRPC_XPRT_RDMA=m [no]
+ --without-nfsrdma-mod [yes]
+
+ --help - print out options
+
+
+EOF
+
+# Currently not supported options
+# --with-sdp-zcopy make CONFIG_INFINIBAND_SDP_SEND_ZCOPY=y CONFIG_INFINIBAND_SDP_RECV_ZCOPY=y [no]
+# --without-sdp-zcopy [yes]
+}
+
+# Execute command w/ echo and exit if it fail
+ex()
+{
+ echo "$@"
+ if ! "$@"; then
+ printf "\nFailed executing $@\n\n"
+ exit 1
+ fi
+}
+
+# Compare 2 kernel versions
+check_kerver()
+{
+ local kver=$1
+ local min_kver=$2
+ shift 2
+
+ kver_a=$(echo -n ${kver} | cut -d '.' -f 1)
+ kver_b=$(echo -n ${kver} | cut -d '.' -f 2)
+ kver_c=$(echo -n ${kver} | cut -d '.' -f 3 | cut -d '-' -f 1 | tr -d [:alpha:][:punct:])
+
+ min_kver_a=$(echo -n ${min_kver} | cut -d '.' -f 1)
+ min_kver_b=$(echo -n ${min_kver} | cut -d '.' -f 2)
+ min_kver_c=$(echo -n ${min_kver} | cut -d '.' -f 3 | cut -d '-' -f 1 | tr -d [:alpha:][:punct:])
+
+ if [ ${kver_a} -lt ${min_kver_a} ] ||
+ [[ ${kver_a} -eq ${min_kver_a} && ${kver_b} -lt ${min_kver_b} ]] ||
+ [[ ${kver_a} -eq ${min_kver_a} && ${kver_b} -eq ${min_kver_b} && ${kver_c} -lt ${min_kver_c} ]]; then
+ return 1
+ fi
+
+ return 0
+}
+
+main()
+{
+ ofed_patch_params=
+ # Parsing parameters
+ while [ ! -z "$1" ]
+ do
+ case $1 in
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p | -p)
+ shift
+ prefix=$1
+ PREFIX="--prefix ${prefix}"
+ ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=* | -p=*)
+ prefix=`expr "x$1" : 'x[^=]*=\(.*\)'`
+ PREFIX="--prefix ${prefix}"
+ ;;
+ -kernel-version | --kernel-version | --kern-ver | --ker-ver)
+ ofed_patch_params="$ofed_patch_params $1"
+ shift
+ ofed_patch_params="$ofed_patch_params $1"
+ KVERSION=$1
+ ;;
+ -kernel-version=* | --kernel-version=* | --kern-ver=* | --ker-ver=*)
+ ofed_patch_params="$ofed_patch_params $1"
+ KVERSION=`expr "x$1" : 'x[^=]*=\(.*\)'`
+ ;;
+ -modules-dir | --modules-dir | --mod-dir)
+ shift
+ MODULES_DIR=$1
+ ;;
+ -modules-dir=* | --modules-dir=* | --mod-dir=*)
+ MODULES_DIR=`expr "x$1" : 'x[^=]*=\(.*\)'`
+ ;;
+ -kernel-sources | --kernel-sources | --kernel-src | --kern-src | --ker-src)
+ shift
+ KSRC=$1
+ ;;
+ -kernel-sources=* | --kernel-sources=* | --kernel-src=* | --kern-src=* | --ker-src=*)
+ KSRC=`expr "x$1" : 'x[^=]*=\(.*\)'`
+ ;;
+ -with-quilt | --with-quilt)
+ ofed_patch_params="$ofed_patch_params $1"
+ if [ ! -z "$2" ] && [ "`echo -n $2 | cut -c 1`" != '-' ]; then
+ shift
+ ofed_patch_params="$ofed_patch_params $1"
+ fi
+ ;;
+ -with-quilt=* | --with-quilt=*)
+ ofed_patch_params="$ofed_patch_params $1"
+ ;;
+ --without-quilt)
+ ofed_patch_params="$ofed_patch_params $1"
+ ;;
+ -with-patchdir | --with-patchdir)
+ ofed_patch_params="$ofed_patch_params $1"
+ shift
+ ofed_patch_params="$ofed_patch_params $1"
+ ;;
+ -with-patchdir=* | --with-patchdir=*)
+ ofed_patch_params="$ofed_patch_params $1"
+ ;;
+ --without-patch)
+ ofed_patch_params="$ofed_patch_params $1"
+ ;;
+ --with-kernel-fixes)
+ ofed_patch_params="$ofed_patch_params $1"
+ ;;
+ --without-kernel-fixes)
+ ofed_patch_params="$ofed_patch_params $1"
+ ;;
+ --with-hpage-patch)
+ ofed_patch_params="$ofed_patch_params $1"
+ ;;
+ --without-hpage-patch)
+ ofed_patch_params="$ofed_patch_params $1"
+ ;;
+ --with-backport-patches)
+ ofed_patch_params="$ofed_patch_params $1"
+ ;;
+ --without-backport-patches)
+ ofed_patch_params="$ofed_patch_params $1"
+ ;;
+ --with-memtrack)
+ CONFIG_MEMTRACK="m"
+ ;;
+ --without-memtrack)
+ CONFIG_MEMTRACK=
+ ;;
+ --with-debug-info)
+ CONFIG_DEBUG_INFO="y"
+ ;;
+ --without-debug-info)
+ CONFIG_DEBUG_INFO=
+ ;;
+ --with-core-mod)
+ CONFIG_INFINIBAND="m"
+ ;;
+ --without-core-mod)
+ CONFIG_INFINIBAND=
+ ;;
+ --with-ipoib-mod)
+ CONFIG_INFINIBAND_IPOIB="m"
+ CONFIG_INFINIBAND_IPOIB_CM="y"
+ CONFIG_INFINIBAND_IPOIB_DEBUG="y"
+ ;;
+ --without-ipoib-mod)
+ CONFIG_INFINIBAND_IPOIB=
+ ;;
+ --with-ipoib-cm)
+ CONFIG_INFINIBAND_IPOIB_CM="y"
+ ;;
+ --without-ipoib-cm)
+ CONFIG_INFINIBAND_IPOIB_CM=
+ ;;
+ --with-ipoib_debug-mod)
+ CONFIG_INFINIBAND_IPOIB_DEBUG="y"
+ ;;
+ --without-ipoib_debug-mod)
+ CONFIG_INFINIBAND_IPOIB_DEBUG=
+ ;;
+ --with-ipoib_debug_data-mod)
+ CONFIG_INFINIBAND_IPOIB_DEBUG_DATA="y"
+ ;;
+ --without-ipoib_debug_data-mod)
+ CONFIG_INFINIBAND_IPOIB_DEBUG_DATA=
+ ;;
+ --with-sdp-mod)
+ CONFIG_INFINIBAND_SDP="m"
+ CONFIG_INFINIBAND_SDP_DEBUG="y"
+ ;;
+ --without-sdp-mod)
+ CONFIG_INFINIBAND_SDP=
+ ;;
+ --with-sdp-zcopy)
+ CONFIG_INFINIBAND_SDP_SEND_ZCOPY="y"
+ CONFIG_INFINIBAND_SDP_RECV_ZCOPY="y"
+ ;;
+ --without-sdp-zcopy)
+ CONFIG_INFINIBAND_SDP_SEND_ZCOPY=
+ CONFIG_INFINIBAND_SDP_RECV_ZCOPY=
+ ;;
+ --with-sdp_debug-mod)
+ CONFIG_INFINIBAND_SDP_DEBUG="y"
+ ;;
+ --without-sdp_debug-mod)
+ CONFIG_INFINIBAND_SDP_DEBUG=
+ ;;
+ --with-sdp_debug_data-mod)
+ CONFIG_INFINIBAND_SDP_DEBUG_DATA="y"
+ ;;
+ --without-sdp_debug_data-mod)
+ CONFIG_INFINIBAND_SDP_DEBUG_DATA=
+ ;;
+ --with-srp-mod)
+ CONFIG_INFINIBAND_SRP="m"
+ ;;
+ --without-srp-mod)
+ CONFIG_INFINIBAND_SRP=
+ ;;
+ --with-srp-target-mod)
+ CONFIG_INFINIBAND_SRPT="m"
+ ;;
+ --without-srp-target-mod)
+ CONFIG_INFINIBAND_SRPT=
+ ;;
+ --with-user_mad-mod)
+ CONFIG_INFINIBAND_USER_MAD="m"
+ ;;
+ --without-user_mad-mod)
+ CONFIG_INFINIBAND_USER_MAD=
+ ;;
+ --with-user_access-mod)
+ CONFIG_INFINIBAND_USER_ACCESS="m"
+ CONFIG_INFINIBAND_USER_MEM=y
+ ;;
+ --without-user_access-mod)
+ CONFIG_INFINIBAND_USER_ACCESS=
+ CONFIG_INFINIBAND_USER_MEM=
+ ;;
+ --with-addr_trans-mod)
+ CONFIG_INFINIBAND_ADDR_TRANS=y
+ ;;
+ --without-addr_trans-mod)
+ CONFIG_INFINIBAND_ADDR_TRANS=
+ ;;
+ --with-mthca-mod)
+ CONFIG_INFINIBAND_MTHCA="m"
+ CONFIG_INFINIBAND_MTHCA_DEBUG="y"
+ ;;
+ --without-mthca-mod)
+ CONFIG_INFINIBAND_MTHCA=
+ ;;
+ --with-mthca_debug-mod)
+ CONFIG_INFINIBAND_MTHCA_DEBUG="y"
+ ;;
+ --without-mthca_debug-mod)
+ CONFIG_INFINIBAND_MTHCA_DEBUG=
+ ;;
+ --with-mlx4-mod)
+ CONFIG_MLX4_CORE="m"
+ CONFIG_MLX4_INFINIBAND="m"
+ CONFIG_MLX4_DEBUG="y"
+ ;;
+ --with-mlx4_core-mod)
+ CONFIG_MLX4_CORE="m"
+ ;;
+ --without-mlx4_core-mod)
+ CONFIG_MLX4_CORE=
+ ;;
+ -without-mlx4-mod)
+ CONFIG_MLX4_CORE=
+ CONFIG_MLX4_INFINIBAND=
+ CONFIG_MLX4_DEBUG=
+ ;;
+ --with-mlx4_en-mod)
+ CONFIG_MLX4_CORE="m"
+ CONFIG_MLX4_EN="m"
+ ;;
+ --without-mlx4_en-mod)
+ CONFIG_MLX4_EN=
+ ;;
+ --with-mlx4_inf-mod)
+ CONFIG_MLX4_CORE="m"
+ CONFIG_MLX4_INFINIBAND="m"
+ ;;
+ --without-mlx4_inf-mod)
+ CONFIG_MLX4_INFINIBAND=
+ ;;
+ --with-mlx4_debug-mod)
+ CONFIG_MLX4_DEBUG="y"
+ ;;
+ --without-mlx4_debug-mod)
+ CONFIG_MLX4_DEBUG=
+ ;;
+ --with-ipath_inf-mod)
+ CONFIG_INFINIBAND_IPATH="m"
+ ;;
+ --without-ipath_inf-mod)
+ CONFIG_INFINIBAND_IPATH=
+ ;;
+ --with-qib-mod)
+ CONFIG_INFINIBAND_QIB="m"
+ ;;
+ --without-qib-mod)
+ CONFIG_INFINIBAND_QIB=
+ ;;
+ --with-iser-mod)
+ CONFIG_INFINIBAND_ISER="m"
+ ;;
+ --with-iscsi-mod)
+ CONFIG_SCSI_ISCSI_ATTRS="m"
+ CONFIG_ISCSI_TCP="m"
+ ;;
+ --without-iser-mod)
+ CONFIG_INFINIBAND_ISER=
+ CONFIG_SCSI_ISCSI_ATTRS=
+ CONFIG_ISCSI_TCP=
+ ;;
+ --with-ehca-mod)
+ CONFIG_INFINIBAND_EHCA="m"
+ CONFIG_INFINIBAND_EHCA_SCALING="y"
+ ;;
+ --without-ehca-mod)
+ CONFIG_INFINIBAND_EHCA=
+ CONFIG_INFINIBAND_EHCA_SCALING=
+ ;;
+ --with-rds-mod)
+ CONFIG_RDS="m"
+ CONFIG_RDS_RDMA="m"
+ CONFIG_RDS_TCP="m"
+ ;;
+ --without-rds-mod)
+ CONFIG_RDS=
+ CONFIG_RDS_RDMA=
+ CONFIG_RDS_TCP=
+ ;;
+ --with-rds_debug-mod)
+ CONFIG_RDS_DEBUG="y"
+ ;;
+ --without-rds_debug-mod)
+ CONFIG_RDS_DEBUG=
+ ;;
+ --with-madeye-mod)
+ CONFIG_INFINIBAND_MADEYE=m
+ ;;
+ --without-madeye-mod)
+ CONFIG_INFINIBAND_MADEYE=
+ ;;
+ --with-qlgc_vnic-mod)
+ CONFIG_INFINIBAND_QLGC_VNIC="m"
+ ;;
+ --without-qlgc_vnic-mod)
+ CONFIG_INFINIBAND_QLGC_VNIC=
+ ;;
+ --with-qlgc_vnic_stats-mod)
+ CONFIG_INFINIBAND_QLGC_VNIC_STATS="y"
+ ;;
+ --without-qlgc_vnic_stats-mod)
+ CONFIG_INFINIBAND_QLGC_VNIC_STATS=
+ ;;
+ --with-cxgb3-mod)
+ CONFIG_INFINIBAND_CXGB3="m"
+ CONFIG_CHELSIO_T3="m"
+ ;;
+ --without-cxgb3-mod)
+ CONFIG_INFINIBAND_CXGB3=
+ CONFIG_CHELSIO_T3=
+ ;;
+ --with-cxgb3_debug-mod)
+ CONFIG_INFINIBAND_CXGB3_DEBUG="y"
+ ;;
+ --without-cxgb3_debug-mod)
+ CONFIG_INFINIBAND_CXGB3_DEBUG=
+ ;;
+ --with-cxgb4-mod)
+ CONFIG_INFINIBAND_CXGB4="m"
+ CONFIG_CHELSIO_T4="m"
+ ;;
+ --without-cxgb4-mod)
+ CONFIG_INFINIBAND_CXGB4=
+ CONFIG_CHELSIO_T4=
+ ;;
+ --with-nes-mod)
+ CONFIG_INFINIBAND_NES="m"
+ ;;
+ --without-nes-mod)
+ CONFIG_INFINIBAND_NES=
+ ;;
+ --with-nes_debug-mod)
+ CONFIG_INFINIBAND_NES_DEBUG="y"
+ ;;
+ --without-nes_debug-mod)
+ CONFIG_INFINIBAND_NES_DEBUG=
+ ;;
+ --with-nfsrdma-mod)
+ CONFIG_SUNRPC_XPRT_RDMA="m"
+ CONFIG_NFSD_RDMA="y"
+ ;;
+ --without-nfsrdma-mod)
+ CONFIG_SUNRPC_XPRT_RDMA=
+ CONFIG_NFSD_RDMA=
+ ;;
+ --with-modprobe|--without-modprobe)
+ ;;
+ -h | --help)
+ usage
+ exit 0
+ ;;
+ --with*)
+ echo
+ echo "Unsupported or unused parameter: $1"
+ echo
+ ;;
+ *)
+ echo
+ echo "Unsupported parameter $1"
+ echo
+ ;;
+ esac
+ shift
+
+ done
+
+#Set default values
+KVERSION=${KVERSION:-$(uname -r)}
+MIN_KVERSION="2.6.5"
+MODULES_DIR=${MODULES_DIR:-/lib/modules/${KVERSION}/updates}
+KSRC=${KSRC:-/lib/modules/${KVERSION}/build}
+
+ARCH=${ARCH:-$(uname -m)}
+
+# Additional parameters to be passed to configure command
+CWD=$(pwd)
+CONFIG="configure.mk.kernel"
+
+mkdir -p ${CWD}/include/linux
+AUTOCONF_H="${CWD}/include/linux/autoconf.h"
+
+CONFIG_MEMTRACK=${CONFIG_MEMTRACK:-''}
+CONFIG_DEBUG_INFO=${CONFIG_DEBUG_INFO:-'y'}
+CONFIG_INFINIBAND=${CONFIG_INFINIBAND:-''}
+CONFIG_INFINIBAND_IPOIB=${CONFIG_INFINIBAND_IPOIB:-''}
+CONFIG_INFINIBAND_IPOIB_CM=${CONFIG_INFINIBAND_IPOIB_CM:-''}
+CONFIG_INFINIBAND_SDP=${CONFIG_INFINIBAND_SDP:-''}
+CONFIG_INFINIBAND_SRP=${CONFIG_INFINIBAND_SRP:-''}
+CONFIG_INFINIBAND_SRPT=${CONFIG_INFINIBAND_SRPT:-''}
+
+CONFIG_INFINIBAND_USER_MAD=${CONFIG_INFINIBAND_USER_MAD:-''}
+CONFIG_INFINIBAND_USER_ACCESS=${CONFIG_INFINIBAND_USER_ACCESS:-''}
+CONFIG_INFINIBAND_ADDR_TRANS=${CONFIG_INFINIBAND_ADDR_TRANS:-''}
+CONFIG_INFINIBAND_USER_MEM=${CONFIG_INFINIBAND_USER_MEM:-''}
+CONFIG_INFINIBAND_MTHCA=${CONFIG_INFINIBAND_MTHCA:-''}
+
+CONFIG_MLX4_CORE=${CONFIG_MLX4_CORE:-''}
+CONFIG_MLX4_EN=${CONFIG_MLX4_EN:-''}
+CONFIG_MLX4_INFINIBAND=${CONFIG_MLX4_INFINIBAND:-''}
+CONFIG_MLX4_DEBUG=${CONFIG_MLX4_DEBUG:-''}
+
+CONFIG_INFINIBAND_IPOIB_DEBUG=${CONFIG_INFINIBAND_IPOIB_DEBUG:-''}
+CONFIG_INFINIBAND_ISER=${CONFIG_INFINIBAND_ISER:-''}
+CONFIG_SCSI_ISCSI_ATTRS=${CONFIG_SCSI_ISCSI_ATTRS:-''}
+CONFIG_ISCSI_TCP=${CONFIG_ISCSI_TCP:-''}
+CONFIG_INFINIBAND_EHCA=${CONFIG_INFINIBAND_EHCA:-''}
+CONFIG_INFINIBAND_EHCA_SCALING=${CONFIG_INFINIBAND_EHCA_SCALING:-''}
+CONFIG_RDS=${CONFIG_RDS:-''}
+CONFIG_RDS_RDMA=${CONFIG_RDS_RDMA:-''}
+CONFIG_RDS_TCP=${CONFIG_RDS_TCP:-''}
+CONFIG_RDS_DEBUG=${CONFIG_RDS_DEBUG:-''}
+CONFIG_INFINIBAND_MADEYE=${CONFIG_INFINIBAND_MADEYE:-''}
+CONFIG_INFINIBAND_QLGC_VNIC=${CONFIG_INFINIBAND_QLGC_VNIC:-''}
+CONFIG_INFINIBAND_CXGB3=${CONFIG_INFINIBAND_CXGB3:-''}
+CONFIG_CHELSIO_T3=${CONFIG_CHELSIO_T3:-''}
+CONFIG_INFINIBAND_CXGB4=${CONFIG_INFINIBAND_CXGB4:-''}
+CONFIG_CHELSIO_T4=${CONFIG_CHELSIO_T4:-''}
+CONFIG_INFINIBAND_NES=${CONFIG_INFINIBAND_NES:-''}
+
+CONFIG_SUNRPC_XPRT_RDMA=${CONFIG_SUNRPC_XPRT_RDMA:-''}
+CONFIG_SUNRPC=${CONFIG_SUNRPC:-''}
+CONFIG_SUNRPC_GSS=${CONFIG_SUNRPC_GSS:-''}
+CONFIG_RPCSEC_GSS_KRB5=${CONFIG_RPCSEC_GSS_KRB5:-''}
+CONFIG_RPCSEC_GSS_SPKM3=${CONFIG_RPCSEC_GSS_SPKM3:-''}
+
+CONFIG_NFS_FS=${CONFIG_NFS_FS:-''}
+CONFIG_NFS_V3=${CONFIG_NFS_V3:-''}
+CONFIG_NFS_V3_ACL=${CONFIG_NFS_V3_ACL:-''}
+CONFIG_NFS_V4=${CONFIG_NFS_V4:-''}
+CONFIG_NFS_ACL_SUPPORT=${CONFIG_NFS_ACL_SUPPORT:-''}
+CONFIG_NFS_DIRECTIO=${CONFIG_NFS_DIRECTIO:-''}
+
+CONFIG_EXPORTFS=${CONFIG_EXPORTFS:-''}
+
+CONFIG_LOCKD=${CONFIG_LOCKD:-''}
+CONFIG_LOCKD_V4=${CONFIG_LOCKD_V4:-''}
+
+CONFIG_NFSD=${CONFIG_NFSD:-''}
+CONFIG_NFSD_V2_ACL=${CONFIG_NFSD_V2_ACL:-''}
+CONFIG_NFSD_V3=${CONFIG_NFSD_V3:-''}
+CONFIG_NFSD_V3_ACL=${CONFIG_NFSD_V3_ACL:-''}
+CONFIG_NFSD_V4=${CONFIG_NFSD_V4:-''}
+CONFIG_NFSD_RDMA=${CONFIG_NFSD_RDMA:-''}
+
+CONFIG_INFINIBAND_IPOIB_DEBUG_DATA=${CONFIG_INFINIBAND_IPOIB_DEBUG_DATA:-''}
+CONFIG_INFINIBAND_SDP_SEND_ZCOPY=${CONFIG_INFINIBAND_SDP_SEND_ZCOPY:-''}
+CONFIG_INFINIBAND_SDP_RECV_ZCOPY=${CONFIG_INFINIBAND_SDP_RECV_ZCOPY:-''}
+CONFIG_INFINIBAND_SDP_DEBUG=${CONFIG_INFINIBAND_SDP_DEBUG:-''}
+CONFIG_INFINIBAND_SDP_DEBUG_DATA=${CONFIG_INFINIBAND_SDP_DEBUG_DATA:-''}
+CONFIG_INFINIBAND_IPATH=${CONFIG_INFINIBAND_IPATH:-''}
+CONFIG_INFINIBAND_QIB=${CONFIG_INFINIBAND_QIB:-''}
+CONFIG_INFINIBAND_MTHCA_DEBUG=${CONFIG_INFINIBAND_MTHCA_DEBUG:-''}
+CONFIG_INFINIBAND_QLGC_VNIC_STATS=${CONFIG_INFINIBAND_QLGC_VNIC_STATS:-''}
+CONFIG_INFINIBAND_CXGB3_DEBUG=${CONFIG_INFINIBAND_CXGB3_DEBUG:-''}
+CONFIG_INFINIBAND_NES_DEBUG=${CONFIG_INFINIBAND_NES_DEBUG:-''}
+CONFIG_INFINIBAND_AMSO1100=${CONFIG_INFINIBAND_AMSO1100:-''}
+
+ # Check for minimal supported kernel version
+ if ! check_kerver ${KVERSION} ${MIN_KVERSION}; then
+ echo "Kernel version ${KVERSION} is less then supported kernel ${MIN_KVERSION}. Exiting..."
+ exit 1
+ fi
+
+ if [ ! -e config.mk ]; then
+ echo "config.mk does not exist. running ofed_patch.sh"
+ ex ${CWD}/ofed_scripts/ofed_patch.sh ${ofed_patch_params}
+ fi
+
+ # Create configure.mk
+ /bin/rm -f ${CWD}/${CONFIG}
+ cat >> ${CWD}/${CONFIG} << EOFCONFIG
+# Current working directory
+CWD=${CWD}
+
+# Kernel level
+KVERSION=${KVERSION}
+ARCH=${ARCH}
+MODULES_DIR=${MODULES_DIR}
+KSRC=${KSRC}
+
+AUTOCONF_H=${AUTOCONF_H}
+
+WITH_MAKE_PARAMS=${WITH_MAKE_PARAMS}
+
+CONFIG_MEMTRACK=${CONFIG_MEMTRACK}
+CONFIG_DEBUG_INFO=${CONFIG_DEBUG_INFO}
+CONFIG_INFINIBAND=${CONFIG_INFINIBAND}
+CONFIG_INFINIBAND_IPOIB=${CONFIG_INFINIBAND_IPOIB}
+CONFIG_INFINIBAND_IPOIB_CM=${CONFIG_INFINIBAND_IPOIB_CM}
+CONFIG_INFINIBAND_SDP=${CONFIG_INFINIBAND_SDP}
+CONFIG_INFINIBAND_SRP=${CONFIG_INFINIBAND_SRP}
+CONFIG_INFINIBAND_SRPT=${CONFIG_INFINIBAND_SRPT}
+
+CONFIG_INFINIBAND_USER_MAD=${CONFIG_INFINIBAND_USER_MAD}
+CONFIG_INFINIBAND_USER_ACCESS=${CONFIG_INFINIBAND_USER_ACCESS}
+CONFIG_INFINIBAND_ADDR_TRANS=${CONFIG_INFINIBAND_ADDR_TRANS}
+CONFIG_INFINIBAND_USER_MEM=${CONFIG_INFINIBAND_USER_MEM}
+CONFIG_INFINIBAND_MTHCA=${CONFIG_INFINIBAND_MTHCA}
+
+CONFIG_MLX4_CORE=${CONFIG_MLX4_CORE}
+CONFIG_MLX4_EN=${CONFIG_MLX4_EN}
+CONFIG_MLX4_INFINIBAND=${CONFIG_MLX4_INFINIBAND}
+CONFIG_MLX4_DEBUG=${CONFIG_MLX4_DEBUG}
+
+CONFIG_INFINIBAND_IPOIB_DEBUG=${CONFIG_INFINIBAND_IPOIB_DEBUG}
+CONFIG_INFINIBAND_ISER=${CONFIG_INFINIBAND_ISER}
+CONFIG_SCSI_ISCSI_ATTRS=${CONFIG_SCSI_ISCSI_ATTRS}
+CONFIG_ISCSI_TCP=${CONFIG_ISCSI_TCP}
+CONFIG_INFINIBAND_EHCA=${CONFIG_INFINIBAND_EHCA}
+CONFIG_INFINIBAND_EHCA_SCALING=${CONFIG_INFINIBAND_EHCA_SCALING}
+CONFIG_RDS=${CONFIG_RDS}
+CONFIG_RDS_RDMA=${CONFIG_RDS_RDMA}
+CONFIG_RDS_TCP=${CONFIG_RDS_TCP}
+CONFIG_RDS_DEBUG=${CONFIG_RDS_DEBUG}
+CONFIG_INFINIBAND_MADEYE=${CONFIG_INFINIBAND_MADEYE}
+CONFIG_INFINIBAND_QLGC_VNIC=${CONFIG_INFINIBAND_QLGC_VNIC}
+CONFIG_INFINIBAND_CXGB3=${CONFIG_INFINIBAND_CXGB3}
+CONFIG_CHELSIO_T3=${CONFIG_CHELSIO_T3}
+CONFIG_INFINIBAND_CXGB4=${CONFIG_INFINIBAND_CXGB4}
+CONFIG_CHELSIO_T4=${CONFIG_CHELSIO_T4}
+CONFIG_INFINIBAND_NES=${CONFIG_INFINIBAND_NES}
+
+CONFIG_SUNRPC_XPRT_RDMA=${CONFIG_SUNRPC_XPRT_RDMA}
+CONFIG_SUNRPC=${CONFIG_SUNRPC}
+CONFIG_SUNRPC_GSS=${CONFIG_SUNRPC_GSS}
+CONFIG_RPCSEC_GSS_KRB5=${CONFIG_RPCSEC_GSS_KRB5}
+CONFIG_RPCSEC_GSS_SPKM3=${CONFIG_RPCSEC_GSS_SPKM3}
+
+CONFIG_NFS_FS=${CONFIG_NFS_FS}
+CONFIG_NFS_V3=${CONFIG_NFS_V3}
+CONFIG_NFS_V3_ACL=${CONFIG_NFS_V3_ACL}
+CONFIG_NFS_V4=${CONFIG_NFS_V4}
+CONFIG_NFS_ACL_SUPPORT=${CONFIG_NFS_ACL_SUPPORT}
+CONFIG_NFS_DIRECTIO=${CONFIG_NFS_DIRECTIO}
+CONFIG_EXPORTFS=${CONFIG_EXPORTFS}
+CONFIG_LOCKD=${CONFIG_LOCKD}
+CONFIG_LOCKD_V4=${CONFIG_LOCKD_V4}
+CONFIG_NFSD=${CONFIG_NFSD}
+CONFIG_NFSD_V2_ACL=${CONFIG_NFSD_V2_ACL}
+CONFIG_NFSD_V3=${CONFIG_NFSD_V3}
+CONFIG_NFSD_V3_ACL=${CONFIG_NFSD_V3_ACL}
+CONFIG_NFSD_V4=${CONFIG_NFSD_V4}
+CONFIG_NFSD_RDMA=${CONFIG_NFSD_RDMA}
+
+CONFIG_INFINIBAND_IPOIB_DEBUG_DATA=${CONFIG_INFINIBAND_IPOIB_DEBUG_DATA}
+CONFIG_INFINIBAND_SDP_SEND_ZCOPY=${CONFIG_INFINIBAND_SDP_SEND_ZCOPY}
+CONFIG_INFINIBAND_SDP_RECV_ZCOPY=${CONFIG_INFINIBAND_SDP_RECV_ZCOPY}
+CONFIG_INFINIBAND_SDP_DEBUG=${CONFIG_INFINIBAND_SDP_DEBUG}
+CONFIG_INFINIBAND_SDP_DEBUG_DATA=${CONFIG_INFINIBAND_SDP_DEBUG_DATA}
+CONFIG_INFINIBAND_IPATH=${CONFIG_INFINIBAND_IPATH}
+CONFIG_INFINIBAND_QIB=${CONFIG_INFINIBAND_QIB}
+CONFIG_INFINIBAND_MTHCA_DEBUG=${CONFIG_INFINIBAND_MTHCA_DEBUG}
+CONFIG_INFINIBAND_QLGC_VNIC_STATS=${CONFIG_INFINIBAND_QLGC_VNIC_STATS}
+CONFIG_INFINIBAND_CXGB3_DEBUG=${CONFIG_INFINIBAND_CXGB3_DEBUG}
+CONFIG_INFINIBAND_NES_DEBUG=${CONFIG_INFINIBAND_NES_DEBUG}
+CONFIG_INFINIBAND_AMSO1100=${CONFIG_INFINIBAND_AMSO1100}
+
+EOFCONFIG
+ echo "Created ${CONFIG}:"
+ cat ${CWD}/${CONFIG}
+
+# Create autoconf.h
+if [ "X${CONFIG_MEMTRACK}" == "Xm" ]; then
+ DEFINE_MEMTRACK="#undef CONFIG_MEMTRACK\n#define CONFIG_MEMTRACK 1"
+else
+ DEFINE_MEMTRACK="#undef CONFIG_MEMTRACK"
+fi
+if [ "X${CONFIG_DEBUG_INFO}" == "Xy" ]; then
+ DEFINE_DEBUG_INFO="#undef CONFIG_DEBUG_INFO\n#define CONFIG_DEBUG_INFO 1"
+else
+ DEFINE_DEBUG_INFO="#undef CONFIG_DEBUG_INFO"
+fi
+if [ "X${CONFIG_INFINIBAND}" == "Xm" ]; then
+ DEFINE_INFINIBAND="#undef CONFIG_INFINIBAND\n#define CONFIG_INFINIBAND 1"
+else
+ DEFINE_INFINIBAND="#undef CONFIG_INFINIBAND"
+fi
+if [ "X${CONFIG_INFINIBAND_IPOIB}" == "Xm" ]; then
+ DEFINE_INFINIBAND_IPOIB="#undef CONFIG_INFINIBAND_IPOIB\n#define CONFIG_INFINIBAND_IPOIB 1"
+else
+ DEFINE_INFINIBAND_IPOIB="#undef CONFIG_INFINIBAND_IPOIB"
+fi
+if [ "X${CONFIG_INFINIBAND_IPOIB_CM}" == "Xy" ]; then
+ DEFINE_INFINIBAND_IPOIB_CM="#undef CONFIG_INFINIBAND_IPOIB_CM\n#define CONFIG_INFINIBAND_IPOIB_CM 1"
+else
+ DEFINE_INFINIBAND_IPOIB_CM="#undef CONFIG_INFINIBAND_IPOIB_CM"
+fi
+if [ "X${CONFIG_INFINIBAND_SDP}" == "Xm" ]; then
+ DEFINE_INFINIBAND_SDP="#undef CONFIG_INFINIBAND_SDP\n#define CONFIG_INFINIBAND_SDP 1"
+else
+ DEFINE_INFINIBAND_SDP="#undef CONFIG_INFINIBAND_SDP"
+fi
+if [ "X${CONFIG_INFINIBAND_SRP}" == "Xm" ]; then
+ DEFINE_INFINIBAND_SRP="#undef CONFIG_INFINIBAND_SRP\n#define CONFIG_INFINIBAND_SRP 1"
+else
+ DEFINE_INFINIBAND_SRP="#undef CONFIG_INFINIBAND_SRP"
+fi
+if [ "X${CONFIG_INFINIBAND_SRPT}" == "Xm" ]; then
+ DEFINE_INFINIBAND_SRPT="#undef CONFIG_INFINIBAND_SRPT\n#define CONFIG_INFINIBAND_SRPT 1"
+else
+ DEFINE_INFINIBAND_SRPT="#undef CONFIG_INFINIBAND_SRP"
+fi
+if [ "X${CONFIG_INFINIBAND_USER_MAD}" == "Xm" ]; then
+ DEFINE_INFINIBAND_USER_MAD="#undef CONFIG_INFINIBAND_USER_MAD\n#define CONFIG_INFINIBAND_USER_MAD 1"
+else
+ DEFINE_INFINIBAND_USER_MAD="#undef CONFIG_INFINIBAND_USER_MAD"
+fi
+if [ "X${CONFIG_INFINIBAND_USER_ACCESS}" == "Xm" ]; then
+ DEFINE_INFINIBAND_USER_ACCESS="#undef CONFIG_INFINIBAND_USER_ACCESS\n#define CONFIG_INFINIBAND_USER_ACCESS 1"
+else
+ DEFINE_INFINIBAND_USER_ACCESS="#undef CONFIG_INFINIBAND_USER_ACCESS"
+fi
+if [ "X${CONFIG_INFINIBAND_ADDR_TRANS}" == "Xy" ]; then
+ DEFINE_INFINIBAND_ADDR_TRANS="#undef CONFIG_INFINIBAND_ADDR_TRANS\n#define CONFIG_INFINIBAND_ADDR_TRANS 1"
+else
+ DEFINE_INFINIBAND_ADDR_TRANS="#undef CONFIG_INFINIBAND_ADDR_TRANS"
+fi
+if [ "X${CONFIG_INFINIBAND_USER_MEM}" == "Xy" ]; then
+ DEFINE_INFINIBAND_USER_MEM="#undef CONFIG_INFINIBAND_USER_MEM\n#define CONFIG_INFINIBAND_USER_MEM 1"
+else
+ DEFINE_INFINIBAND_USER_MEM="#undef CONFIG_INFINIBAND_USER_MEM"
+fi
+if [ "X${CONFIG_INFINIBAND_MTHCA}" == "Xm" ]; then
+ DEFINE_INFINIBAND_MTHCA="#undef CONFIG_INFINIBAND_MTHCA\n#define CONFIG_INFINIBAND_MTHCA 1"
+else
+ DEFINE_INFINIBAND_MTHCA="#undef CONFIG_INFINIBAND_MTHCA"
+fi
+if [ "X${CONFIG_MLX4_CORE}" == "Xm" ]; then
+ DEFINE_MLX4_CORE="#undef CONFIG_MLX4_CORE\n#define CONFIG_MLX4_CORE 1"
+else
+ DEFINE_MLX4_CORE="#undef CONFIG_MLX4_CORE"
+fi
+if [ "X${CONFIG_MLX4_EN}" == "Xm" ]; then
+ DEFINE_MLX4_EN="#undef CONFIG_MLX4_EN\n#define CONFIG_MLX4_EN 1"
+else
+ DEFINE_MLX4_EN="#undef CONFIG_MLX4_EN"
+fi
+if [ "X${CONFIG_MLX4_INFINIBAND}" == "Xm" ]; then
+ DEFINE_MLX4_INFINIBAND="#undef CONFIG_MLX4_INFINIBAND\n#define CONFIG_MLX4_INFINIBAND 1"
+else
+ DEFINE_MLX4_INFINIBAND="#undef CONFIG_MLX4_INFINIBAND"
+fi
+if [ "X${CONFIG_MLX4_DEBUG}" == "Xy" ]; then
+ DEFINE_MLX4_DEBUG="#undef CONFIG_MLX4_DEBUG\n#define CONFIG_MLX4_DEBUG 1"
+else
+ DEFINE_MLX4_DEBUG="#undef CONFIG_MLX4_DEBUG"
+fi
+if [ "X${CONFIG_INFINIBAND_IPOIB_DEBUG}" == "Xy" ]; then
+ DEFINE_INFINIBAND_IPOIB_DEBUG="#undef CONFIG_INFINIBAND_IPOIB_DEBUG\n#define CONFIG_INFINIBAND_IPOIB_DEBUG 1"
+else
+ DEFINE_INFINIBAND_IPOIB_DEBUG="#undef CONFIG_INFINIBAND_IPOIB_DEBUG"
+fi
+if [ "X${CONFIG_INFINIBAND_ISER}" == "Xm" ]; then
+ DEFINE_INFINIBAND_ISER="#undef CONFIG_INFINIBAND_ISER\n#define CONFIG_INFINIBAND_ISER 1"
+ DEFINE_SCSI_ISCSI_ATTRS="#undef CONFIG_SCSI_ISCSI_ATTRS\n#define CONFIG_SCSI_ISCSI_ATTRS 1"
+ DEFINE_ISCSI_TCP="#undef CONFIG_ISCSI_TCP\n#define CONFIG_ISCSI_TCP 1"
+else
+ DEFINE_INFINIBAND_ISER="#undef CONFIG_INFINIBAND_ISER"
+ DEFINE_SCSI_ISCSI_ATTRS="#undef CONFIG_SCSI_ISCSI_ATTRS"
+ DEFINE_ISCSI_TCP="#undef CONFIG_ISCSI_TCP"
+fi
+if [ "X${CONFIG_INFINIBAND_EHCA}" == "Xm" ]; then
+ DEFINE_INFINIBAND_EHCA="#undef CONFIG_INFINIBAND_EHCA\n#define CONFIG_INFINIBAND_EHCA 1"
+else
+ DEFINE_INFINIBAND_EHCA="#undef CONFIG_INFINIBAND_EHCA"
+fi
+if [ "X${CONFIG_INFINIBAND_EHCA_SCALING}" == "Xy" ]; then
+ DEFINE_INFINIBAND_EHCA_SCALING="#undef CONFIG_INFINIBAND_EHCA_SCALING\n#define CONFIG_INFINIBAND_EHCA_SCALING 1"
+else
+ DEFINE_INFINIBAND_EHCA_SCALING="#undef CONFIG_INFINIBAND_EHCA_SCALING"
+fi
+if [ "X${CONFIG_RDS}" == "Xm" ]; then
+ DEFINE_RDS="#undef CONFIG_RDS\n#define CONFIG_RDS 1"
+ DEFINE_RDS_RDMA="#undef CONFIG_RDS_RDMA\n#define CONFIG_RDS_RDMA 1"
+ DEFINE_RDS_TCP="#undef CONFIG_RDS_TCP\n#define CONFIG_RDS_TCP 1"
+else
+ DEFINE_RDS="#undef CONFIG_RDS"
+ DEFINE_RDS_RDMA="#undef CONFIG_RDS_RDMA"
+ DEFINE_RDS_TCP="#undef CONFIG_RDS_TCP"
+fi
+if [ "X${CONFIG_RDS_DEBUG}" == "Xy" ]; then
+ DEFINE_RDS_DEBUG="#undef CONFIG_RDS_DEBUG\n#define CONFIG_RDS_DEBUG 1"
+else
+ DEFINE_RDS_DEBUG="#undef CONFIG_RDS_DEBUG"
+fi
+if [ "X${CONFIG_INFINIBAND_MADEYE}" == "Xm" ]; then
+ DEFINE_INFINIBAND_MADEYE="#undef CONFIG_INFINIBAND_MADEYE\n#define CONFIG_INFINIBAND_MADEYE 1"
+else
+ DEFINE_INFINIBAND_MADEYE="#undef CONFIG_INFINIBAND_MADEYE"
+fi
+if [ "X${CONFIG_INFINIBAND_IPOIB_DEBUG_DATA}" == "Xy" ]; then
+ DEFINE_INFINIBAND_IPOIB_DEBUG_DATA="#undef CONFIG_INFINIBAND_IPOIB_DEBUG_DATA\n#define CONFIG_INFINIBAND_IPOIB_DEBUG_DATA 1"
+else
+ DEFINE_INFINIBAND_IPOIB_DEBUG_DATA="#undef CONFIG_INFINIBAND_IPOIB_DEBUG_DATA"
+fi
+if [ "X${CONFIG_INFINIBAND_SDP_SEND_ZCOPY}" == "Xy" ]; then
+ DEFINE_INFINIBAND_SDP_SEND_ZCOPY="#undef CONFIG_INFINIBAND_SDP_SEND_ZCOPY\n#define CONFIG_INFINIBAND_SDP_SEND_ZCOPY 1"
+else
+ DEFINE_INFINIBAND_SDP_SEND_ZCOPY="#undef CONFIG_INFINIBAND_SDP_SEND_ZCOPY"
+fi
+if [ "X${CONFIG_INFINIBAND_SDP_RECV_ZCOPY}" == "Xy" ]; then
+ DEFINE_INFINIBAND_SDP_RECV_ZCOPY="#undef CONFIG_INFINIBAND_SDP_RECV_ZCOPY\n#define CONFIG_INFINIBAND_SDP_RECV_ZCOPY 1"
+else
+ DEFINE_INFINIBAND_SDP_RECV_ZCOPY="#undef CONFIG_INFINIBAND_SDP_RECV_ZCOPY"
+fi
+if [ "X${CONFIG_INFINIBAND_SDP_DEBUG}" == "Xy" ]; then
+ DEFINE_INFINIBAND_SDP_DEBUG="#undef CONFIG_INFINIBAND_SDP_DEBUG\n#define CONFIG_INFINIBAND_SDP_DEBUG 1"
+else
+ DEFINE_INFINIBAND_SDP_DEBUG="#undef CONFIG_INFINIBAND_SDP_DEBUG"
+fi
+if [ "X${CONFIG_INFINIBAND_SDP_DEBUG_DATA}" == "Xy" ]; then
+ DEFINE_INFINIBAND_SDP_DEBUG_DATA="#undef CONFIG_INFINIBAND_SDP_DEBUG_DATA\n#define CONFIG_INFINIBAND_SDP_DEBUG_DATA 1"
+else
+ DEFINE_INFINIBAND_SDP_DEBUG_DATA="#undef CONFIG_INFINIBAND_SDP_DEBUG_DATA"
+fi
+if [ "X${CONFIG_INFINIBAND_IPATH}" == "Xm" ]; then
+ DEFINE_INFINIBAND_IPATH="#undef CONFIG_INFINIBAND_IPATH\n#define CONFIG_INFINIBAND_IPATH 1"
+else
+ DEFINE_INFINIBAND_IPATH="#undef CONFIG_INFINIBAND_IPATH"
+fi
+if [ "X${CONFIG_INFINIBAND_QIB}" == "Xm" ]; then
+ DEFINE_INFINIBAND_QIB="#undef CONFIG_INFINIBAND_QIB\n#define CONFIG_INFINIBAND_QIB 1"
+else
+ DEFINE_INFINIBAND_QIB="#undef CONFIG_INFINIBAND_QIB"
+fi
+if [ "X${CONFIG_INFINIBAND_MTHCA_DEBUG}" == "Xy" ]; then
+ DEFINE_INFINIBAND_MTHCA_DEBUG="#undef CONFIG_INFINIBAND_MTHCA_DEBUG\n#define CONFIG_INFINIBAND_MTHCA_DEBUG 1"
+else
+ DEFINE_INFINIBAND_MTHCA_DEBUG="#undef CONFIG_INFINIBAND_MTHCA_DEBUG"
+fi
+if [ "X${CONFIG_INFINIBAND_QLGC_VNIC}" == "Xm" ]; then
+ DEFINE_INFINIBAND_QLGC_VNIC="#undef CONFIG_INFINIBAND_QLGC_VNIC\n#define CONFIG_INFINIBAND_QLGC_VNIC 1"
+else
+ DEFINE_INFINIBAND_QLGC_VNIC="#undef CONFIG_INFINIBAND_QLGC_VNIC"
+fi
+if [ "X${CONFIG_INFINIBAND_QLGC_VNIC_STATS}" == "Xy" ]; then
+ DEFINE_INFINIBAND_QLGC_VNIC_STATS="#undef CONFIG_INFINIBAND_QLGC_VNIC_STATS\n#define CONFIG_INFINIBAND_QLGC_VNIC_STATS 1"
+else
+ DEFINE_INFINIBAND_QLGC_VNIC_STATS="#undef CONFIG_INFINIBAND_QLGC_VNIC_STATS"
+fi
+if [ "X${CONFIG_INFINIBAND_CXGB3}" == "Xm" ]; then
+ DEFINE_INFINIBAND_CXGB3="#undef CONFIG_INFINIBAND_CXGB3\n#define CONFIG_INFINIBAND_CXGB3 1"
+else
+ DEFINE_INFINIBAND_CXGB3="#undef CONFIG_INFINIBAND_CXGB3"
+fi
+if [ "X${CONFIG_INFINIBAND_CXGB3_DEBUG}" == "Xy" ]; then
+ DEFINE_INFINIBAND_CXGB3_DEBUG="#undef CONFIG_INFINIBAND_CXGB3_DEBUG\n#define CONFIG_INFINIBAND_CXGB3_DEBUG 1"
+else
+ DEFINE_INFINIBAND_CXGB3_DEBUG="#undef CONFIG_INFINIBAND_CXGB3_DEBUG"
+fi
+if [ "X${CONFIG_CHELSIO_T3}" == "Xm" ]; then
+ DEFINE_CHELSIO_T3="#undef CONFIG_CHELSIO_T3\n#define CONFIG_CHELSIO_T3 1"
+else
+ DEFINE_CHELSIO_T3="#undef CONFIG_CHELSIO_T3"
+fi
+if [ "X${CONFIG_INFINIBAND_CXGB4}" == "Xm" ]; then
+ DEFINE_INFINIBAND_CXGB4="#undef CONFIG_INFINIBAND_CXGB4\n#define CONFIG_INFINIBAND_CXGB4 1"
+else
+ DEFINE_INFINIBAND_CXGB4="#undef CONFIG_INFINIBAND_CXGB4"
+fi
+if [ "X${CONFIG_CHELSIO_T4}" == "Xm" ]; then
+ DEFINE_CHELSIO_T4="#undef CONFIG_CHELSIO_T4\n#define CONFIG_CHELSIO_T4 1"
+else
+ DEFINE_CHELSIO_T4="#undef CONFIG_CHELSIO_T4"
+fi
+if [ "X${CONFIG_INFINIBAND_NES}" == "Xm" ]; then
+ DEFINE_INFINIBAND_NES="#undef CONFIG_INFINIBAND_NES\n#define CONFIG_INFINIBAND_NES 1"
+else
+ DEFINE_INFINIBAND_NES="#undef CONFIG_INFINIBAND_NES"
+fi
+if [ "X${CONFIG_INFINIBAND_NES_DEBUG}" == "Xy" ]; then
+ DEFINE_INFINIBAND_NES_DEBUG="#undef CONFIG_INFINIBAND_NES_DEBUG\n#define CONFIG_INFINIBAND_NES_DEBUG 1"
+else
+ DEFINE_INFINIBAND_NES_DEBUG="#undef CONFIG_INFINIBAND_NES_DEBUG"
+fi
+if [ "X${CONFIG_INFINIBAND_AMSO1100}" == "Xm" ]; then
+ DEFINE_INFINIBAND_AMSO1100="#undef CONFIG_INFINIBAND_AMSO1100\n#define CONFIG_INFINIBAND_AMSO1100 1"
+else
+ DEFINE_INFINIBAND_AMSO1100="#undef CONFIG_INFINIBAND_AMSO1100"
+fi
+if [ "X${CONFIG_SUNRPC_XPRT_RDMA}" == "Xm" ]; then
+ DEFINE_SUNRPC_XPRT_RDMA="#undef CONFIG_SUNRPC_XPRT_RDMA\n#define CONFIG_SUNRPC_XPRT_RDMA 1"
+ DEFINE_SUNRPC="#undef CONFIG_SUNRPC\n#define CONFIG_SUNRPC 1"
+ DEFINE_SUNRPC_GSS="#undef CONFIG_SUNRPC_GSS\n#define CONFIG_SUNRPC_GSS 1"
+ DEFINE_RPCSEC_GSS_KRB5="#undef CONFIG_RPCSEC_GSS_KRB5\n#define CONFIG_RPCSEC_GSS_KRB5 1"
+ DEFINE_RPCSEC_GSS_SPKM3="#undef CONFIG_RPCSEC_GSS_SPKM3\n#define CONFIG_RPCSEC_GSS_SPKM3 1"
+ DEFINE_NFS_FS="#undef CONFIG_NFS_FS\n#define CONFIG_NFS_FS 1"
+ DEFINE_NFS_V3="#undef CONFIG_NFS_V3\n#define CONFIG_NFS_V3 1"
+ DEFINE_NFS_V3_ACL="#undef CONFIG_NFS_V3_ACL\n#define CONFIG_NFS_V3_ACL 1"
+ DEFINE_NFS_V4="#undef CONFIG_NFS_V4\n#define CONFIG_NFS_V4 1"
+ DEFINE_NFS_ACL_SUPPORT="#undef CONFIG_NFS_ACL_SUPPORT\n#define CONFIG_NFS_ACL_SUPPORT 1"
+ DEFINE_NFS_DIRECTIO="#undef CONFIG_NFS_DIRECTIO\n#define CONFIG_NFS_DIRECTIO 1"
+ DEFINE_EXPORTFS="#undef CONFIG_EXPORTFS\n#define CONFIG_EXPORTFS 1"
+ DEFINE_LOCKD="#undef CONFIG_LOCKD\n#define CONFIG_LOCKD 1"
+ DEFINE_LOCKD_V4="#undef CONFIG_LOCKD_V4\n#define CONFIG_LOCKD_V4 1"
+ DEFINE_NFSD="#undef CONFIG_NFSD\n#define CONFIG_NFSD 1"
+ DEFINE_NFSD_V2_ACL="#undef CONFIG_NFSD_V2_ACL\n#define CONFIG_NFSD_V2_ACL 1"
+ DEFINE_NFSD_V3="#undef CONFIG_NFSD_V3\n#define CONFIG_NFSD_V3 1"
+ DEFINE_NFSD_V3_ACL="#undef CONFIG_NFSD_V3_ACL\n#define CONFIG_NFSD_V3_ACL 1"
+ DEFINE_NFSD_V4="#undef CONFIG_NFSD_V4\n#define CONFIG_NFSD_V4 1"
+ DEFINE_NFSD_RDMA="#undef CONFIG_NFSD_RDMA\n#define CONFIG_NFSD_RDMA 1"
+else
+ DEFINE_SUNRPC_XPRT_RDMA="/* CONFIG_SUNRPC_XPRT_RDMA is not set */"
+ DEFINE_SUNRPC="/* CONFIG_SUNRPC is not set */"
+ DEFINE_SUNRPC_GSS="/* CONFIG_SUNRPC_GSS is not set */"
+ DEFINE_RPCSEC_GSS_KRB5="/* CONFIG_RPCSEC_GSS_KRB5 is not set */"
+ DEFINE_RPCSEC_GSS_SPKM3="/* CONFIG_RPCSEC_GSS_SPKM3 is not set */"
+ DEFINE_NFS_FS="/* CONFIG_NFS_FS is not set */"
+ DEFINE_NFS_V3="/* CONFIG_NFS_V3 is not set */"
+ DEFINE_NFS_V3_ACL="/* CONFIG_NFS_V3_ACL is not set */"
+ DEFINE_NFS_V4="/* CONFIG_NFS_V4 is not set */"
+ DEFINE_NFS_ACL_SUPPORT="/* CONFIG_NFS_ACL_SUPPORT is not set */"
+ DEFINE_NFS_DIRECTIO="/* CONFIG_NFS_DIRECTIO is not set */"
+ DEFINE_EXPORTFS="/* CONFIG_EXPORTFS is not set */"
+ DEFINE_LOCKD="/* CONFIG_LOCKD is not set */"
+ DEFINE_LOCKD_V4="/* CONFIG_LOCKD_V4 is not set */"
+ DEFINE_NFSD="/* CONFIG_NFSD is not set */"
+ DEFINE_NFSD_V2_ACL="/* CONFIG_NFSD_V2_ACL is not set */"
+ DEFINE_NFSD_V3="/* CONFIG_NFSD_V3 is not set */"
+ DEFINE_NFSD_V3_ACL="/* CONFIG_NFSD_V3_ACL is not set */"
+ DEFINE_NFSD_V4="/* CONFIG_NFSD_V4 is not set */"
+ DEFINE_NFSD_RDMA="/* CONFIG_NFSD_RDMA is not set */"
+fi
+cat >> ${AUTOCONF_H} << EOFAUTOCONF
+#ifndef __OFED_BUILD__
+#include_next <linux/autoconf.h>
+$(echo -e "${DEFINE_INFINIBAND}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_IPOIB}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_IPOIB_CM}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_SDP}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_SRP}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_SRPT}" | grep -v undef)
+
+$(echo -e "${DEFINE_INFINIBAND_USER_MAD}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_USER_ACCESS}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_ADDR_TRANS}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_USER_MEM}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_MTHCA}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_QLGC_VNIC}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_CXGB3}" | grep -v undef)
+$(echo -e "${DEFINE_CHELSIO_T3}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_CXGB4}" | grep -v undef)
+$(echo -e "${DEFINE_CHELSIO_T4}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_NES}" | grep -v undef)
+
+$(echo -e "${DEFINE_SUNRPC_XPRT_RDMA}" | grep -v undef)
+$(echo -e "${DEFINE_SUNRPC}" | grep -v undef)
+$(echo -e "${DEFINE_SUNRPC_GSS}" | grep -v undef)
+$(echo -e "${DEFINE_RPCSEC_GSS_KRB5}" | grep -v undef)
+$(echo -e "${DEFINE_RPCSEC_GSS_SPKM3}" | grep -v undef)
+$(echo -e "${DEFINE_NFS_FS}" | grep -v undef)
+$(echo -e "${DEFINE_NFS_V3}" | grep -v undef)
+$(echo -e "${DEFINE_NFS_V3_ACL}" | grep -v undef)
+$(echo -e "${DEFINE_NFS_V4}" | grep -v undef)
+$(echo -e "${DEFINE_NFS_ACL_SUPPORT}" | grep -v undef)
+$(echo -e "${DEFINE_NFS_DIRECTIO}" | grep -v undef)
+$(echo -e "${DEFINE_EXPORTFS}" | grep -v undef)
+$(echo -e "${DEFINE_LOCKD}" | grep -v undef)
+$(echo -e "${DEFINE_LOCKD_V4}" | grep -v undef)
+$(echo -e "${DEFINE_NFSD}" | grep -v undef)
+$(echo -e "${DEFINE_NFSD_V2_ACL}" | grep -v undef)
+$(echo -e "${DEFINE_NFSD_V3}" | grep -v undef)
+$(echo -e "${DEFINE_NFSD_V3_ACL}" | grep -v undef)
+$(echo -e "${DEFINE_NFSD_V4}" | grep -v undef)
+$(echo -e "${DEFINE_NFSD_RDMA}" | grep -v undef)
+
+$(echo -e "${DEFINE_INFINIBAND_IPOIB_DEBUG}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_ISER}" | grep -v undef)
+$(echo -e "${DEFINE_SCSI_ISCSI_ATTRS}" | grep -v undef)
+$(echo -e "${DEFINE_ISCSI_TCP}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_EHCA}" | grep -v undef)
+$(echo -e "${DEFINE_RDS}" | grep -v undef)
+$(echo -e "${DEFINE_RDS_RDMA}" | grep -v undef)
+$(echo -e "${DEFINE_RDS_TCP}" | grep -v undef)
+$(echo -e "${DEFINE_RDS_DEBUG}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_QLGC_VNIC_STATS}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_CXGB3_DEBUG}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_NES_DEBUG}" | grep -v undef)
+
+$(echo -e "${DEFINE_MLX4_CORE}" | grep -v undef)
+$(echo -e "${DEFINE_MLX4_EN}" | grep -v undef)
+$(echo -e "${DEFINE_MLX4_INFINIBAND}" | grep -v undef)
+$(echo -e "${DEFINE_MLX4_ETHERNET}" | grep -v undef)
+$(echo -e "${DEFINE_MLX4_DEBUG}" | grep -v undef)
+
+$(echo -e "${DEFINE_INFINIBAND_IPOIB_DEBUG_DATA}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_SDP_SEND_ZCOPY}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_SDP_RECV_ZCOPY}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_SDP_DEBUG}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_SDP_DEBUG_DATA}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_IPATH}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_QIB}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_MTHCA_DEBUG}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_MADEYE}" | grep -v undef)
+$(echo -e "${DEFINE_INFINIBAND_AMSO1100}" | grep -v undef)
+#else
+#undef CONFIG_MEMTRACK
+#undef CONFIG_DEBUG_INFO
+#undef CONFIG_INFINIBAND
+#undef CONFIG_INFINIBAND_IPOIB
+#undef CONFIG_INFINIBAND_IPOIB_CM
+#undef CONFIG_INFINIBAND_SDP
+#undef CONFIG_INFINIBAND_SRP
+#undef CONFIG_INFINIBAND_SRPT
+
+#undef CONFIG_INFINIBAND_USER_MAD
+#undef CONFIG_INFINIBAND_USER_ACCESS
+#undef CONFIG_INFINIBAND_ADDR_TRANS
+#undef CONFIG_INFINIBAND_USER_MEM
+#undef CONFIG_INFINIBAND_MTHCA
+
+#undef CONFIG_MLX4_CORE
+#undef CONFIG_MLX4_DEBUG
+#undef CONFIG_MLX4_EN
+#undef CONFIG_MLX4_INFINIBAND
+
+#undef CONFIG_INFINIBAND_IPOIB_DEBUG
+#undef CONFIG_INFINIBAND_ISER
+#undef CONFIG_INFINIBAND_EHCA
+#undef CONFIG_INFINIBAND_EHCA_SCALING
+#undef CONFIG_RDS
+#undef CONFIG_RDS_RDMA
+#undef CONFIG_RDS_TCP
+#undef CONFIG_RDS_DEBUG
+#undef CONFIG_INFINIBAND_MADEYE
+#undef CONFIG_INFINIBAND_QLGC_VNIC
+#undef CONFIG_INFINIBAND_QLGC_VNIC_STATS
+#undef CONFIG_INFINIBAND_CXGB3
+#undef CONFIG_INFINIBAND_CXGB3_DEBUG
+#undef CONFIG_CHELSIO_T3
+#undef CONFIG_INFINIBAND_CXGB4
+#undef CONFIG_CHELSIO_T4
+#undef CONFIG_INFINIBAND_NES
+#undef CONFIG_INFINIBAND_NES_DEBUG
+
+#undef CONFIG_SUNRPC_XPRT_RDMA
+#undef CONFIG_SUNRPC
+#undef CONFIG_SUNRPC_GSS
+#undef CONFIG_RPCSEC_GSS_KRB5
+#undef CONFIG_RPCSEC_GSS_SPKM3
+#undef CONFIG_NFS_FS
+#undef CONFIG_NFS_V3
+#undef CONFIG_NFS_V3_ACL
+#undef CONFIG_NFS_V4
+#undef CONFIG_NFS_ACL_SUPPORT
+#undef CONFIG_NFS_DIRECTIO
+#undef CONFIG_EXPORTFS
+#undef CONFIG_LOCKD
+#undef CONFIG_LOCKD_V4
+#undef CONFIG_NFSD
+#undef CONFIG_NFSD_V2_ACL
+#undef CONFIG_NFSD_V3
+#undef CONFIG_NFSD_V3_ACL
+#undef CONFIG_NFSD_V4
+#undef CONFIG_NFSD_RDMA
+
+#undef CONFIG_INFINIBAND_IPOIB_DEBUG_DATA
+#undef CONFIG_INFINIBAND_SDP_SEND_ZCOPY
+#undef CONFIG_INFINIBAND_SDP_RECV_ZCOPY
+#undef CONFIG_INFINIBAND_SDP_DEBUG
+#undef CONFIG_INFINIBAND_SDP_DEBUG_DATA
+#undef CONFIG_INFINIBAND_IPATH
+#undef CONFIG_INFINIBAND_QIB
+#undef CONFIG_INFINIBAND_MTHCA_DEBUG
+#undef CONFIG_INFINIBAND_AMSO1100
+
+$(echo -e "${DEFINE_INFINIBAND}")
+$(echo -e "${DEFINE_INFINIBAND_IPOIB}")
+$(echo -e "${DEFINE_INFINIBAND_IPOIB_CM}")
+$(echo -e "${DEFINE_INFINIBAND_SDP}")
+$(echo -e "${DEFINE_INFINIBAND_SRP}")
+$(echo -e "${DEFINE_INFINIBAND_SRPT}")
+
+$(echo -e "${DEFINE_INFINIBAND_USER_MAD}")
+$(echo -e "${DEFINE_INFINIBAND_USER_ACCESS}")
+$(echo -e "${DEFINE_INFINIBAND_ADDR_TRANS}")
+$(echo -e "${DEFINE_INFINIBAND_USER_MEM}")
+$(echo -e "${DEFINE_INFINIBAND_MTHCA}")
+$(echo -e "${DEFINE_INFINIBAND_QLGC_VNIC}")
+$(echo -e "${DEFINE_INFINIBAND_CXGB3}")
+$(echo -e "${DEFINE_CHELSIO_T3}")
+$(echo -e "${DEFINE_INFINIBAND_CXGB4}")
+$(echo -e "${DEFINE_CHELSIO_T4}")
+$(echo -e "${DEFINE_INFINIBAND_NES}")
+
+$(echo -e "${DEFINE_SUNRPC_XPRT_RDMA}")
+$(echo -e "${DEFINE_SUNRPC}")
+$(echo -e "${DEFINE_SUNRPC_GSS}")
+$(echo -e "${DEFINE_RPCSEC_GSS_KRB5}")
+$(echo -e "${DEFINE_RPCSEC_GSS_SPKM3}")
+$(echo -e "${DEFINE_NFS_FS}")
+$(echo -e "${DEFINE_NFS_V3}")
+$(echo -e "${DEFINE_NFS_V3_ACL}")
+$(echo -e "${DEFINE_NFS_V4}")
+$(echo -e "${DEFINE_NFS_ACL_SUPPORT}")
+$(echo -e "${DEFINE_NFS_DIRECTIO}")
+$(echo -e "${DEFINE_EXPORTFS}")
+$(echo -e "${DEFINE_LOCKD}")
+$(echo -e "${DEFINE_LOCKD_V4}")
+$(echo -e "${DEFINE_NFSD}")
+$(echo -e "${DEFINE_NFSD_V2_ACL}")
+$(echo -e "${DEFINE_NFSD_V3}")
+$(echo -e "${DEFINE_NFSD_V3_ACL}")
+$(echo -e "${DEFINE_NFSD_V4}")
+$(echo -e "${DEFINE_NFSD_RDMA}")
+
+$(echo -e "${DEFINE_INFINIBAND_IPOIB_DEBUG}")
+$(echo -e "${DEFINE_INFINIBAND_ISER}")
+$(echo -e "${DEFINE_SCSI_ISCSI_ATTRS}")
+$(echo -e "${DEFINE_ISCSI_TCP}")
+$(echo -e "${DEFINE_INFINIBAND_EHCA}")
+$(echo -e "${DEFINE_RDS}")
+$(echo -e "${DEFINE_RDS_RDMA}")
+$(echo -e "${DEFINE_RDS_TCP}")
+$(echo -e "${DEFINE_RDS_DEBUG}")
+$(echo -e "${DEFINE_INFINIBAND_QLGC_VNIC_STATS}")
+$(echo -e "${DEFINE_INFINIBAND_CXGB3_DEBUG}")
+$(echo -e "${DEFINE_INFINIBAND_NES_DEBUG}")
+
+$(echo -e "${DEFINE_MLX4_CORE}")
+$(echo -e "${DEFINE_MLX4_EN}")
+$(echo -e "${DEFINE_MLX4_INFINIBAND}")
+$(echo -e "${DEFINE_MLX4_ETHERNET}")
+$(echo -e "${DEFINE_MLX4_DEBUG}")
+
+$(echo -e "${DEFINE_INFINIBAND_IPOIB_DEBUG_DATA}")
+$(echo -e "${DEFINE_INFINIBAND_SDP_SEND_ZCOPY}")
+$(echo -e "${DEFINE_INFINIBAND_SDP_RECV_ZCOPY}")
+$(echo -e "${DEFINE_INFINIBAND_SDP_DEBUG}")
+$(echo -e "${DEFINE_INFINIBAND_SDP_DEBUG_DATA}")
+$(echo -e "${DEFINE_INFINIBAND_IPATH}")
+$(echo -e "${DEFINE_INFINIBAND_QIB}")
+$(echo -e "${DEFINE_INFINIBAND_MTHCA_DEBUG}")
+$(echo -e "${DEFINE_INFINIBAND_MADEYE}")
+$(echo -e "${DEFINE_INFINIBAND_AMSO1100}")
+#endif
+
+EOFAUTOCONF
+
+ echo "Created ${AUTOCONF_H}:"
+ cat ${AUTOCONF_H}
+}
+
+main $@
--- /dev/null
+#!/bin/bash
+
+#
+# Copyright (c) 2006 Mellanox Technologies. All rights reserved.
+#
+# This Software is licensed under one of the following licenses:
+#
+# 1) under the terms of the "Common Public License 1.0" a copy of which is
+# available from the Open Source Initiative, see
+# http://www.opensource.org/licenses/cpl.php.
+#
+# 2) under the terms of the "The BSD License" a copy of which is
+# available from the Open Source Initiative, see
+# http://www.opensource.org/licenses/bsd-license.php.
+#
+# 3) under the terms of the "GNU General Public License (GPL) Version 2" a
+# copy of which is available from the Open Source Initiative, see
+# http://www.opensource.org/licenses/gpl-license.php.
+#
+# Licensee has the right to choose one of the above licenses.
+#
+# Redistributions of source code must retain the above copyright
+# notice and one of the license notices.
+#
+# Redistributions in binary form must reproduce both the above copyright
+# notice, one of the license notices in the documentation
+# and/or other materials provided with the distribution.
+#
+#
+
+port_types=( "" "ib" "eth" "auto" )
+
+usage()
+{
+echo "Usage:"
+echo "/sbin/connectx_port_config"
+echo "/sbin/connectx_port_config -s|--show"
+echo "/sbin/connectx_port_config -h|--help"
+echo "/sbin/connectx_port_config [-d|--device <PCI device id>] -c|--conf <port1,port2>"
+echo "Possible port configurations:"
+echo " eth,eth"
+echo " ib,ib"
+echo " ib,eth"
+echo " ib,auto"
+echo " auto,auto"
+echo " auto,eth"
+}
+
+is_integer()
+
+{
+ printf "%s\n" $1 |grep -E "^[+-]?[0-9]+$" > /dev/null
+ return $?
+}
+
+
+
+# If module $1 is loaded return - 0 else - 1
+is_module()
+{
+local RC
+
+ /sbin/lsmod | grep -w "$1" > /dev/null 2>&1
+ RC=$?
+
+return $RC
+}
+
+# Select PCI device interactively
+select_device()
+{
+printf "Please select device to modify [$dev]: "
+read dev;
+
+if is_integer $dev; then
+ if [ $dev -lt 1 ]; then
+ echo "Illegal index selected, quitting..."; echo
+ exit 1;
+ fi
+
+ if [ -e ${Devices[$dev]}/mlx4_port1 ]; then
+ echo "`echo ${Devices[$dev]} | cut -d '/' -f 6`"; echo
+ else
+ echo "Illegal value selected, quitting..."; echo
+ exit 1
+ fi
+else
+ echo "Numeric value expected, quitting..."; echo
+ exit 1
+fi
+}
+
+set_device()
+{
+ser=0;
+for d in ${Devices[@]}
+do
+ ser=$(($ser+1))
+ if [ "/sys/bus/pci/devices/${udevice}/" == "$d" ] || [ "/sys/bus/pci/devices/0000:${udevice}/" == "${d}" ] ; then
+ dev=$ser
+ return
+ fi
+done
+}
+
+validate_device()
+{
+if [ "$udevice" = "0" ]; then
+ if [ "$comm" != "" ]; then
+ if [ ${#Devices[@]} -gt 1 ]; then
+ echo "More then 1 ConnectX devices found, please specify required device"; echo
+ usage
+ exit 1
+ fi
+ fi
+ return
+fi
+for d in ${Devices[@]}
+do
+ ser=$(($ser+1))
+ if [ "/sys/bus/pci/devices/${udevice}/" == "$d" ] || [ "/sys/bus/pci/devices/0000:${udevice}/" == "${d}" ] ; then
+ return
+ fi
+done
+echo "Error: illegal device selected."
+exit 1;
+}
+
+validate_port_config()
+{
+for conf in "eth,eth" "auto,auto" "auto,eth" "ib,ib" "ib,auto" "ib,eth" "eth" "auto" "ib"; do
+ if [ "$conf" == "$comm" ]; then
+ return
+ fi
+done
+echo "Error: $comm is not valid port configuration"
+usage
+exit 1;
+}
+
+prompt_oprtions()
+{
+local port=$1
+local options=$2
+if [ "$port" == "2" ]; then
+ if [ -e ${Devices[$dev]}/mlx4_port2 ]; then
+ echo -n ""
+ else
+ return 0
+ fi
+fi
+printf "Select mode for port $port (${options}): "
+read mode
+if is_integer $mode; then
+ if [ $mode -lt 0 ]; then
+ echo "Illegal value selected, quitting..."; echo
+ exit 1
+ fi
+ if [ `echo ${options} | grep ${mode} -wc` == 0 ]; then
+ echo "Illegal value selected, quitting..."; echo
+ exit 1
+ fi
+ return "${mode}"
+else
+ echo "Illegal value selected, quitting..."; echo
+ exit 1
+fi
+}
+
+show_configuration()
+{
+local cnt=0
+for pci_dev in /sys/bus/pci/devices/*/
+do
+ if [ -e $pci_dev/mlx4_port1 ]; then
+ echo "--------------------------------"
+ dev=`echo $pci_dev | cut -d '/' -f 6`
+ echo "Port configuration for PCI device: $dev is:"
+ cat ${pci_dev}/mlx4_port1
+ if [ -e $pci_dev/mlx4_port2 ]; then
+ cat ${pci_dev}/mlx4_port2
+ fi
+ echo "--------------------------------"
+ cnt=$(($cnt+1))
+ fi
+done
+if [ $cnt == 0 ]; then
+ echo "No ConnectX devices found or driver not loaded"
+fi
+}
+
+save_config()
+{
+if [ -e /etc/infiniband/connectx.conf ]; then
+ perl -ni -e "print unless (/Configuration for $udevice/)" /etc/infiniband/connectx.conf > /dev/null 2>&1
+ perl -ni -e "print unless (/-d $udevice/)" /etc/infiniband/connectx.conf > /dev/null 2>&1
+ echo "# ConnectX Port Configuration for $udevice" >> /etc/infiniband/connectx.conf
+ echo "/sbin/connectx_port_config -d $udevice -c $comm" >> /etc/infiniband/connectx.conf
+fi
+}
+
+set_port_config()
+{
+echo "|----------------------------|"
+echo "| Possible port modes: |"
+echo "| 1: Infiniband |"
+echo "| 2: Ethernet |"
+echo "| 3: AutoSense |"
+echo "|----------------------------|"
+
+local options="1,2,3"
+prompt_oprtions 1 $options
+comm=${port_types[$?]}
+case "$comm" in
+ "eth")
+ comm="eth,eth"
+ return
+ ;;
+ "ib")
+ prompt_oprtions 2 $options
+ comm=${comm}","${port_types[$?]}
+ return
+ ;;
+ "auto")
+ options="2,3"
+ prompt_oprtions 2 $options
+ comm=${comm}","${port_types[$?]}
+ return
+ ;;
+esac
+}
+
+
+udevice=0
+comm=""
+###############################################################################
+# Parsing command line #
+###############################################################################
+while [ ! -z "$1" ]; do
+ case "$1" in
+ -s|--show)
+ show_configuration
+ if [ -n "$2" ]; then
+ echo "Too many parameters"
+ usage
+ exit 1
+ fi
+ exit 0
+ ;;
+ -d|--device)
+ if [ -z "$2" ]; then
+ echo "Error: Illegal input"
+ usage
+ exit 1
+ fi
+ udevice=$2
+ shift 2
+ ;;
+ -c|--conf)
+ if [ -z "$2" ]; then
+ echo "Error: Illegal input"
+ usage
+ exit 1
+ fi
+ comm=$2
+ shift 2;
+ validate_port_config
+ ;;
+ -h|--help)
+ usage
+ exit 0
+ ;;
+ *)
+ echo "Wrong parameter error: $1"
+ usage
+ exit 1
+ ;;
+ esac
+done
+
+#############################################################
+# Load low level driver if not loaded #
+#############################################################
+is_module mlx4_core
+RC=$?
+if [ $RC == 1 ]; then
+ echo "Bus driver not loaded, loading..."
+ /sbin/modprobe mlx4_core
+fi
+
+#############################################################
+# List ConnectX devices #
+#############################################################
+i=0
+echo; echo "ConnectX PCI devices :"
+echo "|----------------------------|"
+for pci_dev in /sys/bus/pci/devices/*/
+do
+ if [ -e $pci_dev/mlx4_port1 ]; then
+ i=`echo "$i + 1" | bc`
+ Devices[$i]=$pci_dev
+ dev=`echo $pci_dev | cut -d '/' -f 6`
+ echo "| $i $dev |"
+ fi
+done
+echo "|----------------------------|"; echo
+
+validate_device
+
+if [ $i == 0 ]; then
+ echo "No devices found, quiting..."
+ exit 1;
+fi
+
+#############################################################
+# Select device to modify #
+#############################################################
+dev=1
+if [ $i -ne 1 ]; then
+ if [ "$comm" != "" ]; then
+ if [ "$udevice" != "0" ]; then
+ set_device
+ fi
+ else
+ select_device
+ fi
+fi
+
+udevice=`echo ${Devices[$dev]} | cut -d '/' -f 6`
+
+echo "Before port change:"
+cat ${Devices[$dev]}/mlx4_port1
+if [ -e ${Devices[$dev]}/mlx4_port2 ]; then
+ cat ${Devices[$dev]}/mlx4_port2
+fi
+echo
+
+############################################################
+# Set port configuration for the selected device #
+############################################################
+if [ "$comm" == "" ]; then
+ set_port_config
+fi
+
+if [ -e ${Devices[$dev]}/mlx4_port2 ]; then
+echo "all" > ${Devices[$dev]}/port_trigger
+fi
+
+comm1=`echo ${comm} | cut -d ',' -f 1`
+comm2=`echo ${comm} | cut -d ',' -f 2`
+{
+echo "${comm1}" > ${Devices[$dev]}/mlx4_port1
+} > /dev/null 2>&1
+rc=$?
+ if [ -e ${Devices[$dev]}/mlx4_port2 ]; then
+ {
+ echo "${comm2}" > ${Devices[$dev]}/mlx4_port2
+ } > /dev/null 2>&1
+ rc=$?
+fi
+if [ $rc -ne 0 ]; then
+ echo "WARNING: Illegal port configuration attempted,"
+ echo " Please view dmesg for details."; echo
+ exit 1
+fi
+
+echo; echo "After port change:"
+cat ${Devices[$dev]}/mlx4_port1
+if [ -e ${Devices[$dev]}/mlx4_port2 ]; then
+ cat ${Devices[$dev]}/mlx4_port2
+fi
+
+save_config
+
+exit 0
+
--- /dev/null
+#!/bin/bash
+#
+# Copyright (c) 2006 Mellanox Technologies. All rights reserved.
+# Copyright (c) 2004, 2005, 2006 Voltaire, Inc. All rights reserved.
+#
+# This Software is licensed under one of the following licenses:
+#
+# 1) under the terms of the "Common Public License 1.0" a copy of which is
+# available from the Open Source Initiative, see
+# http://www.opensource.org/licenses/cpl.php.
+#
+# 2) under the terms of the "The BSD License" a copy of which is
+# available from the Open Source Initiative, see
+# http://www.opensource.org/licenses/bsd-license.php.
+#
+# 3) under the terms of the "GNU General Public License (GPL) Version 2" a
+# copy of which is available from the Open Source Initiative, see
+# http://www.opensource.org/licenses/gpl-license.php.
+#
+# Licensee has the right to choose one of the above licenses.
+#
+# Redistributions of source code must retain the above copyright
+# notice and one of the license notices.
+#
+# Redistributions in binary form must reproduce both the above copyright
+# notice, one of the license notices in the documentation
+# and/or other materials provided with the distribution.
+#
+# Description: creates Module.symvers file for InfiniBand modules
+
+KVERSION=${KVERSION:-$(uname -r)}
+MOD_SYMVERS=./Module.symvers
+SYMS=/tmp/syms
+
+echo MODULES_DIR=${MODULES_DIR-:./}
+
+if [ -f ${MOD_SYMVERS} -a ! -f ${MOD_SYMVERS}.save ]; then
+ mv ${MOD_SYMVERS} ${MOD_SYMVERS}.save
+fi
+rm -f $MOD_SYMVERS
+rm -f $SYMS
+
+for mod in $(find ${MODULES_DIR} -name '*.ko') ; do
+ nm -o $mod |grep __crc >> $SYMS
+ n_mods=$((n_mods+1))
+done
+
+n_syms=$(wc -l $SYMS |cut -f1 -d" ")
+echo Found $n_syms OFED kernel symbols in $n_mods modules
+n=1
+
+while [ $n -le $n_syms ] ; do
+ line=$(head -$n $SYMS|tail -1)
+
+ line1=$(echo $line|cut -f1 -d:)
+ line2=$(echo $line|cut -f2 -d:)
+ file=$(echo $line1| sed -e 's@./@@' -e 's@.ko@@' -e "s@$PWD/@@")
+ crc=$(echo $line2|cut -f1 -d" ")
+ sym=$(echo $line2|cut -f3 -d" ")
+ echo -e "0x$crc\t$sym\t$file" >> $MOD_SYMVERS
+ n=$((n+1))
+done
+
+echo ${MOD_SYMVERS} created.
--- /dev/null
+#!/bin/bash
+#
+# Copyright (c) 2006 Mellanox Technologies. All rights reserved.
+#
+# This Software is licensed under one of the following licenses:
+#
+# 1) under the terms of the "Common Public License 1.0" a copy of which is
+# available from the Open Source Initiative, see
+# http://www.opensource.org/licenses/cpl.php.
+#
+# 2) under the terms of the "The BSD License" a copy of which is
+# available from the Open Source Initiative, see
+# http://www.opensource.org/licenses/bsd-license.php.
+#
+# 3) under the terms of the "GNU General Public License (GPL) Version 2" a
+# copy of which is available from the Open Source Initiative, see
+# http://www.opensource.org/licenses/gpl-license.php.
+#
+# Licensee has the right to choose one of the above licenses.
+#
+# Redistributions of source code must retain the above copyright
+# notice and one of the license notices.
+#
+# Redistributions in binary form must reproduce both the above copyright
+# notice, one of the license notices in the documentation
+# and/or other materials provided with the distribution.
+
+get_backport_dir()
+{
+ case $1 in
+ 2.6.9-42*)
+ echo 2.6.9_U4
+ ;;
+ 2.6.9-55*)
+ echo 2.6.9_U5
+ ;;
+ 2.6.9-67*)
+ echo 2.6.9_U6
+ ;;
+ 2.6.9-78*)
+ echo 2.6.9_U7
+ ;;
+ 2.6.9-89*)
+ echo 2.6.9_U8
+ ;;
+ 2.6.16.*-*-*)
+ minor=$(echo $KVERSION | cut -d"." -f4 | cut -d"-" -f1)
+ if [ $minor -lt 37 ]; then
+ echo 2.6.16_sles10
+ elif [ $minor -lt 60 ]; then
+ echo 2.6.16_sles10_sp1
+ else
+ subminor=$(echo $KVERSION | cut -d "-" -f 2 | cut -d"." -f2)
+ if [ $subminor -lt 49 ]; then
+ echo 2.6.16_sles10_sp2
+ elif [ $subminor -lt 60 ]; then
+ echo 2.6.16_sles10_sp3
+ else
+ echo 2.6.16_sles10_sp4
+ fi
+ fi
+ ;;
+ 2.6.16-*-*) # for SLES10 SP1 lustre ( 2.6.16-54-0.2.5_lustre.1.6.4.3-smp )
+ minor=$(echo $KVERSION | cut -d"." -f3 | cut -d"-" -f2)
+ if [ $minor -lt 60 ]; then
+ echo 2.6.16_sles10_sp1
+ else
+ echo 2.6.16_sles10_sp2
+ fi
+ ;;
+ 2.6.16*)
+ echo 2.6.16
+ ;;
+ 2.6.17*)
+ echo 2.6.17
+ ;;
+ 2.6.18.8-xen*)
+ echo 2.6.18.8-xen
+ ;;
+ 2.6.18*-*chaos)
+ echo 2.6.18-chaos
+ ;;
+ 2.6.18-*.el5*)
+ minor=$(echo $KVERSION | cut -d"." -f3 | cut -d"-" -f2)
+ if [ $minor -lt 50 ]; then
+ echo 2.6.18_FC6
+ elif [ $minor -lt 84 ]; then
+ echo 2.6.18-EL5.1
+ elif [ $minor -lt 128 ]; then
+ echo 2.6.18-EL5.2
+ elif [ $minor -lt 155 ]; then
+ echo 2.6.18-EL5.3
+ elif [ $minor -lt 186 ]; then
+ echo 2.6.18-EL5.4
+ elif [ $minor -lt 229 ]; then
+ echo 2.6.18-EL5.5
+ elif [ $minor -lt 259 ]; then
+ echo 2.6.18-EL5.6
+ else
+ echo 2.6.18-EL5.7
+ fi
+ ;;
+ 2.6.18-*fc[56]*)
+ echo 2.6.18_FC6
+ ;;
+ 2.6.18.*-*-*)
+ middle=$(echo $KVERSION | cut -d"-" -f2)
+ if [ $middle -lt 34 ]; then
+ echo 2.6.18
+ else
+ echo 2.6.18_suse10_2
+ fi
+ ;;
+ 2.6.18*)
+ echo 2.6.18
+ ;;
+ 2.6.19*)
+ echo 2.6.19
+ ;;
+ 2.6.20*)
+ echo 2.6.20
+ ;;
+ 2.6.21*)
+ echo 2.6.21
+ ;;
+ 2.6.22.*-*-rt)
+ echo 2.6.22_slert10_sp2
+ ;;
+ 2.6.22.*-*-*)
+ echo 2.6.22_suse10_3
+ ;;
+ 2.6.22*)
+ echo 2.6.22
+ ;;
+ 2.6.23*)
+ echo 2.6.23
+ ;;
+ 2.6.24.7-*)
+ echo 2.6.24-rt
+ ;;
+ 2.6.24*)
+ echo 2.6.24
+ ;;
+ 2.6.25.*-*-*)
+ echo 2.6.25_suse11
+ ;;
+ 2.6.25*)
+ echo 2.6.25
+ ;;
+ 2.6.26*)
+ echo 2.6.26
+ ;;
+ 2.6.27.*-*)
+ minor=$(echo $KVERSION | cut -d "." -f 4 | cut -d "-" -f 1)
+ if [ $minor -lt 25 ]; then
+ echo 2.6.27_sles11
+ else
+ echo 2.6.27_sles11_update
+ fi
+ ;;
+ 2.6.27*)
+ echo 2.6.27
+ ;;
+ 2.6.28*)
+ echo 2.6.28
+ ;;
+ 2.6.29*)
+ echo 2.6.29
+ ;;
+ 2.6.30*)
+ echo 2.6.30
+ ;;
+ 2.6.31*)
+ echo 2.6.31
+ ;;
+ 2.6.32*xen*)
+ echo 2.6.32-xen
+ ;;
+ 2.6.32*el6* | 2.6.32*chaos*)
+ minor=$(echo $KVERSION | cut -d "." -f 3 | cut -d "-" -f 2)
+ # RHEL6.0 (minor=131) and RHEL6.1 backports are the same
+ if [ $minor -lt 202 ]; then
+ echo 2.6.32-EL6
+ else
+ echo 2.6.32-EL6.2
+ fi
+ ;;
+ 2.6.32*)
+ echo 2.6.32
+ ;;
+ 2.6.33*)
+ echo 2.6.33
+ ;;
+ 2.6.34*)
+ echo 2.6.34
+ ;;
+ 2.6.35*)
+ echo 2.6.35
+ ;;
+ 2.6.36*)
+ echo 2.6.36
+ ;;
+ 2.6.37*)
+ echo 2.6.37
+ ;;
+ 2.6.38*)
+ echo 2.6.38
+ ;;
+ 2.6.39*)
+ echo 2.6.39
+ ;;
+ 3.0* | 2.6.40*)
+ echo 3.0
+ ;;
+ 3.1* | 2.6.41*)
+ echo 3.1
+ ;;
+ *)
+ echo
+ ;;
+ esac
+
+}
+
+if [ -z "$1" ]; then
+ KVERSION=$(uname -r)
+else
+ KVERSION=$1
+fi
+
+get_backport_dir ${KVERSION}
--- /dev/null
+# install ib_ipoib modprobe --ignore-install ib_ipoib && /sbin/ib_ipoib_sysctl load
+# remove ib_ipoib /sbin/ib_ipoib_sysctl unload ; modprobe -r --ignore-remove ib_ipoib
--- /dev/null
+alias net-pf-27 ib_sdp
+alias net-pf-28 ib_sdp
--- /dev/null
+#! /bin/bash
+
+usage()
+{
+ echo "$(basename $0) <options>"
+ echo "-h, --help print help message"
+ echo "-v, --verbose print more info"
+}
+
+case $1 in
+ "-h" | "--help")
+ usage
+ exit 0
+ ;;
+esac
+
+if (( $# > 1 )); then
+ usage
+ exit -1
+fi
+
+if (( $# == 1 )) && [ "$1" != "-v" ]; then
+ usage
+ exit -1
+fi
+
+ibdevs=$(ls /sys/class/infiniband/)
+
+devs=$(ls /sys/class/net/ | grep ^[ei])
+if [ "x$devs" == "x" ]; then
+ # no relevant devices - quit immediately
+ exit
+fi
+
+for d in $devs; do
+ if [ -f /sys/class/net/$d/dev_id ]; then
+ oldstyle=n
+ break
+ fi
+done
+
+if [ "x$oldstyle" == "xn" ]; then
+ for d in $ibdevs; do
+ ibrsc=$(cat /sys/class/infiniband/$d/device/resource)
+ eths=$(ls /sys/class/net/)
+ for eth in $eths; do
+ if [ -f /sys/class/net/$eth/device/resource ]; then
+ ethrsc=$(cat /sys/class/net/$eth/device/resource)
+ if [ "x$ethrsc" == "x$ibrsc" ]; then
+ if [ -f /sys/class/net/$eth/dev_id ]; then
+ port=$(cat /sys/class/net/$eth/dev_id)
+ port=$(printf "%d" $port)
+ port=$(( port + 1 ))
+ if [ "$1" == "-v" ]; then
+ ibstate=$(printf "%-6s" $(cat /sys/class/infiniband/$d/ports/$port/state | gawk '{print $2}'))
+ devid=$(printf "MT%d" $(cat /sys/class/infiniband/$d/device/device))
+ fwver=$(cat /sys/class/infiniband/$d/fw_ver)
+ tmp=$IFS
+ IFS=":"
+ devdesc=$(printf "%-15s" $(strings /sys/class/infiniband/$d/device/vpd | head -1))
+ partid=$(printf "%-11s" $(strings /sys/class/infiniband/$d/device/vpd | head -4 | tail -1 | gawk '{print $1}'))
+ IFS=$tmp
+ fi
+ if [ -f /sys/class/net/$eth/carrier ]; then
+ link_state=$(cat /sys/class/net/$eth/carrier 2> /dev/null)
+ if (( link_state == 1 )); then
+ link_state="Up"
+ else
+ link_state="Down"
+ fi
+ else
+ link_state="NA"
+ fi
+ if [ "$1" == "-v" ]; then
+ echo "$d ($devid - $partid) $devdesc fw $fwver port $port ($ibstate) ==> $eth ($link_state)"
+ else
+ echo "$d port $port ==> $eth ($link_state)"
+ fi
+ fi
+ fi
+ fi
+ done
+ done
+else
+##########################
+### old style
+##########################
+
+function print_line()
+{
+ echo "$1 port $2 <===> $3"
+}
+
+function find_guid()
+{
+ ibdevs=$(ls /sys/class/infiniband/)
+ for ibdev in $ibdevs; do
+ ports=$(ls /sys/class/infiniband/$ibdev/ports/)
+ for port in $ports; do
+ gids=$(ls /sys/class/infiniband/$ibdev/ports/$port/gids)
+ for gid in $gids; do
+ pguid=$(cat /sys/class/infiniband/$ibdev/ports/$port/gids/$gid | cut -b 21- | sed -e 's/://g')
+ if [ x$pguid == x$1 ]; then
+ print_line $ibdev $port $2
+ fi
+ done
+ done
+ done
+}
+
+function find_mac()
+{
+ ibdevs=$(ls /sys/class/infiniband/)
+ for ibdev in $ibdevs; do
+ ports=$(ls /sys/class/infiniband/$ibdev/ports/)
+ for port in $ports; do
+ gids=$(ls /sys/class/infiniband/$ibdev/ports/$port/gids)
+ for gid in $gids; do
+ first=$(cat /sys/class/infiniband/$ibdev/ports/$port/gids/$gid | cut -b 21-22)
+ first=$(( first ^ 2 ))
+ first=$(printf "%02x" $first)
+ second=$(cat /sys/class/infiniband/$ibdev/ports/$port/gids/$gid | cut -b 21- | sed -e 's/://g' | cut -b 3-6)
+ third=$(cat /sys/class/infiniband/$ibdev/ports/$port/gids/$gid | cut -b 21- | sed -e 's/://g' | cut -b 11-)
+ pmac=$first$second$third
+ if [ x$pmac == x$1 ]; then
+ print_line $ibdev $port $2
+ fi
+ done
+ done
+ done
+}
+
+ifcs=$(ifconfig -a | egrep '^eth|^ib' | gawk '{print $1}')
+
+for ifc in $ifcs; do
+ len=$(cat /sys/class/net/$ifc/addr_len)
+ if (( len == 20 )); then
+ guid=$(cat /sys/class/net/$ifc/address | cut -b 37- | sed -e 's/://g')
+ find_guid $guid $ifc
+ elif (( len == 6)); then
+ mac=$(cat /sys/class/net/$ifc/address | sed -e 's/://g')
+ find_mac $mac $ifc
+ fi
+done
+fi
+
--- /dev/null
+# Makefile based on the kernel's drivers/scsi/Makefile
+# to build open-iscsi.
+obj-$(CONFIG_SCSI_ISCSI_ATTRS) += scsi_transport_iscsi.o
+obj-$(CONFIG_ISCSI_TCP) += libiscsi.o iscsi_tcp.o
--- /dev/null
+# $Id: Makefile 9120 2006-08-28 13:01:07Z vlad $
+
+PHONY += all kernel install_kernel install clean clean_kernel
+
+all:
+.PHONY: $(PHONY)
+
+.DELETE_ON_ERROR:
+
+include ./configure.mk.kernel
+include ./config.mk
+
+DEPMOD = /sbin/depmod
+INSTALL_MOD_DIR ?= updates
+
+ifeq ($(CONFIG_MEMTRACK),m)
+ export KERNEL_MEMTRACK_CFLAGS = -include $(CWD)/drivers/infiniband/debug/mtrack.h
+else
+ export KERNEL_MEMTRACK_CFLAGS =
+endif
+
+export OPEN_ISCSI_MODULES = iscsi_tcp.ko libiscsi.ko scsi_transport_iscsi.ko
+
+configure.mk.kernel:
+ @echo Please run ./configure
+ @exit 1
+
+all: kernel
+
+install: install_kernel
+install_kernel: install_modules
+
+autoconf_h=$(shell /bin/ls -1 $(KSRC)/include/*/autoconf.h | head -1)
+
+V ?= 1
+
+#########################
+# make kernel #
+#########################
+#NB: The LINUXINCLUDE value comes from main kernel Makefile
+# with local directories prepended. This eventually affects
+# CPPFLAGS in the kernel Makefile
+kernel:
+ @echo "Building kernel modules"
+ @echo "Kernel version: $(KVERSION)"
+ @echo "Modules directory: $(INSTALL_MOD_PATH)/$(MODULES_DIR)"
+ @echo "Kernel sources: $(KSRC)"
+ env CWD=$(CWD) BACKPORT_INCLUDES=$(BACKPORT_INCLUDES) \
+ $(MAKE) -C $(KSRC) SUBDIRS="$(CWD)" \
+ V=$(V) $(WITH_MAKE_PARAMS) \
+ CONFIG_MEMTRACK=$(CONFIG_MEMTRACK) \
+ CONFIG_DEBUG_INFO=$(CONFIG_DEBUG_INFO) \
+ CONFIG_INFINIBAND=$(CONFIG_INFINIBAND) \
+ CONFIG_INFINIBAND_IPOIB=$(CONFIG_INFINIBAND_IPOIB) \
+ CONFIG_INFINIBAND_IPOIB_CM=$(CONFIG_INFINIBAND_IPOIB_CM) \
+ CONFIG_INFINIBAND_SDP=$(CONFIG_INFINIBAND_SDP) \
+ CONFIG_INFINIBAND_SRP=$(CONFIG_INFINIBAND_SRP) \
+ CONFIG_INFINIBAND_SRPT=$(CONFIG_INFINIBAND_SRPT) \
+ CONFIG_INFINIBAND_USER_MAD=$(CONFIG_INFINIBAND_USER_MAD) \
+ CONFIG_INFINIBAND_USER_ACCESS=$(CONFIG_INFINIBAND_USER_ACCESS) \
+ CONFIG_INFINIBAND_USER_MEM=$(CONFIG_INFINIBAND_USER_MEM) \
+ CONFIG_INFINIBAND_ADDR_TRANS=$(CONFIG_INFINIBAND_ADDR_TRANS) \
+ CONFIG_INFINIBAND_MTHCA=$(CONFIG_INFINIBAND_MTHCA) \
+ CONFIG_INFINIBAND_IPOIB_DEBUG=$(CONFIG_INFINIBAND_IPOIB_DEBUG) \
+ CONFIG_INFINIBAND_ISER=$(CONFIG_INFINIBAND_ISER) \
+ CONFIG_SCSI_ISCSI_ATTRS=$(CONFIG_SCSI_ISCSI_ATTRS) \
+ CONFIG_ISCSI_TCP=$(CONFIG_ISCSI_TCP) \
+ CONFIG_INFINIBAND_EHCA=$(CONFIG_INFINIBAND_EHCA) \
+ CONFIG_INFINIBAND_EHCA_SCALING=$(CONFIG_INFINIBAND_EHCA_SCALING) \
+ CONFIG_RDS=$(CONFIG_RDS) \
+ CONFIG_RDS_RDMA=$(CONFIG_RDS_RDMA) \
+ CONFIG_RDS_TCP=$(CONFIG_RDS_TCP) \
+ CONFIG_RDS_DEBUG=$(CONFIG_RDS_DEBUG) \
+ CONFIG_INFINIBAND_IPOIB_DEBUG_DATA=$(CONFIG_INFINIBAND_IPOIB_DEBUG_DATA) \
+ CONFIG_INFINIBAND_SDP_SEND_ZCOPY=$(CONFIG_INFINIBAND_SDP_SEND_ZCOPY) \
+ CONFIG_INFINIBAND_SDP_RECV_ZCOPY=$(CONFIG_INFINIBAND_SDP_RECV_ZCOPY) \
+ CONFIG_INFINIBAND_SDP_DEBUG=$(CONFIG_INFINIBAND_SDP_DEBUG) \
+ CONFIG_INFINIBAND_SDP_DEBUG_DATA=$(CONFIG_INFINIBAND_SDP_DEBUG_DATA) \
+ CONFIG_INFINIBAND_IPATH=$(CONFIG_INFINIBAND_IPATH) \
+ CONFIG_INFINIBAND_QIB=$(CONFIG_INFINIBAND_QIB) \
+ CONFIG_INFINIBAND_MTHCA_DEBUG=$(CONFIG_INFINIBAND_MTHCA_DEBUG) \
+ CONFIG_INFINIBAND_MADEYE=$(CONFIG_INFINIBAND_MADEYE) \
+ CONFIG_INFINIBAND_QLGC_VNIC=$(CONFIG_INFINIBAND_QLGC_VNIC) \
+ CONFIG_INFINIBAND_QLGC_VNIC_DEBUG=$(CONFIG_INFINIBAND_QLGC_VNIC_DEBUG) \
+ CONFIG_INFINIBAND_QLGC_VNIC_STATS=$(CONFIG_INFINIBAND_QLGC_VNIC_STATS) \
+ CONFIG_CHELSIO_T3=$(CONFIG_CHELSIO_T3) \
+ CONFIG_INFINIBAND_CXGB3=$(CONFIG_INFINIBAND_CXGB3) \
+ CONFIG_INFINIBAND_CXGB3_DEBUG=$(CONFIG_INFINIBAND_CXGB3_DEBUG) \
+ CONFIG_CHELSIO_T4=$(CONFIG_CHELSIO_T4) \
+ CONFIG_INFINIBAND_CXGB4=$(CONFIG_INFINIBAND_CXGB4) \
+ CONFIG_INFINIBAND_NES=$(CONFIG_INFINIBAND_NES) \
+ CONFIG_INFINIBAND_NES_DEBUG=$(CONFIG_INFINIBAND_NES_DEBUG) \
+ CONFIG_MLX4_CORE=$(CONFIG_MLX4_CORE) \
+ CONFIG_MLX4_EN=$(CONFIG_MLX4_EN) \
+ CONFIG_MLX4_INFINIBAND=$(CONFIG_MLX4_INFINIBAND) \
+ CONFIG_MLX4_ETHERNET=$(CONFIG_MLX4_ETHERNET) \
+ CONFIG_MLX4_DEBUG=$(CONFIG_MLX4_DEBUG) \
+ CONFIG_INFINIBAND_AMSO1100=$(CONFIG_INFINIBAND_AMSO1100) \
+ CONFIG_SUNRPC_XPRT_RDMA=$(CONFIG_SUNRPC_XPRT_RDMA) \
+ CONFIG_NFSD_RDMA=$(CONFIG_NFSD_RDMA) \
+ LINUXINCLUDE=' \
+ -D__OFED_BUILD__ \
+ -include $(autoconf_h) \
+ -include $(CWD)/include/linux/autoconf.h \
+ $(BACKPORT_INCLUDES) \
+ $(KERNEL_MEMTRACK_CFLAGS) \
+ $(KERNEL_NFS_FS_CFLAGS) \
+ $(OPENIB_KERNEL_EXTRA_CFLAGS) \
+ -I$(CWD)/include \
+ -I$(CWD)/drivers/infiniband/debug \
+ -I/usr/local/include/scst \
+ -I$(CWD)/drivers/infiniband/ulp/srpt \
+ $$(if $$(CONFIG_XEN),-D__XEN_INTERFACE_VERSION__=$$(CONFIG_XEN_INTERFACE_VERSION)) \
+ $$(if $$(CONFIG_XEN),-I$$(srctree)/arch/x86/include/mach-xen) \
+ -I$$(srctree)/arch/$$(hdr-arch)/include \
+ -Iinclude \
+ $$(if $$(KBUILD_SRC),-Iinclude2 -I$$(srctree)/include) \
+ -I$$(srctree)/arch/$$(SRCARCH)/include \
+ ' \
+ modules
+
+
+#########################
+# Install kernel #
+#########################
+install_modules:
+ @echo "Installing kernel modules"
+
+ $(MAKE) -C $(KSRC) SUBDIRS="$(CWD)" \
+ INSTALL_MOD_PATH=$(INSTALL_MOD_PATH) \
+ INSTALL_MOD_DIR=$(INSTALL_MOD_DIR) \
+ $(WITH_MAKE_PARAMS) modules_install;
+ if [ ! -n "$(INSTALL_MOD_PATH)" ]; then $(DEPMOD) $(KVERSION);fi;
+
+clean: clean_kernel
+
+clean_kernel:
+ $(MAKE) -C $(KSRC) SUBDIRS="$(CWD)" $(WITH_MAKE_PARAMS) clean
+
+help:
+ @echo
+ @echo kernel: build kernel modules
+ @echo all: build kernel modules
+ @echo
+ @echo install_kernel: install kernel modules under $(INSTALL_MOD_PATH)/$(MODULES_DIR)
+ @echo install: run install_kernel
+ @echo
+ @echo clean: delete kernel modules binaries
+ @echo clean_kernel: delete kernel modules binaries
+ @echo
--- /dev/null
+#!/bin/bash
+
+#
+# Copyright (c) 2006 Mellanox Technologies. All rights reserved.
+#
+# This Software is licensed under one of the following licenses:
+#
+# 1) under the terms of the "Common Public License 1.0" a copy of which is
+# available from the Open Source Initiative, see
+# http://www.opensource.org/licenses/cpl.php.
+#
+# 2) under the terms of the "The BSD License" a copy of which is
+# available from the Open Source Initiative, see
+# http://www.opensource.org/licenses/bsd-license.php.
+#
+# 3) under the terms of the "GNU General Public License (GPL) Version 2" a
+# copy of which is available from the Open Source Initiative, see
+# http://www.opensource.org/licenses/gpl-license.php.
+#
+# Licensee has the right to choose one of the above licenses.
+#
+# Redistributions of source code must retain the above copyright
+# notice and one of the license notices.
+#
+# Redistributions in binary form must reproduce both the above copyright
+# notice, one of the license notices in the documentation
+# and/or other materials provided with the distribution.
+#
+#
+
+CONFIG="/etc/mlxethernet/mlxnet.conf"
+if [ ! -f $CONFIG ]; then
+ echo No Ethernet configuration found
+ exit 0
+fi
+
+. $CONFIG
+
+
+ACTION=$1
+shift
+
+# Check if OpenIB configured to start automatically
+if [ "X${ONBOOT}" != "Xyes" ]; then
+ exit 0
+fi
+
+# If module $1 has refcnt return 1 otherwise, return 0
+is_ref()
+{
+ local RC
+ cat /sys/module/"$1"/refcnt | grep -w 0 > /dev/null 2>&1
+ RC=$?
+ if [ "${RC}" -eq "1" ]; then
+ echo "$1" has references
+ RC=1
+ else
+ RC=0
+ fi
+ return $RC
+}
+
+# If module $1 is loaded return - 0 else - 1
+is_module()
+{
+local RC
+
+ /sbin/lsmod | grep -w "$1" > /dev/null 2>&1
+ RC=$?
+
+return $RC
+}
+
+set_irq_affinity()
+{
+# Set the Intterupts affinity in Rx side
+irqs="`cat /proc/interrupts | grep mlx4 | grep comp | cut -d':' -f1 `"
+cores="`cat /proc/cpuinfo | grep processor -wc`"
+
+EQ=-1
+core=-1
+for irq in $irqs; do
+ vec=`echo $irq | cut -d':' -f1`
+ EQ=$(($EQ+1))
+ core=$(($core+1))
+ if [ "$core" == "$cores" ]; then
+ core=0
+ fi
+ mask=`echo $core | awk '{printf("%x", lshift(1,$1))}'`
+ echo $mask > /proc/irq/$vec/smp_affinity
+ after_vec_hex=`cat /proc/irq/$vec/smp_affinity | tail -c3 | sed -e 's:^0[bBxX]::' | tr '[a-f]' '[A-F]'`
+ after_vec=`echo ""$after_vec_hex" 10 o p" | dc`
+ if [ "$mask" != "$after_vec" ]; then
+ set_affinity="Warn"
+ fi
+done
+}
+
+handle_irqdaemon()
+{
+for irqb in /etc/init.d/irq* ; do
+ break
+done
+if [ "$set_affinity" == "Warn" ]; then
+ #We could not change the intterupt manually
+ #lets hope that at least the irq daemon is runinng
+ if $irqb status 1 >/dev/null 2>&1; then
+ echo "Deamon running" > /dev/null
+ else
+ $irqb start 1 >/dev/null 2>&1
+ #lets check if it is running now
+ if $irqb status 1 >/dev/null 2>&1; then
+ echo "Deamon running" > /dev/null
+ else
+ logger "mlx4_core: irq balancer daemon not running and interrupt affinity can't be set."
+ fi
+ fi
+fi
+}
+
+start()
+{
+ local RC=0
+ local cnt=0
+ /sbin/modprobe mlx4_core > /dev/null 2>&1
+ my_rc=$?
+ if [ $my_rc -ne 0 ]; then
+ echo "Loading Mellanox mlx4_core HCA driver: [FAIL]"
+ exit 1
+ else
+ echo "Loading Mellanox mlx4_core HCA driver: [SUCCESS]"
+ fi
+
+ # Config the intterupt affinity
+ set_irq_affinity
+ # Check and turn on the irq balancer if needed
+ handle_irqdaemon
+
+ /sbin/modprobe mlx4_en > /dev/null 2>&1
+ my_rc=$?
+ if [ $my_rc -ne 0 ]; then
+ echo "Loading Mellanox mlx4_en driver: [FAIL]"
+ exit 1
+ else
+ echo "Loading Mellanox mlx4_en driver: [SUCCESS]"
+ sleep 2
+ for eth_dev in /sys/class/net/eth*/device/vendor
+ do
+ if [ `cat $eth_dev` == "0x15b3" ]; then
+ cnt=1
+ fi
+ done
+ if [ $cnt == 0 ]; then
+ echo "WARNING: No Ethernet interfaces found, please check configuration"
+ fi
+ fi
+
+ if [ -x ${LOAD_INTF} ]; then
+ $LOAD_INTF
+ fi
+}
+
+stop()
+{
+ local RC
+ echo "Unloading Mellanox mlx4_en driver"
+ if is_module mlx4_en; then
+ /sbin/rmmod mlx4_en > /dev/null 2>&1
+ RC=$?
+ if [ "$RC" -ne "0" ]; then
+ echo Could not unload Ethernet driver
+ exit 1
+ fi
+ else
+ echo Ethernet driver is not loaded
+ fi
+ if is_module mlx4_core; then
+ is_ref mlx4_core
+ RC=$?
+ if [ "$RC" -ne "1" ]; then
+ /sbin/rmmod mlx4_core > /dev/null 2>&1
+ fi
+ else
+ echo Core driver is not loaded
+ fi
+}
+
+case $ACTION in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ stop
+ start
+ ;;
+ *)
+ echo
+ echo "Usage: `basename $0` {start|stop|restart}"
+ echo
+ exit 1
+ ;;
+esac
+
+RC=$?
+exit $RC
+
+
+
--- /dev/null
+# Start HCA Eth driver upon boot
+ONBOOT=yes
+
--- /dev/null
+#
+# Copyright (c) 2012 Mellanox Technologies. All rights reserved.
+#
+# This Software is licensed under one of the following licenses:
+#
+# 1) under the terms of the "Common Public License 1.0" a copy of which is
+# available from the Open Source Initiative, see
+# http://www.opensource.org/licenses/cpl.php.
+#
+# 2) under the terms of the "The BSD License" a copy of which is
+# available from the Open Source Initiative, see
+# http://www.opensource.org/licenses/bsd-license.php.
+#
+# 3) under the terms of the "GNU General Public License (GPL) Version 2" a
+# copy of which is available from the Open Source Initiative, see
+# http://www.opensource.org/licenses/gpl-license.php.
+#
+# Licensee has the right to choose one of the above licenses.
+#
+# Redistributions of source code must retain the above copyright
+# notice and one of the license notices.
+#
+# Redistributions in binary form must reproduce both the above copyright
+# notice, one of the license notices in the documentation
+# and/or other materials provided with the distribution.
+#
+#
+
+%{!?configure_options: %define configure_options %{nil}}
+
+# %{!?MEMTRACK: %define MEMTRACK 0}
+%define MEMTRACK %(if ( echo %{configure_options} | grep "with-memtrack" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define MADEYE %(if ( echo %{configure_options} | grep "with-madeye-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+
+%{!?KVERSION: %define KVERSION %(uname -r)}
+%define krelver %(echo -n %{KVERSION} | sed -e 's/-/_/g')
+
+%{!?build_kernel_ib: %define build_kernel_ib 0}
+%{!?build_kernel_ib_devel: %define build_kernel_ib_devel 0}
+
+# Select packages to build
+%{!?modprobe_update: %define modprobe_update %(if ( echo %{configure_options} | grep "without-modprobe" > /dev/null ); then echo -n '0'; else echo -n '1'; fi)}
+
+# Kernel module packages to be included into kernel-ib
+%define build_mthca %(if ( echo %{configure_options} | grep "with-mthca-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define build_qib %(if ( echo %{configure_options} | grep "with-qib-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define build_ipath %(if ( echo %{configure_options} | grep "with-ipath_inf-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define build_ehca %(if ( echo %{configure_options} | grep "with-ehca-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define build_ipoib %(if ( echo %{configure_options} | grep "with-ipoib-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define build_sdp %(if ( echo %{configure_options} | grep "with-sdp-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define build_srp %(if ( echo %{configure_options} | grep "with-srp-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define build_srpt %(if ( echo %{configure_options} | grep "with-srp-target-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define build_iser %(if ( echo %{configure_options} | grep "with-iser-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define build_oiscsi %(if ( echo %{configure_options} | grep "with-iscsi-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define build_rds %(if ( echo %{configure_options} | grep "with-rds-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define build_cxgb3 %(if ( echo %{configure_options} | grep "with-cxgb3-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define build_cxgb4 %(if ( echo %{configure_options} | grep "with-cxgb4-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define build_nes %(if ( echo %{configure_options} | grep "with-nes-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define build_mlx4 %(if ( echo %{configure_options} | grep "with-mlx4-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define build_mlx4_en %(if ( echo %{configure_options} | grep "with-mlx4_en-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define build_qlgc_vnic %(if ( echo %{configure_options} | grep "with-qlgc_vnic-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+%define build_nfsrdma %(if ( echo %{configure_options} | grep "with-nfsrdma-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi)
+
+%{!?LIB_MOD_DIR: %define LIB_MOD_DIR /lib/modules/%{KVERSION}/updates}
+
+%{!?IB_CONF_DIR: %define IB_CONF_DIR /etc/infiniband}
+%{!?MLXNET_CONF_DIR: %define MLXNET_CONF_DIR /etc/mlxethernet}
+
+%{!?K_SRC: %define K_SRC /lib/modules/%{KVERSION}/build}
+
+%{!?KERNEL_SOURCES: %define KERNEL_SOURCES /lib/modules/%{KVERSION}/source}
+
+# Do not include srp.h if it exist in the kernel
+%define include_srp_h %(if [ -e %{KERNEL_SOURCES}/include/scsi/srp.h ]; then echo -n 0; else echo -n 1; fi )
+%define include_rdma %(if [ -d %{KERNEL_SOURCES}/include/rdma ]; then echo -n 1; else echo -n 0; fi )
+
+%define include_udev_rules %(eval `grep udev_rules /etc/udev/udev.conf | grep -v '^#'` ; if test -d $udev_rules; then echo -n 1; else echo -n 0; fi)
+
+# Disable debugging
+%define debug_package %{nil}
+%define __check_files %{nil}
+
+# Disable brp-lib64-linux
+%ifarch x86_64 ia64
+%define __arch_install_post %{nil}
+%endif
+
+%{!?_name: %define _name ofa_kernel}
+%{!?_version: %define _version @VERSION@}
+%{!?_release: %define _release @RELEASE@}
+
+Summary: Infiniband HCA Driver
+Name: %{_name}
+Version: %{_version}
+Release: %{_release}
+License: GPL/BSD
+Url: http://openib.org/
+Group: System Environment/Base
+Source: %{_name}-%{_version}.tgz
+BuildRoot: %{?build_root:%{build_root}}%{!?build_root:/var/tmp/OFED}
+Vendor: OpenFabrics
+%description
+InfiniBand "verbs", Access Layer and ULPs
+
+BuildRequires: sysfsutils-devel
+
+%package -n kernel-ib
+Requires: coreutils
+Requires: kernel
+Requires: pciutils
+Requires: grep
+Requires: perl
+Requires: procps
+Requires: module-init-tools
+Version: %{_version}
+Release: %{krelver}
+Summary: Infiniband Driver and ULPs kernel modules
+Group: System Environment/Libraries
+%description -n kernel-ib
+Core, HW and ULPs kernel modules
+
+%package -n kernel-ib-devel
+Requires: coreutils
+Requires: kernel
+Requires: pciutils
+Requires: kernel-ib
+Version: %{_version}
+Release: %{krelver}
+Summary: Infiniband Driver and ULPs kernel modules sources
+Group: System Environment/Libraries
+%description -n kernel-ib-devel
+Core, HW and ULPs kernel modules sources
+
+#################################################################################################################################
+
+%prep
+%setup -n %{_name}-%{_version}
+
+###
+### build
+###
+%build
+rm -rf $RPM_BUILD_ROOT
+cd $RPM_BUILD_DIR/%{_name}-%{_version}
+
+%if %{build_kernel_ib_devel}
+# Save clean sources for kernel-ib-devel
+mkdir -p $RPM_BUILD_DIR/src
+cp -a $RPM_BUILD_DIR/%{_name}-%{_version} $RPM_BUILD_DIR/src/
+%endif
+
+./configure --prefix=%{_prefix} --kernel-version %{KVERSION} --kernel-sources %{K_SRC} --modules-dir %{LIB_MOD_DIR} %{configure_options}
+
+%if %{build_kernel_ib_devel}
+# Copy InfniBand include files after applying backport patches (if required)
+mkdir -p $RPM_BUILD_DIR/src/%{_name}
+cp -a $RPM_BUILD_DIR/%{_name}-%{_version}/include/ $RPM_BUILD_DIR/src/%{_name}
+cp -a $RPM_BUILD_DIR/%{_name}-%{_version}/kernel_addons/ $RPM_BUILD_DIR/src/%{_name}
+cp -a $RPM_BUILD_DIR/%{_name}-%{_version}/configure.mk.kernel $RPM_BUILD_DIR/src/%{_name}
+cp -a $RPM_BUILD_DIR/%{_name}-%{_version}/config.mk $RPM_BUILD_DIR/src/%{_name}
+sed -i -e "s@\${CWD}@%{_prefix}/src/%{_name}@g" $RPM_BUILD_DIR/src/%{_name}/config.mk
+%endif
+
+%if %{build_kernel_ib}
+%if %{build_srpt}
+if [ -f /usr/local/include/scst/Module.symvers ]; then
+ cat /usr/local/include/scst/Module.symvers >> ./Module.symvers
+fi
+%endif
+export INSTALL_MOD_DIR=updates
+make kernel
+%endif
+
+###
+### install
+###
+%install
+%if %{build_kernel_ib_devel}
+mkdir -p $RPM_BUILD_ROOT/%{_prefix}/src
+cp -a $RPM_BUILD_DIR/src/%{_name}-%{_version} $RPM_BUILD_ROOT/%{_prefix}/src
+cp -a $RPM_BUILD_DIR/src/%{_name} $RPM_BUILD_ROOT/%{_prefix}/src
+rm -rf $RPM_BUILD_DIR/src
+
+# Support external modules include dir for backward compatibility
+cd $RPM_BUILD_ROOT/%{_prefix}/src/
+ln -s %{_name} openib
+cd -
+%endif
+
+%if %{build_kernel_ib}
+make install_kernel MODULES_DIR=%{LIB_MOD_DIR} INSTALL_MOD_PATH=$RPM_BUILD_ROOT INSTALL_MOD_DIR=updates KERNELRELEASE=%{KVERSION}
+%endif
+
+%if %{build_kernel_ib_devel}
+modsyms=`find $RPM_BUILD_DIR/%{_name}-%{_version} -name Module.symvers -o -name Modules.symvers`
+if [ -n "$modsyms" ]; then
+ for modsym in $modsyms
+ do
+ cat $modsym >> $RPM_BUILD_ROOT/%{_prefix}/src/%{_name}/Module.symvers
+ done
+else
+ ./ofed_scripts/create_Module.symvers.sh
+ cp ./Module.symvers $RPM_BUILD_ROOT/%{_prefix}/src/%{_name}/Module.symvers
+fi
+%endif
+
+INFO=${RPM_BUILD_ROOT}%{IB_CONF_DIR}/info
+/bin/rm -f ${INFO}
+mkdir -p ${RPM_BUILD_ROOT}%{IB_CONF_DIR}
+touch ${INFO}
+
+cat >> ${INFO} << EOFINFO
+#!/bin/bash
+
+echo prefix=%{_prefix}
+echo Kernel=%{KVERSION}
+echo
+echo "Configure options: %{configure_options}"
+echo
+EOFINFO
+
+chmod +x ${INFO} > /dev/null 2>&1
+
+# Copy infiniband configuration
+install -d $RPM_BUILD_ROOT/%{IB_CONF_DIR}
+install -m 0644 $RPM_BUILD_DIR/%{_name}-%{_version}/ofed_scripts/openib.conf $RPM_BUILD_ROOT/%{IB_CONF_DIR}
+
+# Install openib service script
+install -d $RPM_BUILD_ROOT/etc/init.d
+install -m 0755 $RPM_BUILD_DIR/%{_name}-%{_version}/ofed_scripts/openibd $RPM_BUILD_ROOT/etc/init.d
+install -d $RPM_BUILD_ROOT/sbin
+install -m 0755 $RPM_BUILD_DIR/%{_name}-%{_version}/ofed_scripts/sysctl_perf_tuning $RPM_BUILD_ROOT/sbin
+
+%if %{build_mlx4}
+install -d $RPM_BUILD_ROOT/%{_bindir}
+install -m 0755 $RPM_BUILD_DIR/%{_name}-%{_version}/ofed_scripts/ibdev2netdev $RPM_BUILD_ROOT/%{_bindir}
+%endif
+
+%if %{build_mlx4_en}
+install -d $RPM_BUILD_ROOT/sbin
+install -m 0755 $RPM_BUILD_DIR/%{_name}-%{_version}/ofed_scripts/connectx_port_config $RPM_BUILD_ROOT/sbin
+install -d $RPM_BUILD_ROOT/etc/modprobe.d
+install -m 0644 $RPM_BUILD_DIR/%{_name}-%{_version}/ofed_scripts/mlx4_en.conf $RPM_BUILD_ROOT/etc/modprobe.d
+touch $RPM_BUILD_ROOT/%{IB_CONF_DIR}/connectx.conf
+%endif
+
+%if %{build_qib}
+install -m 0644 $RPM_BUILD_DIR/%{_name}-%{_version}/ofed_scripts/truescale.cmds $RPM_BUILD_ROOT/%{IB_CONF_DIR}
+%endif
+
+%if %{build_ipoib}
+%if %{modprobe_update}
+install -d $RPM_BUILD_ROOT/etc/modprobe.d
+install -m 0644 $RPM_BUILD_DIR/%{_name}-%{_version}/ofed_scripts/ib_ipoib.conf $RPM_BUILD_ROOT/etc/modprobe.d
+%endif
+%endif
+
+%if %{build_sdp}
+%if %{modprobe_update}
+install -d $RPM_BUILD_ROOT/etc/modprobe.d
+install -m 0644 $RPM_BUILD_DIR/%{_name}-%{_version}/ofed_scripts/ib_sdp.conf $RPM_BUILD_ROOT/etc/modprobe.d
+%endif
+%endif
+
+%if %{include_udev_rules}
+install -d $RPM_BUILD_ROOT/etc/udev/rules.d
+install -m 0644 $RPM_BUILD_DIR/%{_name}-%{_version}/ofed_scripts/90-ib.rules $RPM_BUILD_ROOT/etc/udev/rules.d
+case "$(udevinfo -V 2> /dev/null | awk '{print $NF}' 2> /dev/null)" in
+0[1-4]*)
+sed -i -e 's/KERNEL==/KERNEL=/g' $RPM_BUILD_ROOT/etc/udev/rules.d/90-ib.rules
+;;
+esac
+%endif
+
+%clean
+#Remove installed driver after rpm build finished
+rm -rf $RPM_BUILD_ROOT
+rm -rf $RPM_BUILD_DIR/%{_name}-%{_version}
+
+###
+### pre section
+###
+
+%pre -n kernel-ib
+
+%pre -n kernel-ib-devel
+
+###
+### post section
+###
+
+%post -n kernel-ib
+if [ $1 -ge 1 ]; then # 1 : This package is being installed or reinstalled
+count_ib_ports()
+{
+ local cnt=0
+ local tmp_cnt=0
+
+ tmp_cnt=$(/sbin/lspci -n | grep "15b3:6282" | wc -l | tr -d '[:space:]') # Arbel mode
+ cnt=$[ $cnt + 2*${tmp_cnt} ]
+
+ tmp_cnt=$(/sbin/lspci -n | grep -E "15b3:5e8c|15b3:6274" | wc -l | tr -d '[:space:]') # Sinai
+ cnt=$[ $cnt + ${tmp_cnt} ]
+
+ tmp_cnt=$(/sbin/lspci -n | grep -E "15b3:5a44|15b3:6278" | wc -l | tr -d '[:space:]') # Tavor mode
+ cnt=$[ $cnt + 2*${tmp_cnt} ]
+
+ tmp_cnt=$(/sbin/lspci -n | grep -E "1fc1:|1077:7220" | wc -l | tr -d '[:space:]') # QLogic SDR and DDR HCA
+ cnt=$[ $cnt + ${tmp_cnt} ]
+
+ tmp_cnt=$(/sbin/lspci -n | grep -E "1077:7322" | wc -l | tr -d '[:space:]') # QLogic QDR HCA
+ cnt=$[ $cnt + 2*${tmp_cnt} ]
+ return $cnt
+}
+
+count_ib_ports
+ports_num=$?
+
+# Set default number of ports to 2 if no HCAs found
+if [ $ports_num -eq 0 ]; then
+ ports_num=2
+fi
+#############################################################################################################
+# Modules configuration #
+#############################################################################################################
+
+%if ! %{include_udev_rules}
+ if [ -e /etc/udev/udev.rules ]; then
+ perl -ni -e 'if (/\# Infiniband devices \#$/) { $filter = 1 }' -e 'if (!$filter) { print }' -e 'if (/\# End Infiniband devices \#$/){ $filter = 0 }' /etc/udev/udev.rules
+ cat >> /etc/udev/udev.rules << EOF
+# Infiniband devices #
+KERNEL="umad*", NAME="infiniband/%k"
+KERNEL="issm*", NAME="infiniband/%k"
+KERNEL="ucm*", NAME="infiniband/%k", MODE="0666"
+KERNEL="uverbs*", NAME="infiniband/%k", MODE="0666"
+KERNEL="uat", NAME="infiniband/%k", MODE="0666"
+KERNEL="ucma", NAME="infiniband/%k", MODE="0666"
+KERNEL="rdma_cm", NAME="infiniband/%k", MODE="0666"
+# End Infiniband devices #
+EOF
+ fi
+%endif
+
+%if %{modprobe_update}
+%if %{build_ipoib}
+for (( i=0 ; i < $ports_num ; i++ ))
+do
+cat >> /etc/modprobe.d/ib_ipoib.conf << EOF
+alias ib${i} ib_ipoib
+EOF
+done
+%endif
+%endif
+
+ /sbin/depmod %{KVERSION}
+
+#############################################################################################################
+
+
+if [[ -f /etc/redhat-release || -f /etc/rocks-release ]]; then
+perl -i -ne 'if (m@^#!/bin/bash@) {
+ print q@#!/bin/bash
+#
+# Bring up/down openib
+#
+# chkconfig: 2345 05 95
+# description: Activates/Deactivates InfiniBand Driver to \
+# start at boot time.
+#
+### BEGIN INIT INFO
+# Provides: openibd
+### END INIT INFO
+@;
+ } else {
+ print;
+ }' /etc/init.d/openibd
+
+ if ! ( /sbin/chkconfig --del openibd > /dev/null 2>&1 ); then
+ true
+ fi
+ if ! ( /sbin/chkconfig --add openibd > /dev/null 2>&1 ); then
+ true
+ fi
+fi
+
+if [ -f /etc/SuSE-release ]; then
+ local_fs='$local_fs'
+ openiscsi=''
+ %if %{build_oiscsi}
+ openiscsi='open-iscsi'
+ %endif
+ perl -i -ne "if (m@^#!/bin/bash@) {
+ print q@#!/bin/bash
+### BEGIN INIT INFO
+# Provides: openibd
+# Required-Start: $local_fs
+# Required-Stop: opensmd $openiscsi
+# Default-Start: 2 3 5
+# Default-Stop: 0 1 2 6
+# Description: Activates/Deactivates InfiniBand Driver to \
+# start at boot time.
+### END INIT INFO
+@;
+ } else {
+ print;
+ }" /etc/init.d/openibd
+
+ if ! ( /sbin/insserv openibd > /dev/null 2>&1 ); then
+ true
+ fi
+fi
+
+if [ -f /etc/debian_version ]; then
+ local_fs='$local_fs'
+ openiscsi=''
+ %if %{build_oiscsi}
+ openiscsi='open-iscsi'
+ %endif
+ perl -i -ne "if (m@^#!/bin/bash@) {
+ print q@#!/bin/bash
+### BEGIN INIT INFO
+# Provides: openibd
+# Required-Start: $local_fs
+# Required-Stop: opensmd $openiscsi
+# Default-Start: 2 3 5
+# Default-Stop: 0 1 2 6
+# Description: Activates/Deactivates InfiniBand Driver to \
+# start at boot time.
+### END INIT INFO
+@;
+ } else {
+ print;
+ }" /etc/init.d/openibd
+
+ if ! ( /usr/sbin/update-rc.d openibd defaults > /dev/null 2>&1 ); then
+ true
+ fi
+fi
+
+%if %{build_kernel_ib}
+ echo >> %{IB_CONF_DIR}/openib.conf
+ echo "# Load UCM module" >> %{IB_CONF_DIR}/openib.conf
+ echo "UCM_LOAD=no" >> %{IB_CONF_DIR}/openib.conf
+ echo >> %{IB_CONF_DIR}/openib.conf
+ echo "# Load RDMA_CM module" >> %{IB_CONF_DIR}/openib.conf
+ echo "RDMA_CM_LOAD=yes" >> %{IB_CONF_DIR}/openib.conf
+ echo >> %{IB_CONF_DIR}/openib.conf
+ echo "# Load RDMA_UCM module" >> %{IB_CONF_DIR}/openib.conf
+ echo "RDMA_UCM_LOAD=yes" >> %{IB_CONF_DIR}/openib.conf
+ echo >> %{IB_CONF_DIR}/openib.conf
+ echo "# Increase ib_mad thread priority" >> %{IB_CONF_DIR}/openib.conf
+ echo "RENICE_IB_MAD=no" >> %{IB_CONF_DIR}/openib.conf
+ echo >> %{IB_CONF_DIR}/openib.conf
+ echo "# Run sysctl performance tuning script" >> %{IB_CONF_DIR}/openib.conf
+ echo "RUN_SYSCTL=yes" >> %{IB_CONF_DIR}/openib.conf
+%endif
+
+%if %{build_mthca}
+ echo >> %{IB_CONF_DIR}/openib.conf
+ echo "# Load MTHCA" >> %{IB_CONF_DIR}/openib.conf
+ echo "MTHCA_LOAD=yes" >> %{IB_CONF_DIR}/openib.conf
+%endif
+
+%if %{build_qib}
+ echo >> %{IB_CONF_DIR}/openib.conf
+ echo "# Load QIB" >> %{IB_CONF_DIR}/openib.conf
+ echo "QIB_LOAD=yes" >> %{IB_CONF_DIR}/openib.conf
+%endif
+
+%if %{build_ipath}
+ echo >> %{IB_CONF_DIR}/openib.conf
+ echo "# Load IPATH" >> %{IB_CONF_DIR}/openib.conf
+ echo "IPATH_LOAD=yes" >> %{IB_CONF_DIR}/openib.conf
+%endif
+
+%if %{build_ehca}
+ echo >> %{IB_CONF_DIR}/openib.conf
+ echo "# Load eHCA" >> %{IB_CONF_DIR}/openib.conf
+ echo "EHCA_LOAD=yes" >> %{IB_CONF_DIR}/openib.conf
+%endif
+
+%if %{build_mlx4}
+ echo >> %{IB_CONF_DIR}/openib.conf
+ echo "# Load MLX4 modules" >> %{IB_CONF_DIR}/openib.conf
+ echo "MLX4_LOAD=yes" >> %{IB_CONF_DIR}/openib.conf
+%endif
+
+%if %{build_mlx4_en}
+ echo >> %{IB_CONF_DIR}/openib.conf
+ echo "# Load MLX4_EN module" >> %{IB_CONF_DIR}/openib.conf
+ echo "MLX4_EN_LOAD=yes" >> %{IB_CONF_DIR}/openib.conf
+%endif
+
+%if %{build_cxgb3}
+ echo >> %{IB_CONF_DIR}/openib.conf
+ echo "# Load CXGB3 modules" >> %{IB_CONF_DIR}/openib.conf
+ echo "CXGB3_LOAD=yes" >> %{IB_CONF_DIR}/openib.conf
+%endif
+
+%if %{build_cxgb4}
+ echo >> %{IB_CONF_DIR}/openib.conf
+ echo "# Load CXGB4 modules" >> %{IB_CONF_DIR}/openib.conf
+ echo "CXGB4_LOAD=yes" >> %{IB_CONF_DIR}/openib.conf
+%endif
+
+%if %{build_nes}
+ echo >> %{IB_CONF_DIR}/openib.conf
+ echo "# Load NES modules" >> %{IB_CONF_DIR}/openib.conf
+ echo "NES_LOAD=yes" >> %{IB_CONF_DIR}/openib.conf
+%endif
+
+%if %{build_ipoib}
+ echo >> %{IB_CONF_DIR}/openib.conf
+ echo "# Load IPoIB" >> %{IB_CONF_DIR}/openib.conf
+ echo "IPOIB_LOAD=yes" >> %{IB_CONF_DIR}/openib.conf
+ echo >> %{IB_CONF_DIR}/openib.conf
+ echo "# Enable IPoIB Connected Mode" >> %{IB_CONF_DIR}/openib.conf
+ echo "SET_IPOIB_CM=yes" >> %{IB_CONF_DIR}/openib.conf
+%endif
+
+%if %{build_sdp}
+ echo >> %{IB_CONF_DIR}/openib.conf
+ echo "# Load SDP module" >> %{IB_CONF_DIR}/openib.conf
+ echo "SDP_LOAD=yes" >> %{IB_CONF_DIR}/openib.conf
+%endif
+
+%if %{build_srp}
+ echo >> %{IB_CONF_DIR}/openib.conf
+ echo "# Load SRP module" >> %{IB_CONF_DIR}/openib.conf
+ echo "SRP_LOAD=no" >> %{IB_CONF_DIR}/openib.conf
+%endif
+
+%if %{build_srpt}
+ echo >> %{IB_CONF_DIR}/openib.conf
+ echo "# Load SRP Target module" >> %{IB_CONF_DIR}/openib.conf
+ echo "SRPT_LOAD=no" >> %{IB_CONF_DIR}/openib.conf
+%endif
+
+%if %{build_iser}
+ echo >> %{IB_CONF_DIR}/openib.conf
+ echo "# Load ISER module" >> %{IB_CONF_DIR}/openib.conf
+ echo "ISER_LOAD=no" >> %{IB_CONF_DIR}/openib.conf
+%endif
+
+%if %{build_rds}
+ echo >> %{IB_CONF_DIR}/openib.conf
+ echo "# Load RDS module" >> %{IB_CONF_DIR}/openib.conf
+ echo "RDS_LOAD=no" >> %{IB_CONF_DIR}/openib.conf
+%endif
+
+%if %{build_qlgc_vnic}
+ echo >> %{IB_CONF_DIR}/openib.conf
+ echo "# Load QLogic VNIC module" >> %{IB_CONF_DIR}/openib.conf
+ echo "QLGC_VNIC_LOAD=yes" >> %{IB_CONF_DIR}/openib.conf
+%endif
+
+fi # 1 : closed
+# END of post -n kernel-ib
+
+%post -n kernel-ib-devel
+
+###
+### preun section
+###
+
+%preun -n kernel-ib
+if [ $1 = 0 ]; then # 1 : Erase, not upgrade
+ if [[ -f /etc/redhat-release || -f /etc/rocks-release ]]; then
+ if ! ( /sbin/chkconfig --del openibd > /dev/null 2>&1 ); then
+ true
+ fi
+ fi
+ if [ -f /etc/SuSE-release ]; then
+ if ! ( /sbin/insserv -r openibd > /dev/null 2>&1 ); then
+ true
+ fi
+ fi
+ if [ -f /etc/debian_version ]; then
+ if ! ( /usr/sbin/update-rc.d openibd remove > /dev/null 2>&1 ); then
+ true
+ fi
+ fi
+fi
+
+###
+### post uninstall section
+###
+%postun -n kernel-ib
+if [ $1 = 0 ]; then # 1 : Erase, not upgrade
+ # Clean /etc/modprobe.d/ofed.conf
+ # Remove previous configuration if exist
+ /sbin/depmod %{KVERSION}
+
+# Clean udev.rules
+%if ! %{include_udev_rules}
+ if [ -e /etc/udev/udev.rules ]; then
+ perl -ni -e 'if (/\# Infiniband devices \#$/) { $filter = 1 }' -e 'if (!$filter) { print }' -e 'if (/\# End Infiniband devices \#$/){ $filter = 0 }' /etc/udev/udev.rules
+ fi
+%endif
+
+# Clean sysctl.conf
+if [ -f /etc/sysctl.conf ]; then
+perl -ni -e 'if (/\#\# OFED Network tuning parameters \#\#$/) { $filter = 1 }' -e 'if (!$filter) { print }' -e 'if (/\#\# END of OFED parameters \#\#$/){ $filter = 0 }' /etc/sysctl.conf
+fi
+
+fi
+
+%postun -n kernel-ib-devel
+
+###
+### Files
+###
+%if %{build_kernel_ib}
+%files -n kernel-ib
+%defattr(-,root,root,-)
+%dir %{IB_CONF_DIR}
+%config(noreplace) %{IB_CONF_DIR}/openib.conf
+%{IB_CONF_DIR}/info
+/etc/init.d/openibd
+/sbin/sysctl_perf_tuning
+%if %{include_udev_rules}
+/etc/udev/rules.d/90-ib.rules
+%endif
+%{LIB_MOD_DIR}
+%if %{build_qib}
+%config(noreplace) %{IB_CONF_DIR}/truescale.cmds
+%endif
+%if %{build_ipoib}
+%if %{modprobe_update}
+/etc/modprobe.d/ib_ipoib.conf
+%endif
+%endif
+%if %{build_sdp}
+%if %{modprobe_update}
+/etc/modprobe.d/ib_sdp.conf
+%endif
+%endif
+%if %{build_mlx4}
+%{_bindir}/ibdev2netdev
+%endif
+%if %{build_mlx4_en}
+/sbin/connectx_port_config
+/etc/modprobe.d/mlx4_en.conf
+%config(noreplace) %{IB_CONF_DIR}/connectx.conf
+%endif
+
+%endif
+
+%if %{build_kernel_ib_devel}
+%files -n kernel-ib-devel
+%defattr(-,root,root,-)
+%dir %{_prefix}/src
+%{_prefix}/src/%{_name}-%{_version}
+%{_prefix}/src/%{_name}
+%{_prefix}/src/openib
+%endif
+
+# END Files
+
+%changelog
+* Tue Aug 9 2011 Vladimir Sokolovsky <vlad@mellanox.co.il>
+- Simplify spec
+* Mon May 10 2010 Vladimir Sokolovsky <vlad@mellanox.co.il>
+- Support install macro that removes RPM_BUILD_ROOT
+* Thu Feb 4 2010 Vladimir Sokolovsky <vlad@mellanox.co.il>
+- Added ibdev2netdev script
+* Wed Sep 8 2008 Vladimir Sokolovsky <vlad@mellanox.co.il>
+- Added nfsrdma support
+* Wed Aug 13 2008 Vladimir Sokolovsky <vlad@mellanox.co.il>
+- Added mlx4_en support
+* Tue Aug 21 2007 Vladimir Sokolovsky <vlad@mellanox.co.il>
+- Added %build macro
+* Sun Jan 28 2007 Vladimir Sokolovsky <vlad@mellanox.co.il>
+- Created spec file for kernel-ib
--- /dev/null
+#!/bin/bash
+# Usage: ofed_checkout.sh [branch]
+# must be launched from top of git repo
+
+# get ref to "real" stdout
+exec 3>&1
+
+# Execute command w/ echo and exit if it fails
+ex()
+{
+ echo "$@" >&3
+ eval "$@"
+ if [ $? -ne 0 ]; then
+ printf "\nFailed executing $@\n" >&3
+ exit 1
+ fi
+}
+
+# Like ex above, but command is self echoing on stderr
+xex()
+{
+ eval "$@" 2>&3
+ if [ $? -ne 0 ]; then
+ printf "\nFailed executing $@\n" >&3
+ exit 1
+ fi
+}
+
+# branch defaults to ofed_kernel
+branch=${1:-ofed_kernel}
+
+# make sure we have the list of all the other files and dirs
+if [ ! -e ofed_scripts/checkout_files ]; then
+ ex git checkout ${branch} ofed_scripts/checkout_files
+fi
+
+xex xargs -rt git ls-tree -r --name-only ${branch} <ofed_scripts/checkout_files |
+ xex xargs -rt git checkout ${branch}
+
+ex git update-ref HEAD ${branch}
+
+ln -snf ofed_scripts/configure
+ln -snf ofed_scripts/Makefile
+ln -snf ofed_scripts/makefile
+(cd drivers/scsi/; rm -f Makefile; cp ../../ofed_scripts/iscsi_scsi_makefile Makefile)
--- /dev/null
+#!/bin/bash
+#
+# Execute command w/ echo and exit if it fail
+ex()
+{
+ makedist_log=$1
+ shift
+ if [ ! -z $makedist_log ]; then
+ echo "$@ >> $makedist_log"
+ eval "$@" >> $makedist_log 2>&1
+ else
+ echo "$@"
+ eval "$@"
+ fi
+ status=$?
+ if [ $status -ne 0 ]; then
+ if [ ! -z $makedist_log ]; then
+ echo "Failed executing $@ >> $makedist_log" >&2
+ tail $makedist_log >&2
+ else
+ echo "Failed executing $@" >&2
+ fi
+ echo Build failed in $tmpdir >&2
+ if [ ! -z $makedist_log ]; then
+ echo See log file $makedist_log >&2
+ fi
+ exit $status
+ fi
+}
+
+CWD=`pwd`
+project=${project:-"ofed_kernel"}
+tmpdir=`mktemp -d /tmp/build-$project-XXXXXX`
+giturl=${giturl:-${CWD}}
+head=${head:-`git show-ref -s -h -- HEAD`}
+backports=${backports:-`(cd kernel_patches/backport/; ls)`}
+destdir=${destdir:-${CWD}}
+
+# Add reference to local git directory on git.openfabrics.org
+git_reference_dir=${git_reference_dir:-"/home/vlad/scm/ofed_kernel.git"}
+
+git_extra_flags=
+if [ -d ${git_reference_dir} ]; then
+ git_extra_flags="--reference ${git_reference_dir}"
+fi
+
+for backport in $backports
+do
+ if [ ! -d kernel_patches/backport/$backport ] && [ ! -d kernel_addons/backport/$backport ]
+ then
+ continue
+ fi
+ ex "" git clone -q -s -n $git_extra_flags $giturl $tmpdir/$project-$backport
+ ex "" pushd $tmpdir/$project-$backport
+ ex $tmpdir/$project-$backport.log \
+ $CWD/ofed_scripts/ofed_checkout.sh $head
+ ex $tmpdir/$project-$backport.log \
+ $CWD/ofed_scripts/ofed_patch.sh --with-backport=$backport
+ #Some QUILT versions create files with 0 permissions
+ #work around this
+ if [ -d .pc ]
+ then
+ ex "" chmod -R u+rw .pc
+ ex "" chmod -R o+r .pc
+ fi
+ ex "" cd $tmpdir
+ ex "" tar czf $tmpdir/$project-$backport.tgz $project-$backport
+ ex "" popd
+done
+
+# create a tree with only the 'fixes' patches applied
+ex "" git clone -q -s -n $git_extra_flags $giturl $tmpdir/$project-fixes
+ex "" pushd $tmpdir/$project-fixes
+ex $tmpdir/$project-fixes.log \
+ $CWD/ofed_scripts/ofed_checkout.sh $head
+ex $tmpdir/$project-fixes.log BACKPORT_DIR='NONE' \
+ $CWD/ofed_scripts/ofed_patch.sh --with-kernel-fixes \
+ --without-backport-patches
+#Some QUILT versions create files with 0 permissions
+#work around this
+if [ -d .pc ]
+then
+ ex "" chmod -R u+rw .pc
+ ex "" chmod -R o+r .pc
+fi
+ex "" cd $tmpdir
+ex "" tar czf $tmpdir/$project-fixes.tgz $project-fixes
+ex "" popd
+
+# create a tree with no patches applied
+ex "" git clone -q -s -n $git_extra_flags $giturl $tmpdir/$project
+ex "" pushd $tmpdir/$project
+ex $tmpdir/$project.log $CWD/ofed_scripts/ofed_checkout.sh $head
+ex "" cd ..
+ex "" tar czf $tmpdir/$project.tgz $project
+ex "" popd
+
+results=`(cd $tmpdir; ls *tgz)`
+ex "" mv $tmpdir/*tgz $destdir
+ex "" rm -fr $tmpdir
+echo $results
--- /dev/null
+#!/bin/bash
+#
+# Copyright (c) 2006 Mellanox Technologies. All rights reserved.
+#
+# This Software is licensed under one of the following licenses:
+#
+# 1) under the terms of the "Common Public License 1.0" a copy of which is
+# available from the Open Source Initiative, see
+# http://www.opensource.org/licenses/cpl.php.
+#
+# 2) under the terms of the "The BSD License" a copy of which is
+# available from the Open Source Initiative, see
+# http://www.opensource.org/licenses/bsd-license.php.
+#
+# 3) under the terms of the "GNU General Public License (GPL) Version 2" a
+# copy of which is available from the Open Source Initiative, see
+# http://www.opensource.org/licenses/gpl-license.php.
+#
+# Licensee has the right to choose one of the above licenses.
+#
+# Redistributions of source code must retain the above copyright
+# notice and one of the license notices.
+#
+# Redistributions in binary form must reproduce both the above copyright
+# notice, one of the license notices in the documentation
+# and/or other materials provided with the distribution.
+
+usage()
+{
+cat << EOF
+\`ofed_patch.sh' applies kernel fixes and backport patches
+
+Usage: `basename $0` [options]
+
+ --with-backport=VERSION apply these backports [$(get_backport_dir.sh `uname -r`)]
+ --kernel-version=VERSION apply backports for this kernel [$(uname -r)]
+ --with-quilt[=FILE] path to quilt [$(/usr/bin/which quilt 2> /dev/null)]
+ --without-quilt use patch and not quilt [no]
+ --with-patchdir=DIR path to the patches directory []
+ --without-patch don't apply any patch [no]
+
+ --with-kernel-fixes apply fixes (patches) to kernel sources [yes]
+ --without-kernel-fixes don't apply patches to kernel sources
+
+ --with-backport-patches apply backport patches [yes]
+ --without-backport-patches don't apply backport patches
+
+ --with-hpage-patch apply huge pages patch [no]
+ --without-hpage-patch don't apply huge pages patch [yes]
+
+ --help - print out options
+
+List of supported backports:
+
+EOF
+ get_backports
+}
+
+# Execute command w/ echo and exit if it fail
+ex()
+{
+ echo "$@"
+ if ! "$@"; then
+ printf "\nFailed executing $@\n\n"
+ exit 1
+ fi
+}
+
+get_backports()
+{
+ echo 2.6.9_U2
+ echo 2.6.9_U3
+ echo 2.6.9_U4
+ echo 2.6.9_U5
+ echo 2.6.9_U6
+ echo 2.6.9_U7
+ echo 2.6.16_sles10
+ echo 2.6.16_sles10_sp1
+ echo 2.6.16_sles10_sp2
+ echo 2.6.16
+ echo 2.6.17
+ echo 2.6.18_FC6 "(good for RHEL5 as well)"
+ echo 2.6.18-EL5.1 "( RHEL5 U1)"
+ echo 2.6.18-EL5.2 "( RHEL5 U2)"
+ echo 2.6.18-EL5.3 "( RHEL5 U3)"
+ echo 2.6.18-EL5.4 "( RHEL5 U4)"
+ echo 2.6.18_suse10_2
+ echo 2.6.18
+ echo 2.6.19
+ echo 2.6.20
+ echo 2.6.21
+ echo 2.6.22
+ echo 2.6.22_suse10_3
+ echo 2.6.23
+ echo 2.6.24
+ echo 2.6.25
+ echo 2.6.26
+ echo 2.6.27_sles11
+}
+
+# Apply patch
+apply_patch()
+{
+ local patch=$1
+ shift
+
+ if [ -e ${patch} ]; then
+ printf "\t${patch}\n"
+ if [ "${WITH_QUILT}" == "yes" ]; then
+ ex $QUILT import ${patch}
+ ex $QUILT push patches/${patch##*/}
+ else
+ if ! (patch -p1 -l < ${patch} ); then
+ echo "Failed to apply patch: ${patch}"
+ exit 1
+ fi
+ fi
+ else
+ echo File ${patch} does not exist
+ return 1
+ fi
+ return 0
+}
+
+# Apply patches from the given directory
+apply_backport_patches()
+{
+ local pdir=${CWD}/backports/${BACKPORT_DIR}
+ shift
+ printf "\nApplying patches for ${BACKPORT_DIR} kernel:\n"
+ if [ -d ${pdir} ]; then
+ for patch in ${pdir}/*
+ do
+ apply_patch ${patch}
+ done
+ else
+ echo ${pdir} no such directory
+ fi
+}
+
+# Apply patches
+patches_handle()
+{
+ ex mkdir -p ${CWD}/patches
+ quiltrc=${CWD}/patches/quiltrc
+ ex touch ${quiltrc}
+
+cat << EOF >> ${quiltrc}
+QUILT_DIFF_OPTS='-x .svn -p --ignore-matching-lines=\$Id'
+QUILT_PATCH_OPTS='-l'
+EOF
+
+ QUILT="${QUILT} --quiltrc ${quiltrc}"
+
+ if [ -n "${PATCH_DIR}" ]; then
+ # Apply user's patches
+ for patch in ${PATCH_DIR}/*
+ do
+ apply_patch ${patch}
+ done
+
+ else
+ # Apply backport patches
+ BACKPORT_DIR=${BACKPORT_DIR:-$(${CWD}/ofed_scripts/get_backport_dir.sh ${KVERSION})}
+ if [ -n "${BACKPORT_DIR}" ]; then
+ if [ "X${WITH_BACKPORT_PATCHES}" == "Xyes" ]; then
+ apply_backport_patches
+ fi
+ BACKPORT_INCLUDES='-I${CWD}/kernel_addons/backport/'${BACKPORT_DIR}/include/
+ fi
+
+
+#FIXME: why are these applied here? Move them to before backports?
+ if [ "$WITH_PATCH" == "yes" ]; then
+ # Apply huge pages patch
+ if [ -d ${CWD}/kernel_patches/hpage_patches ]; then
+ if [ "X${WITH_HPAGE_PATCH}" == "Xyes" ]; then
+ # Apply hpages.patch
+ patch=${CWD}/kernel_patches/hpage_patches/hpages.patch
+ apply_patch ${patch}
+ fi
+ fi
+ fi
+ fi
+
+ # quilt leaves some files in .pc with no permissions
+ if [ -d ${CWD}/.pc ]; then
+ ex chmod -R u+rw ${CWD}/.pc
+ fi
+}
+
+main()
+{
+ # Parsing parameters
+ while [ ! -z "$1" ]
+ do
+ case $1 in
+ -kernel-version | --kernel-version | --kern-ver | --ker-ver)
+ shift
+ KVERSION=$1
+ ;;
+ -kernel-version=* | --kernel-version=* | --kern-ver=* | --ker-ver=*)
+ KVERSION=`expr "x$1" : 'x[^=]*=\(.*\)'`
+ ;;
+ -with-quilt | --with-quilt)
+ WITH_QUILT="yes"
+ if [ ! -z "$2" ] && [ "`echo -n $2 | cut -c 1`" != '-' ]; then
+ shift
+ QUILT=$1
+ if [ ! -x ${QUILT} ]; then
+ echo "${QUILT} does not exist"
+ exit 1
+ fi
+ fi
+ ;;
+ -with-quilt=* | --with-quilt=*)
+ WITH_QUILT="yes"
+ QUILT=`expr "x$1" : 'x[^=]*=\(.*\)'`
+ if [ ! -x ${QUILT} ]; then
+ echo "${QUILT} does not exist"
+ exit 1
+ fi
+ ;;
+ --without-quilt)
+ WITH_QUILT="no"
+ ;;
+ -with-patchdir | --with-patchdir)
+ shift
+ WITH_PATCH="yes"
+ PATCH_DIR=$1
+ ;;
+ -with-patchdir=* | --with-patchdir=*)
+ PATCH_DIR=`expr "x$1" : 'x[^=]*=\(.*\)'`
+ WITH_PATCH="yes"
+ ;;
+ --without-patch)
+ WITH_PATCH="no"
+ WITH_BACKPORT_PATCHES="no"
+ ;;
+ --with-hpage-patch)
+ WITH_HPAGE_PATCH="yes"
+ WITH_PATCH="yes"
+ ;;
+ --without-hpage-patch)
+ WITH_HPAGE_PATCH="no"
+ ;;
+ --with-backport-patches)
+ WITH_BACKPORT_PATCHES="yes"
+ WITH_PATCH="yes"
+ ;;
+ --without-backport-patches)
+ WITH_BACKPORT_PATCHES="no"
+ ;;
+ --with-backport)
+ shift
+ BACKPORT_DIR=$1
+ ;;
+ --with-backport=*)
+ BACKPORT_DIR=`expr "x$1" : 'x[^=]*=\(.*\)'`
+ ;;
+ -h | --help)
+ usage
+ exit 0
+ ;;
+ *)
+ echo
+ echo "Wrong parameter $1"
+ echo
+ usage
+ exit 1
+ ;;
+ esac
+ shift
+
+ done
+
+#Set default values
+KVERSION=${KVERSION:-$(uname -r)}
+WITH_QUILT=${WITH_QUILT:-"yes"}
+WITH_PATCH=${WITH_PATCH:-"yes"}
+BACKPORT_INCLUDES=""
+
+WITH_BACKPORT_PATCHES=${WITH_BACKPORT_PATCHES:-"yes"}
+WITH_HPAGE_PATCH=${WITH_HPAGE_PATCH:-"no"}
+
+QUILT=${QUILT:-$(/usr/bin/which quilt 2> /dev/null)}
+CWD=$(pwd)
+PATCH_DIR=${PATCH_DIR:-""}
+
+ # Check parameters
+ if [ "$WITH_PATCH" == "yes" ] && [ "$WITH_QUILT" == "yes" ] && [[ ! -x ${QUILT} || ! -n "${QUILT}" ]]; then
+ echo "Quilt ${QUILT} does not exist... Going to use patch."
+ WITH_QUILT="no"
+ fi
+
+ patches_handle
+ touch .backports_applied
+}
+
+main $@
--- /dev/null
+# Start HCA driver upon boot
+ONBOOT=yes
+
+# Node description
+NODE_DESC=$(hostname -s)
+
+# Wait for NODE_DESC_TIME_BEFORE_UPDATE sec before node_desc update
+NODE_DESC_TIME_BEFORE_UPDATE=10
--- /dev/null
+#!/bin/bash
+
+#
+# Copyright (c) 2006 Mellanox Technologies. All rights reserved.
+# Copyright (c) 2010 QLogic Corporation. All rights reserved.
+#
+# This Software is licensed under one of the following licenses:
+#
+# 1) under the terms of the "Common Public License 1.0" a copy of which is
+# available from the Open Source Initiative, see
+# http://www.opensource.org/licenses/cpl.php.
+#
+# 2) under the terms of the "The BSD License" a copy of which is
+# available from the Open Source Initiative, see
+# http://www.opensource.org/licenses/bsd-license.php.
+#
+# 3) under the terms of the "GNU General Public License (GPL) Version 2" a
+# copy of which is available from the Open Source Initiative, see
+# http://www.opensource.org/licenses/gpl-license.php.
+#
+# Licensee has the right to choose one of the above licenses.
+#
+# Redistributions of source code must retain the above copyright
+# notice and one of the license notices.
+#
+# Redistributions in binary form must reproduce both the above copyright
+# notice, one of the license notices in the documentation
+# and/or other materials provided with the distribution.
+#
+#
+# $Id: openibd 9139 2006-08-29 14:03:38Z vlad $
+#
+
+# config: /etc/infiniband/openib.conf
+CONFIG="/etc/infiniband/openib.conf"
+
+if [ ! -f $CONFIG ]; then
+ echo No InfiniBand configuration found
+ exit 0
+fi
+
+. $CONFIG
+
+CWD=`pwd`
+cd /etc/infiniband
+WD=`pwd`
+
+PATH=$PATH:/sbin:/usr/bin
+if [ -e /etc/profile.d/ofed.sh ]; then
+ . /etc/profile.d/ofed.sh
+fi
+
+# Only use ONBOOT option if called by a runlevel directory.
+# Therefore determine the base, follow a runlevel link name ...
+base=${0##*/}
+link=${base#*[SK][0-9][0-9]}
+# ... and compare them
+if [ $link == $base ] ; then
+ RUNMODE=manual
+ ONBOOT=yes
+else
+ RUNMODE=auto
+fi
+
+# Allow unsupported modules, if disallowed by current configuration
+modprobe=/sbin/modprobe
+if ${modprobe} -c | grep -q '^allow_unsupported_modules *0'; then
+ modprobe="${modprobe} --allow-unsupported-modules"
+fi
+
+ACTION=$1
+shift
+max_ports_num_in_hca=0
+
+# Check if OpenIB configured to start automatically
+if [ "X${ONBOOT}" != "Xyes" ]; then
+ exit 0
+fi
+
+if ( grep -i 'SuSE Linux' /etc/issue >/dev/null 2>&1 ); then
+ if [ -n "$INIT_VERSION" ] ; then
+ # MODE=onboot
+ if LANG=C egrep -L "^ONBOOT=['\"]?[Nn][Oo]['\"]?" ${CONFIG} > /dev/null ; then
+ exit 0
+ fi
+ fi
+fi
+
+#########################################################################
+# Get a sane screen width
+[ -z "${COLUMNS:-}" ] && COLUMNS=80
+
+[ -z "${CONSOLETYPE:-}" ] && [ -x /sbin/consoletype ] && CONSOLETYPE="`/sbin/consoletype`"
+
+if [ -f /etc/sysconfig/i18n -a -z "${NOLOCALE:-}" ] ; then
+ . /etc/sysconfig/i18n
+ if [ "$CONSOLETYPE" != "pty" ]; then
+ case "${LANG:-}" in
+ ja_JP*|ko_KR*|zh_CN*|zh_TW*)
+ export LC_MESSAGES=en_US
+ ;;
+ *)
+ export LANG
+ ;;
+ esac
+ else
+ export LANG
+ fi
+fi
+
+# Read in our configuration
+if [ -z "${BOOTUP:-}" ]; then
+ if [ -f /etc/sysconfig/init ]; then
+ . /etc/sysconfig/init
+ else
+ # This all seem confusing? Look in /etc/sysconfig/init,
+ # or in /usr/doc/initscripts-*/sysconfig.txt
+ BOOTUP=color
+ RES_COL=60
+ MOVE_TO_COL="echo -en \\033[${RES_COL}G"
+ SETCOLOR_SUCCESS="echo -en \\033[1;32m"
+ SETCOLOR_FAILURE="echo -en \\033[1;31m"
+ SETCOLOR_WARNING="echo -en \\033[1;33m"
+ SETCOLOR_NORMAL="echo -en \\033[0;39m"
+ LOGLEVEL=1
+ fi
+ if [ "$CONSOLETYPE" = "serial" ]; then
+ BOOTUP=serial
+ MOVE_TO_COL=
+ SETCOLOR_SUCCESS=
+ SETCOLOR_FAILURE=
+ SETCOLOR_WARNING=
+ SETCOLOR_NORMAL=
+ fi
+fi
+
+if [ "${BOOTUP:-}" != "verbose" ]; then
+ INITLOG_ARGS="-q"
+else
+ INITLOG_ARGS=
+fi
+
+echo_success() {
+ echo -n $@
+ [ "$BOOTUP" = "color" ] && $MOVE_TO_COL
+ echo -n "[ "
+ [ "$BOOTUP" = "color" ] && $SETCOLOR_SUCCESS
+ echo -n $"OK"
+ [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
+ echo -n " ]"
+ echo -e "\r"
+ return 0
+}
+
+echo_done() {
+ echo -n $@
+ [ "$BOOTUP" = "color" ] && $MOVE_TO_COL
+ echo -n "[ "
+ [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
+ echo -n $"done"
+ [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
+ echo -n " ]"
+ echo -e "\r"
+ return 0
+}
+
+echo_failure() {
+ echo -n $@
+ [ "$BOOTUP" = "color" ] && $MOVE_TO_COL
+ echo -n "["
+ [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
+ echo -n $"FAILED"
+ [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
+ echo -n "]"
+ echo -e "\r"
+ return 1
+}
+
+echo_warning() {
+ echo -n $@
+ [ "$BOOTUP" = "color" ] && $MOVE_TO_COL
+ echo -n "["
+ [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
+ echo -n $"WARNING"
+ [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
+ echo -n "]"
+ echo -e "\r"
+ return 1
+}
+
+count_ib_ports()
+{
+ local cnt=0
+ local ports_in_hca=0
+ sysdir=/sys/class/infiniband
+ hcas=$(/bin/ls -1 ${sysdir} 2> /dev/null)
+ for hca in $hcas
+ do
+ ports_in_hca=$(/bin/ls -1 ${sysdir}/${hca}/ports 2> /dev/null | wc -l)
+ if [ $ports_in_hca -gt $max_ports_num_in_hca ]; then
+ max_ports_num_in_hca=$ports_in_hca
+ fi
+ cnt=$[ $cnt + $ports_in_hca ]
+ done
+
+ return $cnt
+}
+
+# Setting Environment variables
+IS_FEDORA=0
+if [ -f /etc/redhat-release ]; then
+ DISTRIB="RedHat"
+ NETWORK_CONF_DIR="/etc/sysconfig/network-scripts"
+ # Check for Fedora, CentOS or Red Hat Enterprise Linux AS release 4 distribution
+ if ( grep -wE "Fedora|Nahant|CentOS" /etc/redhat-release > /dev/null ); then
+ IS_FEDORA=1
+ fi
+elif [ -f /etc/rocks-release ]; then
+ DISTRIB="Rocks"
+ NETWORK_CONF_DIR="/etc/sysconfig/network-scripts"
+elif [ -f /etc/SuSE-release ]; then
+ DISTRIB="SuSE"
+ NETWORK_CONF_DIR="/etc/sysconfig/network"
+elif [ -f /etc/debian_version ]; then
+ DISTRIB="Debian"
+else
+ DISTRIB=`ls /etc/*-release | head -n 1 | xargs -iXXX basename XXX -release 2> /dev/null`
+ if [ -d /etc/sysconfig/network-scripts ]; then
+ NETWORK_CONF_DIR="/etc/sysconfig/network-scripts"
+ elif [ -d /etc/sysconfig/network ]; then
+ NETWORK_CONF_DIR="/etc/sysconfig/network"
+ else
+ echo_failure "You system is not supported for IPoIB configuration"
+ echo "Try to load driver manually using configuration files from $WD directory"
+ exit 1
+ fi
+fi
+
+# Define kernel version prefix
+KPREFIX=`uname -r | cut -c -3 | tr -d '.' | tr -d '[:space:]'`
+
+# Setting OpenIB start parameters
+POST_LOAD_MODULES=""
+
+RUN_SYSCTL=${RUN_SYSCTL:-"yes"}
+
+if [ "X${SDP_LOAD}" == "Xyes" ]; then
+ POST_LOAD_MODULES="$POST_LOAD_MODULES ib_sdp"
+ IPOIB_LOAD="yes"
+fi
+
+IPOIB=0
+IPOIB_MTU=${IPOIB_MTU:-65520}
+if [ "X${IPOIB_LOAD}" == "Xyes" ]; then
+ IPOIB=1
+fi
+
+if [ "X${SRP_LOAD}" == "Xyes" ]; then
+ POST_LOAD_MODULES="$POST_LOAD_MODULES ib_srp"
+fi
+
+if [ "X${SRPT_LOAD}" == "Xyes" ]; then
+ POST_LOAD_MODULES="$POST_LOAD_MODULES ib_srpt"
+fi
+
+if [ "X${QLGC_VNIC_LOAD}" == "Xyes" ]; then
+ POST_LOAD_MODULES="$POST_LOAD_MODULES qlgc_vnic"
+fi
+
+if [ "X${SRP_TARGET_LOAD}" == "Xyes" ]; then
+ POST_LOAD_MODULES="$POST_LOAD_MODULES ib_srp_target"
+fi
+
+if [ "X${RDMA_CM_LOAD}" == "Xyes" ]; then
+ POST_LOAD_MODULES="$POST_LOAD_MODULES rdma_cm"
+fi
+
+if [ "X${UCM_LOAD}" == "Xyes" ]; then
+ POST_LOAD_MODULES="$POST_LOAD_MODULES ib_ucm"
+fi
+
+if [ "X${RDS_LOAD}" == "Xyes" ]; then
+ POST_LOAD_MODULES="$POST_LOAD_MODULES rds rds_rdma rds_tcp"
+fi
+
+if [ "X${ISER_LOAD}" == "Xyes" ]; then
+ POST_LOAD_MODULES="$POST_LOAD_MODULES ib_iser"
+fi
+
+if [ "X${RDMA_UCM_LOAD}" == "Xyes" ]; then
+ POST_LOAD_MODULES="$POST_LOAD_MODULES rdma_ucm"
+fi
+
+GEN1_UNLOAD_MODULES="ib_srp_target scsi_target ib_srp kdapltest_module ib_kdapl ib_sdp ib_useraccess ib_useraccess_cm ib_cm ib_dapl_srv ib_ip2pr ib_ipoib ib_tavor mod_thh mod_rhh ib_dm_client ib_sa_client ib_client_query ib_poll ib_mad ib_core ib_services"
+
+UNLOAD_MODULES="ib_mthca mlx4_ib ib_ipath ipath_core ib_ehca iw_nes cxgb3i iw_cxgb3 cxgb3 iw_cxgb4 cxgb4"
+UNLOAD_MODULES="$UNLOAD_MODULES ib_qib"
+UNLOAD_MODULES="$UNLOAD_MODULES ib_ipoib ib_madeye ib_rds"
+UNLOAD_MODULES="$UNLOAD_MODULES rds_rdma rds_tcp rds ib_ucm kdapl ib_srp_target scsi_target ib_srpt ib_srp ib_iser ib_sdp"
+UNLOAD_MODULES="$UNLOAD_MODULES rdma_ucm rdma_cm ib_addr iw_cm ib_cm ib_local_sa findex"
+UNLOAD_MODULES="$UNLOAD_MODULES ib_sa ib_uverbs ib_umad ib_mad ib_core"
+
+STATUS_MODULES="rdma_ucm ib_rds rds rds_rdma rds_tcp ib_srpt ib_srp qlgc_vnic ib_sdp rdma_cm ib_addr ib_local_sa findex ib_ipoib ib_ehca ib_ipath ipath_core mlx4_core mlx4_ib mlx4_en ib_mthca ib_uverbs ib_umad ib_ucm ib_sa ib_cm ib_mad ib_core iw_cxgb3 iw_cxgb4 iw_nes"
+STATUS_MODULES="$STATUS_MODULES ib_qib"
+
+ipoib_ha_pidfile=/var/run/ipoib_ha.pid
+srp_daemon_pidfile=/var/run/srp_daemon.pid
+_truescale=/etc/infiniband/truescale.cmds
+
+get_interfaces()
+{
+ interfaces=$(cd /sys/class/net;/bin/ls -d ib* 2> /dev/null)
+}
+
+get_mlx4_en_interfaces()
+{
+ mlx4_en_interfaces=""
+ for ethpath in /sys/class/net/eth*
+ do
+ if (grep 0x15b3 ${ethpath}/device/vendor > /dev/null 2>&1); then
+ mlx4_en_interfaces="$mlx4_en_interfaces ${ethpath##*/}"
+ fi
+ done
+}
+
+# If module $1 is loaded return - 0 else - 1
+is_module()
+{
+local RC
+
+ /sbin/lsmod | grep -w "$1" > /dev/null 2>&1
+ RC=$?
+
+return $RC
+}
+
+# Return module's refcnt
+is_ref()
+{
+ local refcnt
+ refcnt=`cat /sys/module/"$1"/refcnt 2> /dev/nill`
+ return $refcnt
+}
+
+get_sw_fw_info()
+{
+ INFO=/etc/infiniband/info
+ OFEDHOME="/usr/local"
+ if [ -x ${INFO} ]; then
+ OFEDHOME=$(${INFO} | grep -w prefix | cut -d '=' -f 2)
+ fi
+ MREAD=$(which mstmread 2> /dev/null)
+
+ # Get OFED Build id
+ if [ -r ${OFEDHOME}/BUILD_ID ]; then
+ echo "Software"
+ echo "-------------------------------------"
+ printf "Build ID:\n"
+ cat ${OFEDHOME}/BUILD_ID
+ echo "-------------------------------------"
+ fi
+
+ # Get FW version
+ if [ ! -x ${MREAD} ]; then
+ return 1
+ fi
+
+ vendor="15b3"
+ slots=$(lspci -n -d "${vendor}:" 2> /dev/null | grep -v "5a46" | cut -d ' ' -f 1)
+ for mst_device in $slots
+ do
+ major=$($MREAD ${mst_device} 0x82478 2> /dev/null | cut -d ':' -f 2)
+ subminor__minor=$($MREAD ${mst_device} 0x8247c 2> /dev/null | cut -d ':' -f 2)
+ ftime=$($MREAD ${mst_device} 0x82480 2> /dev/null | cut -d ':' -f 2)
+ fdate=$($MREAD ${mst_device} 0x82484 2> /dev/null | cut -d ':' -f 2)
+
+ major=$(echo -n $major | cut -d x -f 2 | cut -b 4)
+ subminor__minor1=$(echo -n $subminor__minor | cut -d x -f 2 | cut -b 3,4)
+ subminor__minor2=$(echo -n $subminor__minor | cut -d x -f 2 | cut -b 5,6,7,8)
+ echo
+ echo "Device ${mst_device} Info:"
+ echo "Firmware:"
+
+ printf "\tVersion:"
+ printf "\t$major.$subminor__minor1.$subminor__minor2\n"
+
+ day=$(echo -n $fdate | cut -d x -f 2 | cut -b 7,8)
+ month=$(echo -n $fdate | cut -d x -f 2 | cut -b 5,6)
+ year=$(echo -n $fdate | cut -d x -f 2 | cut -b 1,2,3,4)
+ hour=$(echo -n $ftime | cut -d x -f 2 | cut -b 5,6)
+ min=$(echo -n $ftime | cut -d x -f 2 | cut -b 3,4)
+ sec=$(echo -n $ftime | cut -d x -f 2 | cut -b 1,2)
+
+ printf "\tDate:"
+ printf "\t$day/$month/$year $hour:$min:$sec\n"
+ done
+}
+
+# Create debug info
+get_debug_info()
+{
+ trap '' 2 9 15
+ DEBUG_INFO=/tmp/ib_debug_info.log
+ /bin/rm -f $DEBUG_INFO
+ touch $DEBUG_INFO
+ echo "Hostname: `hostname -s`" >> $DEBUG_INFO
+ test -e /etc/issue && echo "OS: `cat /etc/issue`" >> $DEBUG_INFO
+ echo "Current kernel: `uname -r`" >> $DEBUG_INFO
+ echo "Architecture: `uname -m`" >> $DEBUG_INFO
+ which gcc &>/dev/null && echo "GCC version: `gcc --version`" >> $DEBUG_INFO
+ echo "CPU: `cat /proc/cpuinfo | /bin/grep -E \"model name|arch\" | head -1`" >> $DEBUG_INFO
+ echo "`cat /proc/meminfo | /bin/grep \"MemTotal\"`" >> $DEBUG_INFO
+ echo "Chipset: `/sbin/lspci 2> /dev/null | head -1 | cut -d ':' -f 2-`" >> $DEBUG_INFO
+
+ echo >> $DEBUG_INFO
+ get_sw_fw_info >> $DEBUG_INFO
+ echo >> $DEBUG_INFO
+
+ echo >> $DEBUG_INFO
+ echo "############# LSPCI ##############" >> $DEBUG_INFO
+ /sbin/lspci 2> /dev/null >> $DEBUG_INFO
+
+ echo >> $DEBUG_INFO
+ echo "############# LSPCI -N ##############" >> $DEBUG_INFO
+ /sbin/lspci -n 2> /dev/null >> $DEBUG_INFO
+
+ echo >> $DEBUG_INFO
+ echo "############# LSMOD ##############" >> $DEBUG_INFO
+ /sbin/lsmod >> $DEBUG_INFO
+
+ echo >> $DEBUG_INFO
+ echo "############# DMESG ##############" >> $DEBUG_INFO
+ /bin/dmesg >> $DEBUG_INFO
+
+ if [ -r /var/log/messages ]; then
+ echo >> $DEBUG_INFO
+ echo "############# Messages ##############" >> $DEBUG_INFO
+ tail -50 /var/log/messages >> $DEBUG_INFO
+ fi
+
+ echo >> $DEBUG_INFO
+ echo "############# Running Processes ##############" >> $DEBUG_INFO
+ /bin/ps -ef >> $DEBUG_INFO
+ echo "##############################################" >> $DEBUG_INFO
+
+ echo
+ echo "Please open an issue in the http://bugs.openfabrics.org and attach $DEBUG_INFO"
+ echo
+}
+
+errata_58()
+{
+# Check AMD chipset issue Errata #58
+if test -x /sbin/lspci && test -x /sbin/setpci; then
+ if ( /sbin/lspci -nd 1022:1100 2> /dev/null | grep "1100" > /dev/null ) &&
+ ( /sbin/lspci -nd 1022:7450 2> /dev/null | grep "7450" > /dev/null ) &&
+ ( /sbin/lspci -nd 15b3:5a46 2> /dev/null | grep "5a46" > /dev/null ); then
+
+ if ! ( grep FIX_AMD_8131_ERR58 $CONFIG > /dev/null ); then
+ echo >> $CONFIG
+ echo "# Set FIX_AMD_8131_ERR58=YES to apply AMD-8131 Errata #58 workaround" >> $CONFIG
+ echo "FIX_AMD_8131_ERR58=\"YES\"" >> $CONFIG
+ fi
+
+ # Set default value for FIX_AMD_8131_ERR58
+ if [ -z "$FIX_AMD_8131_ERR58" ]; then
+ FIX_AMD_8131_ERR58="YES"
+ fi
+
+ CURVAL=`/sbin/setpci -d 1022:1100 69`
+
+ for val in $CURVAL
+ do
+ if [ "${val}" != "c0" ]; then
+ if [ "$FIX_AMD_8131_ERR58" == "YES" ]; then
+ /sbin/setpci -d 1022:1100 69=c0
+ if [ $? -eq 0 ]; then
+ # echo "AMD-8131 Errata #58 workaround applied"
+ break
+ else
+ echo "Failed to apply AMD-8131 Errata #58 workaround"
+ fi
+ else
+ echo
+ echo "Invalid configuration found for PCI-X chipset AMD-8131 (Errata #58)"
+ echo
+ if [ "$RUNMODE" == "manual" ]; then
+ read -p "Do you wish to continue anyway? [y/N]:"
+ if [[ "$REPLY" != "y" && "$REPLY" != "yes" ]]; then
+ exit 1
+ fi
+ break
+ else
+ exit 1
+ fi
+ fi
+ fi
+ done
+
+ fi
+fi
+
+}
+
+errata_56()
+{
+# Check AMD chipset issue Errata #56
+if test -x /sbin/lspci && test -x /sbin/setpci; then
+ if ( /sbin/lspci -nd 1022:1100 2> /dev/null | grep "1100" > /dev/null ) &&
+ ( /sbin/lspci -nd 1022:7450 2> /dev/null | grep "7450" > /dev/null ) &&
+ ( /sbin/lspci -nd 15b3:5a46 2> /dev/null | grep "5a46" > /dev/null ); then
+
+ if ! ( grep FIX_AMD_8131_ERR56 $CONFIG > /dev/null ); then
+ echo >> $CONFIG
+ echo "# Set FIX_AMD_8131_ERR56=YES to apply AMD-8131 Errata #56 workaround" >> $CONFIG
+ echo "FIX_AMD_8131_ERR56=\"YES\"" >> $CONFIG
+ fi
+
+ # Set default value for FIX_AMD_8131_ERR56
+ if [ -z "$FIX_AMD_8131_ERR56" ]; then
+ FIX_AMD_8131_ERR56="YES"
+ fi
+
+ bus=""
+
+ # Look for devices AMD-8131
+ for amd_dev in `/sbin/setpci -v -f -d 1022:7450 19 | cut -d':' -f1,2`
+ do
+
+ bus=`/sbin/setpci -s $amd_dev 19`
+ rev=`/sbin/setpci -s $amd_dev 8`
+
+
+ # Look for Tavor attach to secondary bus of this devices
+ for device in `/sbin/setpci -f -s $bus: -d 15b3:5a46 19`
+ do
+ if [ $rev -lt 13 ]; then
+ if [ "$FIX_AMD_8131_ERR56" == "YES" ]; then
+ /sbin/setpci -d 15b3:5a44 72=14
+ if [ $? -eq 0 ]; then
+ # echo "AMD-8131 Errata #56 workaround applied"
+ break
+ else
+ echo "Failed to apply AMD-8131 Errata #56 workaround"
+ fi
+ else
+ echo
+ echo "Invalid configuration found for PCI-X chipset AMD-8131 (Errata #56)"
+ echo
+
+ if [ "$RUNMODE" == "manual" ]; then
+ read -p "Do you wish to continue anyway? [y/N]:"
+ if [[ "$REPLY" != "y" && "$REPLY" != "yes" ]]; then
+ exit 1
+ fi
+ break
+ else
+ exit 1
+ fi
+ fi
+
+ else
+ continue
+ fi
+
+ # If more than one device is on the bus the issue a
+ # warning
+ num=`/sbin/setpci -f -s $bus: 0 | wc -l | sed 's/\ *//g'`
+
+ if [ $num -gt 1 ]; then
+ echo "Warning: your current PCI-X configuration might be incorrect."
+ echo "see AMD-8131 Errata 56 for more details."
+ fi
+
+ done
+ done
+
+ fi
+fi
+}
+
+
+ib_set_node_desc()
+{
+ # Wait while node's hostname is set
+ NODE_DESC_TIME_BEFORE_UPDATE=${NODE_DESC_TIME_BEFORE_UPDATE:-10}
+ sleep $NODE_DESC_TIME_BEFORE_UPDATE
+ NODE_DESC=${NODE_DESC:-$(hostname -s)}
+ # Add node description to sysfs
+ ibsysdir="/sys/class/infiniband"
+ if [ -d ${ibsysdir} ]; then
+ declare -i hca_id=1
+ for hca in ${ibsysdir}/*
+ do
+ if [ -e ${hca}/node_desc ]; then
+ logger -i "Set node_desc for $(basename $hca): ${NODE_DESC} HCA-${hca_id}"
+ echo -n "${NODE_DESC} HCA-${hca_id}" >> ${hca}/node_desc
+ fi
+ let hca_id++
+ done
+ fi
+}
+
+
+need_location_code_fix()
+{
+ local sub ARCH KVERSION
+ ARCH=$(uname -m)
+ KVERSION=$(uname -r)
+
+ if [ "$ARCH" != "ppc64" ]; then
+ return 1;
+ fi
+
+ case $KVERSION in
+ 2.6.9-*.EL*)
+ sub=$(echo $KVERSION | cut -d"-" -f2 | cut -d"." -f1)
+ if [ $sub -lt 62 ]; then
+ return 2;
+ fi
+ ;;
+ 2.6.16.*-*-*)
+ sub=$(echo $KVERSION | cut -d"." -f4 | cut -d"-" -f1)
+ if [ $sub -lt 53 ]; then
+ return 0;
+ fi
+ ;;
+ 2.6.18-*.el5*)
+ sub=$(echo $KVERSION | cut -d"-" -f2 | cut -d"." -f1)
+ if [ $sub -lt 54 ]; then
+ return 0;
+ fi
+ ;;
+ 2.6.*)
+ sub=$(echo $KVERSION | cut -d"." -f3 | cut -d"-" -f1 | tr -d [:alpha:][:punct:])
+ if [ $sub -lt 24 ]; then
+ return 0;
+ fi
+ ;;
+ esac
+
+ return 1;
+}
+
+fix_location_codes()
+{
+ # ppc64 only:
+ # Fix duplicate location codes on kernels where ibmebus can't handle them
+
+ need_location_code_fix
+ ret=$?
+ if [ $ret = 1 ]; then return 0; fi
+ if ! [ -d /proc/device-tree -a -f /proc/ppc64/ofdt ]; then return 0; fi
+
+ local i=1 phandle lcode len
+ # output all duplicate location codes and their devices
+ for attr in $(find /proc/device-tree -name "ibm,loc-code" | grep "lh.a"); do
+ echo -e $(dirname $attr)"\t"$(cat $attr)
+ done | sort -k2 | uniq -f1 --all-repeated=separate | cut -f1 | while read dev; do
+ if [ -n "$dev" ]; then
+ # append an instance counter to the location code
+ phandle=$(hexdump -e '8 "%u"' $dev/ibm,phandle)
+ lcode=$(cat $dev/ibm,loc-code)-I$i
+ len=$(echo -n "$lcode" | wc -c)
+ node=${dev#/proc/device-tree}
+
+ # kernel-2.6.9 don't provide "update_property"
+ if [ ! -z "$(echo -n "$node" | grep "lhca")" ]; then
+ if [ $ret = 2 ]; then
+ echo -n "add_node $node" > /tmp/addnode
+ cd $dev
+ for a in *; do
+ SIZE=$(stat -c%s $a)
+ if [ "$a" = "ibm,loc-code" ] ; then
+ echo -n " $a $len $lcode" >> /tmp/addnode
+ elif [ "$a" = "interrupts" ] ; then
+ echo -n " $a 0 " >> /tmp/addnode
+ else
+ echo -n " $a $SIZE " >> /tmp/addnode
+ cat $a >> /tmp/addnode
+ fi
+ done
+ echo -n "remove_node $node" > /proc/ppc64/ofdt
+ cat /tmp/addnode > /proc/ppc64/ofdt
+ rm -rf /tmp/addnode
+ else
+ echo -n "update_property $phandle ibm,loc-code $len $lcode" > /proc/ppc64/ofdt
+ fi
+ i=$(($i + 1))
+ fi
+ else
+ # empty line means new group -- reset i
+ i=1
+ fi
+ done
+}
+
+rotate_log()
+{
+ local log=$1
+ if [ -s ${log} ]; then
+ cat ${log} >> ${log}.$(date +%Y-%m-%d)
+ /bin/rm -f ${log}
+ fi
+ touch ${log}
+}
+
+# Check whether IPoIB interface configured to be started upon boot.
+is_onboot()
+{
+ local i=$1
+ shift
+
+ case $DISTRIB in
+ RedHat|Rocks)
+ if LANG=C egrep -L "^ONBOOT=['\"]?[Nn][Oo]['\"]?" ${NETWORK_CONF_DIR}/ifcfg-$i > /dev/null ; then
+ return 1
+ fi
+ ;;
+ SuSE)
+ if ! LANG=C egrep -L "^STARTMODE=['\"]?onboot['\"]?" ${NETWORK_CONF_DIR}/ifcfg-$i > /dev/null ; then
+ return 1
+ fi
+ ;;
+ Debian)
+ if ! ( LANG=C grep auto /etc/network/interfaces | grep -w $i > /dev/null 2>&1) ; then
+ return 1
+ fi
+ ;;
+ *)
+ if LANG=C egrep -L "^ONBOOT=['\"]?[Nn][Oo]['\"]?" ${NETWORK_CONF_DIR}/ifcfg-$i > /dev/null ; then
+ return 1
+ fi
+ ;;
+ esac
+
+ return 0
+}
+
+set_ipoib_cm()
+{
+ local i=$1
+ shift
+
+ if [ ! -e /sys/class/net/${i}/mode ]; then
+ echo "Failed to configure IPoIB connected mode for ${i}"
+ return 1
+ fi
+
+ sleep 1
+ echo connected > /sys/class/net/${i}/mode
+ /sbin/ip link set ${i} mtu ${IPOIB_MTU}
+}
+
+bring_up()
+{
+ local i=$1
+ shift
+
+ case $DISTRIB in
+ RedHat|Rocks)
+ if [ $IS_FEDORA -eq 0 ]; then
+ /sbin/ifup ${i} 2> /dev/null
+ else
+ . ${NETWORK_CONF_DIR}/ifcfg-${i}
+ if [ ! -z ${IPADDR} ] && [ ! -z ${NETMASK} ] && [ ! -z ${BROADCAST} ]; then
+ /sbin/ifconfig ${i} ${IPADDR} netmask ${NETMASK} broadcast ${BROADCAST} > /dev/null 2>&1
+ else
+ /sbin/ifup ${i} 2> /dev/null
+ fi
+ fi
+ ;;
+ SuSE)
+ if [ "$KPREFIX" == "26" ]; then
+ ifconfig ${i} up > /dev/null 2>&1
+ fi
+ # Workaround for ifup issue: two devices with the same IP address
+ . ${NETWORK_CONF_DIR}/ifcfg-${i}
+ if [ ! -z ${IPADDR} ] && [ ! -z ${NETMASK} ] && [ ! -z ${BROADCAST} ]; then
+ /sbin/ifconfig ${i} ${IPADDR} netmask ${NETMASK} broadcast ${BROADCAST} > /dev/null 2>&1
+ else
+ /sbin/ifup ${i}
+ fi
+ # /sbin/ifup ${i} > /dev/null 2>&1
+ ;;
+ *)
+ /sbin/ifup ${i} 2> /dev/null
+ ;;
+ esac
+
+ if [ "X${SET_IPOIB_CM}" == "Xyes" ]; then
+ set_ipoib_cm ${i}
+ fi
+
+ return $?
+}
+
+start()
+{
+ local RC=0
+
+ # Stop Gen1 modules if they are UP after uninstall
+ if is_module ib_tavor; then
+ echo
+ echo "Found Infiniband Gen1 modules."
+ echo "Trying to unload them first..."
+ echo
+ stop_gen1
+ fi
+
+ if [ $DISTRIB = "SuSE" ]; then
+ if [ -x /sbin/rpc.statd ]; then
+ /sbin/rpc.statd
+ fi
+ fi
+
+ errata_58
+
+ # Load Mellanox HCA driver
+ if [ "X${MTHCA_LOAD}" == "Xyes" ]; then
+ ${modprobe} ib_mthca > /dev/null 2>&1
+ my_rc=$?
+ if [ $my_rc -ne 0 ]; then
+ echo_failure $"Loading Mellanox HCA driver: "
+ fi
+ RC=$[ $RC + $my_rc ]
+ fi
+
+ if [ "X${MLX4_LOAD}" == "Xyes" ]; then
+ ${modprobe} mlx4_core > /dev/null 2>&1
+ my_rc=$?
+ if [ $my_rc -ne 0 ]; then
+ echo_failure $"Loading Mellanox MLX4 HCA driver: "
+ else
+ # Set port configuration
+ if [ -f /etc/infiniband/connectx.conf ]; then
+ . /etc/infiniband/connectx.conf > /dev/null 2>&1
+ fi
+ fi
+ ${modprobe} mlx4_ib > /dev/null 2>&1
+ my_rc=$?
+ if [ $my_rc -ne 0 ]; then
+ echo_failure $"Loading Mellanox MLX4_IB HCA driver: "
+ fi
+ RC=$[ $RC + $my_rc ]
+ fi
+
+ if [ "X${MLX4_EN_LOAD}" == "Xyes" ]; then
+ if ! is_module mlx4_core; then
+ ${modprobe} mlx4_core > /dev/null 2>&1
+ fi
+
+ ${modprobe} mlx4_en > /dev/null 2>&1
+ my_rc=$?
+ if [ $my_rc -ne 0 ]; then
+ echo_failure $"Loading Mellanox MLX4_EN HCA driver: "
+ fi
+ RC=$[ $RC + $my_rc ]
+ fi
+
+ # Load QLogic QIB driver
+ if [ "X${QIB_LOAD}" == "Xyes" ]; then
+ ${modprobe} ib_qib > /dev/null 2>&1
+ my_rc=$?
+ if [ $my_rc -ne 0 ]; then
+ echo_failure $"Loading QLogic QIB driver: "
+ elif [ -s ${_truescale} ]; then
+ . ${_truescale} start
+ fi
+ RC=$[ $RC + $my_rc ]
+ fi
+
+ # Load QLogic InfiniPath driver
+ if [ "X${IPATH_LOAD}" == "Xyes" ]; then
+ ${modprobe} ib_ipath > /dev/null 2>&1
+ my_rc=$?
+ if [ $my_rc -ne 0 ]; then
+ echo_failure $"Loading QLogic InfiniPath driver: "
+ fi
+ # Don't exit on error
+ # Workarround for Bug 252.
+ # RC=$[ $RC + $my_rc ]
+ fi
+
+ # Load eHCA driver
+ if [ "X${EHCA_LOAD}" == "Xyes" ]; then
+ fix_location_codes
+ ${modprobe} ib_ehca > /dev/null 2>&1
+ my_rc=$?
+ if [ $my_rc -ne 0 ]; then
+ echo_failure $"Loading eHCA driver: "
+ fi
+ RC=$[ $RC + $my_rc ]
+ fi
+
+ # Load iw_cxgb3 driver
+ if [ "X${CXGB3_LOAD}" == "Xyes" ]; then
+ fix_location_codes
+ ${modprobe} iw_cxgb3 > /dev/null 2>&1
+ my_rc=$?
+ if [ $my_rc -ne 0 ]; then
+ echo_failure $"Loading cxgb3 driver: "
+ fi
+ RC=$[ $RC + $my_rc ]
+ fi
+
+ # Load iw_cxgb4 driver
+ if [ "X${CXGB4_LOAD}" == "Xyes" ]; then
+ fix_location_codes
+ ${modprobe} iw_cxgb4 > /dev/null 2>&1
+ my_rc=$?
+ if [ $my_rc -ne 0 ]; then
+ echo_failure $"Loading cxgb4 driver: "
+ fi
+ RC=$[ $RC + $my_rc ]
+ fi
+
+ # Load iw_nes driver
+ if [ "X${NES_LOAD}" == "Xyes" ]; then
+ fix_location_codes
+ ${modprobe} iw_nes > /dev/null 2>&1
+ my_rc=$?
+ if [ $my_rc -ne 0 ]; then
+ echo_failure $"Loading nes driver: "
+ fi
+ RC=$[ $RC + $my_rc ]
+ fi
+
+ ib_set_node_desc > /dev/null 2>&1 &
+
+ ${modprobe} ib_umad > /dev/null 2>&1
+ RC=$[ $RC + $? ]
+ ${modprobe} ib_uverbs > /dev/null 2>&1
+ RC=$[ $RC + $? ]
+
+ if [ $IPOIB -eq 1 ]; then
+ ${modprobe} ib_ipoib > /dev/null 2>&1
+ RC=$[ $RC + $? ]
+ fi
+
+ if [ $RC -eq 0 ]; then
+ echo_success $"Loading HCA driver and Access Layer: "
+ else
+ echo_failure $"Loading HCA driver and Access Layer: "
+ get_debug_info
+ exit 1
+ fi
+
+ # Enable IPoIB Interface if configured
+ if [ $IPOIB -eq 1 ]; then
+ get_interfaces
+ echo Setting up InfiniBand network interfaces:
+ for i in $interfaces
+ do
+ if [[ ! -e ${WD}/ifcfg-${i} && ! -e ${NETWORK_CONF_DIR}/ifcfg-${i} ]]; then
+ echo "No configuration found for ${i}"
+ if [ "X${SET_IPOIB_CM}" == "Xyes" ]; then
+ set_ipoib_cm ${i}
+ fi
+ else
+ REMOVE_NETWORK_CONF=0
+ if [ ! -e ${NETWORK_CONF_DIR}/ifcfg-${i} ]; then
+ ln -snf ${WD}/ifcfg-${i} ${NETWORK_CONF_DIR}/ifcfg-${i}
+ REMOVE_NETWORK_CONF=1
+ fi
+
+ if [ "$RUNMODE" != "manual" ]; then
+ if ! is_onboot $i; then
+ continue
+ fi
+ fi
+
+ bring_up $i
+ RC=$?
+
+ unset IPADDR NETMASK BROADCAST
+
+ if [ $REMOVE_NETWORK_CONF -eq 1 ]; then
+ rm -f ${NETWORK_CONF_DIR}/ifcfg-${i}
+ fi
+
+ if [ $RC -eq 0 ]; then
+ echo_success $"Bringing up interface $i:"
+ else
+ echo_failure $"Bringing up interface $i:"
+ fi
+ fi
+
+ # Bring up child interfaces if configured
+ for child_conf in $(/bin/ls -1 ${NETWORK_CONF_DIR}/ifcfg-${i}.???? 2> /dev/null)
+ do
+ ch_i=${child_conf##*-}
+ # Skip saved interfaces rpmsave and rpmnew
+ if (echo $ch_i | grep rpm > /dev/null 2>&1); then
+ continue
+ fi
+ if [ "$RUNMODE" != "manual" ]; then
+ if ! is_onboot $ch_i; then
+ continue
+ fi
+ fi
+
+ if [ ! -f /sys/class/net/${i}/create_child ]; then
+ continue
+ fi
+
+ pkey=0x${ch_i##*.}
+ if [ ! -e /sys/class/net/${i}.${ch_i##*.} ] ; then
+ echo $pkey > /sys/class/net/${i}/create_child
+ fi
+ bring_up $ch_i
+ RC=$?
+
+ unset IPADDR NETMASK BROADCAST
+ if [ $RC -eq 0 ]; then
+ echo_success $"Bringing up interface $ch_i:"
+ else
+ echo_failure $"Bringing up interface $ch_i:"
+ fi
+ done
+ done
+ echo_done "Setting up service network . . ."
+
+ fi
+
+ # Load configured modules
+ if [ "$POST_LOAD_MODULES" != "" ]; then
+ for mod in $POST_LOAD_MODULES
+ do
+ case $mod in
+ ib_srp)
+ ${modprobe} $mod > /dev/null 2>&1
+ if [ "X${SRPHA_ENABLE}" == "Xyes" ]; then
+ if [ ! -x /sbin/multipath ]; then
+ echo "/sbin/multipath is required to enable SRP HA."
+ else
+ # Create 91-srp.rules file
+ mkdir -p /etc/udev/rules.d
+ if [ "$DISTRIB" == "SuSE" ]; then
+ cat > /etc/udev/rules.d/91-srp.rules << EOF
+ACTION=="add", KERNEL=="sd*[!0-9]", RUN+="/sbin/multipath %M:%m"
+EOF
+ fi
+ ${modprobe} dm_multipath > /dev/null 2>&1
+ srp_daemon.sh &
+ srp_daemon_pid=$!
+ echo ${srp_daemon_pid} > ${srp_daemon_pidfile}
+ fi
+ elif [ "X${SRP_DAEMON_ENABLE}" == "Xyes" ]; then
+ srp_daemon.sh &
+ srp_daemon_pid=$!
+ echo ${srp_daemon_pid} > ${srp_daemon_pidfile}
+ fi
+ ;;
+ *)
+ ${modprobe} $mod > /dev/null 2>&1
+ ;;
+ esac
+ RC=$?
+ [ $RC -ne 0 ] && echo_failure "Loading $mod"
+ done
+ fi
+
+ errata_56
+
+ # Create devices using udev
+ if [ -x /sbin/udevstart ]; then
+ UDEVSTART=/sbin/udevstart
+ elif [ -x /sbin/start_udev ]; then
+ UDEVSTART=/sbin/start_udev
+ else
+ UDEVSTART=
+ fi
+
+ if [ ! -z "${UDEVSTART}" ]; then
+ devstart_cnt=0
+ devstart_maxcnt=10
+ while [ ! -d /dev/infiniband/ ] && [ $devstart_cnt -lt $devstart_maxcnt ]; do
+ sleep 1
+ let devstart_cnt++
+ done
+
+ if [ ! -d /dev/infiniband/ ] && [ $devstart_cnt -eq $devstart_maxcnt ]; then
+ ${UDEVSTART} > /dev/null 2>&1
+ fi
+
+ if [ ! -d /dev/infiniband/ ]; then
+ echo_warning $"udevstart: No devices created under /dev/infiniband"
+ fi
+ fi
+
+ # Create qlgc_vnic interfaces. This needs to be done after udevstart
+ if [ "X${QLGC_VNIC_LOAD}" == "Xyes" ]; then
+ if [ -x /etc/init.d/qlgc_vnic ]; then
+ /etc/init.d/qlgc_vnic start
+ fi
+ fi
+
+ if [ X${RENICE_IB_MAD} == "Xyes" ]; then
+ # Set max_ports_num_in_hca variable
+ count_ib_ports
+ ports_num=$?
+ list_of_ibmads=""
+ for (( i=1 ; $i <= ${max_ports_num_in_hca} ; i++ ))
+ do
+ list_of_ibmads="${list_of_ibmads} ib_mad${i}"
+ done
+
+ ib_mad_pids=($(pidof ${list_of_ibmads} 2> /dev/null))
+ num_of_root_ibmad_procs=$(/bin/ps h -o user -p ${ib_mad_pids[*]} | grep -w root | wc -l)
+ get_pid_retries=0
+ while [ ${num_of_root_ibmad_procs} -lt $ports_num ]
+ do
+ # Wait maximum for 5 sec to get ib_mad process pid
+ if [ $get_pid_retries -gt 10 ]; then
+ echo Failed to get $ports_num ib_mad PIDs to renice. Got ${num_of_root_ibmad_procs}.
+ break
+ fi
+ usleep 500000
+ ib_mad_pids=($(pidof ${list_of_ibmads} 2> /dev/null))
+ num_of_root_ibmad_procs=$(/bin/ps h -o user -p ${ib_mad_pids[*]} | grep -w root | wc -l)
+ let get_pid_retries++
+ done
+ for ib_mad_pid in ${ib_mad_pids[*]}
+ do
+ if [ "$(/bin/ps -p ${ib_mad_pid} h -o user 2> /dev/null)" == "root" ]; then
+ renice -19 ${ib_mad_pid} > /dev/null 2>&1
+ fi
+ done
+ fi
+
+ if [ -x /sbin/sysctl_perf_tuning ] && [ "X${RUN_SYSCTL}" == "Xyes" ]; then
+ /sbin/sysctl_perf_tuning load
+ fi
+
+ return $RC
+}
+
+rm_mod()
+{
+ local mod=$1
+ shift
+
+ unload_log=`/sbin/rmmod $mod 2>&1`
+ if [ $? -ne 0 ]; then
+ echo_failure $"Unloading $mod"
+ if [ ! -z "${unload_log}" ]; then
+ echo $unload_log
+ fi
+ # get_debug_info
+ [ ! -z $2 ] && echo $2
+ exit 1
+ fi
+}
+
+unload()
+{
+ # Unload module $1
+ local mod=$1
+ local unload_log
+
+ if is_module $mod; then
+ case $mod in
+ ib_ipath)
+ # infinipath depends on modprobe.conf remove rule
+ ${modprobe} -v -r $mod > /dev/null 2>&1
+ sleep 2
+ ;;
+ ib_qib)
+ if [ -s ${_truescale} ]; then
+ . ${_truescale} stop
+ fi
+ rm_mod $mod
+ sleep 2
+ ;;
+ ib_mthca | mlx4_ib | ib_ehca | iw_cxgb3 | iw_cxgb4 | iw_nes)
+ rm_mod $mod
+ sleep 2
+ ;;
+ *)
+ # is_module ib_ipoib && ${modprobe} -r ib_ipoib > /dev/null 2>&1
+ ${modprobe} -r $mod > /dev/null 2>&1
+ if [ $? -ne 0 ] || is_module $mod; then
+ # Try rmmod if modprobe failed: case that previous installation included more IB modules.
+ rm_mod $mod
+ fi
+ ;;
+ esac
+ fi
+}
+
+stop_gen1()
+{
+ if is_module ib_ipoib; then
+ # Unload IPoIB interfaces
+ get_interfaces
+ for i in $interfaces
+ do
+ if [[ ! -e ${WD}/ifcfg-${i} && ! -e ${NETWORK_CONF_DIR}/ifcfg-${i} ]]; then
+ # echo "No configuration found for ${i}"
+ continue
+ fi
+
+ REMOVE_NETWORK_CONF=0
+ if [ ! -e ${NETWORK_CONF_DIR}/ifcfg-${i} ]; then
+ ln -snf ${WD}/ifcfg-${i} ${NETWORK_CONF_DIR}/ifcfg-${i}
+ REMOVE_NETWORK_CONF=1
+ fi
+
+ ifdown ${i} > /dev/null 2>&1
+ RC=$(($RC+$?))
+ [ $RC -eq 0 ] && echo_success $"Shutting down interface $i: " || echo_failure $"Shutting down interface $i: "
+ if [ $REMOVE_NETWORK_CONF -eq 1 ]; then
+ rm -f ${NETWORK_CONF_DIR}/ifcfg-${i}
+ fi
+ done
+
+ [ $RC -ne 0 ] && echo "Please reboot the host." && exit 1
+ sleep 2
+ fi
+
+
+ if [ "${GEN1_UNLOAD_MODULES}" != "" ]; then
+ for mod in ${GEN1_UNLOAD_MODULES}
+ do
+ unload $mod "Please reboot the host."
+ done
+ fi
+}
+
+stop()
+{
+ # Check if applications which use infiniband are running
+ local apps="opensm osmtest ibbs ibns"
+ local pid
+
+ for app in $apps
+ do
+ if ( ps -ef | grep $app | grep -v grep > /dev/null 2>&1 ); then
+ echo
+ echo "Please stop $app and all applications running over InfiniBand"
+ echo "Then run \"$0 $ACTION\""
+ echo
+ exit 1
+ fi
+ done
+
+ # W/A for http://bugs.openfabrics.org/bugzilla/show_bug.cgi?id=2259
+ for bond in $(cat /sys/class/net/bonding_masters 2> /dev/null) ; do
+ if_type=$(cat /sys/class/net/$bond/type 2> /dev/null)
+ if [ $if_type -eq 32 ] ; then
+ for slave in $(cat /sys/class/net/$bond/bonding/slaves 2> /dev/null) ; do
+ echo -$slave > /sys/class/net/$bond/bonding/slaves
+ done
+ echo -$bond > /sys/class/net/bonding_masters
+ fi
+ done
+
+ # Check if open-iscsi is running and if there are open iSER sessions
+ if [ $(pidof iscsid | wc -w) -gt 0 ]; then
+ iser_session_cnt=$(iscsiadm -m session 2>&1 | grep -c "^iser")
+
+ if [ $iser_session_cnt -gt 0 ]; then
+ echo
+ # If it's RH4, open-iscsi must be stopped before openibd
+ if [[ -f /etc/redhat-release && $(grep -c "Red Hat Enterprise Linux AS release 4" /etc/redhat-release) -eq 1 ]]; then
+ echo "Please stop open-iscsi: /etc/init.d/iscsi stop"
+ else
+ echo "Please logout from all open-iscsi over iSER sessions"
+ fi
+ echo "Then run \"$0 $ACTION\""
+ echo
+ exit 1
+ fi
+ fi
+
+ # Stop Gen1 modules if they are UP after uninstall
+ if is_module ib_tavor; then
+ stop_gen1
+ fi
+
+ # Stop IPoIB HA daemon if running
+ if [ -f $ipoib_ha_pidfile ]; then
+ local line p
+ read line < $ipoib_ha_pidfile
+ for p in $line ; do
+ [ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && ipoib_ha_pids="$ipoib_ha_pids $p"
+ done
+ /bin/rm -f $ipoib_ha_pidfile
+ fi
+
+ if [ -n "${ipoib_ha_pids:-}" ]; then
+ kill -9 ${ipoib_ha_pids} > /dev/null 2>&1
+ mcastpid=$(pidof -x mcasthandle)
+ if [ -n "${mcastpid:-}" ]; then
+ kill -9 ${mcastpid} > /dev/null 2>&1
+ fi
+ fi
+
+ # Stop SRP HA daemon if running
+ if [ -f $srp_daemon_pidfile ]; then
+ local line p
+ read line < $srp_daemon_pidfile
+ for p in $line ; do
+ [ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && srp_daemon_pids="$srp_daemon_pids $p"
+ done
+ /bin/rm -f $srp_daemon_pidfile
+ fi
+
+ if [ -n "${srp_daemon_pids:-}" ]; then
+ kill -15 ${srp_daemon_pids} > /dev/null 2>&1
+ fi
+
+ if [ "X${SRPHA_ENABLE}" == "Xyes" ]; then
+ /bin/rm -f /etc/udev/rules.d/91-srp.rules > /dev/null 2>&1
+ mpath_pids=$(pidof -x multipath)
+ if [ -n "${mpath_pids:-}" ]; then
+ kill -9 ${mpath_pids} > /dev/null 2>&1
+ fi
+
+ if is_module ib_srp; then
+ for f in `/bin/ls /sys/class/scsi_host`
+ do
+ if [ -f /sys/class/scsi_host/$f/local_ib_port ]; then
+ for i in `/bin/ls -d /sys/class/scsi_host/$f/device/target*/*/block* | awk -F: '{print $NF}'`
+ do
+ mdev=`/sbin/scsi_id -g -s /block/$i 2> /dev/null`
+ if [ -n "${mdev}" ]; then
+ /sbin/multipath -f $mdev > /dev/null 2>&1
+ fi
+ done
+ fi
+ done
+ fi
+ fi
+
+ if [ -d /sys/class/infiniband_qlgc_vnic/ ]; then
+ if [ -x /etc/init.d/qlgc_vnic ]; then
+ /etc/init.d/qlgc_vnic stop 2>&1 1>/dev/null
+ fi
+ fi
+
+ # Unload modules
+ if [ "$UNLOAD_MODULES" != "" ]; then
+ for mod in $UNLOAD_MODULES
+ do
+ unload $mod
+ done
+ fi
+
+ # Unload mlx4_core
+ if is_module mlx4_core; then
+ is_ref mlx4_core
+ if [ $? -eq 0 ]; then
+ unload mlx4_core
+ elif is_module mlx4_en; then
+ # Unload mlx4_en if one or more of the following cases takes place:
+ # - No MLX4 eth devices present
+ # - mlx4_en module was not loaded by the openibd script
+ if (grep 0x15b3 /sys/class/net/eth*/device/vendor > /dev/null 2>&1) && [ "X$MLX4_EN_LOAD" != "Xyes" ]; then
+ echo "MLX4_EN module is loaded and in use."
+ echo "To unload MLX4_EN run: 'modprobe -r mlx4_en mlx4_core'"
+ else
+ unload mlx4_en
+ unload mlx4_core
+ fi
+ fi
+ fi
+
+ if [ -x /sbin/sysctl_perf_tuning ] && [ "X${RUN_SYSCTL}" == "Xyes" ]; then
+ /sbin/sysctl_perf_tuning unload
+ fi
+
+ /bin/rm -rf /dev/infiniband
+ echo_success $"Unloading HCA driver: "
+ sleep 1
+}
+
+status()
+{
+ local RC=0
+
+ if is_module ib_mthca || is_module mlx4_core || is_module ib_qib || is_module ib_ipath || is_module ib_ehca || is_module iw_cxgb3 || is_module iw_cxgb4 || is_module iw_nes; then
+ echo
+ echo " HCA driver loaded"
+ echo
+ else
+ echo
+ echo $"HCA driver is not loaded"
+ echo
+ fi
+
+ if is_module ib_ipoib; then
+ get_interfaces
+ if [ -n "$interfaces" ]; then
+ echo $"Configured IPoIB devices:"
+ echo $interfaces
+ echo
+ echo $"Currently active IPoIB devices:"
+
+ for i in $interfaces
+ do
+ if [[ ! -e ${WD}/ifcfg-${i} && ! -e ${NETWORK_CONF_DIR}/ifcfg-${i} ]]; then
+ continue
+ fi
+ echo `/sbin/ip -o link show $i | awk -F ": " '/UP>/ { print $2 }'`
+ RC=$?
+ done
+ fi
+ fi
+
+ if is_module mlx4_en; then
+ get_mlx4_en_interfaces
+ if [ -n "$mlx4_en_interfaces" ]; then
+ echo $"Configured MLX4_EN devices:"
+ echo $mlx4_en_interfaces
+ echo
+ echo $"Currently active MLX4_EN devices:"
+
+ for i in $mlx4_en_interfaces
+ do
+ echo `/sbin/ip -o link show $i | awk -F ": " '/UP>/ { print $2 }'`
+ done
+ fi
+ fi
+
+ echo
+
+ local cnt=0
+
+ for mod in $STATUS_MODULES
+ do
+ if is_module $mod; then
+ [ $cnt -eq 0 ] && echo "The following OFED modules are loaded:" && echo
+ let cnt++
+ echo " $mod"
+ fi
+ done
+
+ echo
+
+ return $RC
+}
+
+
+RC=0
+start_time=$(date +%s | tr -d '[:space:]')
+
+trap_handler()
+{
+ let run_time=$(date +%s | tr -d '[:space:]')-${start_time}
+
+ # Ask to wait for 5 seconds if trying to stop openibd
+ if [ $run_time -gt 5 ] && [ "$ACTION" == "stop" ]; then
+ printf "\nProbably some application are still using InfiniBand modules...\n"
+ else
+ printf "\nPlease wait ...\n"
+ fi
+ return 0
+}
+
+trap 'trap_handler' 2 9 15
+
+case $ACTION in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ stop
+ start
+ ;;
+ status)
+ status
+ ;;
+ *)
+ echo
+ echo "Usage: `basename $0` {start|stop|restart|status}"
+ echo
+ exit 1
+ ;;
+esac
+
+RC=$?
+exit $RC
--- /dev/null
+#! /bin/bash
+if [ -z $1 ]; then
+ echo "usage: $0 <interface> [2nd interface]"
+ exit 1
+fi
+CORES=$((`cat /proc/cpuinfo | grep processor | tail -1 | awk '{print $3}'`+1))
+hop=2
+
+if [ -z $2 ]; then
+ limit_1=$((2**CORES))
+ echo "---------------------------------------"
+ echo "Optimizing IRQs for Single port traffic"
+ echo "---------------------------------------"
+else
+ echo "-------------------------------------"
+ echo "Optimizing IRQs for Dual port traffic"
+ echo "-------------------------------------"
+ limit_1=$(( 2**$((CORES/2)) ))
+ limit_2=$((2**CORES))
+ IRQS_2=$(cat /proc/interrupts | grep $2 | awk '{print $1}' | sed 's/://')
+fi
+
+IRQS_1=$(cat /proc/interrupts | grep $1 | awk '{print $1}' | sed 's/://')
+
+if [ -z "$IRQS_1" ] ; then
+ echo No IRQs found for $1.
+else
+ echo Discovered irqs for $1: $IRQS_1
+ mask=1 ; for IRQ in $IRQS_1 ; do echo Assign irq $IRQ mask 0x$(printf "%x" $mask) ; echo $(printf "%x" $mask) > /proc/irq/$IRQ/smp_affinity ; mask=$(( mask * $hop)) ; if [ $mask -ge $limit_1 ] ; then mask=1; fi ;done
+fi
+
+echo
+
+if [ "$2" != "" ]; then
+ if [ -z "$IRQS_2" ]; then
+ echo No IRQs found for $1.
+ else
+ echo Discovered irqs for $2: $IRQS_2
+ mask=$limit_1 ; for IRQ in $IRQS_2 ; do echo Assign irq $IRQ mask 0x$(printf "%x" $mask) ; echo $(printf "%x" $mask) > /proc/irq/$IRQ/smp_affinity ; mask=$(( mask * $hop)) ; if [ $mask -ge $limit_2 ] ; then mask=$limit_1 ; fi ;done
+ fi
+fi
+echo
+echo done.
--- /dev/null
+#! /bin/bash
+if [ -z $1 ]; then
+ IRQS=$(cat /proc/interrupts | grep eth-mlx | awk '{print $1}' | sed 's/://')
+else
+ IRQS=$(cat /proc/interrupts | grep $1 | awk '{print $1}' | sed 's/://')
+fi
+
+for irq in $IRQS
+do
+ echo -n "$irq: "
+ cat /proc/irq/$irq/smp_affinity
+done
+
--- /dev/null
+#!/bin/bash
+#
+# Copyright (c) 2006 Mellanox Technologies. All rights reserved.
+#
+# This Software is licensed under one of the following licenses:
+#
+# 1) under the terms of the "Common Public License 1.0" a copy of which is
+# available from the Open Source Initiative, see
+# http://www.opensource.org/licenses/cpl.php.
+#
+# 2) under the terms of the "The BSD License" a copy of which is
+# available from the Open Source Initiative, see
+# http://www.opensource.org/licenses/bsd-license.php.
+#
+# 3) under the terms of the "GNU General Public License (GPL) Version 2" a
+# copy of which is available from the Open Source Initiative, see
+# http://www.opensource.org/licenses/gpl-license.php.
+#
+# Licensee has the right to choose one of the above licenses.
+#
+# Redistributions of source code must retain the above copyright
+# notice and one of the license notices.
+#
+# Redistributions in binary form must reproduce both the above copyright
+# notice, one of the license notices in the documentation
+# and/or other materials provided with the distribution.
+#
+
+# Save original sysctl values
+sysctl_orig=/var/cache/sysctl_perf_tuning
+
+load()
+{
+ if [ -f $sysctl_orig ]; then
+ /bin/rm -f $sysctl_orig
+ fi
+
+ umask 022
+ touch $sysctl_orig
+ /sbin/sysctl net.ipv4.tcp_timestamps >> $sysctl_orig
+ /sbin/sysctl net.ipv4.tcp_sack >> $sysctl_orig
+ /sbin/sysctl net.core.netdev_max_backlog >> $sysctl_orig
+ /sbin/sysctl net.core.rmem_max >> $sysctl_orig
+ /sbin/sysctl net.core.wmem_max >> $sysctl_orig
+ /sbin/sysctl net.core.rmem_default >> $sysctl_orig
+ /sbin/sysctl net.core.wmem_default >> $sysctl_orig
+ /sbin/sysctl net.core.optmem_max >> $sysctl_orig
+ /sbin/sysctl net.ipv4.tcp_rmem >> $sysctl_orig
+ /sbin/sysctl net.ipv4.tcp_wmem >> $sysctl_orig
+
+ /sbin/sysctl -q -w net.ipv4.tcp_timestamps=0
+ /sbin/sysctl -q -w net.ipv4.tcp_sack=0
+ /sbin/sysctl -q -w net.core.netdev_max_backlog=250000
+ /sbin/sysctl -q -w net.core.rmem_max=16777216
+ /sbin/sysctl -q -w net.core.wmem_max=16777216
+ /sbin/sysctl -q -w net.core.rmem_default=16777216
+ /sbin/sysctl -q -w net.core.wmem_default=16777216
+ /sbin/sysctl -q -w net.core.optmem_max=16777216
+ /sbin/sysctl -q -w net.ipv4.tcp_rmem="4096 87380 16777216"
+ /sbin/sysctl -q -w net.ipv4.tcp_wmem="4096 65536 16777216"
+}
+
+unload()
+{
+ if [ ! -f $sysctl_orig ]; then
+ return
+ fi
+
+ /sbin/sysctl -q -p $sysctl_orig
+ /bin/rm -f $sysctl_orig
+}
+
+$1
--- /dev/null
+# Copyright (c) 2010 QLogic Corporation.
+# All rights reserved.
+#
+# 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
+# OpenIB.org 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.
+#
+# 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.
+
+# This script does truescale (qib) adapter-specific actions, and is
+# sourced from the /etc/init.d/openibd script after the ib_qib module
+# is loaded, and before it is unloaded, and is passed the corresponding
+# start and stop arguments. It isn't intended for standalone use.
+
+# base name in /sys/class
+qb=/sys/class/infiniband/qib
+ir=/proc/irq
+serdes_parm=txselect
+
+warn_and_log()
+{
+ echo "$0: $@"
+ logger -t infinipath "$@"
+}
+
+setup_qmh()
+{
+ local -i nunit=0 bay bl2xB=0 full=0
+ local parmf sysinfo bayinfo mez1bus mez2bus mez3bus=0 tbay
+ local -a parm bay_h1
+ for parm in parameters/${serdes_parm} ${serdes_parm}; do
+ if [ -e /sys/module/ib_qib/$parm ]; then
+ parmf=/sys/module/ib_qib/$parm
+ break;
+ fi
+ done
+ if [ ! "$parmf" ]; then
+ warn_and_log Unable to find ${serdes_parm} parameter
+ return
+ fi
+ sysinfo="$(PATH=/sbin:/usr/sbin:$PATH; dmidecode -t system | \
+ sed -e '/^Handle/d' -e '/^[ \t]*$/d' -e 's/[ \t]*$//' )"
+ if [ ! "$sysinfo" ]; then
+ warn_and_log Unable to determine system type
+ return
+ fi
+ bayinfo="$(PATH=/sbin:/usr/sbin:$PATH; dmidecode -t 204)"
+ if [ ! "$bayinfo" ]; then
+ warn_and_log Unable to determine bay
+ return
+ fi
+ case "${bayinfo}" in
+ *Server*Bay:*) tbay=$(PATH=/sbin:/usr/sbin:$PATH; dmidecode -t 204 | \
+ sed -n -e 's/[ \t]*$//' -e 's/[ \t]*Server Bay:[ \t]*//p') ;;
+ *) tbay=$(PATH=/sbin:/usr/sbin:$PATH; dmidecode -t 204 | \
+ sed -n -e '1,/BladeSystem/d' -e 's/ *$//' -e 's/^\t\t*//' \
+ -e '/^[0-9][AB]*$/p' -e '/^[0-9][0-9][AB]*$/p') ;;
+ esac
+
+ read pbase < $parmf
+ parm=($(echo ${qb}*))
+ nunit=${#parm[*]}
+
+ # [0] is a dummy in these arrays, bay #'ing starts at 1
+ # H1 value, per bay (same for both ports)
+ m1_bay_h1=(0 8 7 7 7 7 6 6 6 8 7 7 7 7 6 6 7)
+ m2_bay_h1=(0 11 11 11 11 11 11 10 11 11 11 11 11 10 10 10 10)
+ m3_bay_h1=(0 11 11 11 11 10 10 10 10)
+
+ # tx serdes index per bay for mez1 (either port)
+ mez1p1_idx=(0 2 2 17 17 17 1 1 1 2 1 17 17 16 2 18 16)
+ # tx serdes setting for mez1 p2 (only used on full-height blades)
+ mez1p2_idx=(0 4 4 3 3 3 2 4 4)
+ # tx serdes index per bay for mez2 port 1
+ mez2p1_idx=(0 2 2 17 17 17 1 1 1 2 1 17 17 16 2 18 1)
+ # tx serdes index per bay for mez2 port 2
+ mez2p2_idx=(0 2 2 19 1 1 1 1 1 2 1 18 17 1 19 1 1)
+ # tx serdes index per bay for mez3 port 1 (mez3 only on full-height blades)
+ mez3p1_idx=(0 2 1 18 17 1 19 1 1)
+ # tx serdes index per bay for mez3 port 2 (mez3 only on full-height blades)
+ mez3p2_idx=(0 2 1 17 17 16 2 18 1)
+
+ case "${sysinfo}" in
+ *BL280[cC]*) mez1bus=3 mez2bus=6 bay=$tbay ;;
+ # both nodes on the 2x220 blade have bus 3, only one mez, but
+ # they connect to different switches through different paths
+ # so A and B have different parameters. They connect to
+ # the switch as if they were the mez2 on other blade types,
+ # with port 1 on mez2 for A node and port 2 on mez2
+ # for the B node
+ *BL2x220[cC]*)
+ mez1bus=3 mez2bus=3 bay=${tbay%[AB]}
+ case "${tbay}" in
+ *A) bl2xB=${mez2p1_idx[$bay]} ;;
+ *B) bl2xB=${mez2p2_idx[$bay]} ;;
+ esac
+ ;;
+ *BL460[cC]*) mez1bus=6 mez2bus=9 bay=$tbay ;;
+ *BL465[cC]*) mez1bus=5 mez2bus=8 bay=$tbay ;;
+ *BL490[cC]*) mez1bus=6 mez2bus=7 bay=$tbay ;;
+ *BL685[cC]*) mez1bus=41 mez2bus=6 mez3bus=44 full=1 bay=$(($tbay % 9)) ;;
+ *) warn_and_log Unknown blade type "$sysinfo"
+ return ;;
+ esac
+
+ # mez1 only has port1 connected, mez2, mez3 can have both ports
+
+ # If only one card, and two mez possible, we have to figure out which
+ # mez we are plugged into.
+ # On RHEL4U8, we look in the driver subdir, all others
+ # in the device/driver subdir for the pcie bus.
+ pciprefix="[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]:"
+ if [ ${bl2xB} -ne 0 ]; then
+ pbase="${pbase} 0,1=${bl2xB},${m2_bay_h1[$bay]}"
+ else while [ $nunit -ne 0 ]; do
+ (( nunit-- ))
+ buspath=$(readlink -m ${qb}${nunit}/device)
+ if [ -n "$(echo ${buspath} | grep "${pciprefix}$(printf "%02d" ${mez1bus}):")" ]; then
+ pbase="${pbase} ${nunit},1=${mez1p1_idx[$bay]},${m1_bay_h1[$bay]}"
+ if [ ${full} -eq 1 ]; then
+ pbase="${pbase} ${nunit},2=${mez1p2_idx[$bay]},${m1_bay_h1[$bay]}"
+ fi
+ elif [ -n "$(echo ${buspath} | grep "${pciprefix}$(printf "%02d" ${mez2bus}):")" ]; then
+ pbase="${pbase} ${nunit},1=${mez2p1_idx[$bay]},${m2_bay_h1[$bay]}"
+ pbase="${pbase} ${nunit},2=${mez2p2_idx[$bay]},${m2_bay_h1[$bay]}"
+ elif [ -n "$(echo ${buspath} | grep "${pciprefix}$(printf "%02d" ${mez3bus}):")" ]; then
+ pbase="${pbase} ${nunit},1=${mez3p1_idx[$bay]},${m3_bay_h1[$bay]}"
+ pbase="${pbase} ${nunit},2=${mez3p2_idx[$bay]},${m3_bay_h1[$bay]}"
+ else
+ warn_and_log Mismatch on mezbus ${mez1_bus},${mez2_bus},${mez3_bus} \
+ and unit ${nunit}, no serdes setup
+ fi
+ done
+ fi
+ echo -n ${pbase} > $parmf
+}
+
+
+
+setup_qme()
+{
+ local parm parmf sn pbase
+ local -i nunit=0 bay idx
+ for parm in parameters/${serdes_parm} ${serdes_parm}; do
+ if [ -e /sys/module/ib_qib/$parm ]; then
+ parmf=/sys/module/ib_qib/$parm
+ break;
+ fi
+ done
+ if [ ! "$parmf" ]; then
+ warn_and_log Unable to find ${serdes_parm} parameter
+ return
+ fi
+
+ read pbase < $parmf
+ parm=( $(echo ${qb}*) )
+ nunit=${#parm[*]}
+
+ # we get two serial numbers normally, use 2nd if present, else first
+ sn="$(dmidecode -t 2 | grep -i serial | tail -1)"
+ case ${sn} in
+ *[sS]erial\ [nN]umber*)
+ bay="$(echo $sn | sed -e 's/\.$//' -e 's/.*\.0*//')"
+ case $bay in
+ 1) idx=22 ;;
+ 2|10|15) idx=20 ;;
+ 3|7|11|12|13|14) idx=26 ;;
+ 4) idx=25 ;;
+ 5|6) idx=24 ;;
+ 8) idx=21 ;;
+ 9|16) idx=23 ;;
+ *) warn_and_log Unexpected QME7342 bay info: ${sn}, no Tx params
+ return;;
+ esac
+ # H1 is same for all QME bays, so no need to specify.
+ while [ $nunit -ne 0 ]; do
+ (( nunit-- ))
+ pbase="${pbase} ${nunit},1=${idx} ${nunit},2=${idx}"
+ done
+ echo -n ${pbase} > $parmf
+ ;;
+ *) warn_and_log No QME7342 bay information, no Tx params
+ return;;
+ esac
+}
+
+get_localcpus()
+{
+ local filename=${1} cpulist= perl= cpus=
+
+ perl=$(which perl 2>/dev/null)
+ [ ! ${perl} ] && return
+
+ if [ -f ${filename} ]; then
+ cpus=$(cat ${filename} | sed -e 's/,//g')
+ cpulist=$(${perl} -e '$a=0x'${cpus}';$b=0;while($a){if($a&0x1){print "$b ";}$b++;$a>>=1;}')
+ echo "${cpulist}"
+ fi
+}
+
+set_irq_affinity()
+{
+ local -a irqs cpulist
+ local -i nunits=0 idx=1 unit=0 firstcore=1 irq=0 balance=0 \
+ minor=0 is_el6=0
+ local cpus= mask= pcibus= irqtype= kver=
+
+ kver=$(uname -r | sed -re 's/([0-9]*\.[0-9]*\.[0-9]*).*/\1/g')
+ minor=$(echo ${kver} | cut -d. -f3)
+ [ -n "$(uname -r | grep ${kver}'.*el6.*')" ] && is_el6=1
+ [ -n "$(ps aux | grep irqbalance | grep -v grep | awk '{print $2}')" ] && \
+ balance=1
+
+ if [[ ${balance} -eq 0 ]] && \
+ [[ ${minor} -ge 36 || ${is_el6} -eq 1 ]]; then
+ # irqbalance is off and we are running on a kernel which
+ # supports the irq affinity hint
+ irqs=$(grep 'ib_qib' /proc/interrupts | sed -re 's/([0-9]*):.*/\1/g')
+ for irq in ${irqs}; do
+ if [ -e ${ir}/${irq}/affinity_hint ]; then
+ mask=$(cat ${ir}/${irq}/affinity_hint)
+ echo ${mask} > ${ir}/${irq}/smp_affinity
+ fi
+ done
+ else
+ nunits=$(ls -1d ${qb}* | wc -l)
+ for ((unit=0 ; ${unit}<${nunits} ; unit++ )); do
+ pcibus=$(readlink -m ${qb}${unit}/device)
+ if [ -f ${pcibus}/local_cpulist ]; then
+ cpulist=( $(seq $(cat ${pcibus}/local_cpulist | \
+ sed -e 's/-/\ /g')) )
+ elif [ -f ${pcibus}/local_cpus ]; then
+ cpulist=( $(get_localcpus ${pcibus}/local_cpus) )
+ else
+ cpulist=( $(get_localcpus $(dirname ${pcibus})/local_cpus) )
+ fi
+ if [ ${#cpulist[*]} -eq 0 -o ${#cpulist[*]} -eq $(grep -c processor /proc/cpuinfo) ]; then
+ cpulist=( $(get_localcpus /sys/devices/system/cpu/cpu0/topology/core_siblings) )
+ if [ ${#cpulist[*]} -eq 0 ]; then
+ warn_and_log Could not find local CPUs for Unit${unit}.
+ continue
+ fi
+ fi
+
+ idx=${firstcore}
+ irqs=$(grep 'ib_qib'${unit} /proc/interrupts)
+ echo "${irqs}" | while read L; do
+ irq=$(echo ${L} | sed -re 's/([0-9]*):.*/\1/g')
+ irqtype=$(echo ${L} | \
+ sed -re 's/.*ib_qib[0-9]*\ ?\(?([A-Za-z0-9]*)?.*?\)?.*?/\1/g')
+ if [ X${irqtype} == Xkctx ]; then
+ mask=$(( 2 ** ${cpulist[${idx}]} ))
+ (( idx++ ))
+ [ ${idx} -gt $(( ${#cpulist[*]}-${firstcore} )) ] && \
+ idx=${firstcore}
+ else
+ mask=$(( 2 ** ${cpulist[0]} ))
+ fi
+ printf "%x" ${mask} > ${ir}/${irq}/smp_affinity
+ done
+ done
+ fi
+
+ return
+}
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin:$PATH
+
+case "$1" in
+start)
+ has_qmh7342=$(grep QMH7342 ${qb}*/hca_type 2>/dev/null)
+ if [ "${has_qmh7342}" ]; then
+ setup_qmh
+ else
+ has_qme7342=$(grep QME7342 ${qb}*/hca_type 2>/dev/null)
+ if [ "${has_qme7342}" ]; then
+ setup_qme
+ fi
+ fi
+
+ umount /ipathfs >/dev/null 2>&1
+ rm -rf /ipathfs
+ mkdir -p -m 755 /ipathfs 2>&1
+ mount -t ipathfs none /ipathfs
+
+ # make sure /dev/ipath files get created with correct permissions
+ if [ ! -c /dev/ipath ]; then sleep 2; fi
+ if [ ! -c /dev/ipath ]; then sleep 3; fi
+ chmod 666 /dev/ipath /dev/ipath[0-9]* >/dev/null 2>&1
+
+ set_irq_affinity
+ ;;
+stop)
+ if [ -d /ipathfs ]; then
+ umount /ipathfs
+ rmdir /ipathfs
+ fi
+ ;;
+esac
--- /dev/null
+Documentation/infiniband/
+drivers/base/attribute_container.c
+drivers/base/transport_class.c
+drivers/infiniband/
+drivers/net/ethernet/chelsio/cxgb3/
+drivers/net/ethernet/chelsio/cxgb4/
+drivers/net/ethernet/mellanox/mlx4/
+drivers/scsi/iscsi_tcp.c
+drivers/scsi/iscsi_tcp.h
+drivers/scsi/libiscsi.c
+drivers/scsi/scsi_transport_iscsi.c
+fs/exportfs/
+fs/lockd/
+fs/nfs/
+fs/nfs_common/
+fs/nfsd/
+include/linux/mlx4/
+include/rdma/
+include/scsi/srp.h
+kernel/kfifo.c
+lib/klist.c
+net/rds/
+include/linux/rds.h
+net/sunrpc/