| 127 | |
| 128 | #define IPSEC_MODULE_INCR 2 |
| 129 | static int |
| 130 | ipsec_kmod_enter(volatile u_int *cntr) |
| 131 | { |
| 132 | u_int old, new; |
| 133 | |
| 134 | do { |
| 135 | old = *cntr; |
| 136 | if ((old & IPSEC_MODULE_ENABLED) == 0) |
| 137 | return (ENXIO); |
| 138 | new = old + IPSEC_MODULE_INCR; |
| 139 | } while(atomic_cmpset_acq_int(cntr, old, new) == 0); |
| 140 | return (0); |
| 141 | } |
| 142 | |
| 143 | static void |
| 144 | ipsec_kmod_exit(volatile u_int *cntr) |