FreeBSD kernel IPv4 code
|
#include <sys/cdefs.h>
#include "opt_inet.h"
#include "opt_inet6.h"
#include "opt_ipsec.h"
#include "opt_tcpdebug.h"
#include "opt_ratelimit.h"
#include "opt_kern_tls.h"
#include <sys/param.h>
#include <sys/arb.h>
#include <sys/module.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/proc.h>
#include <sys/qmath.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
#include <sys/tree.h>
#include <sys/refcount.h>
#include <sys/queue.h>
#include <sys/smp.h>
#include <sys/kthread.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/tim_filter.h>
#include <sys/time.h>
#include <vm/uma.h>
#include <sys/kern_prefetch.h>
#include <net/route.h>
#include <net/vnet.h>
#include <net/ethernet.h>
#include <net/bpf.h>
#include <netinet/in.h>
#include <netinet/in_kdtrace.h>
#include <netinet/in_pcb.h>
#include <netinet/ip.h>
#include <netinet/ip_icmp.h>
#include <netinet/icmp_var.h>
#include <netinet/ip_var.h>
#include <netinet/ip6.h>
#include <netinet6/in6_pcb.h>
#include <netinet6/ip6_var.h>
#include <netinet/tcp.h>
#include <netinet/tcp_fsm.h>
#include <netinet/tcp_seq.h>
#include <netinet/tcp_timer.h>
#include <netinet/tcp_var.h>
#include <netinet/tcpip.h>
#include <netinet/tcp_hpts.h>
#include <netinet/tcp_lro.h>
#include <netinet/cc/cc.h>
#include <netinet/tcp_log_buf.h>
#include <netinet/tcp_fastopen.h>
#include <netipsec/ipsec_support.h>
#include <net/if.h>
#include <net/if_var.h>
#include <netinet/udp.h>
#include <netinet/udp_var.h>
#include <machine/in_cksum.h>
#include "rack_bbr_common.h"
Go to the source code of this file.
Macros | |
#define | TCPSTATES /* for logging */ |
Functions | |
__FBSDID ("$FreeBSD$") | |
static int | ctf_get_enet_type (struct ifnet *ifp, struct mbuf *m) |
int | ctf_process_inbound_raw (struct tcpcb *tp, struct socket *so, struct mbuf *m, int has_pkt) |
int | ctf_do_queued_segments (struct socket *so, struct tcpcb *tp, int have_pkt) |
uint32_t | ctf_outstanding (struct tcpcb *tp) |
uint32_t | ctf_flight_size (struct tcpcb *tp, uint32_t rc_sacked) |
void | ctf_do_dropwithreset (struct mbuf *m, struct tcpcb *tp, struct tcphdr *th, int32_t rstreason, int32_t tlen) |
void | ctf_ack_war_checks (struct tcpcb *tp, uint32_t *ts, uint32_t *cnt) |
int | _ctf_drop_checks (struct tcpopt *to, struct mbuf *m, struct tcphdr *th, struct tcpcb *tp, int32_t *tlenp, int32_t *thf, int32_t *drop_hdrlen, int32_t *ret_val, uint32_t *ts, uint32_t *cnt) |
void | __ctf_do_dropafterack (struct mbuf *m, struct tcpcb *tp, struct tcphdr *th, int32_t thflags, int32_t tlen, int32_t *ret_val, uint32_t *ts, uint32_t *cnt) |
void | ctf_do_drop (struct mbuf *m, struct tcpcb *tp) |
int | __ctf_process_rst (struct mbuf *m, struct tcphdr *th, struct socket *so, struct tcpcb *tp, uint32_t *ts, uint32_t *cnt) |
void | ctf_challenge_ack (struct mbuf *m, struct tcphdr *th, struct tcpcb *tp, int32_t *ret_val) |
int | ctf_ts_check (struct mbuf *m, struct tcphdr *th, struct tcpcb *tp, int32_t tlen, int32_t thflags, int32_t *ret_val) |
int | ctf_ts_check_ac (struct tcpcb *tp, int32_t thflags) |
void | ctf_calc_rwin (struct socket *so, struct tcpcb *tp) |
void | ctf_do_dropwithreset_conn (struct mbuf *m, struct tcpcb *tp, struct tcphdr *th, int32_t rstreason, int32_t tlen) |
uint32_t | ctf_fixed_maxseg (struct tcpcb *tp) |
void | ctf_log_sack_filter (struct tcpcb *tp, int num_sack_blks, struct sackblk *sack_blocks) |
uint32_t | ctf_decay_count (uint32_t count, uint32_t decay) |
int32_t | ctf_progress_timeout_check (struct tcpcb *tp, bool log) |
#define TCPSTATES /* for logging */ |
Definition at line 80 of file rack_bbr_common.c.
void __ctf_do_dropafterack | ( | struct mbuf * | m, |
struct tcpcb * | tp, | ||
struct tcphdr * | th, | ||
int32_t | thflags, | ||
int32_t | tlen, | ||
int32_t * | ret_val, | ||
uint32_t * | ts, | ||
uint32_t * | cnt | ||
) |
Definition at line 724 of file rack_bbr_common.c.
References BANDLIM_RST_OPENPORT, ctf_ack_war_checks(), ctf_do_dropwithreset(), SEQ_GT, tcpcb::snd_max, tcpcb::snd_una, tcpcb::t_state, and TCPS_SYN_RECEIVED.
Referenced by _ctf_drop_checks(), and rack_process_ack().
int __ctf_process_rst | ( | struct mbuf * | m, |
struct tcphdr * | th, | ||
struct socket * | so, | ||
struct tcpcb * | tp, | ||
uint32_t * | ts, | ||
uint32_t * | cnt | ||
) |
Definition at line 767 of file rack_bbr_common.c.
References ctf_do_drop(), KMOD_TCPSTAT_INC, tcpcb::last_ack_sent, tcpcb::rcv_nxt, tcpcb::rcv_wnd, SEQ_GEQ, SEQ_LT, tcpcb::snd_nxt, tcpcb::t_state, tcp_ack_war_cnt, tcp_ack_war_time_window, tcp_close(), TCP_EI_STATUS_CLIENT_RST, tcp_log_end_status(), tcp_respond(), tcp_state_change(), tcp_ts_getticks(), TCPS_CLOSE_WAIT, TCPS_CLOSED, TCPS_CLOSING, TCPS_ESTABLISHED, TCPS_FIN_WAIT_1, TCPS_FIN_WAIT_2, TCPS_LAST_ACK, TCPS_SYN_RECEIVED, TCPS_SYN_SENT, TSTMP_LT, and V_tcp_insecure_rst.
Referenced by rack_do_close_wait(), rack_do_closing(), rack_do_established(), rack_do_fin_wait_1(), rack_do_fin_wait_2(), rack_do_lastack(), and rack_do_syn_recv().
__FBSDID | ( | "$FreeBSD$" | ) |
int _ctf_drop_checks | ( | struct tcpopt * | to, |
struct mbuf * | m, | ||
struct tcphdr * | th, | ||
struct tcpcb * | tp, | ||
int32_t * | tlenp, | ||
int32_t * | thf, | ||
int32_t * | drop_hdrlen, | ||
int32_t * | ret_val, | ||
uint32_t * | ts, | ||
uint32_t * | cnt | ||
) |
Definition at line 615 of file rack_bbr_common.c.
References __ctf_do_dropafterack(), ctf_ack_war_checks(), KMOD_TCPSTAT_ADD, KMOD_TCPSTAT_INC, tcpcb::rcv_nxt, tcpcb::rcv_wnd, tcpcb::t_flags, tcp_update_sack_list(), TF_ACKNOW, and TF_SACK_PERMIT.
Referenced by rack_do_close_wait(), rack_do_closing(), rack_do_established(), rack_do_fin_wait_1(), rack_do_fin_wait_2(), rack_do_lastack(), and rack_do_syn_recv().
Definition at line 579 of file rack_bbr_common.c.
References tcpcb::t_flags, tcp_ack_war_cnt, tcp_ack_war_time_window, tcp_ts_getticks(), TF_ACKNOW, and TSTMP_LT.
Referenced by __ctf_do_dropafterack(), _ctf_drop_checks(), and rack_do_compressed_ack_processing().
void ctf_calc_rwin | ( | struct socket * | so, |
struct tcpcb * | tp | ||
) |
Definition at line 952 of file rack_bbr_common.c.
References tcpcb::rcv_adv, tcpcb::rcv_nxt, and tcpcb::rcv_wnd.
Referenced by bbr_do_close_wait(), bbr_do_closing(), bbr_do_established(), bbr_do_fastnewdata(), bbr_do_fin_wait_1(), bbr_do_fin_wait_2(), bbr_do_lastack(), bbr_do_syn_recv(), bbr_do_syn_sent(), rack_do_close_wait(), rack_do_closing(), rack_do_compressed_ack_processing(), rack_do_established(), rack_do_fastnewdata(), rack_do_fin_wait_1(), rack_do_fin_wait_2(), rack_do_lastack(), rack_do_syn_recv(), and rack_do_syn_sent().
void ctf_challenge_ack | ( | struct mbuf * | m, |
struct tcphdr * | th, | ||
struct tcpcb * | tp, | ||
int32_t * | ret_val | ||
) |
Definition at line 863 of file rack_bbr_common.c.
References ctf_do_drop(), KMOD_TCPSTAT_INC, tcpcb::last_ack_sent, tcpcb::rcv_nxt, tcpcb::rcv_wnd, SEQ_GEQ, SEQ_LT, tcpcb::snd_nxt, tcp_drop(), tcp_respond(), and V_tcp_insecure_syn.
Referenced by bbr_do_close_wait(), bbr_do_closing(), bbr_do_established(), bbr_do_fin_wait_1(), bbr_do_fin_wait_2(), bbr_do_lastack(), rack_do_close_wait(), rack_do_closing(), rack_do_established(), rack_do_fin_wait_1(), rack_do_fin_wait_2(), and rack_do_lastack().
Definition at line 1019 of file rack_bbr_common.c.
References count.
Referenced by rack_do_decay().
void ctf_do_drop | ( | struct mbuf * | m, |
struct tcpcb * | tp | ||
) |
Definition at line 754 of file rack_bbr_common.c.
References INP_WUNLOCK, and tcpcb::t_inpcb.
Referenced by __ctf_process_rst(), bbr_do_close_wait(), bbr_do_closing(), bbr_do_established(), bbr_do_fin_wait_1(), bbr_do_fin_wait_2(), bbr_do_lastack(), bbr_do_syn_recv(), bbr_do_syn_sent(), ctf_challenge_ack(), ctf_ts_check(), rack_do_close_wait(), rack_do_closing(), rack_do_compressed_ack_processing(), rack_do_established(), rack_do_fin_wait_1(), rack_do_fin_wait_2(), rack_do_lastack(), rack_do_syn_recv(), and rack_do_syn_sent().
void ctf_do_dropwithreset | ( | struct mbuf * | m, |
struct tcpcb * | tp, | ||
struct tcphdr * | th, | ||
int32_t | rstreason, | ||
int32_t | tlen | ||
) |
Definition at line 568 of file rack_bbr_common.c.
References INP_WUNLOCK, tcpcb::t_inpcb, and tcp_dropwithreset().
Referenced by __ctf_do_dropafterack(), bbr_check_data_after_close(), bbr_do_syn_recv(), bbr_do_syn_sent(), bbr_process_ack(), rack_check_data_after_close(), rack_do_segment_nounlock(), rack_do_syn_recv(), rack_do_syn_sent(), and rack_process_ack().
void ctf_do_dropwithreset_conn | ( | struct mbuf * | m, |
struct tcpcb * | tp, | ||
struct tcphdr * | th, | ||
int32_t | rstreason, | ||
int32_t | tlen | ||
) |
Definition at line 968 of file rack_bbr_common.c.
References INP_WUNLOCK, tcpcb::t_inpcb, tcp_drop(), and tcp_dropwithreset().
Referenced by bbr_do_close_wait(), bbr_do_closing(), bbr_do_established(), bbr_do_fin_wait_1(), bbr_do_fin_wait_2(), bbr_do_lastack(), bbr_do_segment_nounlock(), rack_do_close_wait(), rack_do_closing(), rack_do_established(), rack_do_fin_wait_1(), rack_do_fin_wait_2(), and rack_do_lastack().
int ctf_do_queued_segments | ( | struct socket * | so, |
struct tcpcb * | tp, | ||
int | have_pkt | ||
) |
Definition at line 527 of file rack_bbr_common.c.
References ctf_process_inbound_raw(), tcpcb::t_in_pkt, and tcpcb::t_tail_pkt.
Referenced by bbr_do_segment(), and rack_do_segment().
Definition at line 979 of file rack_bbr_common.c.
References tcp_fixed_maxseg().
Referenced by rack_ack_received(), rack_calc_thresh_tlp(), rack_check_bottom_drag(), rack_cong_signal(), rack_do_compressed_ack_processing(), rack_do_goodput_measurement(), rack_do_segment_nounlock(), rack_enough_for_measurement(), rack_enter_probertt(), rack_exit_probertt(), rack_fast_output(), rack_fast_rsm_output(), rack_get_measure_window(), rack_get_pacing_delay(), rack_log_ack(), rack_log_output(), rack_mtu_change(), rack_need_set_test(), rack_output(), rack_post_recovery(), rack_process_ack(), rack_set_pace_segments(), rack_start_gp_measurement(), rack_timeout_tlp(), rack_timer_start(), rack_update_rtt(), rack_validate_fo_sendwin_up(), rc_init_window(), and tcp_rack_xmit_timer().
Definition at line 558 of file rack_bbr_common.c.
References ctf_outstanding().
Referenced by bbr_ack_received(), bbr_cong_signal(), bbr_do_segment_nounlock(), bbr_enter_probe_rtt(), bbr_exit_probe_rtt(), bbr_fill_in_logging_data(), bbr_log_output(), bbr_output_wtime(), bbr_post_recovery(), bbr_set_probebw_gains(), bbr_state_change(), bbr_state_startup(), bbr_substate_change(), bbr_update_rsm(), bbr_what_can_we_send(), pace_to_fill_cwnd(), rack_check_bottom_drag(), rack_check_probe_rtt(), rack_do_segment_nounlock(), rack_fast_output(), rack_fast_rsm_output(), rack_log_doseg_done(), rack_log_fsb(), rack_log_input_packet(), rack_log_map_chg(), rack_log_output(), rack_log_pacing_delay_calc(), rack_log_progress_event(), rack_log_retran_reason(), rack_log_rtt_sample(), rack_log_rtt_shrinks(), rack_log_rtt_upd(), rack_log_timely(), rack_log_to_cancel(), rack_log_to_event(), rack_log_to_processing(), rack_log_to_prr(), rack_log_to_start(), rack_log_type_bbrsnd(), rack_log_type_just_return(), rack_log_type_pacing_sizes(), rack_mtu_change(), rack_output(), rack_remxt_tmr(), rack_update_rsm(), rack_what_can_we_send(), and tcp_bbr_partialack().
|
static |
Definition at line 166 of file rack_bbr_common.c.
References ipovly::ih_len, ipovly::ih_x1, in_pseudo(), ip::ip_dst, ip::ip_hl, ip::ip_len, ip::ip_tos, ip::ip_v, IPPROTO_TCP, IPVERSION, KMOD_TCPSTAT_INC, M_LRO_EHDRSTRP, and in_addr::s_addr.
Referenced by ctf_process_inbound_raw().
Definition at line 985 of file rack_bbr_common.c.
References tcp_log_bbr::applimited, sackblk::end, tcp_log_bbr::flex1, tcp_log_bbr::flex2, tcp_log_bbr::flex3, tcp_log_bbr::flex4, tcp_log_bbr::flex5, tcp_log_bbr::flex6, tcp_log_bbr::flex8, inpcb::inp_socket, tcp_log_bbr::pkts_out, sackblk::start, tcpcb::t_inpcb, tcpcb::t_logstate, tcp_get_usecs(), TCP_LOG_EVENTP, TCP_LOG_STATE_OFF, TCP_SACK_FILTER_RES, tcp_log_bbr::timeStamp, and tcp_log_stackspecific::u_bbr.
Referenced by bbr_log_ack(), and rack_log_ack().
Definition at line 545 of file rack_bbr_common.c.
References tcpcb::snd_max, tcpcb::snd_una, tcpcb::t_flags, tcpcb::t_state, TCPS_ESTABLISHED, and TF_SENTFIN.
Referenced by bbr_cwnd_limiting(), bbr_fastack(), bbr_output_wtime(), bbr_process_data(), bbr_set_probebw_gains(), bbr_timeout_tlp(), bbr_what_can_we_send(), ctf_flight_size(), pace_to_fill_cwnd(), rack_fastack(), rack_output(), rack_post_recovery(), rack_process_data(), rack_validate_fo_sendwin_up(), and rack_what_can_we_send().
int ctf_process_inbound_raw | ( | struct tcpcb * | tp, |
struct socket * | so, | ||
struct mbuf * | m, | ||
int | has_pkt | ||
) |
Definition at line 363 of file rack_bbr_common.c.
References ctf_get_enet_type(), inpcb::inp_flags2, INP_MBUF_ACKCMP, INP_UNLOCK_ASSERT, INP_WLOCK_ASSERT, ip::ip_len, ip::ip_tos, KMOD_TCPSTAT_ADD, KMOD_TCPSTAT_INC, M_ACKCMP, tcpcb::t_fb, tcpcb::t_inpcb, tcp_fields_to_host(), tcp_get_usecs(), and tcp_function_block::tfb_do_segment_nounlock.
Referenced by ctf_do_queued_segments().
int32_t ctf_progress_timeout_check | ( | struct tcpcb * | tp, |
bool | log | ||
) |
Definition at line 1045 of file rack_bbr_common.c.
References KMOD_TCPSTAT_INC, tcpcb::t_acktime, tcpcb::t_maxunacktime, TCP_EI_STATUS_PROGRESS, tcp_log_end_status(), and TSTMP_GT.
Referenced by bbr_do_close_wait(), bbr_do_closing(), bbr_do_established(), bbr_do_fin_wait_1(), bbr_do_fin_wait_2(), bbr_do_lastack(), bbr_timeout_persist(), bbr_timeout_rxt(), bbr_timeout_tlp(), rack_do_close_wait(), rack_do_closing(), rack_do_compressed_ack_processing(), rack_do_established(), rack_do_fin_wait_1(), rack_do_fin_wait_2(), rack_do_lastack(), rack_timeout_persist(), rack_timeout_rxt(), and rack_timeout_tlp().
int ctf_ts_check | ( | struct mbuf * | m, |
struct tcphdr * | th, | ||
struct tcpcb * | tp, | ||
int32_t | tlen, | ||
int32_t | thflags, | ||
int32_t * | ret_val | ||
) |
Definition at line 894 of file rack_bbr_common.c.
References ctf_do_drop(), ctf_do_dropafterack, KMOD_TCPSTAT_ADD, KMOD_TCPSTAT_INC, TCP_PAWS_IDLE, tcp_ts_getticks(), tcpcb::ts_recent, and tcpcb::ts_recent_age.
Referenced by bbr_do_close_wait(), bbr_do_closing(), bbr_do_established(), bbr_do_fin_wait_1(), bbr_do_fin_wait_2(), bbr_do_lastack(), bbr_do_syn_recv(), rack_do_close_wait(), rack_do_closing(), rack_do_established(), rack_do_fin_wait_1(), rack_do_fin_wait_2(), rack_do_lastack(), and rack_do_syn_recv().
int ctf_ts_check_ac | ( | struct tcpcb * | tp, |
int32_t | thflags | ||
) |
Definition at line 926 of file rack_bbr_common.c.
References KMOD_TCPSTAT_INC, TCP_PAWS_IDLE, tcp_ts_getticks(), tcpcb::ts_recent, and tcpcb::ts_recent_age.
Referenced by rack_do_compressed_ack_processing().