From: Florian Fainelli <f.fainelli@gmail.com>
To: Yankejian <yankejian@huawei.com>,
davem@davemloft.net, salil.mehta@huawei.com,
yisen.zhuang@huawei.com, matthias.bgg@gmail.com,
lipeng321@huawei.com, zhouhuiru@huawei.com,
huangdaode@hisilicon.com
Cc: netdev@vger.kernel.org, linuxarm@huawei.com
Subject: Re: [PATCH net v4 3/3] net: hns: fixed bug that skb used after kfree
Date: Thu, 27 Apr 2017 10:38:29 -0700 [thread overview]
Message-ID: <eb7eaead-f32c-0ffb-3b24-0d6e11a60843@gmail.com> (raw)
In-Reply-To: <1493261053-68197-4-git-send-email-yankejian@huawei.com>
On 04/26/2017 07:44 PM, Yankejian wrote:
> struct hns_nic_priv *priv = netdev_priv(ndev);
> struct hnae_ring *ring = ring_data->ring;
> @@ -361,6 +361,10 @@ int hns_nic_net_xmit_hw(struct net_device *ndev,
> dev_queue = netdev_get_tx_queue(ndev, skb->queue_mapping);
> netdev_tx_sent_queue(dev_queue, skb->len);
>
> + netif_trans_update(ndev);
> + ndev->stats.tx_bytes += skb->len;
> + ndev->stats.tx_packets++;
This is still wrong though, you should not update your TX statistics
until you get a TX completion interrupt that confirms these packets were
actually transmitted. This has the advantage of not causing use after
free in your ndo_start_xmit() function (current bug), and also allows
feeding information into BQL where it is appropriate, and in a central
location: the TX completion handler.
--
Florian
next prev parent reply other threads:[~2017-04-27 17:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-27 2:44 [PATCH net v4 0/3] net: hns: bug fix for HNS driver Yankejian
2017-04-27 2:44 ` [PATCH net v4 1/3] net: hns: support deferred probe when can not obtain irq Yankejian
2017-04-27 11:58 ` Matthias Brugger
2017-04-28 3:36 ` lipeng (Y)
2017-04-27 2:44 ` [PATCH net v4 2/3] net: hns: support deferred probe when no mdio Yankejian
2017-04-27 2:44 ` [PATCH net v4 3/3] net: hns: fixed bug that skb used after kfree Yankejian
2017-04-27 17:38 ` Florian Fainelli [this message]
2017-04-28 3:39 ` lipeng (Y)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=eb7eaead-f32c-0ffb-3b24-0d6e11a60843@gmail.com \
--to=f.fainelli@gmail.com \
--cc=davem@davemloft.net \
--cc=huangdaode@hisilicon.com \
--cc=linuxarm@huawei.com \
--cc=lipeng321@huawei.com \
--cc=matthias.bgg@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=salil.mehta@huawei.com \
--cc=yankejian@huawei.com \
--cc=yisen.zhuang@huawei.com \
--cc=zhouhuiru@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).