#ifndef LIB_LNET_CONFIG_API_H
#define LIB_LNET_CONFIG_API_H
+#include <errno.h>
#include <net/if.h>
+#include <stdbool.h>
+#include <sys/socket.h>
+#include <yaml.h>
+#include <netlink/netlink.h>
+#include <netlink/genl/genl.h>
+#include <netlink/genl/ctrl.h>
+
+#include <libcfs/util/ioctl.h>
#include <libcfs/util/string.h>
#include <linux/lnet/lnet-dlc.h>
#include <linux/lnet/nidstr.h>
struct cfs_expr_list *global_cpts,
char *ip2net,
struct lnet_ioctl_config_lnd_tunables *tunables,
- int seq_no, struct cYAML **err_rc);
+ long int cpp, int seq_no, struct cYAML **err_rc);
/*
* lustre_lnet_del_ni
int lustre_lnet_config_ni_healthv(int value, bool all, char *ni_nid,
int seq_no, struct cYAML **err_rc);
+
+/* lustre_lnet_config_ni_conns_per_peer
+ * set the conns_per_peer value of the NI. Valid range is specific to
+ * network type.
+ *
+ * value: conns_per_peer value to set.
+ * all: true to set all local NIs to that value.
+ * ni_nid: NI NID to set its conns_per_peer value. 'all' parameter always
+ * takes precedence
+ * seq_no - sequence number of the request
+ * err_rc - [OUT] struct cYAML tree describing the error. Freed by
+ * caller
+ */
+int lustre_lnet_config_ni_conns_per_peer(int value, bool all, char *ni_nid,
+ int seq_no, struct cYAML **err_rc);
+
/*
* lustre_lnet_config_peer_ni_healthv
* set the health value of the peer NI. -1 resets the value to maximum.
int lustre_lnet_calc_service_id(__u64 *service_id);
/*
+ * lustre_lnet_setup_mrrouting
+ * configure linux routing tables for tcp interfaces
+ *
+ * err_rc - [OUT] struct cYAML tree describing the error. Freed by
+ * caller
+ */
+int lustre_lnet_setup_mrrouting(struct cYAML **err_rc);
+
+/*
* lustre_lnet_config_discovery
* Enable or disable peer discovery. Peer discovery is enabled by default.
*
struct cYAML **err_rc);
/*
+ * lustre_lnet_reset_stats
+ * Resets internal LNET statistics.
+ *
+ * err_rc - YAML strucutre of the resultant return code.
+ */
+int lustre_lnet_reset_stats(int seq_no, struct cYAML **err_rc);
+
+/*
* lustre_lnet_modify_peer
* Handle a peer config or delete operation.
*
int lustre_yaml_exec(char *f, struct cYAML **show_rc,
struct cYAML **err_rc);
+/**
+ * yaml_emitter_set_output_netlink
+ *
+ * Special handling to integrate LNet handling into libyaml.
+ * This function sets up the ability to take the data stored in @emitter
+ * and formats into a netlink packet to send to the kernel.
+ *
+ * emitter - YAML emitter containing what the user specified
+ * nl - Netlink socket to be used by libyaml
+ * family - Netlink family
+ * version - notify kernel what version user land supports
+ * cmd - Netlink command to execute
+ * flags - Netlink flags
+ */
+int yaml_emitter_set_output_netlink(yaml_emitter_t *emitter, struct nl_sock *nl,
+ char *family, int version, int cmd,
+ int flags);
+
+/**
+ * yaml_parser_set_input_netlink
+ *
+ * Special handling to LNet handling into libyaml.
+ * This function sets up the ability to receive the Netlink data
+ * from the Linux kernel. That data is formated into a YAML document.
+ *
+ * parser - YAML parser that is used to present the data received
+ * from the kernel in Netlink format.
+ * nl - should be the Netlink socket receiving data from
+ * the kernel.
+ * stream - Handle the case of continuous data coming in.
+ */
+int yaml_parser_set_input_netlink(yaml_parser_t *parser, struct nl_sock *nl,
+ bool stream);
+
+/**
+ * yaml_parser_get_reader_error
+ *
+ * By default libyaml reports a generic write error. We need a way
+ * to report better parser errors so we can track down problems.
+ *
+ * parser - YAML parser that has reported an error.
+ */
+const char *yaml_parser_get_reader_error(yaml_parser_t *parser);
+
+/**
+ * yaml_parser_log_error
+ *
+ * Helper function to report the parser error to @log.
+ *
+ * parser - YAML parser that has reported an error.
+ * log - file descriptor to write the error message out to.
+ * errmsg - Special extra string to append to error message.
+ */
+void yaml_parser_log_error(yaml_parser_t *parser, FILE *log,
+ const char *errmsg);
+
+/**
+ * yaml_emitter_log_error
+ *
+ * Helper function to report the emitter error to @log.
+ *
+ * emitter - YAML emitter that has reported an error.
+ * log - file descriptor to write the error message out to.
+ */
+void yaml_emitter_log_error(yaml_emitter_t *emitter, FILE *log);
+
+
/*
* lustre_lnet_init_nw_descr
* initialize the network descriptor structure for use
union lnet_udsp_action *action, int idx,
int seq_no, struct cYAML **err_rc);
+/* lustre_lnet_del_udsp
+ * Delete a net selection policy.
+ * idx - the index to delete
+ * seq_no - sequence number of the request
+ * err_rc - [OUT] struct cYAML tree describing the error. Freed by
+ * caller
+ */
+int lustre_lnet_del_udsp(unsigned int idx, int seq_no, struct cYAML **err_rc);
+
+/* lustre_lnet_show_udsp
+ * show selection policy.
+ * idx - the index to show. -1 to show all policies
+ * seq_no - sequence number of the request
+ * err_rc - [IN/OUT] struct cYAML tree containing udsp info
+ * err_rc - [OUT] struct cYAML tree describing the error. Freed by
+ * caller
+ */
+int lustre_lnet_show_udsp(int idx, int seq_no, struct cYAML **show_rc,
+ struct cYAML **err_rc);
+
#endif /* LIB_LNET_CONFIG_API_H */