From 007e3dfbbf0ad158be27c1b4ee30865522041414 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 10 Jun 2014 14:16:14 +0000 Subject: [PATCH] ib_srpt: Make the test for IB_EVENT_GID_CHANGE support more robust git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5577 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- srpt/Makefile | 4 +++- srpt/conftest/gid_change/Makefile | 1 + srpt/conftest/gid_change/gid_change.c | 9 +++++++++ srpt/src/ib_srpt.h | 7 +------ 4 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 srpt/conftest/gid_change/Makefile create mode 100644 srpt/conftest/gid_change/gid_change.c diff --git a/srpt/Makefile b/srpt/Makefile index a97d930df..8453081f1 100644 --- a/srpt/Makefile +++ b/srpt/Makefile @@ -78,10 +78,12 @@ 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) +AUTOCONF_FLAGS=$(shell $(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd)/conftest/gid_change PRE_CFLAGS="$(OFED_CFLAGS)" >&/dev/null && 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)" SCST_INC_DIR=$(SCST_INC_DIR) modules install: all src/ib_srpt.ko $(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd)/src \ 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/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