blob: 843b6efd3fce3127d467bdaab4f1f26e5f4fd61b [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
2 * This file is auto-generated. Modifications will be lost.
3 *
4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5 * for more information.
6 */
Ben Cheng655a7c02013-10-16 16:09:24 -07007#ifndef _UAPI_LINUX_TCP_H
8#define _UAPI_LINUX_TCP_H
9#include <linux/types.h>
10#include <asm/byteorder.h>
Ben Cheng655a7c02013-10-16 16:09:24 -070011#include <linux/socket.h>
12struct tcphdr {
Tao Baod7db5942015-01-28 10:07:51 -080013 __be16 source;
14 __be16 dest;
Tao Baod7db5942015-01-28 10:07:51 -080015 __be32 seq;
16 __be32 ack_seq;
Ben Cheng655a7c02013-10-16 16:09:24 -070017#ifdef __LITTLE_ENDIAN_BITFIELD
Tao Baod7db5942015-01-28 10:07:51 -080018 __u16 res1 : 4, doff : 4, fin : 1, syn : 1, rst : 1, psh : 1, ack : 1, urg : 1, ece : 1, cwr : 1;
Ben Cheng655a7c02013-10-16 16:09:24 -070019#elif defined(__BIG_ENDIAN_BITFIELD)
Tao Baod7db5942015-01-28 10:07:51 -080020 __u16 doff : 4, res1 : 4, cwr : 1, ece : 1, urg : 1, ack : 1, psh : 1, rst : 1, syn : 1, fin : 1;
Ben Cheng655a7c02013-10-16 16:09:24 -070021#else
22#error "Adjust your <asm/byteorder.h> defines"
Tao Baod7db5942015-01-28 10:07:51 -080023#endif
24 __be16 window;
25 __sum16 check;
26 __be16 urg_ptr;
Ben Cheng655a7c02013-10-16 16:09:24 -070027};
28union tcp_word_hdr {
Tao Baod7db5942015-01-28 10:07:51 -080029 struct tcphdr hdr;
30 __be32 words[5];
Ben Cheng655a7c02013-10-16 16:09:24 -070031};
Tao Baod7db5942015-01-28 10:07:51 -080032#define tcp_flag_word(tp) (((union tcp_word_hdr *) (tp))->words[3])
Ben Cheng655a7c02013-10-16 16:09:24 -070033enum {
Tao Baod7db5942015-01-28 10:07:51 -080034 TCP_FLAG_CWR = __constant_cpu_to_be32(0x00800000),
Tao Baod7db5942015-01-28 10:07:51 -080035 TCP_FLAG_ECE = __constant_cpu_to_be32(0x00400000),
36 TCP_FLAG_URG = __constant_cpu_to_be32(0x00200000),
37 TCP_FLAG_ACK = __constant_cpu_to_be32(0x00100000),
38 TCP_FLAG_PSH = __constant_cpu_to_be32(0x00080000),
Tao Baod7db5942015-01-28 10:07:51 -080039 TCP_FLAG_RST = __constant_cpu_to_be32(0x00040000),
40 TCP_FLAG_SYN = __constant_cpu_to_be32(0x00020000),
41 TCP_FLAG_FIN = __constant_cpu_to_be32(0x00010000),
42 TCP_RESERVED_BITS = __constant_cpu_to_be32(0x0F000000),
Tao Baod7db5942015-01-28 10:07:51 -080043 TCP_DATA_OFFSET = __constant_cpu_to_be32(0xF0000000)
Ben Cheng655a7c02013-10-16 16:09:24 -070044};
Ben Cheng655a7c02013-10-16 16:09:24 -070045#define TCP_MSS_DEFAULT 536U
46#define TCP_MSS_DESIRED 1220U
47#define TCP_NODELAY 1
48#define TCP_MAXSEG 2
Ben Cheng655a7c02013-10-16 16:09:24 -070049#define TCP_CORK 3
50#define TCP_KEEPIDLE 4
51#define TCP_KEEPINTVL 5
52#define TCP_KEEPCNT 6
Ben Cheng655a7c02013-10-16 16:09:24 -070053#define TCP_SYNCNT 7
54#define TCP_LINGER2 8
55#define TCP_DEFER_ACCEPT 9
56#define TCP_WINDOW_CLAMP 10
Ben Cheng655a7c02013-10-16 16:09:24 -070057#define TCP_INFO 11
58#define TCP_QUICKACK 12
59#define TCP_CONGESTION 13
60#define TCP_MD5SIG 14
Ben Cheng655a7c02013-10-16 16:09:24 -070061#define TCP_THIN_LINEAR_TIMEOUTS 16
62#define TCP_THIN_DUPACK 17
63#define TCP_USER_TIMEOUT 18
64#define TCP_REPAIR 19
Ben Cheng655a7c02013-10-16 16:09:24 -070065#define TCP_REPAIR_QUEUE 20
66#define TCP_QUEUE_SEQ 21
67#define TCP_REPAIR_OPTIONS 22
68#define TCP_FASTOPEN 23
Ben Cheng655a7c02013-10-16 16:09:24 -070069#define TCP_TIMESTAMP 24
Christopher Ferris38062f92014-07-09 15:33:25 -070070#define TCP_NOTSENT_LOWAT 25
Christopher Ferris05d08e92016-02-04 13:16:38 -080071#define TCP_CC_INFO 26
72#define TCP_SAVE_SYN 27
73#define TCP_SAVED_SYN 28
Christopher Ferris49f525c2016-12-12 14:55:36 -080074#define TCP_REPAIR_WINDOW 29
Christopher Ferris525ce912017-07-26 13:12:53 -070075#define TCP_FASTOPEN_CONNECT 30
Christopher Ferris1308ad32017-11-14 17:32:13 -080076#define TCP_ULP 31
77#define TCP_MD5SIG_EXT 32
Christopher Ferris934ec942018-01-31 15:29:16 -080078#define TCP_FASTOPEN_KEY 33
79#define TCP_FASTOPEN_NO_COOKIE 34
Christopher Ferris9ce28842018-10-25 12:11:39 -070080#define TCP_ZEROCOPY_RECEIVE 35
81#define TCP_INQ 36
82#define TCP_CM_INQ TCP_INQ
Christopher Ferrisb8a95e22019-10-02 18:29:20 -070083#define TCP_TX_DELAY 37
Christopher Ferris9ce28842018-10-25 12:11:39 -070084#define TCP_REPAIR_ON 1
85#define TCP_REPAIR_OFF 0
86#define TCP_REPAIR_OFF_NO_WP - 1
Christopher Ferris49f525c2016-12-12 14:55:36 -080087struct tcp_repair_opt {
Tao Baod7db5942015-01-28 10:07:51 -080088 __u32 opt_code;
89 __u32 opt_val;
Ben Cheng655a7c02013-10-16 16:09:24 -070090};
Christopher Ferris49f525c2016-12-12 14:55:36 -080091struct tcp_repair_window {
92 __u32 snd_wl1;
93 __u32 snd_wnd;
94 __u32 max_window;
Christopher Ferris49f525c2016-12-12 14:55:36 -080095 __u32 rcv_wnd;
96 __u32 rcv_wup;
97};
Ben Cheng655a7c02013-10-16 16:09:24 -070098enum {
Tao Baod7db5942015-01-28 10:07:51 -080099 TCP_NO_QUEUE,
100 TCP_RECV_QUEUE,
101 TCP_SEND_QUEUE,
Tao Baod7db5942015-01-28 10:07:51 -0800102 TCP_QUEUES_NR,
Ben Cheng655a7c02013-10-16 16:09:24 -0700103};
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800104enum tcp_fastopen_client_fail {
105 TFO_STATUS_UNSPEC,
106 TFO_COOKIE_UNAVAILABLE,
107 TFO_DATA_NOT_ACKED,
108 TFO_SYN_RETRANSMITTED,
109};
Christopher Ferris38062f92014-07-09 15:33:25 -0700110#define TCPI_OPT_TIMESTAMPS 1
Ben Cheng655a7c02013-10-16 16:09:24 -0700111#define TCPI_OPT_SACK 2
112#define TCPI_OPT_WSCALE 4
113#define TCPI_OPT_ECN 8
Christopher Ferris38062f92014-07-09 15:33:25 -0700114#define TCPI_OPT_ECN_SEEN 16
Ben Cheng655a7c02013-10-16 16:09:24 -0700115#define TCPI_OPT_SYN_DATA 32
116enum tcp_ca_state {
Tao Baod7db5942015-01-28 10:07:51 -0800117 TCP_CA_Open = 0,
118#define TCPF_CA_Open (1 << TCP_CA_Open)
119 TCP_CA_Disorder = 1,
Tao Baod7db5942015-01-28 10:07:51 -0800120#define TCPF_CA_Disorder (1 << TCP_CA_Disorder)
121 TCP_CA_CWR = 2,
122#define TCPF_CA_CWR (1 << TCP_CA_CWR)
123 TCP_CA_Recovery = 3,
Tao Baod7db5942015-01-28 10:07:51 -0800124#define TCPF_CA_Recovery (1 << TCP_CA_Recovery)
125 TCP_CA_Loss = 4
126#define TCPF_CA_Loss (1 << TCP_CA_Loss)
Ben Cheng655a7c02013-10-16 16:09:24 -0700127};
128struct tcp_info {
Tao Baod7db5942015-01-28 10:07:51 -0800129 __u8 tcpi_state;
130 __u8 tcpi_ca_state;
131 __u8 tcpi_retransmits;
Tao Baod7db5942015-01-28 10:07:51 -0800132 __u8 tcpi_probes;
133 __u8 tcpi_backoff;
134 __u8 tcpi_options;
135 __u8 tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4;
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800136 __u8 tcpi_delivery_rate_app_limited : 1, tcpi_fastopen_client_fail : 2;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800137 __u32 tcpi_rto;
Tao Baod7db5942015-01-28 10:07:51 -0800138 __u32 tcpi_ato;
139 __u32 tcpi_snd_mss;
140 __u32 tcpi_rcv_mss;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800141 __u32 tcpi_unacked;
Tao Baod7db5942015-01-28 10:07:51 -0800142 __u32 tcpi_sacked;
143 __u32 tcpi_lost;
144 __u32 tcpi_retrans;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800145 __u32 tcpi_fackets;
Tao Baod7db5942015-01-28 10:07:51 -0800146 __u32 tcpi_last_data_sent;
147 __u32 tcpi_last_ack_sent;
148 __u32 tcpi_last_data_recv;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800149 __u32 tcpi_last_ack_recv;
Tao Baod7db5942015-01-28 10:07:51 -0800150 __u32 tcpi_pmtu;
151 __u32 tcpi_rcv_ssthresh;
152 __u32 tcpi_rtt;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800153 __u32 tcpi_rttvar;
Tao Baod7db5942015-01-28 10:07:51 -0800154 __u32 tcpi_snd_ssthresh;
155 __u32 tcpi_snd_cwnd;
156 __u32 tcpi_advmss;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800157 __u32 tcpi_reordering;
Tao Baod7db5942015-01-28 10:07:51 -0800158 __u32 tcpi_rcv_rtt;
159 __u32 tcpi_rcv_space;
160 __u32 tcpi_total_retrans;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800161 __u64 tcpi_pacing_rate;
Tao Baod7db5942015-01-28 10:07:51 -0800162 __u64 tcpi_max_pacing_rate;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800163 __u64 tcpi_bytes_acked;
164 __u64 tcpi_bytes_received;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800165 __u32 tcpi_segs_out;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800166 __u32 tcpi_segs_in;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700167 __u32 tcpi_notsent_bytes;
168 __u32 tcpi_min_rtt;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800169 __u32 tcpi_data_segs_in;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700170 __u32 tcpi_data_segs_out;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800171 __u64 tcpi_delivery_rate;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800172 __u64 tcpi_busy_time;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800173 __u64 tcpi_rwnd_limited;
174 __u64 tcpi_sndbuf_limited;
Christopher Ferris9ce28842018-10-25 12:11:39 -0700175 __u32 tcpi_delivered;
176 __u32 tcpi_delivered_ce;
177 __u64 tcpi_bytes_sent;
178 __u64 tcpi_bytes_retrans;
179 __u32 tcpi_dsack_dups;
180 __u32 tcpi_reord_seen;
Christopher Ferris9584fa42019-12-09 15:36:13 -0800181 __u32 tcpi_rcv_ooopack;
182 __u32 tcpi_snd_wnd;
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800183 __u32 tcpi_rcv_wnd;
184 __u32 tcpi_rehash;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800185};
186enum {
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800187 TCP_NLA_PAD,
188 TCP_NLA_BUSY,
189 TCP_NLA_RWND_LIMITED,
190 TCP_NLA_SNDBUF_LIMITED,
Christopher Ferris525ce912017-07-26 13:12:53 -0700191 TCP_NLA_DATA_SEGS_OUT,
192 TCP_NLA_TOTAL_RETRANS,
Christopher Ferris1308ad32017-11-14 17:32:13 -0800193 TCP_NLA_PACING_RATE,
194 TCP_NLA_DELIVERY_RATE,
195 TCP_NLA_SND_CWND,
196 TCP_NLA_REORDERING,
197 TCP_NLA_MIN_RTT,
198 TCP_NLA_RECUR_RETRANS,
199 TCP_NLA_DELIVERY_RATE_APP_LMT,
Christopher Ferris76a1d452018-06-27 14:12:29 -0700200 TCP_NLA_SNDQ_SIZE,
201 TCP_NLA_CA_STATE,
202 TCP_NLA_SND_SSTHRESH,
Christopher Ferris9ce28842018-10-25 12:11:39 -0700203 TCP_NLA_DELIVERED,
204 TCP_NLA_DELIVERED_CE,
205 TCP_NLA_BYTES_SENT,
206 TCP_NLA_BYTES_RETRANS,
207 TCP_NLA_DSACK_DUPS,
208 TCP_NLA_REORD_SEEN,
Christopher Ferrisd842e432019-03-07 10:21:59 -0800209 TCP_NLA_SRTT,
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700210 TCP_NLA_TIMEOUT_REHASH,
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700211 TCP_NLA_BYTES_NOTSENT,
Christopher Ferris25c18d42020-10-14 17:42:58 -0700212 TCP_NLA_EDT,
Christopher Ferrisa9750ed2021-05-03 14:02:49 -0700213 TCP_NLA_TTL,
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800214 TCP_NLA_REHASH,
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800215};
Ben Cheng655a7c02013-10-16 16:09:24 -0700216#define TCP_MD5SIG_MAXKEYLEN 80
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700217#define TCP_MD5SIG_FLAG_PREFIX 0x1
218#define TCP_MD5SIG_FLAG_IFINDEX 0x2
Christopher Ferris38062f92014-07-09 15:33:25 -0700219struct tcp_md5sig {
Colin Crossd2750672021-06-29 12:52:26 -0700220 struct __kernel_sockaddr_storage tcpm_addr;
Christopher Ferris1308ad32017-11-14 17:32:13 -0800221 __u8 tcpm_flags;
222 __u8 tcpm_prefixlen;
Tao Baod7db5942015-01-28 10:07:51 -0800223 __u16 tcpm_keylen;
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700224 int tcpm_ifindex;
Christopher Ferris1308ad32017-11-14 17:32:13 -0800225 __u8 tcpm_key[TCP_MD5SIG_MAXKEYLEN];
226};
227struct tcp_diag_md5sig {
228 __u8 tcpm_family;
229 __u8 tcpm_prefixlen;
230 __u16 tcpm_keylen;
231 __be32 tcpm_addr[4];
Tao Baod7db5942015-01-28 10:07:51 -0800232 __u8 tcpm_key[TCP_MD5SIG_MAXKEYLEN];
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800233};
Christopher Ferris05667cd2021-02-16 16:01:34 -0800234#define TCP_RECEIVE_ZEROCOPY_FLAG_TLB_CLEAN_HINT 0x1
Christopher Ferris9ce28842018-10-25 12:11:39 -0700235struct tcp_zerocopy_receive {
236 __u64 address;
237 __u32 length;
238 __u32 recv_skip_hint;
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700239 __u32 inq;
240 __s32 err;
Christopher Ferris05667cd2021-02-16 16:01:34 -0800241 __u64 copybuf_address;
242 __s32 copybuf_len;
243 __u32 flags;
Christopher Ferrisa9750ed2021-05-03 14:02:49 -0700244 __u64 msg_control;
245 __u64 msg_controllen;
246 __u32 msg_flags;
247 __u32 reserved;
Christopher Ferris9ce28842018-10-25 12:11:39 -0700248};
Ben Cheng655a7c02013-10-16 16:09:24 -0700249#endif