From a4b443cc78ba59e467dfa0ec577f78fd9a063ea6 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sat, 14 Jul 2018 00:42:07 +0000 Subject: [PATCH 1/2] ib_srpt: Add a configure test for dev_attr.max_send_sge git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7420 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- srpt/Makefile | 6 ++++++ srpt/conftest/dev_attr_max_send_sge/Makefile | 3 +++ .../dev_attr_max_send_sge/dev_attr_max_send_sge.c | 10 ++++++++++ srpt/src/ib_srpt.c | 2 +- 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 srpt/conftest/dev_attr_max_send_sge/Makefile create mode 100644 srpt/conftest/dev_attr_max_send_sge/dev_attr_max_send_sge.c diff --git a/srpt/Makefile b/srpt/Makefile index 31c92659a..0b1399676 100644 --- a/srpt/Makefile +++ b/srpt/Makefile @@ -184,6 +184,12 @@ conftest/create_send_mad_base/result-$(KVER).txt: \ echo "$(call run_conftest,create_send_mad_base, \ -DCREATE_SEND_MAD_HAS_BASE_ARG)" >"$@" +conftest/dev_attr_max_send_sge/result-$(KVER).txt: \ + conftest/dev_attr_max_send_sge/dev_attr_max_send_sge.c \ + conftest/dev_attr_max_send_sge/Makefile + echo "$(call run_conftest_bool,dev_attr_max_send_sge, \ + HAVE_DEV_ATTR_MAX_SEND_SGE)" >"$@" + conftest/gid_change/result-$(KVER).txt: \ conftest/gid_change/gid_change.c \ conftest/gid_change/Makefile diff --git a/srpt/conftest/dev_attr_max_send_sge/Makefile b/srpt/conftest/dev_attr_max_send_sge/Makefile new file mode 100644 index 000000000..48187159e --- /dev/null +++ b/srpt/conftest/dev_attr_max_send_sge/Makefile @@ -0,0 +1,3 @@ +LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE) + +obj-m += dev_attr_max_send_sge.o diff --git a/srpt/conftest/dev_attr_max_send_sge/dev_attr_max_send_sge.c b/srpt/conftest/dev_attr_max_send_sge/dev_attr_max_send_sge.c new file mode 100644 index 000000000..8e0530411 --- /dev/null +++ b/srpt/conftest/dev_attr_max_send_sge/dev_attr_max_send_sge.c @@ -0,0 +1,10 @@ +#include +#include +#include + +static int modinit(void) +{ + return offsetof(struct ib_device_attr, max_send_sge); +} + +module_init(modinit); diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index d2ad5f262..47529915b 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -2249,7 +2249,7 @@ retry: * max_sge values < max_sge_delta, use max_sge. For intermediate * max_sge values, use max_sge_delta. */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0) +#if HAVE_DEV_ATTR_MAX_SEND_SGE ch->max_send_sge = sdev->dev_attr.max_send_sge; ch->max_recv_sge = sdev->dev_attr.max_recv_sge; #else From f7fe8e220b7f73ca6409120652a71fc9b55ac057 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sat, 14 Jul 2018 00:44:33 +0000 Subject: [PATCH 2/2] scst_local: Rework the port to kernel v4.17 Rework the port to kernel v4.17 such that building scst_local against the latest MOFED version succeeds. Reported-by: Sergey Gorenko git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7421 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/include/backport.h | 10 ---------- scst/include/scst.h | 2 +- scst_local/scst_local.c | 7 +++++++ 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/scst/include/backport.h b/scst/include/backport.h index dc14ab255..2f65a9061 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -90,16 +90,6 @@ static inline unsigned int queue_max_hw_sectors(struct request_queue *q) } #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0) -static inline void blk_queue_flag_set(unsigned int flag, - struct request_queue *q) -{ -#if !defined(RHEL_MAJOR) || RHEL_MAJOR -0 >= 6 - queue_flag_set_unlocked(flag, q); -#endif -} -#endif - /* */ #if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 20) diff --git a/scst/include/scst.h b/scst/include/scst.h index bbebdcb87..33bc9d3df 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -4975,7 +4975,7 @@ static inline struct scatterlist *sg_next_inline(struct scatterlist *sg) static inline void sg_clear(struct scatterlist *sg) { memset(sg, 0, sizeof(*sg)); -#ifdef CONFIG_DEBUG_SG +#if 0 // def CONFIG_DEBUG_SG sg->sg_magic = SG_MAGIC; #endif } diff --git a/scst_local/scst_local.c b/scst_local/scst_local.c index eef75fa97..df41160e5 100644 --- a/scst_local/scst_local.c +++ b/scst_local/scst_local.c @@ -1230,7 +1230,14 @@ static int scst_local_change_queue_depth(struct scsi_device *sdev, int qdepth) static int scst_local_slave_alloc(struct scsi_device *sdev) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0) +#if !defined(RHEL_MAJOR) || RHEL_MAJOR -0 >= 6 + queue_flag_set_unlocked(QUEUE_FLAG_BIDI, sdev->request_queue); +#endif +#else blk_queue_flag_set(QUEUE_FLAG_BIDI, sdev->request_queue); +#endif + return 0; }