aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@mellanox.co.il>2005-10-29 10:39:42 -0400
committerRoland Dreier <rolandd@cisco.com>2005-10-29 10:39:42 -0400
commitaffcd50546d4788b7849e2b2e2ec7bc50d64c5f8 (patch)
treee4e6a0f5f2203569b6ada4c101a146c3a4f24c28
parent89fbb69c4f285019ba5e029963dc11cc6beb078a (diff)
[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>
-rw-r--r--drivers/infiniband/hw/mthca/mthca_cq.c31
-rw-r--r--drivers/infiniband/hw/mthca/mthca_dev.h4
-rw-r--r--drivers/infiniband/hw/mthca/mthca_eq.c4
3 files changed, 36 insertions, 3 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c
index 8600b6c3e0c2..f98e23555826 100644
--- a/drivers/infiniband/hw/mthca/mthca_cq.c
+++ b/drivers/infiniband/hw/mthca/mthca_cq.c
@@ -208,7 +208,7 @@ static inline void update_cons_index(struct mthca_dev *dev, struct mthca_cq *cq,
208 } 208 }
209} 209}
210 210
211void mthca_cq_event(struct mthca_dev *dev, u32 cqn) 211void mthca_cq_completion(struct mthca_dev *dev, u32 cqn)
212{ 212{
213 struct mthca_cq *cq; 213 struct mthca_cq *cq;
214 214
@@ -224,6 +224,35 @@ void mthca_cq_event(struct mthca_dev *dev, u32 cqn)
224 cq->ibcq.comp_handler(&cq->ibcq, cq->ibcq.cq_context); 224 cq->ibcq.comp_handler(&cq->ibcq, cq->ibcq.cq_context);
225} 225}
226 226
227void mthca_cq_event(struct mthca_dev *dev, u32 cqn,
228 enum ib_event_type event_type)
229{
230 struct mthca_cq *cq;
231 struct ib_event event;
232
233 spin_lock(&dev->cq_table.lock);
234
235 cq = mthca_array_get(&dev->cq_table.cq, cqn & (dev->limits.num_cqs - 1));
236
237 if (cq)
238 atomic_inc(&cq->refcount);
239 spin_unlock(&dev->cq_table.lock);
240
241 if (!cq) {
242 mthca_warn(dev, "Async event for bogus CQ %08x\n", cqn);
243 return;
244 }
245
246 event.device = &dev->ib_dev;
247 event.event = event_type;
248 event.element.cq = &cq->ibcq;
249 if (cq->ibcq.event_handler)
250 cq->ibcq.event_handler(&event, cq->ibcq.cq_context);
251
252 if (atomic_dec_and_test(&cq->refcount))
253 wake_up(&cq->wait);
254}
255
227void mthca_cq_clean(struct mthca_dev *dev, u32 cqn, u32 qpn, 256void mthca_cq_clean(struct mthca_dev *dev, u32 cqn, u32 qpn,
228 struct mthca_srq *srq) 257 struct mthca_srq *srq)
229{ 258{
diff --git a/drivers/infiniband/hw/mthca/mthca_dev.h b/drivers/infiniband/hw/mthca/mthca_dev.h
index 7e68bd4a3780..e7e5d3b4f004 100644
--- a/drivers/infiniband/hw/mthca/mthca_dev.h
+++ b/drivers/infiniband/hw/mthca/mthca_dev.h
@@ -460,7 +460,9 @@ int mthca_init_cq(struct mthca_dev *dev, int nent,
460 struct mthca_cq *cq); 460 struct mthca_cq *cq);
461void mthca_free_cq(struct mthca_dev *dev, 461void mthca_free_cq(struct mthca_dev *dev,
462 struct mthca_cq *cq); 462 struct mthca_cq *cq);
463void mthca_cq_event(struct mthca_dev *dev, u32 cqn); 463void mthca_cq_completion(struct mthca_dev *dev, u32 cqn);
464void mthca_cq_event(struct mthca_dev *dev, u32 cqn,
465 enum ib_event_type event_type);
464void mthca_cq_clean(struct mthca_dev *dev, u32 cqn, u32 qpn, 466void mthca_cq_clean(struct mthca_dev *dev, u32 cqn, u32 qpn,
465 struct mthca_srq *srq); 467 struct mthca_srq *srq);
466 468
diff --git a/drivers/infiniband/hw/mthca/mthca_eq.c b/drivers/infiniband/hw/mthca/mthca_eq.c
index e5a047a6dbeb..34d68e5a72d8 100644
--- a/drivers/infiniband/hw/mthca/mthca_eq.c
+++ b/drivers/infiniband/hw/mthca/mthca_eq.c
@@ -292,7 +292,7 @@ static int mthca_eq_int(struct mthca_dev *dev, struct mthca_eq *eq)
292 case MTHCA_EVENT_TYPE_COMP: 292 case MTHCA_EVENT_TYPE_COMP:
293 disarm_cqn = be32_to_cpu(eqe->event.comp.cqn) & 0xffffff; 293 disarm_cqn = be32_to_cpu(eqe->event.comp.cqn) & 0xffffff;
294 disarm_cq(dev, eq->eqn, disarm_cqn); 294 disarm_cq(dev, eq->eqn, disarm_cqn);
295 mthca_cq_event(dev, disarm_cqn); 295 mthca_cq_completion(dev, disarm_cqn);
296 break; 296 break;
297 297
298 case MTHCA_EVENT_TYPE_PATH_MIG: 298 case MTHCA_EVENT_TYPE_PATH_MIG:
@@ -364,6 +364,8 @@ static int mthca_eq_int(struct mthca_dev *dev, struct mthca_eq *eq)
364 eqe->event.cq_err.syndrome == 1 ? 364 eqe->event.cq_err.syndrome == 1 ?
365 "overrun" : "access violation", 365 "overrun" : "access violation",
366 be32_to_cpu(eqe->event.cq_err.cqn) & 0xffffff); 366 be32_to_cpu(eqe->event.cq_err.cqn) & 0xffffff);
367 mthca_cq_event(dev, be32_to_cpu(eqe->event.cq_err.cqn),
368 IB_EVENT_CQ_ERR);
367 break; 369 break;
368 370
369 case MTHCA_EVENT_TYPE_EQ_OVERFLOW: 371 case MTHCA_EVENT_TYPE_EQ_OVERFLOW: