提交 3a31b64e 编写于 作者: J Jun He 提交者: David S. Miller

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: NJun He <hjat2005@huawei.com>
Signed-off-by: NDing Tianhong <dingtianhong@huawei.com>
Signed-off-by: NYisen Zhuang <Yisen.Zhuang@huawei.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 d8a8371e
......@@ -768,10 +768,10 @@ static int hns_nic_rx_poll_one(struct hns_nic_ring_data *ring_data,
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 @@ static int hns_nic_rx_poll_one(struct hns_nic_ring_data *ring_data,
}
}
out:
/* make all data has been write before submit */
if (clean_count > 0)
hns_nic_alloc_rx_buffers(ring_data, clean_count);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册