Whamcloud - gitweb
a5cecda921f25066cb6d3c6ad285725a78376727
[fs/lustre-release.git] / lnet / utils / lnetconfig / liblnetconfig.h
1 /*
2  * LGPL HEADER START
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
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.
10  *
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.
15  *
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/>.
18  *
19  * LGPL HEADER END
20  *
21  * Copyright (c) 2014, 2017, Intel Corporation.
22  *
23  * Author:
24  *   Amir Shehata <amir.shehata@intel.com>
25  */
26
27 #ifndef LIB_LNET_CONFIG_API_H
28 #define LIB_LNET_CONFIG_API_H
29
30 #include <net/if.h>
31 #include <libcfs/util/string.h>
32 #include <linux/lnet/lnet-dlc.h>
33 #include <linux/lnet/nidstr.h>
34
35 #define LUSTRE_CFG_RC_NO_ERR                     0
36 #define LUSTRE_CFG_RC_BAD_PARAM                 -1
37 #define LUSTRE_CFG_RC_MISSING_PARAM             -2
38 #define LUSTRE_CFG_RC_OUT_OF_RANGE_PARAM        -3
39 #define LUSTRE_CFG_RC_OUT_OF_MEM                -4
40 #define LUSTRE_CFG_RC_GENERIC_ERR               -5
41 #define LUSTRE_CFG_RC_NO_MATCH                  -6
42 #define LUSTRE_CFG_RC_MATCH                     -7
43 #define LUSTRE_CFG_RC_SKIP                      -8
44 #define LUSTRE_CFG_RC_LAST_ELEM                 -9
45
46 struct lnet_dlc_network_descr {
47         struct list_head network_on_rule;
48         __u32 nw_id;
49         struct list_head nw_intflist;
50 };
51
52 struct lnet_dlc_intf_descr {
53         struct list_head intf_on_network;
54         char intf_name[IFNAMSIZ];
55         struct cfs_expr_list *cpt_expr;
56 };
57
58 /* forward declaration of the cYAML structure. */
59 struct cYAML;
60
61 /*
62  * lustre_lnet_config_lib_init()
63  *   Initialize the Library to enable communication with the LNET kernel
64  *   module.  Returns the device ID or -EINVAL if there is an error
65  */
66 int lustre_lnet_config_lib_init();
67
68 /*
69  * lustre_lnet_config_lib_uninit
70  *      Uninitialize the DLC Library
71  */
72 void lustre_lnet_config_lib_uninit();
73
74 /*
75  * lustre_lnet_config_ni_system
76  *   Initialize/Uninitialize the lnet NI system.
77  *
78  *   up - whehter to init or uninit the system
79  *   load_ni_from_mod - load NI from mod params.
80  *   seq_no - sequence number of the request
81  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by
82  *            caller
83  */
84 int lustre_lnet_config_ni_system(bool up, bool load_ni_from_mod,
85                                  int seq_no, struct cYAML **err_rc);
86
87 /*
88  * lustre_lnet_config_route
89  *   Send down an IOCTL to the kernel to configure the route
90  *
91  *   nw - network
92  *   gw - gateway
93  *   hops - number of hops passed down by the user
94  *   prio - priority of the route
95  *   sen - health sensitivity value for the gateway
96  *   seq_no - sequence number of the request
97  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
98  */
99 int lustre_lnet_config_route(char *nw, char *gw, int hops, int prio,
100                              int sen, int seq_no, struct cYAML **err_rc);
101
102 /*
103  * lustre_lnet_del_route
104  *   Send down an IOCTL to the kernel to delete a route
105  *
106  *   nw - network
107  *   gw - gateway
108  *   seq_no - sequence number of the request
109  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
110  */
111 int lustre_lnet_del_route(char *nw, char *gw, int seq_no,
112                           struct cYAML **err_rc);
113
114 /*
115  * lustre_lnet_show_route
116  *   Send down an IOCTL to the kernel to show routes
117  *   This function will get one route at a time and filter according to
118  *   provided parameters. If no routes are available then it will dump all
119  *   routes that are in the system.
120  *
121  *   nw - network.  Optional.  Used to filter output
122  *   gw - gateway. Optional. Used to filter ouptut
123  *   hops - number of hops passed down by the user
124  *          Optional.  Used to filter output.
125  *   prio - priority of the route.  Optional.  Used to filter output.
126  *   detail - flag to indicate whether detail output is required
127  *   seq_no - sequence number of the request
128  *   show_rc - [OUT] The show output in YAML.  Must be freed by caller.
129  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
130  *   backup - true to output only what's necessary for reconfiguring
131  *            a node.
132  */
133 int lustre_lnet_show_route(char *nw, char *gw,
134                            int hops, int prio, int detail,
135                            int seq_no, struct cYAML **show_rc,
136                            struct cYAML **err_rc, bool backup);
137
138 /*
139  * lustre_lnet_config_ni
140  *   Send down an IOCTL to configure a network interface. It implicitly
141  *   creates a network if one doesn't exist..
142  *
143  *   nw_descr - network and interface descriptor
144  *   global_cpts - globally defined CPTs
145  *   ip2net - this parameter allows configuring multiple networks.
146  *      it takes precedence over the net and intf parameters
147  *   tunables - LND tunables
148  *   seq_no - sequence number of the request
149  *   lnd_tunables - lnet specific tunable parameters
150  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
151  */
152 int lustre_lnet_config_ni(struct lnet_dlc_network_descr *nw_descr,
153                           struct cfs_expr_list *global_cpts,
154                           char *ip2net,
155                           struct lnet_ioctl_config_lnd_tunables *tunables,
156                           int seq_no, struct cYAML **err_rc);
157
158 /*
159  * lustre_lnet_del_ni
160  *   Send down an IOCTL to delete a network interface. It implicitly
161  *   deletes a network if it becomes empty of nis
162  *
163  *   nw  - network and interface list
164  *   seq_no - sequence number of the request
165  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
166  */
167 int lustre_lnet_del_ni(struct lnet_dlc_network_descr *nw,
168                        int seq_no, struct cYAML **err_rc);
169
170 /*
171  * lustre_lnet_show_net
172  *   Send down an IOCTL to show networks.
173  *   This function will use the nw paramter to filter the output.  If it's
174  *   not provided then all networks are listed.
175  *
176  *   nw - network to show.  Optional.  Used to filter output.
177  *   detail - flag to indicate if we require detail output.
178  *   seq_no - sequence number of the request
179  *   show_rc - [OUT] The show output in YAML.  Must be freed by caller.
180  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
181  *   backup - true to output only what's necessary for reconfiguring
182  *            a node.
183  */
184 int lustre_lnet_show_net(char *nw, int detail, int seq_no,
185                          struct cYAML **show_rc, struct cYAML **err_rc,
186                          bool backup);
187
188 /*
189  * lustre_lnet_enable_routing
190  *   Send down an IOCTL to enable or diable routing
191  *
192  *   enable - 1 to enable routing, 0 to disable routing
193  *   seq_no - sequence number of the request
194  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
195  */
196 int lustre_lnet_enable_routing(int enable, int seq_no,
197                                struct cYAML **err_rc);
198
199 /*
200  * lustre_lnet_config_numa_range
201  *   Set the NUMA range which impacts the NIs to be selected
202  *   during sending. If the NUMA range is large the NUMA
203  *   distance between the message memory and the NI becomes
204  *   less significant. The NUMA range is a relative number
205  *   with no other meaning besides allowing a wider breadth
206  *   for picking an NI to send from.
207  *
208  *   range - numa range value.
209  *   seq_no - sequence number of the request
210  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by
211  *   caller
212  */
213 int lustre_lnet_config_numa_range(int range, int seq_no,
214                                   struct cYAML **err_rc);
215
216 /*
217  * lustre_lnet_show_num_range
218  *   Get the currently set NUMA range
219  *
220  *   seq_no - sequence number of the request
221  *   show_rc - [OUT] struct cYAML tree containing NUMA range info
222  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by
223  *   caller
224  */
225 int lustre_lnet_show_numa_range(int seq_no, struct cYAML **show_rc,
226                                 struct cYAML **err_rc);
227
228 /*
229  * lustre_lnet_config_ni_healthv
230  *   set the health value of the NI. -1 resets the value to maximum.
231  *
232  *   value: health value to set.
233  *   all: true to set all local NIs to that value.
234  *   ni_nid: NI NID to set its health value. all parameter always takes
235  *   precedence
236  *   seq_no - sequence number of the request
237  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by
238  *   caller
239  */
240 int lustre_lnet_config_ni_healthv(int value, bool all, char *ni_nid,
241                                   int seq_no, struct cYAML **err_rc);
242
243 /*
244  * lustre_lnet_config_peer_ni_healthv
245  *   set the health value of the peer NI. -1 resets the value to maximum.
246  *
247  *   value: health value to set.
248  *   all: true to set all local NIs to that value.
249  *   pni_nid: Peer NI NID to set its health value. all parameter always takes
250  *   precedence
251  *   seq_no - sequence number of the request
252  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by
253  *   caller
254  */
255 int lustre_lnet_config_peer_ni_healthv(int value, bool all, char *pni_nid,
256                                        int seq_no, struct cYAML **err_rc);
257
258 /*
259  * lustre_lnet_config_recov_intrv
260  *   set the recovery interval in seconds. That's the interval to ping an
261  *   unhealthy interface.
262  *
263  *   intrv - recovery interval value to configure
264  *   seq_no - sequence number of the request
265  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by
266  *   caller
267  */
268 int lustre_lnet_config_recov_intrv(int intrv, int seq_no, struct cYAML **err_rc);
269
270 /*
271  * lustre_lnet_show_recov_intrv
272  *    show the recovery interval set in the system
273  *
274  *   seq_no - sequence number of the request
275  *   show_rc - [OUT] struct cYAML tree containing health sensitivity info
276  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by
277  *   caller
278  */
279 int lustre_lnet_show_recov_intrv(int seq_no, struct cYAML **show_rc,
280                                  struct cYAML **err_rc);
281
282 /*
283  * lustre_lnet_config_rtr_sensitivity
284  *   sets the router sensitivity percentage. If the percentage health
285  *   of a router interface drops below that it's considered failed
286  *
287  *   sen - sensitivity value to configure
288  *   seq_no - sequence number of the request
289  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by
290  *   caller
291  */
292 int lustre_lnet_config_rtr_sensitivity(int sen, int seq_no, struct cYAML **err_rc);
293
294 /*
295  * lustre_lnet_config_hsensitivity
296  *   sets the health sensitivity; the value by which to decrement the
297  *   health value of a local or peer NI. If 0 then health is turned off
298  *
299  *   sen - sensitivity value to configure
300  *   seq_no - sequence number of the request
301  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by
302  *   caller
303  */
304 int lustre_lnet_config_hsensitivity(int sen, int seq_no, struct cYAML **err_rc);
305
306 /*
307  * lustre_lnet_show_hsensitivity
308  *    show the health sensitivity in the system
309  *
310  *   seq_no - sequence number of the request
311  *   show_rc - [OUT] struct cYAML tree containing health sensitivity info
312  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by
313  *   caller
314  */
315 int lustre_lnet_show_hsensitivity(int seq_no, struct cYAML **show_rc,
316                                   struct cYAML **err_rc);
317
318 /*
319  * lustre_lnet_show_rtr_sensitivity
320  *    show the router sensitivity percentage in the system
321  *
322  *   seq_no - sequence number of the request
323  *   show_rc - [OUT] struct cYAML tree containing health sensitivity info
324  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by
325  *   caller
326  */
327 int lustre_lnet_show_rtr_sensitivity(int seq_no, struct cYAML **show_rc,
328                                      struct cYAML **err_rc);
329
330 /*
331  * lustre_lnet_config_transaction_to
332  *   sets the timeout after which a message expires or a timeout event is
333  *   propagated for an expired response.
334  *
335  *   timeout - timeout value to configure
336  *   seq_no - sequence number of the request
337  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by
338  *   caller
339  */
340 int lustre_lnet_config_transaction_to(int timeout, int seq_no, struct cYAML **err_rc);
341
342 /*
343  * lustre_lnet_show_transaction_to
344  *    show the transaction timeout in the system
345  *
346  *   seq_no - sequence number of the request
347  *   show_rc - [OUT] struct cYAML tree containing transaction timeout info
348  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by
349  *   caller
350  */
351 int lustre_lnet_show_transaction_to(int seq_no, struct cYAML **show_rc,
352                                     struct cYAML **err_rc);
353
354 /*
355  * lustre_lnet_config_retry_count
356  *   sets the maximum number of retries to resend a message
357  *
358  *   count - maximum value to configure
359  *   seq_no - sequence number of the request
360  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by
361  *   caller
362  */
363 int lustre_lnet_config_retry_count(int count, int seq_no, struct cYAML **err_rc);
364
365 /*
366  * lustre_lnet_show_retry_count
367  *    show current maximum number of retries in the system
368  *
369  *   seq_no - sequence number of the request
370  *   show_rc - [OUT] struct cYAML tree containing retry count info
371  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by
372  *   caller
373  */
374 int lustre_lnet_show_retry_count(int seq_no, struct cYAML **show_rc,
375                                  struct cYAML **err_rc);
376
377 int lustre_lnet_show_local_ni_recovq(int seq_no, struct cYAML **show_rc,
378                                      struct cYAML **err_rc);
379
380 int lustre_lnet_show_peer_ni_recovq(int seq_no, struct cYAML **show_rc,
381                                     struct cYAML **err_rc);
382
383 /*
384  * lustre_lnet_config_max_intf
385  *   Sets the maximum number of interfaces per node. this tunable is
386  *   primarily useful for sanity checks prior to allocating memory.
387  *
388  *   max - maximum value to configure
389  *   seq_no - sequence number of the request
390  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by
391  *   caller
392  */
393 int lustre_lnet_config_max_intf(int max, int seq_no, struct cYAML **err_rc);
394
395 /*
396  * lustre_lnet_show_max_intf
397  *    show current maximum interface setting
398  *
399  *   seq_no - sequence number of the request
400  *   show_rc - [OUT] struct cYAML tree containing NUMA range info
401  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by
402  *   caller
403  */
404 int lustre_lnet_show_max_intf(int seq_no, struct cYAML **show_rc,
405                               struct cYAML **err_rc);
406
407 /*
408  * lustre_lnet_config_discovery
409  *   Enable or disable peer discovery. Peer discovery is enabled by default.
410  *
411  *   enable - non-0 enables, 0 disables
412  *   seq_no - sequence number of the request
413  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by
414  *   caller
415  */
416 int lustre_lnet_config_discovery(int enable, int seq_no, struct cYAML **err_rc);
417
418 /*
419  * lustre_lnet_show_discovery
420  *    show current peer discovery setting
421  *
422  *   seq_no - sequence number of the request
423  *   show_rc - [OUT] struct cYAML tree containing NUMA range info
424  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by
425  *   caller
426  */
427 int lustre_lnet_show_discovery(int seq_no, struct cYAML **show_rc,
428                                struct cYAML **err_rc);
429
430 /*
431  * lustre_lnet_config_drop_asym_route
432  *   Drop or accept asymmetrical route messages. Accept by default.
433  *
434  *   drop - non-0 drops, 0 accepts
435  *   seq_no - sequence number of the request
436  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by
437  *   caller
438  */
439 int lustre_lnet_config_drop_asym_route(int drop, int seq_no,
440                                        struct cYAML **err_rc);
441
442 /*
443  * lustre_lnet_show_drop_asym_route
444  *    show current drop asym route setting
445  *
446  *   seq_no - sequence number of the request
447  *   show_rc - [OUT] struct cYAML tree containing NUMA range info
448  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by
449  *   caller
450  */
451 int lustre_lnet_show_drop_asym_route(int seq_no, struct cYAML **show_rc,
452                                      struct cYAML **err_rc);
453
454 /*
455  * lustre_lnet_config_buffers
456  *   Send down an IOCTL to configure routing buffer sizes.  A value of 0 means
457  *   default that particular buffer to default size. A value of -1 means
458  *   leave the value of the buffer un changed.
459  *
460  *   tiny - tiny buffers
461  *   small - small buffers
462  *   large - large buffers.
463  *   seq_no - sequence number of the request
464  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
465  */
466 int lustre_lnet_config_buffers(int tiny, int small, int large,
467                                int seq_no, struct cYAML **err_rc);
468
469 /*
470  * lustre_lnet_show_routing
471  *   Send down an IOCTL to dump buffers and routing status
472  *   This function is used to dump buffers for all CPU partitions.
473  *
474  *   seq_no - sequence number of the request
475  *   show_rc - [OUT] The show output in YAML.  Must be freed by caller.
476  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
477  *   backup - true to output only what's necessary for reconfiguring
478  *            a node.
479  */
480 int lustre_lnet_show_routing(int seq_no, struct cYAML **show_rc,
481                              struct cYAML **err_rc, bool backup);
482
483 /*
484  * lustre_lnet_show_stats
485  *   Shows internal LNET statistics.  This is useful to display the
486  *   current LNET activity, such as number of messages route, etc
487  *
488  *     seq_no - sequence number of the command
489  *     show_rc - YAML structure of the resultant show
490  *     err_rc - YAML strucutre of the resultant return code.
491  */
492 int lustre_lnet_show_stats(int seq_no, struct cYAML **show_rc,
493                            struct cYAML **err_rc);
494
495 /*
496  * lustre_lnet_config_peer_nid
497  *   Add a peer nid to a peer with primary nid pnid. If no pnid is given
498  *   then the first nid in the nid list becomes the primary nid for
499  *   a newly created peer.
500  *   Otherwise if pnid is provided and it's unique then a new peer is
501  *   created with pnid as the primary NID and the nids in the nid list as
502  *   secondary nids.
503  *   If any of the peers nids provided in with exception to the pnid is
504  *   not unique the operation fails. Some peer nids might have already
505  *   been added. It's the role of the caller of this API to remove the
506  *   added NIDs if they wish.
507  *
508  *     pnid - Primary NID of the peer
509  *     nid - list of nids to add
510  *     num_nids - number of nids in the nid array
511  *     mr - true if this peer is MR capable.
512  *     ip2nets - true if a list of nid expressions are given to configure
513  *     multiple peers
514  *     seq_no - sequence number of the command
515  *     err_rc - YAML strucutre of the resultant return code.
516  */
517 int lustre_lnet_config_peer_nid(char *pnid, char **nid, int num_nids,
518                                 bool mr, bool ip2nets, int seq_no,
519                                 struct cYAML **err_rc);
520
521 /*
522  * lustre_lnet_del_peer_nid
523  *  Delete the nids given in the nid list from the peer with primary NID
524  *  pnid. If pnid is NULL or it doesn't identify a peer the operation
525  *  fails and no change happens to the system.
526  *  The operation is aborted on the first NID that fails to be deleted.
527  *
528  *     pnid - Primary NID of the peer
529  *     nid - list of nids to add
530  *     num_nids - number of nids in the nid array
531  *     ip2nets - used to specify a range of nids
532  *     seq_no - sequence number of the command
533  *     err_rc - YAML strucutre of the resultant return code.
534  */
535 int lustre_lnet_del_peer_nid(char *pnid, char **nid, int num_nids,
536                              bool ip2nets, int seq_no, struct cYAML **err_rc);
537
538 /*
539  * lustre_lnet_show_peer
540  *   Show the peer identified by nid, knid. If knid is NULL all
541  *   peers in the system are shown.
542  *
543  *     knid - A NID of the peer
544  *     detail - display detailed information
545  *     seq_no - sequence number of the command
546  *     show_rc - YAML structure of the resultant show
547  *     err_rc - YAML strucutre of the resultant return code.
548  *     backup - true to output only what's necessary for reconfiguring
549  *              a node.
550  *
551  */
552 int lustre_lnet_show_peer(char *knid, int detail, int seq_no,
553                           struct cYAML **show_rc, struct cYAML **err_rc,
554                           bool backup);
555
556 /*
557  * lustre_lnet_list_peer
558  *   List the known peers.
559  *
560  *     seq_no - sequence number of the command
561  *     show_rc - YAML structure of the resultant show
562  *     err_rc - YAML strucutre of the resultant return code.
563  *
564  */
565 int lustre_lnet_list_peer(int seq_no,
566                           struct cYAML **show_rc, struct cYAML **err_rc);
567
568 /* lustre_lnet_ping_nid
569  *   Ping the nid list, pnids.
570  *
571  *    pnids - NID list to ping.
572  *    timeout - timeout(seconds) for ping.
573  *    seq_no - sequence number of the command.
574  *    show_rc - YAML structure of the resultant show.
575  *    err_rc - YAML strucutre of the resultant return code.
576  *
577  */
578 int lustre_lnet_ping_nid(char *pnid, int timeout, int seq_no,
579                         struct cYAML **show_rc, struct cYAML **err_rc);
580
581 /* lustre_lnet_discover_nid
582  *   Discover the nid list, pnids.
583  *
584  *    pnids - NID list to discover.
585  *    force - force discovery.
586  *    seq_no - sequence number of the command.
587  *    show_rc - YAML structure of the resultant show.
588  *    err_rc - YAML strucutre of the resultant return code.
589  *
590  */
591 int lustre_lnet_discover_nid(char *pnid, int force, int seq_no,
592                              struct cYAML **show_rc, struct cYAML **err_rc);
593
594 /*
595  * lustre_yaml_config
596  *   Parses the provided YAML file and then calls the specific APIs
597  *   to configure the entities identified in the file
598  *
599  *   f - YAML file
600  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
601  */
602 int lustre_yaml_config(char *f, struct cYAML **err_rc);
603
604 /*
605  * lustre_yaml_del
606  *   Parses the provided YAML file and then calls the specific APIs
607  *   to delete the entities identified in the file
608  *
609  *   f - YAML file
610  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
611  */
612 int lustre_yaml_del(char *f, struct cYAML **err_rc);
613
614 /*
615  * lustre_yaml_show
616  *   Parses the provided YAML file and then calls the specific APIs
617  *   to show the entities identified in the file
618  *
619  *   f - YAML file
620  *   show_rc - [OUT] The show output in YAML.  Must be freed by caller.
621  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
622  */
623 int lustre_yaml_show(char *f, struct cYAML **show_rc,
624                      struct cYAML **err_rc);
625
626 /*
627  * lustre_yaml_exec
628  *   Parses the provided YAML file and then calls the specific APIs
629  *   to execute the entities identified in the file
630  *
631  *   f - YAML file
632  *   show_rc - [OUT] The show output in YAML.  Must be freed by caller.
633  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
634  */
635 int lustre_yaml_exec(char *f, struct cYAML **show_rc,
636                      struct cYAML **err_rc);
637
638 /*
639  * lustre_lnet_init_nw_descr
640  *      initialize the network descriptor structure for use
641  */
642 void lustre_lnet_init_nw_descr(struct lnet_dlc_network_descr *nw_descr);
643
644 /*
645  * lustre_lnet_parse_interfaces
646  *      prase an interface string and populate descriptor structures
647  *              intf_str - interface string of the format
648  *                      <intf>[<expr>], <intf>[<expr>],..
649  *              nw_descr - network descriptor to populate
650  *              init - True to initialize nw_descr
651  */
652 int lustre_lnet_parse_interfaces(char *intf_str,
653                                  struct lnet_dlc_network_descr *nw_descr);
654
655 /*
656  * lustre_lnet_parse_nids
657  *      Parse a set of nids into a locally allocated array and return the
658  *      pointer of the array to the caller. The caller is responsible for
659  *      freeing the array. If an initial array is provided then copy over
660  *      the contents of that array into the new array and append to it the
661  *      new content.
662  *      The nids can be of the form "nid [,nid, nid, nid]"
663  *              nids: nids string to be parsed
664  *              array: initial array of content
665  *              size: num of elements in the array
666  *              out_array: [OUT] new allocated array.
667  *      Returns size of array
668  *              sets the out_array to NULL on failure.
669  */
670 int lustre_lnet_parse_nids(char *nids, char **array, int size,
671                            char ***out_array);
672
673 #endif /* LIB_LNET_CONFIG_API_H */