Print this page
11553 Want pluggable TCP congestion control algorithms
Portions contributed by: Cody Peter Mello <cody.mello@joyent.com>
Reviewed by: Dan McDonald <danmcd@joyent.com>
Reviewed by: Robert Mustacchi <robert.mustacchi@joyent.com>


   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 2019 Joyent, Inc.
  24  * Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
  25  * Copyright (c) 2013, 2016 by Delphix. All rights reserved.
  26  */
  27 
  28 #ifndef _INET_TCP_IMPL_H
  29 #define _INET_TCP_IMPL_H
  30 
  31 /*
  32  * TCP implementation private declarations.  These interfaces are
  33  * used to build the IP module and are not meant to be accessed
  34  * by any modules except IP itself.  They are undocumented and are
  35  * subject to change without notice.
  36  */
  37 
  38 #ifdef  __cplusplus
  39 extern "C" {
  40 #endif
  41 
  42 #ifdef _KERNEL
  43 
  44 #include <sys/cpuvar.h>
  45 #include <sys/clock_impl.h>       /* For LBOLT_FASTPATH{,64} */


 545 #define tcps_mss_def_ipv6               tcps_propinfo_tbl[46].prop_cur_uval
 546 #define tcps_mss_max_ipv6               tcps_propinfo_tbl[47].prop_cur_uval
 547 #define tcps_rev_src_routes             tcps_propinfo_tbl[48].prop_cur_bval
 548 #define tcps_local_dack_interval        tcps_propinfo_tbl[49].prop_cur_uval
 549 #define tcps_local_dacks_max            tcps_propinfo_tbl[50].prop_cur_uval
 550 #define tcps_ecn_permitted              tcps_propinfo_tbl[51].prop_cur_uval
 551 #define tcps_rst_sent_rate_enabled      tcps_propinfo_tbl[52].prop_cur_bval
 552 #define tcps_rst_sent_rate              tcps_propinfo_tbl[53].prop_cur_uval
 553 #define tcps_push_timer_interval        tcps_propinfo_tbl[54].prop_cur_uval
 554 #define tcps_use_smss_as_mss_opt        tcps_propinfo_tbl[55].prop_cur_bval
 555 #define tcps_keepalive_abort_interval_high \
 556                                         tcps_propinfo_tbl[56].prop_max_uval
 557 #define tcps_keepalive_abort_interval \
 558                                         tcps_propinfo_tbl[56].prop_cur_uval
 559 #define tcps_keepalive_abort_interval_low \
 560                                         tcps_propinfo_tbl[56].prop_min_uval
 561 #define tcps_wroff_xtra                 tcps_propinfo_tbl[57].prop_cur_uval
 562 #define tcps_dev_flow_ctl               tcps_propinfo_tbl[58].prop_cur_bval
 563 #define tcps_reass_timeout              tcps_propinfo_tbl[59].prop_cur_uval
 564 #define tcps_iss_incr                   tcps_propinfo_tbl[65].prop_cur_uval


 565 
 566 
 567 /*
 568  * As defined in RFC 6298, the RTO is the average estimates (SRTT) plus a
 569  * multiple of the deviation estimates (K * RTTVAR):
 570  *
 571  * RTO = SRTT + max(G, K * RTTVAR)
 572  *
 573  * K is defined in the RFC as 4, and G is the clock granularity. We constrain
 574  * the minimum mean deviation to TCP_SD_MIN when processing new RTTs, so this
 575  * becomes:
 576  *
 577  * RTO = SRTT + 4 * RTTVAR
 578  *
 579  * In practice, however, we make several additions to it. As we use a finer
 580  * grained clock than BSD and update RTO for every ACK, we add in another 1/4 of
 581  * RTT to the deviation of RTO to accommodate burstiness of 1/4 of window size:
 582  *
 583  * RTO = SRTT + (SRTT / 4) + 4 * RTTVAR
 584  *


 716 extern void     tcp_rexmit_after_error(tcp_t *);
 717 extern void     tcp_sack_rexmit(tcp_t *, uint_t *);
 718 extern void     tcp_send_data(tcp_t *, mblk_t *);
 719 extern void     tcp_send_synack(void *, mblk_t *, void *, ip_recv_attr_t *);
 720 extern void     tcp_shutdown_output(void *, mblk_t *, void *, ip_recv_attr_t *);
 721 extern void     tcp_ss_rexmit(tcp_t *);
 722 extern void     tcp_update_xmit_tail(tcp_t *, uint32_t);
 723 extern int      tcp_wput(queue_t *, mblk_t *);
 724 extern void     tcp_wput_data(tcp_t *, mblk_t *, boolean_t);
 725 extern int      tcp_wput_sock(queue_t *, mblk_t *);
 726 extern int      tcp_wput_fallback(queue_t *, mblk_t *);
 727 extern void     tcp_xmit_ctl(char *, tcp_t *, uint32_t, uint32_t, int);
 728 extern void     tcp_xmit_listeners_reset(mblk_t *, ip_recv_attr_t *,
 729                     ip_stack_t *i, conn_t *);
 730 extern mblk_t   *tcp_xmit_mp(tcp_t *, mblk_t *, int32_t, int32_t *,
 731                     mblk_t **, uint32_t, boolean_t, uint32_t *, boolean_t);
 732 
 733 /*
 734  * Input related functions in tcp_input.c.
 735  */

 736 extern void     tcp_icmp_input(void *, mblk_t *, void *, ip_recv_attr_t *);
 737 extern void     tcp_input_data(void *, mblk_t *, void *, ip_recv_attr_t *);
 738 extern void     tcp_input_listener_unbound(void *, mblk_t *, void *,
 739                     ip_recv_attr_t *);
 740 extern boolean_t        tcp_paws_check(tcp_t *, const tcp_opt_t *);
 741 extern int      tcp_parse_options(tcpha_t *, tcp_opt_t *);
 742 extern uint_t   tcp_rcv_drain(tcp_t *);
 743 extern void     tcp_rcv_enqueue(tcp_t *, mblk_t *, uint_t, cred_t *);
 744 extern boolean_t        tcp_verifyicmp(conn_t *, void *, icmph_t *, icmp6_t *,
 745                             ip_recv_attr_t *);
 746 
 747 /*
 748  * Kernel socket related functions in tcp_socket.c.
 749  */
 750 extern int      tcp_fallback(sock_lower_handle_t, queue_t *, boolean_t,
 751                     so_proto_quiesced_cb_t, sock_quiesce_arg_t *);
 752 extern boolean_t tcp_newconn_notify(tcp_t *, ip_recv_attr_t *);
 753 
 754 /*
 755  * Timer related functions in tcp_timers.c.




   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 2019 Joyent, Inc.
  24  * Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
  25  * Copyright (c) 2013, 2017 by Delphix. All rights reserved.
  26  */
  27 
  28 #ifndef _INET_TCP_IMPL_H
  29 #define _INET_TCP_IMPL_H
  30 
  31 /*
  32  * TCP implementation private declarations.  These interfaces are
  33  * used to build the IP module and are not meant to be accessed
  34  * by any modules except IP itself.  They are undocumented and are
  35  * subject to change without notice.
  36  */
  37 
  38 #ifdef  __cplusplus
  39 extern "C" {
  40 #endif
  41 
  42 #ifdef _KERNEL
  43 
  44 #include <sys/cpuvar.h>
  45 #include <sys/clock_impl.h>       /* For LBOLT_FASTPATH{,64} */


 545 #define tcps_mss_def_ipv6               tcps_propinfo_tbl[46].prop_cur_uval
 546 #define tcps_mss_max_ipv6               tcps_propinfo_tbl[47].prop_cur_uval
 547 #define tcps_rev_src_routes             tcps_propinfo_tbl[48].prop_cur_bval
 548 #define tcps_local_dack_interval        tcps_propinfo_tbl[49].prop_cur_uval
 549 #define tcps_local_dacks_max            tcps_propinfo_tbl[50].prop_cur_uval
 550 #define tcps_ecn_permitted              tcps_propinfo_tbl[51].prop_cur_uval
 551 #define tcps_rst_sent_rate_enabled      tcps_propinfo_tbl[52].prop_cur_bval
 552 #define tcps_rst_sent_rate              tcps_propinfo_tbl[53].prop_cur_uval
 553 #define tcps_push_timer_interval        tcps_propinfo_tbl[54].prop_cur_uval
 554 #define tcps_use_smss_as_mss_opt        tcps_propinfo_tbl[55].prop_cur_bval
 555 #define tcps_keepalive_abort_interval_high \
 556                                         tcps_propinfo_tbl[56].prop_max_uval
 557 #define tcps_keepalive_abort_interval \
 558                                         tcps_propinfo_tbl[56].prop_cur_uval
 559 #define tcps_keepalive_abort_interval_low \
 560                                         tcps_propinfo_tbl[56].prop_min_uval
 561 #define tcps_wroff_xtra                 tcps_propinfo_tbl[57].prop_cur_uval
 562 #define tcps_dev_flow_ctl               tcps_propinfo_tbl[58].prop_cur_bval
 563 #define tcps_reass_timeout              tcps_propinfo_tbl[59].prop_cur_uval
 564 #define tcps_iss_incr                   tcps_propinfo_tbl[65].prop_cur_uval
 565 #define tcps_abc                        tcps_propinfo_tbl[67].prop_cur_bval
 566 #define tcps_abc_l_var                  tcps_propinfo_tbl[68].prop_cur_uval
 567 
 568 
 569 /*
 570  * As defined in RFC 6298, the RTO is the average estimates (SRTT) plus a
 571  * multiple of the deviation estimates (K * RTTVAR):
 572  *
 573  * RTO = SRTT + max(G, K * RTTVAR)
 574  *
 575  * K is defined in the RFC as 4, and G is the clock granularity. We constrain
 576  * the minimum mean deviation to TCP_SD_MIN when processing new RTTs, so this
 577  * becomes:
 578  *
 579  * RTO = SRTT + 4 * RTTVAR
 580  *
 581  * In practice, however, we make several additions to it. As we use a finer
 582  * grained clock than BSD and update RTO for every ACK, we add in another 1/4 of
 583  * RTT to the deviation of RTO to accommodate burstiness of 1/4 of window size:
 584  *
 585  * RTO = SRTT + (SRTT / 4) + 4 * RTTVAR
 586  *


 718 extern void     tcp_rexmit_after_error(tcp_t *);
 719 extern void     tcp_sack_rexmit(tcp_t *, uint_t *);
 720 extern void     tcp_send_data(tcp_t *, mblk_t *);
 721 extern void     tcp_send_synack(void *, mblk_t *, void *, ip_recv_attr_t *);
 722 extern void     tcp_shutdown_output(void *, mblk_t *, void *, ip_recv_attr_t *);
 723 extern void     tcp_ss_rexmit(tcp_t *);
 724 extern void     tcp_update_xmit_tail(tcp_t *, uint32_t);
 725 extern int      tcp_wput(queue_t *, mblk_t *);
 726 extern void     tcp_wput_data(tcp_t *, mblk_t *, boolean_t);
 727 extern int      tcp_wput_sock(queue_t *, mblk_t *);
 728 extern int      tcp_wput_fallback(queue_t *, mblk_t *);
 729 extern void     tcp_xmit_ctl(char *, tcp_t *, uint32_t, uint32_t, int);
 730 extern void     tcp_xmit_listeners_reset(mblk_t *, ip_recv_attr_t *,
 731                     ip_stack_t *i, conn_t *);
 732 extern mblk_t   *tcp_xmit_mp(tcp_t *, mblk_t *, int32_t, int32_t *,
 733                     mblk_t **, uint32_t, boolean_t, uint32_t *, boolean_t);
 734 
 735 /*
 736  * Input related functions in tcp_input.c.
 737  */
 738 extern void     cc_cong_signal(tcp_t *, uint32_t, uint32_t);
 739 extern void     tcp_icmp_input(void *, mblk_t *, void *, ip_recv_attr_t *);
 740 extern void     tcp_input_data(void *, mblk_t *, void *, ip_recv_attr_t *);
 741 extern void     tcp_input_listener_unbound(void *, mblk_t *, void *,
 742                     ip_recv_attr_t *);
 743 extern boolean_t        tcp_paws_check(tcp_t *, const tcp_opt_t *);
 744 extern int      tcp_parse_options(tcpha_t *, tcp_opt_t *);
 745 extern uint_t   tcp_rcv_drain(tcp_t *);
 746 extern void     tcp_rcv_enqueue(tcp_t *, mblk_t *, uint_t, cred_t *);
 747 extern boolean_t        tcp_verifyicmp(conn_t *, void *, icmph_t *, icmp6_t *,
 748                             ip_recv_attr_t *);
 749 
 750 /*
 751  * Kernel socket related functions in tcp_socket.c.
 752  */
 753 extern int      tcp_fallback(sock_lower_handle_t, queue_t *, boolean_t,
 754                     so_proto_quiesced_cb_t, sock_quiesce_arg_t *);
 755 extern boolean_t tcp_newconn_notify(tcp_t *, ip_recv_attr_t *);
 756 
 757 /*
 758  * Timer related functions in tcp_timers.c.