blob: 509cd961068d5d89c2b865c7baf1bab4aff2ea2c [file] [log] [blame]
David Howells607ca462012-10-13 10:46:48 +01001#ifndef _UAPI_INET_DIAG_H_
2#define _UAPI_INET_DIAG_H_
3
4#include <linux/types.h>
5
6/* Just some random number */
7#define TCPDIAG_GETSOCK 18
8#define DCCPDIAG_GETSOCK 19
9
10#define INET_DIAG_GETSOCK_MAX 24
11
12/* Socket identity */
13struct inet_diag_sockid {
14 __be16 idiag_sport;
15 __be16 idiag_dport;
16 __be32 idiag_src[4];
17 __be32 idiag_dst[4];
18 __u32 idiag_if;
19 __u32 idiag_cookie[2];
20#define INET_DIAG_NOCOOKIE (~0U)
21};
22
23/* Request structure */
24
25struct inet_diag_req {
26 __u8 idiag_family; /* Family of addresses. */
27 __u8 idiag_src_len;
28 __u8 idiag_dst_len;
29 __u8 idiag_ext; /* Query extended information */
30
31 struct inet_diag_sockid id;
32
33 __u32 idiag_states; /* States to dump */
34 __u32 idiag_dbs; /* Tables to dump (NI) */
35};
36
37struct inet_diag_req_v2 {
38 __u8 sdiag_family;
39 __u8 sdiag_protocol;
40 __u8 idiag_ext;
41 __u8 pad;
42 __u32 idiag_states;
43 struct inet_diag_sockid id;
44};
45
46enum {
47 INET_DIAG_REQ_NONE,
48 INET_DIAG_REQ_BYTECODE,
49};
50
51#define INET_DIAG_REQ_MAX INET_DIAG_REQ_BYTECODE
52
53/* Bytecode is sequence of 4 byte commands followed by variable arguments.
54 * All the commands identified by "code" are conditional jumps forward:
55 * to offset cc+"yes" or to offset cc+"no". "yes" is supposed to be
56 * length of the command and its arguments.
57 */
58
59struct inet_diag_bc_op {
60 unsigned char code;
61 unsigned char yes;
62 unsigned short no;
63};
64
65enum {
66 INET_DIAG_BC_NOP,
67 INET_DIAG_BC_JMP,
68 INET_DIAG_BC_S_GE,
69 INET_DIAG_BC_S_LE,
70 INET_DIAG_BC_D_GE,
71 INET_DIAG_BC_D_LE,
72 INET_DIAG_BC_AUTO,
73 INET_DIAG_BC_S_COND,
74 INET_DIAG_BC_D_COND,
David Ahern637c8412016-06-23 18:42:51 -070075 INET_DIAG_BC_DEV_COND, /* u32 ifindex */
Lorenzo Colittia52e95a2016-08-24 15:46:26 +090076 INET_DIAG_BC_MARK_COND,
David Howells607ca462012-10-13 10:46:48 +010077};
78
79struct inet_diag_hostcond {
80 __u8 family;
81 __u8 prefix_len;
82 int port;
83 __be32 addr[0];
84};
85
Lorenzo Colittia52e95a2016-08-24 15:46:26 +090086struct inet_diag_markcond {
87 __u32 mark;
88 __u32 mask;
89};
90
David Howells607ca462012-10-13 10:46:48 +010091/* Base info structure. It contains socket identity (addrs/ports/cookie)
92 * and, alas, the information shown by netstat. */
93struct inet_diag_msg {
94 __u8 idiag_family;
95 __u8 idiag_state;
96 __u8 idiag_timer;
97 __u8 idiag_retrans;
98
99 struct inet_diag_sockid id;
100
101 __u32 idiag_expires;
102 __u32 idiag_rqueue;
103 __u32 idiag_wqueue;
104 __u32 idiag_uid;
105 __u32 idiag_inode;
106};
107
108/* Extensions */
109
110enum {
111 INET_DIAG_NONE,
112 INET_DIAG_MEMINFO,
113 INET_DIAG_INFO,
114 INET_DIAG_VEGASINFO,
115 INET_DIAG_CONG,
116 INET_DIAG_TOS,
117 INET_DIAG_TCLASS,
118 INET_DIAG_SKMEMINFO,
Pavel Emelyanove4e541a2012-10-23 22:29:56 +0400119 INET_DIAG_SHUTDOWN,
Daniel Borkmanne3118e82014-09-26 22:37:36 +0200120 INET_DIAG_DCTCPINFO,
Craig Gallek35ac8382015-06-15 11:26:20 -0400121 INET_DIAG_PROTOCOL, /* response attribute only */
Phil Sutter20462152015-06-24 11:02:51 +0200122 INET_DIAG_SKV6ONLY,
Xin Long8f840e42016-04-14 15:35:33 +0800123 INET_DIAG_LOCALS,
124 INET_DIAG_PEERS,
Nicolas Dichtel6ed46d12016-04-26 10:06:14 +0200125 INET_DIAG_PAD,
Lorenzo Colittid545cac2016-09-08 00:42:25 +0900126 INET_DIAG_MARK,
Neal Cardwell0f8782e2016-09-19 23:39:23 -0400127 INET_DIAG_BBRINFO,
Nicolas Dichtel6ed46d12016-04-26 10:06:14 +0200128 __INET_DIAG_MAX,
David Howells607ca462012-10-13 10:46:48 +0100129};
130
Nicolas Dichtel6ed46d12016-04-26 10:06:14 +0200131#define INET_DIAG_MAX (__INET_DIAG_MAX - 1)
David Howells607ca462012-10-13 10:46:48 +0100132
133/* INET_DIAG_MEM */
134
135struct inet_diag_meminfo {
136 __u32 idiag_rmem;
137 __u32 idiag_wmem;
138 __u32 idiag_fmem;
139 __u32 idiag_tmem;
140};
141
142/* INET_DIAG_VEGASINFO */
143
144struct tcpvegas_info {
145 __u32 tcpv_enabled;
146 __u32 tcpv_rttcnt;
147 __u32 tcpv_rtt;
148 __u32 tcpv_minrtt;
149};
150
Daniel Borkmanne3118e82014-09-26 22:37:36 +0200151/* INET_DIAG_DCTCPINFO */
152
153struct tcp_dctcp_info {
154 __u16 dctcp_enabled;
155 __u16 dctcp_ce_state;
156 __u32 dctcp_alpha;
157 __u32 dctcp_ab_ecn;
158 __u32 dctcp_ab_tot;
159};
David Howells607ca462012-10-13 10:46:48 +0100160
Neal Cardwell0f8782e2016-09-19 23:39:23 -0400161/* INET_DIAG_BBRINFO */
162
163struct tcp_bbr_info {
164 /* u64 bw: max-filtered BW (app throughput) estimate in Byte per sec: */
165 __u32 bbr_bw_lo; /* lower 32 bits of bw */
166 __u32 bbr_bw_hi; /* upper 32 bits of bw */
167 __u32 bbr_min_rtt; /* min-filtered RTT in uSec */
168 __u32 bbr_pacing_gain; /* pacing gain shifted left 8 bits */
169 __u32 bbr_cwnd_gain; /* cwnd gain shifted left 8 bits */
170};
171
Eric Dumazet64f40ff2015-04-28 16:23:48 -0700172union tcp_cc_info {
173 struct tcpvegas_info vegas;
174 struct tcp_dctcp_info dctcp;
Neal Cardwell0f8782e2016-09-19 23:39:23 -0400175 struct tcp_bbr_info bbr;
Eric Dumazet64f40ff2015-04-28 16:23:48 -0700176};
David Howells607ca462012-10-13 10:46:48 +0100177#endif /* _UAPI_INET_DIAG_H_ */