* [PATCH net] net: hns3: add compatible handling for command HCLGE_OPC_PF_RST_DONE
@ 2019-11-07 1:30 Huazhong Tan
2019-11-07 5:47 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Huazhong Tan @ 2019-11-07 1:30 UTC (permalink / raw)
To: davem
Cc: netdev, linux-kernel, salil.mehta, yisen.zhuang, linuxarm,
jakub.kicinski, Huazhong Tan
Since old firmware does not support HCLGE_OPC_PF_RST_DONE, it will
return -EOPNOTSUPP to the driver when received this command. So
for this case, it should just print a warning and return success
to the caller.
Fixes: 72e2fb07997c ("net: hns3: clear reset interrupt status in hclge_irq_handle()")
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
---
.../net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index e02e01b..16f7d0e 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -3587,12 +3587,28 @@ static int hclge_set_rst_done(struct hclge_dev *hdev)
{
struct hclge_pf_rst_done_cmd *req;
struct hclge_desc desc;
+ int ret;
req = (struct hclge_pf_rst_done_cmd *)desc.data;
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_PF_RST_DONE, false);
req->pf_rst_done |= HCLGE_PF_RESET_DONE_BIT;
- return hclge_cmd_send(&hdev->hw, &desc, 1);
+ ret = hclge_cmd_send(&hdev->hw, &desc, 1);
+ /* To be compatible with the old firmware, which does not support
+ * command HCLGE_OPC_PF_RST_DONE, just print a warning and
+ * return success
+ */
+ if (ret == -EOPNOTSUPP) {
+ dev_warn(&hdev->pdev->dev,
+ "current firmware does not support command(0x%x)!\n",
+ HCLGE_OPC_PF_RST_DONE);
+ return 0;
+ } else if (ret) {
+ dev_err(&hdev->pdev->dev, "assert PF reset done fail %d!\n",
+ ret);
+ }
+
+ return ret;
}
static int hclge_reset_prepare_up(struct hclge_dev *hdev)
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] net: hns3: add compatible handling for command HCLGE_OPC_PF_RST_DONE
2019-11-07 1:30 [PATCH net] net: hns3: add compatible handling for command HCLGE_OPC_PF_RST_DONE Huazhong Tan
@ 2019-11-07 5:47 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-11-07 5:47 UTC (permalink / raw)
To: tanhuazhong
Cc: netdev, linux-kernel, salil.mehta, yisen.zhuang, linuxarm,
jakub.kicinski
From: Huazhong Tan <tanhuazhong@huawei.com>
Date: Thu, 7 Nov 2019 09:30:19 +0800
> Since old firmware does not support HCLGE_OPC_PF_RST_DONE, it will
> return -EOPNOTSUPP to the driver when received this command. So
> for this case, it should just print a warning and return success
> to the caller.
>
> Fixes: 72e2fb07997c ("net: hns3: clear reset interrupt status in hclge_irq_handle()")
> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-11-07 5:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-07 1:30 [PATCH net] net: hns3: add compatible handling for command HCLGE_OPC_PF_RST_DONE Huazhong Tan
2019-11-07 5:47 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).