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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/ipp/dlcosmk/dlcosmk.c
          +++ new/usr/src/uts/common/ipp/dlcosmk/dlcosmk.c
↓ open down ↓ 58 lines elided ↑ open up ↑
  59   59          ASSERT((mpp != NULL) && (*mpp != NULL));
  60   60          mp = *mpp;
  61   61  
  62   62          /*
  63   63           * The action module will receive an M_DATA or an M_CTL followed
  64   64           * by an M_DATA. In the latter case skip the M_CTL.
  65   65           */
  66   66          if (mp->b_datap->db_type != M_DATA) {
  67   67                  if ((mp->b_cont == NULL) ||
  68   68                      (mp->b_cont->b_datap->db_type != M_DATA)) {
  69      -                        atomic_add_64(&dlcosmk_data->epackets, 1);
       69 +                        atomic_inc_64(&dlcosmk_data->epackets);
  70   70                          dlcosmk0dbg(("dlcosmk_process: no data\n"));
  71   71                          return (EINVAL);
  72   72                  }
  73   73          }
  74   74  
  75   75          /* Update global stats */
  76      -        atomic_add_64(&dlcosmk_data->npackets, 1);
       76 +        atomic_inc_64(&dlcosmk_data->npackets);
  77   77  
  78   78          /*
  79   79           * This should only be called for outgoing packets. For inbound, just
  80   80           * send it along.
  81   81           */
  82   82          if ((proc == IPP_LOCAL_IN) || (proc == IPP_FWD_IN)) {
  83   83                  dlcosmk2dbg(("dlcosmk_process:cannot mark incoming packets\n"));
  84      -                atomic_add_64(&dlcosmk_data->ipackets, 1);
       84 +                atomic_inc_64(&dlcosmk_data->ipackets);
  85   85                  return (0);
  86   86          }
  87   87  
  88   88          if ((ill_index == 0) ||
  89   89              ((ill = ill_lookup_on_ifindex_global_instance(ill_index,
  90   90              B_FALSE)) == NULL)) {
  91   91                  dlcosmk2dbg(("dlcosmk_process:invalid ill index %u\n",
  92   92                      ill_index));
  93      -                atomic_add_64(&dlcosmk_data->ipackets, 1);
       93 +                atomic_inc_64(&dlcosmk_data->ipackets);
  94   94                  return (0);
  95   95          }
  96   96  
  97   97          /*
  98   98           * Check if the interface supports CoS marking. If not send it to the
  99   99           * next action in the chain
 100  100           */
 101  101          if (!(ill->ill_flags & ILLF_COS_ENABLED)) {
 102  102                  dlcosmk2dbg(("dlcosmk_process:ill %u does not support CoS\n",
 103  103                      ill_index));
 104      -                atomic_add_64(&dlcosmk_data->ipackets, 1);
      104 +                atomic_inc_64(&dlcosmk_data->ipackets);
 105  105                  ill_refrele(ill);
 106  106                  return (0);
 107  107          }
 108  108          ill_refrele(ill);
 109  109  
 110  110  
 111  111          /*
 112  112           * Mark the b_band for fastpath messages or dl_priority.dl_max for
 113  113           * DL_UNITDATA_REQ messages. For, others just pass it along.
 114  114           */
↓ open down ↓ 2 lines elided ↑ open up ↑
 117  117                  case M_PCPROTO:
 118  118                          {       /* DL_UNITDATA */
 119  119                                  dl_unitdata_req_t *dlur;
 120  120                                  dlur = (dl_unitdata_req_t *)mp->b_rptr;
 121  121  
 122  122                                  /* DL_UNITDATA message?? */
 123  123                                  if (dlur->dl_primitive == DL_UNITDATA_REQ) {
 124  124                                          dlur->dl_priority.dl_max =
 125  125                                              dlcosmk_data->dl_max;
 126  126                                  } else {
 127      -                                        atomic_add_64(&dlcosmk_data->ipackets,
 128      -                                            1);
      127 +                                        atomic_inc_64(&dlcosmk_data->ipackets);
 129  128                                  }
 130  129                                  break;
 131  130                          }
 132  131                  case M_DATA:
 133  132                          /* fastpath message */
 134  133                          mp->b_band = dlcosmk_data->b_band;
 135  134                          break;
 136  135                  default:
 137      -                        atomic_add_64(&dlcosmk_data->ipackets, 1);
      136 +                        atomic_inc_64(&dlcosmk_data->ipackets);
 138  137                          break;
 139  138          }
 140  139  
 141  140          return (0);
 142  141  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX