From e27669332566261ab931d8a57e8640e9adea0903 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 30 Jul 2015 17:33:56 +0000 Subject: [PATCH] ib_srpt: Linux kernel v4.2 build fix (merge r6423 from trunk) git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/3.0.x@6452 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- srpt/Makefile | 3 ++- srpt/conftest/create_send_mad/Makefile | 3 +++ srpt/conftest/create_send_mad/create_send_mad.c | 13 +++++++++++++ srpt/src/ib_srpt.c | 7 +++++-- 4 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 srpt/conftest/create_send_mad/Makefile create mode 100644 srpt/conftest/create_send_mad/create_send_mad.c diff --git a/srpt/Makefile b/srpt/Makefile index 65ccaceab..1e9817d1a 100644 --- a/srpt/Makefile +++ b/srpt/Makefile @@ -77,9 +77,10 @@ endif OFED_MODULE_SYMVERS:=$(OFED_KERNEL_DIR)/$(MODULE_SYMVERS) endif +CREATE_SEND_MAD_FLAG = $(shell $(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd)/conftest/create_send_mad PRE_CFLAGS="$(OFED_CFLAGS)" >/dev/null 2>&1 && echo -DCREATE_SEND_MAD_HAS_AH_ARG) GID_CHANGE_FLAG = $(shell $(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd)/conftest/gid_change PRE_CFLAGS="$(OFED_CFLAGS)" >/dev/null 2>&1 && echo -DHAVE_IB_EVENT_GID_CHANGE) REGISTER_MAD_AGENT_FLAG = $(shell $(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd)/conftest/register_mad_agent PRE_CFLAGS="$(OFED_CFLAGS) -Werror" >/dev/null 2>&1 && echo -DREGISTER_MAD_AGENT_HAS_FLAGS_ARG) -PRE_CFLAGS=$(OFED_CFLAGS) $(GID_CHANGE_FLAG) $(REGISTER_MAD_AGENT_FLAG) -DOFED_FLAVOR=$(OFED_FLAVOR) +PRE_CFLAGS=$(OFED_CFLAGS) $(CREATE_SEND_MAD_FLAG) $(GID_CHANGE_FLAG) $(REGISTER_MAD_AGENT_FLAG) -DOFED_FLAVOR=$(OFED_FLAVOR) all: src/$(MODULE_SYMVERS) $(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd)/src \ diff --git a/srpt/conftest/create_send_mad/Makefile b/srpt/conftest/create_send_mad/Makefile new file mode 100644 index 000000000..0175c993c --- /dev/null +++ b/srpt/conftest/create_send_mad/Makefile @@ -0,0 +1,3 @@ +LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE) + +obj-m += create_send_mad.o diff --git a/srpt/conftest/create_send_mad/create_send_mad.c b/srpt/conftest/create_send_mad/create_send_mad.c new file mode 100644 index 000000000..529a00858 --- /dev/null +++ b/srpt/conftest/create_send_mad/create_send_mad.c @@ -0,0 +1,13 @@ +#include +#include + +static int modinit(void) +{ + struct ib_mad_send_buf *b; + + b = ib_create_send_mad(NULL, 0, 0, NULL, 0, 0, 0, 0); + + return b != 0; +} + +module_init(modinit); diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index 54b1f9ee5..3aef620f5 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -597,8 +597,11 @@ static void srpt_mad_recv_handler(struct ib_mad_agent *mad_agent, BUILD_BUG_ON(offsetof(struct ib_dm_mad, data) != IB_MGMT_DEVICE_HDR); rsp = ib_create_send_mad(mad_agent, mad_wc->wc->src_qp, - mad_wc->wc->pkey_index, 0, - IB_MGMT_DEVICE_HDR, IB_MGMT_DEVICE_DATA, + mad_wc->wc->pkey_index, +#ifdef CREATE_SEND_MAD_HAS_AH_ARG + NULL, +#endif + 0, IB_MGMT_DEVICE_HDR, IB_MGMT_DEVICE_DATA, GFP_KERNEL); if (IS_ERR(rsp)) goto err_rsp;