lkml.org 
[lkml]   [2019]   [Dec]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v4] net: hisilicon: Fix a BUG trigered by wrong bytes_compl
From
From: Jiangfeng Xiao <xiaojiangfeng@huawei.com>
Date: Thu, 19 Dec 2019 10:08:07 +0800

> When doing stress test, we get the following trace:
...
> Pre-modification code:
> int hip04_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
> {
> [...]
> [1] priv->tx_head = TX_NEXT(tx_head);
> [2] count++;
> [3] netdev_sent_queue(ndev, skb->len);
> [...]
> }
> An rx interrupt occurs if hip04_mac_start_xmit just executes to the line 2,
> tx_head has been updated, but corresponding 'skb->len' has not been
> added to dql_queue.
>
> And then
> hip04_mac_interrupt->__napi_schedule->hip04_rx_poll->hip04_tx_reclaim
>
> In hip04_tx_reclaim, because tx_head has been updated,
> bytes_compl will plus an additional "skb-> len"
> which has not been added to dql_queue. And then
> trigger the BUG_ON(bytes_compl > num_queued - dql->num_completed).
>
> To solve the problem described above, we put
> "netdev_sent_queue(ndev, skb->len);"
> before
> "priv->tx_head = TX_NEXT(tx_head);"
>
> Fixes: a41ea46a9a12 ("net: hisilicon: new hip04 ethernet driver")
> Signed-off-by: Jiangfeng Xiao <xiaojiangfeng@huawei.com>

Applied, thanks.

\
 
 \ /
  Last update: 2019-12-21 06:16    [W:0.025 / U:6.912 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site