diff options
-rw-r--r-- | include/net/sctp/sctp.h | 2 | ||||
-rw-r--r-- | include/net/snmp.h | 29 | ||||
-rw-r--r-- | net/dccp/dccp.h | 2 | ||||
-rw-r--r-- | net/ipv4/af_inet.c | 4 |
4 files changed, 11 insertions, 26 deletions
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index 78740ec57d5d..59151557406c 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
@@ -268,7 +268,7 @@ enum { | |||
268 | #define SCTP_MIB_MAX __SCTP_MIB_MAX | 268 | #define SCTP_MIB_MAX __SCTP_MIB_MAX |
269 | struct sctp_mib { | 269 | struct sctp_mib { |
270 | unsigned long mibs[SCTP_MIB_MAX]; | 270 | unsigned long mibs[SCTP_MIB_MAX]; |
271 | } __SNMP_MIB_ALIGN__; | 271 | }; |
272 | 272 | ||
273 | 273 | ||
274 | /* Print debugging messages. */ | 274 | /* Print debugging messages. */ |
diff --git a/include/net/snmp.h b/include/net/snmp.h index 692ee0061dc4..884fdbb74b23 100644 --- a/include/net/snmp.h +++ b/include/net/snmp.h | |||
@@ -52,26 +52,11 @@ struct snmp_mib { | |||
52 | * count on the 20Gb/s + networks people expect in a few years time! | 52 | * count on the 20Gb/s + networks people expect in a few years time! |
53 | */ | 53 | */ |
54 | 54 | ||
55 | /* | ||
56 | * The rule for padding: | ||
57 | * Best is power of two because then the right structure can be found by a | ||
58 | * simple shift. The structure should be always cache line aligned. | ||
59 | * gcc needs n=alignto(cachelinesize, popcnt(sizeof(bla_mib))) shift/add | ||
60 | * instructions to emulate multiply in case it is not power-of-two. | ||
61 | * Currently n is always <=3 for all sizes so simple cache line alignment | ||
62 | * is enough. | ||
63 | * | ||
64 | * The best solution would be a global CPU local area , especially on 64 | ||
65 | * and 128byte cacheline machine it makes a *lot* of sense -AK | ||
66 | */ | ||
67 | |||
68 | #define __SNMP_MIB_ALIGN__ ____cacheline_aligned | ||
69 | |||
70 | /* IPstats */ | 55 | /* IPstats */ |
71 | #define IPSTATS_MIB_MAX __IPSTATS_MIB_MAX | 56 | #define IPSTATS_MIB_MAX __IPSTATS_MIB_MAX |
72 | struct ipstats_mib { | 57 | struct ipstats_mib { |
73 | unsigned long mibs[IPSTATS_MIB_MAX]; | 58 | unsigned long mibs[IPSTATS_MIB_MAX]; |
74 | } __SNMP_MIB_ALIGN__; | 59 | }; |
75 | 60 | ||
76 | /* ICMP */ | 61 | /* ICMP */ |
77 | #define ICMP_MIB_DUMMY __ICMP_MIB_MAX | 62 | #define ICMP_MIB_DUMMY __ICMP_MIB_MAX |
@@ -79,36 +64,36 @@ struct ipstats_mib { | |||
79 | 64 | ||
80 | struct icmp_mib { | 65 | struct icmp_mib { |
81 | unsigned long mibs[ICMP_MIB_MAX]; | 66 | unsigned long mibs[ICMP_MIB_MAX]; |
82 | } __SNMP_MIB_ALIGN__; | 67 | }; |
83 | 68 | ||
84 | #define ICMPMSG_MIB_MAX __ICMPMSG_MIB_MAX | 69 | #define ICMPMSG_MIB_MAX __ICMPMSG_MIB_MAX |
85 | struct icmpmsg_mib { | 70 | struct icmpmsg_mib { |
86 | unsigned long mibs[ICMPMSG_MIB_MAX]; | 71 | unsigned long mibs[ICMPMSG_MIB_MAX]; |
87 | } __SNMP_MIB_ALIGN__; | 72 | }; |
88 | 73 | ||
89 | /* ICMP6 (IPv6-ICMP) */ | 74 | /* ICMP6 (IPv6-ICMP) */ |
90 | #define ICMP6_MIB_MAX __ICMP6_MIB_MAX | 75 | #define ICMP6_MIB_MAX __ICMP6_MIB_MAX |
91 | struct icmpv6_mib { | 76 | struct icmpv6_mib { |
92 | unsigned long mibs[ICMP6_MIB_MAX]; | 77 | unsigned long mibs[ICMP6_MIB_MAX]; |
93 | } __SNMP_MIB_ALIGN__; | 78 | }; |
94 | 79 | ||
95 | #define ICMP6MSG_MIB_MAX __ICMP6MSG_MIB_MAX | 80 | #define ICMP6MSG_MIB_MAX __ICMP6MSG_MIB_MAX |
96 | struct icmpv6msg_mib { | 81 | struct icmpv6msg_mib { |
97 | unsigned long mibs[ICMP6MSG_MIB_MAX]; | 82 | unsigned long mibs[ICMP6MSG_MIB_MAX]; |
98 | } __SNMP_MIB_ALIGN__; | 83 | }; |
99 | 84 | ||
100 | 85 | ||
101 | /* TCP */ | 86 | /* TCP */ |
102 | #define TCP_MIB_MAX __TCP_MIB_MAX | 87 | #define TCP_MIB_MAX __TCP_MIB_MAX |
103 | struct tcp_mib { | 88 | struct tcp_mib { |
104 | unsigned long mibs[TCP_MIB_MAX]; | 89 | unsigned long mibs[TCP_MIB_MAX]; |
105 | } __SNMP_MIB_ALIGN__; | 90 | }; |
106 | 91 | ||
107 | /* UDP */ | 92 | /* UDP */ |
108 | #define UDP_MIB_MAX __UDP_MIB_MAX | 93 | #define UDP_MIB_MAX __UDP_MIB_MAX |
109 | struct udp_mib { | 94 | struct udp_mib { |
110 | unsigned long mibs[UDP_MIB_MAX]; | 95 | unsigned long mibs[UDP_MIB_MAX]; |
111 | } __SNMP_MIB_ALIGN__; | 96 | }; |
112 | 97 | ||
113 | /* Linux */ | 98 | /* Linux */ |
114 | #define LINUX_MIB_MAX __LINUX_MIB_MAX | 99 | #define LINUX_MIB_MAX __LINUX_MIB_MAX |
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h index 5ef32c2f0d6a..53f8e12d0c10 100644 --- a/net/dccp/dccp.h +++ b/net/dccp/dccp.h | |||
@@ -189,7 +189,7 @@ enum { | |||
189 | #define DCCP_MIB_MAX __DCCP_MIB_MAX | 189 | #define DCCP_MIB_MAX __DCCP_MIB_MAX |
190 | struct dccp_mib { | 190 | struct dccp_mib { |
191 | unsigned long mibs[DCCP_MIB_MAX]; | 191 | unsigned long mibs[DCCP_MIB_MAX]; |
192 | } __SNMP_MIB_ALIGN__; | 192 | }; |
193 | 193 | ||
194 | DECLARE_SNMP_STAT(struct dccp_mib, dccp_statistics); | 194 | DECLARE_SNMP_STAT(struct dccp_mib, dccp_statistics); |
195 | #define DCCP_INC_STATS(field) SNMP_INC_STATS(dccp_statistics, field) | 195 | #define DCCP_INC_STATS(field) SNMP_INC_STATS(dccp_statistics, field) |
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 33b7dffa7732..55e11906a73a 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -1401,10 +1401,10 @@ EXPORT_SYMBOL_GPL(snmp_fold_field); | |||
1401 | int snmp_mib_init(void __percpu *ptr[2], size_t mibsize) | 1401 | int snmp_mib_init(void __percpu *ptr[2], size_t mibsize) |
1402 | { | 1402 | { |
1403 | BUG_ON(ptr == NULL); | 1403 | BUG_ON(ptr == NULL); |
1404 | ptr[0] = __alloc_percpu(mibsize, __alignof__(unsigned long long)); | 1404 | ptr[0] = __alloc_percpu(mibsize, __alignof__(unsigned long)); |
1405 | if (!ptr[0]) | 1405 | if (!ptr[0]) |
1406 | goto err0; | 1406 | goto err0; |
1407 | ptr[1] = __alloc_percpu(mibsize, __alignof__(unsigned long long)); | 1407 | ptr[1] = __alloc_percpu(mibsize, __alignof__(unsigned long)); |
1408 | if (!ptr[1]) | 1408 | if (!ptr[1]) |
1409 | goto err1; | 1409 | goto err1; |
1410 | return 0; | 1410 | return 0; |