From 68489e57f9a93e5213597a8ea2676e0ad5ae235b Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Wed, 11 Jun 2014 14:33:30 +0000 Subject: [PATCH] ib_srpt: Merge build and login fixes from trunk git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/3.0.x@5580 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- srpt/Makefile | 18 ++++++++++-------- srpt/conftest/gid_change/Makefile | 1 + srpt/conftest/gid_change/gid_change.c | 9 +++++++++ srpt/conftest/kcflags/Makefile | 1 + srpt/conftest/kcflags/kcflags.c | 8 ++++++++ srpt/conftest/pre_cflags/Makefile | 1 + srpt/conftest/pre_cflags/pre_cflags.c | 8 ++++++++ srpt/src/ib_srpt.c | 16 +++++++++++++--- srpt/src/ib_srpt.h | 7 +------ 9 files changed, 52 insertions(+), 17 deletions(-) create mode 100644 srpt/conftest/gid_change/Makefile create mode 100644 srpt/conftest/gid_change/gid_change.c create mode 100644 srpt/conftest/kcflags/Makefile create mode 100644 srpt/conftest/kcflags/kcflags.c create mode 100644 srpt/conftest/pre_cflags/Makefile create mode 100644 srpt/conftest/pre_cflags/pre_cflags.c diff --git a/srpt/Makefile b/srpt/Makefile index a97d930df..88af0f4f3 100644 --- a/srpt/Makefile +++ b/srpt/Makefile @@ -78,10 +78,15 @@ OFED_SRPT_PATH:=/lib/modules/$(KVER)/updates/kernel/drivers/infiniband/ulp/srpt/ # Whether or not the OFED ib_srpt.ko kernel module has been installed. OFED_SRPT_INSTALLED:=$(shell if [ -e $(OFED_SRPT_PATH) ]; then echo true; else echo false; fi) +HAVE_KCFLAGS = $(shell $(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd)/conftest/kcflags KCFLAGS=-DKCFLAGS_MACRO=1 >/dev/null 2>&1 && echo true || echo false) +HAVE_PRE_CFLAGS = $(shell $(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd)/conftest/pre_cflags PRE_CFLAGS=-DPRE_CFLAGS_MACRO=1 >/dev/null 2>&1 && echo true || echo false) +AUTOCONF_FLAGS = $(shell $(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd)/conftest/gid_change PRE_CFLAGS="$(OFED_CFLAGS)" >/dev/null 2>&1 && echo -DHAVE_IB_EVENT_GID_CHANGE) + all: src/$(MODULE_SYMVERS) $(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd)/src \ - PRE_CFLAGS="$(OFED_CFLAGS)" SCST_INC_DIR=$(SCST_INC_DIR) modules + PRE_CFLAGS="$(OFED_CFLAGS) $(AUTOCONF_FLAGS)" \ + KCFLAGS="$(AUTOCONF_FLAGS)" SCST_INC_DIR=$(SCST_INC_DIR) modules install: all src/ib_srpt.ko $(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd)/src \ @@ -93,6 +98,10 @@ 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 \ + echo "Error: the kernel build system has not yet been patched.";\ + false; \ + fi @if [ -n "$(OFED_KERNEL_IB_RPM)" ]; then \ if [ -z "$(OFED_KERNEL_IB_DEVEL_RPM)" ]; then \ echo "Error: the OFED package $(OFED_KERNEL_IB_RPM)-devel has" \ @@ -107,13 +116,6 @@ 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 [ -e $(KDIR)/scripts/Makefile.lib ] \ - && ! grep -wq '^c_flags .*PRE_CFLAGS' \ - $(KDIR)/scripts/Makefile.lib \ - && ! grep -wq '^LINUXINCLUDE .*PRE_CFLAGS' \ - $(KDIR)/Makefile; then \ - echo "Error: the kernel build system has not yet been patched.";\ - false; \ else \ echo " Building against $(OFED_KERNEL_IB_RPM) InfiniBand" \ "kernel headers."; \ diff --git a/srpt/conftest/gid_change/Makefile b/srpt/conftest/gid_change/Makefile new file mode 100644 index 000000000..e81c05753 --- /dev/null +++ b/srpt/conftest/gid_change/Makefile @@ -0,0 +1 @@ +obj-m += gid_change.o diff --git a/srpt/conftest/gid_change/gid_change.c b/srpt/conftest/gid_change/gid_change.c new file mode 100644 index 000000000..bb60773fb --- /dev/null +++ b/srpt/conftest/gid_change/gid_change.c @@ -0,0 +1,9 @@ +#include +#include + +static int modinit(void) +{ + return IB_EVENT_GID_CHANGE; +} + +module_init(modinit); diff --git a/srpt/conftest/kcflags/Makefile b/srpt/conftest/kcflags/Makefile new file mode 100644 index 000000000..59e12dda0 --- /dev/null +++ b/srpt/conftest/kcflags/Makefile @@ -0,0 +1 @@ +obj-m += kcflags.o diff --git a/srpt/conftest/kcflags/kcflags.c b/srpt/conftest/kcflags/kcflags.c new file mode 100644 index 000000000..fff6e202f --- /dev/null +++ b/srpt/conftest/kcflags/kcflags.c @@ -0,0 +1,8 @@ +#include + +static int modinit(void) +{ + return KCFLAGS_MACRO; +} + +module_init(modinit); diff --git a/srpt/conftest/pre_cflags/Makefile b/srpt/conftest/pre_cflags/Makefile new file mode 100644 index 000000000..3c8c550f2 --- /dev/null +++ b/srpt/conftest/pre_cflags/Makefile @@ -0,0 +1 @@ +obj-m += pre_cflags.o diff --git a/srpt/conftest/pre_cflags/pre_cflags.c b/srpt/conftest/pre_cflags/pre_cflags.c new file mode 100644 index 000000000..1602d7115 --- /dev/null +++ b/srpt/conftest/pre_cflags/pre_cflags.c @@ -0,0 +1,8 @@ +#include + +static int modinit(void) +{ + return PRE_CFLAGS_MACRO; +} + +module_init(modinit); diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index 62acead56..a322d2a9c 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -1938,9 +1938,11 @@ static void srpt_process_send_completion(struct ib_cq *cq, } else if (opcode == SRPT_RDMA_READ_LAST || opcode == SRPT_RDMA_WRITE_LAST) { PRINT_INFO("RDMA t %d for idx %u failed with status %d." + "%s", opcode, index, wc->status, + wc->status == IB_WC_WR_FLUSH_ERR ? " If this has not been triggered by a cable" " pull, please check the involved IB HCA's" - " and cables.", opcode, index, wc->status); + " and cables." : ""); srpt_handle_rdma_err_comp(ch, ch->ioctx_ring[index], opcode, srpt_xmt_rsp_context); } else if (opcode == SRPT_RDMA_ZEROLENGTH_WRITE) { @@ -2057,6 +2059,16 @@ static int srpt_compl_thread(void *arg) ch = arg; BUG_ON(!ch); + while (ch->state < CH_LIVE) { + set_current_state(TASK_INTERRUPTIBLE); + if (srpt_process_completion(ch, poll_budget) >= poll_budget) + cond_resched(); + else + schedule(); + } + + srpt_process_wait_list(ch); + while (ch->state < CH_DISCONNECTED) { set_current_state(TASK_INTERRUPTIBLE); if (srpt_process_completion(ch, poll_budget) >= poll_budget) @@ -2247,9 +2259,7 @@ static void __srpt_close_all_ch(struct srpt_tgt *srpt_tgt) struct srpt_nexus *nexus; struct srpt_rdma_ch *ch; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32) lockdep_assert_held(&srpt_tgt->mutex); -#endif list_for_each_entry(nexus, &srpt_tgt->nexus_list, entry) { list_for_each_entry(ch, &nexus->ch_list, list) { diff --git a/srpt/src/ib_srpt.h b/srpt/src/ib_srpt.h index 6596c0634..0e30e16ea 100644 --- a/srpt/src/ib_srpt.h +++ b/srpt/src/ib_srpt.h @@ -142,12 +142,7 @@ enum { }; #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0) && \ - !(defined(CONFIG_SUSE_KERNEL) && \ - LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 76)) && \ - !(defined(RHEL_MAJOR) && \ - (RHEL_MAJOR -0 > 6 || \ - RHEL_MAJOR -0 == 6 && RHEL_MINOR -0 >= 5 || \ - RHEL_MAJOR -0 == 5 && RHEL_MINOR -0 >= 9)) + !defined(HAVE_IB_EVENT_GID_CHANGE) /* See also patch "IB/core: Add GID change event" (commit 761d90ed4). */ enum { IB_EVENT_GID_CHANGE = 18 }; #endif