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

@@ -64,46 +64,46 @@
          * by an M_DATA. In the latter case skip the M_CTL.
          */
         if (mp->b_datap->db_type != M_DATA) {
                 if ((mp->b_cont == NULL) ||
                     (mp->b_cont->b_datap->db_type != M_DATA)) {
-                        atomic_add_64(&dlcosmk_data->epackets, 1);
+                        atomic_inc_64(&dlcosmk_data->epackets);
                         dlcosmk0dbg(("dlcosmk_process: no data\n"));
                         return (EINVAL);
                 }
         }
 
         /* Update global stats */
-        atomic_add_64(&dlcosmk_data->npackets, 1);
+        atomic_inc_64(&dlcosmk_data->npackets);
 
         /*
          * This should only be called for outgoing packets. For inbound, just
          * send it along.
          */
         if ((proc == IPP_LOCAL_IN) || (proc == IPP_FWD_IN)) {
                 dlcosmk2dbg(("dlcosmk_process:cannot mark incoming packets\n"));
-                atomic_add_64(&dlcosmk_data->ipackets, 1);
+                atomic_inc_64(&dlcosmk_data->ipackets);
                 return (0);
         }
 
         if ((ill_index == 0) ||
             ((ill = ill_lookup_on_ifindex_global_instance(ill_index,
             B_FALSE)) == NULL)) {
                 dlcosmk2dbg(("dlcosmk_process:invalid ill index %u\n",
                     ill_index));
-                atomic_add_64(&dlcosmk_data->ipackets, 1);
+                atomic_inc_64(&dlcosmk_data->ipackets);
                 return (0);
         }
 
         /*
          * Check if the interface supports CoS marking. If not send it to the
          * next action in the chain
          */
         if (!(ill->ill_flags & ILLF_COS_ENABLED)) {
                 dlcosmk2dbg(("dlcosmk_process:ill %u does not support CoS\n",
                     ill_index));
-                atomic_add_64(&dlcosmk_data->ipackets, 1);
+                atomic_inc_64(&dlcosmk_data->ipackets);
                 ill_refrele(ill);
                 return (0);
         }
         ill_refrele(ill);
 

@@ -122,21 +122,20 @@
                                 /* DL_UNITDATA message?? */
                                 if (dlur->dl_primitive == DL_UNITDATA_REQ) {
                                         dlur->dl_priority.dl_max =
                                             dlcosmk_data->dl_max;
                                 } else {
-                                        atomic_add_64(&dlcosmk_data->ipackets,
-                                            1);
+                                        atomic_inc_64(&dlcosmk_data->ipackets);
                                 }
                                 break;
                         }
                 case M_DATA:
                         /* fastpath message */
                         mp->b_band = dlcosmk_data->b_band;
                         break;
                 default:
-                        atomic_add_64(&dlcosmk_data->ipackets, 1);
+                        atomic_inc_64(&dlcosmk_data->ipackets);
                         break;
         }
 
         return (0);
 }