Commit e2152785 authored by Huazhong Tan's avatar Huazhong Tan Committed by David S. Miller

net: hns3: fix netif_napi_del() not do problem when unloading

When the driver is unloading, if a global reset occurs,
unmap_ring_from_vector() in the hns3_nic_uninit_vector_data() will
fail, and hns3_nic_uninit_vector_data() just return. There may be
some netif_napi_del() not be done.

Since hardware will unmap all ring while resetting, so
hns3_nic_uninit_vector_data() should ignore this error, and do the
rest uninitialization.

Fixes: 76ad4f0e ("net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC")
Signed-off-by: default avatarHuazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c8a8045b
...@@ -3183,12 +3183,12 @@ static void hns3_clear_ring_group(struct hns3_enet_ring_group *group) ...@@ -3183,12 +3183,12 @@ static void hns3_clear_ring_group(struct hns3_enet_ring_group *group)
group->count = 0; group->count = 0;
} }
static int hns3_nic_uninit_vector_data(struct hns3_nic_priv *priv) static void hns3_nic_uninit_vector_data(struct hns3_nic_priv *priv)
{ {
struct hnae3_ring_chain_node vector_ring_chain; struct hnae3_ring_chain_node vector_ring_chain;
struct hnae3_handle *h = priv->ae_handle; struct hnae3_handle *h = priv->ae_handle;
struct hns3_enet_tqp_vector *tqp_vector; struct hns3_enet_tqp_vector *tqp_vector;
int i, ret; int i;
for (i = 0; i < priv->vector_num; i++) { for (i = 0; i < priv->vector_num; i++) {
tqp_vector = &priv->tqp_vector[i]; tqp_vector = &priv->tqp_vector[i];
...@@ -3196,15 +3196,10 @@ static int hns3_nic_uninit_vector_data(struct hns3_nic_priv *priv) ...@@ -3196,15 +3196,10 @@ static int hns3_nic_uninit_vector_data(struct hns3_nic_priv *priv)
if (!tqp_vector->rx_group.ring && !tqp_vector->tx_group.ring) if (!tqp_vector->rx_group.ring && !tqp_vector->tx_group.ring)
continue; continue;
ret = hns3_get_vector_ring_chain(tqp_vector, hns3_get_vector_ring_chain(tqp_vector, &vector_ring_chain);
&vector_ring_chain);
if (ret)
return ret;
ret = h->ae_algo->ops->unmap_ring_from_vector(h, h->ae_algo->ops->unmap_ring_from_vector(h,
tqp_vector->vector_irq, &vector_ring_chain); tqp_vector->vector_irq, &vector_ring_chain);
if (ret)
return ret;
hns3_free_vector_ring_chain(tqp_vector, &vector_ring_chain); hns3_free_vector_ring_chain(tqp_vector, &vector_ring_chain);
...@@ -3220,8 +3215,6 @@ static int hns3_nic_uninit_vector_data(struct hns3_nic_priv *priv) ...@@ -3220,8 +3215,6 @@ static int hns3_nic_uninit_vector_data(struct hns3_nic_priv *priv)
hns3_clear_ring_group(&tqp_vector->tx_group); hns3_clear_ring_group(&tqp_vector->tx_group);
netif_napi_del(&priv->tqp_vector[i].napi); netif_napi_del(&priv->tqp_vector[i].napi);
} }
return 0;
} }
static int hns3_nic_dealloc_vector_data(struct hns3_nic_priv *priv) static int hns3_nic_dealloc_vector_data(struct hns3_nic_priv *priv)
...@@ -3691,7 +3684,7 @@ static int hns3_client_init(struct hnae3_handle *handle) ...@@ -3691,7 +3684,7 @@ static int hns3_client_init(struct hnae3_handle *handle)
out_init_phy: out_init_phy:
hns3_uninit_all_ring(priv); hns3_uninit_all_ring(priv);
out_init_ring_data: out_init_ring_data:
(void)hns3_nic_uninit_vector_data(priv); hns3_nic_uninit_vector_data(priv);
out_init_vector_data: out_init_vector_data:
hns3_nic_dealloc_vector_data(priv); hns3_nic_dealloc_vector_data(priv);
out_alloc_vector_data: out_alloc_vector_data:
...@@ -3726,9 +3719,7 @@ static void hns3_client_uninit(struct hnae3_handle *handle, bool reset) ...@@ -3726,9 +3719,7 @@ static void hns3_client_uninit(struct hnae3_handle *handle, bool reset)
hns3_uninit_phy(netdev); hns3_uninit_phy(netdev);
ret = hns3_nic_uninit_vector_data(priv); hns3_nic_uninit_vector_data(priv);
if (ret)
netdev_err(netdev, "uninit vector error\n");
ret = hns3_nic_dealloc_vector_data(priv); ret = hns3_nic_dealloc_vector_data(priv);
if (ret) if (ret)
...@@ -4121,11 +4112,7 @@ static int hns3_reset_notify_uninit_enet(struct hnae3_handle *handle) ...@@ -4121,11 +4112,7 @@ static int hns3_reset_notify_uninit_enet(struct hnae3_handle *handle)
hns3_force_clear_all_rx_ring(handle); hns3_force_clear_all_rx_ring(handle);
ret = hns3_nic_uninit_vector_data(priv); hns3_nic_uninit_vector_data(priv);
if (ret) {
netdev_err(netdev, "uninit vector error\n");
return ret;
}
hns3_store_coal(priv); hns3_store_coal(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