Event Handling Operations

Template: int ibv_get_async_event(struct ibv_context *context, struct ibv_async_event *event)

Input Parameters:

context struct ibv_context from ibv_open_device

event A pointer to use to return the async event

Output Parameters:

event A pointer to the async event being sought

Return Value: 0 on success, -1 on error. If the call fails, errno will be set to indicate the reason for the failure.
Description: ibv_get_async_event gets the next asynchronous event of the RDMA device context 'context' and returns it through the pointer 'event' which is an ibv_async_event struct. All async events returned by ibv_get_async_event must eventually be acknowledged with ibv_ack_asyn- c_event. ibv_get_async_event() is a blocking function. If multiple threads call this function simultaneously, then when an async event occurs, only one thread will receive it, and it is not possible to predict which thread will receive it.

struct ibv_async_event is defined as follows:

Copy
Copied!
            

struct ibv_async_event { union { struct ibv_cq *cq; The CQ that got the event struct ibv_qp *qp; The QP that got the event struct ibv_srq *srq; The SRQ that got the event int port_num; The port number that got the event } element; enum ibv_event_type event_type; Type of event };

One member of the element union will be valid, depending on the event_type member of the structure. event_type will be one of the following events:

QP events:

IBV_EVENT_QP_FATAL

Error occurred on a QP and it transitioned to error state

IBV_EVENT_QP_REQ_ERR

Invalid Request Local Work Queue Error

IBV_EVENT_QP_ACCESS_ERR

Local access violation error

IBV_EVENT_COMM_EST

Communication was established on a QP

IBV_EVENT_SQ_DRAINED

Send Queue was drained of outstanding messages in progress

IBV_EVENT_PATH_MIG

A connection has migrated to the alternate path

IBV_EVENT_PATH_MIG_ERR

A connection failed to migrate to the alternate path

IBV_EVENT_QP_LAST_WQE_REACHED

Last WQE Reached on a QP associated with an SRQ

CQ events:

IBV_EVENT_CQ_ERR

CQ is in error (CQ overrun)

SRQ events:

IBV_EVENT_SRQ_ERR

Error occurred on an SRQ

IBV_EVENT_SRQ_LIMIT_REACHED

SRQ limit was reached

Port events:

IBV_EVENT_PORT_ACTIVE

Link became active on a port

IBV_EVENT_PORT_ERR

Link became unavailable on a port

IBV_EVENT_LID_CHANGE

LID was changed on a port

IBV_EVENT_PKEY_CHANGE

P_Key table was changed on a port

IBV_EVENT_SM_CHANGE

SM was changed on a port

IBV_EVENT_CLIENT_REREGISTER

SM sent a CLIENT_REREGISTER request to a port

IBV_EVENT_GID_CHANGE

GID table was changed on a port

CA events:

IBV_EVENT_DEVICE_FATAL

CA is in FATAL state

Template: void ibv_ack_async_event(struct ibv_async_event *event)

Input Parameters:

event A pointer to the event to be acknowledged

Output Parameters: None

Return Value: None

Description: All async events that ibv_get_async_event() returns must be acknowledged using ibv_ack_asyn- c_event(). To avoid races, destroying an object (CQ, SRQ or QP) will wait for all affiliated events for the object to be acknowledged; this avoids an application retrieving an affiliated event after the corresponding object has already been destroyed.

Template: const char {}ibv_event_type_str{*}(enum ibv_event_type event_type)

Input Parameters:

event_type ibv_event_type enum value

Output Parameters: None

Return Value: A constant string which describes the enum value event_type

Description: ibv_event_type_str returns a string describing the event type enum value, event_type. event_- type may be any one of the 19 different enum values describing different IB events.

Copy
Copied!
            

ibv_event_type { IBV_EVENT_CQ_ERR, IBV_EVENT_QP_FATAL, IBV_EVENT_QP_REQ_ERR, IBV_EVENT_QP_ACCESS_ERR, IBV_EVENT_COMM_EST, IBV_EVENT_SQ_DRAINED, IBV_EVENT_PATH_MIG, IBV_EVENT_PATH_MIG_ERR, IBV_EVENT_DEVICE_FATAL, IBV_EVENT_PORT_ACTIVE, IBV_EVENT_PORT_ERR, IBV_EVENT_LID_CHANGE, IBV_EVENT_PKEY_CHANGE, IBV_EVENT_SM_CHANGE, IBV_EVENT_SRQ_ERR, IBV_EVENT_SRQ_LIMIT_REACHED, IBV_EVENT_QP_LAST_WQE_REACHED, IBV_EVENT_CLIENT_REREGISTER, IBV_EVENT_GID_CHANGE, };

© Copyright 2023, NVIDIA. Last updated on May 23, 2023.