4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 only,
8 * as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License version 2 for more details (a copy is included
14 * in the LICENSE file that accompanied this code).
16 * You should have received a copy of the GNU General Public License
17 * version 2 along with this program; If not, see
18 * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
20 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21 * CA 95054 USA or visit www.sun.com if you need additional information or
27 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
28 * Use is subject to license terms.
30 * Copyright (c) 2012, Intel Corporation.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
37 #ifndef __SELFTEST_RPC_H__
38 #define __SELFTEST_RPC_H__
40 #include "../../include/linux/lnet/lnetst.h"
43 * LST wired structures
45 * XXX: *REPLY == *REQST + 1
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,
69 * All srpc_*_reqst_t's 1st field must be matchbits of reply buffer,
70 * and 2nd field matchbits of bulk buffer if any.
72 * All srpc_*_reply_t's 1st field must be a __u32 status, and 2nd field
73 * session id if needed.
76 __u64 rpyid; /* reply buffer matchbits */
77 __u64 bulkid; /* bulk buffer matchbits */
78 } WIRE_ATTR srpc_generic_reqst_t;
83 } WIRE_ATTR srpc_generic_reply_t;
87 __u64 mksn_rpyid; /* reply buffer matchbits */
88 lst_sid_t mksn_sid; /* session id */
89 __u32 mksn_force; /* use brute force */
90 char mksn_name[LST_NAME_SIZE];
91 } WIRE_ATTR srpc_mksn_reqst_t; /* make session request */
94 __u32 mksn_status; /* session status */
95 lst_sid_t mksn_sid; /* session id */
96 __u32 mksn_timeout; /* session timeout */
97 char mksn_name[LST_NAME_SIZE];
98 } WIRE_ATTR srpc_mksn_reply_t; /* make session reply */
101 __u64 rmsn_rpyid; /* reply buffer matchbits */
102 lst_sid_t rmsn_sid; /* session id */
103 } WIRE_ATTR srpc_rmsn_reqst_t; /* remove session request */
107 lst_sid_t rmsn_sid; /* session id */
108 } WIRE_ATTR srpc_rmsn_reply_t; /* remove session reply */
111 __u64 join_rpyid; /* reply buffer matchbits */
112 lst_sid_t join_sid; /* session id to join */
113 char join_group[LST_NAME_SIZE]; /* group name */
114 } WIRE_ATTR srpc_join_reqst_t;
117 __u32 join_status; /* returned status */
118 lst_sid_t join_sid; /* session id */
119 __u32 join_timeout; /* # seconds' inactivity to
121 char join_session[LST_NAME_SIZE]; /* session name */
122 } WIRE_ATTR srpc_join_reply_t;
125 __u64 dbg_rpyid; /* reply buffer matchbits */
126 lst_sid_t dbg_sid; /* session id */
127 __u32 dbg_flags; /* bitmap of debug */
128 } WIRE_ATTR srpc_debug_reqst_t;
131 __u32 dbg_status; /* returned code */
132 lst_sid_t dbg_sid; /* session id */
133 __u32 dbg_timeout; /* session timeout */
134 __u32 dbg_nbatch; /* # of batches in the node */
135 char dbg_name[LST_NAME_SIZE]; /* session name */
136 } WIRE_ATTR srpc_debug_reply_t;
138 #define SRPC_BATCH_OPC_RUN 1
139 #define SRPC_BATCH_OPC_STOP 2
140 #define SRPC_BATCH_OPC_QUERY 3
143 __u64 bar_rpyid; /* reply buffer matchbits */
144 lst_sid_t bar_sid; /* session id */
145 lst_bid_t bar_bid; /* batch id */
146 __u32 bar_opc; /* create/start/stop batch */
147 __u32 bar_testidx; /* index of test */
148 __u32 bar_arg; /* parameters */
149 } WIRE_ATTR srpc_batch_reqst_t;
152 __u32 bar_status; /* status of request */
153 lst_sid_t bar_sid; /* session id */
154 __u32 bar_active; /* # of active tests in batch/test */
155 __u32 bar_time; /* remained time */
156 } WIRE_ATTR srpc_batch_reply_t;
159 __u64 str_rpyid; /* reply buffer matchbits */
160 lst_sid_t str_sid; /* session id */
161 __u32 str_type; /* type of stat */
162 } WIRE_ATTR srpc_stat_reqst_t;
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;
173 __u32 blk_opc; /* bulk operation code */
174 __u32 blk_npg; /* # of pages */
175 __u32 blk_flags; /* reserved flags */
176 } WIRE_ATTR test_bulk_req_t;
179 __u16 blk_opc; /* bulk operation code */
180 __u16 blk_flags; /* data check flags */
181 __u32 blk_len; /* data length */
182 __u32 blk_offset; /* reserved: offset */
183 } WIRE_ATTR test_bulk_req_v1_t;
186 __u32 png_size; /* size of ping message */
187 __u32 png_flags; /* reserved flags */
188 } WIRE_ATTR test_ping_req_t;
191 __u64 tsr_rpyid; /* reply buffer matchbits */
192 __u64 tsr_bulkid; /* bulk buffer matchbits */
193 lst_sid_t tsr_sid; /* session id */
194 lst_bid_t tsr_bid; /* batch id */
195 __u32 tsr_service; /* test type: bulk|ping|... */
196 __u32 tsr_loop; /* test client loop count or
197 * # server buffers needed */
198 __u32 tsr_concur; /* concurrency of test */
199 __u8 tsr_is_client; /* is test client or not */
200 __u8 tsr_stop_onerr; /* stop on error */
201 __u32 tsr_ndest; /* # of dest nodes */
204 test_ping_req_t ping;
205 test_bulk_req_t bulk_v0;
206 test_bulk_req_v1_t bulk_v1;
208 } WIRE_ATTR srpc_test_reqst_t;
211 __u32 tsr_status; /* returned code */
213 } WIRE_ATTR srpc_test_reply_t;
222 } WIRE_ATTR srpc_ping_reqst_t;
228 } WIRE_ATTR srpc_ping_reply_t;
231 __u64 brw_rpyid; /* reply buffer matchbits */
232 __u64 brw_bulkid; /* bulk buffer matchbits */
233 __u32 brw_rw; /* read or write */
234 __u32 brw_len; /* bulk data len */
235 __u32 brw_flags; /* bulk data patterns */
236 } WIRE_ATTR srpc_brw_reqst_t; /* bulk r/w request */
240 } WIRE_ATTR srpc_brw_reply_t; /* bulk r/w reply */
242 #define SRPC_MSG_MAGIC 0xeeb0f00d
243 #define SRPC_MSG_VERSION 1
245 typedef struct srpc_msg {
246 __u32 msg_magic; /* magic number */
247 __u32 msg_version; /* message version number */
248 __u32 msg_type; /* type of message body: srpc_msg_type_t */
251 __u32 msg_ses_feats; /* test session features */
253 srpc_generic_reqst_t reqst;
254 srpc_generic_reply_t reply;
256 srpc_mksn_reqst_t mksn_reqst;
257 srpc_mksn_reply_t mksn_reply;
258 srpc_rmsn_reqst_t rmsn_reqst;
259 srpc_rmsn_reply_t rmsn_reply;
260 srpc_debug_reqst_t dbg_reqst;
261 srpc_debug_reply_t dbg_reply;
262 srpc_batch_reqst_t bat_reqst;
263 srpc_batch_reply_t bat_reply;
264 srpc_stat_reqst_t stat_reqst;
265 srpc_stat_reply_t stat_reply;
266 srpc_test_reqst_t tes_reqst;
267 srpc_test_reply_t tes_reply;
268 srpc_join_reqst_t join_reqst;
269 srpc_join_reply_t join_reply;
271 srpc_ping_reqst_t ping_reqst;
272 srpc_ping_reply_t ping_reply;
273 srpc_brw_reqst_t brw_reqst;
274 srpc_brw_reply_t brw_reply;
276 } WIRE_ATTR srpc_msg_t;
279 srpc_unpack_msg_hdr(srpc_msg_t *msg)
281 if (msg->msg_magic == SRPC_MSG_MAGIC)
282 return; /* no flipping needed */
284 /* We do not swap the magic number here as it is needed to
285 determine whether the body needs to be swapped. */
286 /* __swab32s(&msg->msg_magic); */
287 __swab32s(&msg->msg_type);
288 __swab32s(&msg->msg_version);
289 __swab32s(&msg->msg_ses_feats);
290 __swab32s(&msg->msg_reserved0);
291 __swab32s(&msg->msg_reserved1);
294 #endif /* __SELFTEST_RPC_H__ */