Whamcloud - gitweb
LU-8769 lnet: removal of obsolete LNDs
[fs/lustre-release.git] / lnet / include / lnet / lib-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 LNET_DLC_H
30 #define LNET_DLC_H
31
32 #include <libcfs/libcfs_ioctl.h>
33 #include <lnet/types.h>
34
35 #define MAX_NUM_SHOW_ENTRIES    32
36 #define LNET_MAX_STR_LEN        128
37 #define LNET_MAX_SHOW_NUM_CPT   128
38 #define LNET_UNDEFINED_HOPS     ((__u32) -1)
39
40 /*
41  * To allow for future enhancements to extend the tunables
42  * add a hdr to this structure, so that the version can be set
43  * and checked for backwards compatibility. Newer versions of LNet
44  * can still work with older versions of lnetctl. The restriction is
45  * that the structure can be added to and not removed from in order
46  * to not invalidate older lnetctl utilities. Moreover, the order of
47  * fields must remain the same, and new fields appended to the structure
48  *
49  * That said all existing LND tunables will be added in this structure
50  * to avoid future changes.
51  */
52 struct lnet_ioctl_config_lnd_cmn_tunables {
53         __u32 lct_version;
54         __s32 lct_peer_timeout;
55         __s32 lct_peer_tx_credits;
56         __s32 lct_peer_rtr_credits;
57         __s32 lct_max_tx_credits;
58 };
59
60 struct lnet_ioctl_config_o2iblnd_tunables {
61         __u32 lnd_version;
62         __u32 lnd_peercredits_hiw;
63         __u32 lnd_map_on_demand;
64         __u32 lnd_concurrent_sends;
65         __u32 lnd_fmr_pool_size;
66         __u32 lnd_fmr_flush_trigger;
67         __u32 lnd_fmr_cache;
68         __u32 pad;
69 };
70
71 struct lnet_lnd_tunables {
72         union {
73                 struct lnet_ioctl_config_o2iblnd_tunables lnd_o2ib;
74         } lnd_tun_u;
75 };
76
77 struct lnet_ioctl_config_lnd_tunables {
78         struct lnet_ioctl_config_lnd_cmn_tunables lt_cmn;
79         struct lnet_lnd_tunables lt_tun;
80 };
81
82 struct lnet_ioctl_net_config {
83         char ni_interfaces[LNET_MAX_INTERFACES][LNET_MAX_STR_LEN];
84         __u32 ni_status;
85         __u32 ni_cpts[LNET_MAX_SHOW_NUM_CPT];
86         char cfg_bulk[0];
87 };
88
89 #define LNET_TINY_BUF_IDX       0
90 #define LNET_SMALL_BUF_IDX      1
91 #define LNET_LARGE_BUF_IDX      2
92
93 /* # different router buffer pools */
94 #define LNET_NRBPOOLS           (LNET_LARGE_BUF_IDX + 1)
95
96 enum lnet_dbg_task {
97         LNET_DBG_INCR_DLC_SEQ = 0
98 };
99
100 struct lnet_ioctl_pool_cfg {
101         struct {
102                 __u32 pl_npages;
103                 __u32 pl_nbuffers;
104                 __u32 pl_credits;
105                 __u32 pl_mincredits;
106         } pl_pools[LNET_NRBPOOLS];
107         __u32 pl_routing;
108 };
109
110 struct lnet_ioctl_config_data {
111         struct libcfs_ioctl_hdr cfg_hdr;
112
113         __u32 cfg_net;
114         __u32 cfg_count;
115         __u64 cfg_nid;
116         __u32 cfg_ncpts;
117
118         union {
119                 struct {
120                         __u32 rtr_hop;
121                         __u32 rtr_priority;
122                         __u32 rtr_flags;
123                 } cfg_route;
124                 struct {
125                         char net_intf[LNET_MAX_STR_LEN];
126                         __s32 net_peer_timeout;
127                         __s32 net_peer_tx_credits;
128                         __s32 net_peer_rtr_credits;
129                         __s32 net_max_tx_credits;
130                         __u32 net_cksum_algo;
131                         __u32 net_interface_count;
132                 } cfg_net;
133                 struct {
134                         __u32 buf_enable;
135                         __s32 buf_tiny;
136                         __s32 buf_small;
137                         __s32 buf_large;
138                 } cfg_buffers;
139         } cfg_config_u;
140
141         char cfg_bulk[0];
142 };
143
144 struct lnet_ioctl_element_stats {
145         __u32   send_count;
146         __u32   recv_count;
147         __u32   drop_count;
148 };
149
150 /*
151  * lnet_ioctl_config_ni
152  *  This structure describes an NI configuration. There are multiple components
153  *  when configuring an NI: Net, Interfaces, CPT list and LND tunables
154  *  A network is passed as a string to the DLC and translated using
155  *  libcfs_str2net()
156  *  An interface is the name of the system configured interface
157  *  (ex eth0, ib1)
158  *  CPT is the list of CPTS LND tunables are passed in the lic_bulk area
159  */
160 struct lnet_ioctl_config_ni {
161         struct libcfs_ioctl_hdr lic_cfg_hdr;
162         lnet_nid_t              lic_nid;
163         char                    lic_ni_intf[LNET_MAX_INTERFACES][LNET_MAX_STR_LEN];
164         char                    lic_legacy_ip2nets[LNET_MAX_STR_LEN];
165         __u32                   lic_cpts[LNET_MAX_SHOW_NUM_CPT];
166         __u32                   lic_ncpts;
167         __u32                   lic_status;
168         __u32                   lic_tcp_bonding;
169         __u32                   lic_idx;
170         __s32                   lic_dev_cpt;
171         char                    pad[4];
172         char                    lic_bulk[0];
173 };
174
175 struct lnet_peer_ni_credit_info {
176         char cr_aliveness[LNET_MAX_STR_LEN];
177         __u32 cr_refcount;
178         __s32 cr_ni_peer_tx_credits;
179         __s32 cr_peer_tx_credits;
180         __s32 cr_peer_min_tx_credits;
181         __u32 cr_peer_tx_qnob;
182         __s32 cr_peer_rtr_credits;
183         __s32 cr_peer_min_rtr_credits;
184         __u32 cr_ncpt;
185 };
186
187 struct lnet_ioctl_peer {
188         struct libcfs_ioctl_hdr pr_hdr;
189         __u32 pr_count;
190         __u32 pr_pad;
191         lnet_nid_t pr_nid;
192
193         union {
194                 struct lnet_peer_ni_credit_info  pr_peer_credits;
195         } pr_lnd_u;
196 };
197
198 struct lnet_dbg_task_info {
199         /*
200          * TODO: a union can be added if the task requires more
201          * information from user space to be carried out in kernel space.
202          */
203 };
204
205 /*
206  * This structure is intended to allow execution of debugging tasks. This
207  * is not intended to be backwards compatible. Extra tasks can be added in
208  * the future
209  */
210 struct lnet_ioctl_dbg {
211         struct libcfs_ioctl_hdr dbg_hdr;
212         enum lnet_dbg_task dbg_task;
213         char dbg_bulk[0];
214 };
215
216 struct lnet_ioctl_peer_cfg {
217         struct libcfs_ioctl_hdr prcfg_hdr;
218         lnet_nid_t prcfg_prim_nid;
219         lnet_nid_t prcfg_cfg_nid;
220         __u32 prcfg_idx;
221         bool prcfg_mr;
222         char prcfg_bulk[0];
223 };
224
225 struct lnet_ioctl_numa_range {
226         struct libcfs_ioctl_hdr nr_hdr;
227         __u32 nr_range;
228 };
229
230 struct lnet_ioctl_lnet_stats {
231         struct libcfs_ioctl_hdr st_hdr;
232         struct lnet_counters st_cntrs;
233 };
234
235 #endif /* LNET_DLC_H */