Index: head/sys/netinet/tcp.h =================================================================== --- head/sys/netinet/tcp.h +++ head/sys/netinet/tcp.h @@ -181,6 +181,9 @@ #define TCP_CONGESTION 64 /* get/set congestion control algorithm */ #define TCP_CCALGOOPT 65 /* get/set cc algorithm specific options */ #define TCP_DELACK 72 /* socket option for delayed ack */ +#define TCP_FIN_IS_RST 73 /* A fin from the peer is treated has a RST */ +#define TCP_LOG_LIMIT 74 /* Limit to number of records in tcp-log */ +#define TCP_SHARED_CWND_ALLOWED 75 /* Use of a shared cwnd is allowed */ #define TCP_KEEPINIT 128 /* N, time to establish connection */ #define TCP_KEEPIDLE 256 /* L,N,X start keeplives after this period */ #define TCP_KEEPINTVL 512 /* L,N interval between keepalives */ @@ -190,10 +193,11 @@ #define TCP_PCAP_IN 4096 /* number of input packets to keep */ #define TCP_FUNCTION_BLK 8192 /* Set the tcp function pointers to the specified stack */ /* Options for Rack and BBR */ +#define TCP_RACK_MBUF_QUEUE 1050 /* Do we allow mbuf queuing if supported */ #define TCP_RACK_PROP 1051 /* RACK proportional rate reduction (bool) */ #define TCP_RACK_TLP_REDUCE 1052 /* RACK TLP cwnd reduction (bool) */ #define TCP_RACK_PACE_REDUCE 1053 /* RACK Pacing reduction factor (divisor) */ -#define TCP_RACK_PACE_MAX_SEG 1054 /* Max segments in a pace */ +#define TCP_RACK_PACE_MAX_SEG 1054 /* Max TSO size we will send */ #define TCP_RACK_PACE_ALWAYS 1055 /* Use the always pace method */ #define TCP_RACK_PROP_RATE 1056 /* The proportional reduction rate */ #define TCP_RACK_PRR_SENDALOT 1057 /* Allow PRR to send more than one seg */ @@ -236,7 +240,7 @@ #define TCP_RACK_IDLE_REDUCE_HIGH 1092 /* Reduce the highest cwnd seen to IW on idle */ #define TCP_RACK_MIN_PACE 1093 /* Do we enforce rack min pace time */ #define TCP_RACK_MIN_PACE_SEG 1094 /* If so what is the seg threshould */ -#define TCP_RACK_GP_INCREASE 1094 /* After 4.1 its the GP increase */ +#define TCP_RACK_GP_INCREASE 1094 /* After 4.1 its the GP increase in older rack */ #define TCP_RACK_TLP_USE 1095 #define TCP_BBR_ACK_COMP_ALG 1096 /* Not used */ #define TCP_BBR_TMR_PACE_OH 1096 /* Recycled in 4.2 */ @@ -248,7 +252,8 @@ #define TCP_BBR_PROBE_RTT_GAIN 1101 #define TCP_BBR_PROBE_RTT_LEN 1102 #define TCP_BBR_SEND_IWND_IN_TSO 1103 /* Do we burst out whole iwin size chunks at start? */ -#define TCP_BBR_USE_RACK_CHEAT 1104 /* Do we use the rack cheat for pacing rxt's */ +#define TCP_BBR_USE_RACK_RR 1104 /* Do we use the rack rapid recovery for pacing rxt's */ +#define TCP_BBR_USE_RACK_CHEAT TCP_BBR_USE_RACK_RR /* Compat. */ #define TCP_BBR_HDWR_PACE 1105 /* Enable/disable hardware pacing */ #define TCP_BBR_UTTER_MAX_TSO 1106 /* Do we enforce an utter max TSO size */ #define TCP_BBR_EXTRA_STATE 1107 /* Special exit-persist catch up */ @@ -256,6 +261,24 @@ #define TCP_BBR_MIN_TOPACEOUT 1109 /* Do we suspend pacing until */ #define TCP_BBR_TSTMP_RAISES 1110 /* Can a timestamp measurement raise the b/w */ #define TCP_BBR_POLICER_DETECT 1111 /* Turn on/off google mode policer detection */ +#define TCP_BBR_RACK_INIT_RATE 1112 /* Set an initial pacing rate for when we have no b/w in kbits per sec */ +#define TCP_RACK_RR_CONF 1113 /* Rack rapid recovery configuration control*/ +#define TCP_RACK_CHEAT_NOT_CONF_RATE TCP_RACK_RR_CONF +#define TCP_RACK_GP_INCREASE_CA 1114 /* GP increase for Congestion Avoidance */ +#define TCP_RACK_GP_INCREASE_SS 1115 /* GP increase for Slow Start */ +#define TCP_RACK_GP_INCREASE_REC 1116 /* GP increase for Recovery */ +#define TCP_RACK_FORCE_MSEG 1117 /* Override to use the user set max-seg value */ +#define TCP_RACK_PACE_RATE_CA 1118 /* Pacing rate for Congestion Avoidance */ +#define TCP_RACK_PACE_RATE_SS 1119 /* Pacing rate for Slow Start */ +#define TCP_RACK_PACE_RATE_REC 1120 /* Pacing rate for Recovery */ +#define TCP_NO_PRR 1122 /* If pacing, don't use prr */ +#define TCP_RACK_NONRXT_CFG_RATE 1123 /* In recovery does a non-rxt use the cfg rate */ +#define TCP_SHARED_CWND_ENABLE 1124 /* Use a shared cwnd if allowed */ +#define TCP_TIMELY_DYN_ADJ 1125 /* Do we attempt dynamic multipler adjustment with timely. */ +#define TCP_RACK_NO_PUSH_AT_MAX 1126 /* For timely do not push if we are over max rtt */ +#define TCP_RACK_PACE_TO_FILL 1127 /* If we are not in recovery, always pace to fill the cwnd in 1 RTT */ +#define TCP_SHARED_CWND_TIME_LIMIT 1128 /* we should limit to low time values the scwnd life */ +#define TCP_RACK_PROFILE 1129 /* Select a profile that sets multiple options */ /* Start of reserved space for third-party user-settable options. */ Index: head/sys/netinet/tcp_log_buf.h =================================================================== --- head/sys/netinet/tcp_log_buf.h +++ head/sys/netinet/tcp_log_buf.h @@ -225,7 +225,11 @@ TCP_LOG_LRO, /* LRO entry 55 */ TCP_SACK_FILTER_RES, /* Results of SACK Filter 56 */ TCP_SAD_DETECTION, /* Sack Attack Detection 57 */ - TCP_LOG_END /* End (keep at end) 58 */ + TCP_TIMELY_WORK, /* Logs regarding Timely CC tweaks 58 */ + TCP_LOG_USER_EVENT, /* User space event data 59 */ + TCP_LOG_SENDFILE, /* sendfile() logging for TCP connections 60 */ + TCP_LOG_HTTP_T, /* logging of http request tracking 61 */ + TCP_LOG_END /* End (keep at end) 62 */ }; enum tcp_log_states { Index: head/sys/netinet/tcp_subr.c =================================================================== --- head/sys/netinet/tcp_subr.c +++ head/sys/netinet/tcp_subr.c @@ -3465,3 +3465,32 @@ if (inp->inp_socket == NULL) xt->xt_inp.xi_socket.xso_protocol = IPPROTO_TCP; } + +void +tcp_log_end_status(struct tcpcb *tp, uint8_t status) +{ + uint32_t bit, i; + + if ((tp == NULL) || + (status > TCP_EI_STATUS_MAX_VALUE) || + (status == 0)) { + /* Invalid */ + return; + } + if (status > (sizeof(uint32_t) * 8)) { + /* Should this be a KASSERT? */ + return; + } + bit = 1U << (status - 1); + if (bit & tp->t_end_info_status) { + /* already logged */ + return; + } + for (i = 0; i < TCP_END_BYTE_INFO; i++) { + if (tp->t_end_info_bytes[i] == TCP_EI_EMPTY_SLOT) { + tp->t_end_info_bytes[i] = status; + tp->t_end_info_status |= bit; + break; + } + } +} Index: head/sys/netinet/tcp_var.h =================================================================== --- head/sys/netinet/tcp_var.h +++ head/sys/netinet/tcp_var.h @@ -43,6 +43,41 @@ #include #endif +#define TCP_END_BYTE_INFO 8 /* Bytes that makeup the "end information array" */ +/* Types of ending byte info */ +#define TCP_EI_EMPTY_SLOT 0 +#define TCP_EI_STATUS_CLIENT_FIN 0x1 +#define TCP_EI_STATUS_CLIENT_RST 0x2 +#define TCP_EI_STATUS_SERVER_FIN 0x3 +#define TCP_EI_STATUS_SERVER_RST 0x4 +#define TCP_EI_STATUS_RETRAN 0x5 +#define TCP_EI_STATUS_PROGRESS 0x6 +#define TCP_EI_STATUS_PERSIST_MAX 0x7 +#define TCP_EI_STATUS_KEEP_MAX 0x8 +#define TCP_EI_STATUS_DATA_A_CLOSE 0x9 +#define TCP_EI_STATUS_RST_IN_FRONT 0xa +#define TCP_EI_STATUS_2MSL 0xb +#define TCP_EI_STATUS_MAX_VALUE 0xb + +/************************************************/ +/* Status bits we track to assure no duplicates, + * the bits here are not used by the code but + * for human representation. To check a bit we + * take and shift over by 1 minus the value (1-8). + */ +/************************************************/ +#define TCP_EI_BITS_CLIENT_FIN 0x001 +#define TCP_EI_BITS_CLIENT_RST 0x002 +#define TCP_EI_BITS_SERVER_FIN 0x004 +#define TCP_EI_BITS_SERVER_RST 0x008 +#define TCP_EI_BITS_RETRAN 0x010 +#define TCP_EI_BITS_PROGRESS 0x020 +#define TCP_EI_BITS_PRESIST_MAX 0x040 +#define TCP_EI_BITS_KEEP_MAX 0x080 +#define TCP_EI_BITS_DATA_A_CLO 0x100 +#define TCP_EI_BITS_RST_IN_FR 0x200 /* a front state reset */ +#define TCP_EI_BITS_2MS_TIMER 0x400 /* 2 MSL timer expired */ + #if defined(_KERNEL) || defined(_WANT_TCPCB) /* TCP segment queue entry */ struct tseg_qent { @@ -219,11 +254,16 @@ tcp_seq gput_ack; /* Inbound measurement ack */ int32_t t_stats_gput_prev; /* XXXLAS: Prev gput measurement */ uint8_t t_tfo_client_cookie_len; /* TCP Fast Open client cookie length */ + uint32_t t_end_info_status; /* Status flag of end info */ unsigned int *t_tfo_pending; /* TCP Fast Open server pending counter */ union { uint8_t client[TCP_FASTOPEN_MAX_COOKIE_LEN]; uint64_t server; } t_tfo_cookie; /* TCP Fast Open cookie to send */ + union { + uint8_t t_end_info_bytes[TCP_END_BYTE_INFO]; + uint64_t t_end_info; + }; #ifdef TCPPCAP struct mbufq t_inpkts; /* List of saved input packets. */ struct mbufq t_outpkts; /* List of saved output packets. */ @@ -1010,6 +1050,7 @@ int32_t seglimit, int32_t segsize, struct sockbuf *sb, bool hw_tls); int tcp_stats_init(void); +void tcp_log_end_status(struct tcpcb *tp, uint8_t status); static inline void tcp_fields_to_host(struct tcphdr *th)