Print this page
916 False-sharing in TCP hash buckets, plus size increase
        (originally Joyent OS-299 tcp_bindi() hash lock contention affects
        TCP client performance)


   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.

  23  */
  24 
  25 #ifndef _INET_TCP_IMPL_H
  26 #define _INET_TCP_IMPL_H
  27 
  28 /*
  29  * TCP implementation private declarations.  These interfaces are
  30  * used to build the IP module and are not meant to be accessed
  31  * by any modules except IP itself.  They are undocumented and are
  32  * subject to change without notice.
  33  */
  34 
  35 #ifdef  __cplusplus
  36 extern "C" {
  37 #endif
  38 
  39 #ifdef _KERNEL
  40 
  41 #include <sys/cpuvar.h>
  42 #include <sys/clock_impl.h>       /* For LBOLT_FASTPATH{,64} */
  43 #include <inet/optcom.h>
  44 #include <inet/tcp.h>
  45 #include <inet/tunables.h>
  46 
  47 #define TCP_MOD_ID      5105
  48 
  49 extern struct qinit     tcp_sock_winit;
  50 extern struct qinit     tcp_winit;
  51 
  52 extern sock_downcalls_t sock_tcp_downcalls;
  53 
  54 /*
  55  * Bind hash list size and has function.  It has to be a power of 2 for
  56  * hashing.
  57  */
  58 #define TCP_BIND_FANOUT_SIZE    512
  59 #define TCP_BIND_HASH(lport) (ntohs(lport) & (TCP_BIND_FANOUT_SIZE - 1))
  60 
  61 /*
  62  * This implementation follows the 4.3BSD interpretation of the urgent
  63  * pointer and not RFC 1122. Switching to RFC 1122 behavior would cause
  64  * incompatible changes in protocols like telnet and rlogin.
  65  */
  66 #define TCP_OLD_URP_INTERPRETATION      1
  67 
  68 /* TCP option length */
  69 #define TCPOPT_NOP_LEN          1
  70 #define TCPOPT_MAXSEG_LEN       4
  71 #define TCPOPT_WS_LEN           3
  72 #define TCPOPT_REAL_WS_LEN      (TCPOPT_WS_LEN+1)
  73 #define TCPOPT_TSTAMP_LEN       10
  74 #define TCPOPT_REAL_TS_LEN      (TCPOPT_TSTAMP_LEN+2)
  75 #define TCPOPT_SACK_OK_LEN      2
  76 #define TCPOPT_REAL_SACK_OK_LEN (TCPOPT_SACK_OK_LEN+2)
  77 #define TCPOPT_REAL_SACK_LEN    4
  78 #define TCPOPT_MAX_SACK_LEN     36




   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright (c) 2011, Joyent Inc. All rights reserved.
  24  */
  25 
  26 #ifndef _INET_TCP_IMPL_H
  27 #define _INET_TCP_IMPL_H
  28 
  29 /*
  30  * TCP implementation private declarations.  These interfaces are
  31  * used to build the IP module and are not meant to be accessed
  32  * by any modules except IP itself.  They are undocumented and are
  33  * subject to change without notice.
  34  */
  35 
  36 #ifdef  __cplusplus
  37 extern "C" {
  38 #endif
  39 
  40 #ifdef _KERNEL
  41 
  42 #include <sys/cpuvar.h>
  43 #include <sys/clock_impl.h>       /* For LBOLT_FASTPATH{,64} */
  44 #include <inet/optcom.h>
  45 #include <inet/tcp.h>
  46 #include <inet/tunables.h>
  47 
  48 #define TCP_MOD_ID      5105
  49 
  50 extern struct qinit     tcp_sock_winit;
  51 extern struct qinit     tcp_winit;
  52 
  53 extern sock_downcalls_t sock_tcp_downcalls;
  54 
  55 /*
  56  * Bind hash list size and has function.  It has to be a power of 2 for
  57  * hashing.
  58  */
  59 #define TCP_BIND_FANOUT_SIZE    1024
  60 #define TCP_BIND_HASH(lport) (ntohs(lport) & (TCP_BIND_FANOUT_SIZE - 1))
  61 
  62 /*
  63  * This implementation follows the 4.3BSD interpretation of the urgent
  64  * pointer and not RFC 1122. Switching to RFC 1122 behavior would cause
  65  * incompatible changes in protocols like telnet and rlogin.
  66  */
  67 #define TCP_OLD_URP_INTERPRETATION      1
  68 
  69 /* TCP option length */
  70 #define TCPOPT_NOP_LEN          1
  71 #define TCPOPT_MAXSEG_LEN       4
  72 #define TCPOPT_WS_LEN           3
  73 #define TCPOPT_REAL_WS_LEN      (TCPOPT_WS_LEN+1)
  74 #define TCPOPT_TSTAMP_LEN       10
  75 #define TCPOPT_REAL_TS_LEN      (TCPOPT_TSTAMP_LEN+2)
  76 #define TCPOPT_SACK_OK_LEN      2
  77 #define TCPOPT_REAL_SACK_OK_LEN (TCPOPT_SACK_OK_LEN+2)
  78 #define TCPOPT_REAL_SACK_LEN    4
  79 #define TCPOPT_MAX_SACK_LEN     36