Print this page
5045 use atomic_{inc,dec}_* instead of atomic_add_*

*** 296,312 **** ipa_pad:19; uint32_t ipa_ovhd; /* per-packet encap ovhd */ } ipsec_action_t; #define IPACT_REFHOLD(ipa) { \ ! atomic_add_32(&(ipa)->ipa_refs, 1); \ ASSERT((ipa)->ipa_refs != 0); \ } #define IPACT_REFRELE(ipa) { \ ASSERT((ipa)->ipa_refs != 0); \ membar_exit(); \ ! if (atomic_add_32_nv(&(ipa)->ipa_refs, -1) == 0) \ ipsec_action_free(ipa); \ (ipa) = 0; \ } /* --- 296,312 ---- ipa_pad:19; uint32_t ipa_ovhd; /* per-packet encap ovhd */ } ipsec_action_t; #define IPACT_REFHOLD(ipa) { \ ! atomic_inc_32(&(ipa)->ipa_refs); \ ASSERT((ipa)->ipa_refs != 0); \ } #define IPACT_REFRELE(ipa) { \ ASSERT((ipa)->ipa_refs != 0); \ membar_exit(); \ ! if (atomic_dec_32_nv(&(ipa)->ipa_refs) == 0) \ ipsec_action_free(ipa); \ (ipa) = 0; \ } /*
*** 412,428 **** ipsec_action_t *ipsp_act; /* action (may be shared) */ netstack_t *ipsp_netstack; /* No netstack_hold */ }; #define IPPOL_REFHOLD(ipp) { \ ! atomic_add_32(&(ipp)->ipsp_refs, 1); \ ASSERT((ipp)->ipsp_refs != 0); \ } #define IPPOL_REFRELE(ipp) { \ ASSERT((ipp)->ipsp_refs != 0); \ membar_exit(); \ ! if (atomic_add_32_nv(&(ipp)->ipsp_refs, -1) == 0) \ ipsec_policy_free(ipp); \ (ipp) = 0; \ } #define IPPOL_UNCHAIN(php, ip) \ --- 412,428 ---- ipsec_action_t *ipsp_act; /* action (may be shared) */ netstack_t *ipsp_netstack; /* No netstack_hold */ }; #define IPPOL_REFHOLD(ipp) { \ ! atomic_inc_32(&(ipp)->ipsp_refs); \ ASSERT((ipp)->ipsp_refs != 0); \ } #define IPPOL_REFRELE(ipp) { \ ASSERT((ipp)->ipsp_refs != 0); \ membar_exit(); \ ! if (atomic_dec_32_nv(&(ipp)->ipsp_refs) == 0) \ ipsec_policy_free(ipp); \ (ipp) = 0; \ } #define IPPOL_UNCHAIN(php, ip) \
*** 459,475 **** ipsec_policy_root_t iph_root[IPSEC_NTYPES]; avl_tree_t iph_rulebyid; } ipsec_policy_head_t; #define IPPH_REFHOLD(iph) { \ ! atomic_add_32(&(iph)->iph_refs, 1); \ ASSERT((iph)->iph_refs != 0); \ } #define IPPH_REFRELE(iph, ns) { \ ASSERT((iph)->iph_refs != 0); \ membar_exit(); \ ! if (atomic_add_32_nv(&(iph)->iph_refs, -1) == 0) \ ipsec_polhead_free(iph, ns); \ (iph) = 0; \ } /* --- 459,475 ---- ipsec_policy_root_t iph_root[IPSEC_NTYPES]; avl_tree_t iph_rulebyid; } ipsec_policy_head_t; #define IPPH_REFHOLD(iph) { \ ! atomic_inc_32(&(iph)->iph_refs); \ ASSERT((iph)->iph_refs != 0); \ } #define IPPH_REFRELE(iph, ns) { \ ASSERT((iph)->iph_refs != 0); \ membar_exit(); \ ! if (atomic_dec_32_nv(&(iph)->iph_refs) == 0) \ ipsec_polhead_free(iph, ns); \ (iph) = 0; \ } /*
*** 546,563 **** #define ITP_P_ISPERPORT(itp, iph) ((itp)->itp_flags & \ (((itp)->itp_policy == (iph)) ? ITPF_P_PER_PORT_SECURITY : \ ITPF_I_PER_PORT_SECURITY)) #define ITP_REFHOLD(itp) { \ ! atomic_add_32(&((itp)->itp_refcnt), 1); \ ASSERT((itp)->itp_refcnt != 0); \ } #define ITP_REFRELE(itp, ns) { \ ASSERT((itp)->itp_refcnt != 0); \ membar_exit(); \ ! if (atomic_add_32_nv(&((itp)->itp_refcnt), -1) == 0) \ itp_free(itp, ns); \ } /* * Certificate identity. --- 546,563 ---- #define ITP_P_ISPERPORT(itp, iph) ((itp)->itp_flags & \ (((itp)->itp_policy == (iph)) ? ITPF_P_PER_PORT_SECURITY : \ ITPF_I_PER_PORT_SECURITY)) #define ITP_REFHOLD(itp) { \ ! atomic_inc_32(&((itp)->itp_refcnt)); \ ASSERT((itp)->itp_refcnt != 0); \ } #define ITP_REFRELE(itp, ns) { \ ASSERT((itp)->itp_refcnt != 0); \ membar_exit(); \ ! if (atomic_dec_32_nv(&((itp)->itp_refcnt)) == 0) \ itp_free(itp, ns); \ } /* * Certificate identity.
*** 575,596 **** /* * ipsid_t reference hold/release macros, just like ipsa versions. */ #define IPSID_REFHOLD(ipsid) { \ ! atomic_add_32(&(ipsid)->ipsid_refcnt, 1); \ ASSERT((ipsid)->ipsid_refcnt != 0); \ } /* * Decrement the reference count on the ID. Someone else will clean up * after us later. */ #define IPSID_REFRELE(ipsid) { \ membar_exit(); \ ! atomic_add_32(&(ipsid)->ipsid_refcnt, -1); \ } /* * Following are the estimates of what the maximum AH and ESP header size * would be. This is used to tell the upper layer the right value of MSS --- 575,596 ---- /* * ipsid_t reference hold/release macros, just like ipsa versions. */ #define IPSID_REFHOLD(ipsid) { \ ! atomic_inc_32(&(ipsid)->ipsid_refcnt); \ ASSERT((ipsid)->ipsid_refcnt != 0); \ } /* * Decrement the reference count on the ID. Someone else will clean up * after us later. */ #define IPSID_REFRELE(ipsid) { \ membar_exit(); \ ! atomic_dec_32(&(ipsid)->ipsid_refcnt); \ } /* * Following are the estimates of what the maximum AH and ESP header size * would be. This is used to tell the upper layer the right value of MSS