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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/myri10ge/drv/myri10ge.c
          +++ new/usr/src/uts/common/io/myri10ge/drv/myri10ge.c
↓ open down ↓ 3124 lines elided ↑ open up ↑
3125 3125  
3126 3126          tx_boundary = mgp->tx_boundary;
3127 3127          hdr_size_tmp = hdr_size;
3128 3128          resid = tx_boundary;
3129 3129          count = 1;
3130 3130          mutex_enter(&tx->lock);
3131 3131  
3132 3132          /* check to see if the slots are really there */
3133 3133          avail = tx->mask - (tx->req - tx->done);
3134 3134          if (unlikely(avail <=  MYRI10GE_MAX_SEND_DESC_TSO)) {
3135      -                atomic_add_32(&tx->stall, 1);
     3135 +                atomic_inc_32(&tx->stall);
3136 3136                  mutex_exit(&tx->lock);
3137 3137                  return (EBUSY);
3138 3138          }
3139 3139  
3140 3140          /* copy */
3141 3141          cum_len = -hdr_size;
3142 3142          count = 0;
3143 3143          req = req_list;
3144 3144          idx = tx->mask & tx->req;
3145 3145          cp = &tx->cp[idx];
↓ open down ↓ 220 lines elided ↑ open up ↑
3366 3366          /*
3367 3367           * If we have > MXGEFW_MAX_SEND_DESC, then any over-length
3368 3368           * message will need to be pulled up in order to fit.
3369 3369           * Otherwise, we are low on transmit descriptors, it is
3370 3370           * probably better to stall and try again rather than pullup a
3371 3371           * message to fit.
3372 3372           */
3373 3373  
3374 3374          if (avail < max_segs) {
3375 3375                  err = EBUSY;
3376      -                atomic_add_32(&tx->stall_early, 1);
     3376 +                atomic_inc_32(&tx->stall_early);
3377 3377                  goto stall;
3378 3378          }
3379 3379  
3380 3380          /* find out how long the frame is and how many segments it is */
3381 3381          count = 0;
3382 3382          odd_flag = 0;
3383 3383          pkt_size = 0;
3384 3384          flags = (MXGEFW_FLAGS_NO_TSO | MXGEFW_FLAGS_FIRST);
3385 3385          for (bp = mp; bp != NULL; bp = bp->b_cont) {
3386 3386                  dblk_t *dbp;
↓ open down ↓ 244 lines elided ↑ open up ↑
3631 3631                  err = 0;
3632 3632                  goto late_stall;
3633 3633          }
3634 3634  
3635 3635          myri10ge_send_locked(tx, req_list, tx_info, count);
3636 3636          mutex_exit(&tx->lock);
3637 3637          return (DDI_SUCCESS);
3638 3638  
3639 3639  late_stall:
3640 3640          try_pullup = 0;
3641      -        atomic_add_32(&tx->stall_late, 1);
     3641 +        atomic_inc_32(&tx->stall_late);
3642 3642  
3643 3643  abort_with_handles:
3644 3644          /* unbind and free handles from previous mblks */
3645 3645          for (i = 0; i < count; i++) {
3646 3646                  bp = tx_info[i].m;
3647 3647                  tx_info[i].m = 0;
3648 3648                  if (bp) {
3649 3649                          dma_handle = tx_info[i].handle;
3650 3650                          (void) ddi_dma_unbind_handle(dma_handle->h);
3651 3651                          dma_handle->next = handles;
↓ open down ↓ 12 lines elided ↑ open up ↑
3664 3664                          freemsg(mp);
3665 3665                          return (0);
3666 3666                  }
3667 3667                  try_pullup = 0;
3668 3668                  goto again;
3669 3669          }
3670 3670  
3671 3671  stall:
3672 3672          if (err != 0) {
3673 3673                  if (err == EBUSY) {
3674      -                        atomic_add_32(&tx->stall, 1);
     3674 +                        atomic_inc_32(&tx->stall);
3675 3675                  } else {
3676 3676                          MYRI10GE_ATOMIC_SLICE_STAT_INC(xmit_err);
3677 3677                  }
3678 3678          }
3679 3679          return (err);
3680 3680  }
3681 3681  
3682 3682  static mblk_t *
3683 3683  myri10ge_send_wrapper(void *arg, mblk_t *mp)
3684 3684  {
↓ open down ↓ 2494 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX