aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYishai Hadas <yishaih@mellanox.com>2016-09-15 15:48:09 +0300
committerDoug Ledford <dledford@redhat.com>2016-09-15 14:16:49 -0400
commitd0ac81c60e12276efb0c094761a82bb388bb134b (patch)
tree300d695fe49d9669ffedaa4ce3547aff5d560f08
parentf70af0c4de0ad790471c0f2186d0a8b5782c4c44 (diff)
Track asynchronous events on a work queue
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>
-rw-r--r--include/infiniband/verbs.h2
-rw-r--r--src/device.c15
2 files changed, 17 insertions, 0 deletions
diff --git a/include/infiniband/verbs.h b/include/infiniband/verbs.h
index 88ac4bb..eab5d1b 100644
--- a/include/infiniband/verbs.h
+++ b/include/infiniband/verbs.h
@@ -341,6 +341,7 @@ 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 {
@@ -348,6 +349,7 @@ struct ibv_async_event {
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;
diff --git a/src/device.c b/src/device.c
index e520295..82d928a 100644
--- a/src/device.c
+++ b/src/device.c
@@ -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;
@@ -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;
}