From 34dd80153e759332abf50af8e83bf89ffa1357fc Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 19 Dec 2016 13:01:40 +0100 Subject: [PATCH] isert-scst: Fix CentOS 7.3 build --- iscsi-scst/Makefile | 34 +++++++++++++++++-- iscsi-scst/conftest/cm_listen/Makefile | 3 ++ iscsi-scst/conftest/cm_listen/cm_listen.c | 9 +++++ .../conftest/create_send_mad_ah/Makefile | 3 ++ .../create_send_mad_ah/create_send_mad_ah.c | 13 +++++++ .../conftest/create_send_mad_base/Makefile | 3 ++ .../create_send_mad_base.c | 13 +++++++ iscsi-scst/conftest/gid_change/Makefile | 3 ++ iscsi-scst/conftest/gid_change/gid_change.c | 9 +++++ iscsi-scst/conftest/ib_client_remove/Makefile | 3 ++ .../ib_client_remove/ib_client_remove.c | 15 ++++++++ iscsi-scst/conftest/ib_dma_map_ops/Makefile | 3 ++ .../conftest/ib_dma_map_ops/ib_dma_map_ops.c | 11 ++++++ .../conftest/ib_set_cpi_resp_time/Makefile | 3 ++ .../ib_set_cpi_resp_time.c | 9 +++++ .../mad_handler_takes_send_buf/Makefile | 3 ++ .../mad_handler_takes_send_buf.c | 17 ++++++++++ .../conftest/pd_has_local_dma_lkey/Makefile | 3 ++ .../pd_has_local_dma_lkey.c | 10 ++++++ iscsi-scst/conftest/query_device/Makefile | 3 ++ .../conftest/query_device/query_device.c | 9 +++++ .../conftest/query_device_attr_arg/Makefile | 3 ++ .../query_device_attr_arg.c | 9 +++++ iscsi-scst/conftest/query_gid/Makefile | 3 ++ iscsi-scst/conftest/query_gid/query_gid.c | 9 +++++ .../conftest/rdma_create_id_net/Makefile | 3 ++ .../rdma_create_id_net/rdma_create_id_net.c | 10 ++++++ .../conftest/register_mad_agent/Makefile | 3 ++ .../register_mad_agent/register_mad_agent.c | 13 +++++++ .../use_pre_440_wr_structure/Makefile | 3 ++ .../use_pre_440_wr_structure.c | 11 ++++++ iscsi-scst/kernel/isert-scst/iser.h | 4 +-- iscsi-scst/kernel/isert-scst/iser_buf.c | 6 ++-- iscsi-scst/kernel/isert-scst/iser_pdu.c | 10 +++--- iscsi-scst/kernel/isert-scst/iser_rdma.c | 23 ++++++------- 35 files changed, 265 insertions(+), 24 deletions(-) create mode 100644 iscsi-scst/conftest/cm_listen/Makefile create mode 100644 iscsi-scst/conftest/cm_listen/cm_listen.c create mode 100644 iscsi-scst/conftest/create_send_mad_ah/Makefile create mode 100644 iscsi-scst/conftest/create_send_mad_ah/create_send_mad_ah.c create mode 100644 iscsi-scst/conftest/create_send_mad_base/Makefile create mode 100644 iscsi-scst/conftest/create_send_mad_base/create_send_mad_base.c create mode 100644 iscsi-scst/conftest/gid_change/Makefile create mode 100644 iscsi-scst/conftest/gid_change/gid_change.c create mode 100644 iscsi-scst/conftest/ib_client_remove/Makefile create mode 100644 iscsi-scst/conftest/ib_client_remove/ib_client_remove.c create mode 100644 iscsi-scst/conftest/ib_dma_map_ops/Makefile create mode 100644 iscsi-scst/conftest/ib_dma_map_ops/ib_dma_map_ops.c create mode 100644 iscsi-scst/conftest/ib_set_cpi_resp_time/Makefile create mode 100644 iscsi-scst/conftest/ib_set_cpi_resp_time/ib_set_cpi_resp_time.c create mode 100644 iscsi-scst/conftest/mad_handler_takes_send_buf/Makefile create mode 100644 iscsi-scst/conftest/mad_handler_takes_send_buf/mad_handler_takes_send_buf.c create mode 100644 iscsi-scst/conftest/pd_has_local_dma_lkey/Makefile create mode 100644 iscsi-scst/conftest/pd_has_local_dma_lkey/pd_has_local_dma_lkey.c create mode 100644 iscsi-scst/conftest/query_device/Makefile create mode 100644 iscsi-scst/conftest/query_device/query_device.c create mode 100644 iscsi-scst/conftest/query_device_attr_arg/Makefile create mode 100644 iscsi-scst/conftest/query_device_attr_arg/query_device_attr_arg.c create mode 100644 iscsi-scst/conftest/query_gid/Makefile create mode 100644 iscsi-scst/conftest/query_gid/query_gid.c create mode 100644 iscsi-scst/conftest/rdma_create_id_net/Makefile create mode 100644 iscsi-scst/conftest/rdma_create_id_net/rdma_create_id_net.c create mode 100644 iscsi-scst/conftest/register_mad_agent/Makefile create mode 100644 iscsi-scst/conftest/register_mad_agent/register_mad_agent.c create mode 100644 iscsi-scst/conftest/use_pre_440_wr_structure/Makefile create mode 100644 iscsi-scst/conftest/use_pre_440_wr_structure/use_pre_440_wr_structure.c diff --git a/iscsi-scst/Makefile b/iscsi-scst/Makefile index 5b1826182..3ff356e99 100644 --- a/iscsi-scst/Makefile +++ b/iscsi-scst/Makefile @@ -114,8 +114,38 @@ 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) +GOALS:=$(if $(MAKECMDGOALS),$(MAKECMDGOALS),all) +OTHER_GOALS:=$(foreach goal,$(MAKECMDGOALS),$(subst all,,$(goal))) +# echo:=$(shell echo 'GOALS = $(GOALS)' >&2) +# echo:=$(shell echo 'OTHER_GOALS = $(OTHER_GOALS)' >&2) +ifneq ("$(GOALS)","$(OTHER_GOALS)") +run_conftest = $(shell if [ "0$(V)" -gt 0 ]; then output=/dev/stdout; else output=/dev/null; fi; if $(MAKE) -C $(KDIR) V=$(V) SUBDIRS="$(shell pwd)/conftest/$1" PRE_CFLAGS="-Werror $(OFED_CFLAGS)" 1>&2 2>$${output}; then echo "$2"; else echo "$3"; fi) +USE_PRE_440_WR_STRUCTURE := $(call run_conftest,use_pre_440_wr_structure,-DUSE_PRE_440_WR_STRUCTURE) +CREATE_CQ_FLAG := $(call run_conftest,create_cq,-DIB_CREATE_CQ_HAS_INIT_ATTR) +CLIENT_REMOVE := $(call run_conftest,ib_client_remove,-DIB_CLIENT_REMOVE_TAKES_TWO_ARGS) +HAVE_IB_DMA_MAP_OPS := $(call run_conftest,ib_dma_map_ops,-DHAVE_IB_DMA_MAP_OPS) +HAVE_IB_SET_CPI_RESP_TIME := $(call run_conftest,ib_set_cpi_resp_time,-DHAVE_IB_SET_CPI_RESP_TIME) +GID_CHANGE_FLAG := $(call run_conftest,gid_change,-DHAVE_IB_EVENT_GID_CHANGE) +PD_HAS_LOCAL_DMA_LKEY := $(call run_conftest,pd_has_local_dma_lkey,-DIB_PD_HAS_LOCAL_DMA_LKEY) +RDMA_CREATE_ID := $(call run_conftest,rdma_create_id_net,-DRDMA_CREATE_ID_TAKES_NET_ARG=1,-DRDMA_CREATE_ID_TAKES_NET_ARG=0) +QUERY_DEVICE := $(call run_conftest,query_device,-DHAVE_IB_QUERY_DEVICE) +QUERY_DEVICE_HAS_ATTR_ARG := $(call run_conftest,query_device_attr_arg,-DIB_QUERY_DEVICE_HAS_ATTR_ARG) +QUERY_GID_FLAG := $(call run_conftest,query_gid,-DIB_QUERY_GID_HAS_ATTR_ARG) +PRE_CFLAGS=$(OFED_CFLAGS) \ + $(USE_PRE_440_WR_STRUCTURE) \ + $(CLIENT_REMOVE) \ + $(CREATE_CQ_FLAG) \ + $(IB_CLIENT_REMOVE_TAKES_TWO_ARGS) \ + $(HAVE_IB_DMA_MAP_OPS) \ + $(HAVE_IB_SET_CPI_RESP_TIME) \ + $(GID_CHANGE_FLAG) \ + $(PD_HAS_LOCAL_DMA_LKEY) \ + $(RDMA_CREATE_ID) \ + $(QUERY_GID_FLAG) \ + $(QUERY_DEVICE) \ + $(QUERY_DEVICE_HAS_ATTR_ARG) \ + -DOFED_FLAVOR=$(OFED_FLAVOR) +endif mods: include/iscsi_scst_itf_ver.h Modules.symvers Module.symvers $(MAKE) -C $(KDIR) SCST_INC_DIR=$(SCST_INC_DIR) SUBDIRS=$(KMOD) modules diff --git a/iscsi-scst/conftest/cm_listen/Makefile b/iscsi-scst/conftest/cm_listen/Makefile new file mode 100644 index 000000000..e9f8cb9f7 --- /dev/null +++ b/iscsi-scst/conftest/cm_listen/Makefile @@ -0,0 +1,3 @@ +LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE) + +obj-m += cm_listen.o diff --git a/iscsi-scst/conftest/cm_listen/cm_listen.c b/iscsi-scst/conftest/cm_listen/cm_listen.c new file mode 100644 index 000000000..f03fddabb --- /dev/null +++ b/iscsi-scst/conftest/cm_listen/cm_listen.c @@ -0,0 +1,9 @@ +#include +#include + +static int modinit(void) +{ + return ib_cm_listen(NULL, 0, 0, NULL); +} + +module_init(modinit); diff --git a/iscsi-scst/conftest/create_send_mad_ah/Makefile b/iscsi-scst/conftest/create_send_mad_ah/Makefile new file mode 100644 index 000000000..37fdb6e9f --- /dev/null +++ b/iscsi-scst/conftest/create_send_mad_ah/Makefile @@ -0,0 +1,3 @@ +LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE) + +obj-m += create_send_mad_ah.o diff --git a/iscsi-scst/conftest/create_send_mad_ah/create_send_mad_ah.c b/iscsi-scst/conftest/create_send_mad_ah/create_send_mad_ah.c new file mode 100644 index 000000000..529a00858 --- /dev/null +++ b/iscsi-scst/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/iscsi-scst/conftest/create_send_mad_base/Makefile b/iscsi-scst/conftest/create_send_mad_base/Makefile new file mode 100644 index 000000000..92f153d51 --- /dev/null +++ b/iscsi-scst/conftest/create_send_mad_base/Makefile @@ -0,0 +1,3 @@ +LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE) + +obj-m += create_send_mad_base.o diff --git a/iscsi-scst/conftest/create_send_mad_base/create_send_mad_base.c b/iscsi-scst/conftest/create_send_mad_base/create_send_mad_base.c new file mode 100644 index 000000000..2f48902e3 --- /dev/null +++ b/iscsi-scst/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/iscsi-scst/conftest/gid_change/Makefile b/iscsi-scst/conftest/gid_change/Makefile new file mode 100644 index 000000000..ef14a136e --- /dev/null +++ b/iscsi-scst/conftest/gid_change/Makefile @@ -0,0 +1,3 @@ +LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE) + +obj-m += gid_change.o diff --git a/iscsi-scst/conftest/gid_change/gid_change.c b/iscsi-scst/conftest/gid_change/gid_change.c new file mode 100644 index 000000000..bb60773fb --- /dev/null +++ b/iscsi-scst/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/iscsi-scst/conftest/ib_client_remove/Makefile b/iscsi-scst/conftest/ib_client_remove/Makefile new file mode 100644 index 000000000..dbb92ba16 --- /dev/null +++ b/iscsi-scst/conftest/ib_client_remove/Makefile @@ -0,0 +1,3 @@ +LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE) + +obj-m += ib_client_remove.o diff --git a/iscsi-scst/conftest/ib_client_remove/ib_client_remove.c b/iscsi-scst/conftest/ib_client_remove/ib_client_remove.c new file mode 100644 index 000000000..77cac3525 --- /dev/null +++ b/iscsi-scst/conftest/ib_client_remove/ib_client_remove.c @@ -0,0 +1,15 @@ +#include +#include + +static void client_remove(struct ib_device *dev, void *client_data) +{ +} + +static int modinit(void) +{ + struct ib_client c = { .remove = client_remove }; + + return (uintptr_t)c.remove; +} + +module_init(modinit); diff --git a/iscsi-scst/conftest/ib_dma_map_ops/Makefile b/iscsi-scst/conftest/ib_dma_map_ops/Makefile new file mode 100644 index 000000000..fc43ac8af --- /dev/null +++ b/iscsi-scst/conftest/ib_dma_map_ops/Makefile @@ -0,0 +1,3 @@ +LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE) + +obj-m += ib_dma_map_ops.o diff --git a/iscsi-scst/conftest/ib_dma_map_ops/ib_dma_map_ops.c b/iscsi-scst/conftest/ib_dma_map_ops/ib_dma_map_ops.c new file mode 100644 index 000000000..2aeb8bbf2 --- /dev/null +++ b/iscsi-scst/conftest/ib_dma_map_ops/ib_dma_map_ops.c @@ -0,0 +1,11 @@ +#include +#include + +static struct ib_device *dev; + +static int modinit(void) +{ + return dev->dma_ops != NULL; +} + +module_init(modinit); diff --git a/iscsi-scst/conftest/ib_set_cpi_resp_time/Makefile b/iscsi-scst/conftest/ib_set_cpi_resp_time/Makefile new file mode 100644 index 000000000..8ba270a73 --- /dev/null +++ b/iscsi-scst/conftest/ib_set_cpi_resp_time/Makefile @@ -0,0 +1,3 @@ +LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE) + +obj-m += ib_set_cpi_resp_time.o diff --git a/iscsi-scst/conftest/ib_set_cpi_resp_time/ib_set_cpi_resp_time.c b/iscsi-scst/conftest/ib_set_cpi_resp_time/ib_set_cpi_resp_time.c new file mode 100644 index 000000000..eb544bd0f --- /dev/null +++ b/iscsi-scst/conftest/ib_set_cpi_resp_time/ib_set_cpi_resp_time.c @@ -0,0 +1,9 @@ +#include +#include + +static int modinit(void) +{ + return (uintptr_t)ib_set_cpi_resp_time; +} + +module_init(modinit); diff --git a/iscsi-scst/conftest/mad_handler_takes_send_buf/Makefile b/iscsi-scst/conftest/mad_handler_takes_send_buf/Makefile new file mode 100644 index 000000000..03f96f272 --- /dev/null +++ b/iscsi-scst/conftest/mad_handler_takes_send_buf/Makefile @@ -0,0 +1,3 @@ +LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE) + +obj-m += mad_handler_takes_send_buf.o diff --git a/iscsi-scst/conftest/mad_handler_takes_send_buf/mad_handler_takes_send_buf.c b/iscsi-scst/conftest/mad_handler_takes_send_buf/mad_handler_takes_send_buf.c new file mode 100644 index 000000000..348d67121 --- /dev/null +++ b/iscsi-scst/conftest/mad_handler_takes_send_buf/mad_handler_takes_send_buf.c @@ -0,0 +1,17 @@ +#include +#include + +static void imrh(struct ib_mad_agent *mad_agent, + struct ib_mad_send_buf *send_buf, + struct ib_mad_recv_wc *mad_recv_wc) +{ +} + +static int modinit(void) +{ + ib_mad_recv_handler h = imrh; + + return !!h; +} + +module_init(modinit); diff --git a/iscsi-scst/conftest/pd_has_local_dma_lkey/Makefile b/iscsi-scst/conftest/pd_has_local_dma_lkey/Makefile new file mode 100644 index 000000000..7e203aff4 --- /dev/null +++ b/iscsi-scst/conftest/pd_has_local_dma_lkey/Makefile @@ -0,0 +1,3 @@ +LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE) + +obj-m += pd_has_local_dma_lkey.o diff --git a/iscsi-scst/conftest/pd_has_local_dma_lkey/pd_has_local_dma_lkey.c b/iscsi-scst/conftest/pd_has_local_dma_lkey/pd_has_local_dma_lkey.c new file mode 100644 index 000000000..b6889c165 --- /dev/null +++ b/iscsi-scst/conftest/pd_has_local_dma_lkey/pd_has_local_dma_lkey.c @@ -0,0 +1,10 @@ +#include +#include +#include + +static int modinit(void) +{ + return offsetof(struct ib_pd, local_dma_lkey); +} + +module_init(modinit); diff --git a/iscsi-scst/conftest/query_device/Makefile b/iscsi-scst/conftest/query_device/Makefile new file mode 100644 index 000000000..7f907d2b3 --- /dev/null +++ b/iscsi-scst/conftest/query_device/Makefile @@ -0,0 +1,3 @@ +LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE) + +obj-m += query_device.o diff --git a/iscsi-scst/conftest/query_device/query_device.c b/iscsi-scst/conftest/query_device/query_device.c new file mode 100644 index 000000000..b32717ce5 --- /dev/null +++ b/iscsi-scst/conftest/query_device/query_device.c @@ -0,0 +1,9 @@ +#include +#include + +static int modinit(void) +{ + return (uintptr_t)ib_query_device; +} + +module_init(modinit); diff --git a/iscsi-scst/conftest/query_device_attr_arg/Makefile b/iscsi-scst/conftest/query_device_attr_arg/Makefile new file mode 100644 index 000000000..1998c3bc1 --- /dev/null +++ b/iscsi-scst/conftest/query_device_attr_arg/Makefile @@ -0,0 +1,3 @@ +LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE) + +obj-m += query_device_attr_arg.o diff --git a/iscsi-scst/conftest/query_device_attr_arg/query_device_attr_arg.c b/iscsi-scst/conftest/query_device_attr_arg/query_device_attr_arg.c new file mode 100644 index 000000000..339d155d4 --- /dev/null +++ b/iscsi-scst/conftest/query_device_attr_arg/query_device_attr_arg.c @@ -0,0 +1,9 @@ +#include +#include + +static int modinit(void) +{ + return ib_query_device(NULL, NULL); +} + +module_init(modinit); diff --git a/iscsi-scst/conftest/query_gid/Makefile b/iscsi-scst/conftest/query_gid/Makefile new file mode 100644 index 000000000..7a7bba1f2 --- /dev/null +++ b/iscsi-scst/conftest/query_gid/Makefile @@ -0,0 +1,3 @@ +LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE) + +obj-m += query_gid.o diff --git a/iscsi-scst/conftest/query_gid/query_gid.c b/iscsi-scst/conftest/query_gid/query_gid.c new file mode 100644 index 000000000..2db08ef62 --- /dev/null +++ b/iscsi-scst/conftest/query_gid/query_gid.c @@ -0,0 +1,9 @@ +#include +#include + +static int modinit(void) +{ + return ib_query_gid(NULL, 0, 0, NULL, NULL); +} + +module_init(modinit); diff --git a/iscsi-scst/conftest/rdma_create_id_net/Makefile b/iscsi-scst/conftest/rdma_create_id_net/Makefile new file mode 100644 index 000000000..3b054d037 --- /dev/null +++ b/iscsi-scst/conftest/rdma_create_id_net/Makefile @@ -0,0 +1,3 @@ +LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE) + +obj-m += rdma_create_id_net.o diff --git a/iscsi-scst/conftest/rdma_create_id_net/rdma_create_id_net.c b/iscsi-scst/conftest/rdma_create_id_net/rdma_create_id_net.c new file mode 100644 index 000000000..fd6b874d9 --- /dev/null +++ b/iscsi-scst/conftest/rdma_create_id_net/rdma_create_id_net.c @@ -0,0 +1,10 @@ +#include +#include + +static int modinit(void) +{ + return rdma_create_id(NULL, NULL, NULL, 0, 0) != NULL; + +} + +module_init(modinit); diff --git a/iscsi-scst/conftest/register_mad_agent/Makefile b/iscsi-scst/conftest/register_mad_agent/Makefile new file mode 100644 index 000000000..11f6f4506 --- /dev/null +++ b/iscsi-scst/conftest/register_mad_agent/Makefile @@ -0,0 +1,3 @@ +LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE) + +obj-m += register_mad_agent.o diff --git a/iscsi-scst/conftest/register_mad_agent/register_mad_agent.c b/iscsi-scst/conftest/register_mad_agent/register_mad_agent.c new file mode 100644 index 000000000..c464f1443 --- /dev/null +++ b/iscsi-scst/conftest/register_mad_agent/register_mad_agent.c @@ -0,0 +1,13 @@ +#include +#include + +static int modinit(void) +{ + struct ib_mad_agent *a; + + a = ib_register_mad_agent(NULL, 0, 0, NULL, 0, NULL, NULL, NULL, 0); + + return a != 0; +} + +module_init(modinit); diff --git a/iscsi-scst/conftest/use_pre_440_wr_structure/Makefile b/iscsi-scst/conftest/use_pre_440_wr_structure/Makefile new file mode 100644 index 000000000..ea82d5d19 --- /dev/null +++ b/iscsi-scst/conftest/use_pre_440_wr_structure/Makefile @@ -0,0 +1,3 @@ +LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE) + +obj-m += use_pre_440_wr_structure.o diff --git a/iscsi-scst/conftest/use_pre_440_wr_structure/use_pre_440_wr_structure.c b/iscsi-scst/conftest/use_pre_440_wr_structure/use_pre_440_wr_structure.c new file mode 100644 index 000000000..3205a489b --- /dev/null +++ b/iscsi-scst/conftest/use_pre_440_wr_structure/use_pre_440_wr_structure.c @@ -0,0 +1,11 @@ +#include +#include + +static int modinit(void) +{ + struct ib_send_wr wr = { }; + + return wr.wr.rdma.rkey; +} + +module_init(modinit); diff --git a/iscsi-scst/kernel/isert-scst/iser.h b/iscsi-scst/kernel/isert-scst/iser.h index 8531896ba..2a842172d 100644 --- a/iscsi-scst/kernel/isert-scst/iser.h +++ b/iscsi-scst/kernel/isert-scst/iser.h @@ -99,7 +99,7 @@ struct isert_wr { struct ib_sge *sge_list; union { struct ib_recv_wr recv_wr; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR) +#ifdef USE_PRE_440_WR_STRUCTURE struct ib_send_wr send_wr; #else struct ib_rdma_wr send_wr; @@ -233,7 +233,7 @@ struct isert_connection { struct isert_device { struct ib_device *ib_dev; struct ib_pd *pd; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0) +#ifndef IB_PD_HAS_LOCAL_DMA_LKEY struct ib_mr *mr; #endif u32 lkey; diff --git a/iscsi-scst/kernel/isert-scst/iser_buf.c b/iscsi-scst/kernel/isert-scst/iser_buf.c index ae8b8c462..b1756f2f8 100644 --- a/iscsi-scst/kernel/isert-scst/iser_buf.c +++ b/iscsi-scst/kernel/isert-scst/iser_buf.c @@ -238,7 +238,7 @@ int isert_wr_init(struct isert_wr *wr, buff_offset = -EFAULT; goto out; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR) +#ifdef USE_PRE_440_WR_STRUCTURE wr->send_wr.wr.rdma.remote_addr = pdu->rem_write_va + buff_offset; wr->send_wr.wr.rdma.rkey = pdu->rem_write_stag; @@ -255,7 +255,7 @@ int isert_wr_init(struct isert_wr *wr, buff_offset = -EFAULT; goto out; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR) +#ifdef USE_PRE_440_WR_STRUCTURE wr->send_wr.wr.rdma.remote_addr = pdu->rem_read_va + buff_offset; wr->send_wr.wr.rdma.rkey = pdu->rem_read_stag; @@ -288,7 +288,7 @@ int isert_wr_init(struct isert_wr *wr, wr->recv_wr.sg_list = wr->sge_list; wr->recv_wr.num_sge = sg_cnt; } else { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR) +#ifdef USE_PRE_440_WR_STRUCTURE wr->send_wr.next = NULL; wr->send_wr.wr_id = _ptr_to_u64(wr); wr->send_wr.sg_list = wr->sge_list; diff --git a/iscsi-scst/kernel/isert-scst/iser_pdu.c b/iscsi-scst/kernel/isert-scst/iser_pdu.c index 7a0810185..729061f66 100644 --- a/iscsi-scst/kernel/isert-scst/iser_pdu.c +++ b/iscsi-scst/kernel/isert-scst/iser_pdu.c @@ -214,7 +214,7 @@ out: static inline void isert_link_send_wrs(struct isert_wr *from_wr, struct isert_wr *to_wr) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR) +#ifdef USE_PRE_440_WR_STRUCTURE from_wr->send_wr.next = &to_wr->send_wr; #else from_wr->send_wr.wr.next = &to_wr->send_wr.wr; @@ -226,7 +226,7 @@ static inline void isert_link_send_pdu_wrs(struct isert_cmnd *from_pdu, int wr_cnt) { isert_link_send_wrs(&from_pdu->wr[wr_cnt - 1], &to_pdu->wr[0]); -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR) +#ifdef USE_PRE_440_WR_STRUCTURE to_pdu->wr[0].send_wr.next = NULL; #else to_pdu->wr[0].send_wr.wr.next = NULL; @@ -289,7 +289,7 @@ int isert_prepare_rdma(struct isert_cmnd *isert_pdu, isert_link_send_wrs(&isert_pdu->wr[i - 1], &isert_pdu->wr[i]); if (op == ISER_WR_RDMA_READ) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR) +#ifdef USE_PRE_440_WR_STRUCTURE isert_pdu->wr[wr_cnt - 1].send_wr.send_flags = IB_SEND_SIGNALED; isert_pdu->wr[wr_cnt - 1].send_wr.next = NULL; #else @@ -588,7 +588,7 @@ int isert_pdu_send(struct isert_connection *isert_conn, #endif wr = &tx_pdu->wr[0]; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR) +#ifdef USE_PRE_440_WR_STRUCTURE wr->send_wr.num_sge = isert_pdu_prepare_send(isert_conn, tx_pdu); #else wr->send_wr.wr.num_sge = isert_pdu_prepare_send(isert_conn, tx_pdu); @@ -613,7 +613,7 @@ int isert_pdu_post_rdma_write(struct isert_connection *isert_conn, TRACE_ENTRY(); -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR) +#ifdef USE_PRE_440_WR_STRUCTURE isert_rsp->wr[0].send_wr.num_sge = isert_pdu_prepare_send(isert_conn, isert_rsp); #else diff --git a/iscsi-scst/kernel/isert-scst/iser_rdma.c b/iscsi-scst/kernel/isert-scst/iser_rdma.c index c35ccbbb5..39bb9c576 100644 --- a/iscsi-scst/kernel/isert-scst/iser_rdma.c +++ b/iscsi-scst/kernel/isert-scst/iser_rdma.c @@ -111,7 +111,7 @@ int isert_post_send(struct isert_connection *isert_conn, struct isert_wr *first_wr, int num_wr) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR) +#ifdef USE_PRE_440_WR_STRUCTURE struct ib_send_wr *first_ib_wr = &first_wr->send_wr; #else struct ib_send_wr *first_ib_wr = &first_wr->send_wr.wr; @@ -150,7 +150,7 @@ static void isert_post_drain_sq(struct isert_connection *isert_conn) isert_wr_set_fields(drain_wr_sq, isert_conn, NULL); drain_wr_sq->wr_op = ISER_WR_SEND; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR) +#ifdef USE_PRE_440_WR_STRUCTURE drain_wr_sq->send_wr.wr_id = _ptr_to_u64(drain_wr_sq); drain_wr_sq->send_wr.opcode = IB_WR_SEND; err = ib_post_send(isert_conn->qp, @@ -704,7 +704,7 @@ static void isert_handle_wc_error(struct ib_wc *wc) switch (wr->wr_op) { case ISER_WR_SEND: -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR) +#ifdef USE_PRE_440_WR_STRUCTURE num_sge = wr->send_wr.num_sge; #else num_sge = wr->send_wr.wr.num_sge; @@ -951,7 +951,7 @@ static struct isert_device *isert_device_create(struct ib_device *ib_dev) struct isert_device *isert_dev; int cqe_num, err; struct ib_pd *pd; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0) +#ifndef IB_PD_HAS_LOCAL_DMA_LKEY struct ib_mr *mr; #endif struct ib_cq *cq; @@ -967,7 +967,7 @@ static struct isert_device *isert_device_create(struct ib_device *ib_dev) goto out; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) || defined(MOFED_MAJOR) +#ifdef HAVE_IB_QUERY_DEVICE err = ib_query_device(ib_dev, &isert_dev->device_attr); if (unlikely(err)) { PRINT_ERROR("Failed to query device, err: %d", err); @@ -1005,7 +1005,7 @@ static struct isert_device *isert_device_create(struct ib_device *ib_dev) goto fail_pd; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0) +#ifndef IB_PD_HAS_LOCAL_DMA_LKEY mr = ib_get_dma_mr(pd, IB_ACCESS_LOCAL_WRITE); if (unlikely(IS_ERR(mr))) { err = PTR_ERR(mr); @@ -1054,8 +1054,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) || defined(MOFED_MAJOR)) && \ - !defined(IB_CREATE_CQ_HAS_INIT_ATTR) +#ifndef IB_CREATE_CQ_HAS_INIT_ATTR cq = ib_create_cq(ib_dev, isert_cq_comp_handler, isert_async_evt_handler, @@ -1095,7 +1094,7 @@ static struct isert_device *isert_device_create(struct ib_device *ib_dev) isert_dev->ib_dev = ib_dev; isert_dev->pd = pd; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0) +#ifndef IB_PD_HAS_LOCAL_DMA_LKEY isert_dev->mr = mr; isert_dev->lkey = mr->lkey; #else @@ -1118,7 +1117,7 @@ fail_cq: if (isert_dev->cq_desc[j].cq_workqueue) destroy_workqueue(isert_dev->cq_desc[j].cq_workqueue); } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0) +#ifndef IB_PD_HAS_LOCAL_DMA_LKEY ib_dereg_mr(mr); fail_mr: #endif @@ -1164,7 +1163,7 @@ static void isert_device_release(struct isert_device *isert_dev) destroy_workqueue(cq_desc->cq_workqueue); } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0) +#ifndef IB_PD_HAS_LOCAL_DMA_LKEY err = ib_dereg_mr(isert_dev->mr); if (unlikely(err)) PRINT_ERROR("Failed to destroy mr, err:%d", err); @@ -1796,7 +1795,7 @@ struct isert_portal *isert_portal_create(void) #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0) && \ (!defined(RHEL_MAJOR) || RHEL_MAJOR -0 <= 5) cm_id = rdma_create_id(isert_cm_evt_handler, portal, RDMA_PS_TCP); -#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR) +#elif !RDMA_CREATE_ID_TAKES_NET_ARG cm_id = rdma_create_id(isert_cm_evt_handler, portal, RDMA_PS_TCP, IB_QPT_RC); #else