From: Pavel Emelyanov <xemul@openvz.org>
To: David Miller <davem@davemloft.net>
Cc: Linux Netdev List <netdev@vger.kernel.org>
Subject: [PATCH 3/20] mib: add net to IP_INC_STATS
Date: Wed, 16 Jul 2008 12:10:59 +0400 [thread overview]
Message-ID: <487DAD13.1070501@openvz.org> (raw)
In-Reply-To: <487DABB6.5080905@openvz.org>
All the callers already have either the net itself, or the place
where to get it from.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
---
include/net/ip.h | 2 +-
net/ipv4/ip_forward.c | 2 +-
net/ipv4/ip_output.c | 30 +++++++++++++++---------------
net/ipv4/raw.c | 2 +-
4 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/include/net/ip.h b/include/net/ip.h
index 673ecdb..b9aaa32 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -157,7 +157,7 @@ struct ipv4_config
extern struct ipv4_config ipv4_config;
DECLARE_SNMP_STAT(struct ipstats_mib, ip_statistics);
-#define IP_INC_STATS(field) SNMP_INC_STATS(ip_statistics, field)
+#define IP_INC_STATS(net, field) do { (void)net; SNMP_INC_STATS(ip_statistics, field); } while (0)
#define IP_INC_STATS_BH(field) SNMP_INC_STATS_BH(ip_statistics, field)
#define IP_ADD_STATS_BH(field, val) SNMP_ADD_STATS_BH(ip_statistics, field, val)
DECLARE_SNMP_STAT(struct linux_mib, net_statistics);
diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c
index da14725..7f78a5a 100644
--- a/net/ipv4/ip_forward.c
+++ b/net/ipv4/ip_forward.c
@@ -88,7 +88,7 @@ int ip_forward(struct sk_buff *skb)
if (unlikely(skb->len > dst_mtu(&rt->u.dst) && !skb_is_gso(skb) &&
(ip_hdr(skb)->frag_off & htons(IP_DF))) && !skb->local_df) {
- IP_INC_STATS(IPSTATS_MIB_FRAGFAILS);
+ IP_INC_STATS(dev_net(rt->u.dst.dev), IPSTATS_MIB_FRAGFAILS);
icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
htonl(dst_mtu(&rt->u.dst)));
goto drop;
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index f003186..465544f 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -182,9 +182,9 @@ static inline int ip_finish_output2(struct sk_buff *skb)
unsigned int hh_len = LL_RESERVED_SPACE(dev);
if (rt->rt_type == RTN_MULTICAST)
- IP_INC_STATS(IPSTATS_MIB_OUTMCASTPKTS);
+ IP_INC_STATS(dev_net(dev), IPSTATS_MIB_OUTMCASTPKTS);
else if (rt->rt_type == RTN_BROADCAST)
- IP_INC_STATS(IPSTATS_MIB_OUTBCASTPKTS);
+ IP_INC_STATS(dev_net(dev), IPSTATS_MIB_OUTBCASTPKTS);
/* Be paranoid, rather than too clever. */
if (unlikely(skb_headroom(skb) < hh_len && dev->header_ops)) {
@@ -244,7 +244,7 @@ int ip_mc_output(struct sk_buff *skb)
/*
* If the indicated interface is up and running, send the packet.
*/
- IP_INC_STATS(IPSTATS_MIB_OUTREQUESTS);
+ IP_INC_STATS(dev_net(dev), IPSTATS_MIB_OUTREQUESTS);
skb->dev = dev;
skb->protocol = htons(ETH_P_IP);
@@ -298,7 +298,7 @@ int ip_output(struct sk_buff *skb)
{
struct net_device *dev = skb->dst->dev;
- IP_INC_STATS(IPSTATS_MIB_OUTREQUESTS);
+ IP_INC_STATS(dev_net(dev), IPSTATS_MIB_OUTREQUESTS);
skb->dev = dev;
skb->protocol = htons(ETH_P_IP);
@@ -389,7 +389,7 @@ packet_routed:
return ip_local_out(skb);
no_route:
- IP_INC_STATS(IPSTATS_MIB_OUTNOROUTES);
+ IP_INC_STATS(sock_net(sk), IPSTATS_MIB_OUTNOROUTES);
kfree_skb(skb);
return -EHOSTUNREACH;
}
@@ -451,7 +451,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
iph = ip_hdr(skb);
if (unlikely((iph->frag_off & htons(IP_DF)) && !skb->local_df)) {
- IP_INC_STATS(IPSTATS_MIB_FRAGFAILS);
+ IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGFAILS);
icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
htonl(ip_skb_dst_mtu(skb)));
kfree_skb(skb);
@@ -542,7 +542,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
err = output(skb);
if (!err)
- IP_INC_STATS(IPSTATS_MIB_FRAGCREATES);
+ IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGCREATES);
if (err || !frag)
break;
@@ -552,7 +552,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
}
if (err == 0) {
- IP_INC_STATS(IPSTATS_MIB_FRAGOKS);
+ IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGOKS);
return 0;
}
@@ -561,7 +561,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
kfree_skb(frag);
frag = skb;
}
- IP_INC_STATS(IPSTATS_MIB_FRAGFAILS);
+ IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGFAILS);
return err;
}
@@ -673,15 +673,15 @@ slow_path:
if (err)
goto fail;
- IP_INC_STATS(IPSTATS_MIB_FRAGCREATES);
+ IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGCREATES);
}
kfree_skb(skb);
- IP_INC_STATS(IPSTATS_MIB_FRAGOKS);
+ IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGOKS);
return err;
fail:
kfree_skb(skb);
- IP_INC_STATS(IPSTATS_MIB_FRAGFAILS);
+ IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGFAILS);
return err;
}
@@ -1047,7 +1047,7 @@ alloc_new_skb:
error:
inet->cork.length -= length;
- IP_INC_STATS(IPSTATS_MIB_OUTDISCARDS);
+ IP_INC_STATS(sock_net(sk), IPSTATS_MIB_OUTDISCARDS);
return err;
}
@@ -1189,7 +1189,7 @@ ssize_t ip_append_page(struct sock *sk, struct page *page,
error:
inet->cork.length -= size;
- IP_INC_STATS(IPSTATS_MIB_OUTDISCARDS);
+ IP_INC_STATS(sock_net(sk), IPSTATS_MIB_OUTDISCARDS);
return err;
}
@@ -1298,7 +1298,7 @@ out:
return err;
error:
- IP_INC_STATS(IPSTATS_MIB_OUTDISCARDS);
+ IP_INC_STATS(net, IPSTATS_MIB_OUTDISCARDS);
goto out;
}
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 7f39ea4..cd97574 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -385,7 +385,7 @@ error_fault:
err = -EFAULT;
kfree_skb(skb);
error:
- IP_INC_STATS(IPSTATS_MIB_OUTDISCARDS);
+ IP_INC_STATS(net, IPSTATS_MIB_OUTDISCARDS);
return err;
}
--
1.5.5.1
next prev parent reply other threads:[~2008-07-16 8:13 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-16 8:05 [PATCH 0/20] mib: add struct net to IP, TCP and NET macros Pavel Emelyanov
2008-07-16 8:08 ` [PATCH 1/20] ipv4: prepare net initialization for IP accounting Pavel Emelyanov
2008-07-16 8:09 ` [PATCH 2/20] mib: drop unused IP_INC_STATS_USER Pavel Emelyanov
2008-07-16 8:10 ` Pavel Emelyanov [this message]
2008-07-16 8:12 ` [PATCH 4/20] mib: add net to IP_INC_STATS_BH Pavel Emelyanov
2008-07-16 8:14 ` [PATCH 5/20] mib: add net to IP_ADD_STATS_BH Pavel Emelyanov
2008-07-16 8:16 ` [PATCH 6/20] inet: prepare struct net for TCP MIB accounting Pavel Emelyanov
2008-07-16 8:19 ` [PATCH 8/20] tcp: add net to tcp_mib_init Pavel Emelyanov
2008-07-16 8:21 ` [PATCH 9/20] mib: add net to TCP_INC_STATS Pavel Emelyanov
2008-07-16 8:22 ` [PATCH 10/20] mib: add net to TCP_INC_STATS_BH Pavel Emelyanov
2008-07-16 8:23 ` [PATCH 11/20] mib: add net to TCP_DEC_STATS Pavel Emelyanov
2008-07-16 8:24 ` [PATCH 12/20] mib: add net to TCP_ADD_STATS_USER Pavel Emelyanov
2008-07-16 8:27 ` [PATCH 13/20] sock: add net to prot->enter_memory_pressure callback Pavel Emelyanov
2008-07-16 8:29 ` [PATCH 14/20] inet: prepare net on the stack for NET accounting macros Pavel Emelyanov
2008-07-16 8:31 ` [PATCH 15/20] tcp: replace tcp_sock argument with sock in some places Pavel Emelyanov
2008-07-16 8:32 ` [PATCH 16/20] mib: add net to NET_INC_STATS Pavel Emelyanov
2008-07-16 8:33 ` [PATCH 17/20] mib: add net to NET_INC_STATS_BH Pavel Emelyanov
2008-07-16 8:34 ` [PATCH 18/20] mib: add net to NET_INC_STATS_USER Pavel Emelyanov
2008-07-16 8:37 ` [PATCH 19/20] mib: add net to NET_ADD_STATS_BH Pavel Emelyanov
2008-07-16 8:38 ` [PATCH 20/20] mib: add net to NET_ADD_STATS_USER Pavel Emelyanov
[not found] ` <487DAE95.4090608@openvz.org>
2008-07-16 8:43 ` [PATCH (resend) 7/20] mib: drop unused TCP MIB accounting macros Pavel Emelyanov
2008-07-17 3:38 ` [PATCH 0/20] mib: add struct net to IP, TCP and NET macros David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=487DAD13.1070501@openvz.org \
--to=xemul@openvz.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).