Skip to content

Commit

Permalink
Track asynchronous events on a work queue
Browse files Browse the repository at this point in the history
Add support to track asynchronous events on a work queue object.
For now only IBV_EVENT_WQ_FATAL is applicable.

Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
  • Loading branch information
yishaih authored and dledford committed Sep 15, 2016
1 parent f70af0c commit d0ac81c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/infiniband/verbs.h
Original file line number Diff line number Diff line change
Expand Up @@ -341,13 +341,15 @@ enum ibv_event_type {
IBV_EVENT_QP_LAST_WQE_REACHED,
IBV_EVENT_CLIENT_REREGISTER,
IBV_EVENT_GID_CHANGE,
IBV_EVENT_WQ_FATAL,
};

struct ibv_async_event {
union {
struct ibv_cq *cq;
struct ibv_qp *qp;
struct ibv_srq *srq;
struct ibv_wq *wq;
int port_num;
} element;
enum ibv_event_type event_type;
Expand Down
15 changes: 15 additions & 0 deletions src/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,9 @@ int __ibv_get_async_event(struct ibv_context *context,
event->element.srq = (void *) (uintptr_t) ev.element;
break;

case IBV_EVENT_WQ_FATAL:
event->element.wq = (void *) (uintptr_t) ev.element;
break;
default:
event->element.port_num = ev.element;
break;
Expand Down Expand Up @@ -357,6 +360,18 @@ void __ibv_ack_async_event(struct ibv_async_event *event)
return;
}

case IBV_EVENT_WQ_FATAL:
{
struct ibv_wq *wq = event->element.wq;

pthread_mutex_lock(&wq->mutex);
++wq->events_completed;
pthread_cond_signal(&wq->cond);
pthread_mutex_unlock(&wq->mutex);

return;
}

default:
return;
}
Expand Down

0 comments on commit d0ac81c

Please sign in to comment.