From 30c6cdfbe7e8736ae70128928797502a28ab53d5 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Fri, 8 Nov 2019 20:40:51 +0000 Subject: [PATCH] ib_srpt: Detect SRP_DATA_DESC_IMM constant support at compile time This patch makes it possible to build the ib_srpt driver against a kernel before v4.21 + latest MOFED. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8653 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- srpt/Makefile | 6 ++++++ srpt/conftest/srp_data_desc_imm/Makefile | 3 +++ srpt/conftest/srp_data_desc_imm/srp_data_desc_imm.c | 9 +++++++++ srpt/src/ib_srpt.h | 4 ++-- 4 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 srpt/conftest/srp_data_desc_imm/Makefile create mode 100644 srpt/conftest/srp_data_desc_imm/srp_data_desc_imm.c diff --git a/srpt/Makefile b/srpt/Makefile index 4eb0445bc..ced096d17 100644 --- a/srpt/Makefile +++ b/srpt/Makefile @@ -269,6 +269,12 @@ conftest/register_mad_agent/result-$(KVER).txt: \ echo "$(call run_conftest,register_mad_agent, \ -DREGISTER_MAD_AGENT_HAS_FLAGS_ARG)" >"$@" +conftest/srp_data_desc_imm/result-$(KVER).txt: \ + conftest/srp_data_desc_imm/srp_data_desc_imm.c \ + conftest/srp_data_desc_imm/Makefile + echo "$(call run_conftest_bool,srp_data_desc_imm, \ + HAVE_SRP_DATA_DESC_IMM)" >"$@" + conftest/srp_login_req_rdma/result-$(KVER).txt: \ conftest/srp_login_req_rdma/srp_login_req_rdma.c \ conftest/srp_login_req_rdma/Makefile diff --git a/srpt/conftest/srp_data_desc_imm/Makefile b/srpt/conftest/srp_data_desc_imm/Makefile new file mode 100644 index 000000000..f06df5a6e --- /dev/null +++ b/srpt/conftest/srp_data_desc_imm/Makefile @@ -0,0 +1,3 @@ +LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE) + +obj-m += srp_data_desc_imm.o diff --git a/srpt/conftest/srp_data_desc_imm/srp_data_desc_imm.c b/srpt/conftest/srp_data_desc_imm/srp_data_desc_imm.c new file mode 100644 index 000000000..1dc977a66 --- /dev/null +++ b/srpt/conftest/srp_data_desc_imm/srp_data_desc_imm.c @@ -0,0 +1,9 @@ +#include +#include + +static int modinit(void) +{ + return SRP_DATA_DESC_IMM; +} + +module_init(modinit); diff --git a/srpt/src/ib_srpt.h b/srpt/src/ib_srpt.h index 59baafc00..2af8422ba 100644 --- a/srpt/src/ib_srpt.h +++ b/srpt/src/ib_srpt.h @@ -66,7 +66,7 @@ struct srpt_nexus; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 21, 0) +#if !HAVE_SRP_DATA_DESC_IMM enum { SRP_DATA_DESC_IMM = 3, SRP_IMMED_REQUESTED = 0x80, @@ -164,7 +164,7 @@ enum { SRP_CMD_ORDERED_Q = 0x2, SRP_CMD_ACA = 0x4, -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 21, 0) +#if !HAVE_SRP_DATA_DESC_IMM SRP_LOGIN_RSP_MULTICHAN_NO_CHAN = 0x0, SRP_LOGIN_RSP_MULTICHAN_TERMINATED = 0x1, SRP_LOGIN_RSP_MULTICHAN_MAINTAINED = 0x2,