Whamcloud - gitweb
LU-13274 uapi: make lnet UAPI headers C99 compliant
[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 #include <linux/lnet/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 #define HSTATUS_END                     11
48 #define HSTATUS_LOCAL_INTERRUPT_BIT     (1 << 1)
49 #define HSTATUS_LOCAL_DROPPED_BIT       (1 << 2)
50 #define HSTATUS_LOCAL_ABORTED_BIT       (1 << 3)
51 #define HSTATUS_LOCAL_NO_ROUTE_BIT      (1 << 4)
52 #define HSTATUS_LOCAL_ERROR_BIT         (1 << 5)
53 #define HSTATUS_LOCAL_TIMEOUT_BIT       (1 << 6)
54 #define HSTATUS_REMOTE_ERROR_BIT        (1 << 7)
55 #define HSTATUS_REMOTE_DROPPED_BIT      (1 << 8)
56 #define HSTATUS_REMOTE_TIMEOUT_BIT      (1 << 9)
57 #define HSTATUS_NETWORK_TIMEOUT_BIT     (1 << 10)
58 #define HSTATUS_RANDOM                  0xffffffff
59
60 /** ioctl parameter for LNet fault simulation */
61 struct lnet_fault_attr {
62         /**
63          * source NID of drop rule
64          * LNET_NID_ANY is wildcard for all sources
65          * 255.255.255.255@net is wildcard for all addresses from @net
66          */
67         lnet_nid_t                      fa_src;
68         /** destination NID of drop rule, see \a dr_src for details */
69         lnet_nid_t                      fa_dst;
70         /** local NID. In case of router this is the NID we're ceiving
71          * messages on
72          */
73         lnet_nid_t                      fa_local_nid;
74         /**
75          * Portal mask to drop, -1 means all portals, for example:
76          * fa_ptl_mask = (1 << _LDLM_CB_REQUEST_PORTAL ) |
77          *               (1 << LDLM_CANCEL_REQUEST_PORTAL)
78          *
79          * If it is non-zero then only PUT and GET will be filtered, otherwise
80          * there is no portal filter, all matched messages will be checked.
81          */
82         __u64                           fa_ptl_mask;
83         /**
84          * message types to drop, for example:
85          * dra_type = LNET_DROP_ACK_BIT | LNET_DROP_PUT_BIT
86          *
87          * If it is non-zero then only specified message types are filtered,
88          * otherwise all message types will be checked.
89          */
90         __u32                           fa_msg_mask;
91         union {
92                 /** message drop simulation */
93                 struct {
94                         /** drop rate of this rule */
95                         __u32                   da_rate;
96                         /**
97                          * time interval of message drop, it is exclusive
98                          * with da_rate
99                          */
100                         __u32                   da_interval;
101                         /** error type mask */
102                         __u32                   da_health_error_mask;
103                         /** randomize error generation */
104                         __u32                   da_random:1,
105                         /** drop all messages if flag is set */
106                                                 da_drop_all:1;
107                 } drop;
108                 /** message latency simulation */
109                 struct {
110                         __u32                   la_rate;
111                         /**
112                          * time interval of message delay, it is exclusive
113                          * with la_rate
114                          */
115                         __u32                   la_interval;
116                         /** latency to delay */
117                         __u32                   la_latency;
118                 } delay;
119                 __u64                   space[8];
120         } u;
121
122 };
123
124 /** fault simluation stats */
125 struct lnet_fault_stat {
126         /** total # matched messages */
127         __u64                           fs_count;
128         /** # dropped LNET_MSG_PUT by this rule */
129         __u64                           fs_put;
130         /** # dropped LNET_MSG_ACK by this rule */
131         __u64                           fs_ack;
132         /** # dropped LNET_MSG_GET by this rule */
133         __u64                           fs_get;
134         /** # dropped LNET_MSG_REPLY by this rule */
135         __u64                           fs_reply;
136         union {
137                 struct {
138                         /** total # dropped messages */
139                         __u64                   ds_dropped;
140                 } drop;
141                 struct {
142                         /** total # delayed messages */
143                         __u64                   ls_delayed;
144                 } delay;
145                 __u64                   space[8];
146         } u;
147 };
148
149 /** @} lnet_fault_simulation */
150
151 #define LNET_DEV_ID     0
152 #define LNET_DEV_PATH   "/dev/lnet"
153
154 #endif