diff options
author | Eric Dumazet <edumazet@google.com> | 2012-06-28 20:15:13 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-06-29 00:52:32 -0700 |
commit | b8c8430726e5bd552e01dacc5a44f3f83f7446ca (patch) | |
tree | e966e64a7bb8a2451048b7e73c0c4aa9a8db40a3 /net/l2tp/l2tp_eth.c | |
parent | a777c892cea917b6c67c61f8dff47d8caae7b8a1 (diff) | |
download | linux-b8c8430726e5bd552e01dacc5a44f3f83f7446ca.tar.gz linux-b8c8430726e5bd552e01dacc5a44f3f83f7446ca.tar.bz2 linux-b8c8430726e5bd552e01dacc5a44f3f83f7446ca.zip |
net: l2tp_eth: provide tx_dropped counter
Change l2tp_xmit_skb() to return NET_XMIT_DROP in case skb is dropped.
Use kfree_skb() instead dev_kfree_skb() for drop_monitor pleasure.
Support tx_dropped counter for l2tp_eth
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: James Chapman <jchapman@katalix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/l2tp/l2tp_eth.c')
-rw-r--r-- | net/l2tp/l2tp_eth.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/net/l2tp/l2tp_eth.c b/net/l2tp/l2tp_eth.c index 47b259fccd27..f9ee74deeac2 100644 --- a/net/l2tp/l2tp_eth.c +++ b/net/l2tp/l2tp_eth.c @@ -44,6 +44,7 @@ struct l2tp_eth { struct list_head list; atomic_long_t tx_bytes; atomic_long_t tx_packets; + atomic_long_t tx_dropped; atomic_long_t rx_bytes; atomic_long_t rx_packets; atomic_long_t rx_errors; @@ -92,12 +93,15 @@ static int l2tp_eth_dev_xmit(struct sk_buff *skb, struct net_device *dev) { struct l2tp_eth *priv = netdev_priv(dev); struct l2tp_session *session = priv->session; + unsigned int len = skb->len; + int ret = l2tp_xmit_skb(session, skb, session->hdr_len); - atomic_long_add(skb->len, &priv->tx_bytes); - atomic_long_inc(&priv->tx_packets); - - l2tp_xmit_skb(session, skb, session->hdr_len); - + if (likely(ret == NET_XMIT_SUCCESS)) { + atomic_long_add(len, &priv->tx_bytes); + atomic_long_inc(&priv->tx_packets); + } else { + atomic_long_inc(&priv->tx_dropped); + } return NETDEV_TX_OK; } @@ -108,6 +112,7 @@ static struct rtnl_link_stats64 *l2tp_eth_get_stats64(struct net_device *dev, stats->tx_bytes = atomic_long_read(&priv->tx_bytes); stats->tx_packets = atomic_long_read(&priv->tx_packets); + stats->tx_dropped = atomic_long_read(&priv->tx_dropped); stats->rx_bytes = atomic_long_read(&priv->rx_bytes); stats->rx_packets = atomic_long_read(&priv->rx_packets); stats->rx_errors = atomic_long_read(&priv->rx_errors); |