sctp: Clean up TEST_FRAME hacks.
[safe/jmp/linux-2.6] / include / net / snmp.h
index 9c5793d..57c9362 100644 (file)
@@ -14,8 +14,6 @@
  *             as published by the Free Software Foundation; either version
  *             2 of the License, or (at your option) any later version.
  *
- *             $Id: snmp.h,v 1.19 2001/06/14 13:40:46 davem Exp $
- *
  */
  
 #ifndef _SNMP_H
@@ -23,6 +21,7 @@
 
 #include <linux/cache.h>
 #include <linux/snmp.h>
+#include <linux/smp.h>
 
 /*
  * Mibs are stored in array of unsigned long.
@@ -117,6 +116,11 @@ struct linux_mib {
        unsigned long   mibs[LINUX_MIB_MAX];
 };
 
+/* Linux Xfrm */
+#define LINUX_MIB_XFRMMAX      __LINUX_MIB_XFRMMAX
+struct linux_xfrm_mib {
+       unsigned long   mibs[LINUX_MIB_XFRMMAX];
+};
 
 /* 
  * FIXME: On x86 and some other CPUs the split into user and softirq parts
@@ -135,14 +139,26 @@ struct linux_mib {
 #define SNMP_INC_STATS_BH(mib, field)  \
        (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field]++)
 #define SNMP_INC_STATS_USER(mib, field) \
-       (per_cpu_ptr(mib[1], raw_smp_processor_id())->mibs[field]++)
+       do { \
+               per_cpu_ptr(mib[1], get_cpu())->mibs[field]++; \
+               put_cpu(); \
+       } while (0)
 #define SNMP_INC_STATS(mib, field)     \
-       (per_cpu_ptr(mib[!in_softirq()], raw_smp_processor_id())->mibs[field]++)
+       do { \
+               per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field]++; \
+               put_cpu(); \
+       } while (0)
 #define SNMP_DEC_STATS(mib, field)     \
-       (per_cpu_ptr(mib[!in_softirq()], raw_smp_processor_id())->mibs[field]--)
+       do { \
+               per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field]--; \
+               put_cpu(); \
+       } while (0)
 #define SNMP_ADD_STATS_BH(mib, field, addend)  \
        (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field] += addend)
 #define SNMP_ADD_STATS_USER(mib, field, addend)        \
-       (per_cpu_ptr(mib[1], raw_smp_processor_id())->mibs[field] += addend)
+       do { \
+               per_cpu_ptr(mib[1], get_cpu())->mibs[field] += addend; \
+               put_cpu(); \
+       } while (0)
 
 #endif