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