diff options
Diffstat (limited to 'net/ipv6/proc.c')
-rw-r--r-- | net/ipv6/proc.c | 61 |
1 files changed, 2 insertions, 59 deletions
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c index fa3fb509f187..acb306a5dd56 100644 --- a/net/ipv6/proc.c +++ b/net/ipv6/proc.c | |||
@@ -23,12 +23,12 @@ | |||
23 | #include <linux/proc_fs.h> | 23 | #include <linux/proc_fs.h> |
24 | #include <linux/seq_file.h> | 24 | #include <linux/seq_file.h> |
25 | #include <linux/stddef.h> | 25 | #include <linux/stddef.h> |
26 | #include <net/ip.h> | ||
26 | #include <net/sock.h> | 27 | #include <net/sock.h> |
27 | #include <net/tcp.h> | 28 | #include <net/tcp.h> |
28 | #include <net/transp_v6.h> | 29 | #include <net/transp_v6.h> |
29 | #include <net/ipv6.h> | 30 | #include <net/ipv6.h> |
30 | 31 | ||
31 | #ifdef CONFIG_PROC_FS | ||
32 | static struct proc_dir_entry *proc_net_devsnmp6; | 32 | static struct proc_dir_entry *proc_net_devsnmp6; |
33 | 33 | ||
34 | static int fold_prot_inuse(struct proto *proto) | 34 | static int fold_prot_inuse(struct proto *proto) |
@@ -142,26 +142,13 @@ static struct snmp_mib snmp6_udplite6_list[] = { | |||
142 | SNMP_MIB_SENTINEL | 142 | SNMP_MIB_SENTINEL |
143 | }; | 143 | }; |
144 | 144 | ||
145 | static unsigned long | ||
146 | fold_field(void *mib[], int offt) | ||
147 | { | ||
148 | unsigned long res = 0; | ||
149 | int i; | ||
150 | |||
151 | for_each_possible_cpu(i) { | ||
152 | res += *(((unsigned long *)per_cpu_ptr(mib[0], i)) + offt); | ||
153 | res += *(((unsigned long *)per_cpu_ptr(mib[1], i)) + offt); | ||
154 | } | ||
155 | return res; | ||
156 | } | ||
157 | |||
158 | static inline void | 145 | static inline void |
159 | snmp6_seq_show_item(struct seq_file *seq, void **mib, struct snmp_mib *itemlist) | 146 | snmp6_seq_show_item(struct seq_file *seq, void **mib, struct snmp_mib *itemlist) |
160 | { | 147 | { |
161 | int i; | 148 | int i; |
162 | for (i=0; itemlist[i].name; i++) | 149 | for (i=0; itemlist[i].name; i++) |
163 | seq_printf(seq, "%-32s\t%lu\n", itemlist[i].name, | 150 | seq_printf(seq, "%-32s\t%lu\n", itemlist[i].name, |
164 | fold_field(mib, itemlist[i].entry)); | 151 | snmp_fold_field(mib, itemlist[i].entry)); |
165 | } | 152 | } |
166 | 153 | ||
167 | static int snmp6_seq_show(struct seq_file *seq, void *v) | 154 | static int snmp6_seq_show(struct seq_file *seq, void *v) |
@@ -271,47 +258,3 @@ void ipv6_misc_proc_exit(void) | |||
271 | proc_net_remove("snmp6"); | 258 | proc_net_remove("snmp6"); |
272 | } | 259 | } |
273 | 260 | ||
274 | #else /* CONFIG_PROC_FS */ | ||
275 | |||
276 | |||
277 | int snmp6_register_dev(struct inet6_dev *idev) | ||
278 | { | ||
279 | return 0; | ||
280 | } | ||
281 | |||
282 | int snmp6_unregister_dev(struct inet6_dev *idev) | ||
283 | { | ||
284 | return 0; | ||
285 | } | ||
286 | #endif /* CONFIG_PROC_FS */ | ||
287 | |||
288 | int snmp6_alloc_dev(struct inet6_dev *idev) | ||
289 | { | ||
290 | int err = -ENOMEM; | ||
291 | |||
292 | if (!idev || !idev->dev) | ||
293 | return -EINVAL; | ||
294 | |||
295 | if (snmp6_mib_init((void **)idev->stats.ipv6, sizeof(struct ipstats_mib), | ||
296 | __alignof__(struct ipstats_mib)) < 0) | ||
297 | goto err_ip; | ||
298 | if (snmp6_mib_init((void **)idev->stats.icmpv6, sizeof(struct icmpv6_mib), | ||
299 | __alignof__(struct icmpv6_mib)) < 0) | ||
300 | goto err_icmp; | ||
301 | |||
302 | return 0; | ||
303 | |||
304 | err_icmp: | ||
305 | snmp6_mib_free((void **)idev->stats.ipv6); | ||
306 | err_ip: | ||
307 | return err; | ||
308 | } | ||
309 | |||
310 | int snmp6_free_dev(struct inet6_dev *idev) | ||
311 | { | ||
312 | snmp6_mib_free((void **)idev->stats.icmpv6); | ||
313 | snmp6_mib_free((void **)idev->stats.ipv6); | ||
314 | return 0; | ||
315 | } | ||
316 | |||
317 | |||