예제 #1
0
static void qp_event_callback(struct ehca_shca *shca, u64 eqe,
			      enum ib_event_type event_type, int fatal)
{
	struct ehca_qp *qp;
	u32 token = EHCA_BMASK_GET(EQE_QP_TOKEN, eqe);

	read_lock(&ehca_qp_idr_lock);
	qp = idr_find(&ehca_qp_idr, token);
	if (qp)
		atomic_inc(&qp->nr_events);
	read_unlock(&ehca_qp_idr_lock);

	if (!qp)
		return;

	if (fatal)
		ehca_error_data(shca, qp, qp->ipz_qp_handle.handle);

	dispatch_qp_event(shca, qp, fatal && qp->ext_type == EQPT_SRQ ?
			  IB_EVENT_SRQ_ERR : event_type);

	/*
	 * eHCA only processes one WQE at a time for SRQ base QPs,
	 * so the last WQE has been processed as soon as the QP enters
	 * error state.
	 */
	if (fatal && qp->ext_type == EQPT_SRQBASE)
		dispatch_qp_event(shca, qp, IB_EVENT_QP_LAST_WQE_REACHED);

	if (atomic_dec_and_test(&qp->nr_events))
		wake_up(&qp->wait_completion);
	return;
}
예제 #2
0
static void qp_event_callback(struct ehca_shca *shca,
                              u64 eqe,
                              enum ib_event_type event_type)
{
    struct ib_event event;
    struct ehca_qp *qp;
    unsigned long flags;
    u32 token = EHCA_BMASK_GET(EQE_QP_TOKEN, eqe);

    spin_lock_irqsave(&ehca_qp_idr_lock, flags);
    qp = idr_find(&ehca_qp_idr, token);
    spin_unlock_irqrestore(&ehca_qp_idr_lock, flags);


    if (!qp)
        return;

    ehca_error_data(shca, qp, qp->ipz_qp_handle.handle);

    if (!qp->ib_qp.event_handler)
        return;

    event.device     = &shca->ib_device;
    event.event      = event_type;
    event.element.qp = &qp->ib_qp;

    qp->ib_qp.event_handler(&event, qp->ib_qp.qp_context);

    return;
}
예제 #3
0
static void cq_event_callback(struct ehca_shca *shca,
                              u64 eqe)
{
    struct ehca_cq *cq;
    unsigned long flags;
    u32 token = EHCA_BMASK_GET(EQE_CQ_TOKEN, eqe);

    spin_lock_irqsave(&ehca_cq_idr_lock, flags);
    cq = idr_find(&ehca_cq_idr, token);
    spin_unlock_irqrestore(&ehca_cq_idr_lock, flags);

    if (!cq)
        return;

    ehca_error_data(shca, cq, cq->ipz_cq_handle.handle);

    return;
}
예제 #4
0
static void cq_event_callback(struct ehca_shca *shca,
			      u64 eqe)
{
	struct ehca_cq *cq;
	u32 token = EHCA_BMASK_GET(EQE_CQ_TOKEN, eqe);

	read_lock(&ehca_cq_idr_lock);
	cq = idr_find(&ehca_cq_idr, token);
	if (cq)
		atomic_inc(&cq->nr_events);
	read_unlock(&ehca_cq_idr_lock);

	if (!cq)
		return;

	ehca_error_data(shca, cq, cq->ipz_cq_handle.handle);

	if (atomic_dec_and_test(&cq->nr_events))
		wake_up(&cq->wait_completion);

	return;
}