From mboxrd@z Thu Jan 1 00:00:00 1970 From: Huazhong Tan Subject: [Patch V3 net 09/11] net: hns3: bugfix for handling mailbox while the command queue reinitialized Date: Sun, 28 Oct 2018 11:34:09 +0800 Message-ID: <1540697651-22993-10-git-send-email-tanhuazhong@huawei.com> References: <1540697651-22993-1-git-send-email-tanhuazhong@huawei.com> Mime-Version: 1.0 Content-Type: text/plain Cc: , , , , , To: , Return-path: Received: from szxga04-in.huawei.com ([45.249.212.190]:14136 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729116AbeJ1MRU (ORCPT ); Sun, 28 Oct 2018 08:17:20 -0400 In-Reply-To: <1540697651-22993-1-git-send-email-tanhuazhong@huawei.com> Sender: netdev-owner@vger.kernel.org List-ID: In a multi-core machine, the mailbox service and reset service will be executed at the same time. The reset service will re-initialize the command queue, before that, the mailbox handler can only get some invalid messages. The HCLGE_STATE_CMD_DISABLE flag means that the command queue is not available and needs to be reinitialized. Therefore, when the mailbox handler recognizes this flag, it should not process the command. Fixes: dde1a86e93ca ("net: hns3: Add mailbox support to PF driver") Signed-off-by: Huazhong Tan --- V3: Fixes comments from Sergei Shtylyov --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c index 04462a3..f890022 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c @@ -400,6 +400,12 @@ void hclge_mbx_handler(struct hclge_dev *hdev) /* handle all the mailbox requests in the queue */ while (!hclge_cmd_crq_empty(&hdev->hw)) { + if (test_bit(HCLGE_STATE_CMD_DISABLE, &hdev->state)) { + dev_warn(&hdev->pdev->dev, + "command queue needs re-initializing\n"); + return; + } + desc = &crq->desc[crq->next_to_use]; req = (struct hclge_mbx_vf_to_pf_cmd *)desc->data; -- 2.7.4