include/linux/tcp.h
Source file repositories/reference/linux-study-clean/include/linux/tcp.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/tcp.h- Extension
.h- Size
- 22763 bytes
- Lines
- 663
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/skbuff.hlinux/win_minmax.hnet/sock.hnet/inet_connection_sock.hnet/inet_timewait_sock.huapi/linux/tcp.h
Detected Declarations
struct tcp_fastopen_cookiestruct tcp_sack_block_wirestruct tcp_sack_blockstruct tcp_options_receivedstruct tcp_request_sock_opsstruct tcp_request_sockstruct tcp_sockstruct tcp_rackstruct tcp_timewait_sockenum tsq_enumenum tsq_flagsfunction __tcp_hdrlenfunction tcp_hdrlenfunction inner_tcp_hdrlenfunction skb_tcp_all_headersfunction skb_inner_tcp_all_headersfunction tcp_optlenfunction tcp_clear_optionsfunction tcp_rsk_used_aofunction tcp_passive_fastopenfunction fastopen_queue_tunefunction tcp_move_synfunction tcp_saved_syn_freefunction tcp_saved_syn_lenfunction tcp_mss_clampfunction dst_tcp_usec_ts
Annotated Snippet
struct tcp_fastopen_cookie {
__le64 val[DIV_ROUND_UP(TCP_FASTOPEN_COOKIE_MAX, sizeof(u64))];
s8 len;
bool exp; /* In RFC6994 experimental option format */
};
/* This defines a selective acknowledgement block. */
struct tcp_sack_block_wire {
__be32 start_seq;
__be32 end_seq;
};
struct tcp_sack_block {
u32 start_seq;
u32 end_seq;
};
/*These are used to set the sack_ok field in struct tcp_options_received */
#define TCP_SACK_SEEN (1 << 0) /*1 = peer is SACK capable, */
#define TCP_DSACK_SEEN (1 << 2) /*1 = DSACK was received from peer*/
struct tcp_options_received {
/* PAWS/RTTM data */
int ts_recent_stamp;/* Time we stored ts_recent (for aging) */
u32 ts_recent; /* Time stamp to echo next */
u32 rcv_tsval; /* Time stamp value */
u32 rcv_tsecr; /* Time stamp echo reply */
u16 saw_tstamp : 1, /* Saw TIMESTAMP on last packet */
tstamp_ok : 1, /* TIMESTAMP seen on SYN packet */
dsack : 1, /* D-SACK is scheduled */
wscale_ok : 1, /* Wscale seen on SYN packet */
sack_ok : 3, /* SACK seen on SYN packet */
smc_ok : 1, /* SMC seen on SYN packet */
snd_wscale : 4, /* Window scaling received from sender */
rcv_wscale : 4; /* Window scaling to send to receiver */
u8 accecn:6, /* AccECN index in header, 0=no options */
saw_unknown:1, /* Received unknown option */
unused:1;
u8 num_sacks; /* Number of SACK blocks */
u16 user_mss; /* mss requested by user in ioctl */
u16 mss_clamp; /* Maximal mss, negotiated at connection setup */
};
static inline void tcp_clear_options(struct tcp_options_received *rx_opt)
{
rx_opt->tstamp_ok = rx_opt->sack_ok = 0;
rx_opt->wscale_ok = rx_opt->snd_wscale = 0;
#if IS_ENABLED(CONFIG_SMC)
rx_opt->smc_ok = 0;
#endif
}
/* This is the max number of SACKS that we'll generate and process. It's safe
* to increase this, although since:
* size = TCPOLEN_SACK_BASE_ALIGNED (4) + n * TCPOLEN_SACK_PERBLOCK (8)
* only four options will fit in a standard TCP header */
#define TCP_NUM_SACKS 4
struct tcp_request_sock_ops;
struct tcp_request_sock {
struct inet_request_sock req;
const struct tcp_request_sock_ops *af_specific;
u64 snt_synack; /* first SYNACK sent time */
bool tfo_listener;
bool is_mptcp;
bool req_usec_ts;
#if IS_ENABLED(CONFIG_MPTCP)
bool drop_req;
#endif
u32 txhash;
u32 rcv_isn;
u32 snt_isn;
u32 ts_off;
u32 snt_tsval_first;
u32 snt_tsval_last;
u32 last_oow_ack_time; /* last SYNACK */
u32 rcv_nxt; /* the ack # by SYNACK. For
* FastOpen it's the seq#
* after data-in-SYN.
*/
u8 syn_tos;
bool accecn_ok;
u8 syn_ect_snt: 2,
syn_ect_rcv: 2,
accecn_fail_mode:4;
u8 saw_accecn_opt :2;
#ifdef CONFIG_TCP_AO
u8 ao_keyid;
u8 ao_rcv_next;
Annotation
- Immediate include surface: `linux/skbuff.h`, `linux/win_minmax.h`, `net/sock.h`, `net/inet_connection_sock.h`, `net/inet_timewait_sock.h`, `uapi/linux/tcp.h`.
- Detected declarations: `struct tcp_fastopen_cookie`, `struct tcp_sack_block_wire`, `struct tcp_sack_block`, `struct tcp_options_received`, `struct tcp_request_sock_ops`, `struct tcp_request_sock`, `struct tcp_sock`, `struct tcp_rack`, `struct tcp_timewait_sock`, `enum tsq_enum`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.