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

Reply via email to