Skip to content

Commit

Permalink
bnxt_re/lib: Adds bnxt_re_async_event support
Browse files Browse the repository at this point in the history
Whenever the application calls the async_event hook, the driver
needs to move qp to error state and also add it into the flush list.
Terminal cqe will be posted in most of the cases and QPs can be moved
to flush list from the HW CQE. Async event is required if the
terminal CQEs are not generated.

Signed-off-by: Kashyap Desai <[email protected]>
Signed-off-by: Selvin Xavier <[email protected]>
  • Loading branch information
kadesai16 authored and selvintxavier committed Nov 16, 2023
1 parent fd3077a commit 1190b64
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions providers/bnxt_re/main.c
Expand Up @@ -115,6 +115,7 @@ static const struct verbs_context_ops bnxt_re_cntx_ops = {
.destroy_qp = bnxt_re_destroy_qp,
.post_send = bnxt_re_post_send,
.post_recv = bnxt_re_post_recv,
.async_event = bnxt_re_async_event,
.create_ah = bnxt_re_create_ah,
.destroy_ah = bnxt_re_destroy_ah,
.free_context = bnxt_re_free_context,
Expand Down
31 changes: 31 additions & 0 deletions providers/bnxt_re/verbs.c
Expand Up @@ -1257,6 +1257,37 @@ static int bnxt_re_alloc_queues(struct bnxt_re_dev *dev,
return ret;
}

void bnxt_re_async_event(struct ibv_context *context,
struct ibv_async_event *event)
{
struct ibv_qp *ibvqp;
struct bnxt_re_qp *qp;

switch (event->event_type) {
case IBV_EVENT_CQ_ERR:
break;
case IBV_EVENT_SRQ_ERR:
case IBV_EVENT_QP_FATAL:
case IBV_EVENT_QP_REQ_ERR:
case IBV_EVENT_QP_ACCESS_ERR:
case IBV_EVENT_PATH_MIG_ERR: {
ibvqp = event->element.qp;
qp = to_bnxt_re_qp(ibvqp);
bnxt_re_qp_move_flush_err(qp);
break;
}
case IBV_EVENT_SQ_DRAINED:
case IBV_EVENT_PATH_MIG:
case IBV_EVENT_COMM_EST:
case IBV_EVENT_QP_LAST_WQE_REACHED:
case IBV_EVENT_SRQ_LIMIT_REACHED:
case IBV_EVENT_PORT_ACTIVE:
case IBV_EVENT_PORT_ERR:
default:
break;
}
}

struct ibv_qp *bnxt_re_create_qp(struct ibv_pd *ibvpd,
struct ibv_qp_init_attr *attr)
{
Expand Down
2 changes: 2 additions & 0 deletions providers/bnxt_re/verbs.h
Expand Up @@ -104,5 +104,7 @@ int bnxt_re_post_srq_recv(struct ibv_srq *ibvsrq, struct ibv_recv_wr *wr,
struct ibv_ah *bnxt_re_create_ah(struct ibv_pd *ibvpd,
struct ibv_ah_attr *attr);
int bnxt_re_destroy_ah(struct ibv_ah *ibvah);
void bnxt_re_async_event(struct ibv_context *context,
struct ibv_async_event *event);

#endif /* __BNXT_RE_VERBS_H__ */

0 comments on commit 1190b64

Please sign in to comment.