Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_var.h
Show First 20 Lines • Show All 122 Lines • ▼ Show 20 Lines | |||||
#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); | ||||
/* | /* | ||||
* Tcp control block, one per tcp; fields: | * Tcp control block, one per tcp; fields: | ||||
* Organized for 64 byte cacheline efficiency based | * Organized for 64 byte cacheline efficiency based | ||||
* on common tcp_input/tcp_output processing. | * on common tcp_input/tcp_output processing. | ||||
*/ | */ | ||||
rgrimes: Be aware this is a cache optimized data structure. | |||||
struct tcpcb { | struct tcpcb { | ||||
/* Cache line 1 */ | /* Cache line 1 */ | ||||
struct inpcb *t_inpcb; /* back pointer to internet pcb */ | struct inpcb *t_inpcb; /* back pointer to internet pcb */ | ||||
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 */ | ||||
uint32_t t_maxseg:24, /* maximum segment size */ | uint32_t t_maxseg:24, /* maximum segment size */ | ||||
t_logstate:8; /* State of "black box" logging */ | t_logstate:8; /* State of "black box" logging */ | ||||
uint32_t t_port:16, /* Tunneling (over udp) port */ | uint32_t t_port:16, /* Tunneling (over udp) port */ | ||||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | struct tcpcb { | ||||
int t_softerror; /* possible error not yet reported */ | int t_softerror; /* possible error not yet reported */ | ||||
uint32_t max_sndwnd; /* largest window peer has offered */ | uint32_t max_sndwnd; /* largest window peer has offered */ | ||||
/* Cache line 5 */ | /* Cache line 5 */ | ||||
uint32_t snd_cwnd_prev; /* cwnd prior to retransmit */ | uint32_t snd_cwnd_prev; /* cwnd prior to retransmit */ | ||||
uint32_t snd_ssthresh_prev; /* ssthresh prior to retransmit */ | uint32_t snd_ssthresh_prev; /* ssthresh prior to retransmit */ | ||||
tcp_seq snd_recover_prev; /* snd_recover prior to retransmit */ | tcp_seq snd_recover_prev; /* snd_recover prior to retransmit */ | ||||
int t_sndzerowin; /* zero-window updates sent */ | int t_sndzerowin; /* zero-window updates sent */ | ||||
u_long t_rttupdated; /* number of times rtt sampled */ | |||||
int snd_numholes; /* number of holes seen by sender */ | int snd_numholes; /* number of holes seen by sender */ | ||||
u_int t_badrxtwin; /* window for retransmit recovery */ | u_int t_badrxtwin; /* window for retransmit recovery */ | ||||
TAILQ_HEAD(sackhole_head, sackhole) snd_holes; | TAILQ_HEAD(sackhole_head, sackhole) snd_holes; | ||||
/* SACK scoreboard (sorted) */ | /* SACK scoreboard (sorted) */ | ||||
tcp_seq snd_fack; /* last seq number(+1) sack'd by rcv'r*/ | tcp_seq snd_fack; /* last seq number(+1) sack'd by rcv'r*/ | ||||
struct sackblk sackblks[MAX_SACK_BLKS]; /* seq nos. of sack blocks */ | struct sackblk sackblks[MAX_SACK_BLKS]; /* seq nos. of sack blocks */ | ||||
struct sackhint sackhint; /* SACK scoreboard hint */ | struct sackhint sackhint; /* SACK scoreboard hint */ | ||||
int t_rttlow; /* smallest observerved RTT */ | int t_rttlow; /* smallest observerved RTT */ | ||||
Show All 22 Lines | 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 */ | ||||
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 */ | ||||
Done Inline ActionsChanging the size of and location of this value is going to undo the comment about this structure being carefully cache aligned, though I do not know if that comment is still true. rgrimes: Changing the size of and location of this value is going to undo the comment about this… | |||||
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_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 */ | ||||
▲ Show 20 Lines • Show All 396 Lines • ▼ Show 20 Lines | |||||
* Brakmo and Larry Peterson which outlines a problem caused | * Brakmo and Larry Peterson which outlines a problem caused | ||||
* by insufficient precision in the original implementation, | * by insufficient precision in the original implementation, | ||||
* which results in inappropriately large RTO values for very | * which results in inappropriately large RTO values for very | ||||
* fast networks. | * fast networks. | ||||
*/ | */ | ||||
#define TCP_REXMTVAL(tp) \ | #define TCP_REXMTVAL(tp) \ | ||||
max((tp)->t_rttmin, (((tp)->t_srtt >> (TCP_RTT_SHIFT - TCP_DELTA_SHIFT)) \ | max((tp)->t_rttmin, (((tp)->t_srtt >> (TCP_RTT_SHIFT - TCP_DELTA_SHIFT)) \ | ||||
+ (tp)->t_rttvar) >> TCP_DELTA_SHIFT) | + (tp)->t_rttvar) >> TCP_DELTA_SHIFT) | ||||
/* | |||||
* Programmatically determine the maximum value of | |||||
* an unsigned type, without integer overflow. | |||||
* | |||||
* After determining the byte-size of the type, | |||||
* e.g. 2 for uint16, set the left-most bit. (0x8000) | |||||
* Set all bits but the highest by subtracting one. (0x7FFF) | |||||
* Shift all set bits left by one by way of muliply by 2. (0xFFFE) | |||||
* Finally, set the lowest bit by adding one. (0xFFFF) | |||||
* | |||||
* This is a portable way to programmatically determine | |||||
* the maximum value of an unsigned variable of arbitrary size. | |||||
*/ | |||||
#define UTYPE_MAX(x) \ | |||||
((((1ULL << (sizeof((x)) * 8 - 1)) - 1) * 2) + 1) | |||||
/* | /* | ||||
* TCP statistics. | * TCP statistics. | ||||
* Many of these should be kept per connection, | * Many of these should be kept per connection, | ||||
* but that's inconvenient at the moment. | * but that's inconvenient at the moment. | ||||
*/ | */ | ||||
struct tcpstat { | struct tcpstat { | ||||
uint64_t tcps_connattempt; /* connections initiated */ | uint64_t tcps_connattempt; /* connections initiated */ | ||||
uint64_t tcps_accepts; /* connections accepted */ | uint64_t tcps_accepts; /* connections accepted */ | ||||
uint64_t tcps_connects; /* connections established */ | uint64_t tcps_connects; /* connections established */ | ||||
uint64_t tcps_drops; /* connections dropped */ | uint64_t tcps_drops; /* connections dropped */ | ||||
uint64_t tcps_conndrops; /* embryonic connections dropped */ | uint64_t tcps_conndrops; /* embryonic connections dropped */ | ||||
Not Done Inline ActionsAh, now this explains why I could not find CEILINC on my 12.1 machine... This set of macros and usage should probably be discussed on the -arch mailling list. This is a general mechanism and should probably be considered on a grander scale and by a wider audiance than just netinet stuff rgrimes: Ah, now this explains why I could not find CEILINC on my 12.1 machine... This set of macros and… | |||||
uint64_t tcps_minmssdrops; /* average minmss too low drops */ | uint64_t tcps_minmssdrops; /* average minmss too low drops */ | ||||
uint64_t tcps_closed; /* conn. closed (includes drops) */ | uint64_t tcps_closed; /* conn. closed (includes drops) */ | ||||
uint64_t tcps_segstimed; /* segs where we tried to get rtt */ | uint64_t tcps_segstimed; /* segs where we tried to get rtt */ | ||||
uint64_t tcps_rttupdated; /* times we succeeded */ | uint64_t tcps_rttupdated; /* times we succeeded */ | ||||
uint64_t tcps_delack; /* delayed acks sent */ | uint64_t tcps_delack; /* delayed acks sent */ | ||||
uint64_t tcps_timeoutdrop; /* conn. dropped in rxmt timeout */ | uint64_t tcps_timeoutdrop; /* conn. dropped in rxmt timeout */ | ||||
uint64_t tcps_rexmttimeo; /* retransmit timeouts */ | uint64_t tcps_rexmttimeo; /* retransmit timeouts */ | ||||
uint64_t tcps_persisttimeo; /* persist timeouts */ | uint64_t tcps_persisttimeo; /* persist timeouts */ | ||||
▲ Show 20 Lines • Show All 594 Lines • Show Last 20 Lines |
Be aware this is a cache optimized data structure.