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