aboutsummaryrefslogtreecommitdiffstats
path: root/net/8021q/vlan_dev.c
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2010-09-30 17:06:55 -0400
committerDavid S. Miller <davem@davemloft.net>2010-10-05 17:47:55 -0400
commitcaf586e5f23cebb2a68cbaf288d59dbbf2d74052 (patch)
tree5c0dfcf5a14c55501f9225835c83abddb8d1876e /net/8021q/vlan_dev.c
parenta00eac0c459abecb539fb2a2abd3122dd7ca5d4a (diff)
net: add a core netdev->rx_dropped counter
In various situations, a device provides a packet to our stack and we drop it before it enters protocol stack : - softnet backlog full (accounted in /proc/net/softnet_stat) - bad vlan tag (not accounted) - unknown/unregistered protocol (not accounted) We can handle a per-device counter of such dropped frames at core level, and automatically adds it to the device provided stats (rx_dropped), so that standard tools can be used (ifconfig, ip link, cat /proc/net/dev) This is a generalization of commit 8990f468a (net: rx_dropped accounting), thus reverting it. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/8021q/vlan_dev.c')
-rw-r--r--net/8021q/vlan_dev.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index f6fbcc0f1af9..f54251edd40d 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -225,16 +225,15 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
225 } 225 }
226 } 226 }
227 227
228 if (unlikely(netif_rx(skb) == NET_RX_DROP)) { 228 netif_rx(skb);
229 if (rx_stats) 229
230 rx_stats->rx_dropped++;
231 }
232 rcu_read_unlock(); 230 rcu_read_unlock();
233 return NET_RX_SUCCESS; 231 return NET_RX_SUCCESS;
234 232
235err_unlock: 233err_unlock:
236 rcu_read_unlock(); 234 rcu_read_unlock();
237err_free: 235err_free:
236 atomic_long_inc(&dev->rx_dropped);
238 kfree_skb(skb); 237 kfree_skb(skb);
239 return NET_RX_DROP; 238 return NET_RX_DROP;
240} 239}
@@ -846,15 +845,13 @@ static struct rtnl_link_stats64 *vlan_dev_get_stats64(struct net_device *dev, st
846 accum.rx_packets += rxpackets; 845 accum.rx_packets += rxpackets;
847 accum.rx_bytes += rxbytes; 846 accum.rx_bytes += rxbytes;
848 accum.rx_multicast += rxmulticast; 847 accum.rx_multicast += rxmulticast;
849 /* rx_errors, rx_dropped are ulong, not protected by syncp */ 848 /* rx_errors is ulong, not protected by syncp */
850 accum.rx_errors += p->rx_errors; 849 accum.rx_errors += p->rx_errors;
851 accum.rx_dropped += p->rx_dropped;
852 } 850 }
853 stats->rx_packets = accum.rx_packets; 851 stats->rx_packets = accum.rx_packets;
854 stats->rx_bytes = accum.rx_bytes; 852 stats->rx_bytes = accum.rx_bytes;
855 stats->rx_errors = accum.rx_errors; 853 stats->rx_errors = accum.rx_errors;
856 stats->multicast = accum.rx_multicast; 854 stats->multicast = accum.rx_multicast;
857 stats->rx_dropped = accum.rx_dropped;
858 } 855 }
859 return stats; 856 return stats;
860} 857}