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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/comstar/port/fct/discovery.c
          +++ new/usr/src/uts/common/io/comstar/port/fct/discovery.c
↓ open down ↓ 930 lines elided ↑ open up ↑
 931  931                          goto start_els_posting;
 932  932                  }
 933  933  
 934  934                  /* A PLOGI is by default a logout of previous session */
 935  935                  irp->irp_deregister_timer = ddi_get_lbolt() +
 936  936                      drv_usectohz(USEC_DEREG_RP_TIMEOUT);
 937  937                  irp->irp_dereg_count = 0;
 938  938                  fct_post_to_discovery_queue(iport, irp, NULL);
 939  939  
 940  940                  /* A PLOGI also invalidates any RSCNs related to this rp */
 941      -                atomic_add_32(&irp->irp_rscn_counter, 1);
      941 +                atomic_inc_32(&irp->irp_rscn_counter);
 942  942          } else {
 943  943                  /*
 944  944                   * For everything else, we have (or be able to lookup) a
 945  945                   * valid port pointer.
 946  946                   */
 947  947                  if (irp == NULL) {
 948  948                          rw_exit(&iport->iport_lock);
 949  949                          if (cmd->cmd_type == FCT_CMD_RCVD_ELS) {
 950  950                                  /* XXX Throw a logout to the initiator */
 951  951                                  stmf_trace(iport->iport_alias, "ELS %x "
↓ open down ↓ 24 lines elided ↑ open up ↑
 976  976                              FCT_NO_XCHG_RESOURCE);
 977  977                          return;
 978  978                  }
 979  979          } else {
 980  980                  /*
 981  981                   * Tell the framework that fct_cmd_free() can decrement the
 982  982                   * irp_nonfcp_xchg_count variable.
 983  983                   */
 984  984                  atomic_or_32(&icmd->icmd_flags, ICMD_IMPLICIT_CMD_HAS_RESOURCE);
 985  985          }
 986      -        atomic_add_16(&irp->irp_nonfcp_xchg_count, 1);
      986 +        atomic_inc_16(&irp->irp_nonfcp_xchg_count);
 987  987  
 988  988          /*
 989  989           * Grab the remote port lock while we modify the port state.
 990  990           * we should not drop the fca port lock (as a reader) until we
 991  991           * modify the remote port state.
 992  992           */
 993  993          rw_enter(&irp->irp_lock, RW_WRITER);
 994  994          if ((op == ELS_OP_PLOGI) || (op == ELS_OP_PRLI) ||
 995  995              (op == ELS_OP_LOGO) || (op == ELS_OP_PRLO) ||
 996  996              (op == ELS_OP_TPRLO)) {
 997  997                  uint32_t rf = IRP_PRLI_DONE;
 998  998                  if ((op == ELS_OP_PLOGI) || (op == ELS_OP_LOGO)) {
 999  999                          rf |= IRP_PLOGI_DONE;
1000 1000                          if (irp->irp_flags & IRP_PLOGI_DONE)
1001      -                                atomic_add_32(&iport->iport_nrps_login, -1);
     1001 +                                atomic_dec_32(&iport->iport_nrps_login);
1002 1002                  }
1003      -                atomic_add_16(&irp->irp_sa_elses_count, 1);
     1003 +                atomic_inc_16(&irp->irp_sa_elses_count);
1004 1004                  atomic_and_32(&irp->irp_flags, ~rf);
1005 1005                  atomic_or_32(&icmd->icmd_flags, ICMD_SESSION_AFFECTING);
1006 1006          } else {
1007      -                atomic_add_16(&irp->irp_nsa_elses_count, 1);
     1007 +                atomic_inc_16(&irp->irp_nsa_elses_count);
1008 1008          }
1009 1009  
1010 1010          fct_post_to_discovery_queue(iport, irp, icmd);
1011 1011  
1012 1012          rw_exit(&irp->irp_lock);
1013 1013          rw_exit(&iport->iport_lock);
1014 1014  }
1015 1015  
1016 1016  /*
1017 1017   * Cleanup I/Os for a rport. ttc is a bit Mask of cmd types to clean.
↓ open down ↓ 135 lines elided ↑ open up ↑
1153 1153                              "handles are used up", rp->rp_id);
1154 1154                          goto hba_fatal_err;
1155 1155                  }
1156 1156                  rp->rp_handle = i;
1157 1157          }
1158 1158          /* By this time rport_handle is valid */
1159 1159          if ((irp->irp_flags & IRP_HANDLE_OPENED) == 0) {
1160 1160                  iport->iport_rp_slots[rp->rp_handle] = irp;
1161 1161                  atomic_or_32(&irp->irp_flags, IRP_HANDLE_OPENED);
1162 1162          }
1163      -        (void) atomic_add_64_nv(&iport->iport_last_change, 1);
     1163 +        (void) atomic_inc_64_nv(&iport->iport_last_change);
1164 1164          fct_log_remote_port_event(port, ESC_SUNFC_TARGET_ADD,
1165 1165              rp->rp_pwwn, rp->rp_id);
1166 1166  
1167 1167  register_rp_done:;
1168 1168          rw_exit(&irp->irp_lock);
1169 1169          rw_exit(&iport->iport_lock);
1170 1170          return (FCT_SUCCESS);
1171 1171  
1172 1172  hba_fatal_err:;
1173 1173          rw_exit(&irp->irp_lock);
↓ open down ↓ 24 lines elided ↑ open up ↑
1198 1198  
1199 1199          if ((ret = port->port_deregister_remote_port(port, rp)) !=
1200 1200              FCT_SUCCESS) {
1201 1201                  return (ret);
1202 1202          }
1203 1203  
1204 1204          if (irp->irp_flags & IRP_HANDLE_OPENED) {
1205 1205                  atomic_and_32(&irp->irp_flags, ~IRP_HANDLE_OPENED);
1206 1206                  iport->iport_rp_slots[rp->rp_handle] = NULL;
1207 1207          }
1208      -        (void) atomic_add_64_nv(&iport->iport_last_change, 1);
     1208 +        (void) atomic_inc_64_nv(&iport->iport_last_change);
1209 1209          fct_log_remote_port_event(port, ESC_SUNFC_TARGET_REMOVE,
1210 1210              rp->rp_pwwn, rp->rp_id);
1211 1211  
1212 1212          return (FCT_SUCCESS);
1213 1213  }
1214 1214  
1215 1215  fct_status_t
1216 1216  fct_send_accrjt(fct_cmd_t *cmd, uint8_t accrjt, uint8_t reason, uint8_t expl)
1217 1217  {
1218 1218          fct_local_port_t *port = (fct_local_port_t *)cmd->cmd_port;
↓ open down ↓ 285 lines elided ↑ open up ↑
1504 1504                          atomic_or_32(&icmd->icmd_flags, ICMD_KNOWN_TO_FCA);
1505 1505                          ret = port->port_send_cmd(cmd);
1506 1506                          if (ret != FCT_SUCCESS) {
1507 1507                                  atomic_and_32(&icmd->icmd_flags,
1508 1508                                      ~ICMD_KNOWN_TO_FCA);
1509 1509                                  atomic_and_32(&irp->irp_flags,
1510 1510                                      ~IRP_SOL_PLOGI_IN_PROGRESS);
1511 1511                          }
1512 1512                  }
1513 1513          }
1514      -        atomic_add_16(&irp->irp_sa_elses_count, -1);
     1514 +        atomic_dec_16(&irp->irp_sa_elses_count);
1515 1515  
1516 1516          if (ret == FCT_SUCCESS) {
1517 1517                  if (cmd_type == FCT_CMD_RCVD_ELS) {
1518 1518                          atomic_or_32(&irp->irp_flags, IRP_PLOGI_DONE);
1519      -                        atomic_add_32(&iport->iport_nrps_login, 1);
     1519 +                        atomic_inc_32(&iport->iport_nrps_login);
1520 1520                          if (irp->irp_deregister_timer)
1521 1521                                  irp->irp_deregister_timer = 0;
1522 1522                  }
1523 1523                  if (icmd_flags & ICMD_IMPLICIT) {
1524 1524                          DTRACE_FC_5(rport__login__end,
1525 1525                              fct_cmd_t, cmd,
1526 1526                              fct_local_port_t, port,
1527 1527                              fct_i_remote_port_t, irp,
1528 1528                              int, (cmd_type != FCT_CMD_RCVD_ELS),
1529 1529                              int, FCT_SUCCESS);
↓ open down ↓ 60 lines elided ↑ open up ↑
1590 1590                  if (els->els_req_payload[4] != 0x08)
1591 1591                          stmf_trace(iport->iport_alias, "PRLI received from"
1592 1592                              " %x for unknown FC-4 type %x", cmd->cmd_rportid,
1593 1593                              els->els_req_payload[4]);
1594 1594                  else
1595 1595                          stmf_trace(iport->iport_alias, "Rejecting PRLI from %x "
1596 1596                              " pld sz %d, prli_flags %x", cmd->cmd_rportid,
1597 1597                              els->els_req_size, els->els_req_payload[6]);
1598 1598  
1599 1599                  fct_dequeue_els(irp);
1600      -                atomic_add_16(&irp->irp_sa_elses_count, -1);
     1600 +                atomic_dec_16(&irp->irp_sa_elses_count);
1601 1601                  ret = fct_send_accrjt(cmd, ELS_OP_LSRJT, 3, 0x2c);
1602 1602                  goto prli_end;
1603 1603          }
1604 1604  
1605 1605          if (irp->irp_fcp_xchg_count) {
1606 1606                  /* Trigger cleanup if necessary */
1607 1607                  if ((irp->irp_flags & IRP_FCP_CLEANUP) == 0) {
1608 1608                          stmf_trace(iport->iport_alias, "handling PRLI from"
1609 1609                              " %x. Triggering cleanup", cmd->cmd_rportid);
1610 1610                          if (fct_trigger_rport_cleanup(irp, FCT_CMD_FCP_XCHG)) {
↓ open down ↓ 53 lines elided ↑ open up ↑
1664 1664                           * The reason IRP_SCSI_SESSION_STARTED is different
1665 1665                           * from IRP_PRLI_DONE is that we clear IRP_PRLI_DONE
1666 1666                           * inside interrupt context. We dont want to deregister
1667 1667                           * the session from an interrupt.
1668 1668                           */
1669 1669                          atomic_or_32(&irp->irp_flags, IRP_SCSI_SESSION_STARTED);
1670 1670                  }
1671 1671          }
1672 1672  
1673 1673          fct_dequeue_els(irp);
1674      -        atomic_add_16(&irp->irp_sa_elses_count, -1);
     1674 +        atomic_dec_16(&irp->irp_sa_elses_count);
1675 1675          if (ses == NULL) {
1676 1676                  /* fail PRLI */
1677 1677                  ret = fct_send_accrjt(cmd, ELS_OP_LSRJT, 3, 0);
1678 1678          } else {
1679 1679                  /* accept PRLI */
1680 1680                  els->els_resp_payload = (uint8_t *)kmem_zalloc(20, KM_SLEEP);
1681 1681                  bcopy(fct_prli_temp, els->els_resp_payload, 20);
1682 1682                  els->els_resp_payload[0] = 2;
1683 1683                  els->els_resp_payload[6] = 0x21;
1684 1684  
↓ open down ↓ 83 lines elided ↑ open up ↑
1768 1768          /* Session can only be terminated after all the I/Os have drained */
1769 1769          if (irp->irp_flags & IRP_SCSI_SESSION_STARTED) {
1770 1770                  stmf_deregister_scsi_session(iport->iport_port->port_lport,
1771 1771                      irp->irp_session);
1772 1772                  stmf_free(irp->irp_session);
1773 1773                  irp->irp_session = NULL;
1774 1774                  atomic_and_32(&irp->irp_flags, ~IRP_SCSI_SESSION_STARTED);
1775 1775          }
1776 1776  
1777 1777          fct_dequeue_els(irp);
1778      -        atomic_add_16(&irp->irp_sa_elses_count, -1);
     1778 +        atomic_dec_16(&irp->irp_sa_elses_count);
1779 1779  
1780 1780          /* don't send response if this is an implicit logout cmd */
1781 1781          if (!(icmd->icmd_flags & ICMD_IMPLICIT)) {
1782 1782                  if (cmd->cmd_type == FCT_CMD_RCVD_ELS) {
1783 1783                          ret = fct_send_accrjt(cmd, ELS_OP_ACC, 0, 0);
1784 1784                  } else {
1785 1785                          atomic_or_32(&icmd->icmd_flags, ICMD_KNOWN_TO_FCA);
1786 1786                          ret = port->port_send_cmd(cmd);
1787 1787                          if (ret != FCT_SUCCESS) {
1788 1788                                  atomic_and_32(&icmd->icmd_flags,
↓ open down ↓ 90 lines elided ↑ open up ↑
1879 1879          /* Session can only be terminated after all the I/Os have drained */
1880 1880          if (irp->irp_flags & IRP_SCSI_SESSION_STARTED) {
1881 1881                  stmf_deregister_scsi_session(iport->iport_port->port_lport,
1882 1882                      irp->irp_session);
1883 1883                  stmf_free(irp->irp_session);
1884 1884                  irp->irp_session = NULL;
1885 1885                  atomic_and_32(&irp->irp_flags, ~IRP_SCSI_SESSION_STARTED);
1886 1886          }
1887 1887  
1888 1888          fct_dequeue_els(irp);
1889      -        atomic_add_16(&irp->irp_sa_elses_count, -1);
     1889 +        atomic_dec_16(&irp->irp_sa_elses_count);
1890 1890          ret = fct_send_accrjt(cmd, ELS_OP_ACC, 0, 0);
1891 1891          if (ret != FCT_SUCCESS)
1892 1892                  fct_queue_cmd_for_termination(cmd, ret);
1893 1893  
1894 1894          return (DISC_ACTION_RESCAN);
1895 1895  }
1896 1896  
1897 1897  disc_action_t
1898 1898  fct_process_rcvd_adisc(fct_i_cmd_t *icmd)
1899 1899  {
↓ open down ↓ 4 lines elided ↑ open up ↑
1904 1904              port->port_fct_private;
1905 1905          fct_els_t               *els = (fct_els_t *)
1906 1906              cmd->cmd_specific;
1907 1907          fct_i_remote_port_t     *irp = (fct_i_remote_port_t *)
1908 1908              rp->rp_fct_private;
1909 1909          uint8_t                 *p;
1910 1910          uint32_t                *q;
1911 1911          fct_status_t            ret;
1912 1912  
1913 1913          fct_dequeue_els(irp);
1914      -        atomic_add_16(&irp->irp_nsa_elses_count, -1);
     1914 +        atomic_dec_16(&irp->irp_nsa_elses_count);
1915 1915  
1916 1916          /* Validate the adisc request */
1917 1917          p = els->els_req_payload;
1918 1918          q = (uint32_t *)p;
1919 1919          if ((els->els_req_size != 28) || (bcmp(rp->rp_pwwn, p + 8, 8)) ||
1920 1920              (bcmp(rp->rp_nwwn, p + 16, 8))) {
1921 1921                  ret = fct_send_accrjt(cmd, ELS_OP_LSRJT, 3, 0);
1922 1922          } else {
1923 1923                  rp->rp_hard_address = BE_32(q[1]);
1924 1924                  els->els_resp_size = els->els_resp_alloc_size = 28;
↓ open down ↓ 17 lines elided ↑ open up ↑
1942 1942  
1943 1943  disc_action_t
1944 1944  fct_process_unknown_els(fct_i_cmd_t *icmd)
1945 1945  {
1946 1946          fct_i_local_port_t      *iport = ICMD_TO_IPORT(icmd);
1947 1947          fct_status_t             ret   = FCT_FAILURE;
1948 1948          uint8_t                  op    = 0;
1949 1949  
1950 1950          ASSERT(icmd->icmd_cmd->cmd_type == FCT_CMD_RCVD_ELS);
1951 1951          fct_dequeue_els(ICMD_TO_IRP(icmd));
1952      -        atomic_add_16(&ICMD_TO_IRP(icmd)->irp_nsa_elses_count, -1);
     1952 +        atomic_dec_16(&ICMD_TO_IRP(icmd)->irp_nsa_elses_count);
1953 1953          op = ICMD_TO_ELS(icmd)->els_req_payload[0];
1954 1954          stmf_trace(iport->iport_alias, "Rejecting unknown unsol els %x (%s)",
1955 1955              op, FCT_ELS_NAME(op));
1956 1956          ret = fct_send_accrjt(icmd->icmd_cmd, ELS_OP_LSRJT, 1, 0);
1957 1957          if (ret != FCT_SUCCESS) {
1958 1958                  fct_queue_cmd_for_termination(icmd->icmd_cmd, ret);
1959 1959          }
1960 1960  
1961 1961          return (DISC_ACTION_RESCAN);
1962 1962  }
↓ open down ↓ 1 lines elided ↑ open up ↑
1964 1964  disc_action_t
1965 1965  fct_process_rscn(fct_i_cmd_t *icmd)
1966 1966  {
1967 1967          fct_i_local_port_t      *iport = ICMD_TO_IPORT(icmd);
1968 1968          fct_status_t             ret   = FCT_FAILURE;
1969 1969          uint8_t                  op    = 0;
1970 1970          uint8_t                 *rscn_req_payload;
1971 1971          uint32_t                 rscn_req_size;
1972 1972  
1973 1973          fct_dequeue_els(ICMD_TO_IRP(icmd));
1974      -        atomic_add_16(&ICMD_TO_IRP(icmd)->irp_nsa_elses_count, -1);
     1974 +        atomic_dec_16(&ICMD_TO_IRP(icmd)->irp_nsa_elses_count);
1975 1975          if (icmd->icmd_cmd->cmd_type == FCT_CMD_RCVD_ELS) {
1976 1976                  op = ICMD_TO_ELS(icmd)->els_req_payload[0];
1977 1977                  stmf_trace(iport->iport_alias, "Accepting RSCN %x (%s)",
1978 1978                      op, FCT_ELS_NAME(op));
1979 1979                  rscn_req_size = ICMD_TO_ELS(icmd)->els_req_size;
1980 1980                  rscn_req_payload = kmem_alloc(rscn_req_size, KM_SLEEP);
1981 1981                  bcopy(ICMD_TO_ELS(icmd)->els_req_payload, rscn_req_payload,
1982 1982                      rscn_req_size);
1983 1983                  ret = fct_send_accrjt(icmd->icmd_cmd, ELS_OP_ACC, 1, 0);
1984 1984                  if (ret != FCT_SUCCESS) {
↓ open down ↓ 76 lines elided ↑ open up ↑
2061 2061                      (special_prli_cond == 0)) {
2062 2062                          stmf_trace(iport->iport_alias, "Killing ELS %x cond 3",
2063 2063                              els->els_req_payload[0]);
2064 2064                          dq = 1;
2065 2065                  }
2066 2066  
2067 2067                  if (dq) {
2068 2068                          fct_i_cmd_t *c = (*ppcmd)->icmd_next;
2069 2069  
2070 2070                          if ((*ppcmd)->icmd_flags & ICMD_SESSION_AFFECTING)
2071      -                                atomic_add_16(&irp->irp_sa_elses_count, -1);
     2071 +                                atomic_dec_16(&irp->irp_sa_elses_count);
2072 2072                          else
2073      -                                atomic_add_16(&irp->irp_nsa_elses_count, -1);
     2073 +                                atomic_dec_16(&irp->irp_nsa_elses_count);
2074 2074                          (*ppcmd)->icmd_next = cmd_to_abort;
2075 2075                          cmd_to_abort = *ppcmd;
2076 2076                          *ppcmd = c;
2077 2077                  } else {
2078 2078                          ppcmd = &((*ppcmd)->icmd_next);
2079 2079                  }
2080 2080          }
2081 2081          rw_exit(&irp->irp_lock);
2082 2082  
2083 2083          while (cmd_to_abort) {
↓ open down ↓ 34 lines elided ↑ open up ↑
2118 2118                  ret |= fct_process_prli(icmd);
2119 2119          } else if (op == ELS_OP_LOGO) {
2120 2120                  ret |= fct_process_logo(icmd);
2121 2121          } else if ((op == ELS_OP_PRLO) || (op == ELS_OP_TPRLO)) {
2122 2122                  ret |= fct_process_prlo(icmd);
2123 2123          } else if (cmd->cmd_type == FCT_CMD_SOL_ELS) {
2124 2124                  fct_status_t s;
2125 2125                  fct_local_port_t *port = iport->iport_port;
2126 2126  
2127 2127                  fct_dequeue_els(irp);
2128      -                atomic_add_16(&irp->irp_nsa_elses_count, -1);
     2128 +                atomic_dec_16(&irp->irp_nsa_elses_count);
2129 2129                  atomic_or_32(&icmd->icmd_flags, ICMD_KNOWN_TO_FCA);
2130 2130                  if ((s = port->port_send_cmd(cmd)) != FCT_SUCCESS) {
2131 2131                          atomic_and_32(&icmd->icmd_flags, ~ICMD_KNOWN_TO_FCA);
2132 2132                          fct_queue_cmd_for_termination(cmd, s);
2133 2133                          stmf_trace(iport->iport_alias, "Solicited els "
2134 2134                              "transport failed, ret = %llx", s);
2135 2135                  }
2136 2136          } else if (op == ELS_OP_ADISC) {
2137 2137                  ret |= fct_process_rcvd_adisc(icmd);
2138 2138          } else if (op == ELS_OP_RSCN) {
↓ open down ↓ 33 lines elided ↑ open up ↑
2172 2172          }
2173 2173          if (icmd->icmd_cmd->cmd_rp &&
2174 2174              (icmd->icmd_cmd->cmd_comp_status == FCT_SUCCESS) &&
2175 2175              (els->els_req_payload[0] == ELS_OP_PLOGI)) {
2176 2176                  bcopy(els->els_resp_payload + 20, irp->irp_rp->rp_pwwn, 8);
2177 2177                  bcopy(els->els_resp_payload + 28, irp->irp_rp->rp_nwwn, 8);
2178 2178  
2179 2179                  stmf_wwn_to_devid_desc((scsi_devid_desc_t *)irp->irp_id,
2180 2180                      irp->irp_rp->rp_pwwn, PROTOCOL_FIBRE_CHANNEL);
2181 2181                  atomic_or_32(&irp->irp_flags, IRP_PLOGI_DONE);
2182      -                atomic_add_32(&iport->iport_nrps_login, 1);
     2182 +                atomic_inc_32(&iport->iport_nrps_login);
2183 2183                  if (irp->irp_deregister_timer) {
2184 2184                          irp->irp_deregister_timer = 0;
2185 2185                          irp->irp_dereg_count = 0;
2186 2186                  }
2187 2187          }
2188 2188  
2189 2189          if (irp && (els->els_req_payload[0] == ELS_OP_PLOGI)) {
2190 2190                  atomic_and_32(&irp->irp_flags, ~IRP_SOL_PLOGI_IN_PROGRESS);
2191 2191          }
2192 2192          atomic_or_32(&icmd->icmd_flags, ICMD_CMD_COMPLETE);
↓ open down ↓ 25 lines elided ↑ open up ↑
2218 2218          for (ndx = 0; ndx < num_to_release; ndx++) {
2219 2219                  mutex_enter(&iport->iport_cached_cmd_lock);
2220 2220                  icmd = iport->iport_cached_cmdlist;
2221 2221                  if (icmd == NULL) {
2222 2222                          mutex_exit(&iport->iport_cached_cmd_lock);
2223 2223                          break;
2224 2224                  }
2225 2225                  iport->iport_cached_cmdlist = icmd->icmd_next;
2226 2226                  iport->iport_cached_ncmds--;
2227 2227                  mutex_exit(&iport->iport_cached_cmd_lock);
2228      -                atomic_add_32(&iport->iport_total_alloced_ncmds, -1);
     2228 +                atomic_dec_32(&iport->iport_total_alloced_ncmds);
2229 2229                  fct_free(icmd->icmd_cmd);
2230 2230          }
2231 2231          mutex_enter(&iport->iport_worker_lock);
2232 2232          return (DISC_ACTION_RESCAN);
2233 2233  }
2234 2234  
2235 2235  /*
2236 2236   * The efficiency of handling solicited commands is very low here. But
2237 2237   * fortunately, we seldom send solicited commands. So it will not hurt
2238 2238   * the system performance much.
↓ open down ↓ 128 lines elided ↑ open up ↑
2367 2367  
2368 2368                  query_irp = fct_lookup_irp_by_portwwn(iport,
2369 2369                      ICMD_TO_CT(icmd)->ct_req_payload + 16);
2370 2370                  if (query_irp) {
2371 2371                          atomic_and_32(&query_irp->irp_flags, ~IRP_RSCN_QUEUED);
2372 2372                  }
2373 2373          }
2374 2374          rw_exit(&irp->irp_lock);
2375 2375          rw_exit(&iport->iport_lock);
2376 2376  
2377      -        atomic_add_16(&irp->irp_nonfcp_xchg_count, 1);
     2377 +        atomic_inc_16(&irp->irp_nonfcp_xchg_count);
2378 2378          atomic_or_32(&icmd->icmd_flags, ICMD_KNOWN_TO_FCA);
2379 2379          icmd->icmd_start_time = ddi_get_lbolt();
2380 2380          ret = iport->iport_port->port_send_cmd(cmd);
2381 2381          if (ret != FCT_SUCCESS) {
2382 2382                  atomic_and_32(&icmd->icmd_flags, ~ICMD_KNOWN_TO_FCA);
2383 2383                  fct_queue_cmd_for_termination(cmd, ret);
2384 2384          }
2385 2385  }
2386 2386  
2387 2387  void
↓ open down ↓ 368 lines elided ↑ open up ↑
2756 2756  
2757 2757  #ifdef  lint
2758 2758  #define FCT_VERIFY_RSCN()       _NOTE(EMPTY)
2759 2759  #else
2760 2760  #define FCT_VERIFY_RSCN()                                               \
2761 2761  do {                                                                    \
2762 2762          ct_cmd = fct_create_solct(port, irp->irp_rp, NS_GID_PN,         \
2763 2763              fct_gid_cb);                                                \
2764 2764          if (ct_cmd) {                                                   \
2765 2765                  uint32_t cnt;                                           \
2766      -                cnt = atomic_add_32_nv(&irp->irp_rscn_counter, 1);      \
     2766 +                cnt = atomic_inc_32_nv(&irp->irp_rscn_counter); \
2767 2767                  CMD_TO_ICMD(ct_cmd)->icmd_cb_private =                  \
2768 2768                      INT2PTR(cnt, void *);                               \
2769 2769                  irp->irp_flags |= IRP_RSCN_QUEUED;                      \
2770 2770                  fct_post_to_solcmd_queue(port, ct_cmd);                 \
2771 2771          }                                                               \
2772 2772  } while (0)
2773 2773  #endif
2774 2774  
2775 2775  /* ARGSUSED */
2776 2776  static void
↓ open down ↓ 70 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX