aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/hisilicon
diff options
context:
space:
mode:
authorJun He <hjat2005@huawei.com>2016-06-21 11:56:36 +0800
committerDavid S. Miller <davem@davemloft.net>2016-06-21 04:51:55 -0400
commit3a31b64e3e4f37452709d73f2c0b5c433faad3f3 (patch)
treeef6e5b39132d0bb56d7d49246cdb6fa7ce65bbaa /drivers/net/ethernet/hisilicon
parentnet: hns: bug fix about led control logic when link down (diff)
downloadlinux-dev-3a31b64e3e4f37452709d73f2c0b5c433faad3f3.tar.xz
linux-dev-3a31b64e3e4f37452709d73f2c0b5c433faad3f3.zip
net: hns: fix bug that alloc skb fail lead to port unavailable
When hns_nic_poll_rx_skb alloc skb fail, it will break receive cycle and read new fbd_num to start new receive cycle. It recomputes cycle num is fbd_num minus clean_count, actually this cycle num is too big because it drop out receive cycle. It brings about the port unavailable. So we will goto out when alloc skb fail to fix this bug. Signed-off-by: Jun He <hjat2005@huawei.com> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com> Signed-off-by: Yisen Zhuang <Yisen.Zhuang@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/hisilicon')
-rw-r--r--drivers/net/ethernet/hisilicon/hns/hns_enet.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
index f49246dfa40c..c0ce37b1702c 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
@@ -768,10 +768,10 @@ recv:
clean_count = 0;
}
- /* poll one pkg*/
+ /* poll one pkt*/
err = hns_nic_poll_rx_skb(ring_data, &skb, &bnum);
if (unlikely(!skb)) /* this fault cannot be repaired */
- break;
+ goto out;
recv_bds += bnum;
clean_count += bnum;
@@ -797,6 +797,7 @@ recv:
}
}
+out:
/* make all data has been write before submit */
if (clean_count > 0)
hns_nic_alloc_rx_buffers(ring_data, clean_count);