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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/gld.c
          +++ new/usr/src/uts/common/io/gld.c
↓ open down ↓ 1740 lines elided ↑ open up ↑
1741 1741                   */
1742 1742                  membar_consumer();
1743 1743                  if (gld->gld_in_wsrv)
1744 1744                          goto use_wsrv;
1745 1745  
1746 1746                  /*
1747 1747                   * Keep a count of current wput calls to start.
1748 1748                   * Nonzero count delays any attempted DL_UNBIND.
1749 1749                   * See comments above gld_start().
1750 1750                   */
1751      -                atomic_add_32((uint32_t *)&gld->gld_wput_count, 1);
     1751 +                atomic_inc_32((uint32_t *)&gld->gld_wput_count);
1752 1752                  membar_enter();
1753 1753  
1754 1754                  /* Recheck state now wput_count is set to prevent DL_UNBIND */
1755 1755                  /* If this Q is in process of DL_UNBIND, don't call start */
1756 1756                  if (gld->gld_state != DL_IDLE || gld->gld_in_unbind) {
1757 1757                          /* Extremely unlikely */
1758      -                        atomic_add_32((uint32_t *)&gld->gld_wput_count, -1);
     1758 +                        atomic_dec_32((uint32_t *)&gld->gld_wput_count);
1759 1759                          goto use_wsrv;
1760 1760                  }
1761 1761  
1762 1762                  /*
1763 1763                   * Get the priority value. Note that in raw mode, the
1764 1764                   * per-packet priority value kept in b_band is ignored.
1765 1765                   */
1766 1766                  upri = (gld->gld_flags & GLD_RAW) ? gld->gld_upri :
1767 1767                      UPRI(gld, mp->b_band);
1768 1768  
1769 1769                  rc = (multidata) ? gld_start_mdt(q, mp, GLD_WPUT) :
1770 1770                      gld_start(q, mp, GLD_WPUT, upri);
1771 1771  
1772 1772                  /* Allow DL_UNBIND again */
1773 1773                  membar_exit();
1774      -                atomic_add_32((uint32_t *)&gld->gld_wput_count, -1);
     1774 +                atomic_dec_32((uint32_t *)&gld->gld_wput_count);
1775 1775  
1776 1776                  if (rc == GLD_NORESOURCES)
1777 1777                          qenable(q);
1778 1778                  break;  /*  Done with this packet */
1779 1779  
1780 1780  use_wsrv:
1781 1781                  /* Q not empty, in DL_DETACH, or start gave NORESOURCES */
1782 1782                  (void) putq(q, mp);
1783 1783                  qenable(q);
1784 1784                  break;
↓ open down ↓ 4157 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX