From: Xiaoyun Wang Date: Tue, 17 Mar 2020 15:01:12 +0000 (+0800) Subject: net/hinic/base: fix port start during FW hot update X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=0194313b2df66d9308c79f501d1018a99b32098b;p=dpdk.git net/hinic/base: fix port start during FW hot update 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 --- diff --git a/drivers/net/hinic/base/hinic_pmd_cmdq.c b/drivers/net/hinic/base/hinic_pmd_cmdq.c index d73e2bf592..685498ec2f 100644 --- a/drivers/net/hinic/base/hinic_pmd_cmdq.c +++ b/drivers/net/hinic/base/hinic_pmd_cmdq.c @@ -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; diff --git a/drivers/net/hinic/base/hinic_pmd_cmdq.h b/drivers/net/hinic/base/hinic_pmd_cmdq.h index da939e16fa..4ce0a4c5b8 100644 --- a/drivers/net/hinic/base/hinic_pmd_cmdq.h +++ b/drivers/net/hinic/base/hinic_pmd_cmdq.h @@ -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 { diff --git a/drivers/net/hinic/base/hinic_pmd_nicio.c b/drivers/net/hinic/base/hinic_pmd_nicio.c index 59e39ed984..31a13fbdcf 100644 --- a/drivers/net/hinic/base/hinic_pmd_nicio.c +++ b/drivers/net/hinic/base/hinic_pmd_nicio.c @@ -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);