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


 354  *
 355  * tlc_report_time stores the time when cmn_err() is called to report that the
 356  * max has been exceeeded.  Report is done at most once every
 357  * TCP_TLC_REPORT_INTERVAL mins for a listener.
 358  *
 359  * tlc_drop stores the number of connection attempt dropped because the
 360  * limit has reached.
 361  */
 362 typedef struct tcp_listen_cnt_s {
 363         uint32_t        tlc_max;
 364         uint32_t        tlc_cnt;
 365         int64_t         tlc_report_time;
 366         uint32_t        tlc_drop;
 367 } tcp_listen_cnt_t;
 368 
 369 #define TCP_TLC_REPORT_INTERVAL (30 * MINUTES)
 370 
 371 #define TCP_DECR_LISTEN_CNT(tcp)                                        \
 372 {                                                                       \
 373         ASSERT((tcp)->tcp_listen_cnt->tlc_cnt > 0);                    \
 374         if (atomic_add_32_nv(&(tcp)->tcp_listen_cnt->tlc_cnt, -1) == 0) \
 375                 kmem_free((tcp)->tcp_listen_cnt, sizeof (tcp_listen_cnt_t)); \
 376         (tcp)->tcp_listen_cnt = NULL;                                        \
 377 }
 378 
 379 /* Increment and decrement the number of connections in tcp_stack_t. */
 380 #define TCPS_CONN_INC(tcps)                                             \
 381         atomic_inc_64(                                                  \
 382             (uint64_t *)&(tcps)->tcps_sc[CPU->cpu_seqid]->tcp_sc_conn_cnt)
 383 
 384 #define TCPS_CONN_DEC(tcps)                                             \
 385         atomic_dec_64(                                                  \
 386             (uint64_t *)&(tcps)->tcps_sc[CPU->cpu_seqid]->tcp_sc_conn_cnt)
 387 
 388 /*
 389  * When the system is under memory pressure, stack variable tcps_reclaim is
 390  * true, we shorten the connection timeout abort interval to tcp_early_abort
 391  * seconds.  Defined in tcp.c.
 392  */
 393 extern uint32_t tcp_early_abort;
 394 




 354  *
 355  * tlc_report_time stores the time when cmn_err() is called to report that the
 356  * max has been exceeeded.  Report is done at most once every
 357  * TCP_TLC_REPORT_INTERVAL mins for a listener.
 358  *
 359  * tlc_drop stores the number of connection attempt dropped because the
 360  * limit has reached.
 361  */
 362 typedef struct tcp_listen_cnt_s {
 363         uint32_t        tlc_max;
 364         uint32_t        tlc_cnt;
 365         int64_t         tlc_report_time;
 366         uint32_t        tlc_drop;
 367 } tcp_listen_cnt_t;
 368 
 369 #define TCP_TLC_REPORT_INTERVAL (30 * MINUTES)
 370 
 371 #define TCP_DECR_LISTEN_CNT(tcp)                                        \
 372 {                                                                       \
 373         ASSERT((tcp)->tcp_listen_cnt->tlc_cnt > 0);                    \
 374         if (atomic_dec_32_nv(&(tcp)->tcp_listen_cnt->tlc_cnt) == 0) \
 375                 kmem_free((tcp)->tcp_listen_cnt, sizeof (tcp_listen_cnt_t)); \
 376         (tcp)->tcp_listen_cnt = NULL;                                        \
 377 }
 378 
 379 /* Increment and decrement the number of connections in tcp_stack_t. */
 380 #define TCPS_CONN_INC(tcps)                                             \
 381         atomic_inc_64(                                                  \
 382             (uint64_t *)&(tcps)->tcps_sc[CPU->cpu_seqid]->tcp_sc_conn_cnt)
 383 
 384 #define TCPS_CONN_DEC(tcps)                                             \
 385         atomic_dec_64(                                                  \
 386             (uint64_t *)&(tcps)->tcps_sc[CPU->cpu_seqid]->tcp_sc_conn_cnt)
 387 
 388 /*
 389  * When the system is under memory pressure, stack variable tcps_reclaim is
 390  * true, we shorten the connection timeout abort interval to tcp_early_abort
 391  * seconds.  Defined in tcp.c.
 392  */
 393 extern uint32_t tcp_early_abort;
 394