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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/inet/sctp/sctp_conn.c
          +++ new/usr/src/uts/common/inet/sctp/sctp_conn.c
↓ open down ↓ 160 lines elided ↑ open up ↑
 161  161          sctps = sctp->sctp_sctps;
 162  162  
 163  163          /*
 164  164           * Enforce the limit set on the number of connections per listener.
 165  165           * Note that tlc_cnt starts with 1.  So need to add 1 to tlc_max
 166  166           * for comparison.
 167  167           */
 168  168          if (slc != NULL) {
 169  169                  int64_t now;
 170  170  
 171      -                if (atomic_add_32_nv(&slc->slc_cnt, 1) > slc->slc_max + 1) {
      171 +                if (atomic_inc_32_nv(&slc->slc_cnt) > slc->slc_max + 1) {
 172  172                          now = ddi_get_lbolt64();
 173      -                        atomic_add_32(&slc->slc_cnt, -1);
      173 +                        atomic_dec_32(&slc->slc_cnt);
 174  174                          SCTP_KSTAT(sctps, sctp_listen_cnt_drop);
 175  175                          slc->slc_drop++;
 176  176                          if (now - slc->slc_report_time >
 177  177                              MSEC_TO_TICK(SCTP_SLC_REPORT_INTERVAL)) {
 178  178                                  zcmn_err(connp->conn_zoneid, CE_WARN,
 179  179                                      "SCTP listener (port %d) association max "
 180  180                                      "(%u) reached: %u attempts dropped total\n",
 181  181                                      ntohs(connp->conn_lport),
 182  182                                      slc->slc_max, slc->slc_drop);
 183  183                                  slc->slc_report_time = now;
 184  184                          }
 185  185                          return (NULL);
 186  186                  }
 187  187                  slc_set = B_TRUE;
 188  188          }
 189  189  
 190  190          if ((eager = sctp_create_eager(sctp)) == NULL) {
 191  191                  if (slc_set)
 192      -                        atomic_add_32(&slc->slc_cnt, -1);
      192 +                        atomic_dec_32(&slc->slc_cnt);
 193  193                  return (NULL);
 194  194          }
 195  195          econnp = eager->sctp_connp;
 196  196  
 197  197          if (connp->conn_policy != NULL) {
 198  198                  /* Inherit the policy from the listener; use actions from ira */
 199  199                  if (!ip_ipsec_policy_inherit(econnp, connp, ira)) {
 200  200                          sctp_close_eager(eager);
 201  201                          SCTPS_BUMP_MIB(sctps, sctpListenDrop);
 202  202                          return (NULL);
↓ open down ↓ 455 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX