include/net/tcp.h
Source file repositories/reference/linux-study-clean/include/net/tcp.h
File Facts
- System
- Linux kernel
- Corpus path
include/net/tcp.h- Extension
.h- Size
- 93113 bytes
- Lines
- 3092
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: implementation source
- Status
- source implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/list.hlinux/tcp.hlinux/bug.hlinux/slab.hlinux/cache.hlinux/percpu.hlinux/skbuff.hlinux/kref.hlinux/ktime.hlinux/indirect_call_wrapper.hlinux/bits.hnet/inet_connection_sock.hnet/inet_timewait_sock.hnet/inet_hashtables.hnet/checksum.hnet/request_sock.hnet/sock_reuseport.hnet/sock.hnet/snmp.hnet/ip.hnet/tcp_states.hnet/tcp_ao.hnet/inet_ecn.hnet/dst.hnet/mptcp.hnet/xfrm.hnet/secure_seq.hlinux/seq_file.hlinux/memcontrol.hlinux/bpf-cgroup.hlinux/siphash.h
Detected Declarations
struct tcp_splice_statestruct bpf_tcp_req_attrsstruct tcp_skb_cbstruct ack_samplestruct rate_samplestruct tcp_congestion_opsstruct tcp_md5sig_keystruct tcp_md5sig_infostruct tcp4_pseudohdrstruct tcp6_pseudohdrstruct md5_ctxstruct tcp_fastopen_requeststruct tcp_fastopen_contextstruct tcp_seq_afinfostruct tcp_iter_statestruct tcp_sock_af_opsstruct tcp_request_sock_opsstruct tcp_keystruct tcp_plb_statestruct tcp_ulp_opsstruct sk_msgstruct sk_psockstruct strparserenum tcp_tw_statusenum tcp_synack_typeenum tcp_queueenum tcp_skb_cb_sacked_flagsenum tcp_ca_eventenum tcp_ca_ack_event_flagsenum tcp_chronoenum tcp_seq_statesfunction tcp_orphan_count_incfunction tcp_orphan_count_decfunction tcp_under_memory_pressurefunction wraparoundfunction betweenfunction tcp_wmem_free_skbfunction tcp_release_cb_condfunction tcp_dec_quickack_modefunction tcp_ecn_mode_anyfunction tcp_ecn_mode_rfc3168function tcp_ecn_mode_accecnfunction tcp_ecn_disabledfunction tcp_ecn_mode_pendingfunction tcp_ecn_mode_setfunction tcp_update_recv_tstampsfunction oftenfunction tcp_synq_no_recent_overflow
Annotated Snippet
struct tcp_splice_state {
struct pipe_inode_info *pipe;
size_t len;
unsigned int flags;
};
void tcp_tsq_work_init(void);
int tcp_v4_err(struct sk_buff *skb, u32);
void tcp_shutdown(struct sock *sk, int how);
int tcp_v4_rcv(struct sk_buff *skb);
void tcp_remove_empty_skb(struct sock *sk);
int tcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t size);
int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size);
int tcp_sendmsg_fastopen(struct sock *sk, struct msghdr *msg, int *copied,
size_t size, struct ubuf_info *uarg);
void tcp_splice_eof(struct socket *sock);
int tcp_send_mss(struct sock *sk, int *size_goal, int flags);
int tcp_wmem_schedule(struct sock *sk, int copy);
void tcp_push(struct sock *sk, int flags, int mss_now, int nonagle,
int size_goal);
void tcp_release_cb(struct sock *sk);
static inline bool tcp_release_cb_cond(struct sock *sk)
{
#ifdef CONFIG_INET
if (likely(sk->sk_prot->release_cb == tcp_release_cb)) {
if (unlikely(smp_load_acquire(&sk->sk_tsq_flags) & TCP_DEFERRED_ALL))
tcp_release_cb(sk);
return true;
}
#endif
return false;
}
void tcp_write_timer_handler(struct sock *sk);
void tcp_delack_timer_handler(struct sock *sk);
int tcp_ioctl(struct sock *sk, int cmd, int *karg);
enum skb_drop_reason tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb);
void tcp_rcv_established(struct sock *sk, struct sk_buff *skb);
void tcp_rcvbuf_grow(struct sock *sk, u32 newval);
void tcp_rcv_space_adjust(struct sock *sk);
int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp);
void tcp_twsk_destructor(struct sock *sk);
void tcp_twsk_purge(struct list_head *net_exit_list);
int tcp_splice_data_recv(read_descriptor_t *rd_desc, struct sk_buff *skb,
unsigned int offset, size_t len);
ssize_t tcp_splice_read(struct socket *sk, loff_t *ppos,
struct pipe_inode_info *pipe, size_t len,
unsigned int flags);
struct sk_buff *tcp_stream_alloc_skb(struct sock *sk, gfp_t gfp,
bool force_schedule);
static inline void tcp_dec_quickack_mode(struct sock *sk)
{
struct inet_connection_sock *icsk = inet_csk(sk);
if (icsk->icsk_ack.quick) {
/* How many ACKs S/ACKing new data have we sent? */
const unsigned int pkts = inet_csk_ack_scheduled(sk) ? 1 : 0;
if (pkts >= icsk->icsk_ack.quick) {
icsk->icsk_ack.quick = 0;
/* Leaving quickack mode we deflate ATO. */
icsk->icsk_ack.ato = TCP_ATO_MIN;
} else
icsk->icsk_ack.quick -= pkts;
}
}
#define TCP_ECN_MODE_RFC3168 BIT(0)
#define TCP_ECN_QUEUE_CWR BIT(1)
#define TCP_ECN_DEMAND_CWR BIT(2)
#define TCP_ECN_SEEN BIT(3)
#define TCP_ECN_MODE_ACCECN BIT(4)
#define TCP_ECN_DISABLED 0
#define TCP_ECN_MODE_PENDING (TCP_ECN_MODE_RFC3168 | TCP_ECN_MODE_ACCECN)
#define TCP_ECN_MODE_ANY (TCP_ECN_MODE_RFC3168 | TCP_ECN_MODE_ACCECN)
static inline bool tcp_ecn_mode_any(const struct tcp_sock *tp)
{
return tp->ecn_flags & TCP_ECN_MODE_ANY;
}
static inline bool tcp_ecn_mode_rfc3168(const struct tcp_sock *tp)
Annotation
- Immediate include surface: `linux/list.h`, `linux/tcp.h`, `linux/bug.h`, `linux/slab.h`, `linux/cache.h`, `linux/percpu.h`, `linux/skbuff.h`, `linux/kref.h`.
- Detected declarations: `struct tcp_splice_state`, `struct bpf_tcp_req_attrs`, `struct tcp_skb_cb`, `struct ack_sample`, `struct rate_sample`, `struct tcp_congestion_ops`, `struct tcp_md5sig_key`, `struct tcp_md5sig_info`, `struct tcp4_pseudohdr`, `struct tcp6_pseudohdr`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.