Whamcloud - gitweb
be196617136d571234947485307689ea21540a5a
[fs/lustre-release.git] / lnet / include / lnet / lnetctl.h
1 /*
2  *   This file is part of Portals, http://www.sf.net/projects/lustre/
3  *
4  *   Portals is free software; you can redistribute it and/or
5  *   modify it under the terms of version 2 of the GNU General Public
6  *   License as published by the Free Software Foundation.
7  *
8  *   Portals is distributed in the hope that it will be useful,
9  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
10  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  *   GNU General Public License for more details.
12  *
13  *   You should have received a copy of the GNU General Public License
14  *   along with Portals; if not, write to the Free Software
15  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16  *
17  * header for lnet ioctl
18  */
19 /*
20  * Copyright (c) 2014, Intel Corporation.
21  */
22 #ifndef _PTLCTL_H_
23 #define _PTLCTL_H_
24
25 #include <libcfs/libcfs.h>
26 #include <lnet/types.h>
27
28 /** \addtogroup lnet_fault_simulation
29  * @{ */
30
31 enum {
32         LNET_CTL_DROP_ADD,
33         LNET_CTL_DROP_DEL,
34         LNET_CTL_DROP_RESET,
35         LNET_CTL_DROP_LIST,
36         LNET_CTL_DELAY_ADD,
37         LNET_CTL_DELAY_DEL,
38         LNET_CTL_DELAY_RESET,
39         LNET_CTL_DELAY_LIST,
40 };
41
42 #define LNET_ACK_BIT            (1 << 0)
43 #define LNET_PUT_BIT            (1 << 1)
44 #define LNET_GET_BIT            (1 << 2)
45 #define LNET_REPLY_BIT          (1 << 3)
46
47 /** ioctl parameter for LNet fault simulation */
48 struct lnet_fault_attr {
49         /**
50          * source NID of drop rule
51          * LNET_NID_ANY is wildcard for all sources
52          * 255.255.255.255@net is wildcard for all addresses from @net
53          */
54         lnet_nid_t                      fa_src;
55         /** destination NID of drop rule, see \a dr_src for details */
56         lnet_nid_t                      fa_dst;
57         /**
58          * Portal mask to drop, -1 means all portals, for example:
59          * fa_ptl_mask = (1 << _LDLM_CB_REQUEST_PORTAL ) |
60          *               (1 << LDLM_CANCEL_REQUEST_PORTAL)
61          *
62          * If it is non-zero then only PUT and GET will be filtered, otherwise
63          * there is no portal filter, all matched messages will be checked.
64          */
65         __u64                           fa_ptl_mask;
66         /**
67          * message types to drop, for example:
68          * dra_type = LNET_DROP_ACK_BIT | LNET_DROP_PUT_BIT
69          *
70          * If it is non-zero then only specified message types are filtered,
71          * otherwise all message types will be checked.
72          */
73         __u32                           fa_msg_mask;
74         union {
75                 /** message drop simulation */
76                 struct {
77                         /** drop rate of this rule */
78                         __u32                   da_rate;
79                         /**
80                          * time interval of message drop, it is exclusive
81                          * with da_rate
82                          */
83                         __u32                   da_interval;
84                 } drop;
85                 /** message latency simulation */
86                 struct {
87                         __u32                   la_rate;
88                         /**
89                          * time interval of message delay, it is exclusive
90                          * with la_rate
91                          */
92                         __u32                   la_interval;
93                         /** latency to delay */
94                         __u32                   la_latency;
95                 } delay;
96                 __u64                   space[8];
97         } u;
98
99 };
100
101 /** fault simluation stats */
102 struct lnet_fault_stat {
103         /** total # matched messages */
104         __u64                           fs_count;
105         /** # dropped LNET_MSG_PUT by this rule */
106         __u64                           fs_put;
107         /** # dropped LNET_MSG_ACK by this rule */
108         __u64                           fs_ack;
109         /** # dropped LNET_MSG_GET by this rule */
110         __u64                           fs_get;
111         /** # dropped LNET_MSG_REPLY by this rule */
112         __u64                           fs_reply;
113         union {
114                 struct {
115                         /** total # dropped messages */
116                         __u64                   ds_dropped;
117                 } drop;
118                 struct {
119                         /** total # delayed messages */
120                         __u64                   ls_delayed;
121                 } delay;
122                 __u64                   space[8];
123         } u;
124 };
125
126 /** @} lnet_fault_simulation */
127
128 #define LNET_DEV_ID 0
129 #define LNET_DEV_PATH "/dev/lnet"
130 #define LNET_DEV_MAJOR 10
131 #define LNET_DEV_MINOR 240
132 #define OBD_DEV_ID 1
133 #define OBD_DEV_NAME "obd"
134 #define OBD_DEV_PATH "/dev/" OBD_DEV_NAME
135 #define OBD_DEV_MAJOR 10
136 #define OBD_DEV_MINOR 241
137 #define SMFS_DEV_ID  2
138 #define SMFS_DEV_PATH "/dev/snapdev"
139 #define SMFS_DEV_MAJOR 10
140 #define SMFS_DEV_MINOR 242
141
142 int ptl_initialize(int argc, char **argv);
143 int jt_ptl_network(int argc, char **argv);
144 int jt_ptl_list_nids(int argc, char **argv);
145 int jt_ptl_which_nid(int argc, char **argv);
146 int jt_ptl_print_interfaces(int argc, char **argv);
147 int jt_ptl_add_interface(int argc, char **argv);
148 int jt_ptl_del_interface(int argc, char **argv);
149 int jt_ptl_print_peers (int argc, char **argv);
150 int jt_ptl_add_peer (int argc, char **argv);
151 int jt_ptl_del_peer (int argc, char **argv);
152 int jt_ptl_print_connections (int argc, char **argv);
153 int jt_ptl_disconnect(int argc, char **argv);
154 int jt_ptl_push_connection(int argc, char **argv);
155 int jt_ptl_ping(int argc, char **argv);
156 int jt_ptl_mynid(int argc, char **argv);
157 int jt_ptl_add_uuid(int argc, char **argv);
158 int jt_ptl_add_uuid_old(int argc, char **argv); /* backwards compatibility  */
159 int jt_ptl_close_uuid(int argc, char **argv);
160 int jt_ptl_del_uuid(int argc, char **argv);
161 int jt_ptl_add_route (int argc, char **argv);
162 int jt_ptl_del_route (int argc, char **argv);
163 int jt_ptl_notify_router (int argc, char **argv);
164 int jt_ptl_print_routes (int argc, char **argv);
165 int jt_ptl_fail_nid (int argc, char **argv);
166 int jt_ptl_testprotocompat(int argc, char **argv);
167 int jt_ptl_memhog(int argc, char **argv);
168 int jt_ptl_drop_add(int argc, char **argv);
169 int jt_ptl_drop_del(int argc, char **argv);
170 int jt_ptl_drop_reset(int argc, char **argv);
171 int jt_ptl_drop_list(int argc, char **argv);
172 int jt_ptl_delay_add(int argc, char **argv);
173 int jt_ptl_delay_del(int argc, char **argv);
174 int jt_ptl_delay_reset(int argc, char **argv);
175 int jt_ptl_delay_list(int argc, char **argv);
176
177 int dbg_initialize(int argc, char **argv);
178 int jt_dbg_filter(int argc, char **argv);
179 int jt_dbg_show(int argc, char **argv);
180 int jt_dbg_list(int argc, char **argv);
181 int jt_dbg_debug_kernel(int argc, char **argv);
182 int jt_dbg_debug_daemon(int argc, char **argv);
183 int jt_dbg_debug_file(int argc, char **argv);
184 int jt_dbg_clear_debug_buf(int argc, char **argv);
185 int jt_dbg_mark_debug_buf(int argc, char **argv);
186 int jt_dbg_modules(int argc, char **argv);
187 int jt_dbg_panic(int argc, char **argv);
188
189 #endif