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

@@ -135,11 +135,11 @@
         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);
+        (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,12 +882,12 @@
         }
         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);
+        (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,12 +1095,11 @@
                         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);
+                        (void) atomic_dec_32_nv(&osctp_ill->sctp_ill_ipifcnt);
                 }
         }
 
         sctp_ipif = kmem_zalloc(sizeof (sctp_ipif_t), KM_NOSLEEP);
         /* Try again? */

@@ -1128,11 +1127,11 @@
          * 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);
+        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,11 +1207,11 @@
                 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);
+                (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,12 +2027,11 @@
                         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);
+                        (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;