1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37#ifndef __SELFTEST_RPC_H__
38#define __SELFTEST_RPC_H__
39
40#include "../../include/linux/lnet/lnetst.h"
41
42
43
44
45
46
47typedef enum {
48 SRPC_MSG_MKSN_REQST = 0,
49 SRPC_MSG_MKSN_REPLY = 1,
50 SRPC_MSG_RMSN_REQST = 2,
51 SRPC_MSG_RMSN_REPLY = 3,
52 SRPC_MSG_BATCH_REQST = 4,
53 SRPC_MSG_BATCH_REPLY = 5,
54 SRPC_MSG_STAT_REQST = 6,
55 SRPC_MSG_STAT_REPLY = 7,
56 SRPC_MSG_TEST_REQST = 8,
57 SRPC_MSG_TEST_REPLY = 9,
58 SRPC_MSG_DEBUG_REQST = 10,
59 SRPC_MSG_DEBUG_REPLY = 11,
60 SRPC_MSG_BRW_REQST = 12,
61 SRPC_MSG_BRW_REPLY = 13,
62 SRPC_MSG_PING_REQST = 14,
63 SRPC_MSG_PING_REPLY = 15,
64 SRPC_MSG_JOIN_REQST = 16,
65 SRPC_MSG_JOIN_REPLY = 17,
66} srpc_msg_type_t;
67
68
69
70
71
72
73
74
75
76typedef struct {
77 __u64 rpyid;
78 __u64 bulkid;
79} WIRE_ATTR srpc_generic_reqst_t;
80
81typedef struct {
82 __u32 status;
83 lst_sid_t sid;
84} WIRE_ATTR srpc_generic_reply_t;
85
86
87typedef struct {
88 __u64 mksn_rpyid;
89 lst_sid_t mksn_sid;
90 __u32 mksn_force;
91 char mksn_name[LST_NAME_SIZE];
92} WIRE_ATTR srpc_mksn_reqst_t;
93
94typedef struct {
95 __u32 mksn_status;
96 lst_sid_t mksn_sid;
97 __u32 mksn_timeout;
98 char mksn_name[LST_NAME_SIZE];
99} WIRE_ATTR srpc_mksn_reply_t;
100
101typedef struct {
102 __u64 rmsn_rpyid;
103 lst_sid_t rmsn_sid;
104} WIRE_ATTR srpc_rmsn_reqst_t;
105
106typedef struct {
107 __u32 rmsn_status;
108 lst_sid_t rmsn_sid;
109} WIRE_ATTR srpc_rmsn_reply_t;
110
111typedef struct {
112 __u64 join_rpyid;
113 lst_sid_t join_sid;
114 char join_group[LST_NAME_SIZE];
115} WIRE_ATTR srpc_join_reqst_t;
116
117typedef struct {
118 __u32 join_status;
119 lst_sid_t join_sid;
120 __u32 join_timeout;
121 char join_session[LST_NAME_SIZE];
122} WIRE_ATTR srpc_join_reply_t;
123
124typedef struct {
125 __u64 dbg_rpyid;
126 lst_sid_t dbg_sid;
127 __u32 dbg_flags;
128} WIRE_ATTR srpc_debug_reqst_t;
129
130typedef struct {
131 __u32 dbg_status;
132 lst_sid_t dbg_sid;
133 __u32 dbg_timeout;
134 __u32 dbg_nbatch;
135 char dbg_name[LST_NAME_SIZE];
136} WIRE_ATTR srpc_debug_reply_t;
137
138#define SRPC_BATCH_OPC_RUN 1
139#define SRPC_BATCH_OPC_STOP 2
140#define SRPC_BATCH_OPC_QUERY 3
141
142typedef struct {
143 __u64 bar_rpyid;
144 lst_sid_t bar_sid;
145 lst_bid_t bar_bid;
146 __u32 bar_opc;
147 __u32 bar_testidx;
148 __u32 bar_arg;
149} WIRE_ATTR srpc_batch_reqst_t;
150
151typedef struct {
152 __u32 bar_status;
153 lst_sid_t bar_sid;
154 __u32 bar_active;
155 __u32 bar_time;
156} WIRE_ATTR srpc_batch_reply_t;
157
158typedef struct {
159 __u64 str_rpyid;
160 lst_sid_t str_sid;
161 __u32 str_type;
162} WIRE_ATTR srpc_stat_reqst_t;
163
164typedef struct {
165 __u32 str_status;
166 lst_sid_t str_sid;
167 sfw_counters_t str_fw;
168 srpc_counters_t str_rpc;
169 lnet_counters_t str_lnet;
170} WIRE_ATTR srpc_stat_reply_t;
171
172typedef struct {
173 __u32 blk_opc;
174 __u32 blk_npg;
175 __u32 blk_flags;
176} WIRE_ATTR test_bulk_req_t;
177
178typedef struct {
179
180 __u16 blk_opc;
181
182 __u16 blk_flags;
183
184 __u32 blk_len;
185
186 __u32 blk_offset;
187} WIRE_ATTR test_bulk_req_v1_t;
188
189typedef struct {
190 __u32 png_size;
191 __u32 png_flags;
192} WIRE_ATTR test_ping_req_t;
193
194typedef struct {
195 __u64 tsr_rpyid;
196 __u64 tsr_bulkid;
197 lst_sid_t tsr_sid;
198 lst_bid_t tsr_bid;
199 __u32 tsr_service;
200
201 __u32 tsr_loop;
202 __u32 tsr_concur;
203 __u8 tsr_is_client;
204 __u8 tsr_stop_onerr;
205 __u32 tsr_ndest;
206
207 union {
208 test_ping_req_t ping;
209 test_bulk_req_t bulk_v0;
210 test_bulk_req_v1_t bulk_v1;
211 } tsr_u;
212} WIRE_ATTR srpc_test_reqst_t;
213
214typedef struct {
215 __u32 tsr_status;
216 lst_sid_t tsr_sid;
217} WIRE_ATTR srpc_test_reply_t;
218
219
220typedef struct {
221 __u64 pnr_rpyid;
222 __u32 pnr_magic;
223 __u32 pnr_seq;
224 __u64 pnr_time_sec;
225 __u64 pnr_time_usec;
226} WIRE_ATTR srpc_ping_reqst_t;
227
228typedef struct {
229 __u32 pnr_status;
230 __u32 pnr_magic;
231 __u32 pnr_seq;
232} WIRE_ATTR srpc_ping_reply_t;
233
234typedef struct {
235 __u64 brw_rpyid;
236 __u64 brw_bulkid;
237 __u32 brw_rw;
238 __u32 brw_len;
239 __u32 brw_flags;
240} WIRE_ATTR srpc_brw_reqst_t;
241
242typedef struct {
243 __u32 brw_status;
244} WIRE_ATTR srpc_brw_reply_t;
245
246#define SRPC_MSG_MAGIC 0xeeb0f00d
247#define SRPC_MSG_VERSION 1
248
249typedef struct srpc_msg {
250
251 __u32 msg_magic;
252
253 __u32 msg_version;
254
255 __u32 msg_type;
256 __u32 msg_reserved0;
257 __u32 msg_reserved1;
258
259 __u32 msg_ses_feats;
260 union {
261 srpc_generic_reqst_t reqst;
262 srpc_generic_reply_t reply;
263
264 srpc_mksn_reqst_t mksn_reqst;
265 srpc_mksn_reply_t mksn_reply;
266 srpc_rmsn_reqst_t rmsn_reqst;
267 srpc_rmsn_reply_t rmsn_reply;
268 srpc_debug_reqst_t dbg_reqst;
269 srpc_debug_reply_t dbg_reply;
270 srpc_batch_reqst_t bat_reqst;
271 srpc_batch_reply_t bat_reply;
272 srpc_stat_reqst_t stat_reqst;
273 srpc_stat_reply_t stat_reply;
274 srpc_test_reqst_t tes_reqst;
275 srpc_test_reply_t tes_reply;
276 srpc_join_reqst_t join_reqst;
277 srpc_join_reply_t join_reply;
278
279 srpc_ping_reqst_t ping_reqst;
280 srpc_ping_reply_t ping_reply;
281 srpc_brw_reqst_t brw_reqst;
282 srpc_brw_reply_t brw_reply;
283 } msg_body;
284} WIRE_ATTR srpc_msg_t;
285
286static inline void
287srpc_unpack_msg_hdr(srpc_msg_t *msg)
288{
289 if (msg->msg_magic == SRPC_MSG_MAGIC)
290 return;
291
292
293
294
295 __swab32s(&msg->msg_type);
296 __swab32s(&msg->msg_version);
297 __swab32s(&msg->msg_ses_feats);
298 __swab32s(&msg->msg_reserved0);
299 __swab32s(&msg->msg_reserved1);
300}
301
302#endif
303