diff options
-rw-r--r-- | include/net/ip.h | 2 | ||||
-rw-r--r-- | net/dccp/proto.c | 3 | ||||
-rw-r--r-- | net/ipv4/af_inet.c | 27 | ||||
-rw-r--r-- | net/ipv6/addrconf.c | 9 | ||||
-rw-r--r-- | net/ipv6/af_inet6.c | 15 | ||||
-rw-r--r-- | net/sctp/protocol.c | 3 | ||||
-rw-r--r-- | net/xfrm/xfrm_policy.c | 3 |
7 files changed, 40 insertions, 22 deletions
diff --git a/include/net/ip.h b/include/net/ip.h index d52f01180361..3b524df7dddb 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
@@ -178,7 +178,7 @@ extern struct ipv4_config ipv4_config; | |||
178 | #define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd) | 178 | #define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd) |
179 | 179 | ||
180 | extern unsigned long snmp_fold_field(void __percpu *mib[], int offt); | 180 | extern unsigned long snmp_fold_field(void __percpu *mib[], int offt); |
181 | extern int snmp_mib_init(void __percpu *ptr[2], size_t mibsize); | 181 | extern int snmp_mib_init(void __percpu *ptr[2], size_t mibsize, size_t align); |
182 | extern void snmp_mib_free(void __percpu *ptr[2]); | 182 | extern void snmp_mib_free(void __percpu *ptr[2]); |
183 | 183 | ||
184 | extern struct local_ports { | 184 | extern struct local_ports { |
diff --git a/net/dccp/proto.c b/net/dccp/proto.c index f79bcef5088f..096250d1323b 100644 --- a/net/dccp/proto.c +++ b/net/dccp/proto.c | |||
@@ -1002,7 +1002,8 @@ EXPORT_SYMBOL_GPL(dccp_shutdown); | |||
1002 | static inline int dccp_mib_init(void) | 1002 | static inline int dccp_mib_init(void) |
1003 | { | 1003 | { |
1004 | return snmp_mib_init((void __percpu **)dccp_statistics, | 1004 | return snmp_mib_init((void __percpu **)dccp_statistics, |
1005 | sizeof(struct dccp_mib)); | 1005 | sizeof(struct dccp_mib), |
1006 | __alignof__(struct dccp_mib)); | ||
1006 | } | 1007 | } |
1007 | 1008 | ||
1008 | static inline void dccp_mib_exit(void) | 1009 | static inline void dccp_mib_exit(void) |
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index b4c0969137cb..640db9b90330 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -1427,13 +1427,13 @@ unsigned long snmp_fold_field(void __percpu *mib[], int offt) | |||
1427 | } | 1427 | } |
1428 | EXPORT_SYMBOL_GPL(snmp_fold_field); | 1428 | EXPORT_SYMBOL_GPL(snmp_fold_field); |
1429 | 1429 | ||
1430 | int snmp_mib_init(void __percpu *ptr[2], size_t mibsize) | 1430 | int snmp_mib_init(void __percpu *ptr[2], size_t mibsize, size_t align) |
1431 | { | 1431 | { |
1432 | BUG_ON(ptr == NULL); | 1432 | BUG_ON(ptr == NULL); |
1433 | ptr[0] = __alloc_percpu(mibsize, __alignof__(unsigned long)); | 1433 | ptr[0] = __alloc_percpu(mibsize, align); |
1434 | if (!ptr[0]) | 1434 | if (!ptr[0]) |
1435 | goto err0; | 1435 | goto err0; |
1436 | ptr[1] = __alloc_percpu(mibsize, __alignof__(unsigned long)); | 1436 | ptr[1] = __alloc_percpu(mibsize, align); |
1437 | if (!ptr[1]) | 1437 | if (!ptr[1]) |
1438 | goto err1; | 1438 | goto err1; |
1439 | return 0; | 1439 | return 0; |
@@ -1490,25 +1490,32 @@ static const struct net_protocol icmp_protocol = { | |||
1490 | static __net_init int ipv4_mib_init_net(struct net *net) | 1490 | static __net_init int ipv4_mib_init_net(struct net *net) |
1491 | { | 1491 | { |
1492 | if (snmp_mib_init((void __percpu **)net->mib.tcp_statistics, | 1492 | if (snmp_mib_init((void __percpu **)net->mib.tcp_statistics, |
1493 | sizeof(struct tcp_mib)) < 0) | 1493 | sizeof(struct tcp_mib), |
1494 | __alignof__(struct tcp_mib)) < 0) | ||
1494 | goto err_tcp_mib; | 1495 | goto err_tcp_mib; |
1495 | if (snmp_mib_init((void __percpu **)net->mib.ip_statistics, | 1496 | if (snmp_mib_init((void __percpu **)net->mib.ip_statistics, |
1496 | sizeof(struct ipstats_mib)) < 0) | 1497 | sizeof(struct ipstats_mib), |
1498 | __alignof__(struct ipstats_mib)) < 0) | ||
1497 | goto err_ip_mib; | 1499 | goto err_ip_mib; |
1498 | if (snmp_mib_init((void __percpu **)net->mib.net_statistics, | 1500 | if (snmp_mib_init((void __percpu **)net->mib.net_statistics, |
1499 | sizeof(struct linux_mib)) < 0) | 1501 | sizeof(struct linux_mib), |
1502 | __alignof__(struct linux_mib)) < 0) | ||
1500 | goto err_net_mib; | 1503 | goto err_net_mib; |
1501 | if (snmp_mib_init((void __percpu **)net->mib.udp_statistics, | 1504 | if (snmp_mib_init((void __percpu **)net->mib.udp_statistics, |
1502 | sizeof(struct udp_mib)) < 0) | 1505 | sizeof(struct udp_mib), |
1506 | __alignof__(struct udp_mib)) < 0) | ||
1503 | goto err_udp_mib; | 1507 | goto err_udp_mib; |
1504 | if (snmp_mib_init((void __percpu **)net->mib.udplite_statistics, | 1508 | if (snmp_mib_init((void __percpu **)net->mib.udplite_statistics, |
1505 | sizeof(struct udp_mib)) < 0) | 1509 | sizeof(struct udp_mib), |
1510 | __alignof__(struct udp_mib)) < 0) | ||
1506 | goto err_udplite_mib; | 1511 | goto err_udplite_mib; |
1507 | if (snmp_mib_init((void __percpu **)net->mib.icmp_statistics, | 1512 | if (snmp_mib_init((void __percpu **)net->mib.icmp_statistics, |
1508 | sizeof(struct icmp_mib)) < 0) | 1513 | sizeof(struct icmp_mib), |
1514 | __alignof__(struct icmp_mib)) < 0) | ||
1509 | goto err_icmp_mib; | 1515 | goto err_icmp_mib; |
1510 | if (snmp_mib_init((void __percpu **)net->mib.icmpmsg_statistics, | 1516 | if (snmp_mib_init((void __percpu **)net->mib.icmpmsg_statistics, |
1511 | sizeof(struct icmpmsg_mib)) < 0) | 1517 | sizeof(struct icmpmsg_mib), |
1518 | __alignof__(struct icmpmsg_mib)) < 0) | ||
1512 | goto err_icmpmsg_mib; | 1519 | goto err_icmpmsg_mib; |
1513 | 1520 | ||
1514 | tcp_mib_init(net); | 1521 | tcp_mib_init(net); |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index b97bb1f30808..c20a7c260a8f 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -284,13 +284,16 @@ static void addrconf_mod_timer(struct inet6_ifaddr *ifp, | |||
284 | static int snmp6_alloc_dev(struct inet6_dev *idev) | 284 | static int snmp6_alloc_dev(struct inet6_dev *idev) |
285 | { | 285 | { |
286 | if (snmp_mib_init((void __percpu **)idev->stats.ipv6, | 286 | if (snmp_mib_init((void __percpu **)idev->stats.ipv6, |
287 | sizeof(struct ipstats_mib)) < 0) | 287 | sizeof(struct ipstats_mib), |
288 | __alignof__(struct ipstats_mib)) < 0) | ||
288 | goto err_ip; | 289 | goto err_ip; |
289 | if (snmp_mib_init((void __percpu **)idev->stats.icmpv6, | 290 | if (snmp_mib_init((void __percpu **)idev->stats.icmpv6, |
290 | sizeof(struct icmpv6_mib)) < 0) | 291 | sizeof(struct icmpv6_mib), |
292 | __alignof__(struct icmpv6_mib)) < 0) | ||
291 | goto err_icmp; | 293 | goto err_icmp; |
292 | if (snmp_mib_init((void __percpu **)idev->stats.icmpv6msg, | 294 | if (snmp_mib_init((void __percpu **)idev->stats.icmpv6msg, |
293 | sizeof(struct icmpv6msg_mib)) < 0) | 295 | sizeof(struct icmpv6msg_mib), |
296 | __alignof__(struct icmpv6msg_mib)) < 0) | ||
294 | goto err_icmpmsg; | 297 | goto err_icmpmsg; |
295 | 298 | ||
296 | return 0; | 299 | return 0; |
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index 94b1b9c954bf..e830cd4f9d0f 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
@@ -971,19 +971,24 @@ static void ipv6_packet_cleanup(void) | |||
971 | static int __net_init ipv6_init_mibs(struct net *net) | 971 | static int __net_init ipv6_init_mibs(struct net *net) |
972 | { | 972 | { |
973 | if (snmp_mib_init((void __percpu **)net->mib.udp_stats_in6, | 973 | if (snmp_mib_init((void __percpu **)net->mib.udp_stats_in6, |
974 | sizeof (struct udp_mib)) < 0) | 974 | sizeof(struct udp_mib), |
975 | __alignof__(struct udp_mib)) < 0) | ||
975 | return -ENOMEM; | 976 | return -ENOMEM; |
976 | if (snmp_mib_init((void __percpu **)net->mib.udplite_stats_in6, | 977 | if (snmp_mib_init((void __percpu **)net->mib.udplite_stats_in6, |
977 | sizeof (struct udp_mib)) < 0) | 978 | sizeof(struct udp_mib), |
979 | __alignof__(struct udp_mib)) < 0) | ||
978 | goto err_udplite_mib; | 980 | goto err_udplite_mib; |
979 | if (snmp_mib_init((void __percpu **)net->mib.ipv6_statistics, | 981 | if (snmp_mib_init((void __percpu **)net->mib.ipv6_statistics, |
980 | sizeof(struct ipstats_mib)) < 0) | 982 | sizeof(struct ipstats_mib), |
983 | __alignof__(struct ipstats_mib)) < 0) | ||
981 | goto err_ip_mib; | 984 | goto err_ip_mib; |
982 | if (snmp_mib_init((void __percpu **)net->mib.icmpv6_statistics, | 985 | if (snmp_mib_init((void __percpu **)net->mib.icmpv6_statistics, |
983 | sizeof(struct icmpv6_mib)) < 0) | 986 | sizeof(struct icmpv6_mib), |
987 | __alignof__(struct icmpv6_mib)) < 0) | ||
984 | goto err_icmp_mib; | 988 | goto err_icmp_mib; |
985 | if (snmp_mib_init((void __percpu **)net->mib.icmpv6msg_statistics, | 989 | if (snmp_mib_init((void __percpu **)net->mib.icmpv6msg_statistics, |
986 | sizeof(struct icmpv6msg_mib)) < 0) | 990 | sizeof(struct icmpv6msg_mib), |
991 | __alignof__(struct icmpv6msg_mib)) < 0) | ||
987 | goto err_icmpmsg_mib; | 992 | goto err_icmpmsg_mib; |
988 | return 0; | 993 | return 0; |
989 | 994 | ||
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index a0e1a7fdebbf..c0e162aeb0bd 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
@@ -1002,7 +1002,8 @@ int sctp_register_pf(struct sctp_pf *pf, sa_family_t family) | |||
1002 | static inline int init_sctp_mibs(void) | 1002 | static inline int init_sctp_mibs(void) |
1003 | { | 1003 | { |
1004 | return snmp_mib_init((void __percpu **)sctp_statistics, | 1004 | return snmp_mib_init((void __percpu **)sctp_statistics, |
1005 | sizeof(struct sctp_mib)); | 1005 | sizeof(struct sctp_mib), |
1006 | __alignof__(struct sctp_mib)); | ||
1006 | } | 1007 | } |
1007 | 1008 | ||
1008 | static inline void cleanup_sctp_mibs(void) | 1009 | static inline void cleanup_sctp_mibs(void) |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 4bf27d901333..593c06be6b62 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -2480,7 +2480,8 @@ static int __net_init xfrm_statistics_init(struct net *net) | |||
2480 | int rv; | 2480 | int rv; |
2481 | 2481 | ||
2482 | if (snmp_mib_init((void __percpu **)net->mib.xfrm_statistics, | 2482 | if (snmp_mib_init((void __percpu **)net->mib.xfrm_statistics, |
2483 | sizeof(struct linux_xfrm_mib)) < 0) | 2483 | sizeof(struct linux_xfrm_mib), |
2484 | __alignof__(struct linux_xfrm_mib)) < 0) | ||
2484 | return -ENOMEM; | 2485 | return -ENOMEM; |
2485 | rv = xfrm_proc_init(net); | 2486 | rv = xfrm_proc_init(net); |
2486 | if (rv < 0) | 2487 | if (rv < 0) |