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

@@ -364,11 +364,11 @@
         mutex_exit(&xnfp->xnf_gref_lock);
 
         if (gref == INVALID_GRANT_REF) {
                 xnfp->xnf_stat_gref_failure++;
         } else {
-                atomic_add_64(&xnfp->xnf_stat_gref_outstanding, 1);
+                atomic_inc_64(&xnfp->xnf_stat_gref_outstanding);
                 if (xnfp->xnf_stat_gref_outstanding > xnfp->xnf_stat_gref_peak)
                         xnfp->xnf_stat_gref_peak =
                             xnfp->xnf_stat_gref_outstanding;
         }
 

@@ -385,11 +385,11 @@
 
         mutex_enter(&xnfp->xnf_gref_lock);
         gnttab_release_grant_reference(&xnfp->xnf_gref_head, gref);
         mutex_exit(&xnfp->xnf_gref_lock);
 
-        atomic_add_64(&xnfp->xnf_stat_gref_outstanding, -1);
+        atomic_dec_64(&xnfp->xnf_stat_gref_outstanding);
 }
 
 /*
  * Acquire a transmit id.
  */

@@ -2350,11 +2350,11 @@
         bdesc->buf_mfn = pfn_to_mfn(xnf_btop(bdesc->buf_phys));
         bdesc->len = dma_cookie.dmac_size;
         bdesc->grant_ref = INVALID_GRANT_REF;
         bdesc->gen = xnfp->xnf_gen;
 
-        atomic_add_64(&xnfp->xnf_stat_buf_allocated, 1);
+        atomic_inc_64(&xnfp->xnf_stat_buf_allocated);
 
         return (0);
 
 failure_2:
         ddi_dma_mem_free(&bdesc->acc_handle);

@@ -2376,11 +2376,11 @@
 
         (void) ddi_dma_unbind_handle(bdesc->dma_handle);
         ddi_dma_mem_free(&bdesc->acc_handle);
         ddi_dma_free_handle(&bdesc->dma_handle);
 
-        atomic_add_64(&xnfp->xnf_stat_buf_allocated, -1);
+        atomic_dec_64(&xnfp->xnf_stat_buf_allocated);
 }
 
 static xnf_buf_t *
 xnf_buf_get(xnf_t *xnfp, int flags, boolean_t readonly)
 {

@@ -2410,11 +2410,11 @@
 
         gnttab_grant_foreign_access_ref(bufp->grant_ref,
             xvdi_get_oeid(bufp->xnfp->xnf_devinfo),
             bufp->buf_mfn, readonly ? 1 : 0);
 
-        atomic_add_64(&xnfp->xnf_stat_buf_outstanding, 1);
+        atomic_inc_64(&xnfp->xnf_stat_buf_outstanding);
 
         return (bufp);
 }
 
 static void

@@ -2427,11 +2427,11 @@
                 bufp->grant_ref = INVALID_GRANT_REF;
         }
 
         kmem_cache_free(xnfp->xnf_buf_cache, bufp);
 
-        atomic_add_64(&xnfp->xnf_stat_buf_outstanding, -1);
+        atomic_dec_64(&xnfp->xnf_stat_buf_outstanding);
 }
 
 /*
  * Refresh any cached data about a buffer after resume.
  */