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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/nxge/nxge_rxdma.c
          +++ new/usr/src/uts/common/io/nxge/nxge_rxdma.c
↓ open down ↓ 1676 lines elided ↑ open up ↑
1677 1677              "nxge_freeb:rx_msg_p = $%p (block pending %d)",
1678 1678              rx_msg_p, nxge_mblks_pending));
1679 1679  
1680 1680          /*
1681 1681           * First we need to get the free state, then
1682 1682           * atomic decrement the reference count to prevent
1683 1683           * the race condition with the interrupt thread that
1684 1684           * is processing a loaned up buffer block.
1685 1685           */
1686 1686          free_state = rx_msg_p->free;
1687      -        ref_cnt = atomic_add_32_nv(&rx_msg_p->ref_cnt, -1);
     1687 +        ref_cnt = atomic_dec_32_nv(&rx_msg_p->ref_cnt);
1688 1688          if (!ref_cnt) {
1689 1689                  atomic_dec_32(&nxge_mblks_pending);
1690 1690                  buffer = rx_msg_p->buffer;
1691 1691                  size = rx_msg_p->block_size;
1692 1692                  NXGE_DEBUG_MSG((NULL, MEM2_CTL, "nxge_freeb: "
1693 1693                      "will free: rx_msg_p = $%p (block pending %d)",
1694 1694                      rx_msg_p, nxge_mblks_pending));
1695 1695  
1696 1696                  if (!rx_msg_p->use_buf_pool) {
1697 1697                          KMEM_FREE(buffer, size);
↓ open down ↓ 3308 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX