diff --git a/srpt/Makefile b/srpt/Makefile index 214edee8f..03da0fa18 100644 --- a/srpt/Makefile +++ b/srpt/Makefile @@ -236,6 +236,12 @@ conftest/rdma_create_id_net/result-$(KVER).txt: \ echo "$(call run_conftest_bool,rdma_create_id_net, \ RDMA_CREATE_ID_TAKES_NET_ARG)" >"$@" +conftest/rdma_destroy_ah/result-$(KVER).txt: \ + conftest/rdma_destroy_ah/rdma_destroy_ah.c \ + conftest/rdma_destroy_ah/Makefile + echo "$(call run_conftest_bool,rdma_destroy_ah, \ + HAVE_RDMA_DESTROY_AH)" >"$@" + conftest/register_mad_agent/result-$(KVER).txt: \ conftest/register_mad_agent/register_mad_agent.c \ conftest/register_mad_agent/Makefile diff --git a/srpt/conftest/rdma_destroy_ah/Makefile b/srpt/conftest/rdma_destroy_ah/Makefile new file mode 100644 index 000000000..2693ee734 --- /dev/null +++ b/srpt/conftest/rdma_destroy_ah/Makefile @@ -0,0 +1,3 @@ +LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE) + +obj-m += rdma_destroy_ah.o diff --git a/srpt/conftest/rdma_destroy_ah/rdma_destroy_ah.c b/srpt/conftest/rdma_destroy_ah/rdma_destroy_ah.c new file mode 100644 index 000000000..375474f54 --- /dev/null +++ b/srpt/conftest/rdma_destroy_ah/rdma_destroy_ah.c @@ -0,0 +1,10 @@ +#include +#include + +static int modinit(void) +{ + return rdma_destroy_ah(NULL) != 0; + +} + +module_init(modinit); diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index c65c76b15..fe7fe72cb 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -589,7 +589,11 @@ static void srpt_mgmt_method_get(struct srpt_port *sp, struct ib_mad *rq_mad, static void srpt_mad_send_handler(struct ib_mad_agent *mad_agent, struct ib_mad_send_wc *mad_wc) { +#ifdef HAVE_RDMA_DESTROY_AH + rdma_destroy_ah(mad_wc->send_buf->ah); +#else ib_destroy_ah(mad_wc->send_buf->ah); +#endif ib_free_send_mad(mad_wc->send_buf); } @@ -661,7 +665,12 @@ static void srpt_mad_recv_handler(struct ib_mad_agent *mad_agent, ib_free_send_mad(rsp); err_rsp: +#ifdef HAVE_RDMA_DESTROY_AH + rdma_destroy_ah(ah); +#else ib_destroy_ah(ah); +#endif + err: ib_free_recv_mad(mad_wc); }