Print this page
OS-4018 lxbrand support TCP SO_REUSEPORT
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Cody Mello <cody.mello@joyent.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/inet/tcp_impl.h
          +++ new/usr/src/uts/common/inet/tcp_impl.h
↓ open down ↓ 398 lines elided ↑ open up ↑
 399  399   * tlc_drop stores the number of connection attempt dropped because the
 400  400   * limit has reached.
 401  401   */
 402  402  typedef struct tcp_listen_cnt_s {
 403  403          uint32_t        tlc_max;
 404  404          uint32_t        tlc_cnt;
 405  405          int64_t         tlc_report_time;
 406  406          uint32_t        tlc_drop;
 407  407  } tcp_listen_cnt_t;
 408  408  
      409 +/*
      410 + * Track tcp_t entities bound to the same port/address tuple via SO_REUSEPORT.
      411 + * - tcprg_lock:        Protects the other fields
      412 + * - tcprg_size:        Allocated size (in entries) of tcprg_members array
      413 + * - tcprg_count:       Count of occupied tcprg_members slots
      414 + * - tcprg_active:      Count of members which still have SO_REUSEPORT set
      415 + * - tcprg_members:     Connections associated with address/port group
      416 + */
      417 +typedef struct tcp_rg_s {
      418 +        kmutex_t        tcprg_lock;
      419 +        unsigned int    tcprg_size;
      420 +        unsigned int    tcprg_count;
      421 +        unsigned int    tcprg_active;
      422 +        tcp_t           **tcprg_members;
      423 +} tcp_rg_t;
      424 +
 409  425  #define TCP_TLC_REPORT_INTERVAL (30 * MINUTES)
 410  426  
 411  427  #define TCP_DECR_LISTEN_CNT(tcp)                                        \
 412  428  {                                                                       \
 413  429          ASSERT((tcp)->tcp_listen_cnt->tlc_cnt > 0);                     \
 414  430          if (atomic_dec_32_nv(&(tcp)->tcp_listen_cnt->tlc_cnt) == 0) \
 415  431                  kmem_free((tcp)->tcp_listen_cnt, sizeof (tcp_listen_cnt_t)); \
 416  432          (tcp)->tcp_listen_cnt = NULL;                                   \
 417  433  }
 418  434  
↓ open down ↓ 223 lines elided ↑ open up ↑
 642  658   * Bind related functions in tcp_bind.c
 643  659   */
 644  660  extern int      tcp_bind_check(conn_t *, struct sockaddr *, socklen_t,
 645  661                      cred_t *, boolean_t);
 646  662  extern void     tcp_bind_hash_insert(tf_t *, tcp_t *, int);
 647  663  extern void     tcp_bind_hash_remove(tcp_t *);
 648  664  extern in_port_t        tcp_bindi(tcp_t *, in_port_t, const in6_addr_t *,
 649  665                              int, boolean_t, boolean_t, boolean_t);
 650  666  extern in_port_t        tcp_update_next_port(in_port_t, const tcp_t *,
 651  667                              boolean_t);
      668 +extern tcp_rg_t *tcp_rg_init(tcp_t *);
      669 +extern boolean_t tcp_rg_remove(tcp_rg_t *, tcp_t *);
      670 +extern void tcp_rg_destroy(tcp_rg_t *);
      671 +extern void tcp_rg_setactive(tcp_rg_t *, boolean_t);
 652  672  
 653  673  /*
 654  674   * Fusion related functions in tcp_fusion.c.
 655  675   */
 656  676  extern void     tcp_fuse(tcp_t *, uchar_t *, tcpha_t *);
 657  677  extern void     tcp_unfuse(tcp_t *);
 658  678  extern boolean_t tcp_fuse_output(tcp_t *, mblk_t *, uint32_t);
 659  679  extern void     tcp_fuse_output_urg(tcp_t *, mblk_t *);
 660  680  extern boolean_t tcp_fuse_rcv_drain(queue_t *, tcp_t *, mblk_t **);
 661  681  extern size_t   tcp_fuse_set_rcv_hiwat(tcp_t *, size_t);
↓ open down ↓ 120 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX