Skip to content

Commit

Permalink
bnxt_re/lib: Avoid applications hang in resize cq operation
Browse files Browse the repository at this point in the history
[ Upstream commit ec106a3 ]

Library currently waits indefinitely for the resize CQ
completion notification from the hardware. Due to hardware
failure in handling the operation, there is a possible
application hang.

Add a loop count with a busy wait of definite time to avoid
the application hang.

Fixes: ae8b278 ("bnxt_re/lib: Resize CQ support")
Signed-off-by: Chandramohan Akula <chandramohan.akula@broadcom.com>
Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
Signed-off-by: Nicolas Morey <nmorey@suse.com>
  • Loading branch information
chandramohan-akula authored and nmorey committed Oct 1, 2024
1 parent 2d21318 commit 95947e9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions providers/bnxt_re/verbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,8 @@ int bnxt_re_resize_cq(struct ibv_cq *ibvcq, int ncqe)
struct bnxt_re_cq *cq = to_bnxt_re_cq(ibvcq);
struct ib_uverbs_resize_cq_resp resp = {};
struct ubnxt_re_resize_cq cmd = {};
uint16_t msec_wait = 100;
uint16_t exit_cnt = 20;
int rc = 0;

if (ncqe > dev->max_cq_depth)
Expand Down Expand Up @@ -488,6 +490,13 @@ int bnxt_re_resize_cq(struct ibv_cq *ibvcq, int ncqe)
list_add_tail(&cq->prev_cq_head, &compl->list);
compl = NULL;
memset(&tmp_wc, 0, sizeof(tmp_wc));
} else {
exit_cnt--;
if (unlikely(!exit_cnt)) {
rc = -EIO;
break;
}
bnxt_re_sub_sec_busy_wait(msec_wait * 1000000);
}
}
done:
Expand Down

0 comments on commit 95947e9

Please sign in to comment.