aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2014-03-27 11:45:56 -0400
committerDavid S. Miller <davem@davemloft.net>2014-03-28 16:49:48 -0400
commit015f0688f57ca4d499047d335b8052a733e17a4d (patch)
treeab376c7815815728d7f595e4a1b37ee303bfefc4
parent43279500decad66ccdddacae7948a1d23be1bef6 (diff)
net: net: add a core netdev->tx_dropped counter
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> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/linux/netdevice.h7
-rw-r--r--net/core/dev.c2
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 {
1311 int iflink; 1311 int iflink;
1312 1312
1313 struct net_device_stats stats; 1313 struct net_device_stats stats;
1314 atomic_long_t rx_dropped; /* dropped packets by core network 1314
1315 * Do not use this in drivers. 1315 /* dropped packets by core network, Do not use this in drivers */
1316 */ 1316 atomic_long_t rx_dropped;
1317 atomic_long_t tx_dropped;
1317 1318
1318#ifdef CONFIG_WIRELESS_EXT 1319#ifdef CONFIG_WIRELESS_EXT
1319 /* List of functions to handle Wireless Extensions (instead of ioctl). 1320 /* 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:
2880 rc = -ENETDOWN; 2880 rc = -ENETDOWN;
2881 rcu_read_unlock_bh(); 2881 rcu_read_unlock_bh();
2882 2882
2883 atomic_long_inc(&dev->tx_dropped);
2883 kfree_skb(skb); 2884 kfree_skb(skb);
2884 return rc; 2885 return rc;
2885out: 2886out:
@@ -6238,6 +6239,7 @@ struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
6238 netdev_stats_to_stats64(storage, &dev->stats); 6239 netdev_stats_to_stats64(storage, &dev->stats);
6239 } 6240 }
6240 storage->rx_dropped += atomic_long_read(&dev->rx_dropped); 6241 storage->rx_dropped += atomic_long_read(&dev->rx_dropped);
6242 storage->tx_dropped += atomic_long_read(&dev->tx_dropped);
6241 return storage; 6243 return storage;
6242} 6244}
6243EXPORT_SYMBOL(dev_get_stats); 6245EXPORT_SYMBOL(dev_get_stats);