From: Jack Wang <jinpu.wang@xxxxxxxxxxxxxxx> Max io size is limited by both remote buffer size and the max fr pages per mr. Signed-off-by: Jack Wang <jinpu.wang@xxxxxxxxx> Reviewed-by: Md Haris Iqbal <haris.iqbal@xxxxxxxxx> Signed-off-by: Gioh Kim <gi-oh.kim@xxxxxxxxx> --- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c index eb830c66fa44..7e72f0911cf2 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c @@ -2929,7 +2929,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; } -- 2.25.1