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