From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 49DA2A0565; Tue, 17 Mar 2020 15:46:13 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1F2941BF7E; Tue, 17 Mar 2020 15:46:03 +0100 (CET) Received: from huawei.com (szxga07-in.huawei.com [45.249.212.35]) by dpdk.org (Postfix) with ESMTP id 39FB91AFF for ; Tue, 17 Mar 2020 15:46:01 +0100 (CET) Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 1C8D67BC2BD0D2EC2963; Tue, 17 Mar 2020 22:45:59 +0800 (CST) Received: from tester.localdomain (10.175.119.39) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.487.0; Tue, 17 Mar 2020 22:45:49 +0800 From: Xiaoyun wang To: CC: , , , , , , , , Xiaoyun wang Date: Tue, 17 Mar 2020 23:01:12 +0800 Message-ID: <5013a1597f6d4db83ab46ae008df1ef7727f1610.1584456756.git.cloud.wangxiaoyun@huawei.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.119.39] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH v2 2/7] net/hinic/base: fix hotupdate firmware problem X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 deteted status of cmdq is fail, then reinit the cmdq when port start. Fixes: d9ce1917941c ("net/hinic/base: add hardware operation") Signed-off-by: Xiaoyun wang --- drivers/net/hinic/base/hinic_pmd_cmdq.c | 4 ++++ drivers/net/hinic/base/hinic_pmd_cmdq.h | 1 + drivers/net/hinic/base/hinic_pmd_nicio.c | 9 +++++++++ 3 files changed, 14 insertions(+) diff --git a/drivers/net/hinic/base/hinic_pmd_cmdq.c b/drivers/net/hinic/base/hinic_pmd_cmdq.c index d73e2bf..685498e 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 da939e1..4ce0a4c 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 59e39ed..31a13fb 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); -- 1.8.3.1