mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-14 09:11:27 +00:00
ib_srpt: Detect ib_sg_dma_len() presence at compile time
This patch makes it possible to build the ib_srpt driver against a kernel before v5.1 + latest MOFED. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8655 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -148,6 +148,9 @@ function evaluate(stmnt, pattern, arg, op, result) {
|
||||
gsub("defined\\(HAVE_IB_DMA_MAP_OPS\\)",
|
||||
"(LINUX_VERSION_CODE >= KERNEL_VERSION(0, 0, 0))", stmnt)
|
||||
|
||||
gsub("defined\\(HAVE_IB_SG_DMA_LEN\\)",
|
||||
"(LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0))", stmnt)
|
||||
|
||||
gsub("defined(ENABLE_NPIV)", 0, stmnt)
|
||||
|
||||
gsub("defined(FC_VPORT_CREATE_DEFINED)", 0, stmnt)
|
||||
@@ -398,6 +401,7 @@ function handle_if(evaluated)
|
||||
|| $0 ~ "HAVE_IB_DMA_MAP_OPS" \
|
||||
|| $0 ~ "HAVE_IB_QUERY_DEVICE" \
|
||||
|| $0 ~ "HAVE_IB_SET_CPI_RESP_TIME" \
|
||||
|| $0 ~ "HAVE_IB_SG_DMA_LEN" \
|
||||
|| $0 ~ "HAVE_RDMA_DESTROY_AH" \
|
||||
|| $0 ~ "HAVE_RDMA_DESTROY_AH_WITH_FLAGS" \
|
||||
|| $0 ~ "HAVE_RDMA_QUERY_GID" \
|
||||
|
||||
@@ -1588,11 +1588,6 @@ static inline struct ib_pd *ib_alloc_pd_backport(struct ib_device *device)
|
||||
})
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0)
|
||||
#define ib_sg_dma_len(dev, sg) sg_dma_len(sg)
|
||||
#define ib_sg_dma_address(dev, sg) sg_dma_address(sg)
|
||||
#endif
|
||||
|
||||
/* <scsi/scsi_cmnd.h> */
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) || \
|
||||
|
||||
@@ -212,6 +212,11 @@ conftest/ib_set_cpi_resp_time/result-$(KVER).txt: \
|
||||
echo "$(call run_conftest,ib_set_cpi_resp_time, \
|
||||
-DHAVE_IB_SET_CPI_RESP_TIME)" >"$@"
|
||||
|
||||
conftest/ib_sg_dma_len/result-$(KVER).txt: \
|
||||
conftest/ib_sg_dma_len/ib_sg_dma_len.c \
|
||||
conftest/ib_sg_dma_len/Makefile
|
||||
echo "$(call run_conftest_bool,ib_sg_dma_len,HAVE_IB_SG_DMA_LEN)" >"$@"
|
||||
|
||||
conftest/mad_handler_takes_send_buf/result-$(KVER).txt: \
|
||||
conftest/mad_handler_takes_send_buf/mad_handler_takes_send_buf.c\
|
||||
conftest/mad_handler_takes_send_buf/Makefile
|
||||
|
||||
3
srpt/conftest/ib_sg_dma_len/Makefile
Normal file
3
srpt/conftest/ib_sg_dma_len/Makefile
Normal file
@@ -0,0 +1,3 @@
|
||||
LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE)
|
||||
|
||||
obj-m += ib_sg_dma_len.o
|
||||
11
srpt/conftest/ib_sg_dma_len/ib_sg_dma_len.c
Normal file
11
srpt/conftest/ib_sg_dma_len/ib_sg_dma_len.c
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <linux/module.h>
|
||||
#include <rdma/ib_verbs.h>
|
||||
|
||||
#undef ib_sg_dma_len
|
||||
|
||||
static int modinit(void)
|
||||
{
|
||||
return ib_sg_dma_len != NULL;
|
||||
}
|
||||
|
||||
module_init(modinit);
|
||||
@@ -66,6 +66,11 @@
|
||||
|
||||
struct srpt_nexus;
|
||||
|
||||
#if !HAVE_IB_SG_DMA_LEN
|
||||
#define ib_sg_dma_len(dev, sg) sg_dma_len(sg)
|
||||
#define ib_sg_dma_address(dev, sg) sg_dma_address(sg)
|
||||
#endif
|
||||
|
||||
#if !HAVE_SRP_DATA_DESC_IMM
|
||||
enum {
|
||||
SRP_DATA_DESC_IMM = 3,
|
||||
|
||||
Reference in New Issue
Block a user