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) 2014, 2017, Intel Corporation.
24 * Amir Shehata <amir.shehata@intel.com>
27 #ifndef LIB_LNET_CONFIG_API_H
28 #define LIB_LNET_CONFIG_API_H
31 #include <libcfs/util/string.h>
32 #include <linux/lnet/lnet-dlc.h>
33 #include <linux/lnet/nidstr.h>
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
47 LNETCTL_CONFIG_CMD = 1,
48 LNETCTL_UNCONFIG_CMD = 2,
53 LNETCTL_MANAGE_CMD = 7,
58 * Max number of nids we'll configure for a single peer via a single DLC
61 #define LNET_MAX_NIDS_PER_PEER 128
63 struct lnet_dlc_network_descr {
64 struct list_head network_on_rule;
66 struct list_head nw_intflist;
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;
75 /* forward declaration of the cYAML structure. */
78 int tokenize_nidstr(char *nidstr, char *out[LNET_MAX_STR_LEN], char *err_str);
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
85 int lustre_lnet_config_lib_init();
88 * lustre_lnet_config_lib_uninit
89 * Uninitialize the DLC Library
91 void lustre_lnet_config_lib_uninit();
94 * lustre_lnet_config_ni_system
95 * Initialize/Uninitialize the lnet NI system.
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
103 int lustre_lnet_config_ni_system(bool up, bool load_ni_from_mod,
104 int seq_no, struct cYAML **err_rc);
107 * lustre_lnet_config_route
108 * Send down an IOCTL to the kernel to configure the route
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
118 int lustre_lnet_config_route(char *nw, char *gw, int hops, int prio,
119 int sen, int seq_no, struct cYAML **err_rc);
122 * lustre_lnet_del_route
123 * Send down an IOCTL to the kernel to delete a route
127 * seq_no - sequence number of the request
128 * err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
130 int lustre_lnet_del_route(char *nw, char *gw, int seq_no,
131 struct cYAML **err_rc);
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.
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
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);
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..
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
171 int lustre_lnet_config_ni(struct lnet_dlc_network_descr *nw_descr,
172 struct cfs_expr_list *global_cpts,
174 struct lnet_ioctl_config_lnd_tunables *tunables,
175 int seq_no, struct cYAML **err_rc);
179 * Send down an IOCTL to delete a network interface. It implicitly
180 * deletes a network if it becomes empty of nis
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
186 int lustre_lnet_del_ni(struct lnet_dlc_network_descr *nw,
187 int seq_no, struct cYAML **err_rc);
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.
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
203 int lustre_lnet_show_net(char *nw, int detail, int seq_no,
204 struct cYAML **show_rc, struct cYAML **err_rc,
208 * lustre_lnet_enable_routing
209 * Send down an IOCTL to enable or diable routing
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
215 int lustre_lnet_enable_routing(int enable, int seq_no,
216 struct cYAML **err_rc);
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.
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
232 int lustre_lnet_config_numa_range(int range, int seq_no,
233 struct cYAML **err_rc);
236 * lustre_lnet_show_num_range
237 * Get the currently set NUMA range
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
244 int lustre_lnet_show_numa_range(int seq_no, struct cYAML **show_rc,
245 struct cYAML **err_rc);
248 * lustre_lnet_config_ni_healthv
249 * set the health value of the NI. -1 resets the value to maximum.
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
255 * seq_no - sequence number of the request
256 * err_rc - [OUT] struct cYAML tree describing the error. Freed by
259 int lustre_lnet_config_ni_healthv(int value, bool all, char *ni_nid,
260 int seq_no, struct cYAML **err_rc);
263 * lustre_lnet_config_peer_ni_healthv
264 * set the health value of the peer NI. -1 resets the value to maximum.
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
270 * seq_no - sequence number of the request
271 * err_rc - [OUT] struct cYAML tree describing the error. Freed by
274 int lustre_lnet_config_peer_ni_healthv(int value, bool all, char *pni_nid,
275 int seq_no, struct cYAML **err_rc);
278 * lustre_lnet_config_recov_intrv
279 * set the recovery interval in seconds. That's the interval to ping an
280 * unhealthy interface.
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
287 int lustre_lnet_config_recov_intrv(int intrv, int seq_no, struct cYAML **err_rc);
290 * lustre_lnet_show_recov_intrv
291 * show the recovery interval set in the system
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
298 int lustre_lnet_show_recov_intrv(int seq_no, struct cYAML **show_rc,
299 struct cYAML **err_rc);
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
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
311 int lustre_lnet_config_rtr_sensitivity(int sen, int seq_no, struct cYAML **err_rc);
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
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
323 int lustre_lnet_config_hsensitivity(int sen, int seq_no, struct cYAML **err_rc);
326 * lustre_lnet_show_hsensitivity
327 * show the health sensitivity in the system
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
334 int lustre_lnet_show_hsensitivity(int seq_no, struct cYAML **show_rc,
335 struct cYAML **err_rc);
338 * lustre_lnet_show_rtr_sensitivity
339 * show the router sensitivity percentage in the system
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
346 int lustre_lnet_show_rtr_sensitivity(int seq_no, struct cYAML **show_rc,
347 struct cYAML **err_rc);
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.
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
359 int lustre_lnet_config_transaction_to(int timeout, int seq_no, struct cYAML **err_rc);
362 * lustre_lnet_show_transaction_to
363 * show the transaction timeout in the system
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
370 int lustre_lnet_show_transaction_to(int seq_no, struct cYAML **show_rc,
371 struct cYAML **err_rc);
374 * lustre_lnet_config_retry_count
375 * sets the maximum number of retries to resend a message
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
382 int lustre_lnet_config_retry_count(int count, int seq_no, struct cYAML **err_rc);
385 * lustre_lnet_show_retry_count
386 * show current maximum number of retries in the system
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
393 int lustre_lnet_show_retry_count(int seq_no, struct cYAML **show_rc,
394 struct cYAML **err_rc);
396 int lustre_lnet_show_local_ni_recovq(int seq_no, struct cYAML **show_rc,
397 struct cYAML **err_rc);
399 int lustre_lnet_show_peer_ni_recovq(int seq_no, struct cYAML **show_rc,
400 struct cYAML **err_rc);
403 * lustre_lnet_config_max_intf
404 * Sets the maximum number of interfaces per node. this tunable is
405 * primarily useful for sanity checks prior to allocating memory.
407 * max - maximum value to configure
408 * seq_no - sequence number of the request
409 * err_rc - [OUT] struct cYAML tree describing the error. Freed by
412 int lustre_lnet_config_max_intf(int max, int seq_no, struct cYAML **err_rc);
415 * lustre_lnet_show_max_intf
416 * show current maximum interface setting
418 * seq_no - sequence number of the request
419 * show_rc - [OUT] struct cYAML tree containing NUMA range info
420 * err_rc - [OUT] struct cYAML tree describing the error. Freed by
423 int lustre_lnet_show_max_intf(int seq_no, struct cYAML **show_rc,
424 struct cYAML **err_rc);
427 * lustre_lnet_config_discovery
428 * Enable or disable peer discovery. Peer discovery is enabled by default.
430 * enable - non-0 enables, 0 disables
431 * seq_no - sequence number of the request
432 * err_rc - [OUT] struct cYAML tree describing the error. Freed by
435 int lustre_lnet_config_discovery(int enable, int seq_no, struct cYAML **err_rc);
438 * lustre_lnet_show_discovery
439 * show current peer discovery setting
441 * seq_no - sequence number of the request
442 * show_rc - [OUT] struct cYAML tree containing NUMA range info
443 * err_rc - [OUT] struct cYAML tree describing the error. Freed by
446 int lustre_lnet_show_discovery(int seq_no, struct cYAML **show_rc,
447 struct cYAML **err_rc);
450 * lustre_lnet_config_drop_asym_route
451 * Drop or accept asymmetrical route messages. Accept by default.
453 * drop - non-0 drops, 0 accepts
454 * seq_no - sequence number of the request
455 * err_rc - [OUT] struct cYAML tree describing the error. Freed by
458 int lustre_lnet_config_drop_asym_route(int drop, int seq_no,
459 struct cYAML **err_rc);
462 * lustre_lnet_show_drop_asym_route
463 * show current drop asym route setting
465 * seq_no - sequence number of the request
466 * show_rc - [OUT] struct cYAML tree containing NUMA range info
467 * err_rc - [OUT] struct cYAML tree describing the error. Freed by
470 int lustre_lnet_show_drop_asym_route(int seq_no, struct cYAML **show_rc,
471 struct cYAML **err_rc);
474 * lustre_lnet_config_buffers
475 * Send down an IOCTL to configure routing buffer sizes. A value of 0 means
476 * default that particular buffer to default size. A value of -1 means
477 * leave the value of the buffer un changed.
479 * tiny - tiny buffers
480 * small - small buffers
481 * large - large buffers.
482 * seq_no - sequence number of the request
483 * err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
485 int lustre_lnet_config_buffers(int tiny, int small, int large,
486 int seq_no, struct cYAML **err_rc);
489 * lustre_lnet_show_routing
490 * Send down an IOCTL to dump buffers and routing status
491 * This function is used to dump buffers for all CPU partitions.
493 * seq_no - sequence number of the request
494 * show_rc - [OUT] The show output in YAML. Must be freed by caller.
495 * err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
496 * backup - true to output only what's necessary for reconfiguring
499 int lustre_lnet_show_routing(int seq_no, struct cYAML **show_rc,
500 struct cYAML **err_rc, bool backup);
503 * lustre_lnet_show_stats
504 * Shows internal LNET statistics. This is useful to display the
505 * current LNET activity, such as number of messages route, etc
507 * seq_no - sequence number of the command
508 * show_rc - YAML structure of the resultant show
509 * err_rc - YAML strucutre of the resultant return code.
511 int lustre_lnet_show_stats(int seq_no, struct cYAML **show_rc,
512 struct cYAML **err_rc);
515 * lustre_lnet_config_peer_nid
516 * Add a peer nid to a peer with primary nid pnid. If no pnid is given
517 * then the first nid in the nid list becomes the primary nid for
518 * a newly created peer.
519 * Otherwise if pnid is provided and it's unique then a new peer is
520 * created with pnid as the primary NID and the nids in the nid list as
522 * If any of the peers nids provided in with exception to the pnid is
523 * not unique the operation fails. Some peer nids might have already
524 * been added. It's the role of the caller of this API to remove the
525 * added NIDs if they wish.
527 * pnid - Primary NID of the peer
528 * nid - list of nids to add
529 * num_nids - number of nids in the nid array
530 * mr - true if this peer is MR capable.
531 * ip2nets - true if a list of nid expressions are given to configure
533 * seq_no - sequence number of the command
534 * err_rc - YAML strucutre of the resultant return code.
536 int lustre_lnet_config_peer_nid(char *pnid, char **nid, int num_nids,
537 bool mr, bool ip2nets, int seq_no,
538 struct cYAML **err_rc);
541 * lustre_lnet_config_peer_nidlist
542 * Add a peer NID to a peer with primary NID pnid. If a pnid is not provided
543 * then the first NID in the NID list becomes the primary NID for a newly
545 * Otherwise, if the provided primary NID is unique, then a new peer is
546 * created with this primary NID, and the NIDs in the NID list are added as
547 * secondary NIDs to this new peer.
548 * If any of the NIDs in the NID list are not unique then the operation
549 * fails. Some peer NIDs might have already been added. It's the responsibility
550 * of the caller of this API to remove the added NIDs if so desired.
552 * pnid - The desired primary NID of a new peer, or the primary NID of
554 * lnet_nidlist - List of LNet NIDs to add to the peer
555 * num_nids - The number of LNet NIDs in the lnet_nidlist array
556 * mr - Specifies whether this peer is MR capable.
557 * seq_no - sequence number of the command
558 * err_rc - YAML structure of the resultant return code
560 int lustre_lnet_config_peer_nidlist(char *pnid, lnet_nid_t *lnet_nidlist,
561 int num_nids, bool mr, int seq_no,
562 struct cYAML **err_rc);
565 * lustre_lnet_del_peer_nid
566 * Delete the nids given in the nid list from the peer with primary NID
567 * pnid. If pnid is NULL or it doesn't identify a peer the operation
568 * fails and no change happens to the system.
569 * The operation is aborted on the first NID that fails to be deleted.
571 * pnid - Primary NID of the peer
572 * nid - list of nids to add
573 * num_nids - number of nids in the nid array
574 * ip2nets - used to specify a range of nids
575 * seq_no - sequence number of the command
576 * err_rc - YAML strucutre of the resultant return code.
578 int lustre_lnet_del_peer_nid(char *pnid, char **nid, int num_nids,
579 bool ip2nets, int seq_no, struct cYAML **err_rc);
582 * lustre_lnet_del_peer_nidlist
583 * Delete the NIDs given in the NID list from the peer with the primary NID
584 * pnid. If pnid is NULL, or it doesn't identify a peer, the operation fails,
585 * and no change happens to the system.
586 * The operation is aborted on the first NID that fails to be deleted.
588 * pnid - The primary NID of the peer to be modified
589 * lnet_nidlist - The list of LNet NIDs to delete from the peer
590 * num_nids - the number of nids in the lnet_nidlist array
591 * seq_no - sequence number of the command
592 * err_rc - YAML structure of the resultant return code
594 int lustre_lnet_del_peer_nidlist(char *pnid, lnet_nid_t *lnet_nidlist,
595 int num_nids, int seq_no,
596 struct cYAML **err_rc);
598 * lustre_lnet_show_peer
599 * Show the peer identified by nid, knid. If knid is NULL all
600 * peers in the system are shown.
602 * knid - A NID of the peer
603 * detail - display detailed information
604 * seq_no - sequence number of the command
605 * show_rc - YAML structure of the resultant show
606 * err_rc - YAML strucutre of the resultant return code.
607 * backup - true to output only what's necessary for reconfiguring
611 int lustre_lnet_show_peer(char *knid, int detail, int seq_no,
612 struct cYAML **show_rc, struct cYAML **err_rc,
616 * lustre_lnet_list_peer
617 * List the known peers.
619 * seq_no - sequence number of the command
620 * show_rc - YAML structure of the resultant show
621 * err_rc - YAML strucutre of the resultant return code.
624 int lustre_lnet_list_peer(int seq_no,
625 struct cYAML **show_rc, struct cYAML **err_rc);
627 /* lustre_lnet_ping_nid
628 * Ping the nid list, pnids.
630 * pnids - NID list to ping.
631 * timeout - timeout(seconds) for ping.
632 * seq_no - sequence number of the command.
633 * show_rc - YAML structure of the resultant show.
634 * err_rc - YAML strucutre of the resultant return code.
637 int lustre_lnet_ping_nid(char *pnid, int timeout, int seq_no,
638 struct cYAML **show_rc, struct cYAML **err_rc);
640 /* lustre_lnet_discover_nid
641 * Discover the nid list, pnids.
643 * pnids - NID list to discover.
644 * force - force discovery.
645 * seq_no - sequence number of the command.
646 * show_rc - YAML structure of the resultant show.
647 * err_rc - YAML strucutre of the resultant return code.
650 int lustre_lnet_discover_nid(char *pnid, int force, int seq_no,
651 struct cYAML **show_rc, struct cYAML **err_rc);
655 * Parses the provided YAML file and then calls the specific APIs
656 * to configure the entities identified in the file
659 * err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
661 int lustre_yaml_config(char *f, struct cYAML **err_rc);
665 * Parses the provided YAML file and then calls the specific APIs
666 * to delete the entities identified in the file
669 * err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
671 int lustre_yaml_del(char *f, struct cYAML **err_rc);
675 * Parses the provided YAML file and then calls the specific APIs
676 * to show the entities identified in the file
679 * show_rc - [OUT] The show output in YAML. Must be freed by caller.
680 * err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
682 int lustre_yaml_show(char *f, struct cYAML **show_rc,
683 struct cYAML **err_rc);
687 * Parses the provided YAML file and then calls the specific APIs
688 * to execute the entities identified in the file
691 * show_rc - [OUT] The show output in YAML. Must be freed by caller.
692 * err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
694 int lustre_yaml_exec(char *f, struct cYAML **show_rc,
695 struct cYAML **err_rc);
698 * lustre_lnet_init_nw_descr
699 * initialize the network descriptor structure for use
701 void lustre_lnet_init_nw_descr(struct lnet_dlc_network_descr *nw_descr);
704 * lustre_lnet_parse_interfaces
705 * prase an interface string and populate descriptor structures
706 * intf_str - interface string of the format
707 * <intf>[<expr>], <intf>[<expr>],..
708 * nw_descr - network descriptor to populate
709 * init - True to initialize nw_descr
711 int lustre_lnet_parse_interfaces(char *intf_str,
712 struct lnet_dlc_network_descr *nw_descr);
715 * lustre_lnet_parse_nidstr
716 * This is a small wrapper around cfs_parse_nidlist.
717 * nidstr - A string parseable by cfs_parse_nidlist
718 * lnet_nidlist - An array of lnet_nid_t to hold the nids specified
720 * max_nids - Size of the lnet_nidlist array, and the maximum number of
721 * nids that can be expressed by the nidstring. If the
722 * nidstring expands to a larger number of nids than max_nids
723 * then an error is returned.
724 * err_str - char pointer where we store an informative error
725 * message when an error is encountered
727 * The number (> 0) of lnet_nid_t stored in the supplied array, or
728 * LUSTRE_CFG_RC_BAD_PARAM if:
730 * - nidstr contains an asterisk. This character is not allowed
731 * because it would cause the size of the expanded nidlist to exceed
732 * the maximum number of nids that is supported by expected callers
734 * - cfs_parse_nidlist fails to parse the nidstring
735 * - The nidlist populated by cfs_parse_nidlist is empty
736 * - The nidstring expands to a larger number of nids than max_nids
737 * - The nidstring expands to zero nids
738 * LUSTRE_CFG_RC_OUT_OF_MEM if:
739 * - cfs_expand_nidlist can return ENOMEM. We return out of mem in
742 int lustre_lnet_parse_nidstr(char *nidstr, lnet_nid_t *lnet_nidlist,
743 int max_nids, char *err_str);
746 * lustre_lnet_parse_nids
747 * Parse a set of nids into a locally allocated array and return the
748 * pointer of the array to the caller. The caller is responsible for
749 * freeing the array. If an initial array is provided then copy over
750 * the contents of that array into the new array and append to it the
752 * The nids can be of the form "nid [,nid, nid, nid]"
753 * nids: nids string to be parsed
754 * array: initial array of content
755 * size: num of elements in the array
756 * out_array: [OUT] new allocated array.
757 * Returns size of array
758 * sets the out_array to NULL on failure.
760 int lustre_lnet_parse_nids(char *nids, char **array, int size,
763 #endif /* LIB_LNET_CONFIG_API_H */