Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

RDMA/rtrs: Add optional support for IB_MR_TYPE_SG_GAPS

Support IB_MR_TYPE_SG_GAPS, which has less limitations
than standard IB_MR_TYPE_MEM_REG, a few ULP support this.

Signed-off-by: Md Haris Iqbal <haris.iqbal@ionos.com>
Signed-off-by: Kim Zhu <zhu.yanjun@ionos.com>
Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Grzegorz Prajsner <grzegorz.prajsner@ionos.com>
Link: https://patch.msgid.link/20260107161517.56357-4-haris.iqbal@ionos.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>

authored by

Md Haris Iqbal and committed by
Leon Romanovsky
9293e042 d6cc7b0d

+18 -5
+8 -2
drivers/infiniband/ulp/rtrs/rtrs-clt.c
··· 1359 1359 1360 1360 static int alloc_path_reqs(struct rtrs_clt_path *clt_path) 1361 1361 { 1362 + struct ib_device *ib_dev = clt_path->s.dev->ib_dev; 1362 1363 struct rtrs_clt_io_req *req; 1364 + enum ib_mr_type mr_type; 1363 1365 int i, err = -ENOMEM; 1364 1366 1365 1367 clt_path->reqs = kcalloc(clt_path->queue_depth, ··· 1369 1367 GFP_KERNEL); 1370 1368 if (!clt_path->reqs) 1371 1369 return -ENOMEM; 1370 + 1371 + if (ib_dev->attrs.kernel_cap_flags & IBK_SG_GAPS_REG) 1372 + mr_type = IB_MR_TYPE_SG_GAPS; 1373 + else 1374 + mr_type = IB_MR_TYPE_MEM_REG; 1372 1375 1373 1376 for (i = 0; i < clt_path->queue_depth; ++i) { 1374 1377 req = &clt_path->reqs[i]; ··· 1388 1381 if (!req->sge) 1389 1382 goto out; 1390 1383 1391 - req->mr = ib_alloc_mr(clt_path->s.dev->ib_pd, 1392 - IB_MR_TYPE_MEM_REG, 1384 + req->mr = ib_alloc_mr(clt_path->s.dev->ib_pd, mr_type, 1393 1385 clt_path->max_pages_per_mr); 1394 1386 if (IS_ERR(req->mr)) { 1395 1387 err = PTR_ERR(req->mr);
+10 -3
drivers/infiniband/ulp/rtrs/rtrs-srv.c
··· 562 562 563 563 static int map_cont_bufs(struct rtrs_srv_path *srv_path) 564 564 { 565 + struct ib_device *ib_dev = srv_path->s.dev->ib_dev; 565 566 struct rtrs_srv_sess *srv = srv_path->srv; 566 567 struct rtrs_path *ss = &srv_path->s; 567 568 int i, err, mrs_num; 568 569 unsigned int chunk_bits; 570 + enum ib_mr_type mr_type; 569 571 int chunks_per_mr = 1; 570 - struct ib_mr *mr; 571 572 struct sg_table *sgt; 573 + struct ib_mr *mr; 572 574 573 575 /* 574 576 * Here we map queue_depth chunks to MR. Firstly we have to ··· 619 617 err = -EINVAL; 620 618 goto free_sg; 621 619 } 622 - mr = ib_alloc_mr(srv_path->s.dev->ib_pd, IB_MR_TYPE_MEM_REG, 623 - nr_sgt); 620 + 621 + if (ib_dev->attrs.kernel_cap_flags & IBK_SG_GAPS_REG) 622 + mr_type = IB_MR_TYPE_SG_GAPS; 623 + else 624 + mr_type = IB_MR_TYPE_MEM_REG; 625 + 626 + mr = ib_alloc_mr(srv_path->s.dev->ib_pd, mr_type, nr_sgt); 624 627 if (IS_ERR(mr)) { 625 628 err = PTR_ERR(mr); 626 629 goto unmap_sg;