[IB] mthca: report asynchronous CQ events
Implement reporting asynchronous CQ events in Mellanox HCA driver. Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il> Signed-off-by: Roland Dreier <rolandd@cisco.com>
This commit is contained in:
committed by
Roland Dreier
parent
89fbb69c4f
commit
affcd50546
@ -208,7 +208,7 @@ static inline void update_cons_index(struct mthca_dev *dev, struct mthca_cq *cq,
|
||||
}
|
||||
}
|
||||
|
||||
void mthca_cq_event(struct mthca_dev *dev, u32 cqn)
|
||||
void mthca_cq_completion(struct mthca_dev *dev, u32 cqn)
|
||||
{
|
||||
struct mthca_cq *cq;
|
||||
|
||||
@ -224,6 +224,35 @@ void mthca_cq_event(struct mthca_dev *dev, u32 cqn)
|
||||
cq->ibcq.comp_handler(&cq->ibcq, cq->ibcq.cq_context);
|
||||
}
|
||||
|
||||
void mthca_cq_event(struct mthca_dev *dev, u32 cqn,
|
||||
enum ib_event_type event_type)
|
||||
{
|
||||
struct mthca_cq *cq;
|
||||
struct ib_event event;
|
||||
|
||||
spin_lock(&dev->cq_table.lock);
|
||||
|
||||
cq = mthca_array_get(&dev->cq_table.cq, cqn & (dev->limits.num_cqs - 1));
|
||||
|
||||
if (cq)
|
||||
atomic_inc(&cq->refcount);
|
||||
spin_unlock(&dev->cq_table.lock);
|
||||
|
||||
if (!cq) {
|
||||
mthca_warn(dev, "Async event for bogus CQ %08x\n", cqn);
|
||||
return;
|
||||
}
|
||||
|
||||
event.device = &dev->ib_dev;
|
||||
event.event = event_type;
|
||||
event.element.cq = &cq->ibcq;
|
||||
if (cq->ibcq.event_handler)
|
||||
cq->ibcq.event_handler(&event, cq->ibcq.cq_context);
|
||||
|
||||
if (atomic_dec_and_test(&cq->refcount))
|
||||
wake_up(&cq->wait);
|
||||
}
|
||||
|
||||
void mthca_cq_clean(struct mthca_dev *dev, u32 cqn, u32 qpn,
|
||||
struct mthca_srq *srq)
|
||||
{
|
||||
|
Reference in New Issue
Block a user