1 // SPDX-License-Identifier: GPL-2.0
3 /* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
4 * Use is subject to license terms.
6 * Copyright (c) 2012, 2016, Intel Corporation.
9 /* This file is part of Lustre, http://www.lustre.org/
11 * Author: Liang Zhen <liangzhen@clusterfs.com>
14 #ifndef __UAPI_LNET_ST_H__
15 #define __UAPI_LNET_ST_H__
17 #include <linux/types.h>
18 #include <linux/lnet/lnet-types.h>
19 #include <linux/time.h>
21 #define LST_FEAT_NONE (0)
22 #define LST_FEAT_BULK_LEN (1 << 0) /* enable variable page size */
24 #define LST_FEATS_EMPTY (LST_FEAT_NONE)
25 #define LST_FEATS_MASK (LST_FEAT_NONE | LST_FEAT_BULK_LEN)
27 #define LST_NAME_SIZE 32 /* max name buffer length */
29 #define LSTIO_DEBUG 0xC00 /* debug */
30 #define LSTIO_SESSION_NEW 0xC01 /* create session */
31 #define LSTIO_SESSION_END 0xC02 /* end session */
32 #define LSTIO_SESSION_INFO 0xC03 /* query session */
33 #define LSTIO_GROUP_ADD 0xC10 /* add group */
34 #define LSTIO_GROUP_LIST 0xC11 /* list all groups in session */
35 #define LSTIO_GROUP_INFO 0xC12 /* query defailt infomation of specified group */
36 #define LSTIO_GROUP_DEL 0xC13 /* delete group */
37 #define LSTIO_NODES_ADD 0xC14 /* add nodes to specified group */
38 #define LSTIO_GROUP_UPDATE 0xC15 /* update group */
39 #define LSTIO_BATCH_ADD 0xC20 /* add batch */
40 #define LSTIO_BATCH_START 0xC21 /* start batch */
41 #define LSTIO_BATCH_STOP 0xC22 /* stop batch */
42 #define LSTIO_BATCH_DEL 0xC23 /* delete batch */
43 #define LSTIO_BATCH_LIST 0xC24 /* show all batches in the session */
44 #define LSTIO_BATCH_INFO 0xC25 /* show defail of specified batch */
45 #define LSTIO_TEST_ADD 0xC26 /* add test (to batch) */
46 #define LSTIO_BATCH_QUERY 0xC27 /* query batch status */
47 #define LSTIO_STAT_QUERY 0xC30 /* get stats */
50 * sparse kernel source annotations
57 lnet_nid_t ses_nid; /* nid of console node */
58 __s64 ses_stamp; /* time stamp in milliseconds */
62 __u64 bat_id; /* unique id in session */
65 /* Status of test node */
66 #define LST_NODE_ACTIVE 0x1 /* node in this session */
67 #define LST_NODE_BUSY 0x2 /* node is taken by other session */
68 #define LST_NODE_DOWN 0x4 /* node is down */
69 #define LST_NODE_UNKNOWN 0x8 /* node not in session */
71 struct lstcon_node_ent {
72 struct lnet_process_id nde_id; /* id of node */
73 int nde_state; /* state of node */
74 }; /*** node entry, for list_group command */
76 struct lstcon_ndlist_ent {
77 int nle_nnode; /* # of nodes */
78 int nle_nactive; /* # of active nodes */
79 int nle_nbusy; /* # of busy nodes */
80 int nle_ndown; /* # of down nodes */
81 int nle_nunknown; /* # of unknown nodes */
82 }; /*** node_list entry, for list_batch command */
84 struct lstcon_test_ent {
85 int tse_type; /* test type */
86 int tse_loop; /* loop count */
87 int tse_concur; /* concurrency of test */
88 }; /*** test summary entry, for list_batch command */
90 struct lstcon_batch_ent {
91 int bae_state; /* batch status */
92 int bae_timeout; /* batch timeout */
93 int bae_ntest; /* # of tests in the batch */
94 }; /*** batch summary entry, for list_batch command */
96 struct lstcon_test_batch_ent {
97 struct lstcon_ndlist_ent tbe_cli_nle; /* client (group) node_list entry */
98 struct lstcon_ndlist_ent tbe_srv_nle; /* server (group) node_list entry */
100 struct lstcon_test_ent tbe_test; /* test entry */
101 struct lstcon_batch_ent tbe_batch; /* batch entry */
103 }; /*** test/batch verbose information entry,
104 *** for list_batch command */
106 /* This will go away once we move to netlink */
107 #if !defined(__KERNEL__) && !defined(__LIBCFS_UTIL_LIST_H__)
109 struct list_head *next, *prev;
113 struct lstcon_rpc_ent {
114 struct list_head rpe_link; /* link chain */
115 struct lnet_process_id rpe_peer; /* peer's id */
116 /* This has not been used since Lustre 2.2 so its safe to use.
117 * Update to allow future use of timespec64
122 } rpe_stamp; /* time stamp of RPC */
123 int rpe_state; /* peer's state */
124 int rpe_rpc_errno; /* RPC errno */
126 struct lst_sid rpe_sid; /* peer's session id */
127 int rpe_fwk_errno; /* framework errno */
128 int rpe_priv[4]; /* private data */
129 char rpe_payload[0]; /* private reply payload */
132 struct lstcon_trans_stat {
133 int trs_rpc_stat[4]; /* RPCs stat (0: total, 1: failed, 2: finished, 4: reserved */
134 int trs_rpc_errno; /* RPC errno */
135 int trs_fwk_stat[8]; /* framework stat */
136 int trs_fwk_errno; /* errno of the first remote error */
137 void *trs_fwk_private; /* private framework stat */
141 lstcon_rpc_stat_total(struct lstcon_trans_stat *stat, int inc)
143 return inc ? ++stat->trs_rpc_stat[0] : stat->trs_rpc_stat[0];
147 lstcon_rpc_stat_success(struct lstcon_trans_stat *stat, int inc)
149 return inc ? ++stat->trs_rpc_stat[1] : stat->trs_rpc_stat[1];
153 lstcon_rpc_stat_failure(struct lstcon_trans_stat *stat, int inc)
155 return inc ? ++stat->trs_rpc_stat[2] : stat->trs_rpc_stat[2];
159 lstcon_sesop_stat_success(struct lstcon_trans_stat *stat, int inc)
161 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
165 lstcon_sesop_stat_failure(struct lstcon_trans_stat *stat, int inc)
167 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
171 lstcon_sesqry_stat_active(struct lstcon_trans_stat *stat, int inc)
173 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
177 lstcon_sesqry_stat_busy(struct lstcon_trans_stat *stat, int inc)
179 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
183 lstcon_sesqry_stat_unknown(struct lstcon_trans_stat *stat, int inc)
185 return inc ? ++stat->trs_fwk_stat[2] : stat->trs_fwk_stat[2];
189 lstcon_tsbop_stat_success(struct lstcon_trans_stat *stat, int inc)
191 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
195 lstcon_tsbop_stat_failure(struct lstcon_trans_stat *stat, int inc)
197 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
201 lstcon_tsbqry_stat_idle(struct lstcon_trans_stat *stat, int inc)
203 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
207 lstcon_tsbqry_stat_run(struct lstcon_trans_stat *stat, int inc)
209 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
213 lstcon_tsbqry_stat_failure(struct lstcon_trans_stat *stat, int inc)
215 return inc ? ++stat->trs_fwk_stat[2] : stat->trs_fwk_stat[2];
219 lstcon_statqry_stat_success(struct lstcon_trans_stat *stat, int inc)
221 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
225 lstcon_statqry_stat_failure(struct lstcon_trans_stat *stat, int inc)
227 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
230 /* create a session */
231 struct lstio_session_new_args {
232 int lstio_ses_key; /* IN: local key */
233 int lstio_ses_timeout; /* IN: session timeout */
234 int lstio_ses_force; /* IN: force create ? */
235 /** IN: session features */
236 unsigned lstio_ses_feats;
237 struct lst_sid __user *lstio_ses_idp; /* OUT: session id */
238 int lstio_ses_nmlen; /* IN: name length */
239 char __user *lstio_ses_namep; /* IN: session name */
242 /* query current session */
243 struct lstio_session_info_args {
244 struct lst_sid __user *lstio_ses_idp; /* OUT: session id */
245 int __user *lstio_ses_keyp; /* OUT: local key */
246 /** OUT: session features */
247 unsigned __user *lstio_ses_featp;
248 struct lstcon_ndlist_ent __user *lstio_ses_ndinfo; /* OUT: */
249 int lstio_ses_nmlen; /* IN: name length */
250 char __user *lstio_ses_namep; /* OUT: session name */
253 /* delete a session */
254 struct lstio_session_end_args {
255 int lstio_ses_key; /* IN: session key */
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
264 struct lstio_debug_args {
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 __user *lstio_dbg_namep; /* IN: name of group|batch */
272 int lstio_dbg_count; /* IN: # of test nodes to debug */
273 struct lnet_process_id __user *lstio_dbg_idsp; /* IN: id of test nodes */
274 /* OUT: list head of result buffer */
275 struct list_head __user *lstio_dbg_resultp;
278 struct lstio_group_add_args {
279 int lstio_grp_key; /* IN: session key */
280 int lstio_grp_nmlen; /* IN: name length */
281 char __user *lstio_grp_namep; /* IN: group name */
284 struct lstio_group_del_args {
285 int lstio_grp_key; /* IN: session key */
286 int lstio_grp_nmlen; /* IN: name length */
287 char __user *lstio_grp_namep; /* IN: group name */
290 #define LST_GROUP_CLEAN 1 /* remove inactive nodes in the group */
291 #define LST_GROUP_REFRESH 2 /* refresh inactive nodes in the group */
292 #define LST_GROUP_RMND 3 /* delete nodes from the group */
294 struct lstio_group_update_args {
295 int lstio_grp_key; /* IN: session key */
296 int lstio_grp_opc; /* IN: OPC */
297 int lstio_grp_args; /* IN: arguments */
298 int lstio_grp_nmlen; /* IN: name length */
299 char __user *lstio_grp_namep; /* IN: group name */
300 int lstio_grp_count; /* IN: # of nodes id */
301 struct lnet_process_id __user *lstio_grp_idsp; /* IN: array of nodes */
302 /* OUT: list head of result buffer */
303 struct list_head __user *lstio_grp_resultp;
306 struct lstio_group_nodes_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 */
310 int lstio_grp_count; /* IN: # of nodes */
311 /** OUT: session features */
312 unsigned __user *lstio_grp_featp;
313 struct lnet_process_id __user *lstio_grp_idsp; /* IN: nodes */
314 /* OUT: list head of result buffer */
315 struct list_head __user *lstio_grp_resultp;
318 struct lstio_group_list_args {
319 int lstio_grp_key; /* IN: session key */
320 int lstio_grp_idx; /* IN: group idx */
321 int lstio_grp_nmlen; /* IN: name len */
322 char __user *lstio_grp_namep; /* OUT: name */
325 struct lstio_group_info_args {
326 int lstio_grp_key; /* IN: session key */
327 int lstio_grp_nmlen; /* IN: name len */
328 char __user *lstio_grp_namep; /* IN: name */
329 struct lstcon_ndlist_ent __user *lstio_grp_entp;/* OUT: description of group */
331 int __user *lstio_grp_idxp; /* IN/OUT: node index */
332 int __user *lstio_grp_ndentp; /* IN/OUT: # of nodent */
333 struct lstcon_node_ent __user *lstio_grp_dentsp;/* OUT: nodent array */
336 #define LST_DEFAULT_BATCH "batch" /* default batch name */
338 struct lstio_batch_add_args {
339 int lstio_bat_key; /* IN: session key */
340 int lstio_bat_nmlen; /* IN: name length */
341 char __user *lstio_bat_namep; /* IN: batch name */
344 struct lstio_batch_del_args {
345 int lstio_bat_key; /* IN: session key */
346 int lstio_bat_nmlen; /* IN: name length */
347 char __user *lstio_bat_namep; /* IN: batch name */
350 struct lstio_batch_run_args {
351 /* IN: session key */
353 /* IN: timeout for the batch */
354 int lstio_bat_timeout;
355 /* IN: name length */
358 char __user *lstio_bat_namep;
359 /* OUT: list head of result buffer */
360 struct list_head __user *lstio_bat_resultp;
363 struct lstio_batch_stop_args {
364 /* IN: session key */
366 /* IN: abort unfinished test RPC */
368 /* IN: name length */
371 char __user *lstio_bat_namep;
372 /* OUT: list head of result buffer */
373 struct list_head __user *lstio_bat_resultp;
376 struct lstio_batch_query_args {
377 /* IN: session key */
380 int lstio_bat_testidx;
381 /* IN: is test client? */
382 int lstio_bat_client;
383 /* IN: timeout for waiting */
384 int lstio_bat_timeout;
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_list_args {
394 int lstio_bat_key; /* IN: session key */
395 int lstio_bat_idx; /* IN: index */
396 int lstio_bat_nmlen; /* IN: name length */
397 char __user *lstio_bat_namep; /* IN: batch name */
400 struct lstio_batch_info_args {
401 int lstio_bat_key; /* IN: session key */
402 int lstio_bat_nmlen; /* IN: name length */
403 char __user *lstio_bat_namep; /* IN: name */
404 int lstio_bat_server; /* IN: query server or not */
405 int lstio_bat_testidx; /* IN: test index */
406 struct lstcon_test_batch_ent __user *lstio_bat_entp;/* OUT: batch ent */
408 int __user *lstio_bat_idxp; /* IN/OUT: index of node */
409 int __user *lstio_bat_ndentp; /* IN/OUT: # of nodent */
410 struct lstcon_node_ent __user *lstio_bat_dentsp;/* array of nodent */
413 /* add stat in session */
414 struct lstio_stat_args {
415 /* IN: session key */
417 /* IN: timeout for stat requst */
418 int lstio_sta_timeout;
419 /* IN: group name length */
422 char __user *lstio_sta_namep;
426 struct lnet_process_id __user *lstio_sta_idsp;
427 /* OUT: list head of result buffer */
428 struct list_head __user *lstio_sta_resultp;
436 /* create a test in a batch */
437 #define LST_MAX_CONCUR 1024 /* Max concurrency of test */
439 struct lstio_test_args {
440 int lstio_tes_key; /* IN: session key */
441 int lstio_tes_bat_nmlen; /* IN: batch name len */
442 char __user *lstio_tes_bat_name; /* IN: batch name */
443 int lstio_tes_type; /* IN: test type */
444 int lstio_tes_oneside; /* IN: one sided test */
445 int lstio_tes_loop; /* IN: loop count */
446 int lstio_tes_concur; /* IN: concurrency */
448 int lstio_tes_dist; /* IN: node distribution in destination groups */
449 int lstio_tes_span; /* IN: node span in destination groups */
450 int lstio_tes_sgrp_nmlen; /* IN: source group name length */
451 char __user *lstio_tes_sgrp_name; /* IN: group name */
452 int lstio_tes_dgrp_nmlen; /* IN: destination group name length */
453 char __user *lstio_tes_dgrp_name; /* IN: group name */
455 /* IN: param buffer len */
456 int lstio_tes_param_len;
457 /* IN: parameter for specified test:
461 void __user *lstio_tes_param;
462 /* OUT: private returned value */
463 int __user *lstio_tes_retp;
464 /* OUT: list head of result buffer */
465 struct list_head __user *lstio_tes_resultp;
474 LST_BRW_CHECK_NONE = 1,
475 LST_BRW_CHECK_SIMPLE = 2,
476 LST_BRW_CHECK_FULL = 3
479 struct lst_test_bulk_param {
480 int blk_opc; /* bulk operation code */
481 int blk_size; /* size (bytes) */
482 int blk_time; /* time of running the test*/
483 int blk_flags; /* reserved flags */
484 int blk_cli_off; /* bulk offset on client */
485 int blk_srv_off; /* reserved: bulk offset on server */
488 struct lst_test_ping_param {
489 int png_size; /* size of ping message */
490 int png_time; /* time */
491 int png_loop; /* loop */
492 int png_flags; /* reserved flags */
495 /* Both struct srpc_counters and struct sfw_counters are sent over the wire */
496 struct srpc_counters {
504 } __attribute__((packed));
506 struct sfw_counters {
507 /** milliseconds since current session started */
509 __u32 active_batches;
510 __u32 zombie_sessions;
513 } __attribute__((packed));
515 #define LNET_SELFTEST_GENL_NAME "lnet_selftest"
516 #define LNET_SELFTEST_GENL_VERSION 0x1
518 /* enum lnet_selftest_commands - Supported core LNet Selftest Netlink
521 * @LNET_SELFTEST_CMD_UNSPEC: unspecified command to catch errors
522 * @LNET_SELFTEST_CMD_SESSIONS: command to manage sessions
523 * @LNET_SELFTEST_CMD_GROUPS: command to manage selftest groups
525 enum lnet_selftest_commands {
526 LNET_SELFTEST_CMD_UNSPEC = 0,
528 LNET_SELFTEST_CMD_SESSIONS = 1,
529 LNET_SELFTEST_CMD_GROUPS = 2,
531 __LNET_SELFTEST_CMD_MAX_PLUS_ONE,
534 #define LNET_SELFTEST_CMD_MAX (__LNET_SELFTEST_CMD_MAX_PLUS_ONE - 1)