From 1e34debd128e09f22ffc00b4cb7cc5f1de52e2ff Mon Sep 17 00:00:00 2001 From: Torsten Schmidt Date: Tue, 5 Jan 2010 09:34:02 +0100 Subject: [PATCH 1/3] ipv4: prepare DSCP statistic for IN/OUT counters some renames and cleanups. Signed-off-by: Torsten Schmidt --- include/net/ipdscp.h | 52 +++++++++++++++++++++------------------------- include/net/netns/mib.h | 2 +- net/ipv4/ip_input.c | 2 +- net/ipv4/ipdscp.c | 8 +++--- 4 files changed, 30 insertions(+), 34 deletions(-) diff --git a/include/net/ipdscp.h b/include/net/ipdscp.h index 14cc8a6..4236704 100644 --- a/include/net/ipdscp.h +++ b/include/net/ipdscp.h @@ -39,13 +39,9 @@ #define IP_DSCP_EF (0x2E) #ifdef CONFIG_IP_DSCP_STAT -#define IP_DSCP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.ipdscp_statistics, field) -#define IP_DSCP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.ipdscp_statistics, field) -#define IP_DSCP_INC_STATS_USER(net, field) SNMP_INC_STATS_USER((net)-mib.ipdscp_statistics, field) +#define IP_DSCPIN_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.ipdscp_in_statistics, field) #else -#define IP_DSCP_INC_STATS(net, field) ((void)(net)) -#define IP_DSCP_INC_STATS_BH(net, field) ((void)(net)) -#define IP_DSCP_INC_STATS_USER(net, field) ((void)(net)) +#define IP_DSCPIN_INC_STATS_BH(net, field) ((void)(net)) #endif @@ -53,30 +49,30 @@ int __net_init ipdscp_stat_init(struct net *net); void ipdscp_stat_fini(struct net *net); -static inline void ipv4_dscp_stat(struct net *net, __u8 dsfield) +static inline void ipv4_dscp_stat_in(struct net *net, __u8 dsfield) { switch (dsfield >> 2) { - case IP_DSCP_CS0: IP_DSCP_INC_STATS_BH(net, LINUX_MIB_IPDSCP_CS0);break; - case IP_DSCP_EF: IP_DSCP_INC_STATS_BH(net, LINUX_MIB_IPDSCP_EF);break; - case IP_DSCP_CS1: IP_DSCP_INC_STATS_BH(net, LINUX_MIB_IPDSCP_CS1);break; - case IP_DSCP_CS2: IP_DSCP_INC_STATS_BH(net, LINUX_MIB_IPDSCP_CS2);break; - case IP_DSCP_CS3: IP_DSCP_INC_STATS_BH(net, LINUX_MIB_IPDSCP_CS3);break; - case IP_DSCP_CS4: IP_DSCP_INC_STATS_BH(net, LINUX_MIB_IPDSCP_CS4);break; - case IP_DSCP_CS5: IP_DSCP_INC_STATS_BH(net, LINUX_MIB_IPDSCP_CS5);break; - case IP_DSCP_CS6: IP_DSCP_INC_STATS_BH(net, LINUX_MIB_IPDSCP_CS6);break; - case IP_DSCP_CS7: IP_DSCP_INC_STATS_BH(net, LINUX_MIB_IPDSCP_CS7);break; - case IP_DSCP_AF11: IP_DSCP_INC_STATS_BH(net, LINUX_MIB_IPDSCP_AF11);break; - case IP_DSCP_AF12: IP_DSCP_INC_STATS_BH(net, LINUX_MIB_IPDSCP_AF12);break; - case IP_DSCP_AF13: IP_DSCP_INC_STATS_BH(net, LINUX_MIB_IPDSCP_AF13);break; - case IP_DSCP_AF21: IP_DSCP_INC_STATS_BH(net, LINUX_MIB_IPDSCP_AF21);break; - case IP_DSCP_AF22: IP_DSCP_INC_STATS_BH(net, LINUX_MIB_IPDSCP_AF22);break; - case IP_DSCP_AF23: IP_DSCP_INC_STATS_BH(net, LINUX_MIB_IPDSCP_AF23);break; - case IP_DSCP_AF31: IP_DSCP_INC_STATS_BH(net, LINUX_MIB_IPDSCP_AF31);break; - case IP_DSCP_AF32: IP_DSCP_INC_STATS_BH(net, LINUX_MIB_IPDSCP_AF32);break; - case IP_DSCP_AF33: IP_DSCP_INC_STATS_BH(net, LINUX_MIB_IPDSCP_AF33);break; - case IP_DSCP_AF41: IP_DSCP_INC_STATS_BH(net, LINUX_MIB_IPDSCP_AF41);break; - case IP_DSCP_AF42: IP_DSCP_INC_STATS_BH(net, LINUX_MIB_IPDSCP_AF42);break; - case IP_DSCP_AF43: IP_DSCP_INC_STATS_BH(net, LINUX_MIB_IPDSCP_AF43);break; + case IP_DSCP_CS0: IP_DSCPIN_INC_STATS_BH(net, LINUX_MIB_IPDSCP_CS0);break; + case IP_DSCP_EF: IP_DSCPIN_INC_STATS_BH(net, LINUX_MIB_IPDSCP_EF);break; + case IP_DSCP_CS1: IP_DSCPIN_INC_STATS_BH(net, LINUX_MIB_IPDSCP_CS1);break; + case IP_DSCP_CS2: IP_DSCPIN_INC_STATS_BH(net, LINUX_MIB_IPDSCP_CS2);break; + case IP_DSCP_CS3: IP_DSCPIN_INC_STATS_BH(net, LINUX_MIB_IPDSCP_CS3);break; + case IP_DSCP_CS4: IP_DSCPIN_INC_STATS_BH(net, LINUX_MIB_IPDSCP_CS4);break; + case IP_DSCP_CS5: IP_DSCPIN_INC_STATS_BH(net, LINUX_MIB_IPDSCP_CS5);break; + case IP_DSCP_CS6: IP_DSCPIN_INC_STATS_BH(net, LINUX_MIB_IPDSCP_CS6);break; + case IP_DSCP_CS7: IP_DSCPIN_INC_STATS_BH(net, LINUX_MIB_IPDSCP_CS7);break; + case IP_DSCP_AF11: IP_DSCPIN_INC_STATS_BH(net, LINUX_MIB_IPDSCP_AF11);break; + case IP_DSCP_AF12: IP_DSCPIN_INC_STATS_BH(net, LINUX_MIB_IPDSCP_AF12);break; + case IP_DSCP_AF13: IP_DSCPIN_INC_STATS_BH(net, LINUX_MIB_IPDSCP_AF13);break; + case IP_DSCP_AF21: IP_DSCPIN_INC_STATS_BH(net, LINUX_MIB_IPDSCP_AF21);break; + case IP_DSCP_AF22: IP_DSCPIN_INC_STATS_BH(net, LINUX_MIB_IPDSCP_AF22);break; + case IP_DSCP_AF23: IP_DSCPIN_INC_STATS_BH(net, LINUX_MIB_IPDSCP_AF23);break; + case IP_DSCP_AF31: IP_DSCPIN_INC_STATS_BH(net, LINUX_MIB_IPDSCP_AF31);break; + case IP_DSCP_AF32: IP_DSCPIN_INC_STATS_BH(net, LINUX_MIB_IPDSCP_AF32);break; + case IP_DSCP_AF33: IP_DSCPIN_INC_STATS_BH(net, LINUX_MIB_IPDSCP_AF33);break; + case IP_DSCP_AF41: IP_DSCPIN_INC_STATS_BH(net, LINUX_MIB_IPDSCP_AF41);break; + case IP_DSCP_AF42: IP_DSCPIN_INC_STATS_BH(net, LINUX_MIB_IPDSCP_AF42);break; + case IP_DSCP_AF43: IP_DSCPIN_INC_STATS_BH(net, LINUX_MIB_IPDSCP_AF43);break; } } diff --git a/include/net/netns/mib.h b/include/net/netns/mib.h index eccbc36..a849e89 100644 --- a/include/net/netns/mib.h +++ b/include/net/netns/mib.h @@ -25,7 +25,7 @@ struct netns_mib { #endif #ifdef CONFIG_IP_DSCP_STAT struct proc_dir_entry *proc_net_ipdscp; - DEFINE_SNMP_STAT(struct ipdscp_mib, ipdscp_statistics); + DEFINE_SNMP_STAT(struct ipdscp_mib, ipdscp_in_statistics); #endif }; diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c index ba23624..ba8cd2c 100644 --- a/net/ipv4/ip_input.c +++ b/net/ipv4/ip_input.c @@ -367,7 +367,7 @@ static int ip_rcv_finish(struct sk_buff *skb) skb->len); #ifdef CONFIG_IP_DSCP_STAT - ipv4_dscp_stat(dev_net(rt->u.dst.dev), iph->tos); + ipv4_dscp_stat_in(dev_net(rt->u.dst.dev), iph->tos); #endif return dst_input(skb); diff --git a/net/ipv4/ipdscp.c b/net/ipv4/ipdscp.c index 90f9fd1..fdbfb7b 100644 --- a/net/ipv4/ipdscp.c +++ b/net/ipv4/ipdscp.c @@ -47,7 +47,7 @@ static int ipdscp_statistics_seq_show(struct seq_file *seq, void *v) int i; for (i=0; ipdscp_mib_list[i].name; i++) seq_printf(seq, "%-24s\t%lu\n", ipdscp_mib_list[i].name, - snmp_fold_field((void **)net->mib.ipdscp_statistics, + snmp_fold_field((void **)net->mib.ipdscp_in_statistics, ipdscp_mib_list[i].entry)); return 0; } @@ -87,19 +87,19 @@ int __net_init ipdscp_stat_init(struct net *net) { int rv; - if (snmp_mib_init((void **)net->mib.ipdscp_statistics, + if (snmp_mib_init((void **)net->mib.ipdscp_in_statistics, sizeof(struct ipdscp_mib)) < 0) return -ENOMEM; rv = ipdscp_proc_init(net); if (rv < 0) - snmp_mib_free((void **)net->mib.ipdscp_statistics); + snmp_mib_free((void **)net->mib.ipdscp_in_statistics); return rv; } void ipdscp_stat_fini(struct net *net) { ipdscp_proc_fini(net); - snmp_mib_free((void **)net->mib.ipdscp_statistics); + snmp_mib_free((void **)net->mib.ipdscp_in_statistics); } -- 1.6.3.3