Whamcloud - gitweb
LU-17744 ldiskfs: mballoc stats fixes
[fs/lustre-release.git] / lnet / include / uapi / linux / lnet / lnetctl.h
1 // SPDX-License-Identifier: GPL-2.0
2
3 /* Copyright (c) 2014, 2017, Intel Corporation. */
4
5 /* This file is part of Lustre, http://www.lustre.org/
6  *
7  * header for lnet ioctl
8  */
9
10 #ifndef __UAPI_LNETCTL_H_
11 #define __UAPI_LNETCTL_H_
12
13 #include <linux/types.h>
14 #include <linux/lnet/lnet-types.h>
15
16 /** \addtogroup lnet_fault_simulation
17  * @{ */
18
19 enum {
20         LNET_CTL_DROP_ADD,
21         LNET_CTL_DROP_DEL,
22         LNET_CTL_DROP_RESET,
23         LNET_CTL_DROP_LIST,
24         LNET_CTL_DELAY_ADD,
25         LNET_CTL_DELAY_DEL,
26         LNET_CTL_DELAY_RESET,
27         LNET_CTL_DELAY_LIST,
28 };
29
30 #define LNET_ACK_BIT            (1 << 0)
31 #define LNET_PUT_BIT            (1 << 1)
32 #define LNET_GET_BIT            (1 << 2)
33 #define LNET_REPLY_BIT          (1 << 3)
34
35 #define HSTATUS_END                     11
36 #define HSTATUS_LOCAL_INTERRUPT_BIT     (1 << 1)
37 #define HSTATUS_LOCAL_DROPPED_BIT       (1 << 2)
38 #define HSTATUS_LOCAL_ABORTED_BIT       (1 << 3)
39 #define HSTATUS_LOCAL_NO_ROUTE_BIT      (1 << 4)
40 #define HSTATUS_LOCAL_ERROR_BIT         (1 << 5)
41 #define HSTATUS_LOCAL_TIMEOUT_BIT       (1 << 6)
42 #define HSTATUS_REMOTE_ERROR_BIT        (1 << 7)
43 #define HSTATUS_REMOTE_DROPPED_BIT      (1 << 8)
44 #define HSTATUS_REMOTE_TIMEOUT_BIT      (1 << 9)
45 #define HSTATUS_NETWORK_TIMEOUT_BIT     (1 << 10)
46 #define HSTATUS_RANDOM                  0xffffffff
47
48 /** ioctl parameter for LNet fault simulation */
49 struct lnet_fault_attr {
50         /**
51          * source NID of drop rule
52          * LNET_NID_ANY is wildcard for all sources
53          * 255.255.255.255@net is wildcard for all addresses from @net
54          */
55         lnet_nid_t                      fa_src;
56         /** destination NID of drop rule, see \a dr_src for details */
57         lnet_nid_t                      fa_dst;
58         /** local NID. In case of router this is the NID we're ceiving
59          * messages on
60          */
61         lnet_nid_t                      fa_local_nid;
62         /**
63          * Portal mask to drop, -1 means all portals, for example:
64          * fa_ptl_mask = (1 << _LDLM_CB_REQUEST_PORTAL ) |
65          *               (1 << LDLM_CANCEL_REQUEST_PORTAL)
66          *
67          * If it is non-zero then only PUT and GET will be filtered, otherwise
68          * there is no portal filter, all matched messages will be checked.
69          */
70         __u64                           fa_ptl_mask;
71         /**
72          * message types to drop, for example:
73          * dra_type = LNET_DROP_ACK_BIT | LNET_DROP_PUT_BIT
74          *
75          * If it is non-zero then only specified message types are filtered,
76          * otherwise all message types will be checked.
77          */
78         __u32                           fa_msg_mask;
79         union {
80                 /** message drop simulation */
81                 struct {
82                         /** drop rate of this rule */
83                         __u32                   da_rate;
84                         /**
85                          * time interval of message drop, it is exclusive
86                          * with da_rate
87                          */
88                         __u32                   da_interval;
89                         /** error type mask */
90                         __u32                   da_health_error_mask;
91                         /** randomize error generation */
92                         __u32                   da_random:1,
93                         /** drop all messages if flag is set */
94                                                 da_drop_all:1;
95                 } drop;
96                 /** message latency simulation */
97                 struct {
98                         __u32                   la_rate;
99                         /**
100                          * time interval of message delay, it is exclusive
101                          * with la_rate
102                          */
103                         __u32                   la_interval;
104                         /** latency to delay */
105                         __u32                   la_latency;
106                 } delay;
107                 __u64                   space[8];
108         } u;
109
110 };
111
112 /** fault simluation stats */
113 struct lnet_fault_stat {
114         /** total # matched messages */
115         __u64                           fs_count;
116         /** # dropped LNET_MSG_PUT by this rule */
117         __u64                           fs_put;
118         /** # dropped LNET_MSG_ACK by this rule */
119         __u64                           fs_ack;
120         /** # dropped LNET_MSG_GET by this rule */
121         __u64                           fs_get;
122         /** # dropped LNET_MSG_REPLY by this rule */
123         __u64                           fs_reply;
124         union {
125                 struct {
126                         /** total # dropped messages */
127                         __u64                   ds_dropped;
128                 } drop;
129                 struct {
130                         /** total # delayed messages */
131                         __u64                   ls_delayed;
132                 } delay;
133                 __u64                   space[8];
134         } u;
135 };
136
137 /** @} lnet_fault_simulation */
138
139 #define LNET_DEV_ID     0
140 #define LNET_DEV_PATH   "/dev/lnet"
141
142 #endif