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