aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/mthca/mthca_srq.c
diff options
context:
space:
mode:
authorRoland Dreier <rolandd@cisco.com>2005-10-06 16:15:56 -0400
committerRoland Dreier <rolandd@cisco.com>2005-10-17 18:20:28 -0400
commit90f104da22bbf2e2b8a2136c12fb4e013fccf504 (patch)
treed720f4b226cd72903ee878096707578ccc7abc0c /drivers/infiniband/hw/mthca/mthca_srq.c
parent116c0074ecfd6f061570856bec52b691d54dbd3c (diff)
[IB] mthca: SRQ limit reached events
Our hardware supports generating an event when the number of receives posted to a shared receive queue (SRQ) falls below a user-specified limit. Implement mthca_modify_srq() to arm the limit, and add code to handle dispatching SRQ events when they occur. Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/mthca/mthca_srq.c')
-rw-r--r--drivers/infiniband/hw/mthca/mthca_srq.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_srq.c b/drivers/infiniband/hw/mthca/mthca_srq.c
index 18998d48c53..13d2290261d 100644
--- a/drivers/infiniband/hw/mthca/mthca_srq.c
+++ b/drivers/infiniband/hw/mthca/mthca_srq.c
@@ -332,6 +332,29 @@ void mthca_free_srq(struct mthca_dev *dev, struct mthca_srq *srq)
332 mthca_free_mailbox(dev, mailbox); 332 mthca_free_mailbox(dev, mailbox);
333} 333}
334 334
335int mthca_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,
336 enum ib_srq_attr_mask attr_mask)
337{
338 struct mthca_dev *dev = to_mdev(ibsrq->device);
339 struct mthca_srq *srq = to_msrq(ibsrq);
340 int ret;
341 u8 status;
342
343 /* We don't support resizing SRQs (yet?) */
344 if (attr_mask & IB_SRQ_MAX_WR)
345 return -EINVAL;
346
347 if (attr_mask & IB_SRQ_LIMIT) {
348 ret = mthca_ARM_SRQ(dev, srq->srqn, attr->srq_limit, &status);
349 if (ret)
350 return ret;
351 if (status)
352 return -EINVAL;
353 }
354
355 return 0;
356}
357
335void mthca_srq_event(struct mthca_dev *dev, u32 srqn, 358void mthca_srq_event(struct mthca_dev *dev, u32 srqn,
336 enum ib_event_type event_type) 359 enum ib_event_type event_type)
337{ 360{
@@ -354,7 +377,7 @@ void mthca_srq_event(struct mthca_dev *dev, u32 srqn,
354 377
355 event.device = &dev->ib_dev; 378 event.device = &dev->ib_dev;
356 event.event = event_type; 379 event.event = event_type;
357 event.element.srq = &srq->ibsrq; 380 event.element.srq = &srq->ibsrq;
358 srq->ibsrq.event_handler(&event, srq->ibsrq.srq_context); 381 srq->ibsrq.event_handler(&event, srq->ibsrq.srq_context);
359 382
360out: 383out: