]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: ena: Make missed_tx stat incremental
authorShay Agroskin <shayagr@amazon.com>
Wed, 19 Aug 2020 17:28:38 +0000 (20:28 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Aug 2020 07:30:49 +0000 (09:30 +0200)
[ Upstream commit ccd143e5150f24b9ba15145c7221b61dd9e41021 ]

Most statistics in ena driver are incremented, meaning that a stat's
value is a sum of all increases done to it since driver/queue
initialization.

This patch makes all statistics this way, effectively making missed_tx
statistic incremental.
Also added a comment regarding rx_drops and tx_drops to make it
clearer how these counters are calculated.

Fixes: 11095fdb712b ("net: ena: add statistics for missed tx packets")
Signed-off-by: Shay Agroskin <shayagr@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/amazon/ena/ena_netdev.c

index c501a4edc34d62f094542400e710e4c277fef445..51b9b49a295e967c225f00051010f930a852c97d 100644 (file)
@@ -3594,7 +3594,7 @@ static int check_missing_comp_in_tx_queue(struct ena_adapter *adapter,
        }
 
        u64_stats_update_begin(&tx_ring->syncp);
-       tx_ring->tx_stats.missed_tx = missed_tx;
+       tx_ring->tx_stats.missed_tx += missed_tx;
        u64_stats_update_end(&tx_ring->syncp);
 
        return rc;
@@ -4519,6 +4519,9 @@ static void ena_keep_alive_wd(void *adapter_data,
        rx_drops = ((u64)desc->rx_drops_high << 32) | desc->rx_drops_low;
 
        u64_stats_update_begin(&adapter->syncp);
+       /* These stats are accumulated by the device, so the counters indicate
+        * all drops since last reset.
+        */
        adapter->dev_stats.rx_drops = rx_drops;
        u64_stats_update_end(&adapter->syncp);
 }