diff mbox series

[net-next,7/9] net: hns3: Fix for reset_level default assignment probelm

Message ID 20180716153627.476-8-salil.mehta@huawei.com
State New
Headers show
Series Bug fixes and some minor changes to HNS3 driver | expand

Commit Message

Salil Mehta July 16, 2018, 3:36 p.m. UTC
From: Yunsheng Lin <linyunsheng@huawei.com>


handle->reset_level is assigned to HNAE3_NONE_RESET when client is
initialized, if a tx timeout happens right after initialization,
then handle->reset_level is not resetted to HNAE3_FUNC_RESET in
hclge_reset_event, which will cause reset event not properly
handled problem.

This patch fixes it by setting handle->reset_level properly when
client is initialized.

Fixes: 6d4c3981a8d8 ("net: hns3: Changes to make enet watchdog timeout func common for PF/VF")
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>

Signed-off-by: Peng Li <lipeng321@huawei.com>

Signed-off-by: Salil Mehta <salil.mehta@huawei.com>

---
 drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

-- 
2.7.4

Comments

Sergei Shtylyov July 17, 2018, 9:37 a.m. UTC | #1
Hello!

On 7/16/2018 6:36 PM, Salil Mehta wrote:

> From: Yunsheng Lin <linyunsheng@huawei.com>

> 

> handle->reset_level is assigned to HNAE3_NONE_RESET when client is

> initialized, if a tx timeout happens right after initialization,

> then handle->reset_level is not resetted to HNAE3_FUNC_RESET in


    s/resetted/reset/.

> hclge_reset_event, which will cause reset event not properly

> handled problem.

> 

> This patch fixes it by setting handle->reset_level properly when

> client is initialized.

> 

> Fixes: 6d4c3981a8d8 ("net: hns3: Changes to make enet watchdog timeout func common for PF/VF")

> Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>

> Signed-off-by: Peng Li <lipeng321@huawei.com>

> Signed-off-by: Salil Mehta <salil.mehta@huawei.com>

[...]

MBR, Sergei
diff mbox series

Patch

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
index 24f82b7..29be96e 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
@@ -3085,7 +3085,6 @@  static int hns3_client_init(struct hnae3_handle *handle)
 	priv->dev = &pdev->dev;
 	priv->netdev = netdev;
 	priv->ae_handle = handle;
-	priv->ae_handle->reset_level = HNAE3_NONE_RESET;
 	priv->ae_handle->last_reset_time = jiffies;
 	priv->tx_timeout_count = 0;
 
@@ -3106,6 +3105,11 @@  static int hns3_client_init(struct hnae3_handle *handle)
 	/* Carrier off reporting is important to ethtool even BEFORE open */
 	netif_carrier_off(netdev);
 
+	if (handle->flags & HNAE3_SUPPORT_VF)
+		handle->reset_level = HNAE3_VF_RESET;
+	else
+		handle->reset_level = HNAE3_FUNC_RESET;
+
 	ret = hns3_get_ring_config(priv);
 	if (ret) {
 		ret = -ENOMEM;