summaryrefslogtreecommitdiff
path: root/drivers/infiniband/ulp/rtrs
diff options
context:
space:
mode:
authorJack Wang <jinpu.wang@cloud.ionos.com>2021-03-25 18:33:05 +0300
committerJason Gunthorpe <jgg@nvidia.com>2021-04-01 21:59:46 +0300
commit0633e23771e0ac84b5e8b3c20e0b4640e29d720b (patch)
tree1802a8847e4f5f2f2a6828f48c0860a1e1db8333 /drivers/infiniband/ulp/rtrs
parent11b74cbf8ea50f781dde4fd2a6003c86ce19285a (diff)
downloadlinux-0633e23771e0ac84b5e8b3c20e0b4640e29d720b.tar.xz
RDMA/rtrs-clt: Cap max_io_size
Max io size is limited by both remote buffer size and the max fr pages per mr. Link: https://lore.kernel.org/r/20210325153308.1214057-20-gi-oh.kim@ionos.com Signed-off-by: Jack Wang <jinpu.wang@ionos.com> Reviewed-by: Md Haris Iqbal <haris.iqbal@ionos.com> Signed-off-by: Gioh Kim <gi-oh.kim@ionos.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'drivers/infiniband/ulp/rtrs')
-rw-r--r--drivers/infiniband/ulp/rtrs/rtrs-clt.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
index 279d60a96dc9..64990df81937 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c
+++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
@@ -2901,7 +2901,9 @@ int rtrs_clt_query(struct rtrs_clt *clt, struct rtrs_attrs *attr)
return -ECOMM;
attr->queue_depth = clt->queue_depth;
- attr->max_io_size = clt->max_io_size;
+ /* Cap max_io_size to min of remote buffer size and the fr pages */
+ attr->max_io_size = min_t(int, clt->max_io_size,
+ clt->max_segments * SZ_4K);
return 0;
}