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/
31 * Author: Liang Zhen <liangzhen@clusterfs.com>
34 #ifndef __UAPI_LNET_ST_H__
35 #define __UAPI_LNET_ST_H__
37 #include <linux/types.h>
38 #include <linux/lnet/lnet-types.h>
39 #include <linux/time.h>
41 #define LST_FEAT_NONE (0)
42 #define LST_FEAT_BULK_LEN (1 << 0) /* enable variable page size */
44 #define LST_FEATS_EMPTY (LST_FEAT_NONE)
45 #define LST_FEATS_MASK (LST_FEAT_NONE | LST_FEAT_BULK_LEN)
47 #define LST_NAME_SIZE 32 /* max name buffer length */
49 #define LSTIO_DEBUG 0xC00 /* debug */
50 #define LSTIO_SESSION_NEW 0xC01 /* create session */
51 #define LSTIO_SESSION_END 0xC02 /* end session */
52 #define LSTIO_SESSION_INFO 0xC03 /* query session */
53 #define LSTIO_GROUP_ADD 0xC10 /* add group */
54 #define LSTIO_GROUP_LIST 0xC11 /* list all groups in session */
55 #define LSTIO_GROUP_INFO 0xC12 /* query defailt infomation of specified group */
56 #define LSTIO_GROUP_DEL 0xC13 /* delete group */
57 #define LSTIO_NODES_ADD 0xC14 /* add nodes to specified group */
58 #define LSTIO_GROUP_UPDATE 0xC15 /* update group */
59 #define LSTIO_BATCH_ADD 0xC20 /* add batch */
60 #define LSTIO_BATCH_START 0xC21 /* start batch */
61 #define LSTIO_BATCH_STOP 0xC22 /* stop batch */
62 #define LSTIO_BATCH_DEL 0xC23 /* delete batch */
63 #define LSTIO_BATCH_LIST 0xC24 /* show all batches in the session */
64 #define LSTIO_BATCH_INFO 0xC25 /* show defail of specified batch */
65 #define LSTIO_TEST_ADD 0xC26 /* add test (to batch) */
66 #define LSTIO_BATCH_QUERY 0xC27 /* query batch status */
67 #define LSTIO_STAT_QUERY 0xC30 /* get stats */
70 * sparse kernel source annotations
77 lnet_nid_t ses_nid; /* nid of console node */
78 __s64 ses_stamp; /* time stamp in milliseconds */
81 extern struct lst_sid LST_INVALID_SID;
84 __u64 bat_id; /* unique id in session */
87 /* Status of test node */
88 #define LST_NODE_ACTIVE 0x1 /* node in this session */
89 #define LST_NODE_BUSY 0x2 /* node is taken by other session */
90 #define LST_NODE_DOWN 0x4 /* node is down */
91 #define LST_NODE_UNKNOWN 0x8 /* node not in session */
93 struct lstcon_node_ent {
94 struct lnet_process_id nde_id; /* id of node */
95 int nde_state; /* state of node */
96 }; /*** node entry, for list_group command */
98 struct lstcon_ndlist_ent {
99 int nle_nnode; /* # of nodes */
100 int nle_nactive; /* # of active nodes */
101 int nle_nbusy; /* # of busy nodes */
102 int nle_ndown; /* # of down nodes */
103 int nle_nunknown; /* # of unknown nodes */
104 }; /*** node_list entry, for list_batch command */
106 struct lstcon_test_ent {
107 int tse_type; /* test type */
108 int tse_loop; /* loop count */
109 int tse_concur; /* concurrency of test */
110 }; /*** test summary entry, for list_batch command */
112 struct lstcon_batch_ent {
113 int bae_state; /* batch status */
114 int bae_timeout; /* batch timeout */
115 int bae_ntest; /* # of tests in the batch */
116 }; /*** batch summary entry, for list_batch command */
118 struct lstcon_test_batch_ent {
119 struct lstcon_ndlist_ent tbe_cli_nle; /* client (group) node_list entry */
120 struct lstcon_ndlist_ent tbe_srv_nle; /* server (group) node_list entry */
122 struct lstcon_test_ent tbe_test; /* test entry */
123 struct lstcon_batch_ent tbe_batch; /* batch entry */
125 }; /*** test/batch verbose information entry,
126 *** for list_batch command */
128 /* This will go away once we move to netlink */
129 #if !defined(__KERNEL__) && !defined(__LIBCFS_UTIL_LIST_H__)
131 struct list_head *next, *prev;
135 struct lstcon_rpc_ent {
136 struct list_head rpe_link; /* link chain */
137 struct lnet_process_id rpe_peer; /* peer's id */
138 /* This has not been used since Lustre 2.2 so its safe to use.
139 * Update to allow future use of timespec64
144 } rpe_stamp; /* time stamp of RPC */
145 int rpe_state; /* peer's state */
146 int rpe_rpc_errno; /* RPC errno */
148 struct lst_sid rpe_sid; /* peer's session id */
149 int rpe_fwk_errno; /* framework errno */
150 int rpe_priv[4]; /* private data */
151 char rpe_payload[0]; /* private reply payload */
154 struct lstcon_trans_stat {
155 int trs_rpc_stat[4]; /* RPCs stat (0: total, 1: failed, 2: finished, 4: reserved */
156 int trs_rpc_errno; /* RPC errno */
157 int trs_fwk_stat[8]; /* framework stat */
158 int trs_fwk_errno; /* errno of the first remote error */
159 void *trs_fwk_private; /* private framework stat */
163 lstcon_rpc_stat_total(struct lstcon_trans_stat *stat, int inc)
165 return inc ? ++stat->trs_rpc_stat[0] : stat->trs_rpc_stat[0];
169 lstcon_rpc_stat_success(struct lstcon_trans_stat *stat, int inc)
171 return inc ? ++stat->trs_rpc_stat[1] : stat->trs_rpc_stat[1];
175 lstcon_rpc_stat_failure(struct lstcon_trans_stat *stat, int inc)
177 return inc ? ++stat->trs_rpc_stat[2] : stat->trs_rpc_stat[2];
181 lstcon_sesop_stat_success(struct lstcon_trans_stat *stat, int inc)
183 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
187 lstcon_sesop_stat_failure(struct lstcon_trans_stat *stat, int inc)
189 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
193 lstcon_sesqry_stat_active(struct lstcon_trans_stat *stat, int inc)
195 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
199 lstcon_sesqry_stat_busy(struct lstcon_trans_stat *stat, int inc)
201 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
205 lstcon_sesqry_stat_unknown(struct lstcon_trans_stat *stat, int inc)
207 return inc ? ++stat->trs_fwk_stat[2] : stat->trs_fwk_stat[2];
211 lstcon_tsbop_stat_success(struct lstcon_trans_stat *stat, int inc)
213 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
217 lstcon_tsbop_stat_failure(struct lstcon_trans_stat *stat, int inc)
219 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
223 lstcon_tsbqry_stat_idle(struct lstcon_trans_stat *stat, int inc)
225 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
229 lstcon_tsbqry_stat_run(struct lstcon_trans_stat *stat, int inc)
231 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
235 lstcon_tsbqry_stat_failure(struct lstcon_trans_stat *stat, int inc)
237 return inc ? ++stat->trs_fwk_stat[2] : stat->trs_fwk_stat[2];
241 lstcon_statqry_stat_success(struct lstcon_trans_stat *stat, int inc)
243 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
247 lstcon_statqry_stat_failure(struct lstcon_trans_stat *stat, int inc)
249 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
252 /* create a session */
253 struct lstio_session_new_args {
254 int lstio_ses_key; /* IN: local key */
255 int lstio_ses_timeout; /* IN: session timeout */
256 int lstio_ses_force; /* IN: force create ? */
257 /** IN: session features */
258 unsigned lstio_ses_feats;
259 struct lst_sid __user *lstio_ses_idp; /* OUT: session id */
260 int lstio_ses_nmlen; /* IN: name length */
261 char __user *lstio_ses_namep; /* IN: session name */
264 /* query current session */
265 struct lstio_session_info_args {
266 struct lst_sid __user *lstio_ses_idp; /* OUT: session id */
267 int __user *lstio_ses_keyp; /* OUT: local key */
268 /** OUT: session features */
269 unsigned __user *lstio_ses_featp;
270 struct lstcon_ndlist_ent __user *lstio_ses_ndinfo; /* OUT: */
271 int lstio_ses_nmlen; /* IN: name length */
272 char __user *lstio_ses_namep; /* OUT: session name */
275 /* delete a session */
276 struct lstio_session_end_args {
277 int lstio_ses_key; /* IN: session key */
280 #define LST_OPC_SESSION 1
281 #define LST_OPC_GROUP 2
282 #define LST_OPC_NODES 3
283 #define LST_OPC_BATCHCLI 4
284 #define LST_OPC_BATCHSRV 5
286 struct lstio_debug_args {
287 int lstio_dbg_key; /* IN: session key */
288 int lstio_dbg_type; /* IN: debug sessin|batch|group|nodes list */
289 int lstio_dbg_flags; /* IN: reserved debug flags */
290 int lstio_dbg_timeout; /* IN: timeout of debug */
292 int lstio_dbg_nmlen; /* IN: len of name */
293 char __user *lstio_dbg_namep; /* IN: name of group|batch */
294 int lstio_dbg_count; /* IN: # of test nodes to debug */
295 struct lnet_process_id __user *lstio_dbg_idsp; /* IN: id of test nodes */
296 /* OUT: list head of result buffer */
297 struct list_head __user *lstio_dbg_resultp;
300 struct lstio_group_add_args {
301 int lstio_grp_key; /* IN: session key */
302 int lstio_grp_nmlen; /* IN: name length */
303 char __user *lstio_grp_namep; /* IN: group name */
306 struct lstio_group_del_args {
307 int lstio_grp_key; /* IN: session key */
308 int lstio_grp_nmlen; /* IN: name length */
309 char __user *lstio_grp_namep; /* IN: group name */
312 #define LST_GROUP_CLEAN 1 /* remove inactive nodes in the group */
313 #define LST_GROUP_REFRESH 2 /* refresh inactive nodes in the group */
314 #define LST_GROUP_RMND 3 /* delete nodes from the group */
316 struct lstio_group_update_args {
317 int lstio_grp_key; /* IN: session key */
318 int lstio_grp_opc; /* IN: OPC */
319 int lstio_grp_args; /* IN: arguments */
320 int lstio_grp_nmlen; /* IN: name length */
321 char __user *lstio_grp_namep; /* IN: group name */
322 int lstio_grp_count; /* IN: # of nodes id */
323 struct lnet_process_id __user *lstio_grp_idsp; /* IN: array of nodes */
324 /* OUT: list head of result buffer */
325 struct list_head __user *lstio_grp_resultp;
328 struct lstio_group_nodes_args {
329 int lstio_grp_key; /* IN: session key */
330 int lstio_grp_nmlen; /* IN: name length */
331 char __user *lstio_grp_namep; /* IN: group name */
332 int lstio_grp_count; /* IN: # of nodes */
333 /** OUT: session features */
334 unsigned __user *lstio_grp_featp;
335 struct lnet_process_id __user *lstio_grp_idsp; /* IN: nodes */
336 /* OUT: list head of result buffer */
337 struct list_head __user *lstio_grp_resultp;
340 struct lstio_group_list_args {
341 int lstio_grp_key; /* IN: session key */
342 int lstio_grp_idx; /* IN: group idx */
343 int lstio_grp_nmlen; /* IN: name len */
344 char __user *lstio_grp_namep; /* OUT: name */
347 struct lstio_group_info_args {
348 int lstio_grp_key; /* IN: session key */
349 int lstio_grp_nmlen; /* IN: name len */
350 char __user *lstio_grp_namep; /* IN: name */
351 struct lstcon_ndlist_ent __user *lstio_grp_entp;/* OUT: description of group */
353 int __user *lstio_grp_idxp; /* IN/OUT: node index */
354 int __user *lstio_grp_ndentp; /* IN/OUT: # of nodent */
355 struct lstcon_node_ent __user *lstio_grp_dentsp;/* OUT: nodent array */
358 #define LST_DEFAULT_BATCH "batch" /* default batch name */
360 struct lstio_batch_add_args {
361 int lstio_bat_key; /* IN: session key */
362 int lstio_bat_nmlen; /* IN: name length */
363 char __user *lstio_bat_namep; /* IN: batch name */
366 struct lstio_batch_del_args {
367 int lstio_bat_key; /* IN: session key */
368 int lstio_bat_nmlen; /* IN: name length */
369 char __user *lstio_bat_namep; /* IN: batch name */
372 struct lstio_batch_run_args {
373 /* IN: session key */
375 /* IN: timeout for the batch */
376 int lstio_bat_timeout;
377 /* IN: name length */
380 char __user *lstio_bat_namep;
381 /* OUT: list head of result buffer */
382 struct list_head __user *lstio_bat_resultp;
385 struct lstio_batch_stop_args {
386 /* IN: session key */
388 /* IN: abort unfinished test RPC */
390 /* IN: name length */
393 char __user *lstio_bat_namep;
394 /* OUT: list head of result buffer */
395 struct list_head __user *lstio_bat_resultp;
398 struct lstio_batch_query_args {
399 /* IN: session key */
402 int lstio_bat_testidx;
403 /* IN: is test client? */
404 int lstio_bat_client;
405 /* IN: timeout for waiting */
406 int lstio_bat_timeout;
407 /* IN: name length */
410 char __user *lstio_bat_namep;
411 /* OUT: list head of result buffer */
412 struct list_head __user *lstio_bat_resultp;
415 struct lstio_batch_list_args {
416 int lstio_bat_key; /* IN: session key */
417 int lstio_bat_idx; /* IN: index */
418 int lstio_bat_nmlen; /* IN: name length */
419 char __user *lstio_bat_namep; /* IN: batch name */
422 struct lstio_batch_info_args {
423 int lstio_bat_key; /* IN: session key */
424 int lstio_bat_nmlen; /* IN: name length */
425 char __user *lstio_bat_namep; /* IN: name */
426 int lstio_bat_server; /* IN: query server or not */
427 int lstio_bat_testidx; /* IN: test index */
428 struct lstcon_test_batch_ent __user *lstio_bat_entp;/* OUT: batch ent */
430 int __user *lstio_bat_idxp; /* IN/OUT: index of node */
431 int __user *lstio_bat_ndentp; /* IN/OUT: # of nodent */
432 struct lstcon_node_ent __user *lstio_bat_dentsp;/* array of nodent */
435 /* add stat in session */
436 struct lstio_stat_args {
437 /* IN: session key */
439 /* IN: timeout for stat requst */
440 int lstio_sta_timeout;
441 /* IN: group name length */
444 char __user *lstio_sta_namep;
448 struct lnet_process_id __user *lstio_sta_idsp;
449 /* OUT: list head of result buffer */
450 struct list_head __user *lstio_sta_resultp;
458 /* create a test in a batch */
459 #define LST_MAX_CONCUR 1024 /* Max concurrency of test */
461 struct lstio_test_args {
462 int lstio_tes_key; /* IN: session key */
463 int lstio_tes_bat_nmlen; /* IN: batch name len */
464 char __user *lstio_tes_bat_name; /* IN: batch name */
465 int lstio_tes_type; /* IN: test type */
466 int lstio_tes_oneside; /* IN: one sided test */
467 int lstio_tes_loop; /* IN: loop count */
468 int lstio_tes_concur; /* IN: concurrency */
470 int lstio_tes_dist; /* IN: node distribution in destination groups */
471 int lstio_tes_span; /* IN: node span in destination groups */
472 int lstio_tes_sgrp_nmlen; /* IN: source group name length */
473 char __user *lstio_tes_sgrp_name; /* IN: group name */
474 int lstio_tes_dgrp_nmlen; /* IN: destination group name length */
475 char __user *lstio_tes_dgrp_name; /* IN: group name */
477 /* IN: param buffer len */
478 int lstio_tes_param_len;
479 /* IN: parameter for specified test:
483 void __user *lstio_tes_param;
484 /* OUT: private returned value */
485 int __user *lstio_tes_retp;
486 /* OUT: list head of result buffer */
487 struct list_head __user *lstio_tes_resultp;
496 LST_BRW_CHECK_NONE = 1,
497 LST_BRW_CHECK_SIMPLE = 2,
498 LST_BRW_CHECK_FULL = 3
501 struct lst_test_bulk_param {
502 int blk_opc; /* bulk operation code */
503 int blk_size; /* size (bytes) */
504 int blk_time; /* time of running the test*/
505 int blk_flags; /* reserved flags */
506 int blk_cli_off; /* bulk offset on client */
507 int blk_srv_off; /* reserved: bulk offset on server */
510 struct lst_test_ping_param {
511 int png_size; /* size of ping message */
512 int png_time; /* time */
513 int png_loop; /* loop */
514 int png_flags; /* reserved flags */
517 /* Both struct srpc_counters and struct sfw_counters are sent over the wire */
518 struct srpc_counters {
526 } __attribute__((packed));
528 struct sfw_counters {
529 /** milliseconds since current session started */
531 __u32 active_batches;
532 __u32 zombie_sessions;
535 } __attribute__((packed));