Whamcloud - gitweb
2b2c05fa3b0b25b89fbf1c72ee891f6ef244b992
[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 #include <linux/lnet/libcfs_ioctl.h>
34 #include <linux/lnet/lnet-types.h>
35
36 #define MAX_NUM_SHOW_ENTRIES    32
37 #define LNET_MAX_STR_LEN        128
38 #define LNET_MAX_SHOW_NUM_CPT   128
39 #define LNET_MAX_SHOW_NUM_NID   128
40 #define LNET_UNDEFINED_HOPS     ((__u32) -1)
41
42 #define LNET_RT_ALIVE           (1 << 0)
43 #define LNET_RT_MULTI_HOP       (1 << 1)
44
45 /*
46  * sparse kernel source annotations
47  */
48 #ifndef __user
49 #define __user
50 #endif
51
52 /*
53  * To allow for future enhancements to extend the tunables
54  * add a hdr to this structure, so that the version can be set
55  * and checked for backwards compatibility. Newer versions of LNet
56  * can still work with older versions of lnetctl. The restriction is
57  * that the structure can be added to and not removed from in order
58  * to not invalidate older lnetctl utilities. Moreover, the order of
59  * fields must remain the same, and new fields appended to the structure
60  *
61  * That said all existing LND tunables will be added in this structure
62  * to avoid future changes.
63  */
64 struct lnet_ioctl_config_lnd_cmn_tunables {
65         __u32 lct_version;
66         __s32 lct_peer_timeout;
67         __s32 lct_peer_tx_credits;
68         __s32 lct_peer_rtr_credits;
69         __s32 lct_max_tx_credits;
70 };
71
72 struct lnet_ioctl_config_o2iblnd_tunables {
73         __u32 lnd_version;
74         __u32 lnd_peercredits_hiw;
75         __u32 lnd_map_on_demand;
76         __u32 lnd_concurrent_sends;
77         __u32 lnd_fmr_pool_size;
78         __u32 lnd_fmr_flush_trigger;
79         __u32 lnd_fmr_cache;
80         __u16 lnd_conns_per_peer;
81         __u16 lnd_ntx;
82 };
83
84 struct lnet_ioctl_config_socklnd_tunables {
85         __u32 lnd_version;
86         __u16 lnd_conns_per_peer;
87         __u16 lnd_pad;
88 };
89
90 struct lnet_lnd_tunables {
91         union {
92                 struct lnet_ioctl_config_o2iblnd_tunables lnd_o2ib;
93                 struct lnet_ioctl_config_socklnd_tunables lnd_sock;
94         } lnd_tun_u;
95 };
96
97 struct lnet_ioctl_config_lnd_tunables {
98         struct lnet_ioctl_config_lnd_cmn_tunables lt_cmn;
99         struct lnet_lnd_tunables lt_tun;
100 };
101
102 struct lnet_ioctl_net_config {
103         char ni_interface[LNET_MAX_STR_LEN];
104         __u32 ni_status;
105         __u32 ni_cpts[LNET_MAX_SHOW_NUM_CPT];
106         char cfg_bulk[0];
107 };
108
109 #define LNET_TINY_BUF_IDX       0
110 #define LNET_SMALL_BUF_IDX      1
111 #define LNET_LARGE_BUF_IDX      2
112
113 /* # different router buffer pools */
114 #define LNET_NRBPOOLS           (LNET_LARGE_BUF_IDX + 1)
115
116 struct lnet_ioctl_pool_cfg {
117         struct {
118                 __u32 pl_npages;
119                 __u32 pl_nbuffers;
120                 __u32 pl_credits;
121                 __u32 pl_mincredits;
122         } pl_pools[LNET_NRBPOOLS];
123         __u32 pl_routing;
124 };
125
126 struct lnet_ioctl_ping_data {
127         struct libcfs_ioctl_hdr ping_hdr;
128
129         __u32 op_param;
130         __u32 ping_count;
131         __u32 ping_flags;
132         __u32 mr_info;
133         struct lnet_process_id ping_id;
134         struct lnet_process_id __user *ping_buf;
135         lnet_nid_t ping_src;
136 };
137
138 struct lnet_ioctl_config_data {
139         struct libcfs_ioctl_hdr cfg_hdr;
140
141         __u32 cfg_net;
142         __u32 cfg_count;
143         __u64 cfg_nid;
144         __u32 cfg_ncpts;
145
146         union {
147                 struct {
148                         __u32 rtr_hop;
149                         __u32 rtr_priority;
150                         __u32 rtr_flags;
151                         __u32 rtr_sensitivity;
152                 } cfg_route;
153                 struct {
154                         char net_intf[LNET_MAX_STR_LEN];
155                         __s32 net_peer_timeout;
156                         __s32 net_peer_tx_credits;
157                         __s32 net_peer_rtr_credits;
158                         __s32 net_max_tx_credits;
159                         __u32 net_cksum_algo;
160                         __u32 net_interface_count;
161                 } cfg_net;
162                 struct {
163                         __u32 buf_enable;
164                         __s32 buf_tiny;
165                         __s32 buf_small;
166                         __s32 buf_large;
167                 } cfg_buffers;
168         } cfg_config_u;
169
170         char cfg_bulk[0];
171 };
172
173 struct lnet_ioctl_comm_count {
174         __u32 ico_get_count;
175         __u32 ico_put_count;
176         __u32 ico_reply_count;
177         __u32 ico_ack_count;
178         __u32 ico_hello_count;
179 };
180
181 struct lnet_ioctl_element_stats {
182         __u32 iel_send_count;
183         __u32 iel_recv_count;
184         __u32 iel_drop_count;
185 };
186
187 enum lnet_health_type {
188         LNET_HEALTH_TYPE_LOCAL_NI = 0,
189         LNET_HEALTH_TYPE_PEER_NI,
190 };
191
192 struct lnet_ioctl_local_ni_hstats {
193         struct libcfs_ioctl_hdr hlni_hdr;
194         lnet_nid_t hlni_nid;
195         __u32 hlni_local_interrupt;
196         __u32 hlni_local_dropped;
197         __u32 hlni_local_aborted;
198         __u32 hlni_local_no_route;
199         __u32 hlni_local_timeout;
200         __u32 hlni_local_error;
201         __s32 hlni_fatal_error;
202         __s32 hlni_health_value;
203         __u32 hlni_ping_count;
204         __u64 hlni_next_ping;
205 };
206
207 struct lnet_ioctl_peer_ni_hstats {
208         __u32 hlpni_remote_dropped;
209         __u32 hlpni_remote_timeout;
210         __u32 hlpni_remote_error;
211         __u32 hlpni_network_timeout;
212         __s32 hlpni_health_value;
213         __u32 hlpni_ping_count;
214         __u64 hlpni_next_ping;
215 };
216
217 struct lnet_ioctl_element_msg_stats {
218         struct libcfs_ioctl_hdr im_hdr;
219         __u32 im_idx;
220         struct lnet_ioctl_comm_count im_send_stats;
221         struct lnet_ioctl_comm_count im_recv_stats;
222         struct lnet_ioctl_comm_count im_drop_stats;
223 };
224
225 /*
226  * lnet_ioctl_config_ni
227  *  This structure describes an NI configuration. There are multiple components
228  *  when configuring an NI: Net, Interfaces, CPT list and LND tunables
229  *  A network is passed as a string to the DLC and translated using
230  *  libcfs_str2net()
231  *  An interface is the name of the system configured interface
232  *  (ex eth0, ib1)
233  *  CPT is the list of CPTS LND tunables are passed in the lic_bulk area
234  */
235 struct lnet_ioctl_config_ni {
236         struct libcfs_ioctl_hdr lic_cfg_hdr;
237         lnet_nid_t              lic_nid;
238         char                    lic_ni_intf[LNET_MAX_STR_LEN];
239         char                    lic_legacy_ip2nets[LNET_MAX_STR_LEN];
240         __u32                   lic_cpts[LNET_MAX_SHOW_NUM_CPT];
241         __u32                   lic_ncpts;
242         __u32                   lic_status;
243         __u32                   lic_idx;
244         __s32                   lic_dev_cpt;
245         char                    pad[4];
246         char                    lic_bulk[0];
247 };
248
249 struct lnet_peer_ni_credit_info {
250         char cr_aliveness[LNET_MAX_STR_LEN];
251         __u32 cr_refcount;
252         __s32 cr_ni_peer_tx_credits;
253         __s32 cr_peer_tx_credits;
254         __s32 cr_peer_min_tx_credits;
255         __u32 cr_peer_tx_qnob;
256         __s32 cr_peer_rtr_credits;
257         __s32 cr_peer_min_rtr_credits;
258         __u32 cr_ncpt;
259 };
260
261 struct lnet_ioctl_peer {
262         struct libcfs_ioctl_hdr pr_hdr;
263         __u32 pr_count;
264         __u32 pr_pad;
265         lnet_nid_t pr_nid;
266
267         union {
268                 struct lnet_peer_ni_credit_info  pr_peer_credits;
269         } pr_lnd_u;
270 };
271
272 struct lnet_ioctl_peer_cfg {
273         struct libcfs_ioctl_hdr prcfg_hdr;
274         lnet_nid_t prcfg_prim_nid;
275         lnet_nid_t prcfg_cfg_nid;
276         __u32 prcfg_count;
277         __u32 prcfg_mr;
278         __u32 prcfg_state;
279         __u32 prcfg_size;
280         void __user *prcfg_bulk;
281 };
282
283 struct lnet_ioctl_reset_health_cfg {
284         struct libcfs_ioctl_hdr rh_hdr;
285         enum lnet_health_type rh_type:32;
286         __u16 rh_all:1;
287         __s16 rh_value;
288         lnet_nid_t rh_nid;
289 };
290
291 struct lnet_ioctl_reset_conns_per_peer_cfg {
292         struct libcfs_ioctl_hdr rcpp_hdr;
293         __u16 rcpp_all:1;
294         __s16 rcpp_value;
295         lnet_nid_t rcpp_nid;
296 };
297
298 struct lnet_ioctl_recovery_list {
299         struct libcfs_ioctl_hdr rlst_hdr;
300         enum lnet_health_type rlst_type:32;
301         __u32 rlst_num_nids;
302         lnet_nid_t rlst_nid_array[LNET_MAX_SHOW_NUM_NID];
303 };
304
305 struct lnet_ioctl_set_value {
306         struct libcfs_ioctl_hdr sv_hdr;
307         __u32 sv_value;
308 };
309
310 struct lnet_ioctl_lnet_stats {
311         struct libcfs_ioctl_hdr st_hdr;
312         struct lnet_counters st_cntrs;
313 };
314
315 /* An IP, numeric NID or a Net number is composed of 1 or more of these
316  * descriptor structures.
317  */
318 struct lnet_range_expr {
319         __u32 re_lo;
320         __u32 re_hi;
321         __u32 re_stride;
322 };
323
324 /* le_count identifies the number of lnet_range_expr in the bulk
325  * which follows
326  */
327 struct lnet_expressions {
328         __u32 le_count;
329 };
330
331 /* A net descriptor has the net type, IE: O2IBLND, SOCKLND, etc and an
332  * expression describing a net number range.
333  */
334 struct lnet_ioctl_udsp_net_descr {
335         __u32 ud_net_type;
336         struct lnet_expressions ud_net_num_expr;
337 };
338
339 /* The UDSP descriptor header contains the type of matching criteria, SRC,
340  * DST, RTE, etc and how many lnet_expressions compose the LNet portion of
341  * the LNet NID. For example an IP can be
342  * composed of 4 lnet_expressions , a gni can be composed of 1
343  */
344 struct lnet_ioctl_udsp_descr_hdr {
345         /* The literals SRC, DST and RTE are encoded
346          * here.
347          */
348         __u32 ud_descr_type;
349         __u32 ud_descr_count;
350 };
351
352 /* each matching expression in the UDSP is described with this.
353  * The bulk format is as follows:
354  *      1. 1x struct lnet_ioctl_udsp_net_descr
355  *              -> the net part of the NID
356  *      2. >=0 struct lnet_expressions
357  *              -> the address part of the NID
358  */
359 struct lnet_ioctl_udsp_descr {
360         struct lnet_ioctl_udsp_descr_hdr iud_src_hdr;
361         struct lnet_ioctl_udsp_net_descr iud_net;
362 };
363
364 /* The cumulative UDSP descriptor
365  * The bulk format is as follows:
366  *      1. >=1 struct lnet_ioctl_udsp_descr
367  *
368  * The size indicated in iou_hdr is the total size of the UDSP.
369  *
370  */
371 struct lnet_ioctl_udsp {
372         struct libcfs_ioctl_hdr iou_hdr;
373         __s32 iou_idx;
374         __u32 iou_action_type;
375         __u32 iou_bulk_size;
376         union {
377                 __u32 priority;
378         } iou_action;
379         void __user *iou_bulk;
380 };
381
382 /* structure used to request udsp instantiation information on the
383  * specified construct.
384  *   cud_nid: the NID of the local or remote NI to pull info on.
385  *   cud_nid_priority: NID prio of the requested NID.
386  *   cud_net_priority: net prio of network of the requested NID.
387  *   cud_pref_nid: array of preferred NIDs if it exists.
388  */
389 struct lnet_ioctl_construct_udsp_info {
390         struct libcfs_ioctl_hdr cud_hdr;
391         __u32 cud_peer:1;
392         lnet_nid_t cud_nid;
393         __u32 cud_nid_priority;
394         __u32 cud_net_priority;
395         lnet_nid_t cud_pref_nid[LNET_MAX_SHOW_NUM_NID];
396         lnet_nid_t cud_pref_rtr_nid[LNET_MAX_SHOW_NUM_NID];
397 };
398
399 #endif /* _LNET_DLC_H_ */