From 92376b51a9abe5218ca67f034d7247ecf03e2c39 Mon Sep 17 00:00:00 2001 From: Chandramohan Akula Date: Thu, 29 Aug 2024 12:46:26 +0530 Subject: [PATCH] bnxt_re/lib: Avoid applications hang in resize cq operation [ Upstream commit ec106a323bfadee9b0965814c201b3a1f38079c5 ] 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: ae8b27866ad6 ("bnxt_re/lib: Resize CQ support") Signed-off-by: Chandramohan Akula Signed-off-by: Selvin Xavier Signed-off-by: Nicolas Morey --- providers/bnxt_re/verbs.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/providers/bnxt_re/verbs.c b/providers/bnxt_re/verbs.c index 7d5c36641..94ddd515a 100644 --- a/providers/bnxt_re/verbs.c +++ b/providers/bnxt_re/verbs.c @@ -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) @@ -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: