isert-scst, srpt: Fix build on systems with kernel >= 4.2.0 + MOFED 3.3

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6973 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2016-08-22 04:28:52 +00:00
parent 3f35afdf88
commit d2dd61c072
5 changed files with 24 additions and 2 deletions

View File

@@ -76,9 +76,16 @@ ifeq ($(OFED_FLAVOR),MOFED)
endif
ifeq ($(MLNX_OFED_IB_RH_INSTALLED),true)
OFED_VERS=$(shell rpm -q --qf '%{version}\n' mlnx-ofa_kernel-devel \
2>/dev/null)
OFED_CFLAGS:=-I/usr/src/ofa_kernel/default/include -include /usr/src/ofa_kernel/default/include/linux/compat-2.6.h
ISER_SYMVERS:="$(ISER_SYMVERS) /usr/src/ofa_kernel/default/Module.symvers"
endif
# Make the version of the MOFED kernel package available to C source
# files such that it can be used in #ifdef statements where MOFED
# uses an older version of the RDMA API than the upstream kernel.
OFED_CFLAGS+=-DMOFED_MAJOR=$(shell echo $(OFED_VERS) | cut -f1 -d.)
else
# Whether or not the OFED kernel-ib-devel RPM has been installed.
OFED_KERNEL_IB_DEVEL_RPM_INSTALLED:=$(shell if rpm -q kernel-ib-devel 2>/dev/null | grep -q $$(uname -r | sed 's/-/_/g'); then echo true; else echo false; fi)

View File

@@ -1050,7 +1050,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) && \
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0) || defined(MOFED_MAJOR)) && \
!defined(IB_CREATE_CQ_HAS_INIT_ATTR)
cq = ib_create_cq(ib_dev,
isert_cq_comp_handler,

View File

@@ -114,6 +114,17 @@ function evaluate(stmnt, pattern, arg, op, result) {
"(\\1) * 256 + (\\2)", "g", stmnt)
}
if (MOFED_MAJOR == "")
{
gsub("defined\\(MOFED_MAJOR\\)", "0", stmnt)
gsub("MOFED_MAJOR", "", stmnt)
}
else
{
gsub("defined\\(MOFED_MAJOR\\)", "1", stmnt)
gsub("MOFED_MAJOR", MOFED_MAJOR, stmnt)
}
if (SCSI_EXEC_REQ_FIFO_DEFINED != "")
{
gsub("defined[[:blank:]]+SCSI_EXEC_REQ_FIFO_DEFINED",
@@ -284,6 +295,7 @@ function handle_if(evaluated)
|| $0 ~ "RHEL_MAJOR" \
|| $0 ~ "RHEL_MINOR" \
|| $0 ~ "RHEL_RELEASE_CODE" \
|| $0 ~ "MOFED_MAJOR" \
|| generating_upstream_patch_defined \
&& $0 ~ "GENERATING_UPSTREAM_PATCH" \
|| $0 ~ "CONFIG_TCP_ZERO_COPY_TRANSFER_COMPLETION_NOTIFICATION" \

View File

@@ -65,7 +65,9 @@ ifeq ($(OFED_FLAVOR),MOFED)
# header files use the LINUX_BACKPORT() macro without including
# <linux/compat-2.6.h>, include that header file explicitly.
OFED_KERNEL_DIR:=/usr/src/ofa_kernel/default
OFED_VERS=$(shell rpm -q --qf '%{version}\n' mlnx-ofa_kernel-devel 2>/dev/null)
OFED_CFLAGS:=-I$(OFED_KERNEL_DIR)/include -include linux/compat-2.6.h
OFED_CFLAGS+=-DMOFED_MAJOR=$(shell echo $(OFED_VERS) | cut -f1 -d.)
else
# OFED 1.5
OFED_KERNEL_DIR:=/usr/src/ofa_kernel

View File

@@ -2223,7 +2223,8 @@ 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);
#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0) && \
#elif (LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0) || \
defined(MOFED_MAJOR)) && \
!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);