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