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

*** 135,145 **** sctps->sctps_g_ipifs[hindex].ipif_count--; sctps->sctps_g_ipifs_count--; rw_destroy(&sctp_ipif->sctp_ipif_lock); kmem_free(sctp_ipif, sizeof (sctp_ipif_t)); ! (void) atomic_add_32_nv(&sctp_ill->sctp_ill_ipifcnt, -1); if (rw_tryupgrade(&sctps->sctps_g_ills_lock) != 0) { rw_downgrade(&sctps->sctps_g_ipifs_lock); if (sctp_ill->sctp_ill_ipifcnt == 0 && sctp_ill->sctp_ill_state == SCTP_ILLS_CONDEMNED) { list_remove(&sctps->sctps_g_ills[ill_index]. --- 135,145 ---- sctps->sctps_g_ipifs[hindex].ipif_count--; sctps->sctps_g_ipifs_count--; rw_destroy(&sctp_ipif->sctp_ipif_lock); kmem_free(sctp_ipif, sizeof (sctp_ipif_t)); ! (void) atomic_dec_32_nv(&sctp_ill->sctp_ill_ipifcnt); if (rw_tryupgrade(&sctps->sctps_g_ills_lock) != 0) { rw_downgrade(&sctps->sctps_g_ipifs_lock); if (sctp_ill->sctp_ill_ipifcnt == 0 && sctp_ill->sctp_ill_state == SCTP_ILLS_CONDEMNED) { list_remove(&sctps->sctps_g_ills[ill_index].
*** 882,893 **** } rw_enter(&sctp_ipif->sctp_ipif_lock, RW_WRITER); ASSERT(sctp_ipif->sctp_ipif_ill == fsctp_ill); sctp_ipif->sctp_ipif_ill = tsctp_ill; rw_exit(&sctp_ipif->sctp_ipif_lock); ! (void) atomic_add_32_nv(&fsctp_ill->sctp_ill_ipifcnt, -1); ! atomic_add_32(&tsctp_ill->sctp_ill_ipifcnt, 1); rw_exit(&sctps->sctps_g_ipifs_lock); rw_exit(&sctps->sctps_g_ills_lock); } /* --- 882,893 ---- } rw_enter(&sctp_ipif->sctp_ipif_lock, RW_WRITER); ASSERT(sctp_ipif->sctp_ipif_ill == fsctp_ill); sctp_ipif->sctp_ipif_ill = tsctp_ill; rw_exit(&sctp_ipif->sctp_ipif_lock); ! (void) atomic_dec_32_nv(&fsctp_ill->sctp_ill_ipifcnt); ! atomic_inc_32(&tsctp_ill->sctp_ill_ipifcnt); rw_exit(&sctps->sctps_g_ipifs_lock); rw_exit(&sctps->sctps_g_ills_lock); } /*
*** 1095,1106 **** list_remove(ipif_list, (void *)osctp_ipif); sctps->sctps_g_ipifs[ohindex].ipif_count--; sctps->sctps_g_ipifs_count--; rw_destroy(&osctp_ipif->sctp_ipif_lock); kmem_free(osctp_ipif, sizeof (sctp_ipif_t)); ! (void) atomic_add_32_nv(&osctp_ill->sctp_ill_ipifcnt, ! -1); } } sctp_ipif = kmem_zalloc(sizeof (sctp_ipif_t), KM_NOSLEEP); /* Try again? */ --- 1095,1105 ---- list_remove(ipif_list, (void *)osctp_ipif); sctps->sctps_g_ipifs[ohindex].ipif_count--; sctps->sctps_g_ipifs_count--; rw_destroy(&osctp_ipif->sctp_ipif_lock); kmem_free(osctp_ipif, sizeof (sctp_ipif_t)); ! (void) atomic_dec_32_nv(&osctp_ill->sctp_ill_ipifcnt); } } sctp_ipif = kmem_zalloc(sizeof (sctp_ipif_t), KM_NOSLEEP); /* Try again? */
*** 1128,1138 **** * additions. */ list_insert_head(&sctps->sctps_g_ipifs[hindex].sctp_ipif_list, (void *)sctp_ipif); sctps->sctps_g_ipifs[hindex].ipif_count++; ! atomic_add_32(&sctp_ill->sctp_ill_ipifcnt, 1); if (sctp_ipif->sctp_ipif_state == SCTP_IPIFS_UP) sctp_chk_and_updt_saddr(hindex, sctp_ipif, sctps); rw_exit(&sctps->sctps_g_ipifs_lock); rw_exit(&sctps->sctps_g_ills_lock); } --- 1127,1137 ---- * additions. */ list_insert_head(&sctps->sctps_g_ipifs[hindex].sctp_ipif_list, (void *)sctp_ipif); sctps->sctps_g_ipifs[hindex].ipif_count++; ! atomic_inc_32(&sctp_ill->sctp_ill_ipifcnt); if (sctp_ipif->sctp_ipif_state == SCTP_IPIFS_UP) sctp_chk_and_updt_saddr(hindex, sctp_ipif, sctps); rw_exit(&sctps->sctps_g_ipifs_lock); rw_exit(&sctps->sctps_g_ills_lock); }
*** 1208,1218 **** list_remove(ipif_list, (void *)sctp_ipif); sctps->sctps_g_ipifs[hindex].ipif_count--; sctps->sctps_g_ipifs_count--; rw_destroy(&sctp_ipif->sctp_ipif_lock); kmem_free(sctp_ipif, sizeof (sctp_ipif_t)); ! (void) atomic_add_32_nv(&sctp_ill->sctp_ill_ipifcnt, -1); if (rw_tryupgrade(&sctps->sctps_g_ills_lock) != 0) { rw_downgrade(&sctps->sctps_g_ipifs_lock); if (sctp_ill->sctp_ill_ipifcnt == 0 && sctp_ill->sctp_ill_state == SCTP_ILLS_CONDEMNED) { list_remove(ill_list, (void *)sctp_ill); --- 1207,1217 ---- list_remove(ipif_list, (void *)sctp_ipif); sctps->sctps_g_ipifs[hindex].ipif_count--; sctps->sctps_g_ipifs_count--; rw_destroy(&sctp_ipif->sctp_ipif_lock); kmem_free(sctp_ipif, sizeof (sctp_ipif_t)); ! (void) atomic_dec_32_nv(&sctp_ill->sctp_ill_ipifcnt); if (rw_tryupgrade(&sctps->sctps_g_ills_lock) != 0) { rw_downgrade(&sctps->sctps_g_ipifs_lock); if (sctp_ill->sctp_ill_ipifcnt == 0 && sctp_ill->sctp_ill_state == SCTP_ILLS_CONDEMNED) { list_remove(ill_list, (void *)sctp_ill);
*** 2028,2039 **** sctp_ill = sctp_ipif->sctp_ipif_ill; list_remove(&sctps->sctps_g_ipifs[i].sctp_ipif_list, sctp_ipif); sctps->sctps_g_ipifs_count--; ! (void) atomic_add_32_nv(&sctp_ill->sctp_ill_ipifcnt, ! -1); kmem_free(sctp_ipif, sizeof (sctp_ipif_t)); sctp_ipif = list_tail(&sctps->sctps_g_ipifs[i].sctp_ipif_list); } sctps->sctps_g_ipifs[i].ipif_count = 0; --- 2027,2037 ---- sctp_ill = sctp_ipif->sctp_ipif_ill; list_remove(&sctps->sctps_g_ipifs[i].sctp_ipif_list, sctp_ipif); sctps->sctps_g_ipifs_count--; ! (void) atomic_dec_32_nv(&sctp_ill->sctp_ill_ipifcnt); kmem_free(sctp_ipif, sizeof (sctp_ipif_t)); sctp_ipif = list_tail(&sctps->sctps_g_ipifs[i].sctp_ipif_list); } sctps->sctps_g_ipifs[i].ipif_count = 0;