tcp.h (db6da59cf27b5661ced03754ae0550f8914eda9e) tcp.h (e1d001fa5b477c4da46a29be1fcece91db7c7c6f)
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * INET An implementation of the TCP/IP protocol suite for the LINUX
4 * operating system. INET is implemented using the BSD Socket
5 * interface as the means of communication with the user level.
6 *
7 * Definitions for the TCP module.
8 *

--- 147 unchanged lines hidden (view full) ---

156#define TCP_KEEPALIVE_PROBES 9 /* Max of 9 keepalive probes */
157#define TCP_KEEPALIVE_INTVL (75*HZ)
158
159#define MAX_TCP_KEEPIDLE 32767
160#define MAX_TCP_KEEPINTVL 32767
161#define MAX_TCP_KEEPCNT 127
162#define MAX_TCP_SYNCNT 127
163
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * INET An implementation of the TCP/IP protocol suite for the LINUX
4 * operating system. INET is implemented using the BSD Socket
5 * interface as the means of communication with the user level.
6 *
7 * Definitions for the TCP module.
8 *

--- 147 unchanged lines hidden (view full) ---

156#define TCP_KEEPALIVE_PROBES 9 /* Max of 9 keepalive probes */
157#define TCP_KEEPALIVE_INTVL (75*HZ)
158
159#define MAX_TCP_KEEPIDLE 32767
160#define MAX_TCP_KEEPINTVL 32767
161#define MAX_TCP_KEEPCNT 127
162#define MAX_TCP_SYNCNT 127
163
164#define TCP_SYNQ_INTERVAL (HZ/5) /* Period of SYNACK timer */
165
166#define TCP_PAWS_24DAYS (60 * 60 * 24 * 24)
167#define TCP_PAWS_MSL 60 /* Per-host timestamps are invalidated
168 * after this time. It should be equal
169 * (or greater than) TCP_TIMEWAIT_LEN
170 * to provide reliability equal to one
171 * provided by timewait state.
172 */
173#define TCP_PAWS_WINDOW 1 /* Replay window for per-host

--- 150 unchanged lines hidden (view full) ---

324int tcp_v4_rcv(struct sk_buff *skb);
325
326void tcp_remove_empty_skb(struct sock *sk);
327int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw);
328int tcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t size);
329int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size);
330int tcp_sendmsg_fastopen(struct sock *sk, struct msghdr *msg, int *copied,
331 size_t size, struct ubuf_info *uarg);
164#define TCP_PAWS_24DAYS (60 * 60 * 24 * 24)
165#define TCP_PAWS_MSL 60 /* Per-host timestamps are invalidated
166 * after this time. It should be equal
167 * (or greater than) TCP_TIMEWAIT_LEN
168 * to provide reliability equal to one
169 * provided by timewait state.
170 */
171#define TCP_PAWS_WINDOW 1 /* Replay window for per-host

--- 150 unchanged lines hidden (view full) ---

322int tcp_v4_rcv(struct sk_buff *skb);
323
324void tcp_remove_empty_skb(struct sock *sk);
325int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw);
326int tcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t size);
327int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size);
328int tcp_sendmsg_fastopen(struct sock *sk, struct msghdr *msg, int *copied,
329 size_t size, struct ubuf_info *uarg);
330void tcp_splice_eof(struct socket *sock);
332int tcp_sendpage(struct sock *sk, struct page *page, int offset, size_t size,
333 int flags);
334int tcp_sendpage_locked(struct sock *sk, struct page *page, int offset,
335 size_t size, int flags);
331int tcp_sendpage(struct sock *sk, struct page *page, int offset, size_t size,
332 int flags);
333int tcp_sendpage_locked(struct sock *sk, struct page *page, int offset,
334 size_t size, int flags);
336ssize_t do_tcp_sendpages(struct sock *sk, struct page *page, int offset,
337 size_t size, int flags);
338int tcp_send_mss(struct sock *sk, int *size_goal, int flags);
335int tcp_send_mss(struct sock *sk, int *size_goal, int flags);
336int tcp_wmem_schedule(struct sock *sk, int copy);
339void tcp_push(struct sock *sk, int flags, int mss_now, int nonagle,
340 int size_goal);
341void tcp_release_cb(struct sock *sk);
342void tcp_wfree(struct sk_buff *skb);
343void tcp_write_timer_handler(struct sock *sk);
344void tcp_delack_timer_handler(struct sock *sk);
337void tcp_push(struct sock *sk, int flags, int mss_now, int nonagle,
338 int size_goal);
339void tcp_release_cb(struct sock *sk);
340void tcp_wfree(struct sk_buff *skb);
341void tcp_write_timer_handler(struct sock *sk);
342void tcp_delack_timer_handler(struct sock *sk);
345int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg);
343int tcp_ioctl(struct sock *sk, int cmd, int *karg);
346int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb);
347void tcp_rcv_established(struct sock *sk, struct sk_buff *skb);
348void tcp_rcv_space_adjust(struct sock *sk);
349int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp);
350void tcp_twsk_destructor(struct sock *sk);
351void tcp_twsk_purge(struct list_head *net_exit_list, int family);
352ssize_t tcp_splice_read(struct socket *sk, loff_t *ppos,
353 struct pipe_inode_info *pipe, size_t len,
354 unsigned int flags);
344int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb);
345void tcp_rcv_established(struct sock *sk, struct sk_buff *skb);
346void tcp_rcv_space_adjust(struct sock *sk);
347int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp);
348void tcp_twsk_destructor(struct sock *sk);
349void tcp_twsk_purge(struct list_head *net_exit_list, int family);
350ssize_t tcp_splice_read(struct socket *sk, loff_t *ppos,
351 struct pipe_inode_info *pipe, size_t len,
352 unsigned int flags);
355struct sk_buff *tcp_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp,
353struct sk_buff *tcp_stream_alloc_skb(struct sock *sk, gfp_t gfp,
356 bool force_schedule);
357
358void tcp_enter_quickack_mode(struct sock *sk, unsigned int max_quickacks);
359static inline void tcp_dec_quickack_mode(struct sock *sk,
360 const unsigned int pkts)
361{
362 struct inet_connection_sock *icsk = inet_csk(sk);
363

--- 263 unchanged lines hidden (view full) ---

627
628/* tcp_input.c */
629void tcp_rearm_rto(struct sock *sk);
630void tcp_synack_rtt_meas(struct sock *sk, struct request_sock *req);
631void tcp_reset(struct sock *sk, struct sk_buff *skb);
632void tcp_skb_mark_lost_uncond_verify(struct tcp_sock *tp, struct sk_buff *skb);
633void tcp_fin(struct sock *sk);
634void tcp_check_space(struct sock *sk);
354 bool force_schedule);
355
356void tcp_enter_quickack_mode(struct sock *sk, unsigned int max_quickacks);
357static inline void tcp_dec_quickack_mode(struct sock *sk,
358 const unsigned int pkts)
359{
360 struct inet_connection_sock *icsk = inet_csk(sk);
361

--- 263 unchanged lines hidden (view full) ---

625
626/* tcp_input.c */
627void tcp_rearm_rto(struct sock *sk);
628void tcp_synack_rtt_meas(struct sock *sk, struct request_sock *req);
629void tcp_reset(struct sock *sk, struct sk_buff *skb);
630void tcp_skb_mark_lost_uncond_verify(struct tcp_sock *tp, struct sk_buff *skb);
631void tcp_fin(struct sock *sk);
632void tcp_check_space(struct sock *sk);
633void tcp_sack_compress_send_ack(struct sock *sk);
635
636/* tcp_timer.c */
637void tcp_init_xmit_timers(struct sock *);
638static inline void tcp_clear_xmit_timers(struct sock *sk)
639{
640 if (hrtimer_try_to_cancel(&tcp_sk(sk)->pacing_timer) == 1)
641 __sock_put(sk);
642

--- 822 unchanged lines hidden (view full) ---

1465
1466 tp->rcv_ssthresh = min(tp->rcv_ssthresh, 4U * tp->advmss);
1467 if (unused_mem)
1468 tp->rcv_ssthresh = max_t(u32, tp->rcv_ssthresh,
1469 tcp_win_from_space(sk, unused_mem));
1470}
1471
1472void tcp_cleanup_rbuf(struct sock *sk, int copied);
634
635/* tcp_timer.c */
636void tcp_init_xmit_timers(struct sock *);
637static inline void tcp_clear_xmit_timers(struct sock *sk)
638{
639 if (hrtimer_try_to_cancel(&tcp_sk(sk)->pacing_timer) == 1)
640 __sock_put(sk);
641

--- 822 unchanged lines hidden (view full) ---

1464
1465 tp->rcv_ssthresh = min(tp->rcv_ssthresh, 4U * tp->advmss);
1466 if (unused_mem)
1467 tp->rcv_ssthresh = max_t(u32, tp->rcv_ssthresh,
1468 tcp_win_from_space(sk, unused_mem));
1469}
1470
1471void tcp_cleanup_rbuf(struct sock *sk, int copied);
1472void __tcp_cleanup_rbuf(struct sock *sk, int copied);
1473
1473
1474
1474/* We provision sk_rcvbuf around 200% of sk_rcvlowat.
1475 * If 87.5 % (7/8) of the space has been consumed, we want to override
1476 * SO_RCVLOWAT constraint, since we are receiving skbs with too small
1477 * len/truesize ratio.
1478 */
1479static inline bool tcp_rmem_pressure(const struct sock *sk)
1480{
1481 int rcvbuf, threshold;

--- 556 unchanged lines hidden (view full) ---

2038
2039struct sk_buff *tcp_gso_segment(struct sk_buff *skb,
2040 netdev_features_t features);
2041struct sk_buff *tcp_gro_receive(struct list_head *head, struct sk_buff *skb);
2042INDIRECT_CALLABLE_DECLARE(int tcp4_gro_complete(struct sk_buff *skb, int thoff));
2043INDIRECT_CALLABLE_DECLARE(struct sk_buff *tcp4_gro_receive(struct list_head *head, struct sk_buff *skb));
2044INDIRECT_CALLABLE_DECLARE(int tcp6_gro_complete(struct sk_buff *skb, int thoff));
2045INDIRECT_CALLABLE_DECLARE(struct sk_buff *tcp6_gro_receive(struct list_head *head, struct sk_buff *skb));
1475/* We provision sk_rcvbuf around 200% of sk_rcvlowat.
1476 * If 87.5 % (7/8) of the space has been consumed, we want to override
1477 * SO_RCVLOWAT constraint, since we are receiving skbs with too small
1478 * len/truesize ratio.
1479 */
1480static inline bool tcp_rmem_pressure(const struct sock *sk)
1481{
1482 int rcvbuf, threshold;

--- 556 unchanged lines hidden (view full) ---

2039
2040struct sk_buff *tcp_gso_segment(struct sk_buff *skb,
2041 netdev_features_t features);
2042struct sk_buff *tcp_gro_receive(struct list_head *head, struct sk_buff *skb);
2043INDIRECT_CALLABLE_DECLARE(int tcp4_gro_complete(struct sk_buff *skb, int thoff));
2044INDIRECT_CALLABLE_DECLARE(struct sk_buff *tcp4_gro_receive(struct list_head *head, struct sk_buff *skb));
2045INDIRECT_CALLABLE_DECLARE(int tcp6_gro_complete(struct sk_buff *skb, int thoff));
2046INDIRECT_CALLABLE_DECLARE(struct sk_buff *tcp6_gro_receive(struct list_head *head, struct sk_buff *skb));
2046int tcp_gro_complete(struct sk_buff *skb);
2047void tcp_gro_complete(struct sk_buff *skb);
2047
2048void __tcp_v4_send_check(struct sk_buff *skb, __be32 saddr, __be32 daddr);
2049
2050static inline u32 tcp_notsent_lowat(const struct tcp_sock *tp)
2051{
2052 struct net *net = sock_net((struct sock *)tp);
2053 return tp->notsent_lowat ?: READ_ONCE(net->ipv4.sysctl_tcp_notsent_lowat);
2054}

--- 266 unchanged lines hidden (view full) ---

2321struct sk_psock;
2322
2323#ifdef CONFIG_BPF_SYSCALL
2324struct proto *tcp_bpf_get_proto(struct sock *sk, struct sk_psock *psock);
2325int tcp_bpf_update_proto(struct sock *sk, struct sk_psock *psock, bool restore);
2326void tcp_bpf_clone(const struct sock *sk, struct sock *newsk);
2327#endif /* CONFIG_BPF_SYSCALL */
2328
2048
2049void __tcp_v4_send_check(struct sk_buff *skb, __be32 saddr, __be32 daddr);
2050
2051static inline u32 tcp_notsent_lowat(const struct tcp_sock *tp)
2052{
2053 struct net *net = sock_net((struct sock *)tp);
2054 return tp->notsent_lowat ?: READ_ONCE(net->ipv4.sysctl_tcp_notsent_lowat);
2055}

--- 266 unchanged lines hidden (view full) ---

2322struct sk_psock;
2323
2324#ifdef CONFIG_BPF_SYSCALL
2325struct proto *tcp_bpf_get_proto(struct sock *sk, struct sk_psock *psock);
2326int tcp_bpf_update_proto(struct sock *sk, struct sk_psock *psock, bool restore);
2327void tcp_bpf_clone(const struct sock *sk, struct sock *newsk);
2328#endif /* CONFIG_BPF_SYSCALL */
2329
2330#ifdef CONFIG_INET
2331void tcp_eat_skb(struct sock *sk, struct sk_buff *skb);
2332#else
2333static inline void tcp_eat_skb(struct sock *sk, struct sk_buff *skb)
2334{
2335}
2336#endif
2337
2329int tcp_bpf_sendmsg_redir(struct sock *sk, bool ingress,
2330 struct sk_msg *msg, u32 bytes, int flags);
2331#endif /* CONFIG_NET_SOCK_MSG */
2332
2333#if !defined(CONFIG_BPF_SYSCALL) || !defined(CONFIG_NET_SOCK_MSG)
2334static inline void tcp_bpf_clone(const struct sock *sk, struct sock *newsk)
2335{
2336}

--- 149 unchanged lines hidden ---
2338int tcp_bpf_sendmsg_redir(struct sock *sk, bool ingress,
2339 struct sk_msg *msg, u32 bytes, int flags);
2340#endif /* CONFIG_NET_SOCK_MSG */
2341
2342#if !defined(CONFIG_BPF_SYSCALL) || !defined(CONFIG_NET_SOCK_MSG)
2343static inline void tcp_bpf_clone(const struct sock *sk, struct sock *newsk)
2344{
2345}

--- 149 unchanged lines hidden ---