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