Whamcloud - gitweb
23560e66dfdc707eb68676081ddad933eeab9c6e
[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 #ifndef _PTLCTL_H_
20 #define _PTLCTL_H_
21
22 #include <libcfs/libcfs.h>
23 #include <lnet/types.h>
24
25 /** \addtogroup lnet_fault_simulation
26  * @{ */
27
28 enum {
29         LNET_CTL_DROP_ADD,
30         LNET_CTL_DROP_DEL,
31         LNET_CTL_DROP_RESET,
32         LNET_CTL_DROP_LIST,
33 };
34
35 #define LNET_ACK_BIT            (1 << 0)
36 #define LNET_PUT_BIT            (1 << 1)
37 #define LNET_GET_BIT            (1 << 2)
38 #define LNET_REPLY_BIT          (1 << 3)
39
40 /** ioctl parameter for LNet fault simulation */
41 struct lnet_fault_attr {
42         /**
43          * source NID of drop rule
44          * LNET_NID_ANY is wildcard for all sources
45          * 255.255.255.255@net is wildcard for all addresses from @net
46          */
47         lnet_nid_t                      fa_src;
48         /** destination NID of drop rule, see \a dr_src for details */
49         lnet_nid_t                      fa_dst;
50         /**
51          * Portal mask to drop, -1 means all portals, for example:
52          * fa_ptl_mask = (1 << _LDLM_CB_REQUEST_PORTAL ) |
53          *               (1 << LDLM_CANCEL_REQUEST_PORTAL)
54          *
55          * If it is non-zero then only PUT and GET will be filtered, otherwise
56          * there is no portal filter, all matched messages will be checked.
57          */
58         __u64                           fa_ptl_mask;
59         /**
60          * message types to drop, for example:
61          * dra_type = LNET_DROP_ACK_BIT | LNET_DROP_PUT_BIT
62          *
63          * If it is non-zero then only specified message types are filtered,
64          * otherwise all message types will be checked.
65          */
66         __u32                           fa_msg_mask;
67         union {
68                 /** message drop simulation */
69                 struct {
70                         /** drop rate of this rule */
71                         __u32                   da_rate;
72                         /**
73                          * time interval of message drop, it is exclusive
74                          * with da_rate
75                          */
76                         __u32                   da_interval;
77                 } drop;
78                 /** TODO: add more */
79                 __u64                   space[8];
80         } u;
81
82 };
83
84 /** fault simluation stats */
85 struct lnet_fault_stat {
86         /** total # matched messages */
87         __u64                           fs_count;
88         /** # dropped LNET_MSG_PUT by this rule */
89         __u64                           fs_put;
90         /** # dropped LNET_MSG_ACK by this rule */
91         __u64                           fs_ack;
92         /** # dropped LNET_MSG_GET by this rule */
93         __u64                           fs_get;
94         /** # dropped LNET_MSG_REPLY by this rule */
95         __u64                           fs_reply;
96         union {
97                 struct {
98                         /** total # dropped messages */
99                         __u64                   ds_dropped;
100                 } drop;
101                 /** TODO: add more */
102                 __u64                   space[8];
103         } u;
104 };
105
106 /** @} lnet_fault_simulation */
107
108 #define LNET_DEV_ID 0
109 #define LNET_DEV_PATH "/dev/lnet"
110 #define LNET_DEV_MAJOR 10
111 #define LNET_DEV_MINOR 240
112 #define OBD_DEV_ID 1
113 #define OBD_DEV_NAME "obd"
114 #define OBD_DEV_PATH "/dev/" OBD_DEV_NAME
115 #define OBD_DEV_MAJOR 10
116 #define OBD_DEV_MINOR 241
117 #define SMFS_DEV_ID  2
118 #define SMFS_DEV_PATH "/dev/snapdev"
119 #define SMFS_DEV_MAJOR 10
120 #define SMFS_DEV_MINOR 242
121
122 int ptl_initialize(int argc, char **argv);
123 int jt_ptl_network(int argc, char **argv);
124 int jt_ptl_list_nids(int argc, char **argv);
125 int jt_ptl_which_nid(int argc, char **argv);
126 int jt_ptl_print_interfaces(int argc, char **argv);
127 int jt_ptl_add_interface(int argc, char **argv);
128 int jt_ptl_del_interface(int argc, char **argv);
129 int jt_ptl_print_peers (int argc, char **argv);
130 int jt_ptl_add_peer (int argc, char **argv);
131 int jt_ptl_del_peer (int argc, char **argv);
132 int jt_ptl_print_connections (int argc, char **argv);
133 int jt_ptl_disconnect(int argc, char **argv);
134 int jt_ptl_push_connection(int argc, char **argv);
135 int jt_ptl_print_active_txs(int argc, char **argv);
136 int jt_ptl_ping(int argc, char **argv);
137 int jt_ptl_mynid(int argc, char **argv);
138 int jt_ptl_add_uuid(int argc, char **argv);
139 int jt_ptl_add_uuid_old(int argc, char **argv); /* backwards compatibility  */
140 int jt_ptl_close_uuid(int argc, char **argv);
141 int jt_ptl_del_uuid(int argc, char **argv);
142 int jt_ptl_add_route (int argc, char **argv);
143 int jt_ptl_del_route (int argc, char **argv);
144 int jt_ptl_notify_router (int argc, char **argv);
145 int jt_ptl_print_routes (int argc, char **argv);
146 int jt_ptl_fail_nid (int argc, char **argv);
147 int jt_ptl_testprotocompat(int argc, char **argv);
148 int jt_ptl_memhog(int argc, char **argv);
149 int jt_ptl_drop_add(int argc, char **argv);
150 int jt_ptl_drop_del(int argc, char **argv);
151 int jt_ptl_drop_reset(int argc, char **argv);
152 int jt_ptl_drop_list(int argc, char **argv);
153
154 int dbg_initialize(int argc, char **argv);
155 int jt_dbg_filter(int argc, char **argv);
156 int jt_dbg_show(int argc, char **argv);
157 int jt_dbg_list(int argc, char **argv);
158 int jt_dbg_debug_kernel(int argc, char **argv);
159 int jt_dbg_debug_daemon(int argc, char **argv);
160 int jt_dbg_debug_file(int argc, char **argv);
161 int jt_dbg_clear_debug_buf(int argc, char **argv);
162 int jt_dbg_mark_debug_buf(int argc, char **argv);
163 int jt_dbg_modules(int argc, char **argv);
164 int jt_dbg_panic(int argc, char **argv);
165
166 #endif