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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/dls/dls_link.c
          +++ new/usr/src/uts/common/io/dls/dls_link.c
↓ open down ↓ 353 lines elided ↑ open up ↑
 354  354           * Walk the packet chain.
 355  355           */
 356  356          for (; mp != NULL; mp = nextp) {
 357  357                  /*
 358  358                   * Wipe the accepted state.
 359  359                   */
 360  360                  accepted = B_FALSE;
 361  361  
 362  362                  DLS_PREPARE_PKT(dlp->dl_mh, mp, &mhi, err);
 363  363                  if (err != 0) {
 364      -                        atomic_add_32(&(dlp->dl_unknowns), 1);
      364 +                        atomic_inc_32(&(dlp->dl_unknowns));
 365  365                          nextp = mp->b_next;
 366  366                          mp->b_next = NULL;
 367  367                          freemsg(mp);
 368  368                          continue;
 369  369                  }
 370  370  
 371  371                  /*
 372  372                   * Grab the longest sub-chain we can process as a single
 373  373                   * unit.
 374  374                   */
↓ open down ↓ 153 lines elided ↑ open up ↑
 528  528                          goto drop;
 529  529  
 530  530                  if (!dls_accept(dsp, &mhi, &ds_rx, &ds_rx_arg))
 531  531                          goto drop;
 532  532  
 533  533                  ds_rx(ds_rx_arg, NULL, mp, &mhi);
 534  534                  return;
 535  535          }
 536  536  
 537  537  drop:
 538      -        atomic_add_32(&dlp->dl_unknowns, 1);
      538 +        atomic_inc_32(&dlp->dl_unknowns);
 539  539          freemsg(mp);
 540  540  }
 541  541  
 542  542  /* ARGSUSED */
 543  543  void
 544  544  dls_rx_promisc(void *arg, mac_resource_handle_t mrh, mblk_t *mp,
 545  545      boolean_t loopback)
 546  546  {
 547  547          dld_str_t                       *dsp = arg;
 548  548          dls_link_t                      *dlp = dsp->ds_dlp;
↓ open down ↓ 19 lines elided ↑ open up ↑
 568  568                          goto drop;
 569  569          }
 570  570  
 571  571          if (!dls_accept_promisc(dsp, &mhi, &ds_rx, &ds_rx_arg, loopback))
 572  572                  goto drop;
 573  573  
 574  574          ds_rx(ds_rx_arg, NULL, mp, &mhi);
 575  575          return;
 576  576  
 577  577  drop:
 578      -        atomic_add_32(&dlp->dl_unknowns, 1);
      578 +        atomic_inc_32(&dlp->dl_unknowns);
 579  579          freemsg(mp);
 580  580  }
 581  581  
 582  582  static void
 583  583  i_dls_link_destroy(dls_link_t *dlp)
 584  584  {
 585  585          ASSERT(dlp->dl_nactive == 0);
 586  586          ASSERT(dlp->dl_impl_count == 0);
 587  587          ASSERT(dlp->dl_zone_ref == 0);
 588  588  
↓ open down ↓ 136 lines elided ↑ open up ↑
 725  725          if ((err = i_dls_link_create(name, &dlp)) != 0)
 726  726                  return (err);
 727  727  
 728  728          /*
 729  729           * Insert the dls_link_t.
 730  730           */
 731  731          err = mod_hash_insert(i_dls_link_hash, (mod_hash_key_t)dlp->dl_name,
 732  732              (mod_hash_val_t)dlp);
 733  733          ASSERT(err == 0);
 734  734  
 735      -        atomic_add_32(&i_dls_link_count, 1);
      735 +        atomic_inc_32(&i_dls_link_count);
 736  736          ASSERT(i_dls_link_count != 0);
 737  737  
 738  738  done:
 739  739          ASSERT(MAC_PERIM_HELD(dlp->dl_mh));
 740  740          /*
 741  741           * Bump the reference count and hand back the reference.
 742  742           */
 743  743          dlp->dl_ref++;
 744  744          *dlpp = dlp;
 745  745          return (0);
↓ open down ↓ 66 lines elided ↑ open up ↑
 812  812          if (--dlp->dl_ref == 0) {
 813  813                  (void) mod_hash_remove(i_dls_link_hash,
 814  814                      (mod_hash_key_t)dlp->dl_name, &val);
 815  815                  ASSERT(dlp == (dls_link_t *)val);
 816  816  
 817  817                  /*
 818  818                   * Destroy the dls_link_t.
 819  819                   */
 820  820                  i_dls_link_destroy(dlp);
 821  821                  ASSERT(i_dls_link_count > 0);
 822      -                atomic_add_32(&i_dls_link_count, -1);
      822 +                atomic_dec_32(&i_dls_link_count);
 823  823          }
 824  824  }
 825  825  
 826  826  int
 827  827  dls_link_rele_by_name(const char *name)
 828  828  {
 829  829          dls_link_t              *dlp;
 830  830  
 831  831          if (mod_hash_find(i_dls_link_hash, (mod_hash_key_t)name,
 832  832              (mod_hash_val_t *)&dlp) != 0)
↓ open down ↓ 185 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX