netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: net: add a core netdev->tx_dropped counter
@ 2014-03-27 15:45 Eric Dumazet
  2014-03-28 20:51 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2014-03-27 15:45 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

From: Eric Dumazet <edumazet@google.com>

Dropping packets in __dev_queue_xmit() when transmit queue
is stopped (NIC TX ring buffer full or BQL limit reached) currently
outputs a syslog message.

It would be better to get a precise count of such events available in
netdevice stats so that monitoring tools can have a clue.

This extends the work done in caf586e5f23ce
("net: add a core netdev->rx_dropped counter")

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
Google-Bug-Id: 11288639

 include/linux/netdevice.h |    7 ++++---
 net/core/dev.c            |    2 ++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 4b6d12c7b803..159c7e7945f8 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1311,9 +1311,10 @@ struct net_device {
 	int			iflink;
 
 	struct net_device_stats	stats;
-	atomic_long_t		rx_dropped; /* dropped packets by core network
-					     * Do not use this in drivers.
-					     */
+
+	/* dropped packets by core network, Do not use this in drivers */
+	atomic_long_t		rx_dropped;
+	atomic_long_t		tx_dropped;
 
 #ifdef CONFIG_WIRELESS_EXT
 	/* List of functions to handle Wireless Extensions (instead of ioctl).
diff --git a/net/core/dev.c b/net/core/dev.c
index 48dd323d5918..98ba581b89f0 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2880,6 +2880,7 @@ recursion_alert:
 	rc = -ENETDOWN;
 	rcu_read_unlock_bh();
 
+	atomic_long_inc(&dev->tx_dropped);
 	kfree_skb(skb);
 	return rc;
 out:
@@ -6238,6 +6239,7 @@ struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
 		netdev_stats_to_stats64(storage, &dev->stats);
 	}
 	storage->rx_dropped += atomic_long_read(&dev->rx_dropped);
+	storage->tx_dropped += atomic_long_read(&dev->tx_dropped);
 	return storage;
 }
 EXPORT_SYMBOL(dev_get_stats);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] net: net: add a core netdev->tx_dropped counter
  2014-03-27 15:45 [PATCH net-next] net: net: add a core netdev->tx_dropped counter Eric Dumazet
@ 2014-03-28 20:51 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-03-28 20:51 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 27 Mar 2014 08:45:56 -0700

> From: Eric Dumazet <edumazet@google.com>
> 
> Dropping packets in __dev_queue_xmit() when transmit queue
> is stopped (NIC TX ring buffer full or BQL limit reached) currently
> outputs a syslog message.
> 
> It would be better to get a precise count of such events available in
> netdevice stats so that monitoring tools can have a clue.
> 
> This extends the work done in caf586e5f23ce
> ("net: add a core netdev->rx_dropped counter")
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Applied, thanks Eric.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-03-28 20:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-27 15:45 [PATCH net-next] net: net: add a core netdev->tx_dropped counter Eric Dumazet
2014-03-28 20:51 ` David Miller

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).