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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/sys/aggr_impl.h
          +++ new/usr/src/uts/common/sys/aggr_impl.h
↓ open down ↓ 226 lines elided ↑ open up ↑
 227  227           * The following fields are used by aggr to wait for all the
 228  228           * aggr_port_notify_cb() and aggr_port_timer_thread() to finish
 229  229           * before it calls mac_unregister() when the aggr is deleted.
 230  230           */
 231  231          kmutex_t        lg_port_lock;
 232  232          kcondvar_t      lg_port_cv;
 233  233          int             lg_port_ref;
 234  234  } aggr_grp_t;
 235  235  
 236  236  #define AGGR_GRP_REFHOLD(grp) {                 \
 237      -        atomic_add_32(&(grp)->lg_refs, 1);      \
      237 +        atomic_inc_32(&(grp)->lg_refs); \
 238  238          ASSERT((grp)->lg_refs != 0);            \
 239  239  }
 240  240  
 241  241  #define AGGR_GRP_REFRELE(grp) {                                 \
 242  242          ASSERT((grp)->lg_refs != 0);                            \
 243  243          membar_exit();                                          \
 244      -        if (atomic_add_32_nv(&(grp)->lg_refs, -1) == 0)         \
      244 +        if (atomic_dec_32_nv(&(grp)->lg_refs) == 0)             \
 245  245                  aggr_grp_free(grp);                             \
 246  246  }
 247  247  
 248  248  #define AGGR_PORT_REFHOLD(port) {               \
 249      -        atomic_add_32(&(port)->lp_refs, 1);     \
      249 +        atomic_inc_32(&(port)->lp_refs);        \
 250  250          ASSERT((port)->lp_refs != 0);           \
 251  251  }
 252  252  
 253  253  #define AGGR_PORT_REFRELE(port) {                               \
 254  254          ASSERT((port)->lp_refs != 0);                           \
 255  255          membar_exit();                                          \
 256      -        if (atomic_add_32_nv(&(port)->lp_refs, -1) == 0)        \
      256 +        if (atomic_dec_32_nv(&(port)->lp_refs) == 0)    \
 257  257                  aggr_port_free(port);                           \
 258  258  }
 259  259  
 260  260  extern dev_info_t *aggr_dip;
 261  261  extern int aggr_ioc_init(void);
 262  262  extern void aggr_ioc_fini(void);
 263  263  
 264  264  typedef int (*aggr_grp_info_new_grp_fn_t)(void *, datalink_id_t, uint32_t,
 265  265      uchar_t *, boolean_t, boolean_t, uint32_t, uint32_t, aggr_lacp_mode_t,
 266  266      aggr_lacp_timer_t);
↓ open down ↓ 84 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX