xref: /openbmc/linux/include/uapi/rdma/rdma_netlink.h (revision 9cfc5c90)
1 #ifndef _UAPI_RDMA_NETLINK_H
2 #define _UAPI_RDMA_NETLINK_H
3 
4 #include <linux/types.h>
5 
6 enum {
7 	RDMA_NL_RDMA_CM = 1,
8 	RDMA_NL_NES,
9 	RDMA_NL_C4IW,
10 	RDMA_NL_LS,	/* RDMA Local Services */
11 	RDMA_NL_NUM_CLIENTS
12 };
13 
14 enum {
15 	RDMA_NL_GROUP_CM = 1,
16 	RDMA_NL_GROUP_IWPM,
17 	RDMA_NL_GROUP_LS,
18 	RDMA_NL_NUM_GROUPS
19 };
20 
21 #define RDMA_NL_GET_CLIENT(type) ((type & (((1 << 6) - 1) << 10)) >> 10)
22 #define RDMA_NL_GET_OP(type) (type & ((1 << 10) - 1))
23 #define RDMA_NL_GET_TYPE(client, op) ((client << 10) + op)
24 
25 enum {
26 	RDMA_NL_RDMA_CM_ID_STATS = 0,
27 	RDMA_NL_RDMA_CM_NUM_OPS
28 };
29 
30 enum {
31 	RDMA_NL_RDMA_CM_ATTR_SRC_ADDR = 1,
32 	RDMA_NL_RDMA_CM_ATTR_DST_ADDR,
33 	RDMA_NL_RDMA_CM_NUM_ATTR,
34 };
35 
36 /* iwarp port mapper op-codes */
37 enum {
38 	RDMA_NL_IWPM_REG_PID = 0,
39 	RDMA_NL_IWPM_ADD_MAPPING,
40 	RDMA_NL_IWPM_QUERY_MAPPING,
41 	RDMA_NL_IWPM_REMOVE_MAPPING,
42 	RDMA_NL_IWPM_REMOTE_INFO,
43 	RDMA_NL_IWPM_HANDLE_ERR,
44 	RDMA_NL_IWPM_MAPINFO,
45 	RDMA_NL_IWPM_MAPINFO_NUM,
46 	RDMA_NL_IWPM_NUM_OPS
47 };
48 
49 struct rdma_cm_id_stats {
50 	__u32	qp_num;
51 	__u32	bound_dev_if;
52 	__u32	port_space;
53 	__s32	pid;
54 	__u8	cm_state;
55 	__u8	node_type;
56 	__u8	port_num;
57 	__u8	qp_type;
58 };
59 
60 enum {
61 	IWPM_NLA_REG_PID_UNSPEC = 0,
62 	IWPM_NLA_REG_PID_SEQ,
63 	IWPM_NLA_REG_IF_NAME,
64 	IWPM_NLA_REG_IBDEV_NAME,
65 	IWPM_NLA_REG_ULIB_NAME,
66 	IWPM_NLA_REG_PID_MAX
67 };
68 
69 enum {
70 	IWPM_NLA_RREG_PID_UNSPEC = 0,
71 	IWPM_NLA_RREG_PID_SEQ,
72 	IWPM_NLA_RREG_IBDEV_NAME,
73 	IWPM_NLA_RREG_ULIB_NAME,
74 	IWPM_NLA_RREG_ULIB_VER,
75 	IWPM_NLA_RREG_PID_ERR,
76 	IWPM_NLA_RREG_PID_MAX
77 
78 };
79 
80 enum {
81 	IWPM_NLA_MANAGE_MAPPING_UNSPEC = 0,
82 	IWPM_NLA_MANAGE_MAPPING_SEQ,
83 	IWPM_NLA_MANAGE_ADDR,
84 	IWPM_NLA_MANAGE_MAPPED_LOC_ADDR,
85 	IWPM_NLA_RMANAGE_MAPPING_ERR,
86 	IWPM_NLA_RMANAGE_MAPPING_MAX
87 };
88 
89 #define IWPM_NLA_MANAGE_MAPPING_MAX 3
90 #define IWPM_NLA_QUERY_MAPPING_MAX  4
91 #define IWPM_NLA_MAPINFO_SEND_MAX   3
92 
93 enum {
94 	IWPM_NLA_QUERY_MAPPING_UNSPEC = 0,
95 	IWPM_NLA_QUERY_MAPPING_SEQ,
96 	IWPM_NLA_QUERY_LOCAL_ADDR,
97 	IWPM_NLA_QUERY_REMOTE_ADDR,
98 	IWPM_NLA_RQUERY_MAPPED_LOC_ADDR,
99 	IWPM_NLA_RQUERY_MAPPED_REM_ADDR,
100 	IWPM_NLA_RQUERY_MAPPING_ERR,
101 	IWPM_NLA_RQUERY_MAPPING_MAX
102 };
103 
104 enum {
105 	IWPM_NLA_MAPINFO_REQ_UNSPEC = 0,
106 	IWPM_NLA_MAPINFO_ULIB_NAME,
107 	IWPM_NLA_MAPINFO_ULIB_VER,
108 	IWPM_NLA_MAPINFO_REQ_MAX
109 };
110 
111 enum {
112 	IWPM_NLA_MAPINFO_UNSPEC = 0,
113 	IWPM_NLA_MAPINFO_LOCAL_ADDR,
114 	IWPM_NLA_MAPINFO_MAPPED_ADDR,
115 	IWPM_NLA_MAPINFO_MAX
116 };
117 
118 enum {
119 	IWPM_NLA_MAPINFO_NUM_UNSPEC = 0,
120 	IWPM_NLA_MAPINFO_SEQ,
121 	IWPM_NLA_MAPINFO_SEND_NUM,
122 	IWPM_NLA_MAPINFO_ACK_NUM,
123 	IWPM_NLA_MAPINFO_NUM_MAX
124 };
125 
126 enum {
127 	IWPM_NLA_ERR_UNSPEC = 0,
128 	IWPM_NLA_ERR_SEQ,
129 	IWPM_NLA_ERR_CODE,
130 	IWPM_NLA_ERR_MAX
131 };
132 
133 /*
134  * Local service operations:
135  *   RESOLVE - The client requests the local service to resolve a path.
136  *   SET_TIMEOUT - The local service requests the client to set the timeout.
137  */
138 enum {
139 	RDMA_NL_LS_OP_RESOLVE = 0,
140 	RDMA_NL_LS_OP_SET_TIMEOUT,
141 	RDMA_NL_LS_NUM_OPS
142 };
143 
144 /* Local service netlink message flags */
145 #define RDMA_NL_LS_F_ERR	0x0100	/* Failed response */
146 
147 /*
148  * Local service resolve operation family header.
149  * The layout for the resolve operation:
150  *    nlmsg header
151  *    family header
152  *    attributes
153  */
154 
155 /*
156  * Local service path use:
157  * Specify how the path(s) will be used.
158  *   ALL - For connected CM operation (6 pathrecords)
159  *   UNIDIRECTIONAL - For unidirectional UD (1 pathrecord)
160  *   GMP - For miscellaneous GMP like operation (at least 1 reversible
161  *         pathrecord)
162  */
163 enum {
164 	LS_RESOLVE_PATH_USE_ALL = 0,
165 	LS_RESOLVE_PATH_USE_UNIDIRECTIONAL,
166 	LS_RESOLVE_PATH_USE_GMP,
167 	LS_RESOLVE_PATH_USE_MAX
168 };
169 
170 #define LS_DEVICE_NAME_MAX 64
171 
172 struct rdma_ls_resolve_header {
173 	__u8 device_name[LS_DEVICE_NAME_MAX];
174 	__u8 port_num;
175 	__u8 path_use;
176 };
177 
178 /* Local service attribute type */
179 #define RDMA_NLA_F_MANDATORY	(1 << 13)
180 #define RDMA_NLA_TYPE_MASK	(~(NLA_F_NESTED | NLA_F_NET_BYTEORDER | \
181 				  RDMA_NLA_F_MANDATORY))
182 
183 /*
184  * Local service attributes:
185  *   Attr Name       Size                       Byte order
186  *   -----------------------------------------------------
187  *   PATH_RECORD     struct ib_path_rec_data
188  *   TIMEOUT         u32                        cpu
189  *   SERVICE_ID      u64                        cpu
190  *   DGID            u8[16]                     BE
191  *   SGID            u8[16]                     BE
192  *   TCLASS          u8
193  *   PKEY            u16                        cpu
194  *   QOS_CLASS       u16                        cpu
195  */
196 enum {
197 	LS_NLA_TYPE_UNSPEC = 0,
198 	LS_NLA_TYPE_PATH_RECORD,
199 	LS_NLA_TYPE_TIMEOUT,
200 	LS_NLA_TYPE_SERVICE_ID,
201 	LS_NLA_TYPE_DGID,
202 	LS_NLA_TYPE_SGID,
203 	LS_NLA_TYPE_TCLASS,
204 	LS_NLA_TYPE_PKEY,
205 	LS_NLA_TYPE_QOS_CLASS,
206 	LS_NLA_TYPE_MAX
207 };
208 
209 /* Local service DGID/SGID attribute: big endian */
210 struct rdma_nla_ls_gid {
211 	__u8		gid[16];
212 };
213 
214 #endif /* _UAPI_RDMA_NETLINK_H */
215