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