From af498fafddf58e55f10b48481b2b6a4eacfabb31 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 25 May 2020 18:17:22 +0000 Subject: [PATCH 1/3] nightly build: Update kernel versions git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8981 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- nightly/conf/nightly.conf | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/nightly/conf/nightly.conf b/nightly/conf/nightly.conf index 5681f701d..2a549eaa6 100644 --- a/nightly/conf/nightly.conf +++ b/nightly/conf/nightly.conf @@ -3,30 +3,30 @@ ABT_DETAILS="x86_64" ABT_JOBS=5 ABT_KERNELS=" \ -5.6.12 \ +5.6.14 \ 5.5.19-nc \ -5.4.40-nc \ +5.4.42-nc \ 5.3.18-nc \ 5.2.21-nc \ 5.1.21-nc \ 5.0.21-nc \ 4.20.17-nc \ -4.19.122-nc \ +4.19.124-nc \ 4.18.20-nc \ 4.17.19-nc \ 4.16.18-nc \ 4.15.18-nc \ -4.14.180-nc \ +4.14.181-nc \ 4.13.16-nc \ 4.12.14-nc \ 4.11.12-nc \ 4.10.17-nc \ -4.9.223-nc \ +4.9.224-nc \ 4.8.17-nc \ 4.7.10-nc \ 4.6.7-nc \ 4.5.7-nc \ -4.4.223-nc \ +4.4.224-nc \ 4.3.6-nc \ 4.2.8-nc \ 4.1.52-nc \ @@ -34,7 +34,7 @@ ABT_KERNELS=" \ 3.19.8-nc \ 3.18.140-nc \ 3.17.8-nc \ -3.16.83-nc \ +3.16.84-nc \ 3.15.10-nc \ 3.14.79-nc \ 3.13.11-nc \ From 52497bb8b6d76a6322ba9da609f19d73d6066637 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 25 May 2020 18:18:02 +0000 Subject: [PATCH 2/3] ib_srpt: Introduce a new local variable in srpt_map_sg_to_ib_sge() git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8982 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- srpt/src/ib_srpt.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index a5c309cb3..1f3d31441 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -3278,7 +3278,8 @@ static int srpt_map_sg_to_ib_sge(struct srpt_rdma_ch *ch, struct srpt_send_ioctx *ioctx, struct scst_cmd *cmd) { - struct ib_device *dev __maybe_unused; + struct srpt_device *sdev = ch->sport->sdev; + struct ib_device *dev __maybe_unused = sdev->device; struct scatterlist *sg, *cur_sg; int sg_cnt; scst_data_direction dir; @@ -3294,10 +3295,6 @@ static int srpt_map_sg_to_ib_sge(struct srpt_rdma_ch *ch, int i, j, k; int max_sge, nsge; - BUG_ON(!ch); - BUG_ON(!ioctx); - BUG_ON(!cmd); - dev = ch->sport->sdev->device; max_sge = ch->max_send_sge; dir = scst_cmd_get_data_direction(cmd); BUG_ON(dir == SCST_DATA_NONE); @@ -3316,7 +3313,7 @@ static int srpt_map_sg_to_ib_sge(struct srpt_rdma_ch *ch, } ioctx->sg = sg; ioctx->sg_cnt = sg_cnt; - count = ib_dma_map_sg(ch->sport->sdev->device, sg, sg_cnt, + count = ib_dma_map_sg(sdev->device, sg, sg_cnt, scst_to_tgt_dma_dir(dir)); if (unlikely(!count)) return -EBUSY; @@ -3419,7 +3416,7 @@ static int srpt_map_sg_to_ib_sge(struct srpt_rdma_ch *ch, while (rsize > 0 && tsize > 0) { sge->addr = dma_addr; - sge->lkey = ch->sport->sdev->lkey; + sge->lkey = sdev->lkey; if (rsize >= dma_len) { sge->length = From ac0de9d4859710838bcd5f834787bc1932db8cf9 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 25 May 2020 18:19:45 +0000 Subject: [PATCH 3/3] ib_srpt: Limit the number of scatter/gather elements in RDMA READs to max_sge_rd Additionally, declare the max_sge_delta parameter obsolete. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8983 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- srpt/README | 8 -------- srpt/src/ib_srpt.c | 46 ++-------------------------------------------- 2 files changed, 2 insertions(+), 52 deletions(-) diff --git a/srpt/README b/srpt/README index 9c6fe1f66..334fb5fcc 100644 --- a/srpt/README +++ b/srpt/README @@ -39,14 +39,6 @@ Building and installing the SRP target driver is possible as follows: 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". * rdma_cm_port (number) A 16-bit number that specifies the port number to be registered via the RDMA/CM. Must be specified to make communication over RoCE or iWARP diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index 1f3d31441..30820bfe7 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -166,7 +166,7 @@ MODULE_PARM_DESC(srpt_service_guid, static unsigned int max_sge_delta = 0; module_param(max_sge_delta, uint, 0444); -MODULE_PARM_DESC(max_sge_delta, "Number to subtract from max_sge."); +MODULE_PARM_DESC(max_sge_delta, "Number to subtract from max_sge (obsolete)."); /* * Note: changing any of the two constants below into SCST_CONTEXT_DIRECT is @@ -2340,49 +2340,6 @@ retry: #else ch->max_send_sge = sdev->dev_attr.max_sge; #endif - if (max_sge_delta == 0) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0) - /* - * See also commit b9560a419bfd ("RDMA: Move driver_id into - * struct ib_device_ops") # v5.3. - */ - switch (sdev->device->ops.driver_id) { - case RDMA_DRIVER_MLX4: - /* - * The smallest max_sge_delta value that works with - * ConnectX-3 firmware version 2.42.5000. - */ - max_sge_delta = 2; - break; - case RDMA_DRIVER_MTHCA: - /* - * From the OFED release notes: In mem-free devices, RC - * QPs can be created with a maximum of (max_sge - 1) - * entries only. See also - * https://git.openfabrics.org/?p=compat-rdma/docs.git;a=blob;f=release_notes/mthca_release_notes.txt;h=40f3c4ea77a07fe5ded888b8417530471e89d87b;hb=1ebd1b1dd5b413be595a835bbcb644d2c8897f98. - */ - max_sge_delta = 1; - break; - default: - break; - } -#else - if (strncmp(dev_name(&sdev->device->dev), "mlx4_", 5) == 0) - max_sge_delta = 2; - else if (strncmp(dev_name(&sdev->device->dev), "mthca", 5) == 0) - max_sge_delta = 1; -#endif - pr_debug("max_sge_delta = %d\n", max_sge_delta); - } - /* - * For max_sge values > 2 * max_sge_delta, subtract max_sge_delta. For - * max_sge values < max_sge_delta, use max_sge. For intermediate - * max_sge values, use max_sge_delta. - */ - ch->max_send_sge -= - min_t(unsigned, max_sge_delta, - max_t(int, 0, - ch->max_send_sge - max_sge_delta)); qp_init->cap.max_send_sge = ch->max_send_sge; qp_init->cap.max_recv_sge = 1; if (sdev->use_srq) { @@ -3306,6 +3263,7 @@ static int srpt_map_sg_to_ib_sge(struct srpt_rdma_ch *ch, if (dir == SCST_DATA_WRITE) { scst_cmd_get_write_fields(cmd, &sg, &sg_cnt); WARN_ON(!sg); + max_sge = min(max_sge, ch->sport->sdev->dev_attr.max_sge_rd); } else { sg = scst_cmd_get_sg(cmd); sg_cnt = scst_cmd_get_sg_cnt(cmd);