Re: [RFC PATCH rdma-next 05/10] RDMA/rxe: Allow registering persistent flag for pmem MR only

From: Tom Talpey
Date: Fri Dec 31 2021 - 09:40:29 EST


On 12/30/2021 10:34 PM, lizhijian@xxxxxxxxxxx wrote:

  +static bool ib_check_flush_access_flags(struct ib_mr *mr, u32 flags)
+{
+    return mr->is_pmem || !(flags & IB_ACCESS_FLUSH_PERSISTENT);
+}

Its name is confusing and needs to be clarified.

Err,  let me see.... a more suitable name is very welcome.

Since the subroutine is rather simple, and with only a single
reference in a single file, it would be best to just pull
the test inline and delete it. This would also remove some
inefficient code.

if (flags & IB_ACCESS_FLUSH_PERSISTENT) {
if (!iova_in_pmem(mr, iova, length) {
pr_err("Cannot set IB_ACCESS_FLUSH_PERSISTENT for non-pmem memory\n");
mr->state = RXE_MR_STATE_INVALID;
mr->umem = NULL;
err = -EINVAL;
goto err_release_umem;
}
mr-> ibmr.is_pmem = true;
}
...