Whamcloud - gitweb
52d0c812000f41632e7e669e162fc3ff98a910fa
[fs/lustre-release.git] / lnet / include / uapi / linux / lnet / lnet-dlc.h
1 /*
2  * LGPL HEADER START
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library.
18  *
19  * LGPL HEADER END
20  *
21  */
22 /*
23  * Copyright (c) 2014, 2017, Intel Corporation.
24  */
25 /*
26  * Author: Amir Shehata <amir.shehata@intel.com>
27  */
28
29 #ifndef __UAPI_LNET_DLC_H_
30 #define __UAPI_LNET_DLC_H_
31
32 /*
33  * This is due to us being out of kernel and the way the OpenSFS branch
34  * handles CFLAGS.
35  */
36 #ifdef __KERNEL__
37 # include <uapi/linux/lnet/libcfs_ioctl.h>
38 # include <uapi/linux/lnet/lnet-types.h>
39 #else
40 # include <linux/lnet/libcfs_ioctl.h>
41 # include <linux/lnet/lnet-types.h>
42 #endif
43
44 #define MAX_NUM_SHOW_ENTRIES    32
45 #define LNET_MAX_STR_LEN        128
46 #define LNET_MAX_SHOW_NUM_CPT   128
47 #define LNET_MAX_SHOW_NUM_NID   128
48 #define LNET_UNDEFINED_HOPS     ((__u32) -1)
49
50 /*
51  * To allow for future enhancements to extend the tunables
52  * add a hdr to this structure, so that the version can be set
53  * and checked for backwards compatibility. Newer versions of LNet
54  * can still work with older versions of lnetctl. The restriction is
55  * that the structure can be added to and not removed from in order
56  * to not invalidate older lnetctl utilities. Moreover, the order of
57  * fields must remain the same, and new fields appended to the structure
58  *
59  * That said all existing LND tunables will be added in this structure
60  * to avoid future changes.
61  */
62 struct lnet_ioctl_config_lnd_cmn_tunables {
63         __u32 lct_version;
64         __s32 lct_peer_timeout;
65         __s32 lct_peer_tx_credits;
66         __s32 lct_peer_rtr_credits;
67         __s32 lct_max_tx_credits;
68 };
69
70 struct lnet_ioctl_config_o2iblnd_tunables {
71         __u32 lnd_version;
72         __u32 lnd_peercredits_hiw;
73         __u32 lnd_map_on_demand;
74         __u32 lnd_concurrent_sends;
75         __u32 lnd_fmr_pool_size;
76         __u32 lnd_fmr_flush_trigger;
77         __u32 lnd_fmr_cache;
78         __u16 lnd_conns_per_peer;
79         __u16 lnd_ntx;
80 };
81
82 struct lnet_lnd_tunables {
83         union {
84                 struct lnet_ioctl_config_o2iblnd_tunables lnd_o2ib;
85         } lnd_tun_u;
86 };
87
88 struct lnet_ioctl_config_lnd_tunables {
89         struct lnet_ioctl_config_lnd_cmn_tunables lt_cmn;
90         struct lnet_lnd_tunables lt_tun;
91 };
92
93 struct lnet_ioctl_net_config {
94         char ni_interfaces[LNET_INTERFACES_NUM][LNET_MAX_STR_LEN];
95         __u32 ni_status;
96         __u32 ni_cpts[LNET_MAX_SHOW_NUM_CPT];
97         char cfg_bulk[0];
98 };
99
100 #define LNET_TINY_BUF_IDX       0
101 #define LNET_SMALL_BUF_IDX      1
102 #define LNET_LARGE_BUF_IDX      2
103
104 /* # different router buffer pools */
105 #define LNET_NRBPOOLS           (LNET_LARGE_BUF_IDX + 1)
106
107 struct lnet_ioctl_pool_cfg {
108         struct {
109                 __u32 pl_npages;
110                 __u32 pl_nbuffers;
111                 __u32 pl_credits;
112                 __u32 pl_mincredits;
113         } pl_pools[LNET_NRBPOOLS];
114         __u32 pl_routing;
115 };
116
117 struct lnet_ioctl_ping_data {
118         struct libcfs_ioctl_hdr ping_hdr;
119
120         __u32 op_param;
121         __u32 ping_count;
122         __u32 ping_flags;
123         bool mr_info;
124         struct lnet_process_id ping_id;
125         struct lnet_process_id __user *ping_buf;
126 };
127
128 struct lnet_ioctl_config_data {
129         struct libcfs_ioctl_hdr cfg_hdr;
130
131         __u32 cfg_net;
132         __u32 cfg_count;
133         __u64 cfg_nid;
134         __u32 cfg_ncpts;
135
136         union {
137                 struct {
138                         __u32 rtr_hop;
139                         __u32 rtr_priority;
140                         __u32 rtr_flags;
141                 } cfg_route;
142                 struct {
143                         char net_intf[LNET_MAX_STR_LEN];
144                         __s32 net_peer_timeout;
145                         __s32 net_peer_tx_credits;
146                         __s32 net_peer_rtr_credits;
147                         __s32 net_max_tx_credits;
148                         __u32 net_cksum_algo;
149                         __u32 net_interface_count;
150                 } cfg_net;
151                 struct {
152                         __u32 buf_enable;
153                         __s32 buf_tiny;
154                         __s32 buf_small;
155                         __s32 buf_large;
156                 } cfg_buffers;
157         } cfg_config_u;
158
159         char cfg_bulk[0];
160 };
161
162 struct lnet_ioctl_comm_count {
163         __u32 ico_get_count;
164         __u32 ico_put_count;
165         __u32 ico_reply_count;
166         __u32 ico_ack_count;
167         __u32 ico_hello_count;
168 };
169
170 struct lnet_ioctl_element_stats {
171         __u32 iel_send_count;
172         __u32 iel_recv_count;
173         __u32 iel_drop_count;
174 };
175
176 enum lnet_health_type {
177         LNET_HEALTH_TYPE_LOCAL_NI = 0,
178         LNET_HEALTH_TYPE_PEER_NI,
179 };
180
181 struct lnet_ioctl_local_ni_hstats {
182         struct libcfs_ioctl_hdr hlni_hdr;
183         lnet_nid_t hlni_nid;
184         __u32 hlni_local_interrupt;
185         __u32 hlni_local_dropped;
186         __u32 hlni_local_aborted;
187         __u32 hlni_local_no_route;
188         __u32 hlni_local_timeout;
189         __u32 hlni_local_error;
190         __s32 hlni_health_value;
191 };
192
193 struct lnet_ioctl_peer_ni_hstats {
194         __u32 hlpni_remote_dropped;
195         __u32 hlpni_remote_timeout;
196         __u32 hlpni_remote_error;
197         __u32 hlpni_network_timeout;
198         __s32 hlpni_health_value;
199 };
200
201 struct lnet_ioctl_element_msg_stats {
202         struct libcfs_ioctl_hdr im_hdr;
203         __u32 im_idx;
204         struct lnet_ioctl_comm_count im_send_stats;
205         struct lnet_ioctl_comm_count im_recv_stats;
206         struct lnet_ioctl_comm_count im_drop_stats;
207 };
208
209 /*
210  * lnet_ioctl_config_ni
211  *  This structure describes an NI configuration. There are multiple components
212  *  when configuring an NI: Net, Interfaces, CPT list and LND tunables
213  *  A network is passed as a string to the DLC and translated using
214  *  libcfs_str2net()
215  *  An interface is the name of the system configured interface
216  *  (ex eth0, ib1)
217  *  CPT is the list of CPTS LND tunables are passed in the lic_bulk area
218  */
219 struct lnet_ioctl_config_ni {
220         struct libcfs_ioctl_hdr lic_cfg_hdr;
221         lnet_nid_t              lic_nid;
222         char                    lic_ni_intf[LNET_INTERFACES_NUM][LNET_MAX_STR_LEN];
223         char                    lic_legacy_ip2nets[LNET_MAX_STR_LEN];
224         __u32                   lic_cpts[LNET_MAX_SHOW_NUM_CPT];
225         __u32                   lic_ncpts;
226         __u32                   lic_status;
227         __u32                   lic_tcp_bonding;
228         __u32                   lic_idx;
229         __s32                   lic_dev_cpt;
230         char                    pad[4];
231         char                    lic_bulk[0];
232 };
233
234 struct lnet_peer_ni_credit_info {
235         char cr_aliveness[LNET_MAX_STR_LEN];
236         __u32 cr_refcount;
237         __s32 cr_ni_peer_tx_credits;
238         __s32 cr_peer_tx_credits;
239         __s32 cr_peer_min_tx_credits;
240         __u32 cr_peer_tx_qnob;
241         __s32 cr_peer_rtr_credits;
242         __s32 cr_peer_min_rtr_credits;
243         __u32 cr_ncpt;
244 };
245
246 struct lnet_ioctl_peer {
247         struct libcfs_ioctl_hdr pr_hdr;
248         __u32 pr_count;
249         __u32 pr_pad;
250         lnet_nid_t pr_nid;
251
252         union {
253                 struct lnet_peer_ni_credit_info  pr_peer_credits;
254         } pr_lnd_u;
255 };
256
257 struct lnet_ioctl_peer_cfg {
258         struct libcfs_ioctl_hdr prcfg_hdr;
259         lnet_nid_t prcfg_prim_nid;
260         lnet_nid_t prcfg_cfg_nid;
261         __u32 prcfg_count;
262         bool prcfg_mr;
263         __u32 prcfg_state;
264         __u32 prcfg_size;
265         void __user *prcfg_bulk;
266 };
267
268 struct lnet_ioctl_reset_health_cfg {
269         struct libcfs_ioctl_hdr rh_hdr;
270         enum lnet_health_type rh_type;
271         bool rh_all;
272         int rh_value;
273         lnet_nid_t rh_nid;
274 };
275
276 struct lnet_ioctl_recovery_list {
277         struct libcfs_ioctl_hdr rlst_hdr;
278         enum lnet_health_type rlst_type;
279         int rlst_num_nids;
280         lnet_nid_t rlst_nid_array[LNET_MAX_SHOW_NUM_NID];
281 };
282
283 struct lnet_ioctl_set_value {
284         struct libcfs_ioctl_hdr sv_hdr;
285         __u32 sv_value;
286 };
287
288 struct lnet_ioctl_lnet_stats {
289         struct libcfs_ioctl_hdr st_hdr;
290         struct lnet_counters st_cntrs;
291 };
292
293 #endif /* _LNET_DLC_H_ */