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

Commit beb5a042 authored by Brian Welty's avatar Brian Welty Committed by Doug Ledford
Browse files

IB/hfi1, qib, rdmavt: Move two IB event functions into rdmavt



Add rvt_rc_error() and rvt_comm_est() as shared functions in
rdmavt, moved from hfi1/qib logic.

Reviewed-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: default avatarBrian Welty <brian.welty@intel.com>
Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent c03c08d5
Loading
Loading
Loading
Loading
+0 −13
Original line number Diff line number Diff line
@@ -784,19 +784,6 @@ void qp_iter_print(struct seq_file *s, struct qp_iter *iter)
		   qp->pid);
}

void qp_comm_est(struct rvt_qp *qp)
{
	qp->r_flags |= RVT_R_COMM_EST;
	if (qp->ibqp.event_handler) {
		struct ib_event ev;

		ev.device = qp->ibqp.device;
		ev.element.qp = &qp->ibqp;
		ev.event = IB_EVENT_COMM_EST;
		qp->ibqp.event_handler(&ev, qp->ibqp.qp_context);
	}
}

void *qp_priv_alloc(struct rvt_dev_info *rdi, struct rvt_qp *qp,
		    gfp_t gfp)
{
+0 −6
Original line number Diff line number Diff line
@@ -131,12 +131,6 @@ int qp_iter_next(struct qp_iter *iter);
 */
void qp_iter_print(struct seq_file *s, struct qp_iter *iter);

/**
 * qp_comm_est - handle trap with QP established
 * @qp: the QP
 */
void qp_comm_est(struct rvt_qp *qp);

void _hfi1_schedule_send(struct rvt_qp *qp);
void hfi1_schedule_send(struct rvt_qp *qp);

+4 −23
Original line number Diff line number Diff line
@@ -1966,25 +1966,6 @@ static noinline int rc_rcv_error(struct ib_other_headers *ohdr, void *data,
	return 0;
}

void hfi1_rc_error(struct rvt_qp *qp, enum ib_wc_status err)
{
	unsigned long flags;
	int lastwqe;

	spin_lock_irqsave(&qp->s_lock, flags);
	lastwqe = rvt_error_qp(qp, err);
	spin_unlock_irqrestore(&qp->s_lock, flags);

	if (lastwqe) {
		struct ib_event ev;

		ev.device = qp->ibqp.device;
		ev.element.qp = &qp->ibqp;
		ev.event = IB_EVENT_QP_LAST_WQE_REACHED;
		qp->ibqp.event_handler(&ev, qp->ibqp.qp_context);
	}
}

static inline void update_ack_queue(struct rvt_qp *qp, unsigned n)
{
	unsigned next;
@@ -2185,7 +2166,7 @@ void hfi1_rc_rcv(struct hfi1_packet *packet)
	}

	if (qp->state == IB_QPS_RTR && !(qp->r_flags & RVT_R_COMM_EST))
		qp_comm_est(qp);
		rvt_comm_est(qp);

	/* OK, process the packet. */
	switch (opcode) {
@@ -2517,7 +2498,7 @@ void hfi1_rc_rcv(struct hfi1_packet *packet)
	return;

nack_op_err:
	hfi1_rc_error(qp, IB_WC_LOC_QP_OP_ERR);
	rvt_rc_error(qp, IB_WC_LOC_QP_OP_ERR);
	qp->r_nak_state = IB_NAK_REMOTE_OPERATIONAL_ERROR;
	qp->r_ack_psn = qp->r_psn;
	/* Queue NAK for later */
@@ -2527,7 +2508,7 @@ void hfi1_rc_rcv(struct hfi1_packet *packet)
nack_inv_unlck:
	spin_unlock_irqrestore(&qp->s_lock, flags);
nack_inv:
	hfi1_rc_error(qp, IB_WC_LOC_QP_OP_ERR);
	rvt_rc_error(qp, IB_WC_LOC_QP_OP_ERR);
	qp->r_nak_state = IB_NAK_INVALID_REQUEST;
	qp->r_ack_psn = qp->r_psn;
	/* Queue NAK for later */
@@ -2537,7 +2518,7 @@ void hfi1_rc_rcv(struct hfi1_packet *packet)
nack_acc_unlck:
	spin_unlock_irqrestore(&qp->s_lock, flags);
nack_acc:
	hfi1_rc_error(qp, IB_WC_LOC_PROT_ERR);
	rvt_rc_error(qp, IB_WC_LOC_PROT_ERR);
	qp->r_nak_state = IB_NAK_REMOTE_ACCESS_ERROR;
	qp->r_ack_psn = qp->r_psn;
send_ack:
+1 −1
Original line number Diff line number Diff line
@@ -637,7 +637,7 @@ static void ruc_loopback(struct rvt_qp *sqp)
	wc.status = IB_WC_LOC_PROT_ERR;
err:
	/* responder goes to error state */
	hfi1_rc_error(qp, wc.status);
	rvt_rc_error(qp, wc.status);

serr:
	spin_lock_irqsave(&sqp->s_lock, flags);
+2 −2
Original line number Diff line number Diff line
@@ -384,7 +384,7 @@ void hfi1_uc_rcv(struct hfi1_packet *packet)
	}

	if (qp->state == IB_QPS_RTR && !(qp->r_flags & RVT_R_COMM_EST))
		qp_comm_est(qp);
		rvt_comm_est(qp);

	/* OK, process the packet. */
	switch (opcode) {
@@ -584,5 +584,5 @@ void hfi1_uc_rcv(struct hfi1_packet *packet)
	return;

op_err:
	hfi1_rc_error(qp, IB_WC_LOC_QP_OP_ERR);
	rvt_rc_error(qp, IB_WC_LOC_QP_OP_ERR);
}
Loading