From 32b49ce1f24ccad79083621c25d9da772698cf43 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 23 Jul 2019 15:11:42 +0000 Subject: [PATCH] iscsi-scst: Detect at compile time whether or not max_recv_sge is available (merge r8399 from trunk) Signed-off-by: Sergey Gorenko git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/3.3.x@8470 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/Makefile | 6 ++++++ iscsi-scst/conftest/dev_attr_max_recv_sge/Makefile | 3 +++ .../dev_attr_max_recv_sge/dev_attr_max_recv_sge.c | 10 ++++++++++ iscsi-scst/kernel/isert-scst/iser_rdma.c | 2 +- 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 iscsi-scst/conftest/dev_attr_max_recv_sge/Makefile create mode 100644 iscsi-scst/conftest/dev_attr_max_recv_sge/dev_attr_max_recv_sge.c diff --git a/iscsi-scst/Makefile b/iscsi-scst/Makefile index c9faba741..8a224fb38 100644 --- a/iscsi-scst/Makefile +++ b/iscsi-scst/Makefile @@ -303,6 +303,12 @@ conftest/query_device_attr_arg/result-$(KVER).txt: \ echo "$(call run_conftest,query_device_attr_arg, \ -DIB_QUERY_DEVICE_HAS_ATTR_ARG)" >"$@" +conftest/dev_attr_max_recv_sge/result-$(KVER).txt: \ + conftest/dev_attr_max_recv_sge/dev_attr_max_recv_sge.c \ + conftest/dev_attr_max_recv_sge/Makefile + echo "$(call run_conftest,dev_attr_max_recv_sge, \ + -DHAVE_DEV_ATTR_MAX_RECV_SGE)" >"$@" + conftest/query_gid/result-$(KVER).txt: \ conftest/query_gid/query_gid.c \ conftest/query_gid/Makefile diff --git a/iscsi-scst/conftest/dev_attr_max_recv_sge/Makefile b/iscsi-scst/conftest/dev_attr_max_recv_sge/Makefile new file mode 100644 index 000000000..01d1ba7d9 --- /dev/null +++ b/iscsi-scst/conftest/dev_attr_max_recv_sge/Makefile @@ -0,0 +1,3 @@ +LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE) + +obj-m += dev_attr_max_recv_sge.o diff --git a/iscsi-scst/conftest/dev_attr_max_recv_sge/dev_attr_max_recv_sge.c b/iscsi-scst/conftest/dev_attr_max_recv_sge/dev_attr_max_recv_sge.c new file mode 100644 index 000000000..2a70a2ebe --- /dev/null +++ b/iscsi-scst/conftest/dev_attr_max_recv_sge/dev_attr_max_recv_sge.c @@ -0,0 +1,10 @@ +#include +#include +#include + +static int modinit(void) +{ + return offsetof(struct ib_device_attr, max_recv_sge); +} + +module_init(modinit); diff --git a/iscsi-scst/kernel/isert-scst/iser_rdma.c b/iscsi-scst/kernel/isert-scst/iser_rdma.c index 3fb80102f..2fc6d0a5f 100644 --- a/iscsi-scst/kernel/isert-scst/iser_rdma.c +++ b/iscsi-scst/kernel/isert-scst/iser_rdma.c @@ -1292,7 +1292,7 @@ static struct isert_connection *isert_conn_create(struct rdma_cm_id *cm_id, * In mem-free devices, RC QPs can be created with a maximum of * (max_sge - 3) entries only. */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 0) +#ifndef HAVE_DEV_ATTR_MAX_RECV_SGE isert_conn->max_sge = isert_dev->device_attr.max_sge - 3; #else isert_conn->max_sge = isert_dev->device_attr.max_recv_sge - 3;