diff options
Diffstat (limited to 'net/ipv6/proc.c')
-rw-r--r-- | net/ipv6/proc.c | 44 |
1 files changed, 30 insertions, 14 deletions
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c index d082eaeefa25..18ff5df7ec02 100644 --- a/net/ipv6/proc.c +++ b/net/ipv6/proc.c | |||
@@ -126,6 +126,8 @@ static const struct snmp_mib snmp6_udp6_list[] = { | |||
126 | SNMP_MIB_ITEM("Udp6NoPorts", UDP_MIB_NOPORTS), | 126 | SNMP_MIB_ITEM("Udp6NoPorts", UDP_MIB_NOPORTS), |
127 | SNMP_MIB_ITEM("Udp6InErrors", UDP_MIB_INERRORS), | 127 | SNMP_MIB_ITEM("Udp6InErrors", UDP_MIB_INERRORS), |
128 | SNMP_MIB_ITEM("Udp6OutDatagrams", UDP_MIB_OUTDATAGRAMS), | 128 | SNMP_MIB_ITEM("Udp6OutDatagrams", UDP_MIB_OUTDATAGRAMS), |
129 | SNMP_MIB_ITEM("Udp6RcvbufErrors", UDP_MIB_RCVBUFERRORS), | ||
130 | SNMP_MIB_ITEM("Udp6SndbufErrors", UDP_MIB_SNDBUFERRORS), | ||
129 | SNMP_MIB_SENTINEL | 131 | SNMP_MIB_SENTINEL |
130 | }; | 132 | }; |
131 | 133 | ||
@@ -134,10 +136,16 @@ static const struct snmp_mib snmp6_udplite6_list[] = { | |||
134 | SNMP_MIB_ITEM("UdpLite6NoPorts", UDP_MIB_NOPORTS), | 136 | SNMP_MIB_ITEM("UdpLite6NoPorts", UDP_MIB_NOPORTS), |
135 | SNMP_MIB_ITEM("UdpLite6InErrors", UDP_MIB_INERRORS), | 137 | SNMP_MIB_ITEM("UdpLite6InErrors", UDP_MIB_INERRORS), |
136 | SNMP_MIB_ITEM("UdpLite6OutDatagrams", UDP_MIB_OUTDATAGRAMS), | 138 | SNMP_MIB_ITEM("UdpLite6OutDatagrams", UDP_MIB_OUTDATAGRAMS), |
139 | SNMP_MIB_ITEM("UdpLite6RcvbufErrors", UDP_MIB_RCVBUFERRORS), | ||
140 | SNMP_MIB_ITEM("UdpLite6SndbufErrors", UDP_MIB_SNDBUFERRORS), | ||
137 | SNMP_MIB_SENTINEL | 141 | SNMP_MIB_SENTINEL |
138 | }; | 142 | }; |
139 | 143 | ||
140 | static void snmp6_seq_show_icmpv6msg(struct seq_file *seq, void __percpu **mib) | 144 | /* can be called either with percpu mib (pcpumib != NULL), |
145 | * or shared one (smib != NULL) | ||
146 | */ | ||
147 | static void snmp6_seq_show_icmpv6msg(struct seq_file *seq, void __percpu **pcpumib, | ||
148 | atomic_long_t *smib) | ||
141 | { | 149 | { |
142 | char name[32]; | 150 | char name[32]; |
143 | int i; | 151 | int i; |
@@ -154,14 +162,14 @@ static void snmp6_seq_show_icmpv6msg(struct seq_file *seq, void __percpu **mib) | |||
154 | snprintf(name, sizeof(name), "Icmp6%s%s", | 162 | snprintf(name, sizeof(name), "Icmp6%s%s", |
155 | i & 0x100 ? "Out" : "In", p); | 163 | i & 0x100 ? "Out" : "In", p); |
156 | seq_printf(seq, "%-32s\t%lu\n", name, | 164 | seq_printf(seq, "%-32s\t%lu\n", name, |
157 | snmp_fold_field(mib, i)); | 165 | pcpumib ? snmp_fold_field(pcpumib, i) : atomic_long_read(smib + i)); |
158 | } | 166 | } |
159 | 167 | ||
160 | /* print by number (nonzero only) - ICMPMsgStat format */ | 168 | /* print by number (nonzero only) - ICMPMsgStat format */ |
161 | for (i = 0; i < ICMP6MSG_MIB_MAX; i++) { | 169 | for (i = 0; i < ICMP6MSG_MIB_MAX; i++) { |
162 | unsigned long val; | 170 | unsigned long val; |
163 | 171 | ||
164 | val = snmp_fold_field(mib, i); | 172 | val = pcpumib ? snmp_fold_field(pcpumib, i) : atomic_long_read(smib + i); |
165 | if (!val) | 173 | if (!val) |
166 | continue; | 174 | continue; |
167 | snprintf(name, sizeof(name), "Icmp6%sType%u", | 175 | snprintf(name, sizeof(name), "Icmp6%sType%u", |
@@ -170,14 +178,22 @@ static void snmp6_seq_show_icmpv6msg(struct seq_file *seq, void __percpu **mib) | |||
170 | } | 178 | } |
171 | } | 179 | } |
172 | 180 | ||
173 | static void snmp6_seq_show_item(struct seq_file *seq, void __percpu **mib, | 181 | /* can be called either with percpu mib (pcpumib != NULL), |
182 | * or shared one (smib != NULL) | ||
183 | */ | ||
184 | static void snmp6_seq_show_item(struct seq_file *seq, void __percpu **pcpumib, | ||
185 | atomic_long_t *smib, | ||
174 | const struct snmp_mib *itemlist) | 186 | const struct snmp_mib *itemlist) |
175 | { | 187 | { |
176 | int i; | 188 | int i; |
189 | unsigned long val; | ||
177 | 190 | ||
178 | for (i = 0; itemlist[i].name; i++) | 191 | for (i = 0; itemlist[i].name; i++) { |
179 | seq_printf(seq, "%-32s\t%lu\n", itemlist[i].name, | 192 | val = pcpumib ? |
180 | snmp_fold_field(mib, itemlist[i].entry)); | 193 | snmp_fold_field(pcpumib, itemlist[i].entry) : |
194 | atomic_long_read(smib + itemlist[i].entry); | ||
195 | seq_printf(seq, "%-32s\t%lu\n", itemlist[i].name, val); | ||
196 | } | ||
181 | } | 197 | } |
182 | 198 | ||
183 | static void snmp6_seq_show_item64(struct seq_file *seq, void __percpu **mib, | 199 | static void snmp6_seq_show_item64(struct seq_file *seq, void __percpu **mib, |
@@ -197,13 +213,13 @@ static int snmp6_seq_show(struct seq_file *seq, void *v) | |||
197 | snmp6_seq_show_item64(seq, (void __percpu **)net->mib.ipv6_statistics, | 213 | snmp6_seq_show_item64(seq, (void __percpu **)net->mib.ipv6_statistics, |
198 | snmp6_ipstats_list, offsetof(struct ipstats_mib, syncp)); | 214 | snmp6_ipstats_list, offsetof(struct ipstats_mib, syncp)); |
199 | snmp6_seq_show_item(seq, (void __percpu **)net->mib.icmpv6_statistics, | 215 | snmp6_seq_show_item(seq, (void __percpu **)net->mib.icmpv6_statistics, |
200 | snmp6_icmp6_list); | 216 | NULL, snmp6_icmp6_list); |
201 | snmp6_seq_show_icmpv6msg(seq, | 217 | snmp6_seq_show_icmpv6msg(seq, |
202 | (void __percpu **)net->mib.icmpv6msg_statistics); | 218 | (void __percpu **)net->mib.icmpv6msg_statistics, NULL); |
203 | snmp6_seq_show_item(seq, (void __percpu **)net->mib.udp_stats_in6, | 219 | snmp6_seq_show_item(seq, (void __percpu **)net->mib.udp_stats_in6, |
204 | snmp6_udp6_list); | 220 | NULL, snmp6_udp6_list); |
205 | snmp6_seq_show_item(seq, (void __percpu **)net->mib.udplite_stats_in6, | 221 | snmp6_seq_show_item(seq, (void __percpu **)net->mib.udplite_stats_in6, |
206 | snmp6_udplite6_list); | 222 | NULL, snmp6_udplite6_list); |
207 | return 0; | 223 | return 0; |
208 | } | 224 | } |
209 | 225 | ||
@@ -225,11 +241,11 @@ static int snmp6_dev_seq_show(struct seq_file *seq, void *v) | |||
225 | struct inet6_dev *idev = (struct inet6_dev *)seq->private; | 241 | struct inet6_dev *idev = (struct inet6_dev *)seq->private; |
226 | 242 | ||
227 | seq_printf(seq, "%-32s\t%u\n", "ifIndex", idev->dev->ifindex); | 243 | seq_printf(seq, "%-32s\t%u\n", "ifIndex", idev->dev->ifindex); |
228 | snmp6_seq_show_item(seq, (void __percpu **)idev->stats.ipv6, | 244 | snmp6_seq_show_item(seq, (void __percpu **)idev->stats.ipv6, NULL, |
229 | snmp6_ipstats_list); | 245 | snmp6_ipstats_list); |
230 | snmp6_seq_show_item(seq, (void __percpu **)idev->stats.icmpv6, | 246 | snmp6_seq_show_item(seq, NULL, idev->stats.icmpv6dev->mibs, |
231 | snmp6_icmp6_list); | 247 | snmp6_icmp6_list); |
232 | snmp6_seq_show_icmpv6msg(seq, (void __percpu **)idev->stats.icmpv6msg); | 248 | snmp6_seq_show_icmpv6msg(seq, NULL, idev->stats.icmpv6msgdev->mibs); |
233 | return 0; | 249 | return 0; |
234 | } | 250 | } |
235 | 251 | ||