Whamcloud - gitweb
LU-11304 misc: update all url links to whamcloud
[fs/lustre-release.git] / lnet / include / uapi / linux / lnet / lnetctl.h
1 /*
2  *   This file is part of Lustre, https://wiki.whamcloud.com/
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, 2017, Intel Corporation.
21  */
22 #ifndef __UAPI_LNETCTL_H_
23 #define __UAPI_LNETCTL_H_
24
25 #include <linux/types.h>
26 /*
27  * This is due to us being out of kernel and the way the OpenSFS branch
28  * handles CFLAGS.
29  */
30 #ifdef __KERNEL__
31 # include <uapi/linux/lnet/lnet-types.h>
32 #else
33 # include <linux/lnet/lnet-types.h>
34 #endif
35
36 #include <stdbool.h>
37
38 /** \addtogroup lnet_fault_simulation
39  * @{ */
40
41 enum {
42         LNET_CTL_DROP_ADD,
43         LNET_CTL_DROP_DEL,
44         LNET_CTL_DROP_RESET,
45         LNET_CTL_DROP_LIST,
46         LNET_CTL_DELAY_ADD,
47         LNET_CTL_DELAY_DEL,
48         LNET_CTL_DELAY_RESET,
49         LNET_CTL_DELAY_LIST,
50 };
51
52 #define LNET_ACK_BIT            (1 << 0)
53 #define LNET_PUT_BIT            (1 << 1)
54 #define LNET_GET_BIT            (1 << 2)
55 #define LNET_REPLY_BIT          (1 << 3)
56
57 #define HSTATUS_END                     11
58 #define HSTATUS_LOCAL_INTERRUPT_BIT     (1 << 1)
59 #define HSTATUS_LOCAL_DROPPED_BIT       (1 << 2)
60 #define HSTATUS_LOCAL_ABORTED_BIT       (1 << 3)
61 #define HSTATUS_LOCAL_NO_ROUTE_BIT      (1 << 4)
62 #define HSTATUS_LOCAL_ERROR_BIT         (1 << 5)
63 #define HSTATUS_LOCAL_TIMEOUT_BIT       (1 << 6)
64 #define HSTATUS_REMOTE_ERROR_BIT        (1 << 7)
65 #define HSTATUS_REMOTE_DROPPED_BIT      (1 << 8)
66 #define HSTATUS_REMOTE_TIMEOUT_BIT      (1 << 9)
67 #define HSTATUS_NETWORK_TIMEOUT_BIT     (1 << 10)
68 #define HSTATUS_RANDOM                  0xffffffff
69
70 /** ioctl parameter for LNet fault simulation */
71 struct lnet_fault_attr {
72         /**
73          * source NID of drop rule
74          * LNET_NID_ANY is wildcard for all sources
75          * 255.255.255.255@net is wildcard for all addresses from @net
76          */
77         lnet_nid_t                      fa_src;
78         /** destination NID of drop rule, see \a dr_src for details */
79         lnet_nid_t                      fa_dst;
80         /**
81          * Portal mask to drop, -1 means all portals, for example:
82          * fa_ptl_mask = (1 << _LDLM_CB_REQUEST_PORTAL ) |
83          *               (1 << LDLM_CANCEL_REQUEST_PORTAL)
84          *
85          * If it is non-zero then only PUT and GET will be filtered, otherwise
86          * there is no portal filter, all matched messages will be checked.
87          */
88         __u64                           fa_ptl_mask;
89         /**
90          * message types to drop, for example:
91          * dra_type = LNET_DROP_ACK_BIT | LNET_DROP_PUT_BIT
92          *
93          * If it is non-zero then only specified message types are filtered,
94          * otherwise all message types will be checked.
95          */
96         __u32                           fa_msg_mask;
97         union {
98                 /** message drop simulation */
99                 struct {
100                         /** drop rate of this rule */
101                         __u32                   da_rate;
102                         /**
103                          * time interval of message drop, it is exclusive
104                          * with da_rate
105                          */
106                         __u32                   da_interval;
107                         /** error type mask */
108                         __u32                   da_health_error_mask;
109                         /** randomize error generation */
110                         bool                    da_random;
111                 } drop;
112                 /** message latency simulation */
113                 struct {
114                         __u32                   la_rate;
115                         /**
116                          * time interval of message delay, it is exclusive
117                          * with la_rate
118                          */
119                         __u32                   la_interval;
120                         /** latency to delay */
121                         __u32                   la_latency;
122                 } delay;
123                 __u64                   space[8];
124         } u;
125
126 };
127
128 /** fault simluation stats */
129 struct lnet_fault_stat {
130         /** total # matched messages */
131         __u64                           fs_count;
132         /** # dropped LNET_MSG_PUT by this rule */
133         __u64                           fs_put;
134         /** # dropped LNET_MSG_ACK by this rule */
135         __u64                           fs_ack;
136         /** # dropped LNET_MSG_GET by this rule */
137         __u64                           fs_get;
138         /** # dropped LNET_MSG_REPLY by this rule */
139         __u64                           fs_reply;
140         union {
141                 struct {
142                         /** total # dropped messages */
143                         __u64                   ds_dropped;
144                 } drop;
145                 struct {
146                         /** total # delayed messages */
147                         __u64                   ls_delayed;
148                 } delay;
149                 __u64                   space[8];
150         } u;
151 };
152
153 /** @} lnet_fault_simulation */
154
155 #define LNET_DEV_ID     0
156 #define LNET_DEV_PATH   "/dev/lnet"
157
158 #endif