mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-18 19:21:26 +00:00
ib_srpt: Fix nightly build
This commit is contained in:
@@ -63,6 +63,45 @@ function evaluate(stmnt, pattern, arg, op, result) {
|
||||
stmnt = "+#if !defined(" arg[1] ")"
|
||||
}
|
||||
|
||||
gsub("defined\\(REGISTER_MAD_AGENT_HAS_FLAGS_ARG\\)",
|
||||
"(LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0))", stmnt)
|
||||
|
||||
gsub("defined\\(USE_PRE_440_WR_STRUCTURE\\)",
|
||||
"(LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0))", stmnt)
|
||||
|
||||
gsub("defined\\(IB_CREATE_CQ_HAS_INIT_ATTR\\)",
|
||||
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0))", stmnt)
|
||||
|
||||
gsub("defined\\(CREATE_SEND_MAD_HAS_BASE_ARG\\)",
|
||||
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0))", stmnt)
|
||||
|
||||
gsub("defined\\(IB_CLIENT_REMOVE_TAKES_TWO_ARGS\\)",
|
||||
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0))", stmnt)
|
||||
|
||||
gsub("defined\\(IB_QUERY_GID_HAS_ATTR_ARG\\)",
|
||||
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0))", stmnt)
|
||||
|
||||
gsub("RDMA_CREATE_ID_TAKES_NET_ARG",
|
||||
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0))", stmnt)
|
||||
|
||||
gsub("defined\\(USE_PRE_440_WR_STRUCTURE\\)",
|
||||
"(LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0))", stmnt)
|
||||
|
||||
gsub("defined\\(HAVE_IB_QUERY_DEVICE\\)",
|
||||
"(LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0))", stmnt)
|
||||
|
||||
gsub("defined\\(MAD_HANDLER_TAKES_SEND_BUF\\)",
|
||||
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0))", stmnt)
|
||||
|
||||
gsub("defined\\(HAVE_IB_SET_CPI_RESP_TIME\\)",
|
||||
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0))", stmnt)
|
||||
|
||||
gsub("defined\\(IB_PD_HAS_LOCAL_DMA_LKEY\\)",
|
||||
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0))", stmnt)
|
||||
|
||||
gsub("defined\\(HAVE_IB_DMA_MAP_OPS\\)",
|
||||
"(LINUX_VERSION_CODE >= KERNEL_VERSION(0, 0, 0))", stmnt)
|
||||
|
||||
gsub("LINUX_VERSION_CODE", LINUX_VERSION_CODE, stmnt)
|
||||
|
||||
pattern="KERNEL_VERSION\\([[:blank:]]*([0-9]+)[[:blank:]]*,[[:blank:]]*([0-9]+)[[:blank:]]*,[[:blank:]]*([0-9]+)[[:blank:]]*\\)"
|
||||
@@ -290,12 +329,24 @@ function handle_if(evaluated)
|
||||
# Only act on preprocessor conditional expressions with regard to the Linux
|
||||
# kernel version, and do not interpret other expressions.
|
||||
if ($0 ~ "LINUX_VERSION_CODE" \
|
||||
|| $0 ~ "INSIDE_KERNEL_TREE" \
|
||||
|| $0 ~ "CONFIG_SCST_PROC" \
|
||||
|| $0 ~ "CREATE_SEND_MAD_HAS_BASE_ARG" \
|
||||
|| $0 ~ "HAVE_IB_SET_CPI_RESP_TIME" \
|
||||
|| $0 ~ "HAVE_IB_DMA_MAP_OPS" \
|
||||
|| $0 ~ "IB_CLIENT_REMOVE_TAKES_TWO_ARGS" \
|
||||
|| $0 ~ "IB_CREATE_CQ_HAS_INIT_ATTR" \
|
||||
|| $0 ~ "IB_PD_HAS_LOCAL_DMA_LKEY" \
|
||||
|| $0 ~ "IB_PD_HAS_LOCAL_DMA_LKEY" \
|
||||
|| $0 ~ "IB_QUERY_GID_HAS_ATTR_ARG" \
|
||||
|| $0 ~ "INSIDE_KERNEL_TREE" \
|
||||
|| $0 ~ "MAD_HANDLER_TAKES_SEND_BUF" \
|
||||
|| $0 ~ "MOFED_MAJOR" \
|
||||
|| $0 ~ "REGISTER_MAD_AGENT_HAS_FLAGS_ARG" \
|
||||
|| $0 ~ "RDMA_CREATE_ID_TAKES_NET_ARG" \
|
||||
|| $0 ~ "RHEL_MAJOR" \
|
||||
|| $0 ~ "RHEL_MINOR" \
|
||||
|| $0 ~ "RHEL_RELEASE_CODE" \
|
||||
|| $0 ~ "MOFED_MAJOR" \
|
||||
|| $0 ~ "USE_PRE_440_WR_STRUCTURE" \
|
||||
|| generating_upstream_patch_defined \
|
||||
&& $0 ~ "GENERATING_UPSTREAM_PATCH" \
|
||||
|| $0 ~ "CONFIG_TCP_ZERO_COPY_TRANSFER_COMPLETION_NOTIFICATION" \
|
||||
|
||||
@@ -104,6 +104,7 @@ MAD_HANDLER_TAKES_SEND_BUF := $(call run_conftest,mad_handler_takes_send_buf,-D
|
||||
HAVE_IB_DMA_MAP_OPS := $(call run_conftest,ib_dma_map_ops,-DHAVE_IB_DMA_MAP_OPS)
|
||||
HAVE_IB_SET_CPI_RESP_TIME := $(call run_conftest,ib_set_cpi_resp_time,-DHAVE_IB_SET_CPI_RESP_TIME)
|
||||
GID_CHANGE_FLAG := $(call run_conftest,gid_change,-DHAVE_IB_EVENT_GID_CHANGE)
|
||||
PD_HAS_LOCAL_DMA_LKEY := $(call run_conftest,pd_has_local_dma_lkey,-DIB_PD_HAS_LOCAL_DMA_LKEY)
|
||||
RDMA_CREATE_ID := $(call run_conftest,rdma_create_id_net,-DRDMA_CREATE_ID_TAKES_NET_ARG=1,-DRDMA_CREATE_ID_TAKES_NET_ARG=0)
|
||||
REGISTER_MAD_AGENT_FLAG := $(call run_conftest,register_mad_agent,-DREGISTER_MAD_AGENT_HAS_FLAGS_ARG)
|
||||
QUERY_DEVICE := $(call run_conftest,query_device,-DHAVE_IB_QUERY_DEVICE)
|
||||
@@ -121,6 +122,7 @@ PRE_CFLAGS=$(OFED_CFLAGS) \
|
||||
$(HAVE_IB_DMA_MAP_OPS) \
|
||||
$(HAVE_IB_SET_CPI_RESP_TIME) \
|
||||
$(GID_CHANGE_FLAG) \
|
||||
$(PD_HAS_LOCAL_DMA_LKEY) \
|
||||
$(RDMA_CREATE_ID) \
|
||||
$(REGISTER_MAD_AGENT_FLAG) \
|
||||
$(QUERY_GID_FLAG) \
|
||||
|
||||
3
srpt/conftest/pd_has_local_dma_lkey/Makefile
Normal file
3
srpt/conftest/pd_has_local_dma_lkey/Makefile
Normal file
@@ -0,0 +1,3 @@
|
||||
LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE)
|
||||
|
||||
obj-m += pd_has_local_dma_lkey.o
|
||||
10
srpt/conftest/pd_has_local_dma_lkey/pd_has_local_dma_lkey.c
Normal file
10
srpt/conftest/pd_has_local_dma_lkey/pd_has_local_dma_lkey.c
Normal file
@@ -0,0 +1,10 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/stddef.h>
|
||||
#include <rdma/ib_verbs.h>
|
||||
|
||||
static int modinit(void)
|
||||
{
|
||||
return offsetof(struct ib_pd, local_dma_lkey);
|
||||
}
|
||||
|
||||
module_init(modinit);
|
||||
@@ -625,8 +625,7 @@ static void srpt_mad_recv_handler(struct ib_mad_agent *mad_agent,
|
||||
#endif
|
||||
0, IB_MGMT_DEVICE_HDR, IB_MGMT_DEVICE_DATA,
|
||||
GFP_KERNEL
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) && !defined(MOFED_MAJOR) || \
|
||||
defined(CREATE_SEND_MAD_HAS_BASE_ARG)
|
||||
#ifdef CREATE_SEND_MAD_HAS_BASE_ARG
|
||||
, 0
|
||||
#endif
|
||||
);
|
||||
@@ -701,8 +700,7 @@ static int srpt_refresh_port(struct srpt_port *sport)
|
||||
sport->lid = port_attr.lid;
|
||||
|
||||
ret = ib_query_gid(sport->sdev->device, sport->port, 0, &sport->gid
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0) || \
|
||||
defined(IB_QUERY_GID_HAS_ATTR_ARG)
|
||||
#ifdef IB_QUERY_GID_HAS_ATTR_ARG
|
||||
, NULL
|
||||
#endif
|
||||
);
|
||||
@@ -723,8 +721,7 @@ static int srpt_refresh_port(struct srpt_port *sport)
|
||||
srpt_mad_send_handler,
|
||||
srpt_mad_recv_handler,
|
||||
sport
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0) || \
|
||||
defined(REGISTER_MAD_AGENT_HAS_FLAGS_ARG)
|
||||
#ifdef REGISTER_MAD_AGENT_HAS_FLAGS_ARG
|
||||
, 0
|
||||
#endif
|
||||
);
|
||||
@@ -2224,9 +2221,7 @@ retry:
|
||||
!defined(RHEL_RELEASE_CODE)
|
||||
ch->cq = ib_create_cq(sdev->device, srpt_completion, NULL, ch,
|
||||
ch->rq_size + sq_size);
|
||||
#elif (LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0) || \
|
||||
defined(MOFED_MAJOR)) && \
|
||||
!defined(IB_CREATE_CQ_HAS_INIT_ATTR)
|
||||
#elif !defined(IB_CREATE_CQ_HAS_INIT_ATTR)
|
||||
ch->cq = ib_create_cq(sdev->device, srpt_completion, NULL, ch,
|
||||
ch->rq_size + sq_size, ch->comp_vector);
|
||||
#else
|
||||
@@ -4357,7 +4352,7 @@ static void srpt_add_one(struct ib_device *device)
|
||||
goto free_dev;
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0)
|
||||
#ifndef IB_PD_HAS_LOCAL_DMA_LKEY
|
||||
sdev->mr = ib_get_dma_mr(sdev->pd, IB_ACCESS_LOCAL_WRITE);
|
||||
if (IS_ERR(sdev->mr)) {
|
||||
pr_err("ib_get_dma_mr() failed: %ld\n", PTR_ERR(sdev->mr));
|
||||
@@ -4492,7 +4487,7 @@ err_ring:
|
||||
sdev->srq_size, srp_max_req_size,
|
||||
DMA_FROM_DEVICE);
|
||||
err_mr:
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0)
|
||||
#ifndef IB_PD_HAS_LOCAL_DMA_LKEY
|
||||
ib_dereg_mr(sdev->mr);
|
||||
err_pd:
|
||||
#endif
|
||||
@@ -4565,7 +4560,7 @@ static void srpt_remove_one(struct ib_device *device, void *client_data)
|
||||
ib_destroy_srq(sdev->srq);
|
||||
srpt_free_ioctx_ring((struct srpt_ioctx **)sdev->ioctx_ring, sdev,
|
||||
sdev->srq_size, srp_max_req_size, DMA_FROM_DEVICE);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0)
|
||||
#ifndef IB_PD_HAS_LOCAL_DMA_LKEY
|
||||
ib_dereg_mr(sdev->mr);
|
||||
#endif
|
||||
ib_dealloc_pd(sdev->pd);
|
||||
|
||||
@@ -457,7 +457,7 @@ struct srpt_port {
|
||||
struct srpt_device {
|
||||
struct ib_device *device;
|
||||
struct ib_pd *pd;
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0)
|
||||
#ifndef IB_PD_HAS_LOCAL_DMA_LKEY
|
||||
struct ib_mr *mr;
|
||||
#endif
|
||||
struct ib_srq *srq;
|
||||
|
||||
Reference in New Issue
Block a user