Commit b7b585c2 authored by Jian Shen's avatar Jian Shen Committed by David S. Miller

net: hns3: add initialization for nic state

This patch adds initialization for nic state, sets flag
HNS3_NIC_STATE_DOWN when initialize, clears it before
vectors and napi being enabled in the hns3_nic_net_up(),
and sets it back in the error handler.
Signed-off-by: default avatarJian Shen <shenjian15@huawei.com>
Signed-off-by: default avatarHuazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 51e8439f
...@@ -348,6 +348,8 @@ static int hns3_nic_net_up(struct net_device *netdev) ...@@ -348,6 +348,8 @@ static int hns3_nic_net_up(struct net_device *netdev)
return ret; return ret;
} }
clear_bit(HNS3_NIC_STATE_DOWN, &priv->state);
/* enable the vectors */ /* enable the vectors */
for (i = 0; i < priv->vector_num; i++) for (i = 0; i < priv->vector_num; i++)
hns3_vector_enable(&priv->tqp_vector[i]); hns3_vector_enable(&priv->tqp_vector[i]);
...@@ -361,11 +363,10 @@ static int hns3_nic_net_up(struct net_device *netdev) ...@@ -361,11 +363,10 @@ static int hns3_nic_net_up(struct net_device *netdev)
if (ret) if (ret)
goto out_start_err; goto out_start_err;
clear_bit(HNS3_NIC_STATE_DOWN, &priv->state);
return 0; return 0;
out_start_err: out_start_err:
set_bit(HNS3_NIC_STATE_DOWN, &priv->state);
while (j--) while (j--)
hns3_tqp_disable(h->kinfo.tqp[j]); hns3_tqp_disable(h->kinfo.tqp[j]);
...@@ -3614,6 +3615,7 @@ static int hns3_client_init(struct hnae3_handle *handle) ...@@ -3614,6 +3615,7 @@ static int hns3_client_init(struct hnae3_handle *handle)
priv->netdev = netdev; priv->netdev = netdev;
priv->ae_handle = handle; priv->ae_handle = handle;
priv->tx_timeout_count = 0; priv->tx_timeout_count = 0;
set_bit(HNS3_NIC_STATE_DOWN, &priv->state);
handle->kinfo.netdev = netdev; handle->kinfo.netdev = netdev;
handle->priv = (void *)priv; handle->priv = (void *)priv;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment