]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
IB/rxe: Properly honor max IRD value for rd/atomic.
authorParav Pandit <pandit.parav@gmail.com>
Wed, 28 Sep 2016 20:26:44 +0000 (20:26 +0000)
committerDoug Ledford <dledford@redhat.com>
Thu, 6 Oct 2016 17:50:04 +0000 (13:50 -0400)
This patch honoris the max incoming read request count instead of
outgoing read req count
(a) during modify qp by allocating response queue metadata
(b) during incoming read request processing

Signed-off-by: Parav Pandit <pandit.parav@gmail.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/sw/rxe/rxe_loc.h
drivers/infiniband/sw/rxe/rxe_qp.c
drivers/infiniband/sw/rxe/rxe_resp.c

index 4a5484ef604f0462fae46c822a75322c0d237826..73849a5a91b3a9de83db6b1ad2d7753e4d98e02e 100644 (file)
@@ -198,7 +198,7 @@ void free_rd_atomic_resource(struct rxe_qp *qp, struct resp_res *res);
 static inline void rxe_advance_resp_resource(struct rxe_qp *qp)
 {
        qp->resp.res_head++;
-       if (unlikely(qp->resp.res_head == qp->attr.max_rd_atomic))
+       if (unlikely(qp->resp.res_head == qp->attr.max_dest_rd_atomic))
                qp->resp.res_head = 0;
 }
 
index 22ba24f2a2c18b165623be787c00e0c9637f25fd..62c37a563df92a5b2154e18d1ac2ba39c120cabf 100644 (file)
@@ -146,7 +146,7 @@ static void free_rd_atomic_resources(struct rxe_qp *qp)
        if (qp->resp.resources) {
                int i;
 
-               for (i = 0; i < qp->attr.max_rd_atomic; i++) {
+               for (i = 0; i < qp->attr.max_dest_rd_atomic; i++) {
                        struct resp_res *res = &qp->resp.resources[i];
 
                        free_rd_atomic_resource(qp, res);
@@ -174,7 +174,7 @@ static void cleanup_rd_atomic_resources(struct rxe_qp *qp)
        struct resp_res *res;
 
        if (qp->resp.resources) {
-               for (i = 0; i < qp->attr.max_rd_atomic; i++) {
+               for (i = 0; i < qp->attr.max_dest_rd_atomic; i++) {
                        res = &qp->resp.resources[i];
                        free_rd_atomic_resource(qp, res);
                }
@@ -596,14 +596,21 @@ int rxe_qp_from_attr(struct rxe_qp *qp, struct ib_qp_attr *attr, int mask,
        if (mask & IB_QP_MAX_QP_RD_ATOMIC) {
                int max_rd_atomic = __roundup_pow_of_two(attr->max_rd_atomic);
 
+               qp->attr.max_rd_atomic = max_rd_atomic;
+               atomic_set(&qp->req.rd_atomic, max_rd_atomic);
+       }
+
+       if (mask & IB_QP_MAX_DEST_RD_ATOMIC) {
+               int max_dest_rd_atomic =
+                       __roundup_pow_of_two(attr->max_dest_rd_atomic);
+
+               qp->attr.max_dest_rd_atomic = max_dest_rd_atomic;
+
                free_rd_atomic_resources(qp);
 
-               err = alloc_rd_atomic_resources(qp, max_rd_atomic);
+               err = alloc_rd_atomic_resources(qp, max_dest_rd_atomic);
                if (err)
                        return err;
-
-               qp->attr.max_rd_atomic = max_rd_atomic;
-               atomic_set(&qp->req.rd_atomic, max_rd_atomic);
        }
 
        if (mask & IB_QP_CUR_STATE)
@@ -701,11 +708,6 @@ int rxe_qp_from_attr(struct rxe_qp *qp, struct ib_qp_attr *attr, int mask,
                pr_debug("set req psn = 0x%x\n", qp->req.psn);
        }
 
-       if (mask & IB_QP_MAX_DEST_RD_ATOMIC) {
-               qp->attr.max_dest_rd_atomic =
-                       __roundup_pow_of_two(attr->max_dest_rd_atomic);
-       }
-
        if (mask & IB_QP_PATH_MIG_STATE)
                qp->attr.path_mig_state = attr->path_mig_state;
 
index 3e0f0f2baace2518a92e1c7b8c6b995191730007..d544b5e84797a14e454588364e5855fc021fe9e6 100644 (file)
@@ -383,7 +383,7 @@ static enum resp_states check_resource(struct rxe_qp *qp,
                 * too many read/atomic ops, we just
                 * recycle the responder resource queue
                 */
-               if (likely(qp->attr.max_rd_atomic > 0))
+               if (likely(qp->attr.max_dest_rd_atomic > 0))
                        return RESPST_CHK_LENGTH;
                else
                        return RESPST_ERR_TOO_MANY_RDMA_ATM_REQ;