Whamcloud - gitweb
LU-10086 libcfs: use dynamic minors for /dev/{lnet,obd}
[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, 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 /** \addtogroup lnet_fault_simulation
36  * @{ */
37
38 enum {
39         LNET_CTL_DROP_ADD,
40         LNET_CTL_DROP_DEL,
41         LNET_CTL_DROP_RESET,
42         LNET_CTL_DROP_LIST,
43         LNET_CTL_DELAY_ADD,
44         LNET_CTL_DELAY_DEL,
45         LNET_CTL_DELAY_RESET,
46         LNET_CTL_DELAY_LIST,
47 };
48
49 #define LNET_ACK_BIT            (1 << 0)
50 #define LNET_PUT_BIT            (1 << 1)
51 #define LNET_GET_BIT            (1 << 2)
52 #define LNET_REPLY_BIT          (1 << 3)
53
54 /** ioctl parameter for LNet fault simulation */
55 struct lnet_fault_attr {
56         /**
57          * source NID of drop rule
58          * LNET_NID_ANY is wildcard for all sources
59          * 255.255.255.255@net is wildcard for all addresses from @net
60          */
61         lnet_nid_t                      fa_src;
62         /** destination NID of drop rule, see \a dr_src for details */
63         lnet_nid_t                      fa_dst;
64         /**
65          * Portal mask to drop, -1 means all portals, for example:
66          * fa_ptl_mask = (1 << _LDLM_CB_REQUEST_PORTAL ) |
67          *               (1 << LDLM_CANCEL_REQUEST_PORTAL)
68          *
69          * If it is non-zero then only PUT and GET will be filtered, otherwise
70          * there is no portal filter, all matched messages will be checked.
71          */
72         __u64                           fa_ptl_mask;
73         /**
74          * message types to drop, for example:
75          * dra_type = LNET_DROP_ACK_BIT | LNET_DROP_PUT_BIT
76          *
77          * If it is non-zero then only specified message types are filtered,
78          * otherwise all message types will be checked.
79          */
80         __u32                           fa_msg_mask;
81         union {
82                 /** message drop simulation */
83                 struct {
84                         /** drop rate of this rule */
85                         __u32                   da_rate;
86                         /**
87                          * time interval of message drop, it is exclusive
88                          * with da_rate
89                          */
90                         __u32                   da_interval;
91                 } drop;
92                 /** message latency simulation */
93                 struct {
94                         __u32                   la_rate;
95                         /**
96                          * time interval of message delay, it is exclusive
97                          * with la_rate
98                          */
99                         __u32                   la_interval;
100                         /** latency to delay */
101                         __u32                   la_latency;
102                 } delay;
103                 __u64                   space[8];
104         } u;
105
106 };
107
108 /** fault simluation stats */
109 struct lnet_fault_stat {
110         /** total # matched messages */
111         __u64                           fs_count;
112         /** # dropped LNET_MSG_PUT by this rule */
113         __u64                           fs_put;
114         /** # dropped LNET_MSG_ACK by this rule */
115         __u64                           fs_ack;
116         /** # dropped LNET_MSG_GET by this rule */
117         __u64                           fs_get;
118         /** # dropped LNET_MSG_REPLY by this rule */
119         __u64                           fs_reply;
120         union {
121                 struct {
122                         /** total # dropped messages */
123                         __u64                   ds_dropped;
124                 } drop;
125                 struct {
126                         /** total # delayed messages */
127                         __u64                   ls_delayed;
128                 } delay;
129                 __u64                   space[8];
130         } u;
131 };
132
133 /** @} lnet_fault_simulation */
134
135 #define LNET_DEV_ID     0
136 #define LNET_DEV_PATH   "/dev/lnet"
137
138 #endif