mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-18 19:21:26 +00:00
ib_srpt: CentOS 7.3 build fix
This commit is contained in:
@@ -87,23 +87,40 @@ OTHER_GOALS:=$(foreach goal,$(MAKECMDGOALS),$(subst all,,$(goal)))
|
||||
# echo:=$(shell echo 'OTHER_GOALS = $(OTHER_GOALS)' >&2)
|
||||
ifneq ("$(GOALS)","$(OTHER_GOALS)")
|
||||
run_conftest = $(shell if [ "0$(V)" -gt 0 ]; then output=/dev/stdout; else output=/dev/null; fi; if $(MAKE) -C $(KDIR) V=$(V) SUBDIRS="$(shell pwd)/conftest/$1" PRE_CFLAGS="-Werror $(OFED_CFLAGS)" 1>&2 2>$${output}; then echo "$2"; else echo "$3"; fi)
|
||||
USE_PRE_440_WR_STRUCTURE := $(call run_conftest,use_pre_440_wr_structure,-DUSE_PRE_440_WR_STRUCTURE)
|
||||
CREATE_CQ_FLAG := $(call run_conftest,create_cq,-DIB_CREATE_CQ_HAS_INIT_ATTR)
|
||||
CREATE_SEND_MAD_AH_FLAG := $(call run_conftest,create_send_mad_ah,-DCREATE_SEND_MAD_HAS_AH_ARG)
|
||||
ifeq ($(CREATE_SEND_MAD_AH_FLAG),)
|
||||
CREATE_SEND_MAD_BASE_FLAG := $(call run_conftest,create_send_mad_base,-DCREATE_SEND_MAD_HAS_BASE_ARG)
|
||||
endif
|
||||
CLIENT_REMOVE := $(call run_conftest,ib_client_remove,-DIB_CLIENT_REMOVE_TAKES_TWO_ARGS)
|
||||
CM_LISTEN := $(call run_conftest,cm_listen,-DIB_CM_LISTEN_TAKES_FOURTH_ARG)
|
||||
MAD_HANDLER_TAKES_SEND_BUF := $(call run_conftest,mad_handler_takes_send_buf,-DMAD_HANDLER_TAKES_SEND_BUF)
|
||||
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)
|
||||
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)
|
||||
QUERY_DEVICE_HAS_ATTR_ARG := $(call run_conftest,query_device_attr_arg,-DIB_QUERY_DEVICE_HAS_ATTR_ARG)
|
||||
QUERY_GID_FLAG := $(call run_conftest,query_gid,-DIB_QUERY_GID_HAS_ATTR_ARG)
|
||||
PRE_CFLAGS=$(OFED_CFLAGS) \
|
||||
$(USE_PRE_440_WR_STRUCTURE) \
|
||||
$(CLIENT_REMOVE) \
|
||||
$(CREATE_CQ_FLAG) \
|
||||
$(CREATE_SEND_MAD_AH_FLAG) \
|
||||
$(CREATE_SEND_MAD_BASE_FLAG) \
|
||||
$(IB_CLIENT_REMOVE_TAKES_TWO_ARGS) \
|
||||
$(CM_LISTEN) \
|
||||
$(MAD_HANDLER_TAKES_SEND_BUF) \
|
||||
$(HAVE_IB_DMA_MAP_OPS) \
|
||||
$(HAVE_IB_SET_CPI_RESP_TIME) \
|
||||
$(GID_CHANGE_FLAG) \
|
||||
$(RDMA_CREATE_ID) \
|
||||
$(REGISTER_MAD_AGENT_FLAG) \
|
||||
$(QUERY_GID_FLAG) \
|
||||
$(QUERY_DEVICE) \
|
||||
$(QUERY_DEVICE_HAS_ATTR_ARG) \
|
||||
-DOFED_FLAVOR=$(OFED_FLAVOR)
|
||||
endif
|
||||
|
||||
|
||||
3
srpt/conftest/cm_listen/Makefile
Normal file
3
srpt/conftest/cm_listen/Makefile
Normal file
@@ -0,0 +1,3 @@
|
||||
LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE)
|
||||
|
||||
obj-m += cm_listen.o
|
||||
9
srpt/conftest/cm_listen/cm_listen.c
Normal file
9
srpt/conftest/cm_listen/cm_listen.c
Normal file
@@ -0,0 +1,9 @@
|
||||
#include <linux/module.h>
|
||||
#include <rdma/ib_cm.h>
|
||||
|
||||
static int modinit(void)
|
||||
{
|
||||
return ib_cm_listen(NULL, 0, 0, NULL);
|
||||
}
|
||||
|
||||
module_init(modinit);
|
||||
3
srpt/conftest/ib_client_remove/Makefile
Normal file
3
srpt/conftest/ib_client_remove/Makefile
Normal file
@@ -0,0 +1,3 @@
|
||||
LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE)
|
||||
|
||||
obj-m += ib_client_remove.o
|
||||
15
srpt/conftest/ib_client_remove/ib_client_remove.c
Normal file
15
srpt/conftest/ib_client_remove/ib_client_remove.c
Normal file
@@ -0,0 +1,15 @@
|
||||
#include <linux/module.h>
|
||||
#include <rdma/ib_verbs.h>
|
||||
|
||||
static void client_remove(struct ib_device *dev, void *client_data)
|
||||
{
|
||||
}
|
||||
|
||||
static int modinit(void)
|
||||
{
|
||||
struct ib_client c = { .remove = client_remove };
|
||||
|
||||
return (uintptr_t)c.remove;
|
||||
}
|
||||
|
||||
module_init(modinit);
|
||||
3
srpt/conftest/ib_set_cpi_resp_time/Makefile
Normal file
3
srpt/conftest/ib_set_cpi_resp_time/Makefile
Normal file
@@ -0,0 +1,3 @@
|
||||
LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE)
|
||||
|
||||
obj-m += ib_set_cpi_resp_time.o
|
||||
@@ -0,0 +1,9 @@
|
||||
#include <linux/module.h>
|
||||
#include <rdma/ib_mad.h>
|
||||
|
||||
static int modinit(void)
|
||||
{
|
||||
return (uintptr_t)ib_set_cpi_resp_time;
|
||||
}
|
||||
|
||||
module_init(modinit);
|
||||
3
srpt/conftest/mad_handler_takes_send_buf/Makefile
Normal file
3
srpt/conftest/mad_handler_takes_send_buf/Makefile
Normal file
@@ -0,0 +1,3 @@
|
||||
LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE)
|
||||
|
||||
obj-m += mad_handler_takes_send_buf.o
|
||||
@@ -0,0 +1,17 @@
|
||||
#include <linux/module.h>
|
||||
#include <rdma/ib_mad.h>
|
||||
|
||||
static void imrh(struct ib_mad_agent *mad_agent,
|
||||
struct ib_mad_send_buf *send_buf,
|
||||
struct ib_mad_recv_wc *mad_recv_wc)
|
||||
{
|
||||
}
|
||||
|
||||
static int modinit(void)
|
||||
{
|
||||
ib_mad_recv_handler h = imrh;
|
||||
|
||||
return !!h;
|
||||
}
|
||||
|
||||
module_init(modinit);
|
||||
3
srpt/conftest/query_device/Makefile
Normal file
3
srpt/conftest/query_device/Makefile
Normal file
@@ -0,0 +1,3 @@
|
||||
LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE)
|
||||
|
||||
obj-m += query_device.o
|
||||
9
srpt/conftest/query_device/query_device.c
Normal file
9
srpt/conftest/query_device/query_device.c
Normal file
@@ -0,0 +1,9 @@
|
||||
#include <linux/module.h>
|
||||
#include <rdma/ib_verbs.h>
|
||||
|
||||
static int modinit(void)
|
||||
{
|
||||
return (uintptr_t)ib_query_device;
|
||||
}
|
||||
|
||||
module_init(modinit);
|
||||
3
srpt/conftest/query_device_attr_arg/Makefile
Normal file
3
srpt/conftest/query_device_attr_arg/Makefile
Normal file
@@ -0,0 +1,3 @@
|
||||
LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE)
|
||||
|
||||
obj-m += query_device_attr_arg.o
|
||||
@@ -0,0 +1,9 @@
|
||||
#include <linux/module.h>
|
||||
#include <rdma/ib_verbs.h>
|
||||
|
||||
static int modinit(void)
|
||||
{
|
||||
return ib_query_device(NULL, NULL);
|
||||
}
|
||||
|
||||
module_init(modinit);
|
||||
3
srpt/conftest/rdma_create_id_net/Makefile
Normal file
3
srpt/conftest/rdma_create_id_net/Makefile
Normal file
@@ -0,0 +1,3 @@
|
||||
LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE)
|
||||
|
||||
obj-m += rdma_create_id_net.o
|
||||
10
srpt/conftest/rdma_create_id_net/rdma_create_id_net.c
Normal file
10
srpt/conftest/rdma_create_id_net/rdma_create_id_net.c
Normal file
@@ -0,0 +1,10 @@
|
||||
#include <linux/module.h>
|
||||
#include <rdma/rdma_cm.h>
|
||||
|
||||
static int modinit(void)
|
||||
{
|
||||
return rdma_create_id(NULL, NULL, NULL, 0, 0) != NULL;
|
||||
|
||||
}
|
||||
|
||||
module_init(modinit);
|
||||
3
srpt/conftest/use_pre_440_wr_structure/Makefile
Normal file
3
srpt/conftest/use_pre_440_wr_structure/Makefile
Normal file
@@ -0,0 +1,3 @@
|
||||
LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE)
|
||||
|
||||
obj-m += use_pre_440_wr_structure.o
|
||||
@@ -0,0 +1,11 @@
|
||||
#include <linux/module.h>
|
||||
#include <rdma/ib_verbs.h>
|
||||
|
||||
static int modinit(void)
|
||||
{
|
||||
struct ib_send_wr wr = { };
|
||||
|
||||
return wr.wr.rdma.rkey;
|
||||
}
|
||||
|
||||
module_init(modinit);
|
||||
@@ -418,7 +418,7 @@ static void srpt_get_class_port_info(struct ib_dm_mad *mad)
|
||||
memset(cif, 0, sizeof(*cif));
|
||||
cif->base_version = 1;
|
||||
cif->class_version = 1;
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0)
|
||||
#ifndef HAVE_IB_SET_CPI_RESP_TIME
|
||||
cif->resp_time_value = 20;
|
||||
#else
|
||||
ib_set_cpi_resp_time(cif, 20);
|
||||
@@ -598,7 +598,7 @@ static void srpt_mad_send_handler(struct ib_mad_agent *mad_agent,
|
||||
* srpt_mad_recv_handler() - MAD reception callback function.
|
||||
*/
|
||||
static void srpt_mad_recv_handler(struct ib_mad_agent *mad_agent,
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) && !defined(MOFED_MAJOR)
|
||||
#ifdef MAD_HANDLER_TAKES_SEND_BUF
|
||||
struct ib_mad_send_buf *send_buf,
|
||||
#endif
|
||||
struct ib_mad_recv_wc *mad_wc)
|
||||
@@ -3389,7 +3389,7 @@ static int srpt_perform_rdmas(struct srpt_rdma_ch *ch,
|
||||
struct srpt_send_ioctx *ioctx,
|
||||
scst_data_direction dir)
|
||||
{
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR)
|
||||
#ifdef USE_PRE_440_WR_STRUCTURE
|
||||
struct ib_send_wr wr;
|
||||
#else
|
||||
struct ib_rdma_wr wr;
|
||||
@@ -3414,7 +3414,7 @@ static int srpt_perform_rdmas(struct srpt_rdma_ch *ch,
|
||||
memset(&wr, 0, sizeof(wr));
|
||||
|
||||
for (i = 0; i < n_rdma; ++i, ++riu) {
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR)
|
||||
#ifdef USE_PRE_440_WR_STRUCTURE
|
||||
if (dir == SCST_DATA_READ) {
|
||||
wr.opcode = IB_WR_RDMA_WRITE;
|
||||
wr.wr_id = encode_wr_id(i == n_rdma - 1 ?
|
||||
@@ -3473,7 +3473,7 @@ static int srpt_perform_rdmas(struct srpt_rdma_ch *ch,
|
||||
pr_err("%s: ib_post_send() returned %d for %d/%d\n", __func__,
|
||||
ret, i, n_rdma);
|
||||
if (ret && i > 0) {
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR)
|
||||
#ifdef USE_PRE_440_WR_STRUCTURE
|
||||
wr.num_sge = 0;
|
||||
wr.wr_id = encode_wr_id(SRPT_RDMA_ABORT, ioctx->ioctx.index);
|
||||
wr.send_flags = IB_SEND_SIGNALED;
|
||||
@@ -3500,7 +3500,7 @@ static int srpt_perform_rdmas(struct srpt_rdma_ch *ch,
|
||||
#endif
|
||||
pr_info("Waiting until RDMA abort finished [%d]\n",
|
||||
ioctx->ioctx.index);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR)
|
||||
#ifdef USE_PRE_440_WR_STRUCTURE
|
||||
while (ch->state < CH_DISCONNECTED && !ioctx->rdma_aborted) {
|
||||
pr_info("Waiting until RDMA abort finished [%d]\n",
|
||||
ioctx->ioctx.index);
|
||||
@@ -4341,7 +4341,7 @@ static void srpt_add_one(struct ib_device *device)
|
||||
|
||||
sdev->device = device;
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) || defined(MOFED_MAJOR)
|
||||
#ifdef HAVE_IB_QUERY_DEVICE
|
||||
ret = ib_query_device(device, &sdev->dev_attr);
|
||||
if (ret) {
|
||||
pr_err("ib_query_device() failed: %d\n", ret);
|
||||
@@ -4459,7 +4459,7 @@ static void srpt_add_one(struct ib_device *device)
|
||||
* if this HCA is gone bad and replaced by different HCA
|
||||
*/
|
||||
ret = ib_cm_listen(sdev->cm_id, cpu_to_be64(srpt_service_guid), 0
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) || defined(MOFED_MAJOR)
|
||||
#ifdef IB_CM_LISTEN_TAKES_FOURTH_ARG
|
||||
, NULL
|
||||
#endif
|
||||
);
|
||||
@@ -4508,7 +4508,7 @@ err:
|
||||
/**
|
||||
* srpt_remove_one() - InfiniBand device removal callback function.
|
||||
*/
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) || defined(MOFED_MAJOR)
|
||||
#ifndef IB_CLIENT_REMOVE_TAKES_TWO_ARGS
|
||||
static void srpt_remove_one(struct ib_device *device)
|
||||
{
|
||||
void *client_data = ib_get_client_data(device, &srpt_client);
|
||||
@@ -4690,7 +4690,7 @@ static int __init srpt_init_module(void)
|
||||
(!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 6)
|
||||
rdma_cm_id = rdma_create_id(srpt_rdma_cm_handler, NULL,
|
||||
RDMA_PS_TCP);
|
||||
#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR)
|
||||
#elif !RDMA_CREATE_ID_TAKES_NET_ARG
|
||||
rdma_cm_id = rdma_create_id(srpt_rdma_cm_handler, NULL,
|
||||
RDMA_PS_TCP, IB_QPT_RC);
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user