Skip to contentSkip to conversation

IB/iser: Fix sg_tablesize calculation

PATCH In review Max Gurtovoy 5 participants 6 messages Jan 17, 2017 – Jan 24, 2017 4 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/2 IB/iser: Fix sg_tablesize calculation

For devices that can register page list that is bigger than USHRT_MAX, we actually take the wrong value for sg_tablesize. E.g: for CX4 max_fast_reg_page_list_len is 65536 (bigger than USHRT_MAX) so we set sg_tablesize to 0 by mistake. Therefore, each IO that is bigger than 4k splitted to "< 4k" chunks that cause performance degredation. Remove wrong sg_tablesize assignment, and use the value that was set during address resolution handler with the needed casting.

---
Changes since v2:
- remove "Fixes" statement

Changes since v1:
- update "Fixes" statement
- use sg_tablesize assignment from iser_calc_scsi_params()
- add patch 2/2 to remove unneeded variable

---
 drivers/infiniband/ulp/iser/iscsi_iser.c |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)
drivers/infiniband/ulp/iser/iscsi_iser.c +0 -7
index 9104e6b..1c91187 100644
@@ -651,13 +651,6 @@ static void iscsi_iser_cleanup_task(struct iscsi_task *task)
 						   SHOST_DIX_GUARD_CRC);
 		}
 
-		/*
-		 * Limit the sg_tablesize and max_sectors based on the device
-		 * max fastreg page list length.
-		 */
-		shost->sg_tablesize = min_t(unsigned short, shost->sg_tablesize,
-			ib_conn->device->ib_device->attrs.max_fast_reg_page_list_len);
-
 		if (iscsi_host_add(shost,
 				   ib_conn->device->ib_device->dma_device)) {
 			mutex_unlock(&iser_conn->state_mutex);
Signature · 6 lines
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1484692840-12400-1-git-send-email-maxg-VPRAkNaXOzVWk0Htik3J/[email protected]

#2 lore raw

PATCH v3 2/2 IB/iser: remove unused variable from iser_conn struct

max_sectors calculation was fixed in commit:
9c674815d346 ("IB/iser: Fix max_sectors calculation"). Thus, iser_conn variable scsi_max_sectors is not needed anymore.

---
 drivers/infiniband/ulp/iser/iscsi_iser.c |    4 ++++
 drivers/infiniband/ulp/iser/iscsi_iser.h |    2 --
 drivers/infiniband/ulp/iser/iser_verbs.c |   13 +------------
 3 files changed, 5 insertions(+), 14 deletions(-)
drivers/infiniband/ulp/iser/iscsi_iser.c +4 -0
index 1c91187..e71af71 100644
@@ -672,6 +672,10 @@ static void iscsi_iser_cleanup_task(struct iscsi_task *task)
 	max_fr_sectors = ((shost->sg_tablesize - 1) * PAGE_SIZE) >> 9;
 	shost->max_sectors = min(iser_max_sectors, max_fr_sectors);
 
+	iser_dbg("iser_conn %p, sg_tablesize %u, max_sectors %u\n",
+		 iser_conn, shost->sg_tablesize,
+		 shost->max_sectors);
+
 	if (cmds_max > max_cmds) {
 		iser_info("cmds_max changed from %u to %u\n",
 			  cmds_max, max_cmds);
drivers/infiniband/ulp/iser/iscsi_iser.h +0 -2
index 0be6a7c..9d0b22a 100644
@@ -496,7 +496,6 @@ struct ib_conn {
  * @rx_descs:         rx buffers array (cyclic buffer)
  * @num_rx_descs:     number of rx descriptors
  * @scsi_sg_tablesize: scsi host sg_tablesize
- * @scsi_max_sectors: scsi host max sectors
  */
 struct iser_conn {
 	struct ib_conn		     ib_conn;
@@ -519,7 +518,6 @@ struct iser_conn {
 	struct iser_rx_desc	     *rx_descs;
 	u32                          num_rx_descs;
 	unsigned short               scsi_sg_tablesize;
-	unsigned int                 scsi_max_sectors;
 	bool			     snd_w_inv;
 };
 
drivers/infiniband/ulp/iser/iser_verbs.c +1 -12
index 8ae7a3b..6a9d1cb 100644
@@ -707,18 +707,7 @@ static void iser_connect_error(struct rdma_cm_id *cma_id)
 	sup_sg_tablesize = min_t(unsigned, ISCSI_ISER_MAX_SG_TABLESIZE,
 				 device->ib_device->attrs.max_fast_reg_page_list_len);
 
-	if (sg_tablesize > sup_sg_tablesize) {
-		sg_tablesize = sup_sg_tablesize;
-		iser_conn->scsi_max_sectors = sg_tablesize * SIZE_4K / 512;
-	} else {
-		iser_conn->scsi_max_sectors = max_sectors;
-	}
-
-	iser_conn->scsi_sg_tablesize = sg_tablesize;
-
-	iser_dbg("iser_conn %p, sg_tablesize %u, max_sectors %u\n",
-		 iser_conn, iser_conn->scsi_sg_tablesize,
-		 iser_conn->scsi_max_sectors);
+	iser_conn->scsi_sg_tablesize = min(sg_tablesize, sup_sg_tablesize);
 }
 
 /**
Signature · 6 lines
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1484692840-12400-2-git-send-email-maxg-VPRAkNaXOzVWk0Htik3J/[email protected]

A message that is not in the archive (sent off-list or not yet received): 91c76eee-bead-16e2-1642-a8e4cf89ee73-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org

#6 lore raw

RE: [PATCHv3 2/2] IB/iser: remove unused variable from iser_conn struct

+raju

Quoted 3 lines

This looks good,

Lets wait for Steve to give his Tested-by tag.

Raju should have this tested by EOB tomorrow India time.

Raju, when done, please reply with your Tested-by: tag.

Thanks,

Steve.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Tested-by
#7 lore raw

Re: [PATCHv3 2/2] IB/iser: remove unused variable from iser_conn struct

Looks good.

Thanks,
Raju

From: Steve Wise <[email protected]>
Sent: Wednesday, January 18, 2017 10:43 PM
To: 'Sagi Grimberg'; 'Max Gurtovoy'; [email protected]; [email protected]; [email protected]
Cc: Raju Rangoju
Subject: RE: [PATCHv3 2/2] IB/iser: remove unused variable from iser_conn struct

+raju

Quoted 3 lines

This looks good,

Lets wait for Steve to give his Tested-by tag.

Raju should have this tested by EOB tomorrow India time.

Raju, when done, please reply with your Tested-by: tag.

Thanks,

Steve.

    --

To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): CY1PR12MB07749D43502D9F051DA5AFA1BC7E0-1s8aH8ViOEdztePUUsNjzQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#9 lore raw

Re: [PATCHv3 2/2] IB/iser: remove unused variable from iser_conn struct

Quoted 4 lines · Raju Rangoju

Looks good.

Series applied, thanks.

Signature · 4 lines
Doug Ledford <[email protected]>
    GPG KeyID: B826A3330E572FDD
   
Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD