Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_var.h
Show First 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | |||||
#define TCP_EI_STATUS_PROGRESS 0x6 | #define TCP_EI_STATUS_PROGRESS 0x6 | ||||
#define TCP_EI_STATUS_PERSIST_MAX 0x7 | #define TCP_EI_STATUS_PERSIST_MAX 0x7 | ||||
#define TCP_EI_STATUS_KEEP_MAX 0x8 | #define TCP_EI_STATUS_KEEP_MAX 0x8 | ||||
#define TCP_EI_STATUS_DATA_A_CLOSE 0x9 | #define TCP_EI_STATUS_DATA_A_CLOSE 0x9 | ||||
#define TCP_EI_STATUS_RST_IN_FRONT 0xa | #define TCP_EI_STATUS_RST_IN_FRONT 0xa | ||||
#define TCP_EI_STATUS_2MSL 0xb | #define TCP_EI_STATUS_2MSL 0xb | ||||
#define TCP_EI_STATUS_MAX_VALUE 0xb | #define TCP_EI_STATUS_MAX_VALUE 0xb | ||||
#define TCP_HTTP_REQ_LOG_NEW 0x01 | |||||
#define TCP_HTTP_REQ_LOG_COMPLETE 0x02 | |||||
#define TCP_HTTP_REQ_LOG_FREED 0x03 | |||||
#define TCP_HTTP_REQ_LOG_ALLOCFAIL 0x04 | |||||
#define TCP_HTTP_REQ_LOG_MOREYET 0x05 | |||||
#define TCP_HTTP_REQ_LOG_FORCEFREE 0x06 | |||||
#define TCP_HTTP_REQ_LOG_STALE 0x07 | |||||
#define TCP_HTTP_REQ_LOG_SEARCH 0x08 | |||||
/************************************************/ | /************************************************/ | ||||
/* Status bits we track to assure no duplicates, | /* Status bits we track to assure no duplicates, | ||||
* the bits here are not used by the code but | * the bits here are not used by the code but | ||||
* for human representation. To check a bit we | * for human representation. To check a bit we | ||||
* take and shift over by 1 minus the value (1-8). | * take and shift over by 1 minus the value (1-8). | ||||
*/ | */ | ||||
/************************************************/ | /************************************************/ | ||||
#define TCP_EI_BITS_CLIENT_FIN 0x001 | #define TCP_EI_BITS_CLIENT_FIN 0x001 | ||||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | struct sackhint { | ||||
uint32_t prr_delivered; /* Total bytes delivered using PRR */ | uint32_t prr_delivered; /* Total bytes delivered using PRR */ | ||||
uint32_t prr_out; /* Bytes sent during IN_RECOVERY */ | uint32_t prr_out; /* Bytes sent during IN_RECOVERY */ | ||||
}; | }; | ||||
#define SEGQ_EMPTY(tp) TAILQ_EMPTY(&(tp)->t_segq) | #define SEGQ_EMPTY(tp) TAILQ_EMPTY(&(tp)->t_segq) | ||||
STAILQ_HEAD(tcp_log_stailq, tcp_log_mem); | STAILQ_HEAD(tcp_log_stailq, tcp_log_mem); | ||||
#define TCP_HTTP_TRACK_FLG_EMPTY 0x00 /* Available */ | |||||
#define TCP_HTTP_TRACK_FLG_USED 0x01 /* In use */ | |||||
#define TCP_HTTP_TRACK_FLG_OPEN 0x02 /* End is not valid (open range request) */ | |||||
#define TCP_HTTP_TRACK_FLG_SEQV 0x04 /* We had a sendfile that touched it */ | |||||
#define TCP_HTTP_TRACK_FLG_COMP 0x08 /* Sendfile as placed the last bits (range req only) */ | |||||
#define TCP_HTTP_TRACK_FLG_FSND 0x10 /* First send has been done into the seq space */ | |||||
#define MAX_TCP_HTTP_REQ 5 /* Max we will have at once */ | |||||
#ifdef TCP_REQUEST_TRK | |||||
struct http_sendfile_track { | |||||
uint64_t timestamp; /* User sent timestamp */ | |||||
uint64_t start; /* Start of sendfile offset */ | |||||
uint64_t end; /* End if not open-range req */ | |||||
uint64_t localtime; /* Time we actually got the req */ | |||||
uint64_t deadline; /* If in CU mode, deadline to delivery */ | |||||
uint64_t first_send; /* Time of first send in the range */ | |||||
uint64_t cspr; /* Client suggested pace rate */ | |||||
uint64_t sent_at_fs; /* What was t_sndbytes as we begun sending */ | |||||
uint64_t rxt_at_fs; /* What was t_snd_rxt_bytes as we begun sending */ | |||||
tcp_seq start_seq; /* First TCP Seq assigned */ | |||||
tcp_seq end_seq; /* If range req last seq */ | |||||
uint32_t flags; /* Type of request open etc */ | |||||
uint32_t sbcc_at_s; /* When we allocate what is the sb_cc */ | |||||
uint32_t hint_maxseg; /* Client hinted maxseg */ | |||||
uint32_t hybrid_flags; /* Hybrid flags on this request */ | |||||
}; | |||||
#endif | |||||
/* | |||||
* Change Query responses for a stack switch we create a structure | |||||
* that allows query response from the new stack to the old, if | |||||
* supported. | |||||
* | |||||
* There are three queries currently defined. | |||||
* - sendmap | |||||
* - timers | |||||
* - rack_times | |||||
* | |||||
* For the sendmap query the caller fills in the | |||||
* req and the req_param as the first seq (usually | |||||
* snd_una). When the response comes back indicating | |||||
* that there was data (return value 1), then the caller | |||||
* can build a sendmap entry based on the range and the | |||||
* times. The next query would then be done at the | |||||
* newly created sendmap_end. Repeated until sendmap_end == snd_max. | |||||
* | |||||
* Flags in sendmap_flags are defined below as well. | |||||
* | |||||
* For timers the standard PACE_TMR_XXXX flags are returned indicating | |||||
* a pacing timer (possibly) and one other timer. If pacing timer then | |||||
* the expiration timeout time in microseconds is in timer_pacing_to. | |||||
* And the value used with whatever timer (if a flag is set) is in | |||||
* timer_rxt. If no timers are running a 0 is returned and of | |||||
* course no flags are set in timer_hpts_flags. | |||||
* | |||||
* The rack_times are a misc collection of information that | |||||
* the old stack might possibly fill in. Of course its possible | |||||
* that an old stack may not have a piece of information. If so | |||||
* then setting that value to zero is advised. Setting any | |||||
* timestamp passed should only place a zero in it when it | |||||
* is unfilled. This may mean that a time is off by a micro-second | |||||
* but this is ok in the grand scheme of things. | |||||
* | |||||
* When switching stacks it is desireable to get as much information | |||||
* from the old stack to the new stack as possible. Though not always | |||||
* will the stack be compatible in the types of information. The | |||||
* init() function needs to take care when it begins changing | |||||
* things such as inp_flags2 and the timer units to position these | |||||
* changes at a point where it is unlikely they will fail after | |||||
* making such changes. A stack optionally can have an "undo" | |||||
* function | |||||
* | |||||
* To transfer information to the old stack from the new in | |||||
* respect to LRO and the inp_flags2, the new stack should set | |||||
* the inp_flags2 to what it supports. The old stack in its | |||||
* fini() function should call the tcp_handle_orphaned_packets() | |||||
* to clean up any packets. Note that a new stack should attempt | |||||
*/ | |||||
/* Query types */ | |||||
#define TCP_QUERY_SENDMAP 1 | |||||
#define TCP_QUERY_TIMERS_UP 2 | |||||
#define TCP_QUERY_RACK_TIMES 3 | |||||
/* Flags returned in sendmap_flags */ | |||||
#define SNDMAP_ACKED 0x000001/* The remote endpoint acked this */ | |||||
#define SNDMAP_OVERMAX 0x000008/* We have more retran's then we can fit */ | |||||
#define SNDMAP_SACK_PASSED 0x000010/* A sack was done above this block */ | |||||
#define SNDMAP_HAS_FIN 0x000040/* segment is sent with fin */ | |||||
#define SNDMAP_TLP 0x000080/* segment sent as tail-loss-probe */ | |||||
#define SNDMAP_HAS_SYN 0x000800/* SYN is on this guy */ | |||||
#define SNDMAP_HAD_PUSH 0x008000/* Push was sent on original send */ | |||||
#define SNDMAP_MASK (SNDMAP_ACKED|SNDMAP_OVERMAX|SNDMAP_SACK_PASSED|SNDMAP_HAS_FIN\ | |||||
|SNDMAP_TLP|SNDMAP_HAS_SYN|SNDMAP_HAD_PUSH) | |||||
#define SNDMAP_NRTX 3 | |||||
struct tcp_query_resp { | |||||
int req; | |||||
uint32_t req_param; | |||||
union { | |||||
struct { | |||||
tcp_seq sendmap_start; | |||||
tcp_seq sendmap_end; | |||||
int sendmap_send_cnt; | |||||
uint64_t sendmap_time[SNDMAP_NRTX]; | |||||
uint64_t sendmap_ack_arrival; | |||||
int sendmap_flags; | |||||
uint32_t sendmap_r_rtr_bytes; | |||||
/* If FAS is available if not 0 */ | |||||
uint32_t sendmap_fas; | |||||
uint8_t sendmap_dupacks; | |||||
}; | |||||
struct { | |||||
uint32_t timer_hpts_flags; | |||||
uint32_t timer_pacing_to; | |||||
uint32_t timer_timer_exp; | |||||
}; | |||||
struct { | |||||
/* Timestamps and rtt's */ | |||||
uint32_t rack_reorder_ts; /* Last uscts that reordering was seen */ | |||||
uint32_t rack_num_dsacks; /* Num of dsacks seen */ | |||||
uint32_t rack_rxt_last_time; /* Last time a RXT/TLP or rack tmr went off */ | |||||
uint32_t rack_min_rtt; /* never 0 smallest rtt seen */ | |||||
uint32_t rack_rtt; /* Last rtt used by rack */ | |||||
uint32_t rack_tmit_time; /* The time the rtt seg was tmited */ | |||||
uint32_t rack_time_went_idle; /* If in persist the time we went idle */ | |||||
/* Prr data */ | |||||
uint32_t rack_sacked; | |||||
uint32_t rack_holes_rxt; | |||||
uint32_t rack_prr_delivered; | |||||
uint32_t rack_prr_recovery_fs; | |||||
uint32_t rack_prr_out; | |||||
uint32_t rack_prr_sndcnt; | |||||
/* TLP data */ | |||||
uint16_t rack_tlp_cnt_out; /* How many tlp's have been sent */ | |||||
/* Various bits */ | |||||
uint8_t rack_tlp_out; /* Is a TLP outstanding */ | |||||
uint8_t rack_srtt_measured; /* The previous stack has measured srtt */ | |||||
uint8_t rack_in_persist; /* Is the old stack in persists? */ | |||||
uint8_t rack_wanted_output; /* Did the prevous stack have a want output set */ | |||||
}; | |||||
}; | |||||
}; | |||||
#define TCP_TMR_GRANULARITY_TICKS 1 /* TCP timers are in ticks (msec if hz=1000) */ | |||||
#define TCP_TMR_GRANULARITY_USEC 2 /* TCP timers are in microseconds */ | |||||
typedef enum { | typedef enum { | ||||
TT_REXMT = 0, | TT_REXMT = 0, | ||||
TT_PERSIST, | TT_PERSIST, | ||||
TT_KEEP, | TT_KEEP, | ||||
TT_2MSL, | TT_2MSL, | ||||
TT_DELACK, | TT_DELACK, | ||||
TT_N, | TT_N, | ||||
} tt_which; | } tt_which; | ||||
▲ Show 20 Lines • Show All 135 Lines • ▼ Show 20 Lines | #define t_zero_size (sizeof(struct tcpcb) - \ | ||||
struct tcp_log_id_bucket *t_lib; | struct tcp_log_id_bucket *t_lib; | ||||
const char *t_output_caller; /* Function that called tcp_output */ | const char *t_output_caller; /* Function that called tcp_output */ | ||||
struct statsblob *t_stats; /* Per-connection stats */ | struct statsblob *t_stats; /* Per-connection stats */ | ||||
/* Should these be a pointer to the arrays or an array? */ | /* Should these be a pointer to the arrays or an array? */ | ||||
#ifdef TCP_ACCOUNTING | #ifdef TCP_ACCOUNTING | ||||
uint64_t tcp_cnt_counters[TCP_NUM_CNT_COUNTERS]; | uint64_t tcp_cnt_counters[TCP_NUM_CNT_COUNTERS]; | ||||
uint64_t tcp_proc_time[TCP_NUM_CNT_COUNTERS]; | uint64_t tcp_proc_time[TCP_NUM_CNT_COUNTERS]; | ||||
#endif | #endif | ||||
#ifdef TCP_REQUEST_TRK | |||||
uint32_t tcp_hybrid_start; /* Num of times we started hybrid pacing */ | |||||
uint32_t tcp_hybrid_stop; /* Num of times we stopped hybrid pacing */ | |||||
uint32_t tcp_hybrid_error; /* Num of times we failed to start hybrid pacing */ | |||||
#endif | |||||
uint32_t t_logsn; /* Log "serial number" */ | uint32_t t_logsn; /* Log "serial number" */ | ||||
uint32_t gput_ts; /* Time goodput measurement started */ | uint32_t gput_ts; /* Time goodput measurement started */ | ||||
tcp_seq gput_seq; /* Outbound measurement seq */ | tcp_seq gput_seq; /* Outbound measurement seq */ | ||||
tcp_seq gput_ack; /* Inbound measurement ack */ | tcp_seq gput_ack; /* Inbound measurement ack */ | ||||
int32_t t_stats_gput_prev; /* XXXLAS: Prev gput measurement */ | int32_t t_stats_gput_prev; /* XXXLAS: Prev gput measurement */ | ||||
uint32_t t_maxpeakrate; /* max peak rate set by user, bytes/s */ | uint32_t t_maxpeakrate; /* max peak rate set by user, bytes/s */ | ||||
uint32_t t_sndtlppack; /* tail loss probe packets sent */ | uint32_t t_sndtlppack; /* tail loss probe packets sent */ | ||||
uint64_t t_sndtlpbyte; /* total tail loss probe bytes sent */ | uint64_t t_sndtlpbyte; /* total tail loss probe bytes sent */ | ||||
uint64_t t_sndbytes; /* total bytes sent */ | uint64_t t_sndbytes; /* total bytes sent */ | ||||
uint64_t t_snd_rxt_bytes; /* total bytes retransmitted */ | uint64_t t_snd_rxt_bytes; /* total bytes retransmitted */ | ||||
uint32_t t_dsack_bytes; /* dsack bytes received */ | uint32_t t_dsack_bytes; /* dsack bytes received */ | ||||
uint32_t t_dsack_tlp_bytes; /* dsack bytes received for TLPs sent */ | uint32_t t_dsack_tlp_bytes; /* dsack bytes received for TLPs sent */ | ||||
uint32_t t_dsack_pack; /* dsack packets we have eceived */ | uint32_t t_dsack_pack; /* dsack packets we have eceived */ | ||||
uint8_t t_tmr_granularity; /* Granularity of all timers srtt etc */ | |||||
uint8_t t_rttupdated; /* number of times rtt sampled */ | uint8_t t_rttupdated; /* number of times rtt sampled */ | ||||
/* TCP Fast Open */ | /* TCP Fast Open */ | ||||
uint8_t t_tfo_client_cookie_len; /* TFO client cookie length */ | uint8_t t_tfo_client_cookie_len; /* TFO client cookie length */ | ||||
uint32_t t_end_info_status; /* Status flag of end info */ | uint32_t t_end_info_status; /* Status flag of end info */ | ||||
unsigned int *t_tfo_pending; /* TFO server pending counter */ | unsigned int *t_tfo_pending; /* TFO server pending counter */ | ||||
union { | union { | ||||
uint8_t client[TCP_FASTOPEN_MAX_COOKIE_LEN]; | uint8_t client[TCP_FASTOPEN_MAX_COOKIE_LEN]; | ||||
uint64_t server; | uint64_t server; | ||||
} t_tfo_cookie; /* TCP Fast Open cookie to send */ | } t_tfo_cookie; /* TCP Fast Open cookie to send */ | ||||
union { | union { | ||||
uint8_t t_end_info_bytes[TCP_END_BYTE_INFO]; | uint8_t t_end_info_bytes[TCP_END_BYTE_INFO]; | ||||
uint64_t t_end_info; | uint64_t t_end_info; | ||||
}; | }; | ||||
#ifdef 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. */ | ||||
#endif | #endif | ||||
#ifdef TCP_HHOOK | #ifdef TCP_HHOOK | ||||
struct osd t_osd; /* storage for Khelp module data */ | struct osd t_osd; /* storage for Khelp module data */ | ||||
#endif | #endif | ||||
uint8_t _t_logpoint; /* Used when a BB log points is enabled */ | uint8_t _t_logpoint; /* Used when a BB log points is enabled */ | ||||
#ifdef TCP_REQUEST_TRK | |||||
/* Response tracking addons. */ | |||||
uint8_t t_http_req; /* Request count */ | |||||
uint8_t t_http_open; /* Number of open range requests */ | |||||
uint8_t t_http_closed; /* Number of closed range requests */ | |||||
struct http_sendfile_track t_http_info[MAX_TCP_HTTP_REQ]; | |||||
#endif | |||||
}; | }; | ||||
#endif /* _KERNEL || _WANT_TCPCB */ | #endif /* _KERNEL || _WANT_TCPCB */ | ||||
#ifdef _KERNEL | #ifdef _KERNEL | ||||
struct tcptemp { | struct tcptemp { | ||||
u_char tt_ipgen[40]; /* the size must be of max ip header, now IPv6 */ | u_char tt_ipgen[40]; /* the size must be of max ip header, now IPv6 */ | ||||
struct tcphdr tt_t; | struct tcphdr tt_t; | ||||
}; | }; | ||||
Show All 19 Lines | |||||
* need to be changed. If we do tackle tcp_input() | * need to be changed. If we do tackle tcp_input() | ||||
* then we need to get rid of the tcp_do_segment() | * then we need to get rid of the tcp_do_segment() | ||||
* function below. | * function below. | ||||
*/ | */ | ||||
/* Flags for tcp functions */ | /* Flags for tcp functions */ | ||||
#define TCP_FUNC_BEING_REMOVED 0x01 /* Can no longer be referenced */ | #define TCP_FUNC_BEING_REMOVED 0x01 /* Can no longer be referenced */ | ||||
#define TCP_FUNC_OUTPUT_CANDROP 0x02 /* tfb_tcp_output may ask tcp_drop */ | #define TCP_FUNC_OUTPUT_CANDROP 0x02 /* tfb_tcp_output may ask tcp_drop */ | ||||
/* | /** | ||||
* If defining the optional tcp_timers, in the | * If defining the optional tcp_timers, in the | ||||
* tfb_tcp_timer_stop call you must use the | * tfb_tcp_timer_stop call you must use the | ||||
* callout_async_drain() function with the | * callout_async_drain() function with the | ||||
* tcp_timer_discard callback. You should check | * tcp_timer_discard callback. You should check | ||||
* the return of callout_async_drain() and if 0 | * the return of callout_async_drain() and if 0 | ||||
* increment tt_draincnt. Since the timer sub-system | * increment tt_draincnt. Since the timer sub-system | ||||
* does not know your callbacks you must provide a | * does not know your callbacks you must provide a | ||||
* stop_all function that loops through and calls | * stop_all function that loops through and calls | ||||
* tcp_timer_stop() with each of your defined timers. | * tcp_timer_stop() with each of your defined timers. | ||||
* | |||||
* Adding a tfb_tcp_handoff_ok function allows the socket | * Adding a tfb_tcp_handoff_ok function allows the socket | ||||
* option to change stacks to query you even if the | * option to change stacks to query you even if the | ||||
* connection is in a later stage. You return 0 to | * connection is in a later stage. You return 0 to | ||||
* say you can take over and run your stack, you return | * say you can take over and run your stack, you return | ||||
* non-zero (an error number) to say no you can't. | * non-zero (an error number) to say no you can't. | ||||
* If the function is undefined you can only change | * If the function is undefined you can only change | ||||
* in the early states (before connect or listen). | * in the early states (before connect or listen). | ||||
* | |||||
* tfb_tcp_fb_init is used to allow the new stack to | |||||
* setup its control block. Among the things it must | |||||
* do is: | |||||
* a) Make sure that the inp_flags2 is setup correctly | |||||
* for LRO. There are two flags that the previous | |||||
* stack may have set INP_MBUF_ACKCMP and | |||||
* INP_SUPPORTS_MBUFQ. If the new stack does not | |||||
* support these it *should* clear the flags. | |||||
* b) Make sure that the timers are in the proper | |||||
* granularity that the stack wants. The stack | |||||
* should check the t_tmr_granularity field. Currently | |||||
* there are two values that it may hold | |||||
* TCP_TMR_GRANULARITY_TICKS and TCP_TMR_GRANULARITY_USEC. | |||||
* Use the functions tcp_timer_convert(tp, granularity); | |||||
* to move the timers to the correct format for your stack. | |||||
* | |||||
* The new stack may also optionally query the tfb_chg_query | |||||
* function if the old stack has one. The new stack may ask | |||||
* for one of three entries and can also state to the old | |||||
* stack its support for the INP_MBUF_ACKCMP and | |||||
* INP_SUPPORTS_MBUFQ. This is important since if there are | |||||
* queued ack's without that statement the old stack will | |||||
* be forced to discard the queued acks. The requests that | |||||
* can be made for information by the new stacks are: | |||||
* | |||||
* Note also that the tfb_tcp_fb_init() when called can | |||||
* determine if a query is needed by looking at the | |||||
* value passed in the ptr. The ptr is designed to be | |||||
* set in with any allocated memory, but the address | |||||
* of the condtion (ptr == &tp->t_fb_ptr) will be | |||||
* true if this is not a stack switch but the initial | |||||
* setup of a tcb (which means no query would be needed). | |||||
* If, however, the value is not t_fb_ptr, then the caller | |||||
* is in the middle of a stack switch and is the new stack. | |||||
* A query would be appropriate (if the new stack support | |||||
* the query mechanism). | |||||
* | |||||
* TCP_QUERY_SENDMAP - Query of outstanding data. | |||||
* TCP_QUERY_TIMERS_UP - Query about running timers. | |||||
* TCP_SUPPORTED_LRO - Declaration in req_param of | |||||
* the inp_flags2 supported by | |||||
* the new stack. | |||||
* TCP_QUERY_RACK_TIMES - Enquire about various timestamps | |||||
* and states the old stack may be in. | |||||
* | |||||
* tfb_tcp_fb_fini is changed to add a flag to tell | * tfb_tcp_fb_fini is changed to add a flag to tell | ||||
* the old stack if the tcb is being destroyed or | * the old stack if the tcb is being destroyed or | ||||
* not. A one in the flag means the TCB is being | * not. A one in the flag means the TCB is being | ||||
* destroyed, a zero indicates its transitioning to | * destroyed, a zero indicates its transitioning to | ||||
* another stack (via socket option). | * another stack (via socket option). The | ||||
* tfb_tcp_fb_fini() function itself should not change timers | |||||
* or inp_flags2 (the tfb_tcp_fb_init() must do that). However | |||||
* if the old stack supports the LRO mbuf queuing, and the new | |||||
* stack does not communicate via chg messages that it too does, | |||||
* it must assume it does not and free any queued mbufs. | |||||
* | |||||
*/ | */ | ||||
struct tcp_function_block { | struct tcp_function_block { | ||||
char tfb_tcp_block_name[TCP_FUNCTION_NAME_LEN_MAX]; | char tfb_tcp_block_name[TCP_FUNCTION_NAME_LEN_MAX]; | ||||
int (*tfb_tcp_output)(struct tcpcb *); | int (*tfb_tcp_output)(struct tcpcb *); | ||||
int (*tfb_tcp_output_wtime)(struct tcpcb *, const struct timeval *); | |||||
void (*tfb_tcp_do_segment)(struct mbuf *, struct tcphdr *, | void (*tfb_tcp_do_segment)(struct mbuf *, struct tcphdr *, | ||||
struct socket *, struct tcpcb *, | struct socket *, struct tcpcb *, | ||||
int, int, uint8_t); | int, int, uint8_t); | ||||
int (*tfb_do_queued_segments)(struct socket *, struct tcpcb *, int); | int (*tfb_do_queued_segments)(struct socket *, struct tcpcb *, int); | ||||
int (*tfb_do_segment_nounlock)(struct mbuf *, struct tcphdr *, | int (*tfb_do_segment_nounlock)(struct mbuf *, struct tcphdr *, | ||||
struct socket *, struct tcpcb *, | struct socket *, struct tcpcb *, | ||||
int, int, uint8_t, | int, int, uint8_t, | ||||
int, struct timeval *); | int, struct timeval *); | ||||
void (*tfb_tcp_hpts_do_segment)(struct mbuf *, struct tcphdr *, | void (*tfb_tcp_hpts_do_segment)(struct mbuf *, struct tcphdr *, | ||||
struct socket *, struct tcpcb *, | struct socket *, struct tcpcb *, | ||||
int, int, uint8_t, | int, int, uint8_t, | ||||
int, struct timeval *); | int, struct timeval *); | ||||
int (*tfb_tcp_ctloutput)(struct inpcb *inp, struct sockopt *sopt); | int (*tfb_tcp_ctloutput)(struct inpcb *inp, struct sockopt *sopt); | ||||
/* Optional memory allocation/free routine */ | /* Optional memory allocation/free routine */ | ||||
int (*tfb_tcp_fb_init)(struct tcpcb *); | int (*tfb_tcp_fb_init)(struct tcpcb *, void **); | ||||
void (*tfb_tcp_fb_fini)(struct tcpcb *, int); | void (*tfb_tcp_fb_fini)(struct tcpcb *, int); | ||||
/* Optional timers, must define all if you define one */ | /* Optional timers, must define all if you define one */ | ||||
int (*tfb_tcp_timer_stop_all)(struct tcpcb *); | int (*tfb_tcp_timer_stop_all)(struct tcpcb *); | ||||
void (*tfb_tcp_rexmit_tmr)(struct tcpcb *); | void (*tfb_tcp_rexmit_tmr)(struct tcpcb *); | ||||
int (*tfb_tcp_handoff_ok)(struct tcpcb *); | int (*tfb_tcp_handoff_ok)(struct tcpcb *); | ||||
void (*tfb_tcp_mtu_chg)(struct tcpcb *); | void (*tfb_tcp_mtu_chg)(struct tcpcb *tp); | ||||
int (*tfb_pru_options)(struct tcpcb *, int); | int (*tfb_pru_options)(struct tcpcb *, int); | ||||
void (*tfb_hwtls_change)(struct tcpcb *, int); | void (*tfb_hwtls_change)(struct tcpcb *, int); | ||||
int (*tfb_chg_query)(struct tcpcb *, struct tcp_query_resp *); | |||||
void (*tfb_switch_failed)(struct tcpcb *); | |||||
bool (*tfb_early_wake_check)(struct tcpcb *); | |||||
int (*tfb_compute_pipe)(struct tcpcb *tp); | int (*tfb_compute_pipe)(struct tcpcb *tp); | ||||
volatile uint32_t tfb_refcnt; | volatile uint32_t tfb_refcnt; | ||||
uint32_t tfb_flags; | uint32_t tfb_flags; | ||||
uint8_t tfb_id; | uint8_t tfb_id; | ||||
}; | }; | ||||
struct tcp_function { | struct tcp_function { | ||||
TAILQ_ENTRY(tcp_function) tf_next; | TAILQ_ENTRY(tcp_function) tf_next; | ||||
Show All 33 Lines | if (rv < 0) { | ||||
tp = tcp_drop(tp, -rv); | tp = tcp_drop(tp, -rv); | ||||
if (tp) | if (tp) | ||||
INP_WUNLOCK(inp); | INP_WUNLOCK(inp); | ||||
} | } | ||||
return (rv); | return (rv); | ||||
} | } | ||||
static inline void | |||||
tcp_lro_features_off(struct inpcb *inp) | |||||
{ | |||||
inp->inp_flags2 &= ~(INP_SUPPORTS_MBUFQ| | |||||
INP_MBUF_QUEUE_READY| | |||||
INP_DONT_SACK_QUEUE| | |||||
INP_MBUF_ACKCMP| | |||||
INP_MBUF_L_ACKS); | |||||
} | |||||
/* | /* | ||||
* tcp_output_unlock() | * tcp_output_unlock() | ||||
* Always returns unlocked, handles drop request from advanced stacks. | * Always returns unlocked, handles drop request from advanced stacks. | ||||
* Always returns positive error code. | * Always returns positive error code. | ||||
*/ | */ | ||||
static inline int | static inline int | ||||
tcp_output_unlock(struct tcpcb *tp) | tcp_output_unlock(struct tcpcb *tp) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 708 Lines • ▼ Show 20 Lines | |||||
extern counter_u64_t tcp_would_have_but; | extern counter_u64_t tcp_would_have_but; | ||||
extern counter_u64_t tcp_comp_total; | extern counter_u64_t tcp_comp_total; | ||||
extern counter_u64_t tcp_uncomp_total; | extern counter_u64_t tcp_uncomp_total; | ||||
extern counter_u64_t tcp_bad_csums; | extern counter_u64_t tcp_bad_csums; | ||||
#ifdef NETFLIX_EXP_DETECTION | #ifdef NETFLIX_EXP_DETECTION | ||||
/* Various SACK attack thresholds */ | /* Various SACK attack thresholds */ | ||||
extern int32_t tcp_force_detection; | extern int32_t tcp_force_detection; | ||||
extern int32_t tcp_sad_limit; | |||||
extern int32_t tcp_sack_to_ack_thresh; | extern int32_t tcp_sack_to_ack_thresh; | ||||
extern int32_t tcp_sack_to_move_thresh; | extern int32_t tcp_sack_to_move_thresh; | ||||
extern int32_t tcp_restoral_thresh; | extern int32_t tcp_restoral_thresh; | ||||
extern int32_t tcp_sad_decay_val; | extern int32_t tcp_sad_decay_val; | ||||
extern int32_t tcp_sad_pacing_interval; | extern int32_t tcp_sad_pacing_interval; | ||||
extern int32_t tcp_sad_low_pps; | extern int32_t tcp_sad_low_pps; | ||||
extern int32_t tcp_map_minimum; | extern int32_t tcp_map_minimum; | ||||
extern int32_t tcp_attack_on_turns_on_logging; | |||||
#endif | #endif | ||||
extern uint32_t tcp_ack_war_time_window; | extern uint32_t tcp_ack_war_time_window; | ||||
extern uint32_t tcp_ack_war_cnt; | extern uint32_t tcp_ack_war_cnt; | ||||
uint32_t tcp_maxmtu(struct in_conninfo *, struct tcp_ifcap *); | uint32_t tcp_maxmtu(struct in_conninfo *, struct tcp_ifcap *); | ||||
uint32_t tcp_maxmtu6(struct in_conninfo *, struct tcp_ifcap *); | uint32_t tcp_maxmtu6(struct in_conninfo *, struct tcp_ifcap *); | ||||
void tcp6_use_min_mtu(struct tcpcb *); | void tcp6_use_min_mtu(struct tcpcb *); | ||||
u_int tcp_maxseg(const struct tcpcb *); | u_int tcp_maxseg(const struct tcpcb *); | ||||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | |||||
int tcp_newreno(struct tcpcb *, struct tcphdr *); | int tcp_newreno(struct tcpcb *, struct tcphdr *); | ||||
int tcp_compute_pipe(struct tcpcb *); | int tcp_compute_pipe(struct tcpcb *); | ||||
uint32_t tcp_compute_initwnd(uint32_t); | uint32_t tcp_compute_initwnd(uint32_t); | ||||
void tcp_sndbuf_autoscale(struct tcpcb *, struct socket *, uint32_t); | void tcp_sndbuf_autoscale(struct tcpcb *, struct socket *, uint32_t); | ||||
int tcp_stats_sample_rollthedice(struct tcpcb *tp, void *seed_bytes, | int tcp_stats_sample_rollthedice(struct tcpcb *tp, void *seed_bytes, | ||||
size_t seed_len); | size_t seed_len); | ||||
int tcp_can_enable_pacing(void); | int tcp_can_enable_pacing(void); | ||||
void tcp_decrement_paced_conn(void); | void tcp_decrement_paced_conn(void); | ||||
void tcp_change_time_units(struct tcpcb *, int); | |||||
void tcp_handle_orphaned_packets(struct tcpcb *); | |||||
struct mbuf * | struct mbuf * | ||||
tcp_m_copym(struct mbuf *m, int32_t off0, int32_t *plen, | tcp_m_copym(struct mbuf *m, int32_t off0, int32_t *plen, | ||||
int32_t seglimit, int32_t segsize, struct sockbuf *sb, bool hw_tls); | int32_t seglimit, int32_t segsize, struct sockbuf *sb, bool hw_tls); | ||||
int tcp_stats_init(void); | int tcp_stats_init(void); | ||||
void tcp_log_end_status(struct tcpcb *tp, uint8_t status); | void tcp_log_end_status(struct tcpcb *tp, uint8_t status); | ||||
#ifdef TCP_REQUEST_TRK | |||||
void tcp_http_free_a_slot(struct tcpcb *tp, struct http_sendfile_track *ent); | |||||
struct http_sendfile_track * | |||||
tcp_http_find_a_req_that_is_completed_by(struct tcpcb *tp, tcp_seq th_ack, int *ip); | |||||
int tcp_http_check_for_comp(struct tcpcb *tp, tcp_seq ack_point); | |||||
int | |||||
tcp_http_is_entry_comp(struct tcpcb *tp, struct http_sendfile_track *ent, tcp_seq ack_point); | |||||
struct http_sendfile_track * | |||||
tcp_http_find_req_for_seq(struct tcpcb *tp, tcp_seq seq); | |||||
void | |||||
tcp_http_log_req_info(struct tcpcb *tp, | |||||
struct http_sendfile_track *http, uint16_t slot, | |||||
uint8_t val, uint64_t offset, uint64_t nbytes); | |||||
uint32_t | |||||
tcp_estimate_tls_overhead(struct socket *so, uint64_t tls_usr_bytes); | |||||
void | |||||
tcp_http_alloc_req(struct tcpcb *tp, union tcp_log_userdata *user, | |||||
uint64_t ts); | |||||
struct http_sendfile_track * | |||||
tcp_http_alloc_req_full(struct tcpcb *tp, struct http_req *req, uint64_t ts, int rec_dups); | |||||
#endif | |||||
#ifdef TCP_ACCOUNTING | #ifdef TCP_ACCOUNTING | ||||
int tcp_do_ack_accounting(struct tcpcb *tp, struct tcphdr *th, struct tcpopt *to, uint32_t tiwin, int mss); | int tcp_do_ack_accounting(struct tcpcb *tp, struct tcphdr *th, struct tcpopt *to, uint32_t tiwin, int mss); | ||||
#endif | #endif | ||||
static inline void | static inline void | ||||
tcp_fields_to_host(struct tcphdr *th) | tcp_fields_to_host(struct tcphdr *th) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 56 Lines • Show Last 20 Lines |