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 #include <linux/types.h>
39 #include <linux/lnet/lnet-types.h>
40 #include <linux/time.h>
42 #define LST_FEAT_NONE (0)
43 #define LST_FEAT_BULK_LEN (1 << 0) /* enable variable page size */
45 #define LST_FEATS_EMPTY (LST_FEAT_NONE)
46 #define LST_FEATS_MASK (LST_FEAT_NONE | LST_FEAT_BULK_LEN)
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 * sparse kernel source annotations
78 lnet_nid_t ses_nid; /* nid of console node */
79 __s64 ses_stamp; /* time stamp in milliseconds */
82 extern struct lst_sid LST_INVALID_SID;
85 __u64 bat_id; /* unique id in session */
88 /* Status of test node */
89 #define LST_NODE_ACTIVE 0x1 /* node in this session */
90 #define LST_NODE_BUSY 0x2 /* node is taken by other session */
91 #define LST_NODE_DOWN 0x4 /* node is down */
92 #define LST_NODE_UNKNOWN 0x8 /* node not in session */
94 struct lstcon_node_ent {
95 struct lnet_process_id nde_id; /* id of node */
96 int nde_state; /* state of node */
97 }; /*** node entry, for list_group command */
99 struct lstcon_ndlist_ent {
100 int nle_nnode; /* # of nodes */
101 int nle_nactive; /* # of active nodes */
102 int nle_nbusy; /* # of busy nodes */
103 int nle_ndown; /* # of down nodes */
104 int nle_nunknown; /* # of unknown nodes */
105 }; /*** node_list entry, for list_batch command */
107 struct lstcon_test_ent {
108 int tse_type; /* test type */
109 int tse_loop; /* loop count */
110 int tse_concur; /* concurrency of test */
111 }; /*** test summary entry, for list_batch command */
113 struct lstcon_batch_ent {
114 int bae_state; /* batch status */
115 int bae_timeout; /* batch timeout */
116 int bae_ntest; /* # of tests in the batch */
117 }; /*** batch summary entry, for list_batch command */
119 struct lstcon_test_batch_ent {
120 struct lstcon_ndlist_ent tbe_cli_nle; /* client (group) node_list entry */
121 struct lstcon_ndlist_ent tbe_srv_nle; /* server (group) node_list entry */
123 struct lstcon_test_ent tbe_test; /* test entry */
124 struct lstcon_batch_ent tbe_batch; /* batch entry */
126 }; /*** test/batch verbose information entry,
127 *** for list_batch command */
129 /* This will go away once we move to netlink */
130 #if !defined(__KERNEL__) && !defined(__LIBCFS_UTIL_LIST_H__)
132 struct list_head *next, *prev;
136 struct lstcon_rpc_ent {
137 struct list_head rpe_link; /* link chain */
138 struct lnet_process_id rpe_peer; /* peer's id */
139 struct timeval rpe_stamp; /* time stamp of RPC */
140 int rpe_state; /* peer's state */
141 int rpe_rpc_errno; /* RPC errno */
143 struct lst_sid rpe_sid; /* peer's session id */
144 int rpe_fwk_errno; /* framework errno */
145 int rpe_priv[4]; /* private data */
146 char rpe_payload[0]; /* private reply payload */
149 struct lstcon_trans_stat {
150 int trs_rpc_stat[4]; /* RPCs stat (0: total, 1: failed, 2: finished, 4: reserved */
151 int trs_rpc_errno; /* RPC errno */
152 int trs_fwk_stat[8]; /* framework stat */
153 int trs_fwk_errno; /* errno of the first remote error */
154 void *trs_fwk_private; /* private framework stat */
158 lstcon_rpc_stat_total(struct lstcon_trans_stat *stat, int inc)
160 return inc ? ++stat->trs_rpc_stat[0] : stat->trs_rpc_stat[0];
164 lstcon_rpc_stat_success(struct lstcon_trans_stat *stat, int inc)
166 return inc ? ++stat->trs_rpc_stat[1] : stat->trs_rpc_stat[1];
170 lstcon_rpc_stat_failure(struct lstcon_trans_stat *stat, int inc)
172 return inc ? ++stat->trs_rpc_stat[2] : stat->trs_rpc_stat[2];
176 lstcon_sesop_stat_success(struct lstcon_trans_stat *stat, int inc)
178 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
182 lstcon_sesop_stat_failure(struct lstcon_trans_stat *stat, int inc)
184 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
188 lstcon_sesqry_stat_active(struct lstcon_trans_stat *stat, int inc)
190 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
194 lstcon_sesqry_stat_busy(struct lstcon_trans_stat *stat, int inc)
196 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
200 lstcon_sesqry_stat_unknown(struct lstcon_trans_stat *stat, int inc)
202 return inc ? ++stat->trs_fwk_stat[2] : stat->trs_fwk_stat[2];
206 lstcon_tsbop_stat_success(struct lstcon_trans_stat *stat, int inc)
208 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
212 lstcon_tsbop_stat_failure(struct lstcon_trans_stat *stat, int inc)
214 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
218 lstcon_tsbqry_stat_idle(struct lstcon_trans_stat *stat, int inc)
220 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
224 lstcon_tsbqry_stat_run(struct lstcon_trans_stat *stat, int inc)
226 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
230 lstcon_tsbqry_stat_failure(struct lstcon_trans_stat *stat, int inc)
232 return inc ? ++stat->trs_fwk_stat[2] : stat->trs_fwk_stat[2];
236 lstcon_statqry_stat_success(struct lstcon_trans_stat *stat, int inc)
238 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
242 lstcon_statqry_stat_failure(struct lstcon_trans_stat *stat, int inc)
244 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
247 /* create a session */
248 struct lstio_session_new_args {
249 int lstio_ses_key; /* IN: local key */
250 int lstio_ses_timeout; /* IN: session timeout */
251 int lstio_ses_force; /* IN: force create ? */
252 /** IN: session features */
253 unsigned lstio_ses_feats;
254 struct lst_sid __user *lstio_ses_idp; /* OUT: session id */
255 int lstio_ses_nmlen; /* IN: name length */
256 char __user *lstio_ses_namep; /* IN: session name */
259 /* query current session */
260 struct lstio_session_info_args {
261 struct lst_sid __user *lstio_ses_idp; /* OUT: session id */
262 int __user *lstio_ses_keyp; /* OUT: local key */
263 /** OUT: session features */
264 unsigned __user *lstio_ses_featp;
265 struct lstcon_ndlist_ent __user *lstio_ses_ndinfo; /* OUT: */
266 int lstio_ses_nmlen; /* IN: name length */
267 char __user *lstio_ses_namep; /* OUT: session name */
270 /* delete a session */
271 struct lstio_session_end_args {
272 int lstio_ses_key; /* IN: session key */
275 #define LST_OPC_SESSION 1
276 #define LST_OPC_GROUP 2
277 #define LST_OPC_NODES 3
278 #define LST_OPC_BATCHCLI 4
279 #define LST_OPC_BATCHSRV 5
281 struct lstio_debug_args {
282 int lstio_dbg_key; /* IN: session key */
283 int lstio_dbg_type; /* IN: debug sessin|batch|group|nodes list */
284 int lstio_dbg_flags; /* IN: reserved debug flags */
285 int lstio_dbg_timeout; /* IN: timeout of debug */
287 int lstio_dbg_nmlen; /* IN: len of name */
288 char __user *lstio_dbg_namep; /* IN: name of group|batch */
289 int lstio_dbg_count; /* IN: # of test nodes to debug */
290 struct lnet_process_id __user *lstio_dbg_idsp; /* IN: id of test nodes */
291 /* OUT: list head of result buffer */
292 struct list_head __user *lstio_dbg_resultp;
295 struct lstio_group_add_args {
296 int lstio_grp_key; /* IN: session key */
297 int lstio_grp_nmlen; /* IN: name length */
298 char __user *lstio_grp_namep; /* IN: group name */
301 struct lstio_group_del_args {
302 int lstio_grp_key; /* IN: session key */
303 int lstio_grp_nmlen; /* IN: name length */
304 char __user *lstio_grp_namep; /* IN: group name */
307 #define LST_GROUP_CLEAN 1 /* remove inactive nodes in the group */
308 #define LST_GROUP_REFRESH 2 /* refresh inactive nodes in the group */
309 #define LST_GROUP_RMND 3 /* delete nodes from the group */
311 struct lstio_group_update_args {
312 int lstio_grp_key; /* IN: session key */
313 int lstio_grp_opc; /* IN: OPC */
314 int lstio_grp_args; /* IN: arguments */
315 int lstio_grp_nmlen; /* IN: name length */
316 char __user *lstio_grp_namep; /* IN: group name */
317 int lstio_grp_count; /* IN: # of nodes id */
318 struct lnet_process_id __user *lstio_grp_idsp; /* IN: array of nodes */
319 /* OUT: list head of result buffer */
320 struct list_head __user *lstio_grp_resultp;
323 struct lstio_group_nodes_args {
324 int lstio_grp_key; /* IN: session key */
325 int lstio_grp_nmlen; /* IN: name length */
326 char __user *lstio_grp_namep; /* IN: group name */
327 int lstio_grp_count; /* IN: # of nodes */
328 /** OUT: session features */
329 unsigned __user *lstio_grp_featp;
330 struct lnet_process_id __user *lstio_grp_idsp; /* IN: nodes */
331 /* OUT: list head of result buffer */
332 struct list_head __user *lstio_grp_resultp;
335 struct lstio_group_list_args {
336 int lstio_grp_key; /* IN: session key */
337 int lstio_grp_idx; /* IN: group idx */
338 int lstio_grp_nmlen; /* IN: name len */
339 char __user *lstio_grp_namep; /* OUT: name */
342 struct lstio_group_info_args {
343 int lstio_grp_key; /* IN: session key */
344 int lstio_grp_nmlen; /* IN: name len */
345 char __user *lstio_grp_namep; /* IN: name */
346 struct lstcon_ndlist_ent __user *lstio_grp_entp;/* OUT: description of group */
348 int __user *lstio_grp_idxp; /* IN/OUT: node index */
349 int __user *lstio_grp_ndentp; /* IN/OUT: # of nodent */
350 struct lstcon_node_ent __user *lstio_grp_dentsp;/* OUT: nodent array */
353 #define LST_DEFAULT_BATCH "batch" /* default batch name */
355 struct lstio_batch_add_args {
356 int lstio_bat_key; /* IN: session key */
357 int lstio_bat_nmlen; /* IN: name length */
358 char __user *lstio_bat_namep; /* IN: batch name */
361 struct lstio_batch_del_args {
362 int lstio_bat_key; /* IN: session key */
363 int lstio_bat_nmlen; /* IN: name length */
364 char __user *lstio_bat_namep; /* IN: batch name */
367 struct lstio_batch_run_args {
368 /* IN: session key */
370 /* IN: timeout for the batch */
371 int lstio_bat_timeout;
372 /* IN: name length */
375 char __user *lstio_bat_namep;
376 /* OUT: list head of result buffer */
377 struct list_head __user *lstio_bat_resultp;
380 struct lstio_batch_stop_args {
381 /* IN: session key */
383 /* IN: abort unfinished test RPC */
385 /* IN: name length */
388 char __user *lstio_bat_namep;
389 /* OUT: list head of result buffer */
390 struct list_head __user *lstio_bat_resultp;
393 struct lstio_batch_query_args {
394 /* IN: session key */
397 int lstio_bat_testidx;
398 /* IN: is test client? */
399 int lstio_bat_client;
400 /* IN: timeout for waiting */
401 int lstio_bat_timeout;
402 /* IN: name length */
405 char __user *lstio_bat_namep;
406 /* OUT: list head of result buffer */
407 struct list_head __user *lstio_bat_resultp;
410 struct lstio_batch_list_args {
411 int lstio_bat_key; /* IN: session key */
412 int lstio_bat_idx; /* IN: index */
413 int lstio_bat_nmlen; /* IN: name length */
414 char __user *lstio_bat_namep; /* IN: batch name */
417 struct lstio_batch_info_args {
418 int lstio_bat_key; /* IN: session key */
419 int lstio_bat_nmlen; /* IN: name length */
420 char __user *lstio_bat_namep; /* IN: name */
421 int lstio_bat_server; /* IN: query server or not */
422 int lstio_bat_testidx; /* IN: test index */
423 struct lstcon_test_batch_ent __user *lstio_bat_entp;/* OUT: batch ent */
425 int __user *lstio_bat_idxp; /* IN/OUT: index of node */
426 int __user *lstio_bat_ndentp; /* IN/OUT: # of nodent */
427 struct lstcon_node_ent __user *lstio_bat_dentsp;/* array of nodent */
430 /* add stat in session */
431 struct lstio_stat_args {
432 /* IN: session key */
434 /* IN: timeout for stat requst */
435 int lstio_sta_timeout;
436 /* IN: group name length */
439 char __user *lstio_sta_namep;
443 struct lnet_process_id __user *lstio_sta_idsp;
444 /* OUT: list head of result buffer */
445 struct list_head __user *lstio_sta_resultp;
453 /* create a test in a batch */
454 #define LST_MAX_CONCUR 1024 /* Max concurrency of test */
456 struct lstio_test_args {
457 int lstio_tes_key; /* IN: session key */
458 int lstio_tes_bat_nmlen; /* IN: batch name len */
459 char __user *lstio_tes_bat_name; /* IN: batch name */
460 int lstio_tes_type; /* IN: test type */
461 int lstio_tes_oneside; /* IN: one sided test */
462 int lstio_tes_loop; /* IN: loop count */
463 int lstio_tes_concur; /* IN: concurrency */
465 int lstio_tes_dist; /* IN: node distribution in destination groups */
466 int lstio_tes_span; /* IN: node span in destination groups */
467 int lstio_tes_sgrp_nmlen; /* IN: source group name length */
468 char __user *lstio_tes_sgrp_name; /* IN: group name */
469 int lstio_tes_dgrp_nmlen; /* IN: destination group name length */
470 char __user *lstio_tes_dgrp_name; /* IN: group name */
472 /* IN: param buffer len */
473 int lstio_tes_param_len;
474 /* IN: parameter for specified test:
478 void __user *lstio_tes_param;
479 /* OUT: private returned value */
480 int __user *lstio_tes_retp;
481 /* OUT: list head of result buffer */
482 struct list_head __user *lstio_tes_resultp;
491 LST_BRW_CHECK_NONE = 1,
492 LST_BRW_CHECK_SIMPLE = 2,
493 LST_BRW_CHECK_FULL = 3
496 struct lst_test_bulk_param {
497 int blk_opc; /* bulk operation code */
498 int blk_size; /* size (bytes) */
499 int blk_time; /* time of running the test*/
500 int blk_flags; /* reserved flags */
501 int blk_cli_off; /* bulk offset on client */
502 int blk_srv_off; /* reserved: bulk offset on server */
505 struct lst_test_ping_param {
506 int png_size; /* size of ping message */
507 int png_time; /* time */
508 int png_loop; /* loop */
509 int png_flags; /* reserved flags */
512 struct srpc_counters {
522 struct sfw_counters {
523 /** milliseconds since current session started */
525 __u32 active_batches;
526 __u32 zombie_sessions;