1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Author: Liang Zhen <liangzhen@clusterfs.com>
6 * This file is part of Lustre, http://www.lustre.org
12 #include <libcfs/kp30.h>
13 #include <lnet/lnet.h>
14 #include <lnet/lib-types.h>
16 #define LST_NAME_SIZE 32 /* max name buffer length */
18 #define LSTIO_DEBUG 0xC00 /* debug */
19 #define LSTIO_SESSION_NEW 0xC01 /* create session */
20 #define LSTIO_SESSION_END 0xC02 /* end session */
21 #define LSTIO_SESSION_INFO 0xC03 /* query session */
22 #define LSTIO_GROUP_ADD 0xC10 /* add group */
23 #define LSTIO_GROUP_LIST 0xC11 /* list all groups in session */
24 #define LSTIO_GROUP_INFO 0xC12 /* query defailt infomation of specified group */
25 #define LSTIO_GROUP_DEL 0xC13 /* delete group */
26 #define LSTIO_NODES_ADD 0xC14 /* add nodes to specified group */
27 #define LSTIO_GROUP_UPDATE 0xC15 /* update group */
28 #define LSTIO_BATCH_ADD 0xC20 /* add batch */
29 #define LSTIO_BATCH_START 0xC21 /* start batch */
30 #define LSTIO_BATCH_STOP 0xC22 /* stop batch */
31 #define LSTIO_BATCH_DEL 0xC23 /* delete batch */
32 #define LSTIO_BATCH_LIST 0xC24 /* show all batches in the session */
33 #define LSTIO_BATCH_INFO 0xC25 /* show defail of specified batch */
34 #define LSTIO_TEST_ADD 0xC26 /* add test (to batch) */
35 #define LSTIO_BATCH_QUERY 0xC27 /* query batch status */
36 #define LSTIO_STAT_QUERY 0xC30 /* get stats */
39 lnet_nid_t ses_nid; /* nid of console node */
40 __u64 ses_stamp; /* time stamp */
41 } lst_sid_t; /*** session id */
43 #define LST_INVALID_SID ((const lst_sid_t){.ses_nid = LNET_NID_ANY,\
47 __u64 bat_id; /* unique id in session */
48 } lst_bid_t; /*** batch id (group of tests) */
50 /* Status of test node */
51 #define LST_NODE_ACTIVE 0x1 /* node in this session */
52 #define LST_NODE_BUSY 0x2 /* node is taken by other session */
53 #define LST_NODE_DOWN 0x4 /* node is down */
54 #define LST_NODE_UNKNOWN 0x8 /* node not in session */
57 lnet_process_id_t nde_id; /* id of node */
58 int nde_state; /* state of node */
59 } lstcon_node_ent_t; /*** node entry, for list_group command */
62 int nle_nnode; /* # of nodes */
63 int nle_nactive; /* # of active nodes */
64 int nle_nbusy; /* # of busy nodes */
65 int nle_ndown; /* # of down nodes */
66 int nle_nunknown; /* # of unknown nodes */
67 } lstcon_ndlist_ent_t; /*** node_list entry, for list_batch command */
70 int tse_type; /* test type */
71 int tse_loop; /* loop count */
72 int tse_concur; /* concurrency of test */
73 } lstcon_test_ent_t; /*** test summary entry, for list_batch command */
76 int bae_state; /* batch status */
77 int bae_timeout; /* batch timeout */
78 int bae_ntest; /* # of tests in the batch */
79 } lstcon_batch_ent_t; /*** batch summary entry, for list_batch command */
82 lstcon_ndlist_ent_t tbe_cli_nle; /* client (group) node_list entry */
83 lstcon_ndlist_ent_t tbe_srv_nle; /* server (group) node_list entry */
85 lstcon_test_ent_t tbe_test; /* test entry */
86 lstcon_batch_ent_t tbe_batch; /* batch entry */
88 } lstcon_test_batch_ent_t; /*** test/batch verbose information entry,
89 *** for list_batch command */
92 struct list_head rpe_link; /* link chain */
93 lnet_process_id_t rpe_peer; /* peer's id */
94 struct timeval rpe_stamp; /* time stamp of RPC */
95 int rpe_state; /* peer's state */
96 int rpe_rpc_errno; /* RPC errno */
98 lst_sid_t rpe_sid; /* peer's session id */
99 int rpe_fwk_errno; /* framework errno */
100 int rpe_priv[4]; /* private data */
101 char rpe_payload[0]; /* private reply payload */
105 int trs_rpc_stat[4]; /* RPCs stat (0: total, 1: failed, 2: finished, 4: reserved */
106 int trs_rpc_errno; /* RPC errno */
107 int trs_fwk_stat[8]; /* framework stat */
108 int trs_fwk_errno; /* errno of the first remote error */
109 void *trs_fwk_private; /* private framework stat */
110 } lstcon_trans_stat_t;
113 lstcon_rpc_stat_total(lstcon_trans_stat_t *stat, int inc)
115 return inc ? ++stat->trs_rpc_stat[0] : stat->trs_rpc_stat[0];
119 lstcon_rpc_stat_success(lstcon_trans_stat_t *stat, int inc)
121 return inc ? ++stat->trs_rpc_stat[1] : stat->trs_rpc_stat[1];
125 lstcon_rpc_stat_failure(lstcon_trans_stat_t *stat, int inc)
127 return inc ? ++stat->trs_rpc_stat[2] : stat->trs_rpc_stat[2];
131 lstcon_sesop_stat_success(lstcon_trans_stat_t *stat, int inc)
133 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
137 lstcon_sesop_stat_failure(lstcon_trans_stat_t *stat, int inc)
139 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
143 lstcon_sesqry_stat_active(lstcon_trans_stat_t *stat, int inc)
145 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
149 lstcon_sesqry_stat_busy(lstcon_trans_stat_t *stat, int inc)
151 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
155 lstcon_sesqry_stat_unknown(lstcon_trans_stat_t *stat, int inc)
157 return inc ? ++stat->trs_fwk_stat[2] : stat->trs_fwk_stat[2];
161 lstcon_tsbop_stat_success(lstcon_trans_stat_t *stat, int inc)
163 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
167 lstcon_tsbop_stat_failure(lstcon_trans_stat_t *stat, int inc)
169 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
173 lstcon_tsbqry_stat_idle(lstcon_trans_stat_t *stat, int inc)
175 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
179 lstcon_tsbqry_stat_run(lstcon_trans_stat_t *stat, int inc)
181 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
185 lstcon_tsbqry_stat_failure(lstcon_trans_stat_t *stat, int inc)
187 return inc ? ++stat->trs_fwk_stat[2] : stat->trs_fwk_stat[2];
191 lstcon_statqry_stat_success(lstcon_trans_stat_t *stat, int inc)
193 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
197 lstcon_statqry_stat_failure(lstcon_trans_stat_t *stat, int inc)
199 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
202 /* create a session */
204 int lstio_ses_key; /* IN: local key */
205 int lstio_ses_timeout; /* IN: session timeout */
206 int lstio_ses_force; /* IN: force create ? */
207 lst_sid_t *lstio_ses_idp; /* OUT: session id */
208 int lstio_ses_nmlen; /* IN: name length */
209 char *lstio_ses_namep; /* IN: session name */
210 } lstio_session_new_args_t;
212 /* query current session */
214 lst_sid_t *lstio_ses_idp; /* OUT: session id */
215 int *lstio_ses_keyp; /* OUT: local key */
216 lstcon_ndlist_ent_t *lstio_ses_ndinfo; /* OUT: */
217 int lstio_ses_nmlen; /* IN: name length */
218 char *lstio_ses_namep; /* OUT: session name */
219 } lstio_session_info_args_t;
221 /* delete a session */
223 int lstio_ses_key; /* IN: session key */
224 } lstio_session_end_args_t;
226 #define LST_OPC_SESSION 1
227 #define LST_OPC_GROUP 2
228 #define LST_OPC_NODES 3
229 #define LST_OPC_BATCHCLI 4
230 #define LST_OPC_BATCHSRV 5
233 int lstio_dbg_key; /* IN: session key */
234 int lstio_dbg_type; /* IN: debug sessin|batch|group|nodes list */
235 int lstio_dbg_flags; /* IN: reserved debug flags */
236 int lstio_dbg_timeout; /* IN: timeout of debug */
238 int lstio_dbg_nmlen; /* IN: len of name */
239 char *lstio_dbg_namep; /* IN: name of group|batch */
240 int lstio_dbg_count; /* IN: # of test nodes to debug */
241 lnet_process_id_t *lstio_dbg_idsp; /* IN: id of test nodes */
242 struct list_head *lstio_dbg_resultp; /* OUT: list head of result buffer */
243 } lstio_debug_args_t;
246 int lstio_grp_key; /* IN: session key */
247 int lstio_grp_nmlen; /* IN: name length */
248 char *lstio_grp_namep; /* IN: group name */
249 } lstio_group_add_args_t;
252 int lstio_grp_key; /* IN: session key */
253 int lstio_grp_nmlen; /* IN: name length */
254 char *lstio_grp_namep; /* IN: group name */
255 } lstio_group_del_args_t;
257 #define LST_GROUP_CLEAN 1 /* remove inactive nodes in the group */
258 #define LST_GROUP_REFRESH 2 /* refresh inactive nodes in the group */
259 #define LST_GROUP_RMND 3 /* delete nodes from the group */
262 int lstio_grp_key; /* IN: session key */
263 int lstio_grp_opc; /* IN: OPC */
264 int lstio_grp_args; /* IN: arguments */
265 int lstio_grp_nmlen; /* IN: name length */
266 char *lstio_grp_namep; /* IN: group name */
267 int lstio_grp_count; /* IN: # of nodes id */
268 lnet_process_id_t *lstio_grp_idsp; /* IN: array of nodes */
269 struct list_head *lstio_grp_resultp; /* OUT: list head of result buffer */
270 } lstio_group_update_args_t;
273 int lstio_grp_key; /* IN: session key */
274 int lstio_grp_nmlen; /* IN: name length */
275 char *lstio_grp_namep; /* IN: group name */
276 int lstio_grp_count; /* IN: # of nodes */
277 lnet_process_id_t *lstio_grp_idsp; /* IN: nodes */
278 struct list_head *lstio_grp_resultp; /* OUT: list head of result buffer */
279 } lstio_group_nodes_args_t;
282 int lstio_grp_key; /* IN: session key */
283 int lstio_grp_idx; /* IN: group idx */
284 int lstio_grp_nmlen; /* IN: name len */
285 char *lstio_grp_namep; /* OUT: name */
286 } lstio_group_list_args_t;
289 int lstio_grp_key; /* IN: session key */
290 int lstio_grp_nmlen; /* IN: name len */
291 char *lstio_grp_namep; /* IN: name */
292 lstcon_ndlist_ent_t *lstio_grp_entp; /* OUT: description of group */
294 int *lstio_grp_idxp; /* IN/OUT: node index */
295 int *lstio_grp_ndentp; /* IN/OUT: # of nodent */
296 lstcon_node_ent_t *lstio_grp_dentsp; /* OUT: nodent array */
297 } lstio_group_info_args_t;
299 #define LST_DEFAULT_BATCH "batch" /* default batch name */
302 int lstio_bat_key; /* IN: session key */
303 int lstio_bat_nmlen; /* IN: name length */
304 char *lstio_bat_namep; /* IN: batch name */
305 } lstio_batch_add_args_t;
308 int lstio_bat_key; /* IN: session key */
309 int lstio_bat_nmlen; /* IN: name length */
310 char *lstio_bat_namep; /* IN: batch name */
311 } lstio_batch_del_args_t;
314 int lstio_bat_key; /* IN: session key */
315 int lstio_bat_timeout; /* IN: timeout for the batch */
316 int lstio_bat_nmlen; /* IN: name length */
317 char *lstio_bat_namep; /* IN: batch name */
318 struct list_head *lstio_bat_resultp; /* OUT: list head of result buffer */
319 } lstio_batch_run_args_t;
322 int lstio_bat_key; /* IN: session key */
323 int lstio_bat_force; /* IN: abort unfinished test RPC */
324 int lstio_bat_nmlen; /* IN: name length */
325 char *lstio_bat_namep; /* IN: batch name */
326 struct list_head *lstio_bat_resultp; /* OUT: list head of result buffer */
327 } lstio_batch_stop_args_t;
330 int lstio_bat_key; /* IN: session key */
331 int lstio_bat_testidx; /* IN: test index */
332 int lstio_bat_client; /* IN: is test client? */
333 int lstio_bat_timeout; /* IN: timeout for waiting */
334 int lstio_bat_nmlen; /* IN: name length */
335 char *lstio_bat_namep; /* IN: batch name */
336 struct list_head *lstio_bat_resultp; /* OUT: list head of result buffer */
337 } lstio_batch_query_args_t;
340 int lstio_bat_key; /* IN: session key */
341 int lstio_bat_idx; /* IN: index */
342 int lstio_bat_nmlen; /* IN: name length */
343 char *lstio_bat_namep; /* IN: batch name */
344 } lstio_batch_list_args_t;
347 int lstio_bat_key; /* IN: session key */
348 int lstio_bat_nmlen; /* IN: name length */
349 char *lstio_bat_namep; /* IN: name */
350 int lstio_bat_server; /* IN: query server or not */
351 int lstio_bat_testidx; /* IN: test index */
352 lstcon_test_batch_ent_t *lstio_bat_entp; /* OUT: batch ent */
354 int *lstio_bat_idxp; /* IN/OUT: index of node */
355 int *lstio_bat_ndentp; /* IN/OUT: # of nodent */
356 lstcon_node_ent_t *lstio_bat_dentsp; /* array of nodent */
357 } lstio_batch_info_args_t;
359 /* add stat in session */
361 int lstio_sta_key; /* IN: session key */
362 int lstio_sta_timeout; /* IN: timeout for stat requst */
363 int lstio_sta_nmlen; /* IN: group name length */
364 char *lstio_sta_namep; /* IN: group name */
365 int lstio_sta_count; /* IN: # of pid */
366 lnet_process_id_t *lstio_sta_idsp; /* IN: pid */
367 struct list_head *lstio_sta_resultp; /* OUT: list head of result buffer */
375 /* create a test in a batch */
376 #define LST_MAX_CONCUR 1024 /* Max concurrency of test */
379 int lstio_tes_key; /* IN: session key */
380 int lstio_tes_bat_nmlen; /* IN: batch name len */
381 char *lstio_tes_bat_name; /* IN: batch name */
382 int lstio_tes_type; /* IN: test type */
383 int lstio_tes_oneside; /* IN: one sided test */
384 int lstio_tes_loop; /* IN: loop count */
385 int lstio_tes_concur; /* IN: concurrency */
387 int lstio_tes_dist; /* IN: node distribution in destination groups */
388 int lstio_tes_span; /* IN: node span in destination groups */
389 int lstio_tes_sgrp_nmlen; /* IN: source group name length */
390 char *lstio_tes_sgrp_name; /* IN: group name */
391 int lstio_tes_dgrp_nmlen; /* IN: destination group name length */
392 char *lstio_tes_dgrp_name; /* IN: group name */
394 int lstio_tes_param_len; /* IN: param buffer len */
395 void *lstio_tes_param; /* IN: parameter for specified test:
399 int *lstio_tes_retp; /* OUT: private returned value */
400 struct list_head *lstio_tes_resultp; /* OUT: list head of result buffer */
409 LST_BRW_CHECK_NONE = 1,
410 LST_BRW_CHECK_SIMPLE = 2,
411 LST_BRW_CHECK_FULL = 3
415 int blk_opc; /* bulk operation code */
416 int blk_size; /* size (bytes) */
417 int blk_time; /* time of running the test*/
418 int blk_flags; /* reserved flags */
419 } lst_test_bulk_param_t;
422 int png_size; /* size of ping message */
423 int png_time; /* time */
424 int png_loop; /* loop */
425 int png_flags; /* reserved flags */
426 } lst_test_ping_param_t;
442 __u32 active_batches;
443 __u32 zombie_sessions;