ar71xx: only access device stats in tx handler if packets were processed
authorFelix Fietkau <nbd@nbd.name>
Tue, 5 Dec 2017 13:23:59 +0000 (14:23 +0100)
committerFelix Fietkau <nbd@nbd.name>
Tue, 12 Dec 2017 11:46:04 +0000 (12:46 +0100)
Signed-off-by: Felix Fietkau <nbd@nbd.name>
target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c

index eea54132f9d96f760295c69c170bfeb2e727bbba..3e7bfb70745f4544cde7a5316f0b002130f51435 100644 (file)
@@ -990,12 +990,12 @@ static int ag71xx_tx_packets(struct ag71xx *ag, bool flush)
 
        DBG("%s: %d packets sent out\n", ag->dev->name, sent);
 
-       ag->dev->stats.tx_bytes += bytes_compl;
-       ag->dev->stats.tx_packets += sent;
-
        if (!sent)
                return 0;
 
+       ag->dev->stats.tx_bytes += bytes_compl;
+       ag->dev->stats.tx_packets += sent;
+
        netdev_completed_queue(ag->dev, sent, bytes_compl);
        if ((ring->curr - ring->dirty) < (ring_size * 3) / 4)
                netif_wake_queue(ag->dev);