diff --git a/iscsi-scst/Makefile b/iscsi-scst/Makefile index 00ddfd2fb..ec37c8578 100644 --- a/iscsi-scst/Makefile +++ b/iscsi-scst/Makefile @@ -221,6 +221,18 @@ extraclean: clean kernel/isert-scst/*.orig kernel/isert-scst/*.rej rm -rf conftest/*/*.rej conftest/*/*.orig +conftest/bad_wr_mod/result-$(KVER).txt: \ + conftest/bad_wr_mod/bad_wr_mod.c \ + conftest/bad_wr_mod/Makefile + echo "$(call run_conftest,bad_wr_mod, \ + -DBAD_WR_MODIFIER=const,-DBAD_WR_MODIFIER=)" >"$@" + +conftest/cm_event_mod/result-$(KVER).txt: \ + conftest/cm_event_mod/cm_event_mod.c \ + conftest/cm_event_mod/Makefile + echo "$(call run_conftest,cm_event_mod, \ + -DCM_HANDLER_EVENT_MODIFIER=const,-DCM_HANDLER_EVENT_MODIFIER=)" >"$@" + conftest/cm_listen/result-$(KVER).txt: \ conftest/cm_listen/cm_listen.c \ conftest/cm_listen/Makefile diff --git a/iscsi-scst/conftest/bad_wr_mod/Makefile b/iscsi-scst/conftest/bad_wr_mod/Makefile new file mode 100644 index 000000000..aaa933974 --- /dev/null +++ b/iscsi-scst/conftest/bad_wr_mod/Makefile @@ -0,0 +1,3 @@ +LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE) + +obj-m += bad_wr_mod.o diff --git a/iscsi-scst/conftest/bad_wr_mod/bad_wr_mod.c b/iscsi-scst/conftest/bad_wr_mod/bad_wr_mod.c new file mode 100644 index 000000000..cfd76d393 --- /dev/null +++ b/iscsi-scst/conftest/bad_wr_mod/bad_wr_mod.c @@ -0,0 +1,13 @@ +#include +#include + +static int modinit(void) +{ + struct ib_qp *qp = NULL; + const struct ib_recv_wr *recv_wr = NULL; + const struct ib_recv_wr **bad_recv_wr = NULL; + + return ib_post_recv(qp, recv_wr, bad_recv_wr); +} + +module_init(modinit); diff --git a/iscsi-scst/conftest/cm_event_mod/Makefile b/iscsi-scst/conftest/cm_event_mod/Makefile new file mode 100644 index 000000000..7df493105 --- /dev/null +++ b/iscsi-scst/conftest/cm_event_mod/Makefile @@ -0,0 +1,3 @@ +LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE) + +obj-m += cm_event_mod.o diff --git a/iscsi-scst/conftest/cm_event_mod/cm_event_mod.c b/iscsi-scst/conftest/cm_event_mod/cm_event_mod.c new file mode 100644 index 000000000..23ec6a4fb --- /dev/null +++ b/iscsi-scst/conftest/cm_event_mod/cm_event_mod.c @@ -0,0 +1,14 @@ +#include +#include + +static int h(struct ib_cm_id *cm_id, const struct ib_cm_event *event) +{ + return 0; +} + +static int modinit(void) +{ + return ib_create_cm_id(NULL, h, NULL) != NULL; +} + +module_init(modinit); diff --git a/iscsi-scst/kernel/isert-scst/iser_rdma.c b/iscsi-scst/kernel/isert-scst/iser_rdma.c index c97924d01..3fb80102f 100644 --- a/iscsi-scst/kernel/isert-scst/iser_rdma.c +++ b/iscsi-scst/kernel/isert-scst/iser_rdma.c @@ -55,7 +55,7 @@ static DEFINE_MUTEX(dev_list_mutex); static void isert_portal_free(struct isert_portal *portal); static int isert_num_recv_posted_on_err(struct ib_recv_wr *first_ib_wr, - struct ib_recv_wr *bad_wr) + BAD_WR_MODIFIER struct ib_recv_wr *bad_wr) { struct ib_recv_wr *wr; int num_posted = 0; @@ -71,7 +71,7 @@ int isert_post_recv(struct isert_connection *isert_conn, int num_wr) { struct ib_recv_wr *first_ib_wr = &first_wr->recv_wr; - struct ib_recv_wr *bad_wr; + BAD_WR_MODIFIER struct ib_recv_wr *bad_wr; int num_posted; int err; @@ -98,7 +98,7 @@ int isert_post_recv(struct isert_connection *isert_conn, } static int isert_num_send_posted_on_err(struct ib_send_wr *first_ib_wr, - struct ib_send_wr *bad_wr) + BAD_WR_MODIFIER struct ib_send_wr *bad_wr) { struct ib_send_wr *wr; int num_posted = 0; @@ -118,7 +118,7 @@ int isert_post_send(struct isert_connection *isert_conn, #else struct ib_send_wr *first_ib_wr = &first_wr->send_wr.wr; #endif - struct ib_send_wr *bad_wr; + BAD_WR_MODIFIER struct ib_send_wr *bad_wr; int num_posted; int err; @@ -146,7 +146,7 @@ int isert_post_send(struct isert_connection *isert_conn, static void isert_post_drain_sq(struct isert_connection *isert_conn) { - struct ib_send_wr *bad_wr; + BAD_WR_MODIFIER struct ib_send_wr *bad_wr; struct isert_wr *drain_wr_sq = &isert_conn->drain_wr_sq; int err; @@ -177,7 +177,7 @@ static void isert_post_drain_sq(struct isert_connection *isert_conn) static void isert_post_drain_rq(struct isert_connection *isert_conn) { - struct ib_recv_wr *bad_wr; + BAD_WR_MODIFIER struct ib_recv_wr *bad_wr; struct isert_wr *drain_wr_rq = &isert_conn->drain_wr_rq; int err; @@ -1292,7 +1292,11 @@ static struct isert_connection *isert_conn_create(struct rdma_cm_id *cm_id, * In mem-free devices, RC QPs can be created with a maximum of * (max_sge - 3) entries only. */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 0) isert_conn->max_sge = isert_dev->device_attr.max_sge - 3; +#else + isert_conn->max_sge = isert_dev->device_attr.max_recv_sge - 3; +#endif WARN_ON(isert_conn->max_sge < 1);