RDMA/rxe: Move atomic original value to res
authorBob Pearson <rpearsonhpe@gmail.com>
Mon, 6 Jun 2022 14:38:36 +0000 (09:38 -0500)
committerJason Gunthorpe <jgg@nvidia.com>
Thu, 30 Jun 2022 17:00:21 +0000 (14:00 -0300)
Move the saved original value to the atomic responder resource.  This
replaces saving it in the qp. In preparation for merging the normal and
retry atomic responder flows.

Link: https://lore.kernel.org/r/20220606143836.3323-5-rpearsonhpe@gmail.com
Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/sw/rxe/rxe_resp.c
drivers/infiniband/sw/rxe/rxe_verbs.h

index 7489256..5399e2a 100644 (file)
@@ -579,6 +579,7 @@ static enum resp_states rxe_atomic_reply(struct rxe_qp *qp,
        enum resp_states ret;
        struct rxe_mr *mr = qp->resp.mr;
        struct resp_res *res = qp->resp.res;
+       u64 value;
 
        if (!res) {
                res = rxe_prepare_atomic_res(qp, pkt);
@@ -599,16 +600,16 @@ static enum resp_states rxe_atomic_reply(struct rxe_qp *qp,
        }
 
        spin_lock_bh(&atomic_ops_lock);
-
-       qp->resp.atomic_orig = *vaddr;
+       res->atomic.orig_val = value = *vaddr;
 
        if (pkt->opcode == IB_OPCODE_RC_COMPARE_SWAP) {
-               if (*vaddr == atmeth_comp(pkt))
-                       *vaddr = atmeth_swap_add(pkt);
+               if (value == atmeth_comp(pkt))
+                       value = atmeth_swap_add(pkt);
        } else {
-               *vaddr += atmeth_swap_add(pkt);
+               value += atmeth_swap_add(pkt);
        }
 
+       *vaddr = value;
        spin_unlock_bh(&atomic_ops_lock);
 
        qp->resp.msn++;
@@ -663,7 +664,7 @@ static struct sk_buff *prepare_ack_packet(struct rxe_qp *qp,
        }
 
        if (ack->mask & RXE_ATMACK_MASK)
-               atmack_set_orig(ack, qp->resp.atomic_orig);
+               atmack_set_orig(ack, qp->resp.res->atomic.orig_val);
 
        err = rxe_prepare(&qp->pri_av, ack, skb);
        if (err) {
index ac464e6..5ee0f25 100644 (file)
@@ -156,6 +156,7 @@ struct resp_res {
        union {
                struct {
                        struct sk_buff  *skb;
+                       u64             orig_val;
                } atomic;
                struct {
                        u64             va_org;
@@ -189,7 +190,6 @@ struct rxe_resp_info {
        u32                     resid;
        u32                     rkey;
        u32                     length;
-       u64                     atomic_orig;
 
        /* SRQ only */
        struct {