diff --git a/scripts/specialize-patch b/scripts/specialize-patch index b2b2abe25..df45fb9fa 100755 --- a/scripts/specialize-patch +++ b/scripts/specialize-patch @@ -93,6 +93,9 @@ function evaluate(stmnt, pattern, arg, op, result) { gsub("HAVE_DEV_ATTR_MAX_SEND_SGE", "(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0))", stmnt) + gsub("HAVE_RDMA_DESTROY_AH_WITH_FLAGS", + "(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 21, 0))", stmnt) + gsub("HAVE_RDMA_DESTROY_AH", "(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0))", stmnt) @@ -352,6 +355,7 @@ function handle_if(evaluated) || $0 ~ "HAVE_IB_QUERY_DEVICE" \ || $0 ~ "HAVE_IB_SET_CPI_RESP_TIME" \ || $0 ~ "HAVE_RDMA_DESTROY_AH" \ + || $0 ~ "HAVE_RDMA_DESTROY_AH_WITH_FLAGS" \ || $0 ~ "HAVE_RDMA_QUERY_GID" \ || $0 ~ "HAVE_STRUCT_SRP_LOGIN_REQ_RDMA" \ || $0 ~ "IB_CLIENT_REMOVE_TAKES_TWO_ARGS" \ diff --git a/srpt/Makefile b/srpt/Makefile index b7cd90f84..0c0064135 100644 --- a/srpt/Makefile +++ b/srpt/Makefile @@ -266,6 +266,12 @@ conftest/rdma_destroy_ah/result-$(KVER).txt: \ echo "$(call run_conftest_bool,rdma_destroy_ah, \ HAVE_RDMA_DESTROY_AH)" >"$@" +conftest/rdma_destroy_ah_with_flags/result-$(KVER).txt: \ + conftest/rdma_destroy_ah_with_flags/rdma_destroy_ah_with_flags.c\ + conftest/rdma_destroy_ah_with_flags/Makefile + echo "$(call run_conftest_bool,rdma_destroy_ah_with_flags, \ + HAVE_RDMA_DESTROY_AH_WITH_FLAGS)" >"$@" + conftest/rdma_query_gid/result-$(KVER).txt: \ conftest/rdma_query_gid/rdma_query_gid.c \ conftest/rdma_query_gid/Makefile diff --git a/srpt/conftest/rdma_destroy_ah_with_flags/Makefile b/srpt/conftest/rdma_destroy_ah_with_flags/Makefile new file mode 100644 index 000000000..1bc5bf514 --- /dev/null +++ b/srpt/conftest/rdma_destroy_ah_with_flags/Makefile @@ -0,0 +1,3 @@ +LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE) + +obj-m += rdma_destroy_ah_with_flags.o diff --git a/srpt/conftest/rdma_destroy_ah_with_flags/rdma_destroy_ah_with_flags.c b/srpt/conftest/rdma_destroy_ah_with_flags/rdma_destroy_ah_with_flags.c new file mode 100644 index 000000000..18d7585b4 --- /dev/null +++ b/srpt/conftest/rdma_destroy_ah_with_flags/rdma_destroy_ah_with_flags.c @@ -0,0 +1,11 @@ +#include +#include + +static int modinit(void) +{ + return rdma_destroy_ah(NULL, 0) != 0; + +} + +module_init(modinit); +MODULE_LICENSE("GPL"); diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index 82040821e..00cb83cac 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -605,7 +605,9 @@ 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) { -#if HAVE_RDMA_DESTROY_AH +#if HAVE_RDMA_DESTROY_AH_WITH_FLAGS + rdma_destroy_ah(mad_wc->send_buf->ah, RDMA_DESTROY_AH_SLEEPABLE); +#elif HAVE_RDMA_DESTROY_AH rdma_destroy_ah(mad_wc->send_buf->ah); #else ib_destroy_ah(mad_wc->send_buf->ah); @@ -684,7 +686,9 @@ static void srpt_mad_recv_handler(struct ib_mad_agent *mad_agent, ib_free_send_mad(rsp); err_rsp: -#if HAVE_RDMA_DESTROY_AH +#if HAVE_RDMA_DESTROY_AH_WITH_FLAGS + rdma_destroy_ah(ah, RDMA_DESTROY_AH_SLEEPABLE); +#elif HAVE_RDMA_DESTROY_AH rdma_destroy_ah(ah); #else ib_destroy_ah(ah); diff --git a/srpt/src/ib_srpt.h b/srpt/src/ib_srpt.h index 7ceb48bc2..9bf45647c 100644 --- a/srpt/src/ib_srpt.h +++ b/srpt/src/ib_srpt.h @@ -113,9 +113,11 @@ enum { SRP_CMD_ORDERED_Q = 0x2, SRP_CMD_ACA = 0x4, +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 21, 0) SRP_LOGIN_RSP_MULTICHAN_NO_CHAN = 0x0, SRP_LOGIN_RSP_MULTICHAN_TERMINATED = 0x1, SRP_LOGIN_RSP_MULTICHAN_MAINTAINED = 0x2, +#endif MIN_SRPT_SQ_SIZE = 16, DEF_SRPT_SQ_SIZE = 256,