aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/snmp.h
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2010-03-18 16:36:06 -0400
committerDavid S. Miller <davem@davemloft.net>2010-03-21 21:34:16 -0400
commitec733b15a3ef0b5759141a177f8044a2f40c41e7 (patch)
tree41af80ea4dcc89cc049bd36cbd882916a6469263 /include/net/snmp.h
parent62c97ac04a67c120ec37a9bfd445a8d5dbbc1ed2 (diff)
net: snmp mib cleanup
There is no point to align or pad mibs to cache lines, they are per cpu allocated with a 8 bytes alignment anyway. This wastes space for no gain. This patch removes __SNMP_MIB_ALIGN__ Since SNMP mibs contain "unsigned long" fields only, we can relax the allocation alignment from "unsigned long long" to "unsigned long" Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/snmp.h')
-rw-r--r--include/net/snmp.h29
1 files changed, 7 insertions, 22 deletions
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
72struct ipstats_mib { 57struct 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
80struct icmp_mib { 65struct 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
85struct icmpmsg_mib { 70struct 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
91struct icmpv6_mib { 76struct 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
96struct icmpv6msg_mib { 81struct 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
103struct tcp_mib { 88struct 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
109struct udp_mib { 94struct 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