4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as
8 * published by the Free Software Foundation; either version 2.1 of the
9 * License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful, but
12 * 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.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
21 * Copyright (c) 2013, Intel Corporation.
24 * Amir Shehata <amir.shehata@intel.com>
27 #ifndef LIB_LUSTRE_CONFIG_API_H
28 #define LIB_LUSTRE_CONFIG_API_H
30 #define LUSTRE_CFG_RC_NO_ERR 0
31 #define LUSTRE_CFG_RC_BAD_PARAM -1
32 #define LUSTRE_CFG_RC_MISSING_PARAM -2
33 #define LUSTRE_CFG_RC_OUT_OF_RANGE_PARAM -3
34 #define LUSTRE_CFG_RC_OUT_OF_MEM -4
35 #define LUSTRE_CFG_RC_GENERIC_ERR -5
37 /* forward declaration of the cYAML structure. */
41 * lustre_lnet_config_lib_init()
42 * Initialize the Library to enable communication with the LNET kernel
43 * module. Returns the device ID or -EINVAL if there is an error
45 int lustre_lnet_config_lib_init();
48 * lustre_lnet_config_ni_system
49 * Initialize/Uninitialize the lnet NI system.
51 * up - whehter to init or uninit the system
52 * load_ni_from_mod - load NI from mod params.
53 * seq_no - sequence number of the request
54 * err_rc - [OUT] struct cYAML tree describing the error. Freed by
57 int lustre_lnet_config_ni_system(bool up, bool load_ni_from_mod,
58 int seq_no, struct cYAML **err_rc);
61 * lustre_lnet_config_route
62 * Send down an IOCTL to the kernel to configure the route
66 * hops - number of hops passed down by the user
67 * prio - priority of the route
68 * seq_no - sequence number of the request
69 * err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
71 int lustre_lnet_config_route(char *nw, char *gw, int hops, int prio,
72 int seq_no, struct cYAML **err_rc);
75 * lustre_lnet_del_route
76 * Send down an IOCTL to the kernel to delete a route
80 * seq_no - sequence number of the request
81 * err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
83 int lustre_lnet_del_route(char *nw, char *gw, int seq_no,
84 struct cYAML **err_rc);
87 * lustre_lnet_show_route
88 * Send down an IOCTL to the kernel to show routes
89 * This function will get one route at a time and filter according to
90 * provided parameters. If no routes are available then it will dump all
91 * routes that are in the system.
93 * nw - network. Optional. Used to filter output
94 * gw - gateway. Optional. Used to filter ouptut
95 * hops - number of hops passed down by the user
96 * Optional. Used to filter output.
97 * prio - priority of the route. Optional. Used to filter output.
98 * detail - flag to indicate whether detail output is required
99 * seq_no - sequence number of the request
100 * show_rc - [OUT] The show output in YAML. Must be freed by caller.
101 * err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
103 int lustre_lnet_show_route(char *nw, char *gw,
104 int hops, int prio, int detail,
105 int seq_no, struct cYAML **show_rc,
106 struct cYAML **err_rc);
109 * lustre_lnet_config_net
110 * Send down an IOCTL to configure a network.
112 * net - the network name
113 * intf - the interface of the network of the form net_name(intf)
114 * ip2net - this parameter allows configuring multiple networks.
115 * it takes precedence over the net and intf parameters
116 * peer_to - peer timeout
117 * peer_cr - peer credit
118 * peer_buf_cr - peer buffer credits
119 * - the above are LND tunable parameters and are optional
120 * credits - network interface credits
122 * seq_no - sequence number of the request
123 * err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
125 int lustre_lnet_config_net(char *net, char *intf, char *ip2net,
126 int peer_to, int peer_cr, int peer_buf_cr,
127 int credits, char *smp, int seq_no,
128 struct cYAML **err_rc);
131 * lustre_lnet_del_net
132 * Send down an IOCTL to delete a network.
134 * nw - network to delete.
135 * seq_no - sequence number of the request
136 * err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
138 int lustre_lnet_del_net(char *nw, int seq_no,
139 struct cYAML **err_rc);
142 * lustre_lnet_show_net
143 * Send down an IOCTL to show networks.
144 * This function will use the nw paramter to filter the output. If it's
145 * not provided then all networks are listed.
147 * nw - network to show. Optional. Used to filter output.
148 * detail - flag to indicate if we require detail output.
149 * seq_no - sequence number of the request
150 * show_rc - [OUT] The show output in YAML. Must be freed by caller.
151 * err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
153 int lustre_lnet_show_net(char *nw, int detail, int seq_no,
154 struct cYAML **show_rc, struct cYAML **err_rc);
157 * lustre_lnet_enable_routing
158 * Send down an IOCTL to enable or diable routing
160 * enable - 1 to enable routing, 0 to disable routing
161 * seq_no - sequence number of the request
162 * err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
164 int lustre_lnet_enable_routing(int enable, int seq_no,
165 struct cYAML **err_rc);
168 * lustre_lnet_config_buffers
169 * Send down an IOCTL to configure routing buffer sizes. A value of 0 means
170 * default that particular buffer to default size. A value of -1 means
171 * leave the value of the buffer un changed.
173 * tiny - tiny buffers
174 * small - small buffers
175 * large - large buffers.
176 * seq_no - sequence number of the request
177 * err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
179 int lustre_lnet_config_buffers(int tiny, int small, int large,
180 int seq_no, struct cYAML **err_rc);
183 * lustre_lnet_show_routing
184 * Send down an IOCTL to dump buffers and routing status
185 * This function is used to dump buffers for all CPU partitions.
187 * seq_no - sequence number of the request
188 * show_rc - [OUT] The show output in YAML. Must be freed by caller.
189 * err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
191 int lustre_lnet_show_routing(int seq_no, struct cYAML **show_rc,
192 struct cYAML **err_rc);
195 * lustre_lnet_show_peer_credits
196 * Shows credit details on the peers in the system
198 * seq_no - sequence number of the command
199 * show_rc - YAML structure of the resultant show
200 * err_rc - YAML strucutre of the resultant return code.
202 int lustre_lnet_show_peer_credits(int seq_no, struct cYAML **show_rc,
203 struct cYAML **err_rc);
206 * lustre_lnet_show_stats
207 * Shows internal LNET statistics. This is useful to display the
208 * current LNET activity, such as number of messages route, etc
210 * seq_no - sequence number of the command
211 * show_rc - YAML structure of the resultant show
212 * err_rc - YAML strucutre of the resultant return code.
214 int lustre_lnet_show_stats(int seq_no, struct cYAML **show_rc,
215 struct cYAML **err_rc);
219 * Parses the provided YAML file and then calls the specific APIs
220 * to configure the entities identified in the file
223 * err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
225 int lustre_yaml_config(char *f, struct cYAML **err_rc);
229 * Parses the provided YAML file and then calls the specific APIs
230 * to delete the entities identified in the file
233 * err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
235 int lustre_yaml_del(char *f, struct cYAML **err_rc);
239 * Parses the provided YAML file and then calls the specific APIs
240 * to show the entities identified in the file
243 * show_rc - [OUT] The show output in YAML. Must be freed by caller.
244 * err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
246 int lustre_yaml_show(char *f, struct cYAML **show_rc,
247 struct cYAML **err_rc);
249 #endif /* LIB_LUSTRE_CONFIG_API_H */