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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/inet/ip/igmp.c
          +++ new/usr/src/uts/common/inet/ip/igmp.c
↓ open down ↓ 500 lines elided ↑ open up ↑
 501  501                  /*
 502  502                   * Query from an old router.
 503  503                   * Remember that the querier on this interface is old,
 504  504                   * and set the timer to the value in RFC 1112.
 505  505                   */
 506  506                  ill->ill_mcast_v1_time = 0;
 507  507                  ill->ill_mcast_v1_tset = 1;
 508  508                  if (ill->ill_mcast_type != IGMP_V1_ROUTER) {
 509  509                          ip1dbg(("Received IGMPv1 Query on %s, switching mode "
 510  510                              "to IGMP_V1_ROUTER\n", ill->ill_name));
 511      -                        atomic_add_16(&ill->ill_ifptr->illif_mcast_v1, 1);
      511 +                        atomic_inc_16(&ill->ill_ifptr->illif_mcast_v1);
 512  512                          ill->ill_mcast_type = IGMP_V1_ROUTER;
 513  513                  }
 514  514  
 515  515                  timer = SEC_TO_MSEC(IGMP_MAX_HOST_REPORT_DELAY);
 516  516  
 517  517                  if (ipha->ipha_dst != htonl(INADDR_ALLHOSTS_GROUP) ||
 518  518                      igmpa->igmpa_group != 0) {
 519  519                          ++ipst->ips_igmpstat.igps_rcv_badqueries;
 520  520                          rw_exit(&ill->ill_mcast_lock);
 521  521                          ill_mcast_timer_start(ill->ill_ipst);
↓ open down ↓ 16 lines elided ↑ open up ↑
 538  538                  }
 539  539  
 540  540                  /*
 541  541                   * Switch interface state to v2 on receipt of a v2 query
 542  542                   * ONLY IF current state is v3.  Let things be if current
 543  543                   * state if v1 but do reset the v2-querier-present timer.
 544  544                   */
 545  545                  if (ill->ill_mcast_type == IGMP_V3_ROUTER) {
 546  546                          ip1dbg(("Received IGMPv2 Query on %s, switching mode "
 547  547                              "to IGMP_V2_ROUTER", ill->ill_name));
 548      -                        atomic_add_16(&ill->ill_ifptr->illif_mcast_v2, 1);
      548 +                        atomic_inc_16(&ill->ill_ifptr->illif_mcast_v2);
 549  549                          ill->ill_mcast_type = IGMP_V2_ROUTER;
 550  550                  }
 551  551                  ill->ill_mcast_v2_time = 0;
 552  552                  ill->ill_mcast_v2_tset = 1;
 553  553  
 554  554                  timer = DSEC_TO_MSEC((int)igmpa->igmpa_code);
 555  555          }
 556  556  
 557  557          if (ip_debug > 1) {
 558  558                  (void) mi_strlog(ill->ill_rq, 1, SL_TRACE,
↓ open down ↓ 1150 lines elided ↑ open up ↑
1709 1709                                  } else {
1710 1710                                          ip1dbg(("V1 query timer "
1711 1711                                              "expired on %s; switching "
1712 1712                                              "mode to IGMP_V3\n",
1713 1713                                              ill->ill_name));
1714 1714                                          ill->ill_mcast_type =
1715 1715                                              IGMP_V3_ROUTER;
1716 1716                                  }
1717 1717                                  ill->ill_mcast_v1_time = 0;
1718 1718                                  ill->ill_mcast_v1_tset = 0;
1719      -                                atomic_add_16(&ifp->illif_mcast_v1, -1);
     1719 +                                atomic_dec_16(&ifp->illif_mcast_v1);
1720 1720                          }
1721 1721                          if ((ill->ill_mcast_type == IGMP_V2_ROUTER) &&
1722 1722                              (ipst->ips_igmp_max_version >= IGMP_V3_ROUTER) &&
1723 1723                              (ill->ill_mcast_v2_time >= OVQP(ill))) {
1724 1724                                  ip1dbg(("V2 query timer expired on "
1725 1725                                      "%s; switching mode to IGMP_V3\n",
1726 1726                                      ill->ill_name));
1727 1727                                  ill->ill_mcast_type = IGMP_V3_ROUTER;
1728 1728                                  ill->ill_mcast_v2_time = 0;
1729 1729                                  ill->ill_mcast_v2_tset = 0;
1730      -                                atomic_add_16(&ifp->illif_mcast_v2, -1);
     1730 +                                atomic_dec_16(&ifp->illif_mcast_v2);
1731 1731                          }
1732 1732                          rw_exit(&ill->ill_mcast_lock);
1733 1733                          ill_refrele(ill);
1734 1734                          rw_enter(&ipst->ips_ill_g_lock, RW_READER);
1735 1735                  }
1736 1736          }
1737 1737          rw_exit(&ipst->ips_ill_g_lock);
1738 1738          ill_mcast_timer_start(ipst);
1739 1739          mutex_enter(&ipst->ips_igmp_slowtimeout_lock);
1740 1740          ipst->ips_igmp_slowtimeout_id = timeout(igmp_slowtimo, (void *)ipst,
↓ open down ↓ 38 lines elided ↑ open up ↑
1779 1779                                  ill->ill_mcast_v1_time++;
1780 1780                          if ((ill->ill_mcast_type == MLD_V1_ROUTER) &&
1781 1781                              (ipst->ips_mld_max_version >= MLD_V2_ROUTER) &&
1782 1782                              (ill->ill_mcast_v1_time >= OVQP(ill))) {
1783 1783                                  ip1dbg(("MLD query timer expired on"
1784 1784                                      " %s; switching mode to MLD_V2\n",
1785 1785                                      ill->ill_name));
1786 1786                                  ill->ill_mcast_type = MLD_V2_ROUTER;
1787 1787                                  ill->ill_mcast_v1_time = 0;
1788 1788                                  ill->ill_mcast_v1_tset = 0;
1789      -                                atomic_add_16(&ifp->illif_mcast_v1, -1);
     1789 +                                atomic_dec_16(&ifp->illif_mcast_v1);
1790 1790                          }
1791 1791                          rw_exit(&ill->ill_mcast_lock);
1792 1792                          ill_refrele(ill);
1793 1793                          rw_enter(&ipst->ips_ill_g_lock, RW_READER);
1794 1794                  }
1795 1795          }
1796 1796          rw_exit(&ipst->ips_ill_g_lock);
1797 1797          ill_mcast_timer_start(ipst);
1798 1798          mutex_enter(&ipst->ips_mld_slowtimeout_lock);
1799 1799          ipst->ips_mld_slowtimeout_id = timeout(mld_slowtimo, (void *)ipst,
↓ open down ↓ 409 lines elided ↑ open up ↑
2209 2209                  return (0);
2210 2210          }
2211 2211  
2212 2212          /* Need to do compatibility mode checking */
2213 2213          rw_enter(&ill->ill_mcast_lock, RW_WRITER);
2214 2214          ill->ill_mcast_v1_time = 0;
2215 2215          ill->ill_mcast_v1_tset = 1;
2216 2216          if (ill->ill_mcast_type == MLD_V2_ROUTER) {
2217 2217                  ip1dbg(("Received MLDv1 Query on %s, switching mode to "
2218 2218                      "MLD_V1_ROUTER\n", ill->ill_name));
2219      -                atomic_add_16(&ill->ill_ifptr->illif_mcast_v1, 1);
     2219 +                atomic_inc_16(&ill->ill_ifptr->illif_mcast_v1);
2220 2220                  ill->ill_mcast_type = MLD_V1_ROUTER;
2221 2221          }
2222 2222  
2223 2223          timer = (int)ntohs(mldh->mld_maxdelay);
2224 2224          if (ip_debug > 1) {
2225 2225                  (void) mi_strlog(ill->ill_rq, 1, SL_TRACE,
2226 2226                      "mld_input: TIMER = mld_maxdelay %d mld_type 0x%x",
2227 2227                      timer, (int)mldh->mld_type);
2228 2228          }
2229 2229  
↓ open down ↓ 663 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX