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 * Author: Liang Zhen <liangzhen@clusterfs.com>
35 #ifndef __UAPI_LNET_ST_H__
36 #define __UAPI_LNET_ST_H__
38 #define LST_FEAT_NONE (0)
39 #define LST_FEAT_BULK_LEN (1 << 0) /* enable variable page size */
41 #define LST_FEATS_EMPTY (LST_FEAT_NONE)
42 #define LST_FEATS_MASK (LST_FEAT_NONE | LST_FEAT_BULK_LEN)
44 #define LST_NAME_SIZE 32 /* max name buffer length */
46 #define LSTIO_DEBUG 0xC00 /* debug */
47 #define LSTIO_SESSION_NEW 0xC01 /* create session */
48 #define LSTIO_SESSION_END 0xC02 /* end session */
49 #define LSTIO_SESSION_INFO 0xC03 /* query session */
50 #define LSTIO_GROUP_ADD 0xC10 /* add group */
51 #define LSTIO_GROUP_LIST 0xC11 /* list all groups in session */
52 #define LSTIO_GROUP_INFO 0xC12 /* query defailt infomation of specified group */
53 #define LSTIO_GROUP_DEL 0xC13 /* delete group */
54 #define LSTIO_NODES_ADD 0xC14 /* add nodes to specified group */
55 #define LSTIO_GROUP_UPDATE 0xC15 /* update group */
56 #define LSTIO_BATCH_ADD 0xC20 /* add batch */
57 #define LSTIO_BATCH_START 0xC21 /* start batch */
58 #define LSTIO_BATCH_STOP 0xC22 /* stop batch */
59 #define LSTIO_BATCH_DEL 0xC23 /* delete batch */
60 #define LSTIO_BATCH_LIST 0xC24 /* show all batches in the session */
61 #define LSTIO_BATCH_INFO 0xC25 /* show defail of specified batch */
62 #define LSTIO_TEST_ADD 0xC26 /* add test (to batch) */
63 #define LSTIO_BATCH_QUERY 0xC27 /* query batch status */
64 #define LSTIO_STAT_QUERY 0xC30 /* get stats */
67 lnet_nid_t ses_nid; /* nid of console node */
68 __u64 ses_stamp; /* time stamp */
71 extern struct lst_sid LST_INVALID_SID;
74 __u64 bat_id; /* unique id in session */
77 /* Status of test node */
78 #define LST_NODE_ACTIVE 0x1 /* node in this session */
79 #define LST_NODE_BUSY 0x2 /* node is taken by other session */
80 #define LST_NODE_DOWN 0x4 /* node is down */
81 #define LST_NODE_UNKNOWN 0x8 /* node not in session */
83 struct lstcon_node_ent {
84 struct lnet_process_id nde_id; /* id of node */
85 int nde_state; /* state of node */
86 }; /*** node entry, for list_group command */
88 struct lstcon_ndlist_ent {
89 int nle_nnode; /* # of nodes */
90 int nle_nactive; /* # of active nodes */
91 int nle_nbusy; /* # of busy nodes */
92 int nle_ndown; /* # of down nodes */
93 int nle_nunknown; /* # of unknown nodes */
94 }; /*** node_list entry, for list_batch command */
96 struct lstcon_test_ent {
97 int tse_type; /* test type */
98 int tse_loop; /* loop count */
99 int tse_concur; /* concurrency of test */
100 }; /*** test summary entry, for list_batch command */
102 struct lstcon_batch_ent {
103 int bae_state; /* batch status */
104 int bae_timeout; /* batch timeout */
105 int bae_ntest; /* # of tests in the batch */
106 }; /*** batch summary entry, for list_batch command */
108 struct lstcon_test_batch_ent {
109 struct lstcon_ndlist_ent tbe_cli_nle; /* client (group) node_list entry */
110 struct lstcon_ndlist_ent tbe_srv_nle; /* server (group) node_list entry */
112 struct lstcon_test_ent tbe_test; /* test entry */
113 struct lstcon_batch_ent tbe_batch; /* batch entry */
115 }; /*** test/batch verbose information entry,
116 *** for list_batch command */
118 struct lstcon_rpc_ent {
119 struct list_head rpe_link; /* link chain */
120 struct lnet_process_id rpe_peer; /* peer's id */
121 struct timeval rpe_stamp; /* time stamp of RPC */
122 int rpe_state; /* peer's state */
123 int rpe_rpc_errno; /* RPC errno */
125 struct lst_sid rpe_sid; /* peer's session id */
126 int rpe_fwk_errno; /* framework errno */
127 int rpe_priv[4]; /* private data */
128 char rpe_payload[0]; /* private reply payload */
131 struct lstcon_trans_stat {
132 int trs_rpc_stat[4]; /* RPCs stat (0: total, 1: failed, 2: finished, 4: reserved */
133 int trs_rpc_errno; /* RPC errno */
134 int trs_fwk_stat[8]; /* framework stat */
135 int trs_fwk_errno; /* errno of the first remote error */
136 void *trs_fwk_private; /* private framework stat */
140 lstcon_rpc_stat_total(struct lstcon_trans_stat *stat, int inc)
142 return inc ? ++stat->trs_rpc_stat[0] : stat->trs_rpc_stat[0];
146 lstcon_rpc_stat_success(struct lstcon_trans_stat *stat, int inc)
148 return inc ? ++stat->trs_rpc_stat[1] : stat->trs_rpc_stat[1];
152 lstcon_rpc_stat_failure(struct lstcon_trans_stat *stat, int inc)
154 return inc ? ++stat->trs_rpc_stat[2] : stat->trs_rpc_stat[2];
158 lstcon_sesop_stat_success(struct lstcon_trans_stat *stat, int inc)
160 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
164 lstcon_sesop_stat_failure(struct lstcon_trans_stat *stat, int inc)
166 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
170 lstcon_sesqry_stat_active(struct lstcon_trans_stat *stat, int inc)
172 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
176 lstcon_sesqry_stat_busy(struct lstcon_trans_stat *stat, int inc)
178 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
182 lstcon_sesqry_stat_unknown(struct lstcon_trans_stat *stat, int inc)
184 return inc ? ++stat->trs_fwk_stat[2] : stat->trs_fwk_stat[2];
188 lstcon_tsbop_stat_success(struct lstcon_trans_stat *stat, int inc)
190 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
194 lstcon_tsbop_stat_failure(struct lstcon_trans_stat *stat, int inc)
196 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
200 lstcon_tsbqry_stat_idle(struct lstcon_trans_stat *stat, int inc)
202 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
206 lstcon_tsbqry_stat_run(struct lstcon_trans_stat *stat, int inc)
208 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
212 lstcon_tsbqry_stat_failure(struct lstcon_trans_stat *stat, int inc)
214 return inc ? ++stat->trs_fwk_stat[2] : stat->trs_fwk_stat[2];
218 lstcon_statqry_stat_success(struct lstcon_trans_stat *stat, int inc)
220 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
224 lstcon_statqry_stat_failure(struct lstcon_trans_stat *stat, int inc)
226 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
229 /* create a session */
230 struct lstio_session_new_args {
231 int lstio_ses_key; /* IN: local key */
232 int lstio_ses_timeout; /* IN: session timeout */
233 int lstio_ses_force; /* IN: force create ? */
234 /** IN: session features */
235 unsigned lstio_ses_feats;
236 struct lst_sid __user *lstio_ses_idp; /* OUT: session id */
237 int lstio_ses_nmlen; /* IN: name length */
238 char __user *lstio_ses_namep; /* IN: session name */
241 /* query current session */
242 struct lstio_session_info_args {
243 struct lst_sid __user *lstio_ses_idp; /* OUT: session id */
244 int __user *lstio_ses_keyp; /* OUT: local key */
245 /** OUT: session features */
246 unsigned __user *lstio_ses_featp;
247 struct lstcon_ndlist_ent __user *lstio_ses_ndinfo; /* OUT: */
248 int lstio_ses_nmlen; /* IN: name length */
249 char __user *lstio_ses_namep; /* OUT: session name */
252 /* delete a session */
253 struct lstio_session_end_args {
254 int lstio_ses_key; /* IN: session key */
257 #define LST_OPC_SESSION 1
258 #define LST_OPC_GROUP 2
259 #define LST_OPC_NODES 3
260 #define LST_OPC_BATCHCLI 4
261 #define LST_OPC_BATCHSRV 5
263 struct lstio_debug_args {
264 int lstio_dbg_key; /* IN: session key */
265 int lstio_dbg_type; /* IN: debug sessin|batch|group|nodes list */
266 int lstio_dbg_flags; /* IN: reserved debug flags */
267 int lstio_dbg_timeout; /* IN: timeout of debug */
269 int lstio_dbg_nmlen; /* IN: len of name */
270 char __user *lstio_dbg_namep; /* IN: name of group|batch */
271 int lstio_dbg_count; /* IN: # of test nodes to debug */
272 struct lnet_process_id __user *lstio_dbg_idsp; /* IN: id of test nodes */
273 /* OUT: list head of result buffer */
274 struct list_head __user *lstio_dbg_resultp;
277 struct lstio_group_add_args {
278 int lstio_grp_key; /* IN: session key */
279 int lstio_grp_nmlen; /* IN: name length */
280 char __user *lstio_grp_namep; /* IN: group name */
283 struct lstio_group_del_args {
284 int lstio_grp_key; /* IN: session key */
285 int lstio_grp_nmlen; /* IN: name length */
286 char __user *lstio_grp_namep; /* IN: group name */
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 */
293 struct lstio_group_update_args {
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 __user *lstio_grp_namep; /* IN: group name */
299 int lstio_grp_count; /* IN: # of nodes id */
300 struct lnet_process_id __user *lstio_grp_idsp; /* IN: array of nodes */
301 /* OUT: list head of result buffer */
302 struct list_head __user *lstio_grp_resultp;
305 struct lstio_group_nodes_args {
306 int lstio_grp_key; /* IN: session key */
307 int lstio_grp_nmlen; /* IN: name length */
308 char __user *lstio_grp_namep; /* IN: group name */
309 int lstio_grp_count; /* IN: # of nodes */
310 /** OUT: session features */
311 unsigned __user *lstio_grp_featp;
312 struct lnet_process_id __user *lstio_grp_idsp; /* IN: nodes */
313 /* OUT: list head of result buffer */
314 struct list_head __user *lstio_grp_resultp;
317 struct lstio_group_list_args {
318 int lstio_grp_key; /* IN: session key */
319 int lstio_grp_idx; /* IN: group idx */
320 int lstio_grp_nmlen; /* IN: name len */
321 char __user *lstio_grp_namep; /* OUT: name */
324 struct lstio_group_info_args {
325 int lstio_grp_key; /* IN: session key */
326 int lstio_grp_nmlen; /* IN: name len */
327 char __user *lstio_grp_namep; /* IN: name */
328 struct lstcon_ndlist_ent __user *lstio_grp_entp;/* OUT: description of group */
330 int __user *lstio_grp_idxp; /* IN/OUT: node index */
331 int __user *lstio_grp_ndentp; /* IN/OUT: # of nodent */
332 struct lstcon_node_ent __user *lstio_grp_dentsp;/* OUT: nodent array */
335 #define LST_DEFAULT_BATCH "batch" /* default batch name */
337 struct lstio_batch_add_args {
338 int lstio_bat_key; /* IN: session key */
339 int lstio_bat_nmlen; /* IN: name length */
340 char __user *lstio_bat_namep; /* IN: batch name */
343 struct lstio_batch_del_args {
344 int lstio_bat_key; /* IN: session key */
345 int lstio_bat_nmlen; /* IN: name length */
346 char __user *lstio_bat_namep; /* IN: batch name */
349 struct lstio_batch_run_args {
350 /* IN: session key */
352 /* IN: timeout for the batch */
353 int lstio_bat_timeout;
354 /* IN: name length */
357 char __user *lstio_bat_namep;
358 /* OUT: list head of result buffer */
359 struct list_head __user *lstio_bat_resultp;
362 struct lstio_batch_stop_args {
363 /* IN: session key */
365 /* IN: abort unfinished test RPC */
367 /* IN: name length */
370 char __user *lstio_bat_namep;
371 /* OUT: list head of result buffer */
372 struct list_head __user *lstio_bat_resultp;
375 struct lstio_batch_query_args {
376 /* IN: session key */
379 int lstio_bat_testidx;
380 /* IN: is test client? */
381 int lstio_bat_client;
382 /* IN: timeout for waiting */
383 int lstio_bat_timeout;
384 /* IN: name length */
387 char __user *lstio_bat_namep;
388 /* OUT: list head of result buffer */
389 struct list_head __user *lstio_bat_resultp;
392 struct lstio_batch_list_args {
393 int lstio_bat_key; /* IN: session key */
394 int lstio_bat_idx; /* IN: index */
395 int lstio_bat_nmlen; /* IN: name length */
396 char __user *lstio_bat_namep; /* IN: batch name */
399 struct lstio_batch_info_args {
400 int lstio_bat_key; /* IN: session key */
401 int lstio_bat_nmlen; /* IN: name length */
402 char __user *lstio_bat_namep; /* IN: name */
403 int lstio_bat_server; /* IN: query server or not */
404 int lstio_bat_testidx; /* IN: test index */
405 struct lstcon_test_batch_ent __user *lstio_bat_entp;/* OUT: batch ent */
407 int __user *lstio_bat_idxp; /* IN/OUT: index of node */
408 int __user *lstio_bat_ndentp; /* IN/OUT: # of nodent */
409 struct lstcon_node_ent __user *lstio_bat_dentsp;/* array of nodent */
412 /* add stat in session */
413 struct lstio_stat_args {
414 /* IN: session key */
416 /* IN: timeout for stat requst */
417 int lstio_sta_timeout;
418 /* IN: group name length */
421 char __user *lstio_sta_namep;
425 struct lnet_process_id __user *lstio_sta_idsp;
426 /* OUT: list head of result buffer */
427 struct list_head __user *lstio_sta_resultp;
435 /* create a test in a batch */
436 #define LST_MAX_CONCUR 1024 /* Max concurrency of test */
438 struct lstio_test_args {
439 int lstio_tes_key; /* IN: session key */
440 int lstio_tes_bat_nmlen; /* IN: batch name len */
441 char __user *lstio_tes_bat_name; /* IN: batch name */
442 int lstio_tes_type; /* IN: test type */
443 int lstio_tes_oneside; /* IN: one sided test */
444 int lstio_tes_loop; /* IN: loop count */
445 int lstio_tes_concur; /* IN: concurrency */
447 int lstio_tes_dist; /* IN: node distribution in destination groups */
448 int lstio_tes_span; /* IN: node span in destination groups */
449 int lstio_tes_sgrp_nmlen; /* IN: source group name length */
450 char __user *lstio_tes_sgrp_name; /* IN: group name */
451 int lstio_tes_dgrp_nmlen; /* IN: destination group name length */
452 char __user *lstio_tes_dgrp_name; /* IN: group name */
454 /* IN: param buffer len */
455 int lstio_tes_param_len;
456 /* IN: parameter for specified test:
460 void __user *lstio_tes_param;
461 /* OUT: private returned value */
462 int __user *lstio_tes_retp;
463 /* OUT: list head of result buffer */
464 struct list_head __user *lstio_tes_resultp;
473 LST_BRW_CHECK_NONE = 1,
474 LST_BRW_CHECK_SIMPLE = 2,
475 LST_BRW_CHECK_FULL = 3
478 struct lst_test_bulk_param {
479 int blk_opc; /* bulk operation code */
480 int blk_size; /* size (bytes) */
481 int blk_time; /* time of running the test*/
482 int blk_flags; /* reserved flags */
483 int blk_cli_off; /* bulk offset on client */
484 int blk_srv_off; /* reserved: bulk offset on server */
487 struct lst_test_ping_param {
488 int png_size; /* size of ping message */
489 int png_time; /* time */
490 int png_loop; /* loop */
491 int png_flags; /* reserved flags */
494 struct srpc_counters {
504 struct sfw_counters {
505 /** milliseconds since current session started */
507 __u32 active_batches;
508 __u32 zombie_sessions;