From 12a90c6b71384e2b4cded43b8e4e4e6e687c716b Mon Sep 17 00:00:00 2001 From: Joachim Foerster Date: Fri, 14 Oct 2022 15:36:36 +0200 Subject: [PATCH] modules/mqnic: Export existing dropped_packets counter per TX ring to netdev statistics Signed-off-by: Joachim Foerster --- modules/mqnic/mqnic_netdev.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/mqnic/mqnic_netdev.c b/modules/mqnic/mqnic_netdev.c index 0bea67b69..3d6cccbbd 100644 --- a/modules/mqnic/mqnic_netdev.c +++ b/modules/mqnic/mqnic_netdev.c @@ -230,6 +230,7 @@ void mqnic_update_stats(struct net_device *ndev) { struct mqnic_priv *priv = netdev_priv(ndev); unsigned long packets, bytes; + unsigned long dropped; int k; if (unlikely(!priv->port_up)) @@ -237,25 +238,31 @@ void mqnic_update_stats(struct net_device *ndev) packets = 0; bytes = 0; + dropped = 0; for (k = 0; k < priv->rx_queue_count; k++) { const struct mqnic_ring *ring = priv->rx_ring[k]; packets += READ_ONCE(ring->packets); bytes += READ_ONCE(ring->bytes); + dropped += READ_ONCE(ring->dropped_packets); } ndev->stats.rx_packets = packets; ndev->stats.rx_bytes = bytes; + ndev->stats.rx_dropped = dropped; packets = 0; bytes = 0; + dropped = 0; for (k = 0; k < priv->tx_queue_count; k++) { const struct mqnic_ring *ring = priv->tx_ring[k]; packets += READ_ONCE(ring->packets); bytes += READ_ONCE(ring->bytes); + dropped += READ_ONCE(ring->dropped_packets); } ndev->stats.tx_packets = packets; ndev->stats.tx_bytes = bytes; + ndev->stats.tx_dropped = dropped; } static void mqnic_get_stats64(struct net_device *ndev,