1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 only,
10 * as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License version 2 for more details (a copy is included
16 * in the LICENSE file that accompanied this code).
18 * You should have received a copy of the GNU General Public License
19 * version 2 along with this program; If not, see [sun.com URL with a
22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23 * CA 95054 USA or visit www.sun.com if you need additional information or
29 * Copyright 2008 Sun Microsystems, Inc. All rights reserved
30 * Use is subject to license terms.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
36 * lnet/include/lnet/lnetst.h
38 * Author: Liang Zhen <liangzhen@clusterfs.com>
44 #include <libcfs/libcfs.h>
45 #include <lnet/lnet.h>
46 #include <lnet/lib-types.h>
48 #define LST_NAME_SIZE 32 /* max name buffer length */
50 #define LSTIO_DEBUG 0xC00 /* debug */
51 #define LSTIO_SESSION_NEW 0xC01 /* create session */
52 #define LSTIO_SESSION_END 0xC02 /* end session */
53 #define LSTIO_SESSION_INFO 0xC03 /* query session */
54 #define LSTIO_GROUP_ADD 0xC10 /* add group */
55 #define LSTIO_GROUP_LIST 0xC11 /* list all groups in session */
56 #define LSTIO_GROUP_INFO 0xC12 /* query defailt infomation of specified group */
57 #define LSTIO_GROUP_DEL 0xC13 /* delete group */
58 #define LSTIO_NODES_ADD 0xC14 /* add nodes to specified group */
59 #define LSTIO_GROUP_UPDATE 0xC15 /* update group */
60 #define LSTIO_BATCH_ADD 0xC20 /* add batch */
61 #define LSTIO_BATCH_START 0xC21 /* start batch */
62 #define LSTIO_BATCH_STOP 0xC22 /* stop batch */
63 #define LSTIO_BATCH_DEL 0xC23 /* delete batch */
64 #define LSTIO_BATCH_LIST 0xC24 /* show all batches in the session */
65 #define LSTIO_BATCH_INFO 0xC25 /* show defail of specified batch */
66 #define LSTIO_TEST_ADD 0xC26 /* add test (to batch) */
67 #define LSTIO_BATCH_QUERY 0xC27 /* query batch status */
68 #define LSTIO_STAT_QUERY 0xC30 /* get stats */
71 lnet_nid_t ses_nid; /* nid of console node */
72 __u64 ses_stamp; /* time stamp */
73 } lst_sid_t; /*** session id */
75 #define LST_INVALID_SID ((const lst_sid_t){.ses_nid = LNET_NID_ANY,\
79 __u64 bat_id; /* unique id in session */
80 } lst_bid_t; /*** batch id (group of tests) */
82 /* Status of test node */
83 #define LST_NODE_ACTIVE 0x1 /* node in this session */
84 #define LST_NODE_BUSY 0x2 /* node is taken by other session */
85 #define LST_NODE_DOWN 0x4 /* node is down */
86 #define LST_NODE_UNKNOWN 0x8 /* node not in session */
89 lnet_process_id_t nde_id; /* id of node */
90 int nde_state; /* state of node */
91 } lstcon_node_ent_t; /*** node entry, for list_group command */
94 int nle_nnode; /* # of nodes */
95 int nle_nactive; /* # of active nodes */
96 int nle_nbusy; /* # of busy nodes */
97 int nle_ndown; /* # of down nodes */
98 int nle_nunknown; /* # of unknown nodes */
99 } lstcon_ndlist_ent_t; /*** node_list entry, for list_batch command */
102 int tse_type; /* test type */
103 int tse_loop; /* loop count */
104 int tse_concur; /* concurrency of test */
105 } lstcon_test_ent_t; /*** test summary entry, for list_batch command */
108 int bae_state; /* batch status */
109 int bae_timeout; /* batch timeout */
110 int bae_ntest; /* # of tests in the batch */
111 } lstcon_batch_ent_t; /*** batch summary entry, for list_batch command */
114 lstcon_ndlist_ent_t tbe_cli_nle; /* client (group) node_list entry */
115 lstcon_ndlist_ent_t tbe_srv_nle; /* server (group) node_list entry */
117 lstcon_test_ent_t tbe_test; /* test entry */
118 lstcon_batch_ent_t tbe_batch; /* batch entry */
120 } lstcon_test_batch_ent_t; /*** test/batch verbose information entry,
121 *** for list_batch command */
124 struct list_head rpe_link; /* link chain */
125 lnet_process_id_t rpe_peer; /* peer's id */
126 struct timeval rpe_stamp; /* time stamp of RPC */
127 int rpe_state; /* peer's state */
128 int rpe_rpc_errno; /* RPC errno */
130 lst_sid_t rpe_sid; /* peer's session id */
131 int rpe_fwk_errno; /* framework errno */
132 int rpe_priv[4]; /* private data */
133 char rpe_payload[0]; /* private reply payload */
137 int trs_rpc_stat[4]; /* RPCs stat (0: total, 1: failed, 2: finished, 4: reserved */
138 int trs_rpc_errno; /* RPC errno */
139 int trs_fwk_stat[8]; /* framework stat */
140 int trs_fwk_errno; /* errno of the first remote error */
141 void *trs_fwk_private; /* private framework stat */
142 } lstcon_trans_stat_t;
145 lstcon_rpc_stat_total(lstcon_trans_stat_t *stat, int inc)
147 return inc ? ++stat->trs_rpc_stat[0] : stat->trs_rpc_stat[0];
151 lstcon_rpc_stat_success(lstcon_trans_stat_t *stat, int inc)
153 return inc ? ++stat->trs_rpc_stat[1] : stat->trs_rpc_stat[1];
157 lstcon_rpc_stat_failure(lstcon_trans_stat_t *stat, int inc)
159 return inc ? ++stat->trs_rpc_stat[2] : stat->trs_rpc_stat[2];
163 lstcon_sesop_stat_success(lstcon_trans_stat_t *stat, int inc)
165 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
169 lstcon_sesop_stat_failure(lstcon_trans_stat_t *stat, int inc)
171 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
175 lstcon_sesqry_stat_active(lstcon_trans_stat_t *stat, int inc)
177 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
181 lstcon_sesqry_stat_busy(lstcon_trans_stat_t *stat, int inc)
183 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
187 lstcon_sesqry_stat_unknown(lstcon_trans_stat_t *stat, int inc)
189 return inc ? ++stat->trs_fwk_stat[2] : stat->trs_fwk_stat[2];
193 lstcon_tsbop_stat_success(lstcon_trans_stat_t *stat, int inc)
195 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
199 lstcon_tsbop_stat_failure(lstcon_trans_stat_t *stat, int inc)
201 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
205 lstcon_tsbqry_stat_idle(lstcon_trans_stat_t *stat, int inc)
207 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
211 lstcon_tsbqry_stat_run(lstcon_trans_stat_t *stat, int inc)
213 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
217 lstcon_tsbqry_stat_failure(lstcon_trans_stat_t *stat, int inc)
219 return inc ? ++stat->trs_fwk_stat[2] : stat->trs_fwk_stat[2];
223 lstcon_statqry_stat_success(lstcon_trans_stat_t *stat, int inc)
225 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
229 lstcon_statqry_stat_failure(lstcon_trans_stat_t *stat, int inc)
231 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
234 /* create a session */
236 int lstio_ses_key; /* IN: local key */
237 int lstio_ses_timeout; /* IN: session timeout */
238 int lstio_ses_force; /* IN: force create ? */
239 lst_sid_t *lstio_ses_idp; /* OUT: session id */
240 int lstio_ses_nmlen; /* IN: name length */
241 char *lstio_ses_namep; /* IN: session name */
242 } lstio_session_new_args_t;
244 /* query current session */
246 lst_sid_t *lstio_ses_idp; /* OUT: session id */
247 int *lstio_ses_keyp; /* OUT: local key */
248 lstcon_ndlist_ent_t *lstio_ses_ndinfo; /* OUT: */
249 int lstio_ses_nmlen; /* IN: name length */
250 char *lstio_ses_namep; /* OUT: session name */
251 } lstio_session_info_args_t;
253 /* delete a session */
255 int lstio_ses_key; /* IN: session key */
256 } lstio_session_end_args_t;
258 #define LST_OPC_SESSION 1
259 #define LST_OPC_GROUP 2
260 #define LST_OPC_NODES 3
261 #define LST_OPC_BATCHCLI 4
262 #define LST_OPC_BATCHSRV 5
265 int lstio_dbg_key; /* IN: session key */
266 int lstio_dbg_type; /* IN: debug sessin|batch|group|nodes list */
267 int lstio_dbg_flags; /* IN: reserved debug flags */
268 int lstio_dbg_timeout; /* IN: timeout of debug */
270 int lstio_dbg_nmlen; /* IN: len of name */
271 char *lstio_dbg_namep; /* IN: name of group|batch */
272 int lstio_dbg_count; /* IN: # of test nodes to debug */
273 lnet_process_id_t *lstio_dbg_idsp; /* IN: id of test nodes */
274 struct list_head *lstio_dbg_resultp; /* OUT: list head of result buffer */
275 } lstio_debug_args_t;
278 int lstio_grp_key; /* IN: session key */
279 int lstio_grp_nmlen; /* IN: name length */
280 char *lstio_grp_namep; /* IN: group name */
281 } lstio_group_add_args_t;
284 int lstio_grp_key; /* IN: session key */
285 int lstio_grp_nmlen; /* IN: name length */
286 char *lstio_grp_namep; /* IN: group name */
287 } lstio_group_del_args_t;
289 #define LST_GROUP_CLEAN 1 /* remove inactive nodes in the group */
290 #define LST_GROUP_REFRESH 2 /* refresh inactive nodes in the group */
291 #define LST_GROUP_RMND 3 /* delete nodes from the group */
294 int lstio_grp_key; /* IN: session key */
295 int lstio_grp_opc; /* IN: OPC */
296 int lstio_grp_args; /* IN: arguments */
297 int lstio_grp_nmlen; /* IN: name length */
298 char *lstio_grp_namep; /* IN: group name */
299 int lstio_grp_count; /* IN: # of nodes id */
300 lnet_process_id_t *lstio_grp_idsp; /* IN: array of nodes */
301 struct list_head *lstio_grp_resultp; /* OUT: list head of result buffer */
302 } lstio_group_update_args_t;
305 int lstio_grp_key; /* IN: session key */
306 int lstio_grp_nmlen; /* IN: name length */
307 char *lstio_grp_namep; /* IN: group name */
308 int lstio_grp_count; /* IN: # of nodes */
309 lnet_process_id_t *lstio_grp_idsp; /* IN: nodes */
310 struct list_head *lstio_grp_resultp; /* OUT: list head of result buffer */
311 } lstio_group_nodes_args_t;
314 int lstio_grp_key; /* IN: session key */
315 int lstio_grp_idx; /* IN: group idx */
316 int lstio_grp_nmlen; /* IN: name len */
317 char *lstio_grp_namep; /* OUT: name */
318 } lstio_group_list_args_t;
321 int lstio_grp_key; /* IN: session key */
322 int lstio_grp_nmlen; /* IN: name len */
323 char *lstio_grp_namep; /* IN: name */
324 lstcon_ndlist_ent_t *lstio_grp_entp; /* OUT: description of group */
326 int *lstio_grp_idxp; /* IN/OUT: node index */
327 int *lstio_grp_ndentp; /* IN/OUT: # of nodent */
328 lstcon_node_ent_t *lstio_grp_dentsp; /* OUT: nodent array */
329 } lstio_group_info_args_t;
331 #define LST_DEFAULT_BATCH "batch" /* default batch name */
334 int lstio_bat_key; /* IN: session key */
335 int lstio_bat_nmlen; /* IN: name length */
336 char *lstio_bat_namep; /* IN: batch name */
337 } lstio_batch_add_args_t;
340 int lstio_bat_key; /* IN: session key */
341 int lstio_bat_nmlen; /* IN: name length */
342 char *lstio_bat_namep; /* IN: batch name */
343 } lstio_batch_del_args_t;
346 int lstio_bat_key; /* IN: session key */
347 int lstio_bat_timeout; /* IN: timeout for the batch */
348 int lstio_bat_nmlen; /* IN: name length */
349 char *lstio_bat_namep; /* IN: batch name */
350 struct list_head *lstio_bat_resultp; /* OUT: list head of result buffer */
351 } lstio_batch_run_args_t;
354 int lstio_bat_key; /* IN: session key */
355 int lstio_bat_force; /* IN: abort unfinished test RPC */
356 int lstio_bat_nmlen; /* IN: name length */
357 char *lstio_bat_namep; /* IN: batch name */
358 struct list_head *lstio_bat_resultp; /* OUT: list head of result buffer */
359 } lstio_batch_stop_args_t;
362 int lstio_bat_key; /* IN: session key */
363 int lstio_bat_testidx; /* IN: test index */
364 int lstio_bat_client; /* IN: is test client? */
365 int lstio_bat_timeout; /* IN: timeout for waiting */
366 int lstio_bat_nmlen; /* IN: name length */
367 char *lstio_bat_namep; /* IN: batch name */
368 struct list_head *lstio_bat_resultp; /* OUT: list head of result buffer */
369 } lstio_batch_query_args_t;
372 int lstio_bat_key; /* IN: session key */
373 int lstio_bat_idx; /* IN: index */
374 int lstio_bat_nmlen; /* IN: name length */
375 char *lstio_bat_namep; /* IN: batch name */
376 } lstio_batch_list_args_t;
379 int lstio_bat_key; /* IN: session key */
380 int lstio_bat_nmlen; /* IN: name length */
381 char *lstio_bat_namep; /* IN: name */
382 int lstio_bat_server; /* IN: query server or not */
383 int lstio_bat_testidx; /* IN: test index */
384 lstcon_test_batch_ent_t *lstio_bat_entp; /* OUT: batch ent */
386 int *lstio_bat_idxp; /* IN/OUT: index of node */
387 int *lstio_bat_ndentp; /* IN/OUT: # of nodent */
388 lstcon_node_ent_t *lstio_bat_dentsp; /* array of nodent */
389 } lstio_batch_info_args_t;
391 /* add stat in session */
393 int lstio_sta_key; /* IN: session key */
394 int lstio_sta_timeout; /* IN: timeout for stat requst */
395 int lstio_sta_nmlen; /* IN: group name length */
396 char *lstio_sta_namep; /* IN: group name */
397 int lstio_sta_count; /* IN: # of pid */
398 lnet_process_id_t *lstio_sta_idsp; /* IN: pid */
399 struct list_head *lstio_sta_resultp; /* OUT: list head of result buffer */
407 /* create a test in a batch */
408 #define LST_MAX_CONCUR 1024 /* Max concurrency of test */
411 int lstio_tes_key; /* IN: session key */
412 int lstio_tes_bat_nmlen; /* IN: batch name len */
413 char *lstio_tes_bat_name; /* IN: batch name */
414 int lstio_tes_type; /* IN: test type */
415 int lstio_tes_oneside; /* IN: one sided test */
416 int lstio_tes_loop; /* IN: loop count */
417 int lstio_tes_concur; /* IN: concurrency */
419 int lstio_tes_dist; /* IN: node distribution in destination groups */
420 int lstio_tes_span; /* IN: node span in destination groups */
421 int lstio_tes_sgrp_nmlen; /* IN: source group name length */
422 char *lstio_tes_sgrp_name; /* IN: group name */
423 int lstio_tes_dgrp_nmlen; /* IN: destination group name length */
424 char *lstio_tes_dgrp_name; /* IN: group name */
426 int lstio_tes_param_len; /* IN: param buffer len */
427 void *lstio_tes_param; /* IN: parameter for specified test:
431 int *lstio_tes_retp; /* OUT: private returned value */
432 struct list_head *lstio_tes_resultp; /* OUT: list head of result buffer */
441 LST_BRW_CHECK_NONE = 1,
442 LST_BRW_CHECK_SIMPLE = 2,
443 LST_BRW_CHECK_FULL = 3
447 int blk_opc; /* bulk operation code */
448 int blk_size; /* size (bytes) */
449 int blk_time; /* time of running the test*/
450 int blk_flags; /* reserved flags */
451 } lst_test_bulk_param_t;
454 int png_size; /* size of ping message */
455 int png_time; /* time */
456 int png_loop; /* loop */
457 int png_flags; /* reserved flags */
458 } lst_test_ping_param_t;
474 __u32 active_batches;
475 __u32 zombie_sessions;