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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/hxge/hxge_rxdma.c
          +++ new/usr/src/uts/common/io/hxge/hxge_rxdma.c
↓ open down ↓ 1023 lines elided ↑ open up ↑
1024 1024          if (ring->rbr_state == RBR_POSTING)
1025 1025                  MUTEX_ENTER(&ring->post_lock);
1026 1026  
1027 1027          /*
1028 1028           * First we need to get the free state, then
1029 1029           * atomic decrement the reference count to prevent
1030 1030           * the race condition with the interrupt thread that
1031 1031           * is processing a loaned up buffer block.
1032 1032           */
1033 1033          free_state = rx_msg_p->free;
1034      -        ref_cnt = atomic_add_32_nv(&rx_msg_p->ref_cnt, -1);
     1034 +        ref_cnt = atomic_dec_32_nv(&rx_msg_p->ref_cnt);
1035 1035          if (!ref_cnt) {
1036 1036                  atomic_dec_32(&hxge_mblks_pending);
1037 1037  
1038 1038                  buffer = rx_msg_p->buffer;
1039 1039                  size = rx_msg_p->block_size;
1040 1040  
1041 1041                  HXGE_DEBUG_MSG((NULL, MEM2_CTL, "hxge_freeb: "
1042 1042                      "will free: rx_msg_p = $%p (block pending %d)",
1043 1043                      rx_msg_p, hxge_mblks_pending));
1044 1044  
↓ open down ↓ 2832 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX