From 37ef0a30ee68f4a2a0a8d373dd687124aca87589 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Fri, 13 Jun 2014 06:59:13 +0000 Subject: [PATCH] ib_srpt: Merge from trunk git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/3.0.x@5599 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- srpt/LICENSE | 3 +-- srpt/Makefile | 39 +++++++++++++++++++++++---------------- srpt/README | 3 ++- srpt/src/ib_srpt.c | 4 ++-- 4 files changed, 28 insertions(+), 21 deletions(-) diff --git a/srpt/LICENSE b/srpt/LICENSE index 7dd67d52b..bfaa85cb7 100644 --- a/srpt/LICENSE +++ b/srpt/LICENSE @@ -40,6 +40,5 @@ is the GNU Public License: GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. diff --git a/srpt/Makefile b/srpt/Makefile index 88af0f4f3..4a4c2efd4 100644 --- a/srpt/Makefile +++ b/srpt/Makefile @@ -48,27 +48,30 @@ MODULE_SYMVERS:=$(shell if [ -e $(KDIR)/Module.symvers ]; then \ echo Module.symvers; else echo Modules.symvers; fi) # Name of the OFED kernel RPM. -OFED_KERNEL_IB_RPM:=$(shell for r in kernel-ib mlnx-ofa_kernel compat-rdma; do rpm -q $$r 2>/dev/null | grep -q "^$$r" && echo $$r && break; done) +OFED_KERNEL_IB_RPM:=$(shell for r in mlnx-ofa_kernel compat-rdma kernel-ib; do rpm -q $$r 2>/dev/null | grep -q "^$$r" && echo $$r && break; done) # Name of the OFED kernel development RPM. -OFED_KERNEL_IB_DEVEL_RPM:=$(shell for r in kernel-ib-devel mlnx-ofa_kernel-devel compat-rdma-devel; do rpm -q $$r 2>/dev/null | grep -q "^$$r" && echo $$r && break; done) +OFED_KERNEL_IB_DEVEL_RPM:=$(shell for r in mlnx-ofa_kernel-devel compat-rdma-devel kernel-ib-devel; do rpm -q $$r 2>/dev/null | grep -q "^$$r" && echo $$r && break; done) -ifeq ($(OFED_KERNEL_IB_RPM),kernel-ib) +OFED_FLAVOR=$(shell /usr/bin/ofed_info 2>/dev/null | head -n1 | sed -n 's/^MLNX_OFED.*/MOFED/p;s/^OFED-.*/OFED/p') + +ifneq ($(OFED_KERNEL_IB_RPM),) +ifeq ($(OFED_KERNEL_IB_RPM),compat-rdma) +# OFED 3.x +OFED_KERNEL_DIR:=/usr/src/compat-rdma +OFED_CFLAGS:=-I$(OFED_KERNEL_DIR)/include +else OFED_KERNEL_DIR:=/usr/src/ofa_kernel -# Read OFED 1.x's config.mk, which contains the definition of the variable -# BACKPORT_INCLUDES. +ifeq ($(OFED_FLAVOR),MOFED) +# Mellanox OFED with or without kernel-ib RPM +OFED_CFLAGS:=-I$(OFED_KERNEL_DIR)/include +else +# OFED 1.5 include $(OFED_KERNEL_DIR)/config.mk OFED_CFLAGS:=$(BACKPORT_INCLUDES) -I$(OFED_KERNEL_DIR)/include endif -ifeq ($(OFED_KERNEL_IB_RPM),mlnx-ofa_kernel) -OFED_KERNEL_DIR:=/usr/src/ofa_kernel/default -OFED_CFLAGS:=-I$(OFED_KERNEL_DIR)/default/include endif -ifeq ($(OFED_KERNEL_IB_RPM),compat-rdma) -OFED_KERNEL_DIR:=/usr/src/compat-rdma -OFED_CFLAGS:=-I$(OFED_KERNEL_DIR)/include -endif -ifneq ($(OFED_KERNEL_IB_RPM),) +# Any OFED version OFED_MODULE_SYMVERS:=$(OFED_KERNEL_DIR)/Module.symvers endif @@ -98,7 +101,8 @@ uninstall: -/sbin/depmod -b $(INSTALL_MOD_PATH)/ -a $(KVER) src/Module.symvers src/Modules.symvers: $(SCST_SYMVERS_DIR)/$(MODULE_SYMVERS) - @if [ $(HAVE_KCFLAGS) = false -a $(HAVE_PRE_CFLAGS) = false ]; then \ + @if [ "$(HAVE_KCFLAGS)" = false -a "$(HAVE_PRE_CFLAGS)" = false -a \ + -n "$(AUTOCONF_FLAGS)" ]; then \ echo "Error: the kernel build system has not yet been patched.";\ false; \ fi @@ -116,9 +120,12 @@ src/Module.symvers src/Modules.symvers: $(SCST_SYMVERS_DIR)/$(MODULE_SYMVERS) echo "Error: OFED has been built with srpt=y in ofed.conf."; \ echo "Rebuild OFED with srpt=n."; \ false; \ + elif [ "$(HAVE_PRE_CFLAGS)" = false ]; then \ + echo "Error: the kernel build system has not yet been patched.";\ + false; \ else \ - echo " Building against $(OFED_KERNEL_IB_RPM) InfiniBand" \ - "kernel headers."; \ + echo " Building against $(OFED_FLAVOR) $(OFED_KERNEL_IB_RPM)" \ + "InfiniBand kernel headers."; \ ( \ grep -v drivers/infiniband/ $<; \ cat $(OFED_MODULE_SYMVERS) \ diff --git a/srpt/README b/srpt/README index f5940962c..ae06ffd62 100644 --- a/srpt/README +++ b/srpt/README @@ -50,7 +50,8 @@ The ib_srpt kernel module supports the following parameters: Mode (1) is choosen if both one_target_per_port and use_node_guid_in_target_name are false. Mode (2) is choosen if one_target_per_port is false and use_node_guid_in_target_name is true. Mode - (3) is choosen if one_target_per_port is true. + (3) is choosen if one_target_per_port is true. This last mode is the + default mode. * rdma_cm_port (number) A 16-bit number that specifies the port number to be registered via the RDMA/CM. Must be specified to make communication over RoCE or iWARP diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index a322d2a9c..807485476 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -151,9 +151,9 @@ MODULE_PARM_DESC(use_node_guid_in_target_name, #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31) \ || defined(RHEL_MAJOR) && RHEL_MAJOR -0 <= 5 -static int one_target_per_port; +static int one_target_per_port = true; #else -static bool one_target_per_port; +static bool one_target_per_port = true; #endif module_param(one_target_per_port, bool, 0444); MODULE_PARM_DESC(one_target_per_port,