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.gnu.org/licenses/gpl-2.0.html
23 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Use is subject to license terms.
26 * Copyright (c) 2012, 2016, Intel Corporation.
29 * This file is part of Lustre, http://www.lustre.org/
30 * Lustre is a trademark of Sun Microsystems, Inc.
32 * lnet/include/lnet/lnetst.h
34 * Author: Liang Zhen <liangzhen@clusterfs.com>
40 #define LST_FEAT_NONE (0)
41 #define LST_FEAT_BULK_LEN (1 << 0) /* enable variable page size */
43 #define LST_FEATS_EMPTY (LST_FEAT_NONE)
44 #define LST_FEATS_MASK (LST_FEAT_NONE | LST_FEAT_BULK_LEN)
46 #define LST_NAME_SIZE 32 /* max name buffer length */
48 #define LSTIO_DEBUG 0xC00 /* debug */
49 #define LSTIO_SESSION_NEW 0xC01 /* create session */
50 #define LSTIO_SESSION_END 0xC02 /* end session */
51 #define LSTIO_SESSION_INFO 0xC03 /* query session */
52 #define LSTIO_GROUP_ADD 0xC10 /* add group */
53 #define LSTIO_GROUP_LIST 0xC11 /* list all groups in session */
54 #define LSTIO_GROUP_INFO 0xC12 /* query defailt infomation of specified group */
55 #define LSTIO_GROUP_DEL 0xC13 /* delete group */
56 #define LSTIO_NODES_ADD 0xC14 /* add nodes to specified group */
57 #define LSTIO_GROUP_UPDATE 0xC15 /* update group */
58 #define LSTIO_BATCH_ADD 0xC20 /* add batch */
59 #define LSTIO_BATCH_START 0xC21 /* start batch */
60 #define LSTIO_BATCH_STOP 0xC22 /* stop batch */
61 #define LSTIO_BATCH_DEL 0xC23 /* delete batch */
62 #define LSTIO_BATCH_LIST 0xC24 /* show all batches in the session */
63 #define LSTIO_BATCH_INFO 0xC25 /* show defail of specified batch */
64 #define LSTIO_TEST_ADD 0xC26 /* add test (to batch) */
65 #define LSTIO_BATCH_QUERY 0xC27 /* query batch status */
66 #define LSTIO_STAT_QUERY 0xC30 /* get stats */
69 lnet_nid_t ses_nid; /* nid of console node */
70 __u64 ses_stamp; /* time stamp */
73 extern struct lst_sid LST_INVALID_SID;
76 __u64 bat_id; /* unique id in session */
79 /* Status of test node */
80 #define LST_NODE_ACTIVE 0x1 /* node in this session */
81 #define LST_NODE_BUSY 0x2 /* node is taken by other session */
82 #define LST_NODE_DOWN 0x4 /* node is down */
83 #define LST_NODE_UNKNOWN 0x8 /* node not in session */
85 struct lstcon_node_ent {
86 lnet_process_id_t nde_id; /* id of node */
87 int nde_state; /* state of node */
88 }; /*** node entry, for list_group command */
90 struct lstcon_ndlist_ent {
91 int nle_nnode; /* # of nodes */
92 int nle_nactive; /* # of active nodes */
93 int nle_nbusy; /* # of busy nodes */
94 int nle_ndown; /* # of down nodes */
95 int nle_nunknown; /* # of unknown nodes */
96 }; /*** node_list entry, for list_batch command */
98 struct lstcon_test_ent {
99 int tse_type; /* test type */
100 int tse_loop; /* loop count */
101 int tse_concur; /* concurrency of test */
102 }; /*** test summary entry, for list_batch command */
104 struct lstcon_batch_ent {
105 int bae_state; /* batch status */
106 int bae_timeout; /* batch timeout */
107 int bae_ntest; /* # of tests in the batch */
108 }; /*** batch summary entry, for list_batch command */
110 struct lstcon_test_batch_ent {
111 struct lstcon_ndlist_ent tbe_cli_nle; /* client (group) node_list entry */
112 struct lstcon_ndlist_ent tbe_srv_nle; /* server (group) node_list entry */
114 struct lstcon_test_ent tbe_test; /* test entry */
115 struct lstcon_batch_ent tbe_batch; /* batch entry */
117 }; /*** test/batch verbose information entry,
118 *** for list_batch command */
120 struct lstcon_rpc_ent {
121 struct list_head rpe_link; /* link chain */
122 lnet_process_id_t rpe_peer; /* peer's id */
123 struct timeval rpe_stamp; /* time stamp of RPC */
124 int rpe_state; /* peer's state */
125 int rpe_rpc_errno; /* RPC errno */
127 struct lst_sid rpe_sid; /* peer's session id */
128 int rpe_fwk_errno; /* framework errno */
129 int rpe_priv[4]; /* private data */
130 char rpe_payload[0]; /* private reply payload */
133 struct lstcon_trans_stat {
134 int trs_rpc_stat[4]; /* RPCs stat (0: total, 1: failed, 2: finished, 4: reserved */
135 int trs_rpc_errno; /* RPC errno */
136 int trs_fwk_stat[8]; /* framework stat */
137 int trs_fwk_errno; /* errno of the first remote error */
138 void *trs_fwk_private; /* private framework stat */
142 lstcon_rpc_stat_total(struct lstcon_trans_stat *stat, int inc)
144 return inc ? ++stat->trs_rpc_stat[0] : stat->trs_rpc_stat[0];
148 lstcon_rpc_stat_success(struct lstcon_trans_stat *stat, int inc)
150 return inc ? ++stat->trs_rpc_stat[1] : stat->trs_rpc_stat[1];
154 lstcon_rpc_stat_failure(struct lstcon_trans_stat *stat, int inc)
156 return inc ? ++stat->trs_rpc_stat[2] : stat->trs_rpc_stat[2];
160 lstcon_sesop_stat_success(struct lstcon_trans_stat *stat, int inc)
162 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
166 lstcon_sesop_stat_failure(struct lstcon_trans_stat *stat, int inc)
168 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
172 lstcon_sesqry_stat_active(struct lstcon_trans_stat *stat, int inc)
174 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
178 lstcon_sesqry_stat_busy(struct lstcon_trans_stat *stat, int inc)
180 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
184 lstcon_sesqry_stat_unknown(struct lstcon_trans_stat *stat, int inc)
186 return inc ? ++stat->trs_fwk_stat[2] : stat->trs_fwk_stat[2];
190 lstcon_tsbop_stat_success(struct lstcon_trans_stat *stat, int inc)
192 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
196 lstcon_tsbop_stat_failure(struct lstcon_trans_stat *stat, int inc)
198 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
202 lstcon_tsbqry_stat_idle(struct lstcon_trans_stat *stat, int inc)
204 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
208 lstcon_tsbqry_stat_run(struct lstcon_trans_stat *stat, int inc)
210 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
214 lstcon_tsbqry_stat_failure(struct lstcon_trans_stat *stat, int inc)
216 return inc ? ++stat->trs_fwk_stat[2] : stat->trs_fwk_stat[2];
220 lstcon_statqry_stat_success(struct lstcon_trans_stat *stat, int inc)
222 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
226 lstcon_statqry_stat_failure(struct lstcon_trans_stat *stat, int inc)
228 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
231 /* create a session */
232 struct lstio_session_new_args {
233 int lstio_ses_key; /* IN: local key */
234 int lstio_ses_timeout; /* IN: session timeout */
235 int lstio_ses_force; /* IN: force create ? */
236 /** IN: session features */
237 unsigned lstio_ses_feats;
238 struct lst_sid __user *lstio_ses_idp; /* OUT: session id */
239 int lstio_ses_nmlen; /* IN: name length */
240 char __user *lstio_ses_namep; /* IN: session name */
243 /* query current session */
244 struct lstio_session_info_args {
245 struct lst_sid __user *lstio_ses_idp; /* OUT: session id */
246 int __user *lstio_ses_keyp; /* OUT: local key */
247 /** OUT: session features */
248 unsigned __user *lstio_ses_featp;
249 struct lstcon_ndlist_ent __user *lstio_ses_ndinfo; /* OUT: */
250 int lstio_ses_nmlen; /* IN: name length */
251 char __user *lstio_ses_namep; /* OUT: session name */
254 /* delete a session */
255 struct lstio_session_end_args {
256 int lstio_ses_key; /* IN: session key */
259 #define LST_OPC_SESSION 1
260 #define LST_OPC_GROUP 2
261 #define LST_OPC_NODES 3
262 #define LST_OPC_BATCHCLI 4
263 #define LST_OPC_BATCHSRV 5
265 struct lstio_debug_args {
266 int lstio_dbg_key; /* IN: session key */
267 int lstio_dbg_type; /* IN: debug sessin|batch|group|nodes list */
268 int lstio_dbg_flags; /* IN: reserved debug flags */
269 int lstio_dbg_timeout; /* IN: timeout of debug */
271 int lstio_dbg_nmlen; /* IN: len of name */
272 char __user *lstio_dbg_namep; /* IN: name of group|batch */
273 int lstio_dbg_count; /* IN: # of test nodes to debug */
274 lnet_process_id_t __user *lstio_dbg_idsp; /* IN: id of test nodes */
275 /* OUT: list head of result buffer */
276 struct list_head __user *lstio_dbg_resultp;
279 struct lstio_group_add_args {
280 int lstio_grp_key; /* IN: session key */
281 int lstio_grp_nmlen; /* IN: name length */
282 char __user *lstio_grp_namep; /* IN: group name */
285 struct lstio_group_del_args {
286 int lstio_grp_key; /* IN: session key */
287 int lstio_grp_nmlen; /* IN: name length */
288 char __user *lstio_grp_namep; /* IN: group name */
291 #define LST_GROUP_CLEAN 1 /* remove inactive nodes in the group */
292 #define LST_GROUP_REFRESH 2 /* refresh inactive nodes in the group */
293 #define LST_GROUP_RMND 3 /* delete nodes from the group */
295 struct lstio_group_update_args {
296 int lstio_grp_key; /* IN: session key */
297 int lstio_grp_opc; /* IN: OPC */
298 int lstio_grp_args; /* IN: arguments */
299 int lstio_grp_nmlen; /* IN: name length */
300 char __user *lstio_grp_namep; /* IN: group name */
301 int lstio_grp_count; /* IN: # of nodes id */
302 lnet_process_id_t __user *lstio_grp_idsp; /* IN: array of nodes */
303 /* OUT: list head of result buffer */
304 struct list_head __user *lstio_grp_resultp;
307 struct lstio_group_nodes_args {
308 int lstio_grp_key; /* IN: session key */
309 int lstio_grp_nmlen; /* IN: name length */
310 char __user *lstio_grp_namep; /* IN: group name */
311 int lstio_grp_count; /* IN: # of nodes */
312 /** OUT: session features */
313 unsigned __user *lstio_grp_featp;
314 lnet_process_id_t __user *lstio_grp_idsp; /* IN: nodes */
315 /* OUT: list head of result buffer */
316 struct list_head __user *lstio_grp_resultp;
319 struct lstio_group_list_args {
320 int lstio_grp_key; /* IN: session key */
321 int lstio_grp_idx; /* IN: group idx */
322 int lstio_grp_nmlen; /* IN: name len */
323 char __user *lstio_grp_namep; /* OUT: name */
326 struct lstio_group_info_args {
327 int lstio_grp_key; /* IN: session key */
328 int lstio_grp_nmlen; /* IN: name len */
329 char __user *lstio_grp_namep; /* IN: name */
330 struct lstcon_ndlist_ent __user *lstio_grp_entp;/* OUT: description of group */
332 int __user *lstio_grp_idxp; /* IN/OUT: node index */
333 int __user *lstio_grp_ndentp; /* IN/OUT: # of nodent */
334 struct lstcon_node_ent __user *lstio_grp_dentsp;/* OUT: nodent array */
337 #define LST_DEFAULT_BATCH "batch" /* default batch name */
339 struct lstio_batch_add_args {
340 int lstio_bat_key; /* IN: session key */
341 int lstio_bat_nmlen; /* IN: name length */
342 char __user *lstio_bat_namep; /* IN: batch name */
345 struct lstio_batch_del_args {
346 int lstio_bat_key; /* IN: session key */
347 int lstio_bat_nmlen; /* IN: name length */
348 char __user *lstio_bat_namep; /* IN: batch name */
351 struct lstio_batch_run_args {
352 /* IN: session key */
354 /* IN: timeout for the batch */
355 int lstio_bat_timeout;
356 /* IN: name length */
359 char __user *lstio_bat_namep;
360 /* OUT: list head of result buffer */
361 struct list_head __user *lstio_bat_resultp;
364 struct lstio_batch_stop_args {
365 /* IN: session key */
367 /* IN: abort unfinished test RPC */
369 /* IN: name length */
372 char __user *lstio_bat_namep;
373 /* OUT: list head of result buffer */
374 struct list_head __user *lstio_bat_resultp;
377 struct lstio_batch_query_args {
378 /* IN: session key */
381 int lstio_bat_testidx;
382 /* IN: is test client? */
383 int lstio_bat_client;
384 /* IN: timeout for waiting */
385 int lstio_bat_timeout;
386 /* IN: name length */
389 char __user *lstio_bat_namep;
390 /* OUT: list head of result buffer */
391 struct list_head __user *lstio_bat_resultp;
394 struct lstio_batch_list_args {
395 int lstio_bat_key; /* IN: session key */
396 int lstio_bat_idx; /* IN: index */
397 int lstio_bat_nmlen; /* IN: name length */
398 char __user *lstio_bat_namep; /* IN: batch name */
401 struct lstio_batch_info_args {
402 int lstio_bat_key; /* IN: session key */
403 int lstio_bat_nmlen; /* IN: name length */
404 char __user *lstio_bat_namep; /* IN: name */
405 int lstio_bat_server; /* IN: query server or not */
406 int lstio_bat_testidx; /* IN: test index */
407 struct lstcon_test_batch_ent __user *lstio_bat_entp;/* OUT: batch ent */
409 int __user *lstio_bat_idxp; /* IN/OUT: index of node */
410 int __user *lstio_bat_ndentp; /* IN/OUT: # of nodent */
411 struct lstcon_node_ent __user *lstio_bat_dentsp;/* array of nodent */
414 /* add stat in session */
415 struct lstio_stat_args {
416 /* IN: session key */
418 /* IN: timeout for stat requst */
419 int lstio_sta_timeout;
420 /* IN: group name length */
423 char __user *lstio_sta_namep;
427 lnet_process_id_t __user *lstio_sta_idsp;
428 /* OUT: list head of result buffer */
429 struct list_head __user *lstio_sta_resultp;
437 /* create a test in a batch */
438 #define LST_MAX_CONCUR 1024 /* Max concurrency of test */
440 struct lstio_test_args {
441 int lstio_tes_key; /* IN: session key */
442 int lstio_tes_bat_nmlen; /* IN: batch name len */
443 char __user *lstio_tes_bat_name; /* IN: batch name */
444 int lstio_tes_type; /* IN: test type */
445 int lstio_tes_oneside; /* IN: one sided test */
446 int lstio_tes_loop; /* IN: loop count */
447 int lstio_tes_concur; /* IN: concurrency */
449 int lstio_tes_dist; /* IN: node distribution in destination groups */
450 int lstio_tes_span; /* IN: node span in destination groups */
451 int lstio_tes_sgrp_nmlen; /* IN: source group name length */
452 char __user *lstio_tes_sgrp_name; /* IN: group name */
453 int lstio_tes_dgrp_nmlen; /* IN: destination group name length */
454 char __user *lstio_tes_dgrp_name; /* IN: group name */
456 /* IN: param buffer len */
457 int lstio_tes_param_len;
458 /* IN: parameter for specified test:
462 void __user *lstio_tes_param;
463 /* OUT: private returned value */
464 int __user *lstio_tes_retp;
465 /* OUT: list head of result buffer */
466 struct list_head __user *lstio_tes_resultp;
475 LST_BRW_CHECK_NONE = 1,
476 LST_BRW_CHECK_SIMPLE = 2,
477 LST_BRW_CHECK_FULL = 3
480 struct lst_test_bulk_param {
481 int blk_opc; /* bulk operation code */
482 int blk_size; /* size (bytes) */
483 int blk_time; /* time of running the test*/
484 int blk_flags; /* reserved flags */
485 int blk_cli_off; /* bulk offset on client */
486 int blk_srv_off; /* reserved: bulk offset on server */
489 struct lst_test_ping_param {
490 int png_size; /* size of ping message */
491 int png_time; /* time */
492 int png_loop; /* loop */
493 int png_flags; /* reserved flags */
496 struct srpc_counters {
506 struct sfw_counters {
507 /** milliseconds since current session started */
509 __u32 active_batches;
510 __u32 zombie_sessions;