Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH for-next] RDMA/rxe: Improve readability of ODP pagefault interface
@ 2025-03-12  6:59 Daisuke Matsuda
  2025-03-12  7:19 ` Zhu Yanjun
  2025-03-12 18:57 ` Leon Romanovsky
  0 siblings, 2 replies; 4+ messages in thread
From: Daisuke Matsuda @ 2025-03-12  6:59 UTC (permalink / raw)
  To: linux-rdma, leon, jgg, zyjzyj2000; +Cc: Daisuke Matsuda

Use a meaningful constant explicitly instead of hard-coding a literal.

Signed-off-by: Daisuke Matsuda <matsuda-daisuke@fujitsu.com>
---
 drivers/infiniband/sw/rxe/rxe_odp.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/infiniband/sw/rxe/rxe_odp.c b/drivers/infiniband/sw/rxe/rxe_odp.c
index a82e5011360c..94f7bbe14981 100644
--- a/drivers/infiniband/sw/rxe/rxe_odp.c
+++ b/drivers/infiniband/sw/rxe/rxe_odp.c
@@ -37,8 +37,9 @@ const struct mmu_interval_notifier_ops rxe_mn_ops = {
 	.invalidate = rxe_ib_invalidate_range,
 };
 
-#define RXE_PAGEFAULT_RDONLY BIT(1)
-#define RXE_PAGEFAULT_SNAPSHOT BIT(2)
+#define RXE_PAGEFAULT_DEFAULT 0
+#define RXE_PAGEFAULT_RDONLY BIT(0)
+#define RXE_PAGEFAULT_SNAPSHOT BIT(1)
 static int rxe_odp_do_pagefault_and_lock(struct rxe_mr *mr, u64 user_va, int bcnt, u32 flags)
 {
 	struct ib_umem_odp *umem_odp = to_ib_umem_odp(mr->umem);
@@ -222,7 +223,7 @@ int rxe_odp_mr_copy(struct rxe_mr *mr, u64 iova, void *addr, int length,
 		    enum rxe_mr_copy_dir dir)
 {
 	struct ib_umem_odp *umem_odp = to_ib_umem_odp(mr->umem);
-	u32 flags = 0;
+	u32 flags = RXE_PAGEFAULT_DEFAULT;
 	int err;
 
 	if (length == 0)
@@ -236,7 +237,7 @@ int rxe_odp_mr_copy(struct rxe_mr *mr, u64 iova, void *addr, int length,
 		break;
 
 	case RXE_FROM_MR_OBJ:
-		flags = RXE_PAGEFAULT_RDONLY;
+		flags |= RXE_PAGEFAULT_RDONLY;
 		break;
 
 	default:
@@ -312,7 +313,8 @@ int rxe_odp_atomic_op(struct rxe_mr *mr, u64 iova, int opcode,
 	struct ib_umem_odp *umem_odp = to_ib_umem_odp(mr->umem);
 	int err;
 
-	err = rxe_odp_map_range_and_lock(mr, iova, sizeof(char), 0);
+	err = rxe_odp_map_range_and_lock(mr, iova, sizeof(char),
+					 RXE_PAGEFAULT_DEFAULT);
 	if (err < 0)
 		return err;
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-03-12 18:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-12  6:59 [PATCH for-next] RDMA/rxe: Improve readability of ODP pagefault interface Daisuke Matsuda
2025-03-12  7:19 ` Zhu Yanjun
2025-03-12  7:58   ` Daisuke Matsuda (Fujitsu)
2025-03-12 18:57 ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox