Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1997412d authored by Tatyana Nikolova's avatar Tatyana Nikolova Committed by Doug Ledford
Browse files

RDMA/nes: Adding queue drain functions



Adding sq and rq drain functions, which block until all
previously posted wr-s in the specified queue have completed.
A completion object is signaled to unblock the thread,
when the last cqe for the corresponding queue is processed.

Signed-off-by: default avatarTatyana Nikolova <tatyana.e.nikolova@intel.com>
Signed-off-by: default avatarFaisal Latif <faisal.latif@intel.com>
Reviewed-by: default avatarSteve Wise <swise@opengridcomputing.com>
Reviewed-by: default avatarSteve Wise <swise@opengridcomputing.com>
Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 825107a2
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
@@ -1315,6 +1315,8 @@ static struct ib_qp *nes_create_qp(struct ib_pd *ibpd,
			nes_debug(NES_DBG_QP, "Invalid QP type: %d\n", init_attr->qp_type);
			return ERR_PTR(-EINVAL);
	}
	init_completion(&nesqp->sq_drained);
	init_completion(&nesqp->rq_drained);

	nesqp->sig_all = (init_attr->sq_sig_type == IB_SIGNAL_ALL_WR);
	init_timer(&nesqp->terminate_timer);
@@ -3452,6 +3454,29 @@ static int nes_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *ib_wr,
	return err;
}

/**
 * nes_drain_sq - drain sq
 * @ibqp: pointer to ibqp
 */
static void nes_drain_sq(struct ib_qp *ibqp)
{
	struct nes_qp *nesqp = to_nesqp(ibqp);

	if (nesqp->hwqp.sq_tail != nesqp->hwqp.sq_head)
		wait_for_completion(&nesqp->sq_drained);
}

/**
 * nes_drain_rq - drain rq
 * @ibqp: pointer to ibqp
 */
static void nes_drain_rq(struct ib_qp *ibqp)
{
	struct nes_qp *nesqp = to_nesqp(ibqp);

	if (nesqp->hwqp.rq_tail != nesqp->hwqp.rq_head)
		wait_for_completion(&nesqp->rq_drained);
}

/**
 * nes_poll_cq
@@ -3582,6 +3607,13 @@ static int nes_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *entry)
				}
			}

			if (nesqp->iwarp_state > NES_CQP_QP_IWARP_STATE_RTS) {
				if (nesqp->hwqp.sq_tail == nesqp->hwqp.sq_head)
					complete(&nesqp->sq_drained);
				if (nesqp->hwqp.rq_tail == nesqp->hwqp.rq_head)
					complete(&nesqp->rq_drained);
			}

			entry->wr_id = wrid;
			entry++;
			cqe_count++;
@@ -3754,6 +3786,8 @@ struct nes_ib_device *nes_init_ofa_device(struct net_device *netdev)
	nesibdev->ibdev.req_notify_cq = nes_req_notify_cq;
	nesibdev->ibdev.post_send = nes_post_send;
	nesibdev->ibdev.post_recv = nes_post_recv;
	nesibdev->ibdev.drain_sq = nes_drain_sq;
	nesibdev->ibdev.drain_rq = nes_drain_rq;

	nesibdev->ibdev.iwcm = kzalloc(sizeof(*nesibdev->ibdev.iwcm), GFP_KERNEL);
	if (nesibdev->ibdev.iwcm == NULL) {
+2 −0
Original line number Diff line number Diff line
@@ -189,6 +189,8 @@ struct nes_qp {
	u8                    pau_pending;
	u8                    pau_state;
	__u64                 nesuqp_addr;
	struct completion     sq_drained;
	struct completion     rq_drained;
};

struct ib_mr *nes_reg_phys_mr(struct ib_pd *ib_pd,