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 */
82 __u64 bat_id; /* unique id in session */
85 /* Status of test node */
86 #define LST_NODE_ACTIVE 0x1 /* node in this session */
87 #define LST_NODE_BUSY 0x2 /* node is taken by other session */
88 #define LST_NODE_DOWN 0x4 /* node is down */
89 #define LST_NODE_UNKNOWN 0x8 /* node not in session */
91 struct lstcon_node_ent {
92 struct lnet_process_id nde_id; /* id of node */
93 int nde_state; /* state of node */
94 }; /*** node entry, for list_group command */
96 struct lstcon_ndlist_ent {
97 int nle_nnode; /* # of nodes */
98 int nle_nactive; /* # of active nodes */
99 int nle_nbusy; /* # of busy nodes */
100 int nle_ndown; /* # of down nodes */
101 int nle_nunknown; /* # of unknown nodes */
102 }; /*** node_list entry, for list_batch command */
104 struct lstcon_test_ent {
105 int tse_type; /* test type */
106 int tse_loop; /* loop count */
107 int tse_concur; /* concurrency of test */
108 }; /*** test summary entry, for list_batch command */
110 struct lstcon_batch_ent {
111 int bae_state; /* batch status */
112 int bae_timeout; /* batch timeout */
113 int bae_ntest; /* # of tests in the batch */
114 }; /*** batch summary entry, for list_batch command */
116 struct lstcon_test_batch_ent {
117 struct lstcon_ndlist_ent tbe_cli_nle; /* client (group) node_list entry */
118 struct lstcon_ndlist_ent tbe_srv_nle; /* server (group) node_list entry */
120 struct lstcon_test_ent tbe_test; /* test entry */
121 struct lstcon_batch_ent tbe_batch; /* batch entry */
123 }; /*** test/batch verbose information entry,
124 *** for list_batch command */
126 /* This will go away once we move to netlink */
127 #if !defined(__KERNEL__) && !defined(__LIBCFS_UTIL_LIST_H__)
129 struct list_head *next, *prev;
133 struct lstcon_rpc_ent {
134 struct list_head rpe_link; /* link chain */
135 struct lnet_process_id rpe_peer; /* peer's id */
136 /* This has not been used since Lustre 2.2 so its safe to use.
137 * Update to allow future use of timespec64
142 } rpe_stamp; /* time stamp of RPC */
143 int rpe_state; /* peer's state */
144 int rpe_rpc_errno; /* RPC errno */
146 struct lst_sid rpe_sid; /* peer's session id */
147 int rpe_fwk_errno; /* framework errno */
148 int rpe_priv[4]; /* private data */
149 char rpe_payload[0]; /* private reply payload */
152 struct lstcon_trans_stat {
153 int trs_rpc_stat[4]; /* RPCs stat (0: total, 1: failed, 2: finished, 4: reserved */
154 int trs_rpc_errno; /* RPC errno */
155 int trs_fwk_stat[8]; /* framework stat */
156 int trs_fwk_errno; /* errno of the first remote error */
157 void *trs_fwk_private; /* private framework stat */
161 lstcon_rpc_stat_total(struct lstcon_trans_stat *stat, int inc)
163 return inc ? ++stat->trs_rpc_stat[0] : stat->trs_rpc_stat[0];
167 lstcon_rpc_stat_success(struct lstcon_trans_stat *stat, int inc)
169 return inc ? ++stat->trs_rpc_stat[1] : stat->trs_rpc_stat[1];
173 lstcon_rpc_stat_failure(struct lstcon_trans_stat *stat, int inc)
175 return inc ? ++stat->trs_rpc_stat[2] : stat->trs_rpc_stat[2];
179 lstcon_sesop_stat_success(struct lstcon_trans_stat *stat, int inc)
181 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
185 lstcon_sesop_stat_failure(struct lstcon_trans_stat *stat, int inc)
187 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
191 lstcon_sesqry_stat_active(struct lstcon_trans_stat *stat, int inc)
193 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
197 lstcon_sesqry_stat_busy(struct lstcon_trans_stat *stat, int inc)
199 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
203 lstcon_sesqry_stat_unknown(struct lstcon_trans_stat *stat, int inc)
205 return inc ? ++stat->trs_fwk_stat[2] : stat->trs_fwk_stat[2];
209 lstcon_tsbop_stat_success(struct lstcon_trans_stat *stat, int inc)
211 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
215 lstcon_tsbop_stat_failure(struct lstcon_trans_stat *stat, int inc)
217 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
221 lstcon_tsbqry_stat_idle(struct lstcon_trans_stat *stat, int inc)
223 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
227 lstcon_tsbqry_stat_run(struct lstcon_trans_stat *stat, int inc)
229 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
233 lstcon_tsbqry_stat_failure(struct lstcon_trans_stat *stat, int inc)
235 return inc ? ++stat->trs_fwk_stat[2] : stat->trs_fwk_stat[2];
239 lstcon_statqry_stat_success(struct lstcon_trans_stat *stat, int inc)
241 return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
245 lstcon_statqry_stat_failure(struct lstcon_trans_stat *stat, int inc)
247 return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
250 /* create a session */
251 struct lstio_session_new_args {
252 int lstio_ses_key; /* IN: local key */
253 int lstio_ses_timeout; /* IN: session timeout */
254 int lstio_ses_force; /* IN: force create ? */
255 /** IN: session features */
256 unsigned lstio_ses_feats;
257 struct lst_sid __user *lstio_ses_idp; /* OUT: session id */
258 int lstio_ses_nmlen; /* IN: name length */
259 char __user *lstio_ses_namep; /* IN: session name */
262 /* query current session */
263 struct lstio_session_info_args {
264 struct lst_sid __user *lstio_ses_idp; /* OUT: session id */
265 int __user *lstio_ses_keyp; /* OUT: local key */
266 /** OUT: session features */
267 unsigned __user *lstio_ses_featp;
268 struct lstcon_ndlist_ent __user *lstio_ses_ndinfo; /* OUT: */
269 int lstio_ses_nmlen; /* IN: name length */
270 char __user *lstio_ses_namep; /* OUT: session name */
273 /* delete a session */
274 struct lstio_session_end_args {
275 int lstio_ses_key; /* IN: session key */
278 #define LST_OPC_SESSION 1
279 #define LST_OPC_GROUP 2
280 #define LST_OPC_NODES 3
281 #define LST_OPC_BATCHCLI 4
282 #define LST_OPC_BATCHSRV 5
284 struct lstio_debug_args {
285 int lstio_dbg_key; /* IN: session key */
286 int lstio_dbg_type; /* IN: debug sessin|batch|group|nodes list */
287 int lstio_dbg_flags; /* IN: reserved debug flags */
288 int lstio_dbg_timeout; /* IN: timeout of debug */
290 int lstio_dbg_nmlen; /* IN: len of name */
291 char __user *lstio_dbg_namep; /* IN: name of group|batch */
292 int lstio_dbg_count; /* IN: # of test nodes to debug */
293 struct lnet_process_id __user *lstio_dbg_idsp; /* IN: id of test nodes */
294 /* OUT: list head of result buffer */
295 struct list_head __user *lstio_dbg_resultp;
298 struct lstio_group_add_args {
299 int lstio_grp_key; /* IN: session key */
300 int lstio_grp_nmlen; /* IN: name length */
301 char __user *lstio_grp_namep; /* IN: group name */
304 struct lstio_group_del_args {
305 int lstio_grp_key; /* IN: session key */
306 int lstio_grp_nmlen; /* IN: name length */
307 char __user *lstio_grp_namep; /* IN: group name */
310 #define LST_GROUP_CLEAN 1 /* remove inactive nodes in the group */
311 #define LST_GROUP_REFRESH 2 /* refresh inactive nodes in the group */
312 #define LST_GROUP_RMND 3 /* delete nodes from the group */
314 struct lstio_group_update_args {
315 int lstio_grp_key; /* IN: session key */
316 int lstio_grp_opc; /* IN: OPC */
317 int lstio_grp_args; /* IN: arguments */
318 int lstio_grp_nmlen; /* IN: name length */
319 char __user *lstio_grp_namep; /* IN: group name */
320 int lstio_grp_count; /* IN: # of nodes id */
321 struct lnet_process_id __user *lstio_grp_idsp; /* IN: array of nodes */
322 /* OUT: list head of result buffer */
323 struct list_head __user *lstio_grp_resultp;
326 struct lstio_group_nodes_args {
327 int lstio_grp_key; /* IN: session key */
328 int lstio_grp_nmlen; /* IN: name length */
329 char __user *lstio_grp_namep; /* IN: group name */
330 int lstio_grp_count; /* IN: # of nodes */
331 /** OUT: session features */
332 unsigned __user *lstio_grp_featp;
333 struct lnet_process_id __user *lstio_grp_idsp; /* IN: nodes */
334 /* OUT: list head of result buffer */
335 struct list_head __user *lstio_grp_resultp;
338 struct lstio_group_list_args {
339 int lstio_grp_key; /* IN: session key */
340 int lstio_grp_idx; /* IN: group idx */
341 int lstio_grp_nmlen; /* IN: name len */
342 char __user *lstio_grp_namep; /* OUT: name */
345 struct lstio_group_info_args {
346 int lstio_grp_key; /* IN: session key */
347 int lstio_grp_nmlen; /* IN: name len */
348 char __user *lstio_grp_namep; /* IN: name */
349 struct lstcon_ndlist_ent __user *lstio_grp_entp;/* OUT: description of group */
351 int __user *lstio_grp_idxp; /* IN/OUT: node index */
352 int __user *lstio_grp_ndentp; /* IN/OUT: # of nodent */
353 struct lstcon_node_ent __user *lstio_grp_dentsp;/* OUT: nodent array */
356 #define LST_DEFAULT_BATCH "batch" /* default batch name */
358 struct lstio_batch_add_args {
359 int lstio_bat_key; /* IN: session key */
360 int lstio_bat_nmlen; /* IN: name length */
361 char __user *lstio_bat_namep; /* IN: batch name */
364 struct lstio_batch_del_args {
365 int lstio_bat_key; /* IN: session key */
366 int lstio_bat_nmlen; /* IN: name length */
367 char __user *lstio_bat_namep; /* IN: batch name */
370 struct lstio_batch_run_args {
371 /* IN: session key */
373 /* IN: timeout for the batch */
374 int lstio_bat_timeout;
375 /* IN: name length */
378 char __user *lstio_bat_namep;
379 /* OUT: list head of result buffer */
380 struct list_head __user *lstio_bat_resultp;
383 struct lstio_batch_stop_args {
384 /* IN: session key */
386 /* IN: abort unfinished test RPC */
388 /* IN: name length */
391 char __user *lstio_bat_namep;
392 /* OUT: list head of result buffer */
393 struct list_head __user *lstio_bat_resultp;
396 struct lstio_batch_query_args {
397 /* IN: session key */
400 int lstio_bat_testidx;
401 /* IN: is test client? */
402 int lstio_bat_client;
403 /* IN: timeout for waiting */
404 int lstio_bat_timeout;
405 /* IN: name length */
408 char __user *lstio_bat_namep;
409 /* OUT: list head of result buffer */
410 struct list_head __user *lstio_bat_resultp;
413 struct lstio_batch_list_args {
414 int lstio_bat_key; /* IN: session key */
415 int lstio_bat_idx; /* IN: index */
416 int lstio_bat_nmlen; /* IN: name length */
417 char __user *lstio_bat_namep; /* IN: batch name */
420 struct lstio_batch_info_args {
421 int lstio_bat_key; /* IN: session key */
422 int lstio_bat_nmlen; /* IN: name length */
423 char __user *lstio_bat_namep; /* IN: name */
424 int lstio_bat_server; /* IN: query server or not */
425 int lstio_bat_testidx; /* IN: test index */
426 struct lstcon_test_batch_ent __user *lstio_bat_entp;/* OUT: batch ent */
428 int __user *lstio_bat_idxp; /* IN/OUT: index of node */
429 int __user *lstio_bat_ndentp; /* IN/OUT: # of nodent */
430 struct lstcon_node_ent __user *lstio_bat_dentsp;/* array of nodent */
433 /* add stat in session */
434 struct lstio_stat_args {
435 /* IN: session key */
437 /* IN: timeout for stat requst */
438 int lstio_sta_timeout;
439 /* IN: group name length */
442 char __user *lstio_sta_namep;
446 struct lnet_process_id __user *lstio_sta_idsp;
447 /* OUT: list head of result buffer */
448 struct list_head __user *lstio_sta_resultp;
456 /* create a test in a batch */
457 #define LST_MAX_CONCUR 1024 /* Max concurrency of test */
459 struct lstio_test_args {
460 int lstio_tes_key; /* IN: session key */
461 int lstio_tes_bat_nmlen; /* IN: batch name len */
462 char __user *lstio_tes_bat_name; /* IN: batch name */
463 int lstio_tes_type; /* IN: test type */
464 int lstio_tes_oneside; /* IN: one sided test */
465 int lstio_tes_loop; /* IN: loop count */
466 int lstio_tes_concur; /* IN: concurrency */
468 int lstio_tes_dist; /* IN: node distribution in destination groups */
469 int lstio_tes_span; /* IN: node span in destination groups */
470 int lstio_tes_sgrp_nmlen; /* IN: source group name length */
471 char __user *lstio_tes_sgrp_name; /* IN: group name */
472 int lstio_tes_dgrp_nmlen; /* IN: destination group name length */
473 char __user *lstio_tes_dgrp_name; /* IN: group name */
475 /* IN: param buffer len */
476 int lstio_tes_param_len;
477 /* IN: parameter for specified test:
481 void __user *lstio_tes_param;
482 /* OUT: private returned value */
483 int __user *lstio_tes_retp;
484 /* OUT: list head of result buffer */
485 struct list_head __user *lstio_tes_resultp;
494 LST_BRW_CHECK_NONE = 1,
495 LST_BRW_CHECK_SIMPLE = 2,
496 LST_BRW_CHECK_FULL = 3
499 struct lst_test_bulk_param {
500 int blk_opc; /* bulk operation code */
501 int blk_size; /* size (bytes) */
502 int blk_time; /* time of running the test*/
503 int blk_flags; /* reserved flags */
504 int blk_cli_off; /* bulk offset on client */
505 int blk_srv_off; /* reserved: bulk offset on server */
508 struct lst_test_ping_param {
509 int png_size; /* size of ping message */
510 int png_time; /* time */
511 int png_loop; /* loop */
512 int png_flags; /* reserved flags */
515 /* Both struct srpc_counters and struct sfw_counters are sent over the wire */
516 struct srpc_counters {
524 } __attribute__((packed));
526 struct sfw_counters {
527 /** milliseconds since current session started */
529 __u32 active_batches;
530 __u32 zombie_sessions;
533 } __attribute__((packed));
535 #define LNET_SELFTEST_GENL_NAME "lnet_selftest"
536 #define LNET_SELFTEST_GENL_VERSION 0x1
538 /* enum lnet_selftest_commands - Supported core LNet Selftest Netlink
541 * @LNET_SELFTEST_CMD_UNSPEC: unspecified command to catch errors
542 * @LNET_SELFTEST_CMD_SESSIONS: command to manage sessions
543 * @LNET_SELFTEST_CMD_GROUPS: command to manage selftest groups
545 enum lnet_selftest_commands {
546 LNET_SELFTEST_CMD_UNSPEC = 0,
548 LNET_SELFTEST_CMD_SESSIONS = 1,
549 LNET_SELFTEST_CMD_GROUPS = 2,
551 __LNET_SELFTEST_CMD_MAX_PLUS_ONE,
554 #define LNET_SELFTEST_CMD_MAX (__LNET_SELFTEST_CMD_MAX_PLUS_ONE - 1)