diff --git a/srpt/README b/srpt/README index ae06ffd62..0d805bdb3 100644 --- a/srpt/README +++ b/srpt/README @@ -38,6 +38,15 @@ Building and installing the SRP target driver is possible as follows: fi The ib_srpt kernel module supports the following parameters: + +* max_sge_delta (unsigned): Number to subtract from max_sge. Some but not + all HCA's allow to use up to max_sge S/G-list elements in RDMA + communication. The default value of this parameter is 3 and works with all + HCA's. If you know that the HCA's that are used by the ib_srpt driver allow + to use S/G-lists that are longer than max_sge - 3 then you can decrease this + parameter. Note: setting this parameter too low will cause SRP every login + to fail and will cause a message similar to the following to be logged on + the target system: "ib_srpt: RDMA t ... for idx ... failed with status 12". * one_target_per_port (boolean) and * use_node_guid_in_target_name (boolean) ib_srpt can operate in one of the following three modes: diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index 4ec301ecc..437aa5e83 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -171,6 +171,10 @@ MODULE_PARM_DESC(srpt_service_guid, "Using this value for ioc_guid, id_ext, and cm_listen_id" " instead of using the node_guid of the first HCA."); +static unsigned max_sge_delta = 3; +module_param(max_sge_delta, uint, 0444); +MODULE_PARM_DESC(max_sge_delta, "Number to subtract from max_sge."); + /* * Note: changing any of the two constants below into SCST_CONTEXT_DIRECT is * dangerous because it might cause IB completions to be processed too late @@ -2151,19 +2155,7 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch) qp_init->sq_sig_type = IB_SIGNAL_REQ_WR; qp_init->qp_type = IB_QPT_RC; qp_init->cap.max_send_wr = srpt_sq_size; - /* - * A quote from the OFED 1.5.3.1 release notes - * (docs/release_notes/mthca_release_notes.txt), section "Known Issues": - * In mem-free devices, RC QPs can be created with a maximum of - * (max_sge - 1) entries only; UD QPs can be created with a maximum of - * (max_sge - 3) entries. - * A quote from the OFED 1.2.5 release notes - * (docs/mthca_release_notes.txt), section "Known Issues": - * In mem-free devices, RC QPs can be created with a maximum of - * (max_sge - 3) entries only. - */ - ch->max_sge = sdev->dev_attr.max_sge - 3; - WARN_ON(ch->max_sge < 1); + ch->max_sge = max_t(int, 1, sdev->dev_attr.max_sge - max_sge_delta); qp_init->cap.max_send_sge = ch->max_sge; if (ch->using_rdma_cm) {