On 5/28/2021 3:31 AM, Zhu Yanjun wrote:
On Fri, May 28, 2021 at 3:47 AM Bob Pearson <rpearsonhpe@xxxxxxxxx> wrote:
To create optimal code only want to use smp_load_acquire() and
smp_store_release() for user indices in rxe_queue APIs since
kernel indices are protected by locks which also act as memory
barriers. By adding a type to the queues we can determine which
indices need to be protected.
Signed-off-by: Bob Pearson <rpearsonhpe@xxxxxxxxx>
---
drivers/infiniband/sw/rxe/rxe_cq.c | 4 +++-
drivers/infiniband/sw/rxe/rxe_qp.c | 12 ++++++++----
drivers/infiniband/sw/rxe/rxe_queue.c | 8 ++++----
drivers/infiniband/sw/rxe/rxe_queue.h | 13 ++++++++++---
drivers/infiniband/sw/rxe/rxe_srq.c | 4 +++-
5 files changed, 28 insertions(+), 13 deletions(-)
diff --git a/drivers/infiniband/sw/rxe/rxe_cq.c b/drivers/infiniband/sw/rxe/rxe_cq.c
index b315ebf041ac..1d4d8a31bc12 100644
--- a/drivers/infiniband/sw/rxe/rxe_cq.c
+++ b/drivers/infiniband/sw/rxe/rxe_cq.c
@@ -59,9 +59,11 @@ int rxe_cq_from_init(struct rxe_dev *rxe, struct rxe_cq *cq, int cqe,
struct rxe_create_cq_resp __user *uresp)
{
int err;
+ enum queue_type type;
+ type = uresp ? QUEUE_TYPE_TO_USER : QUEUE_TYPE_KERNEL;
When is QUEUE_TYPE_TO_USER used? and when is QUEUE_TYPE_FROM_USER is used?
Zhu Yanjun
QUEUE_TYPE_FROM_USER is used for user space send, recv and shared
receive work queues. QUEUE_TYPE_TO_USER is used for user space
completion queues. QUEUE_TYPE_KERNEL is used for kernel verbs consumers
for any queue.
Bob