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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/xen/io/xnb.c
          +++ new/usr/src/uts/common/xen/io/xnb.c
↓ open down ↓ 1292 lines elided ↑ open up ↑
1293 1293              &dma_cookie, &ncookies)
1294 1294              != DDI_DMA_MAPPED)
1295 1295                  goto failure_2;
1296 1296          ASSERT(ncookies == 1);
1297 1297  
1298 1298          txp->xt_mfn = xnb_btop(dma_cookie.dmac_laddress);
1299 1299          txp->xt_buflen = dma_cookie.dmac_size;
1300 1300  
1301 1301          DTRACE_PROBE(txbuf_allocated);
1302 1302  
1303      -        atomic_add_32(&xnbp->xnb_tx_buf_count, 1);
     1303 +        atomic_inc_32(&xnbp->xnb_tx_buf_count);
1304 1304          xnbp->xnb_tx_buf_outstanding++;
1305 1305  
1306 1306          return (0);
1307 1307  
1308 1308  failure_2:
1309 1309          ddi_dma_mem_free(&txp->xt_acc_handle);
1310 1310  
1311 1311  failure_1:
1312 1312          ddi_dma_free_handle(&txp->xt_dma_handle);
1313 1313  
↓ open down ↓ 5 lines elided ↑ open up ↑
1319 1319  static void
1320 1320  xnb_txbuf_destructor(void *buf, void *arg)
1321 1321  {
1322 1322          xnb_txbuf_t *txp = buf;
1323 1323          xnb_t *xnbp = arg;
1324 1324  
1325 1325          (void) ddi_dma_unbind_handle(txp->xt_dma_handle);
1326 1326          ddi_dma_mem_free(&txp->xt_acc_handle);
1327 1327          ddi_dma_free_handle(&txp->xt_dma_handle);
1328 1328  
1329      -        atomic_add_32(&xnbp->xnb_tx_buf_count, -1);
     1329 +        atomic_dec_32(&xnbp->xnb_tx_buf_count);
1330 1330  }
1331 1331  
1332 1332  /*
1333 1333   * Take packets from the peer and deliver them onward.
1334 1334   */
1335 1335  static mblk_t *
1336 1336  xnb_from_peer(xnb_t *xnbp)
1337 1337  {
1338 1338          RING_IDX start, end, loop;
1339 1339          gnttab_copy_t *cop;
↓ open down ↓ 736 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX