mib: add net to IP_INC_STATS
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> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
c6f8f7e3bb
commit
5e38e27044
4 changed files with 18 additions and 18 deletions
|
@ -157,7 +157,7 @@ struct ipv4_config
|
||||||
|
|
||||||
extern struct ipv4_config ipv4_config;
|
extern struct ipv4_config ipv4_config;
|
||||||
DECLARE_SNMP_STAT(struct ipstats_mib, ip_statistics);
|
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_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)
|
#define IP_ADD_STATS_BH(field, val) SNMP_ADD_STATS_BH(ip_statistics, field, val)
|
||||||
DECLARE_SNMP_STAT(struct linux_mib, net_statistics);
|
DECLARE_SNMP_STAT(struct linux_mib, net_statistics);
|
||||||
|
|
|
@ -88,7 +88,7 @@ int ip_forward(struct sk_buff *skb)
|
||||||
|
|
||||||
if (unlikely(skb->len > dst_mtu(&rt->u.dst) && !skb_is_gso(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_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,
|
icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
|
||||||
htonl(dst_mtu(&rt->u.dst)));
|
htonl(dst_mtu(&rt->u.dst)));
|
||||||
goto drop;
|
goto drop;
|
||||||
|
|
|
@ -182,9 +182,9 @@ static inline int ip_finish_output2(struct sk_buff *skb)
|
||||||
unsigned int hh_len = LL_RESERVED_SPACE(dev);
|
unsigned int hh_len = LL_RESERVED_SPACE(dev);
|
||||||
|
|
||||||
if (rt->rt_type == RTN_MULTICAST)
|
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)
|
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. */
|
/* Be paranoid, rather than too clever. */
|
||||||
if (unlikely(skb_headroom(skb) < hh_len && dev->header_ops)) {
|
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.
|
* 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->dev = dev;
|
||||||
skb->protocol = htons(ETH_P_IP);
|
skb->protocol = htons(ETH_P_IP);
|
||||||
|
@ -298,7 +298,7 @@ int ip_output(struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
struct net_device *dev = skb->dst->dev;
|
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->dev = dev;
|
||||||
skb->protocol = htons(ETH_P_IP);
|
skb->protocol = htons(ETH_P_IP);
|
||||||
|
@ -389,7 +389,7 @@ int ip_queue_xmit(struct sk_buff *skb, int ipfragok)
|
||||||
return ip_local_out(skb);
|
return ip_local_out(skb);
|
||||||
|
|
||||||
no_route:
|
no_route:
|
||||||
IP_INC_STATS(IPSTATS_MIB_OUTNOROUTES);
|
IP_INC_STATS(sock_net(sk), IPSTATS_MIB_OUTNOROUTES);
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
return -EHOSTUNREACH;
|
return -EHOSTUNREACH;
|
||||||
}
|
}
|
||||||
|
@ -451,7 +451,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
|
||||||
iph = ip_hdr(skb);
|
iph = ip_hdr(skb);
|
||||||
|
|
||||||
if (unlikely((iph->frag_off & htons(IP_DF)) && !skb->local_df)) {
|
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,
|
icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
|
||||||
htonl(ip_skb_dst_mtu(skb)));
|
htonl(ip_skb_dst_mtu(skb)));
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
|
@ -542,7 +542,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
|
||||||
err = output(skb);
|
err = output(skb);
|
||||||
|
|
||||||
if (!err)
|
if (!err)
|
||||||
IP_INC_STATS(IPSTATS_MIB_FRAGCREATES);
|
IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGCREATES);
|
||||||
if (err || !frag)
|
if (err || !frag)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -552,7 +552,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
IP_INC_STATS(IPSTATS_MIB_FRAGOKS);
|
IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGOKS);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -561,7 +561,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
|
||||||
kfree_skb(frag);
|
kfree_skb(frag);
|
||||||
frag = skb;
|
frag = skb;
|
||||||
}
|
}
|
||||||
IP_INC_STATS(IPSTATS_MIB_FRAGFAILS);
|
IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGFAILS);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -673,15 +673,15 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
|
||||||
if (err)
|
if (err)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
IP_INC_STATS(IPSTATS_MIB_FRAGCREATES);
|
IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGCREATES);
|
||||||
}
|
}
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
IP_INC_STATS(IPSTATS_MIB_FRAGOKS);
|
IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGOKS);
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
IP_INC_STATS(IPSTATS_MIB_FRAGFAILS);
|
IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGFAILS);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1047,7 +1047,7 @@ int ip_append_data(struct sock *sk,
|
||||||
|
|
||||||
error:
|
error:
|
||||||
inet->cork.length -= length;
|
inet->cork.length -= length;
|
||||||
IP_INC_STATS(IPSTATS_MIB_OUTDISCARDS);
|
IP_INC_STATS(sock_net(sk), IPSTATS_MIB_OUTDISCARDS);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1189,7 +1189,7 @@ ssize_t ip_append_page(struct sock *sk, struct page *page,
|
||||||
|
|
||||||
error:
|
error:
|
||||||
inet->cork.length -= size;
|
inet->cork.length -= size;
|
||||||
IP_INC_STATS(IPSTATS_MIB_OUTDISCARDS);
|
IP_INC_STATS(sock_net(sk), IPSTATS_MIB_OUTDISCARDS);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1298,7 +1298,7 @@ int ip_push_pending_frames(struct sock *sk)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
IP_INC_STATS(IPSTATS_MIB_OUTDISCARDS);
|
IP_INC_STATS(net, IPSTATS_MIB_OUTDISCARDS);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -385,7 +385,7 @@ static int raw_send_hdrinc(struct sock *sk, void *from, size_t length,
|
||||||
err = -EFAULT;
|
err = -EFAULT;
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
error:
|
error:
|
||||||
IP_INC_STATS(IPSTATS_MIB_OUTDISCARDS);
|
IP_INC_STATS(net, IPSTATS_MIB_OUTDISCARDS);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue