RDMA/bnxt_re: cancel all control path command waiters upon error
authorKashyap Desai <kashyap.desai@broadcom.com>
Fri, 9 Jun 2023 11:01:51 +0000 (04:01 -0700)
committerLeon Romanovsky <leon@kernel.org>
Mon, 12 Jun 2023 07:10:51 +0000 (10:10 +0300)
When an error is detected in FW, wake up all the waiters as the
all of them need to be completed with timeout. Add the device
error state also as a wait condition.

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-15-git-send-email-selvin.xavier@broadcom.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/infiniband/hw/bnxt_re/main.c
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c

index 51372de19e22cca166348bb601658b930a538e8c..82411541943698fc22b3744ad333b2768883acc5 100644 (file)
@@ -1495,6 +1495,7 @@ static int bnxt_re_suspend(struct auxiliary_device *adev, pm_message_t state)
         */
        set_bit(BNXT_RE_FLAG_ERR_DEVICE_DETACHED, &rdev->flags);
        set_bit(ERR_DEVICE_DETACHED, &rdev->rcfw.cmdq.flags);
+       wake_up_all(&rdev->rcfw.cmdq.waitq);
        mutex_unlock(&bnxt_re_mutex);
 
        return 0;
index 8dd82163ab7ac10d4597384b7ab81f4661120814..8b1b4132afc024fae5fe02104002b0f57511d8a4 100644 (file)
@@ -116,10 +116,10 @@ static int __wait_for_resp(struct bnxt_qplib_rcfw *rcfw, u16 cookie, u8 opcode)
                        return -ETIMEDOUT;
 
                wait_event_timeout(cmdq->waitq,
-                                  !test_bit(cbit, cmdq->cmdq_bitmap),
+                                  !test_bit(cbit, cmdq->cmdq_bitmap) ||
+                                  test_bit(ERR_DEVICE_DETACHED, &cmdq->flags),
                                   msecs_to_jiffies(RCFW_FW_STALL_TIMEOUT_SEC
                                                    * 1000));
-
                if (!test_bit(cbit, cmdq->cmdq_bitmap))
                        return 0;