1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2 #ifndef _UAPI_MPTCP_H
3 #define _UAPI_MPTCP_H
4 
5 #include <linux/const.h>
6 #include <linux/types.h>
7 
8 #define MPTCP_SUBFLOW_FLAG_MCAP_REM		_BITUL(0)
9 #define MPTCP_SUBFLOW_FLAG_MCAP_LOC		_BITUL(1)
10 #define MPTCP_SUBFLOW_FLAG_JOIN_REM		_BITUL(2)
11 #define MPTCP_SUBFLOW_FLAG_JOIN_LOC		_BITUL(3)
12 #define MPTCP_SUBFLOW_FLAG_BKUP_REM		_BITUL(4)
13 #define MPTCP_SUBFLOW_FLAG_BKUP_LOC		_BITUL(5)
14 #define MPTCP_SUBFLOW_FLAG_FULLY_ESTABLISHED	_BITUL(6)
15 #define MPTCP_SUBFLOW_FLAG_CONNECTED		_BITUL(7)
16 #define MPTCP_SUBFLOW_FLAG_MAPVALID		_BITUL(8)
17 
18 enum {
19 	MPTCP_SUBFLOW_ATTR_UNSPEC,
20 	MPTCP_SUBFLOW_ATTR_TOKEN_REM,
21 	MPTCP_SUBFLOW_ATTR_TOKEN_LOC,
22 	MPTCP_SUBFLOW_ATTR_RELWRITE_SEQ,
23 	MPTCP_SUBFLOW_ATTR_MAP_SEQ,
24 	MPTCP_SUBFLOW_ATTR_MAP_SFSEQ,
25 	MPTCP_SUBFLOW_ATTR_SSN_OFFSET,
26 	MPTCP_SUBFLOW_ATTR_MAP_DATALEN,
27 	MPTCP_SUBFLOW_ATTR_FLAGS,
28 	MPTCP_SUBFLOW_ATTR_ID_REM,
29 	MPTCP_SUBFLOW_ATTR_ID_LOC,
30 	MPTCP_SUBFLOW_ATTR_PAD,
31 	__MPTCP_SUBFLOW_ATTR_MAX
32 };
33 
34 #define MPTCP_SUBFLOW_ATTR_MAX (__MPTCP_SUBFLOW_ATTR_MAX - 1)
35 
36 /* netlink interface */
37 #define MPTCP_PM_NAME		"mptcp_pm"
38 #define MPTCP_PM_CMD_GRP_NAME	"mptcp_pm_cmds"
39 #define MPTCP_PM_VER		0x1
40 
41 /*
42  * ATTR types defined for MPTCP
43  */
44 enum {
45 	MPTCP_PM_ATTR_UNSPEC,
46 
47 	MPTCP_PM_ATTR_ADDR,				/* nested address */
48 	MPTCP_PM_ATTR_RCV_ADD_ADDRS,			/* u32 */
49 	MPTCP_PM_ATTR_SUBFLOWS,				/* u32 */
50 
51 	__MPTCP_PM_ATTR_MAX
52 };
53 
54 #define MPTCP_PM_ATTR_MAX (__MPTCP_PM_ATTR_MAX - 1)
55 
56 enum {
57 	MPTCP_PM_ADDR_ATTR_UNSPEC,
58 
59 	MPTCP_PM_ADDR_ATTR_FAMILY,			/* u16 */
60 	MPTCP_PM_ADDR_ATTR_ID,				/* u8 */
61 	MPTCP_PM_ADDR_ATTR_ADDR4,			/* struct in_addr */
62 	MPTCP_PM_ADDR_ATTR_ADDR6,			/* struct in6_addr */
63 	MPTCP_PM_ADDR_ATTR_PORT,			/* u16 */
64 	MPTCP_PM_ADDR_ATTR_FLAGS,			/* u32 */
65 	MPTCP_PM_ADDR_ATTR_IF_IDX,			/* s32 */
66 
67 	__MPTCP_PM_ADDR_ATTR_MAX
68 };
69 
70 #define MPTCP_PM_ADDR_ATTR_MAX (__MPTCP_PM_ADDR_ATTR_MAX - 1)
71 
72 #define MPTCP_PM_ADDR_FLAG_SIGNAL			(1 << 0)
73 #define MPTCP_PM_ADDR_FLAG_SUBFLOW			(1 << 1)
74 #define MPTCP_PM_ADDR_FLAG_BACKUP			(1 << 2)
75 
76 enum {
77 	MPTCP_PM_CMD_UNSPEC,
78 
79 	MPTCP_PM_CMD_ADD_ADDR,
80 	MPTCP_PM_CMD_DEL_ADDR,
81 	MPTCP_PM_CMD_GET_ADDR,
82 	MPTCP_PM_CMD_FLUSH_ADDRS,
83 	MPTCP_PM_CMD_SET_LIMITS,
84 	MPTCP_PM_CMD_GET_LIMITS,
85 
86 	__MPTCP_PM_CMD_AFTER_LAST
87 };
88 
89 #define MPTCP_INFO_FLAG_FALLBACK		_BITUL(0)
90 #define MPTCP_INFO_FLAG_REMOTE_KEY_RECEIVED	_BITUL(1)
91 
92 struct mptcp_info {
93 	__u8	mptcpi_subflows;
94 	__u8	mptcpi_add_addr_signal;
95 	__u8	mptcpi_add_addr_accepted;
96 	__u8	mptcpi_subflows_max;
97 	__u8	mptcpi_add_addr_signal_max;
98 	__u8	mptcpi_add_addr_accepted_max;
99 	__u32	mptcpi_flags;
100 	__u32	mptcpi_token;
101 	__u64	mptcpi_write_seq;
102 	__u64	mptcpi_snd_una;
103 	__u64	mptcpi_rcv_nxt;
104 };
105 
106 #endif /* _UAPI_MPTCP_H */
107