net/hinic/base: fix port start during FW hot update
authorXiaoyun Wang <cloud.wangxiaoyun@huawei.com>
Tue, 17 Mar 2020 15:01:12 +0000 (23:01 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 21 Apr 2020 11:57:04 +0000 (13:57 +0200)
When repeatedly hotupdate firmware and start/stop port at the same time,
port start may be failed when cmdq reinit failed at the FW active phase,
so if cmdq fails, then reinit the cmdq when port start.

Fixes: d9ce1917941c ("net/hinic/base: add hardware operation")
Cc: stable@dpdk.org
Signed-off-by: Xiaoyun Wang <cloud.wangxiaoyun@huawei.com>
drivers/net/hinic/base/hinic_pmd_cmdq.c
drivers/net/hinic/base/hinic_pmd_cmdq.h
drivers/net/hinic/base/hinic_pmd_nicio.c

index d73e2bf..685498e 100644 (file)
@@ -7,6 +7,7 @@
 #include "hinic_pmd_hwif.h"
 #include "hinic_pmd_wq.h"
 #include "hinic_pmd_mgmt.h"
+#include "hinic_pmd_mbox.h"
 #include "hinic_pmd_cmdq.h"
 
 #define CMDQ_CMD_TIMEOUT                               5000 /* millisecond */
@@ -439,11 +440,14 @@ static int hinic_set_cmdq_ctxts(struct hinic_hwdev *hwdev)
                                             cmdq_ctxt, in_size, NULL,
                                             NULL, 0);
                if (err) {
+                       if (err == HINIC_MBOX_PF_BUSY_ACTIVE_FW)
+                               cmdqs->status |= HINIC_CMDQ_SET_FAIL;
                        PMD_DRV_LOG(ERR, "Set cmdq ctxt failed");
                        return -EFAULT;
                }
        }
 
+       cmdqs->status &= ~HINIC_CMDQ_SET_FAIL;
        cmdqs->status |= HINIC_CMDQ_ENABLE;
 
        return 0;
index da939e1..4ce0a4c 100644 (file)
@@ -170,6 +170,7 @@ struct hinic_cmdq_ctxt {
 
 enum hinic_cmdq_status {
        HINIC_CMDQ_ENABLE = BIT(0),
+       HINIC_CMDQ_SET_FAIL = BIT(1)
 };
 
 enum hinic_cmdq_cmd_type {
index 59e39ed..31a13fb 100644 (file)
@@ -533,6 +533,15 @@ int hinic_init_qp_ctxts(struct hinic_hwdev *hwdev)
                return err;
        }
 
+       if (hwdev->cmdqs->status & HINIC_CMDQ_SET_FAIL) {
+               err = hinic_reinit_cmdq_ctxts(hwdev);
+               if (err) {
+                       PMD_DRV_LOG(ERR, "Reinit cmdq context failed, rc: %d\n",
+                               err);
+                       return err;
+               }
+       }
+
        err = init_qp_ctxts(nic_io);
        if (err) {
                PMD_DRV_LOG(ERR, "Init QP ctxts failed, rc: %d", err);