Skip to content

Commit 7854550

Browse files
Steve Wisedledford
authored andcommitted
RDMA/iser: Limit sgs to the device fastreg depth
Currently the sg tablesize, which dictates fast register page list depth to use, does not take into account the limits of the rdma device. So adjust it once we discover the device fastreg max depth limit. Also adjust the max_sectors based on the resulting sg tablesize. Signed-off-by: Steve Wise <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent d6c7276 commit 7854550

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/infiniband/ulp/iser/iscsi_iser.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,15 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep,
640640
SHOST_DIX_GUARD_CRC);
641641
}
642642

643+
/*
644+
* Limit the sg_tablesize and max_sectors based on the device
645+
* max fastreg page list length.
646+
*/
647+
shost->sg_tablesize = min_t(unsigned short, shost->sg_tablesize,
648+
ib_conn->device->dev_attr.max_fast_reg_page_list_len);
649+
shost->max_sectors = min_t(unsigned int,
650+
1024, (shost->sg_tablesize * PAGE_SIZE) >> 9);
651+
643652
if (iscsi_host_add(shost,
644653
ib_conn->device->ib_device->dma_device)) {
645654
mutex_unlock(&iser_conn->state_mutex);

0 commit comments

Comments
 (0)