diff --git a/iscsi-scst/Makefile b/iscsi-scst/Makefile index 1df57d882..d1969de05 100644 --- a/iscsi-scst/Makefile +++ b/iscsi-scst/Makefile @@ -100,12 +100,15 @@ else endif endif +CREATE_CQ_FLAG = $(shell $(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd)/conftest/create_cq PRE_CFLAGS="$(OFED_CFLAGS) -Werror" >/dev/null 2>&1 && echo -DIB_CREATE_CQ_HAS_INIT_ATTR) +PRE_CFLAGS=$(OFED_CFLAGS) $(CREATE_CQ_FLAG) -DOFED_FLAVOR=$(OFED_FLAVOR) + mods: Modules.symvers Module.symvers $(MAKE) -C $(KDIR) SCST_INC_DIR=$(SCST_INC_DIR) SUBDIRS=$(KMOD) modules if $(INFINIBAND_ENABLED); then \ echo " Building against $(OFED_FLAVOR) InfiniBand kernel headers."; \ $(MAKE) -C $(KDIR) SCST_INC_DIR=$(SCST_INC_DIR) SUBDIRS=$(ISERTMOD) \ - PRE_CFLAGS="$(OFED_CFLAGS) -DOFED_FLAVOR=$(OFED_FLAVOR)" \ + PRE_CFLAGS="$(PRE_CFLAGS)" \ KBUILD_EXTRA_SYMBOLS=$(ISER_SYMVERS) modules; \ fi diff --git a/iscsi-scst/conftest/create_cq/Makefile b/iscsi-scst/conftest/create_cq/Makefile new file mode 100644 index 000000000..d7ada9b0a --- /dev/null +++ b/iscsi-scst/conftest/create_cq/Makefile @@ -0,0 +1,3 @@ +LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE) + +obj-m += create_cq.o diff --git a/iscsi-scst/conftest/create_cq/create_cq.c b/iscsi-scst/conftest/create_cq/create_cq.c new file mode 100644 index 000000000..86fce929e --- /dev/null +++ b/iscsi-scst/conftest/create_cq/create_cq.c @@ -0,0 +1,13 @@ +#include +#include + +static int modinit(void) +{ + struct ib_cq *q; + + q = ib_create_cq(NULL, NULL, NULL, NULL, NULL); + + return q != 0; +} + +module_init(modinit); diff --git a/iscsi-scst/kernel/isert-scst/iser_rdma.c b/iscsi-scst/kernel/isert-scst/iser_rdma.c index 08050a221..3b48f5bea 100644 --- a/iscsi-scst/kernel/isert-scst/iser_rdma.c +++ b/iscsi-scst/kernel/isert-scst/iser_rdma.c @@ -963,7 +963,7 @@ static struct isert_device *isert_device_create(struct ib_device *ib_dev) goto fail_cq; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0) +#ifndef IB_CREATE_CQ_HAS_INIT_ATTR cq = ib_create_cq(ib_dev, isert_cq_comp_handler, isert_async_evt_handler,