Skip to content

Commit bb8c936

Browse files
kadesai16rleon
authored andcommitted
RDMA/bnxt_re: consider timeout of destroy ah as success.
If destroy_ah is timed out, it is likely to be destroyed by firmware but it is taking longer time due to temporary slowness in processing the rcfw command. In worst case, there might be AH resource leak in firmware. Sending timeout return value can dump warning message from ib_core which can be avoided if we map timeout of destroy_ah as success. Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com> Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com> Link: https://lore.kernel.org/r/1686308514-11996-14-git-send-email-selvin.xavier@broadcom.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
1 parent 84911cf commit bb8c936

4 files changed

Lines changed: 21 additions & 9 deletions

File tree

drivers/infiniband/hw/bnxt_re/bnxt_re.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ struct bnxt_re_dev {
181181
#define BNXT_RE_ROCEV2_IPV4_PACKET 2
182182
#define BNXT_RE_ROCEV2_IPV6_PACKET 3
183183

184+
#define BNXT_RE_CHECK_RC(x) ((x) && ((x) != -ETIMEDOUT))
185+
184186
static inline struct device *rdev_to_dev(struct bnxt_re_dev *rdev)
185187
{
186188
if (rdev)

drivers/infiniband/hw/bnxt_re/ib_verbs.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -613,12 +613,20 @@ int bnxt_re_destroy_ah(struct ib_ah *ib_ah, u32 flags)
613613
{
614614
struct bnxt_re_ah *ah = container_of(ib_ah, struct bnxt_re_ah, ib_ah);
615615
struct bnxt_re_dev *rdev = ah->rdev;
616+
bool block = true;
617+
int rc = 0;
616618

617-
bnxt_qplib_destroy_ah(&rdev->qplib_res, &ah->qplib_ah,
618-
!(flags & RDMA_DESTROY_AH_SLEEPABLE));
619+
block = !(flags & RDMA_DESTROY_AH_SLEEPABLE);
620+
rc = bnxt_qplib_destroy_ah(&rdev->qplib_res, &ah->qplib_ah, block);
621+
if (BNXT_RE_CHECK_RC(rc)) {
622+
if (rc == -ETIMEDOUT)
623+
rc = 0;
624+
else
625+
goto fail;
626+
}
619627
atomic_dec(&rdev->ah_count);
620-
621-
return 0;
628+
fail:
629+
return rc;
622630
}
623631

624632
static u8 bnxt_re_stack_to_dev_nw_type(enum rdma_network_type ntype)

drivers/infiniband/hw/bnxt_re/qplib_sp.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -460,13 +460,14 @@ int bnxt_qplib_create_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah,
460460
return 0;
461461
}
462462

463-
void bnxt_qplib_destroy_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah,
464-
bool block)
463+
int bnxt_qplib_destroy_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah,
464+
bool block)
465465
{
466466
struct bnxt_qplib_rcfw *rcfw = res->rcfw;
467467
struct creq_destroy_ah_resp resp = {};
468468
struct bnxt_qplib_cmdqmsg msg = {};
469469
struct cmdq_destroy_ah req = {};
470+
int rc;
470471

471472
/* Clean up the AH table in the device */
472473
bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
@@ -477,7 +478,8 @@ void bnxt_qplib_destroy_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah,
477478

478479
bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req),
479480
sizeof(resp), block);
480-
bnxt_qplib_rcfw_send_message(rcfw, &msg);
481+
rc = bnxt_qplib_rcfw_send_message(rcfw, &msg);
482+
return rc;
481483
}
482484

483485
/* MRW */

drivers/infiniband/hw/bnxt_re/qplib_sp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,8 @@ int bnxt_qplib_set_func_resources(struct bnxt_qplib_res *res,
327327
struct bnxt_qplib_ctx *ctx);
328328
int bnxt_qplib_create_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah,
329329
bool block);
330-
void bnxt_qplib_destroy_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah,
331-
bool block);
330+
int bnxt_qplib_destroy_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah,
331+
bool block);
332332
int bnxt_qplib_alloc_mrw(struct bnxt_qplib_res *res,
333333
struct bnxt_qplib_mrw *mrw);
334334
int bnxt_qplib_dereg_mrw(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mrw,

0 commit comments

Comments
 (0)