Print this page
5042 stop using deprecated atomic functions

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/inet/nca/nca.h
          +++ new/usr/src/uts/common/inet/nca/nca.h
↓ open down ↓ 687 lines elided ↑ open up ↑
 688  688  
 689  689  #define NODE_T_TRACE(p, a) {                                            \
 690  690          struct node_ts *_p;                                             \
 691  691          struct node_ts *_np;                                            \
 692  692          int    _ix;                                                     \
 693  693                                                                          \
 694  694          do {                                                            \
 695  695                  _p = node_tp;                                           \
 696  696                  if ((_np = _p + 1) == &node_tv[NODE_TV_SZ])             \
 697  697                          _np = node_tv;                                  \
 698      -        } while (casptr(&node_tp, _p, _np) != _p);                      \
      698 +        } while (atomic_cas_ptr(&node_tp, _p, _np) != _p);              \
 699  699          _p->node = (p);                                                 \
 700  700          _p->action = (a);                                               \
 701  701          _p->ref = (p) ? (p)->ref : 0;                                   \
 702  702          _p->cnt = (p) ? (p)->cnt : 0;                                   \
 703  703          _p->cpu = CPU->cpu_seqid;                                       \
 704  704          NODE_T_TRACE_STK();                                             \
 705  705  }
 706  706  
 707  707  #else   /* NODE_T_TRACE_ON */
 708  708  
↓ open down ↓ 69 lines elided ↑ open up ↑
 778  778          nca_conn_t *_cp = (io) ? (nca_conn_t *)(io)->cid : (nca_conn_t *)NULL; \
 779  779          node_t *_req_np = _cp ? _cp->req_np : (node_t *)NULL;           \
 780  780          struct door_ts *_p;                                             \
 781  781          struct door_ts *_np;                                            \
 782  782          int    _ix;                                                     \
 783  783                                                                          \
 784  784          do {                                                            \
 785  785                  _p = door_tp;                                           \
 786  786                  if ((_np = _p + 1) == &door_tv[DOOR_TV_SZ])             \
 787  787                          _np = door_tv;                                  \
 788      -        } while (casptr(&door_tp, _p, _np) != _p);                      \
      788 +        } while (atomic_cas_ptr(&door_tp, _p, _np) != _p);              \
 789  789          _p->cp = _cp;                                                   \
 790  790          _p->np = _req_np;                                               \
 791  791          _p->action = (a);                                               \
 792  792          _p->ref = _req_np ? _req_np->ref : 0;                           \
 793  793          if ((io)) {                                                     \
 794  794                  _p->state = ((io)->op == http_op ? 0x80000000 : 0) |    \
 795  795                              ((io)->more ? 0x40000000 : 0) |             \
 796  796                              ((io)->first ? 0x20000000 : 0) |            \
 797  797                              ((io)->advisory ? 0x10000000 : 0) |         \
 798  798                              ((io)->nocache ? 0x08000000 : 0) |          \
↓ open down ↓ 181 lines elided ↑ open up ↑
 980  980                  for (cpu = 0; cpu < max_ncpus; cpu++) {                 \
 981  981                          int new;                                        \
 982  982                          uint32_t *rp = &nca_gv[cpu].dcb_readers;        \
 983  983                          int old = *rp;                                  \
 984  984                                                                          \
 985  985                          if (old & DCB_COUNT_USELOCK) {                  \
 986  986                                  readers += old & DCB_COUNT_MASK;        \
 987  987                                  continue;                               \
 988  988                          }                                               \
 989  989                          new = old | DCB_COUNT_USELOCK;                  \
 990      -                        while (cas32(rp, old, new) != old) {            \
      990 +                        while (atomic_cas_32(rp, old, new) != old) {    \
 991  991                                  old = *rp;                              \
 992  992                                  new = old | DCB_COUNT_USELOCK;          \
 993  993                          }                                               \
 994  994                          readers += (new & DCB_COUNT_MASK);              \
 995  995                  }                                                       \
 996  996                  if (readers == 0)                                       \
 997  997                          break;                                          \
 998  998                  cv_wait(&nca_dcb_wait, &nca_dcb_lock);                  \
 999  999          }                                                               \
1000 1000          mutex_exit(&nca_dcb_lock);                                      \
↓ open down ↓ 2 lines elided ↑ open up ↑
1003 1003  #define DCB_WR_EXIT() {                                                 \
1004 1004          int cpu;                                                        \
1005 1005                                                                          \
1006 1006          mutex_enter(&nca_dcb_lock);                                     \
1007 1007          for (cpu = 0; cpu < max_ncpus; cpu++) {                         \
1008 1008                  int new;                                                \
1009 1009                  uint32_t *rp = &nca_gv[cpu].dcb_readers;                \
1010 1010                  int old = *rp;                                          \
1011 1011                                                                          \
1012 1012                  new = old & ~DCB_COUNT_USELOCK;                         \
1013      -                while (cas32(rp, old, new) != old) {                    \
     1013 +                while (atomic_cas_32(rp, old, new) != old) {            \
1014 1014                          old = *rp;                                      \
1015 1015                          new = old & ~DCB_COUNT_USELOCK;                 \
1016 1016                  }                                                       \
1017 1017          }                                                               \
1018 1018          mutex_exit(&nca_dcb_lock);                                      \
1019 1019          mutex_exit(&nca_dcb_readers);                                   \
1020 1020  }
1021 1021  
1022 1022  typedef struct nca_door_s {
1023 1023          door_handle_t   handle;         /* The door handle */
↓ open down ↓ 512 lines elided ↑ open up ↑
1536 1536  
1537 1537  #define NCA_CONN_T_TRACE(p, a) {                                        \
1538 1538          struct conn_ts *_p;                                             \
1539 1539          struct conn_ts *_np;                                            \
1540 1540          int    _ix;                                                     \
1541 1541                                                                          \
1542 1542          do {                                                            \
1543 1543                  _p = conn_tp;                                   \
1544 1544                  if ((_np = _p + 1) == &con_tv[CON_TV_SZ])       \
1545 1545                          _np = con_tv;                           \
1546      -        } while (casptr(&conn_tp, _p, _np) != _p);                      \
     1546 +        } while (atomic_cas_ptr(&conn_tp, _p, _np) != _p);              \
1547 1547          _p->conn = (p);                                                 \
1548 1548          _p->action = (a);                                               \
1549 1549          _p->ref = (p)->ref;                                             \
1550 1550          _p->cpu = CPU->cpu_seqid;                                       \
1551 1551          NCA_CONN_T_TRACE_STK();                                         \
1552 1552  }
1553 1553  
1554 1554  #else   /* NCA_CONN_T_TRACE_ON */
1555 1555  
1556 1556  #define NCA_CONN_T_TRACE(p, a)
↓ open down ↓ 201 lines elided ↑ open up ↑
1758 1758          unsigned long   _nv;                                            \
1759 1759          nca_counter_t   *_otp;                                          \
1760 1760          nca_counter_t   *_ntp;                                          \
1761 1761                                                                          \
1762 1762          _nv = atomic_add_long_nv(p, v);                                 \
1763 1763          do {                                                            \
1764 1764                  _otp = nca_counter_tp;                                  \
1765 1765                  _ntp = _otp + 1;                                        \
1766 1766                  if (_ntp == &nca_counter_tv[NCA_COUNTER_TRACE_SZ])      \
1767 1767                          _ntp = nca_counter_tv;                          \
1768      -        } while (casptr((void *)&nca_counter_tp, (void *)_otp,          \
     1768 +        } while (atomic_cas_ptr((void *)&nca_counter_tp, (void *)_otp,  \
1769 1769              (void *)_ntp) != (void *)_otp);                             \
1770 1770          _ntp->t = gethrtime();                                          \
1771 1771          _ntp->p = p;                                                    \
1772 1772          _ntp->v = v;                                                    \
1773 1773          _ntp->nv = _nv;                                                 \
1774 1774  }
1775 1775  
1776 1776  #else   /* NCA_COUNTER_TRACE */
1777 1777  
1778 1778  #define NCA_COUNTER(p, v) atomic_add_long((p), (v))
↓ open down ↓ 369 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX