Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_var.h
Show First 20 Lines • Show All 84 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 75 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 19 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 */ | ||||
uint8_t t_rttupdated; /* number of times rtt sampled */ | |||||
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… | |||||
uint8_t t_tfo_client_cookie_len; /* TCP Fast Open client cookie length */ | uint8_t t_tfo_client_cookie_len; /* TCP Fast Open client cookie length */ | ||||
unsigned int *t_tfo_pending; /* TCP Fast Open server pending counter */ | unsigned int *t_tfo_pending; /* TCP Fast Open 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 */ | ||||
#ifdef TCPPCAP | #ifdef TCPPCAP | ||||
struct mbufq t_inpkts; /* List of saved input packets. */ | struct mbufq t_inpkts; /* List of saved input packets. */ | ||||
▲ Show 20 Lines • Show All 276 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 | |||||
* a signed or unsigned type, without integer overflow. | |||||
* Determining if the type of a variable is signed | |||||
* or not in a portable way without typeof() is quite | |||||
* involved but the resuting code is still optimal. | |||||
*/ | |||||
#define UTYPE_MAX(x) \ | |||||
((((1 << (sizeof((x)) * 8 - 1)) - 1) * 2) + 1) | |||||
#define TYPE_MAX(x) \ | |||||
((((1 << (sizeof((x)) * 8 - 2)) - 1) * 2) + 1) | |||||
#define HIGH_BIT(n) \ | |||||
((n) & (1 << (sizeof(n) * 8 - 1))) | |||||
#define IS_SIGNED(n) \ | |||||
(HIGH_BIT(n) ? \ | |||||
HIGH_BIT(n >> 1) != 0 : \ | |||||
HIGH_BIT(~n >> 1) != 0) | |||||
/* | |||||
* Macro to Post-increment counters that should NOT | |||||
* overflow, as a drop-in replacement for 'x++'. | |||||
*/ | |||||
#define INCMAX(x) \ | |||||
IS_SIGNED(x) ? \ | |||||
((x) < TYPE_MAX(x)) ? (x)++ : (x) : \ | |||||
((x) < UTYPE_MAX(x)) ? (x)++ : (x) | |||||
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… | |||||
/* | /* | ||||
* 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 */ | ||||
▲ Show 20 Lines • Show All 514 Lines • Show Last 20 Lines |
Be aware this is a cache optimized data structure.