diff --git a/iscsi-scst/kernel/isert-scst/iser_rdma.c b/iscsi-scst/kernel/isert-scst/iser_rdma.c index a7dae9a56..f56ef3286 100644 --- a/iscsi-scst/kernel/isert-scst/iser_rdma.c +++ b/iscsi-scst/kernel/isert-scst/iser_rdma.c @@ -35,6 +35,7 @@ */ #include +#include #include #include #include @@ -870,12 +871,26 @@ static struct isert_device *isert_device_create(struct ib_device *ib_dev) goto fail_cq; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0) cq = ib_create_cq(ib_dev, isert_cq_comp_handler, isert_async_evt_handler, cq_desc, /* context */ cqe_num, i); /* completion vector */ +#else + { + struct ib_cq_init_attr ia = { + .cqe = cqe_num, + .comp_vector = i, + }; + cq = ib_create_cq(ib_dev, + isert_cq_comp_handler, + isert_async_evt_handler, + cq_desc, /* context */ + &ia); + } +#endif if (unlikely(IS_ERR(cq))) { cq_desc->cq = NULL; err = PTR_ERR(cq); diff --git a/iscsi-scst/kernel/isert-scst/isert_login.c b/iscsi-scst/kernel/isert-scst/isert_login.c index 158574793..e2e42a505 100644 --- a/iscsi-scst/kernel/isert-scst/isert_login.c +++ b/iscsi-scst/kernel/isert-scst/isert_login.c @@ -38,6 +38,7 @@ #include /* everything... */ #include /* error codes */ #include +#include #include #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20) #include diff --git a/iscsi-scst/kernel/target.c b/iscsi-scst/kernel/target.c index 32adf116a..391436edc 100644 --- a/iscsi-scst/kernel/target.c +++ b/iscsi-scst/kernel/target.c @@ -523,7 +523,7 @@ ssize_t iscsi_sysfs_send_event(uint32_t tid, enum iscsi_kern_event_code code, goto out; TRACE_DBG("Sending event %d (tid %d, param1 %s, param2 %s, cookie %d, " - "info %p)", tid, code, param1, param2, info->info_cookie, info); + "info %p)", code, tid, param1, param2, info->info_cookie, info); res = event_send(tid, 0, 0, info->info_cookie, code, param1, param2); if (res <= 0) { diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index 45101cacf..2a9691464 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #ifdef INSIDE_KERNEL_TREE diff --git a/scstadmin/init.d/scst b/scstadmin/init.d/scst index 99bc1f6ce..6bd0915ae 100755 --- a/scstadmin/init.d/scst +++ b/scstadmin/init.d/scst @@ -159,8 +159,7 @@ parse_scst_conf() { x86_64|i686) SCST_OPT_MODULES="crc32c-intel $SCST_OPT_MODULES";; esac - SCST_MODULES="$SCST_MODULES isert_scst" - SCST_OPT_MODULES="crc32c $SCST_OPT_MODULES" + SCST_OPT_MODULES="crc32c isert_scst $SCST_OPT_MODULES" SCST_DAEMONS="${ISCSI_DAEMON} $SCST_DAEMONS" fi } diff --git a/srpt/Makefile b/srpt/Makefile index d7805080e..df2cf832b 100644 --- a/srpt/Makefile +++ b/srpt/Makefile @@ -77,9 +77,14 @@ endif OFED_MODULE_SYMVERS:=$(OFED_KERNEL_DIR)/$(MODULE_SYMVERS) 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) +CREATE_SEND_MAD_AH_FLAG := $(shell $(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd)/conftest/create_send_mad_ah PRE_CFLAGS="$(OFED_CFLAGS) -Werror" >/dev/null 2>&1 && echo -DCREATE_SEND_MAD_HAS_AH_ARG) +ifeq ($(CREATE_SEND_MAD_AH_FLAG),) + CREATE_SEND_MAD_BASE_FLAG := $(shell $(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd)/conftest/create_send_mad_base PRE_CFLAGS="$(OFED_CFLAGS) -Werror" >/dev/null 2>&1 && echo -DCREATE_SEND_MAD_HAS_BASE_ARG) +endif GID_CHANGE_FLAG = $(shell $(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd)/conftest/gid_change PRE_CFLAGS="$(OFED_CFLAGS)" >/dev/null 2>&1 && echo -DHAVE_IB_EVENT_GID_CHANGE) REGISTER_MAD_AGENT_FLAG = $(shell $(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd)/conftest/register_mad_agent PRE_CFLAGS="$(OFED_CFLAGS) -Werror" >/dev/null 2>&1 && echo -DREGISTER_MAD_AGENT_HAS_FLAGS_ARG) -PRE_CFLAGS=$(OFED_CFLAGS) $(GID_CHANGE_FLAG) $(REGISTER_MAD_AGENT_FLAG) -DOFED_FLAVOR=$(OFED_FLAVOR) +PRE_CFLAGS=$(OFED_CFLAGS) $(CREATE_CQ_FLAG) $(CREATE_SEND_MAD_AH_FLAG) $(CREATE_SEND_MAD_BASE_FLAG) $(GID_CHANGE_FLAG) $(REGISTER_MAD_AGENT_FLAG) -DOFED_FLAVOR=$(OFED_FLAVOR) all: src/$(MODULE_SYMVERS) $(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd)/src \ diff --git a/srpt/conftest/create_cq/Makefile b/srpt/conftest/create_cq/Makefile new file mode 100644 index 000000000..d7ada9b0a --- /dev/null +++ b/srpt/conftest/create_cq/Makefile @@ -0,0 +1,3 @@ +LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE) + +obj-m += create_cq.o diff --git a/srpt/conftest/create_cq/create_cq.c b/srpt/conftest/create_cq/create_cq.c new file mode 100644 index 000000000..86fce929e --- /dev/null +++ b/srpt/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/srpt/conftest/create_send_mad_ah/Makefile b/srpt/conftest/create_send_mad_ah/Makefile new file mode 100644 index 000000000..37fdb6e9f --- /dev/null +++ b/srpt/conftest/create_send_mad_ah/Makefile @@ -0,0 +1,3 @@ +LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE) + +obj-m += create_send_mad_ah.o diff --git a/srpt/conftest/create_send_mad_ah/create_send_mad_ah.c b/srpt/conftest/create_send_mad_ah/create_send_mad_ah.c new file mode 100644 index 000000000..529a00858 --- /dev/null +++ b/srpt/conftest/create_send_mad_ah/create_send_mad_ah.c @@ -0,0 +1,13 @@ +#include +#include + +static int modinit(void) +{ + struct ib_mad_send_buf *b; + + b = ib_create_send_mad(NULL, 0, 0, NULL, 0, 0, 0, 0); + + return b != 0; +} + +module_init(modinit); diff --git a/srpt/conftest/create_send_mad_base/Makefile b/srpt/conftest/create_send_mad_base/Makefile new file mode 100644 index 000000000..92f153d51 --- /dev/null +++ b/srpt/conftest/create_send_mad_base/Makefile @@ -0,0 +1,3 @@ +LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE) + +obj-m += create_send_mad_base.o diff --git a/srpt/conftest/create_send_mad_base/create_send_mad_base.c b/srpt/conftest/create_send_mad_base/create_send_mad_base.c new file mode 100644 index 000000000..2f48902e3 --- /dev/null +++ b/srpt/conftest/create_send_mad_base/create_send_mad_base.c @@ -0,0 +1,13 @@ +#include +#include + +static int modinit(void) +{ + struct ib_mad_send_buf *b; + + b = ib_create_send_mad(NULL, 0, 0, 0, 0, 0, 0, 0); + + return b != 0; +} + +module_init(modinit); diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index e4ec367e7..bb1093ead 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -621,9 +621,16 @@ static void srpt_mad_recv_handler(struct ib_mad_agent *mad_agent, BUILD_BUG_ON(offsetof(struct ib_dm_mad, data) != IB_MGMT_DEVICE_HDR); rsp = ib_create_send_mad(mad_agent, mad_wc->wc->src_qp, - mad_wc->wc->pkey_index, 0, - IB_MGMT_DEVICE_HDR, IB_MGMT_DEVICE_DATA, - GFP_KERNEL); + mad_wc->wc->pkey_index, +#ifdef CREATE_SEND_MAD_HAS_AH_ARG + NULL, +#endif + 0, IB_MGMT_DEVICE_HDR, IB_MGMT_DEVICE_DATA, + GFP_KERNEL +#ifdef CREATE_SEND_MAD_HAS_BASE_ARG + , 0 +#endif + ); if (IS_ERR(rsp)) goto err_rsp; @@ -2174,9 +2181,17 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch) && !defined(RHEL_RELEASE_CODE) ch->cq = ib_create_cq(sdev->device, srpt_completion, NULL, ch, ch->rq_size + srpt_sq_size); -#else +#elif !defined(IB_CREATE_CQ_HAS_INIT_ATTR) ch->cq = ib_create_cq(sdev->device, srpt_completion, NULL, ch, ch->rq_size + srpt_sq_size, ch->comp_vector); +#else + { + struct ib_cq_init_attr ia = { }; + + ia.cqe = ch->rq_size + srpt_sq_size; + ia.comp_vector = ch->comp_vector; + ch->cq = ib_create_cq(sdev->device, srpt_completion, NULL, ch, &ia); + } #endif if (IS_ERR(ch->cq)) { ret = PTR_ERR(ch->cq);