Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netinet/tcp_var.h
Show All 33 Lines | |||||
#define _NETINET_TCP_VAR_H_ | #define _NETINET_TCP_VAR_H_ | ||||
#include <netinet/tcp.h> | #include <netinet/tcp.h> | ||||
#include <netinet/tcp_fsm.h> | #include <netinet/tcp_fsm.h> | ||||
#ifdef _KERNEL | #ifdef _KERNEL | ||||
#include <net/vnet.h> | #include <net/vnet.h> | ||||
#include <sys/mbuf.h> | #include <sys/mbuf.h> | ||||
#endif | |||||
/* | #if defined(_KERNEL) || defined(_WANT_TCPCB) | ||||
* Kernel variables for tcp. | |||||
*/ | |||||
VNET_DECLARE(int, tcp_do_rfc1323); | |||||
#define V_tcp_do_rfc1323 VNET(tcp_do_rfc1323) | |||||
#endif /* _KERNEL */ | |||||
/* TCP segment queue entry */ | /* TCP segment queue entry */ | ||||
struct tseg_qent { | struct tseg_qent { | ||||
LIST_ENTRY(tseg_qent) tqe_q; | LIST_ENTRY(tseg_qent) tqe_q; | ||||
int tqe_len; /* TCP segment data length */ | int tqe_len; /* TCP segment data length */ | ||||
struct tcphdr *tqe_th; /* a pointer to tcp header */ | struct tcphdr *tqe_th; /* a pointer to tcp header */ | ||||
struct mbuf *tqe_m; /* mbuf contains packet */ | struct mbuf *tqe_m; /* mbuf contains packet */ | ||||
}; | }; | ||||
LIST_HEAD(tsegqe_head, tseg_qent); | LIST_HEAD(tsegqe_head, tseg_qent); | ||||
Show All 19 Lines | struct sackhint { | ||||
int sacked_bytes; /* | int sacked_bytes; /* | ||||
* Total sacked bytes reported by the | * Total sacked bytes reported by the | ||||
* receiver via sack option | * receiver via sack option | ||||
*/ | */ | ||||
uint32_t _pad1[1]; /* TBD */ | uint32_t _pad1[1]; /* TBD */ | ||||
uint64_t _pad[1]; /* TBD */ | uint64_t _pad[1]; /* TBD */ | ||||
}; | }; | ||||
struct tcptemp { | |||||
u_char tt_ipgen[40]; /* the size must be of max ip header, now IPv6 */ | |||||
struct tcphdr tt_t; | |||||
}; | |||||
#define tcp6cb tcpcb /* for KAME src sync over BSD*'s */ | |||||
/* | /* | ||||
* TODO: We yet need to brave plowing in | |||||
* to tcp_input() and the pru_usrreq() block. | |||||
* Right now these go to the old standards which | |||||
* are somewhat ok, but in the long term may | |||||
* need to be changed. If we do tackle tcp_input() | |||||
* then we need to get rid of the tcp_do_segment() | |||||
* function below. | |||||
*/ | |||||
/* Flags for tcp functions */ | |||||
#define TCP_FUNC_BEING_REMOVED 0x01 /* Can no longer be referenced */ | |||||
struct tcpcb; | |||||
struct inpcb; | |||||
struct sockopt; | |||||
struct socket; | |||||
/* | |||||
* If defining the optional tcp_timers, in the | |||||
* tfb_tcp_timer_stop call you must use the | |||||
* callout_async_drain() function with the | |||||
* tcp_timer_discard callback. You should check | |||||
* the return of callout_async_drain() and if 0 | |||||
* increment tt_draincnt. Since the timer sub-system | |||||
* does not know your callbacks you must provide a | |||||
* stop_all function that loops through and calls | |||||
* tcp_timer_stop() with each of your defined timers. | |||||
* Adding a tfb_tcp_handoff_ok function allows the socket | |||||
* option to change stacks to query you even if the | |||||
* connection is in a later stage. You return 0 to | |||||
* say you can take over and run your stack, you return | |||||
* non-zero (an error number) to say no you can't. | |||||
* If the function is undefined you can only change | |||||
* in the early states (before connect or listen). | |||||
* tfb_tcp_fb_fini is changed to add a flag to tell | |||||
* the old stack if the tcb is being destroyed or | |||||
* not. A one in the flag means the TCB is being | |||||
* destroyed, a zero indicates its transitioning to | |||||
* another stack (via socket option). | |||||
*/ | |||||
struct tcp_function_block { | |||||
char tfb_tcp_block_name[TCP_FUNCTION_NAME_LEN_MAX]; | |||||
int (*tfb_tcp_output)(struct tcpcb *); | |||||
void (*tfb_tcp_do_segment)(struct mbuf *, struct tcphdr *, | |||||
struct socket *, struct tcpcb *, | |||||
int, int, uint8_t, | |||||
int); | |||||
int (*tfb_tcp_ctloutput)(struct socket *so, struct sockopt *sopt, | |||||
struct inpcb *inp, struct tcpcb *tp); | |||||
/* Optional memory allocation/free routine */ | |||||
void (*tfb_tcp_fb_init)(struct tcpcb *); | |||||
void (*tfb_tcp_fb_fini)(struct tcpcb *, int); | |||||
/* Optional timers, must define all if you define one */ | |||||
int (*tfb_tcp_timer_stop_all)(struct tcpcb *); | |||||
void (*tfb_tcp_timer_activate)(struct tcpcb *, | |||||
uint32_t, u_int); | |||||
int (*tfb_tcp_timer_active)(struct tcpcb *, uint32_t); | |||||
void (*tfb_tcp_timer_stop)(struct tcpcb *, uint32_t); | |||||
void (*tfb_tcp_rexmit_tmr)(struct tcpcb *); | |||||
int (*tfb_tcp_handoff_ok)(struct tcpcb *); | |||||
volatile uint32_t tfb_refcnt; | |||||
uint32_t tfb_flags; | |||||
}; | |||||
struct tcp_function { | |||||
TAILQ_ENTRY(tcp_function) tf_next; | |||||
struct tcp_function_block *tf_fb; | |||||
}; | |||||
TAILQ_HEAD(tcp_funchead, tcp_function); | |||||
/* | |||||
* Tcp control block, one per tcp; fields: | * Tcp control block, one per tcp; fields: | ||||
* Organized for 16 byte cacheline efficiency. | * Organized for 16 byte cacheline efficiency. | ||||
*/ | */ | ||||
struct tcpcb { | struct tcpcb { | ||||
struct tsegqe_head t_segq; /* segment reassembly queue */ | struct tsegqe_head t_segq; /* segment reassembly queue */ | ||||
void *t_pspare[2]; /* new reassembly queue */ | |||||
int t_segqlen; /* segment reassembly queue length */ | int t_segqlen; /* segment reassembly queue length */ | ||||
int t_dupacks; /* consecutive dup acks recd */ | int t_dupacks; /* consecutive dup acks recd */ | ||||
struct tcp_timer *t_timers; /* All the TCP timers in one struct */ | struct tcp_timer *t_timers; /* All the TCP timers in one struct */ | ||||
struct inpcb *t_inpcb; /* back pointer to internet pcb */ | struct inpcb *t_inpcb; /* back pointer to internet pcb */ | ||||
int t_state; /* state of this connection */ | int t_state; /* state of this connection */ | ||||
u_int t_flags; | u_int t_flags; | ||||
Show All 14 Lines | struct tcpcb { | ||||
tcp_seq rcv_nxt; /* receive next */ | tcp_seq rcv_nxt; /* receive next */ | ||||
tcp_seq rcv_adv; /* advertised window */ | tcp_seq rcv_adv; /* advertised window */ | ||||
uint32_t rcv_wnd; /* receive window */ | uint32_t rcv_wnd; /* receive window */ | ||||
tcp_seq rcv_up; /* receive urgent pointer */ | tcp_seq rcv_up; /* receive urgent pointer */ | ||||
uint32_t snd_wnd; /* send window */ | uint32_t snd_wnd; /* send window */ | ||||
uint32_t snd_cwnd; /* congestion-controlled window */ | uint32_t snd_cwnd; /* congestion-controlled window */ | ||||
u_long snd_spare1; /* unused */ | |||||
uint32_t snd_ssthresh; /* snd_cwnd size threshold for | uint32_t snd_ssthresh; /* snd_cwnd size threshold for | ||||
* for slow start exponential to | * for slow start exponential to | ||||
* linear switch | * linear switch | ||||
*/ | */ | ||||
u_long snd_spare2; /* unused */ | |||||
tcp_seq snd_recover; /* for use in NewReno Fast Recovery */ | tcp_seq snd_recover; /* for use in NewReno Fast Recovery */ | ||||
u_int t_rcvtime; /* inactivity time */ | u_int t_rcvtime; /* inactivity time */ | ||||
u_int t_starttime; /* time connection was established */ | u_int t_starttime; /* time connection was established */ | ||||
u_int t_rtttime; /* RTT measurement start time */ | u_int t_rtttime; /* RTT measurement start time */ | ||||
tcp_seq t_rtseq; /* sequence number being timed */ | tcp_seq t_rtseq; /* sequence number being timed */ | ||||
u_int t_bw_spare1; /* unused */ | |||||
tcp_seq t_bw_spare2; /* unused */ | |||||
int t_rxtcur; /* current retransmit value (ticks) */ | int t_rxtcur; /* current retransmit value (ticks) */ | ||||
u_int t_maxseg; /* maximum segment size */ | u_int t_maxseg; /* maximum segment size */ | ||||
u_int t_pmtud_saved_maxseg; /* pre-blackhole MSS */ | u_int t_pmtud_saved_maxseg; /* pre-blackhole MSS */ | ||||
int t_srtt; /* smoothed round-trip time */ | int t_srtt; /* smoothed round-trip time */ | ||||
int t_rttvar; /* variance in round-trip time */ | int t_rttvar; /* variance in round-trip time */ | ||||
int t_rxtshift; /* log(2) of rexmt exp. backoff */ | int t_rxtshift; /* log(2) of rexmt exp. backoff */ | ||||
u_int t_rttmin; /* minimum rtt allowed */ | u_int t_rttmin; /* minimum rtt allowed */ | ||||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | /* SACK related state */ | ||||
u_int t_keepidle; /* time before keepalive probes begin */ | u_int t_keepidle; /* time before keepalive probes begin */ | ||||
u_int t_keepintvl; /* interval between keepalives */ | u_int t_keepintvl; /* interval between keepalives */ | ||||
u_int t_keepcnt; /* number of keepalives before close */ | u_int t_keepcnt; /* number of keepalives before close */ | ||||
u_int t_tsomax; /* TSO total burst length limit in bytes */ | u_int t_tsomax; /* TSO total burst length limit in bytes */ | ||||
u_int t_tsomaxsegcount; /* TSO maximum segment count */ | u_int t_tsomaxsegcount; /* TSO maximum segment count */ | ||||
u_int t_tsomaxsegsize; /* TSO maximum segment size in bytes */ | u_int t_tsomaxsegsize; /* TSO maximum segment size in bytes */ | ||||
u_int t_flags2; /* More tcpcb flags storage */ | u_int t_flags2; /* More tcpcb flags storage */ | ||||
#if defined(_KERNEL) && defined(TCP_RFC7413) | |||||
uint32_t t_ispare[6]; /* 5 UTO, 1 TBD */ | |||||
uint64_t t_tfo_cookie; /* TCP Fast Open cookie */ | |||||
#else | |||||
uint32_t t_ispare[8]; /* 5 UTO, 3 TBD */ | |||||
#endif | |||||
struct tcp_function_block *t_fb;/* TCP function call block */ | struct tcp_function_block *t_fb;/* TCP function call block */ | ||||
void *t_fb_ptr; /* Pointer to t_fb specific data */ | void *t_fb_ptr; /* Pointer to t_fb specific data */ | ||||
#if defined(_KERNEL) && defined(TCP_RFC7413) | #ifdef TCP_RFC7413 | ||||
uint64_t t_tfo_cookie; /* TCP Fast Open cookie */ | |||||
unsigned int *t_tfo_pending; /* TCP Fast Open pending counter */ | unsigned int *t_tfo_pending; /* TCP Fast Open pending counter */ | ||||
void *t_pspare2[1]; /* 1 TCP_SIGNATURE */ | |||||
#else | |||||
void *t_pspare2[2]; /* 1 TCP_SIGNATURE, 1 TBD */ | |||||
#endif | #endif | ||||
#if defined(_KERNEL) && defined(TCPPCAP) | #ifdef TCPPCAP | ||||
struct mbufq t_inpkts; /* List of saved input packets. */ | struct mbufq t_inpkts; /* List of saved input packets. */ | ||||
struct mbufq t_outpkts; /* List of saved output packets. */ | struct mbufq t_outpkts; /* List of saved output packets. */ | ||||
#ifdef _LP64 | #endif | ||||
uint64_t _pad[0]; /* all used! */ | |||||
#else | |||||
uint64_t _pad[2]; /* 2 are available */ | |||||
#endif /* _LP64 */ | |||||
#else | |||||
uint64_t _pad[6]; | |||||
#endif /* defined(_KERNEL) && defined(TCPPCAP) */ | |||||
}; | }; | ||||
#endif /* _KERNEL || _WANT_TCPCB */ | |||||
#ifdef _KERNEL | |||||
/* | /* | ||||
* Kernel variables for tcp. | |||||
*/ | |||||
VNET_DECLARE(int, tcp_do_rfc1323); | |||||
#define V_tcp_do_rfc1323 VNET(tcp_do_rfc1323) | |||||
struct tcptemp { | |||||
u_char tt_ipgen[40]; /* the size must be of max ip header, now IPv6 */ | |||||
struct tcphdr tt_t; | |||||
}; | |||||
/* | |||||
* TODO: We yet need to brave plowing in | |||||
* to tcp_input() and the pru_usrreq() block. | |||||
* Right now these go to the old standards which | |||||
* are somewhat ok, but in the long term may | |||||
* need to be changed. If we do tackle tcp_input() | |||||
* then we need to get rid of the tcp_do_segment() | |||||
* function below. | |||||
*/ | |||||
/* Flags for tcp functions */ | |||||
#define TCP_FUNC_BEING_REMOVED 0x01 /* Can no longer be referenced */ | |||||
/* | |||||
* If defining the optional tcp_timers, in the | |||||
* tfb_tcp_timer_stop call you must use the | |||||
* callout_async_drain() function with the | |||||
* tcp_timer_discard callback. You should check | |||||
* the return of callout_async_drain() and if 0 | |||||
* increment tt_draincnt. Since the timer sub-system | |||||
* does not know your callbacks you must provide a | |||||
* stop_all function that loops through and calls | |||||
* tcp_timer_stop() with each of your defined timers. | |||||
* Adding a tfb_tcp_handoff_ok function allows the socket | |||||
* option to change stacks to query you even if the | |||||
* connection is in a later stage. You return 0 to | |||||
* say you can take over and run your stack, you return | |||||
* non-zero (an error number) to say no you can't. | |||||
* If the function is undefined you can only change | |||||
* in the early states (before connect or listen). | |||||
* tfb_tcp_fb_fini is changed to add a flag to tell | |||||
* the old stack if the tcb is being destroyed or | |||||
* not. A one in the flag means the TCB is being | |||||
* destroyed, a zero indicates its transitioning to | |||||
* another stack (via socket option). | |||||
*/ | |||||
struct tcp_function_block { | |||||
char tfb_tcp_block_name[TCP_FUNCTION_NAME_LEN_MAX]; | |||||
int (*tfb_tcp_output)(struct tcpcb *); | |||||
void (*tfb_tcp_do_segment)(struct mbuf *, struct tcphdr *, | |||||
struct socket *, struct tcpcb *, | |||||
int, int, uint8_t, | |||||
int); | |||||
int (*tfb_tcp_ctloutput)(struct socket *so, struct sockopt *sopt, | |||||
struct inpcb *inp, struct tcpcb *tp); | |||||
/* Optional memory allocation/free routine */ | |||||
void (*tfb_tcp_fb_init)(struct tcpcb *); | |||||
void (*tfb_tcp_fb_fini)(struct tcpcb *, int); | |||||
/* Optional timers, must define all if you define one */ | |||||
int (*tfb_tcp_timer_stop_all)(struct tcpcb *); | |||||
void (*tfb_tcp_timer_activate)(struct tcpcb *, | |||||
uint32_t, u_int); | |||||
int (*tfb_tcp_timer_active)(struct tcpcb *, uint32_t); | |||||
void (*tfb_tcp_timer_stop)(struct tcpcb *, uint32_t); | |||||
void (*tfb_tcp_rexmit_tmr)(struct tcpcb *); | |||||
int (*tfb_tcp_handoff_ok)(struct tcpcb *); | |||||
volatile uint32_t tfb_refcnt; | |||||
uint32_t tfb_flags; | |||||
}; | |||||
struct tcp_function { | |||||
TAILQ_ENTRY(tcp_function) tf_next; | |||||
struct tcp_function_block *tf_fb; | |||||
}; | |||||
TAILQ_HEAD(tcp_funchead, tcp_function); | |||||
#endif /* _KERNEL */ | |||||
/* | |||||
* Flags and utility macros for the t_flags field. | * Flags and utility macros for the t_flags field. | ||||
*/ | */ | ||||
#define TF_ACKNOW 0x000001 /* ack peer immediately */ | #define TF_ACKNOW 0x000001 /* ack peer immediately */ | ||||
#define TF_DELACK 0x000002 /* ack, but try to delay it */ | #define TF_DELACK 0x000002 /* ack, but try to delay it */ | ||||
#define TF_NODELAY 0x000004 /* don't delay packets to coalesce */ | #define TF_NODELAY 0x000004 /* don't delay packets to coalesce */ | ||||
#define TF_NOOPT 0x000008 /* don't use tcp options */ | #define TF_NOOPT 0x000008 /* don't use tcp options */ | ||||
#define TF_SENTFIN 0x000010 /* have sent FIN */ | #define TF_SENTFIN 0x000010 /* have sent FIN */ | ||||
#define TF_REQ_SCALE 0x000020 /* have/will request window scaling */ | #define TF_REQ_SCALE 0x000020 /* have/will request window scaling */ | ||||
▲ Show 20 Lines • Show All 336 Lines • ▼ Show 20 Lines | struct tcp_hhook_data { | ||||
uint32_t len; | uint32_t len; | ||||
int tso; | int tso; | ||||
tcp_seq curack; | tcp_seq curack; | ||||
}; | }; | ||||
#endif | #endif | ||||
/* | /* | ||||
* TCB structure exported to user-land via sysctl(3). | * TCB structure exported to user-land via sysctl(3). | ||||
* | |||||
* Fields prefixed with "xt_" are unique to the export structure, and fields | |||||
* with "t_" or other prefixes match corresponding fields of 'struct tcpcb'. | |||||
* | |||||
* Legend: | |||||
* (s) - used by userland utilities in src | |||||
* (p) - used by utilities in ports | |||||
* (3) - is known to be used by third party software not in ports | |||||
* (n) - no known usage | |||||
* | |||||
* Evil hack: declare only if in_pcb.h and sys/socketvar.h have been | * Evil hack: declare only if in_pcb.h and sys/socketvar.h have been | ||||
* included. Not all of our clients do. | * included. Not all of our clients do. | ||||
*/ | */ | ||||
#if defined(_NETINET_IN_PCB_H_) && defined(_SYS_SOCKETVAR_H_) | #if defined(_NETINET_IN_PCB_H_) && defined(_SYS_SOCKETVAR_H_) | ||||
struct xtcp_timer { | |||||
int tt_rexmt; /* retransmit timer */ | |||||
int tt_persist; /* retransmit persistence */ | |||||
int tt_keep; /* keepalive */ | |||||
int tt_2msl; /* 2*msl TIME_WAIT timer */ | |||||
int tt_delack; /* delayed ACK timer */ | |||||
int t_rcvtime; /* Time since last packet received */ | |||||
}; | |||||
struct xtcpcb { | struct xtcpcb { | ||||
size_t xt_len; | size_t xt_len; /* length of this structure */ | ||||
struct inpcb xt_inp; | struct xinpcb xt_inp; | ||||
struct tcpcb xt_tp; | char xt_stack[TCP_FUNCTION_NAME_LEN_MAX]; /* (n) */ | ||||
struct xsocket xt_socket; | int64_t spare64[8]; | ||||
bdrewery: I think finding what fields are "used" is impossible. Ports is not the entire FreeBSD ecosystem. | |||||
struct xtcp_timer xt_timer; | int32_t t_state; /* (s,p) */ | ||||
u_quad_t xt_alignment_hack; | uint32_t t_flags; /* (s,p) */ | ||||
}; | int32_t t_sndzerowin; /* (s) */ | ||||
int32_t t_sndrexmitpack; /* (s) */ | |||||
int32_t t_rcvoopack; /* (s) */ | |||||
int32_t t_rcvtime; /* (s) */ | |||||
int32_t tt_rexmt; /* (s) */ | |||||
int32_t tt_persist; /* (s) */ | |||||
int32_t tt_keep; /* (s) */ | |||||
int32_t tt_2msl; /* (s) */ | |||||
int32_t tt_delack; /* (s) */ | |||||
int32_t spare32[32]; | |||||
} __aligned(8); | |||||
#ifdef _KERNEL | |||||
void tcp_inptoxtp(const struct inpcb *, struct xtcpcb *); | |||||
#endif | |||||
#endif | #endif | ||||
/* | /* | ||||
* Identifiers for TCP sysctl nodes | * Identifiers for TCP sysctl nodes | ||||
*/ | */ | ||||
#define TCPCTL_DO_RFC1323 1 /* use RFC-1323 extensions */ | #define TCPCTL_DO_RFC1323 1 /* use RFC-1323 extensions */ | ||||
#define TCPCTL_MSSDFLT 3 /* MSS default */ | #define TCPCTL_MSSDFLT 3 /* MSS default */ | ||||
#define TCPCTL_STATS 4 /* statistics */ | #define TCPCTL_STATS 4 /* statistics */ | ||||
▲ Show 20 Lines • Show All 191 Lines • Show Last 20 Lines |
I think finding what fields are "used" is impossible. Ports is not the entire FreeBSD ecosystem. I just merged this change downstream and have *14* fields missing that we depend on. Breaking ABI is one thing but not providing all of the same data is another.