1 // SPDX-License-Identifier: GPL-2.0
4 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
5 * Use is subject to license terms.
7 * Copyright (c) 2012, 2016, Intel Corporation.
11 * This file is part of Lustre, http://www.lustre.org/
14 #ifndef __SELFTEST_RPC_H__
15 #define __SELFTEST_RPC_H__
17 #include <uapi/linux/lnet/lnetst.h>
20 * LST wired structures
22 * XXX: *REPLY == *REQST + 1
25 SRPC_MSG_MKSN_REQST = 0,
26 SRPC_MSG_MKSN_REPLY = 1,
27 SRPC_MSG_RMSN_REQST = 2,
28 SRPC_MSG_RMSN_REPLY = 3,
29 SRPC_MSG_BATCH_REQST = 4,
30 SRPC_MSG_BATCH_REPLY = 5,
31 SRPC_MSG_STAT_REQST = 6,
32 SRPC_MSG_STAT_REPLY = 7,
33 SRPC_MSG_TEST_REQST = 8,
34 SRPC_MSG_TEST_REPLY = 9,
35 SRPC_MSG_DEBUG_REQST = 10,
36 SRPC_MSG_DEBUG_REPLY = 11,
37 SRPC_MSG_BRW_REQST = 12,
38 SRPC_MSG_BRW_REPLY = 13,
39 SRPC_MSG_PING_REQST = 14,
40 SRPC_MSG_PING_REPLY = 15,
41 SRPC_MSG_JOIN_REQST = 16,
42 SRPC_MSG_JOIN_REPLY = 17,
46 * All struct srpc_*_reqst's 1st field must be matchbits of reply buffer,
47 * and 2nd field matchbits of bulk buffer if any.
49 * All struct srpc_*_reply's 1st field must be a __u32 status, and 2nd field
50 * session id if needed.
52 struct srpc_generic_reqst {
53 __u64 rpyid; /* reply buffer matchbits */
54 __u64 bulkid; /* bulk buffer matchbits */
57 struct srpc_generic_reply {
63 struct srpc_mksn_reqst {
64 __u64 mksn_rpyid; /* reply buffer matchbits */
65 struct lst_sid mksn_sid; /* session id */
66 __u32 mksn_force; /* use brute force */
67 char mksn_name[LST_NAME_SIZE];
68 } __packed; /* make session request */
70 struct srpc_mksn_reply {
71 __u32 mksn_status; /* session status */
72 struct lst_sid mksn_sid; /* session id */
73 __u32 mksn_timeout; /* session timeout */
74 char mksn_name[LST_NAME_SIZE];
75 } __packed; /* make session reply */
77 struct srpc_rmsn_reqst {
78 __u64 rmsn_rpyid; /* reply buffer matchbits */
79 struct lst_sid rmsn_sid; /* session id */
80 } __packed; /* remove session request */
82 struct srpc_rmsn_reply {
84 struct lst_sid rmsn_sid; /* session id */
85 } __packed; /* remove session reply */
87 struct srpc_join_reqst {
88 __u64 join_rpyid; /* reply buffer matchbits */
89 struct lst_sid join_sid; /* session id to join */
90 char join_group[LST_NAME_SIZE]; /* group name */
93 struct srpc_join_reply {
94 __u32 join_status; /* returned status */
95 struct lst_sid join_sid; /* session id */
96 __u32 join_timeout; /* # seconds' inactivity to expire */
97 char join_session[LST_NAME_SIZE]; /* session name */
100 struct srpc_debug_reqst {
101 __u64 dbg_rpyid; /* reply buffer matchbits */
102 struct lst_sid dbg_sid; /* session id */
103 __u32 dbg_flags; /* bitmap of debug */
106 struct srpc_debug_reply {
107 __u32 dbg_status; /* returned code */
108 struct lst_sid dbg_sid; /* session id */
109 __u32 dbg_timeout; /* session timeout */
110 __u32 dbg_nbatch; /* # of batches in the node */
111 char dbg_name[LST_NAME_SIZE]; /* session name */
114 #define SRPC_BATCH_OPC_RUN 1
115 #define SRPC_BATCH_OPC_STOP 2
116 #define SRPC_BATCH_OPC_QUERY 3
118 struct srpc_batch_reqst {
119 __u64 bar_rpyid; /* reply buffer matchbits */
120 struct lst_sid bar_sid; /* session id */
121 struct lst_bid bar_bid; /* batch id */
122 __u32 bar_opc; /* create/start/stop batch */
123 __u32 bar_testidx; /* index of test */
124 __u32 bar_arg; /* parameters */
127 struct srpc_batch_reply {
128 __u32 bar_status; /* status of request */
129 struct lst_sid bar_sid; /* session id */
130 __u32 bar_active; /* # of active tests in batch/test */
131 __u32 bar_time; /* remained time */
134 struct srpc_stat_reqst {
135 __u64 str_rpyid; /* reply buffer matchbits */
136 struct lst_sid str_sid; /* session id */
137 __u32 str_type; /* type of stat */
140 struct srpc_stat_reply {
142 struct lst_sid str_sid;
143 struct sfw_counters str_fw;
144 struct srpc_counters str_rpc;
145 struct lnet_counters_common str_lnet;
148 struct test_bulk_req {
149 __u32 blk_opc; /* bulk operation code */
150 __u32 blk_npg; /* # of pages */
151 __u32 blk_flags; /* reserved flags */
154 struct test_bulk_req_v1 {
155 /** bulk operation code */
157 /** data check flags */
165 struct test_ping_req {
166 __u32 png_size; /* size of ping message */
167 __u32 png_flags; /* reserved flags */
170 struct srpc_test_reqst {
171 __u64 tsr_rpyid; /* reply buffer matchbits */
172 __u64 tsr_bulkid; /* bulk buffer matchbits */
173 struct lst_sid tsr_sid; /* session id */
174 struct lst_bid tsr_bid; /* batch id */
175 __u32 tsr_service; /* test type: bulk|ping|... */
176 /* test client loop count or # server buffers needed */
178 __u32 tsr_concur; /* concurrency of test */
179 __u8 tsr_is_client; /* is test client or not */
180 __u8 tsr_stop_onerr; /* stop on error */
181 __u32 tsr_ndest; /* # of dest nodes */
184 struct test_ping_req ping;
185 struct test_bulk_req bulk_v0;
186 struct test_bulk_req_v1 bulk_v1;
190 struct srpc_test_reply {
191 __u32 tsr_status; /* returned code */
192 struct lst_sid tsr_sid;
196 struct srpc_ping_reqst {
204 struct srpc_ping_reply {
210 struct srpc_brw_reqst {
211 __u64 brw_rpyid; /* reply buffer matchbits */
212 __u64 brw_bulkid; /* bulk buffer matchbits */
213 __u32 brw_rw; /* read or write */
214 __u32 brw_len; /* bulk data len */
215 __u32 brw_flags; /* bulk data patterns */
216 } __packed; /* bulk r/w request */
218 struct srpc_brw_reply {
220 } __packed; /* bulk r/w reply */
222 #define SRPC_MSG_MAGIC 0xeeb0f00d
223 #define SRPC_MSG_VERSION 1
228 /** message version number */
230 /** type of message body: enum srpc_msg_type */
234 /** test session features */
237 struct srpc_generic_reqst reqst;
238 struct srpc_generic_reply reply;
240 struct srpc_mksn_reqst mksn_reqst;
241 struct srpc_mksn_reply mksn_reply;
242 struct srpc_rmsn_reqst rmsn_reqst;
243 struct srpc_rmsn_reply rmsn_reply;
244 struct srpc_debug_reqst dbg_reqst;
245 struct srpc_debug_reply dbg_reply;
246 struct srpc_batch_reqst bat_reqst;
247 struct srpc_batch_reply bat_reply;
248 struct srpc_stat_reqst stat_reqst;
249 struct srpc_stat_reply stat_reply;
250 struct srpc_test_reqst tes_reqst;
251 struct srpc_test_reply tes_reply;
252 struct srpc_join_reqst join_reqst;
253 struct srpc_join_reply join_reply;
255 struct srpc_ping_reqst ping_reqst;
256 struct srpc_ping_reply ping_reply;
257 struct srpc_brw_reqst brw_reqst;
258 struct srpc_brw_reply brw_reply;
263 srpc_unpack_msg_hdr(struct srpc_msg *msg)
265 if (msg->msg_magic == SRPC_MSG_MAGIC)
266 return; /* no flipping needed */
268 /* We do not swap the magic number here as it is needed to
269 determine whether the body needs to be swapped. */
270 /* __swab32s(&msg->msg_magic); */
271 __swab32s(&msg->msg_type);
272 __swab32s(&msg->msg_version);
273 __swab32s(&msg->msg_ses_feats);
274 __swab32s(&msg->msg_reserved0);
275 __swab32s(&msg->msg_reserved1);
278 #endif /* __SELFTEST_RPC_H__ */