aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
Diffstat (limited to 'include/net')
-rw-r--r--include/net/ip.h3
-rw-r--r--include/net/ipv6.h15
-rw-r--r--include/net/snmp.h19
3 files changed, 35 insertions, 2 deletions
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
168extern struct ipv4_config ipv4_config; 168extern 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