diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/snmp.h | 10 | ||||
-rw-r--r-- | include/net/ip.h | 3 | ||||
-rw-r--r-- | include/net/ipv6.h | 15 | ||||
-rw-r--r-- | include/net/snmp.h | 19 |
4 files changed, 43 insertions, 4 deletions
diff --git a/include/linux/snmp.h b/include/linux/snmp.h index aee3f1e1d1ce..0f953fe40413 100644 --- a/include/linux/snmp.h +++ b/include/linux/snmp.h | |||
@@ -18,7 +18,7 @@ | |||
18 | enum | 18 | enum |
19 | { | 19 | { |
20 | IPSTATS_MIB_NUM = 0, | 20 | IPSTATS_MIB_NUM = 0, |
21 | IPSTATS_MIB_INRECEIVES, /* InReceives */ | 21 | IPSTATS_MIB_INPKTS, /* InReceives */ |
22 | IPSTATS_MIB_INHDRERRORS, /* InHdrErrors */ | 22 | IPSTATS_MIB_INHDRERRORS, /* InHdrErrors */ |
23 | IPSTATS_MIB_INTOOBIGERRORS, /* InTooBigErrors */ | 23 | IPSTATS_MIB_INTOOBIGERRORS, /* InTooBigErrors */ |
24 | IPSTATS_MIB_INNOROUTES, /* InNoRoutes */ | 24 | IPSTATS_MIB_INNOROUTES, /* InNoRoutes */ |
@@ -28,7 +28,7 @@ enum | |||
28 | IPSTATS_MIB_INDISCARDS, /* InDiscards */ | 28 | IPSTATS_MIB_INDISCARDS, /* InDiscards */ |
29 | IPSTATS_MIB_INDELIVERS, /* InDelivers */ | 29 | IPSTATS_MIB_INDELIVERS, /* InDelivers */ |
30 | IPSTATS_MIB_OUTFORWDATAGRAMS, /* OutForwDatagrams */ | 30 | IPSTATS_MIB_OUTFORWDATAGRAMS, /* OutForwDatagrams */ |
31 | IPSTATS_MIB_OUTREQUESTS, /* OutRequests */ | 31 | IPSTATS_MIB_OUTPKTS, /* OutRequests */ |
32 | IPSTATS_MIB_OUTDISCARDS, /* OutDiscards */ | 32 | IPSTATS_MIB_OUTDISCARDS, /* OutDiscards */ |
33 | IPSTATS_MIB_OUTNOROUTES, /* OutNoRoutes */ | 33 | IPSTATS_MIB_OUTNOROUTES, /* OutNoRoutes */ |
34 | IPSTATS_MIB_REASMTIMEOUT, /* ReasmTimeout */ | 34 | IPSTATS_MIB_REASMTIMEOUT, /* ReasmTimeout */ |
@@ -42,6 +42,12 @@ enum | |||
42 | IPSTATS_MIB_OUTMCASTPKTS, /* OutMcastPkts */ | 42 | IPSTATS_MIB_OUTMCASTPKTS, /* OutMcastPkts */ |
43 | IPSTATS_MIB_INBCASTPKTS, /* InBcastPkts */ | 43 | IPSTATS_MIB_INBCASTPKTS, /* InBcastPkts */ |
44 | IPSTATS_MIB_OUTBCASTPKTS, /* OutBcastPkts */ | 44 | IPSTATS_MIB_OUTBCASTPKTS, /* OutBcastPkts */ |
45 | IPSTATS_MIB_INOCTETS, /* InOctets */ | ||
46 | IPSTATS_MIB_OUTOCTETS, /* OutOctets */ | ||
47 | IPSTATS_MIB_INMCASTOCTETS, /* InMcastOctets */ | ||
48 | IPSTATS_MIB_OUTMCASTOCTETS, /* OutMcastOctets */ | ||
49 | IPSTATS_MIB_INBCASTOCTETS, /* InBcastOctets */ | ||
50 | IPSTATS_MIB_OUTBCASTOCTETS, /* OutBcastOctets */ | ||
45 | __IPSTATS_MIB_MAX | 51 | __IPSTATS_MIB_MAX |
46 | }; | 52 | }; |
47 | 53 | ||
diff --git a/include/net/ip.h b/include/net/ip.h index 4ac7577f98d0..72c36926c26d 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
@@ -168,7 +168,10 @@ struct ipv4_config | |||
168 | extern struct ipv4_config ipv4_config; | 168 | extern struct ipv4_config ipv4_config; |
169 | #define IP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.ip_statistics, field) | 169 | #define IP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.ip_statistics, field) |
170 | #define IP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.ip_statistics, field) | 170 | #define IP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.ip_statistics, field) |
171 | #define IP_ADD_STATS(net, field, val) SNMP_ADD_STATS((net)->mib.ip_statistics, field, val) | ||
171 | #define IP_ADD_STATS_BH(net, field, val) SNMP_ADD_STATS_BH((net)->mib.ip_statistics, field, val) | 172 | #define IP_ADD_STATS_BH(net, field, val) SNMP_ADD_STATS_BH((net)->mib.ip_statistics, field, val) |
173 | #define IP_UPD_PO_STATS(net, field, val) SNMP_UPD_PO_STATS((net)->mib.ip_statistics, field, val) | ||
174 | #define IP_UPD_PO_STATS_BH(net, field, val) SNMP_UPD_PO_STATS_BH((net)->mib.ip_statistics, field, val) | ||
172 | #define NET_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.net_statistics, field) | 175 | #define NET_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.net_statistics, field) |
173 | #define NET_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.net_statistics, field) | 176 | #define NET_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.net_statistics, field) |
174 | #define NET_INC_STATS_USER(net, field) SNMP_INC_STATS_USER((net)->mib.net_statistics, field) | 177 | #define NET_INC_STATS_USER(net, field) SNMP_INC_STATS_USER((net)->mib.net_statistics, field) |
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index c1f16fc49ade..f27fd83d67d8 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -126,15 +126,28 @@ extern struct ctl_path net_ipv6_ctl_path[]; | |||
126 | SNMP_ADD_STATS##modifier((net)->mib.statname##_statistics, (field), (val));\ | 126 | SNMP_ADD_STATS##modifier((net)->mib.statname##_statistics, (field), (val));\ |
127 | }) | 127 | }) |
128 | 128 | ||
129 | #define _DEVUPD(net, statname, modifier, idev, field, val) \ | ||
130 | ({ \ | ||
131 | struct inet6_dev *_idev = (idev); \ | ||
132 | if (likely(_idev != NULL)) \ | ||
133 | SNMP_UPD_PO_STATS##modifier((_idev)->stats.statname, field, (val)); \ | ||
134 | SNMP_UPD_PO_STATS##modifier((net)->mib.statname##_statistics, field, (val));\ | ||
135 | }) | ||
136 | |||
129 | /* MIBs */ | 137 | /* MIBs */ |
130 | 138 | ||
131 | #define IP6_INC_STATS(net, idev,field) \ | 139 | #define IP6_INC_STATS(net, idev,field) \ |
132 | _DEVINC(net, ipv6, , idev, field) | 140 | _DEVINC(net, ipv6, , idev, field) |
133 | #define IP6_INC_STATS_BH(net, idev,field) \ | 141 | #define IP6_INC_STATS_BH(net, idev,field) \ |
134 | _DEVINC(net, ipv6, _BH, idev, field) | 142 | _DEVINC(net, ipv6, _BH, idev, field) |
143 | #define IP6_ADD_STATS(net, idev,field,val) \ | ||
144 | _DEVADD(net, ipv6, , idev, field, val) | ||
135 | #define IP6_ADD_STATS_BH(net, idev,field,val) \ | 145 | #define IP6_ADD_STATS_BH(net, idev,field,val) \ |
136 | _DEVADD(net, ipv6, _BH, idev, field, val) | 146 | _DEVADD(net, ipv6, _BH, idev, field, val) |
137 | 147 | #define IP6_UPD_PO_STATS(net, idev,field,val) \ | |
148 | _DEVUPD(net, ipv6, , idev, field, val) | ||
149 | #define IP6_UPD_PO_STATS_BH(net, idev,field,val) \ | ||
150 | _DEVUPD(net, ipv6, _BH, idev, field, val) | ||
138 | #define ICMP6_INC_STATS(net, idev, field) \ | 151 | #define ICMP6_INC_STATS(net, idev, field) \ |
139 | _DEVINC(net, icmpv6, , idev, field) | 152 | _DEVINC(net, icmpv6, , idev, field) |
140 | #define ICMP6_INC_STATS_BH(net, idev, field) \ | 153 | #define ICMP6_INC_STATS_BH(net, idev, field) \ |
diff --git a/include/net/snmp.h b/include/net/snmp.h index 57c93628695f..8c842e06bec8 100644 --- a/include/net/snmp.h +++ b/include/net/snmp.h | |||
@@ -153,6 +153,11 @@ struct linux_xfrm_mib { | |||
153 | per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field]--; \ | 153 | per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field]--; \ |
154 | put_cpu(); \ | 154 | put_cpu(); \ |
155 | } while (0) | 155 | } while (0) |
156 | #define SNMP_ADD_STATS(mib, field, addend) \ | ||
157 | do { \ | ||
158 | per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field] += addend; \ | ||
159 | put_cpu(); \ | ||
160 | } while (0) | ||
156 | #define SNMP_ADD_STATS_BH(mib, field, addend) \ | 161 | #define SNMP_ADD_STATS_BH(mib, field, addend) \ |
157 | (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field] += addend) | 162 | (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field] += addend) |
158 | #define SNMP_ADD_STATS_USER(mib, field, addend) \ | 163 | #define SNMP_ADD_STATS_USER(mib, field, addend) \ |
@@ -160,5 +165,17 @@ struct linux_xfrm_mib { | |||
160 | per_cpu_ptr(mib[1], get_cpu())->mibs[field] += addend; \ | 165 | per_cpu_ptr(mib[1], get_cpu())->mibs[field] += addend; \ |
161 | put_cpu(); \ | 166 | put_cpu(); \ |
162 | } while (0) | 167 | } while (0) |
163 | 168 | #define SNMP_UPD_PO_STATS(mib, basefield, addend) \ | |
169 | do { \ | ||
170 | __typeof__(mib[0]) ptr = per_cpu_ptr(mib[!in_softirq()], get_cpu());\ | ||
171 | ptr->mibs[basefield##PKTS]++; \ | ||
172 | ptr->mibs[basefield##OCTETS] += addend;\ | ||
173 | put_cpu(); \ | ||
174 | } while (0) | ||
175 | #define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \ | ||
176 | do { \ | ||
177 | __typeof__(mib[0]) ptr = per_cpu_ptr(mib[!in_softirq()], raw_smp_processor_id());\ | ||
178 | ptr->mibs[basefield##PKTS]++; \ | ||
179 | ptr->mibs[basefield##OCTETS] += addend;\ | ||
180 | } while (0) | ||
164 | #endif | 181 | #endif |