*
* LGPL HEADER END
*
- * Copyright (c) 2014, Intel Corporation.
+ * Copyright (c) 2014, 2016, Intel Corporation.
*
* Author:
* Amir Shehata <amir.shehata@intel.com>
*/
-#ifndef LIB_LUSTRE_CONFIG_API_H
-#define LIB_LUSTRE_CONFIG_API_H
+#ifndef LIB_LNET_CONFIG_API_H
+#define LIB_LNET_CONFIG_API_H
+
+#include <lnet/lnet.h>
#define LUSTRE_CFG_RC_NO_ERR 0
#define LUSTRE_CFG_RC_BAD_PARAM -1
#define LUSTRE_CFG_RC_OUT_OF_RANGE_PARAM -3
#define LUSTRE_CFG_RC_OUT_OF_MEM -4
#define LUSTRE_CFG_RC_GENERIC_ERR -5
+#define LUSTRE_CFG_RC_NO_MATCH -6
+#define LUSTRE_CFG_RC_MATCH -7
+
+#include <lnet/lnet.h>
+#include <libcfs/util/string.h>
+
+struct lnet_dlc_network_descr {
+ struct list_head network_on_rule;
+ __u32 nw_id;
+ struct list_head nw_intflist;
+};
+
+struct lnet_dlc_intf_descr {
+ struct list_head intf_on_network;
+ char intf_name[LNET_MAX_STR_LEN];
+ struct cfs_expr_list *cpt_expr;
+};
/* forward declaration of the cYAML structure. */
struct cYAML;
int lustre_lnet_config_lib_init();
/*
+ * lustre_lnet_config_lib_uninit
+ * Uninitialize the DLC Library
+ */
+void lustre_lnet_config_lib_uninit();
+
+/*
* lustre_lnet_config_ni_system
* Initialize/Uninitialize the lnet NI system.
*
struct cYAML **err_rc);
/*
- * lustre_lnet_config_net
- * Send down an IOCTL to configure a network.
+ * lustre_lnet_config_ni
+ * Send down an IOCTL to configure a network interface. It implicitly
+ * creates a network if one doesn't exist..
*
- * net - the network name
- * intf - the interface of the network of the form net_name(intf)
+ * nw_descr - network and interface descriptor
+ * global_cpts - globally defined CPTs
* ip2net - this parameter allows configuring multiple networks.
* it takes precedence over the net and intf parameters
- * peer_to - peer timeout
- * peer_cr - peer credit
- * peer_buf_cr - peer buffer credits
- * - the above are LND tunable parameters and are optional
- * credits - network interface credits
- * smp - cpu affinity
+ * tunables - LND tunables
* seq_no - sequence number of the request
+ * lnd_tunables - lnet specific tunable parameters
* err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
*/
-int lustre_lnet_config_net(char *net, char *intf, char *ip2net,
- int peer_to, int peer_cr, int peer_buf_cr,
- int credits, char *smp, int seq_no,
- struct cYAML **err_rc);
+int lustre_lnet_config_ni(struct lnet_dlc_network_descr *nw_descr,
+ struct cfs_expr_list *global_cpts,
+ char *ip2net,
+ struct lnet_ioctl_config_lnd_tunables *tunables,
+ int seq_no, struct cYAML **err_rc);
/*
- * lustre_lnet_del_net
- * Send down an IOCTL to delete a network.
+ * lustre_lnet_del_ni
+ * Send down an IOCTL to delete a network interface. It implicitly
+ * deletes a network if it becomes empty of nis
*
- * nw - network to delete.
+ * nw - network and interface list
* seq_no - sequence number of the request
* err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
*/
-int lustre_lnet_del_net(char *nw, int seq_no,
- struct cYAML **err_rc);
+int lustre_lnet_del_ni(struct lnet_dlc_network_descr *nw,
+ int seq_no, struct cYAML **err_rc);
/*
* lustre_lnet_show_net
struct cYAML **err_rc);
/*
+ * lustre_lnet_config_numa_range
+ * Set the NUMA range which impacts the NIs to be selected
+ * during sending. If the NUMA range is large the NUMA
+ * distance between the message memory and the NI becomes
+ * less significant. The NUMA range is a relative number
+ * with no other meaning besides allowing a wider breadth
+ * for picking an NI to send from.
+ *
+ * range - numa range value.
+ * seq_no - sequence number of the request
+ * err_rc - [OUT] struct cYAML tree describing the error. Freed by
+ * caller
+ */
+int lustre_lnet_config_numa_range(int range, int seq_no,
+ struct cYAML **err_rc);
+
+/*
+ * lustre_lnet_show_num_range
+ * Get the currently set NUMA range
+ *
+ * seq_no - sequence number of the request
+ * show_rc - [OUT] struct cYAML tree containing NUMA range info
+ * err_rc - [OUT] struct cYAML tree describing the error. Freed by
+ * caller
+ */
+int lustre_lnet_show_numa_range(int seq_no, struct cYAML **show_rc,
+ struct cYAML **err_rc);
+
+/*
* lustre_lnet_config_buffers
* Send down an IOCTL to configure routing buffer sizes. A value of 0 means
* default that particular buffer to default size. A value of -1 means
struct cYAML **err_rc);
/*
- * lustre_lnet_show_peer_credits
- * Shows credit details on the peers in the system
+ * lustre_lnet_show_stats
+ * Shows internal LNET statistics. This is useful to display the
+ * current LNET activity, such as number of messages route, etc
*
* seq_no - sequence number of the command
* show_rc - YAML structure of the resultant show
* err_rc - YAML strucutre of the resultant return code.
*/
-int lustre_lnet_show_peer_credits(int seq_no, struct cYAML **show_rc,
- struct cYAML **err_rc);
+int lustre_lnet_show_stats(int seq_no, struct cYAML **show_rc,
+ struct cYAML **err_rc);
/*
- * lustre_lnet_show_stats
- * Shows internal LNET statistics. This is useful to display the
- * current LNET activity, such as number of messages route, etc
+ * lustre_lnet_config_peer_nid
+ * Add a peer nid to a peer with primary nid pnid. If no pnid is given
+ * then the first nid in the nid list becomes the primary nid for
+ * a newly created peer.
+ * Otherwise if pnid is provided and it's unique then a new peer is
+ * created with pnid as the primary NID and the nids in the nid list as
+ * secondary nids.
+ * If any of the peers nids provided in with exception to the pnid is
+ * not unique the operation fails. Some peer nids might have already
+ * been added. It's the role of the caller of this API to remove the
+ * added NIDs if they wish.
+ *
+ * pnid - Primary NID of the peer
+ * nid - list of nids to add
+ * num_nids - number of nids in the nid array
+ * mr - true if this peer is MR capable.
+ * seq_no - sequence number of the command
+ * err_rc - YAML strucutre of the resultant return code.
+ */
+int lustre_lnet_config_peer_nid(char *pnid, char **nid, int num_nids,
+ bool mr, int seq_no, struct cYAML **err_rc);
+
+/*
+ * lustre_lnet_del_peer_nid
+ * Delete the nids given in the nid list from the peer with primary NID
+ * pnid. If pnid is NULL or it doesn't identify a peer the operation
+ * fails and no change happens to the system.
+ * The operation is aborted on the first NID that fails to be deleted.
*
+ * pnid - Primary NID of the peer
+ * nid - list of nids to add
+ * num_nids - number of nids in the nid array
+ * seq_no - sequence number of the command
+ * err_rc - YAML strucutre of the resultant return code.
+ */
+int lustre_lnet_del_peer_nid(char *pnid, char **nid, int num_nids,
+ int seq_no, struct cYAML **err_rc);
+
+/*
+ * lustre_lnet_show_peer
+ * Show the peer identified by nid, knid. If knid is NULL all
+ * peers in the system are shown.
+ *
+ * knid - A NID of the peer
+ * detail - display detailed information
* seq_no - sequence number of the command
* show_rc - YAML structure of the resultant show
* err_rc - YAML strucutre of the resultant return code.
+ *
*/
-int lustre_lnet_show_stats(int seq_no, struct cYAML **show_rc,
- struct cYAML **err_rc);
+int lustre_lnet_show_peer(char *knid, int detail, int seq_no,
+ struct cYAML **show_rc, struct cYAML **err_rc);
/*
* lustre_yaml_config
int lustre_yaml_show(char *f, struct cYAML **show_rc,
struct cYAML **err_rc);
-#endif /* LIB_LUSTRE_CONFIG_API_H */
+/*
+ * lustre_lnet_init_nw_descr
+ * initialize the network descriptor structure for use
+ */
+void lustre_lnet_init_nw_descr(struct lnet_dlc_network_descr *nw_descr);
+
+/*
+ * lustre_lnet_parse_interfaces
+ * prase an interface string and populate descriptor structures
+ * intf_str - interface string of the format
+ * <intf>[<expr>], <intf>[<expr>],..
+ * nw_descr - network descriptor to populate
+ * init - True to initialize nw_descr
+ */
+int lustre_lnet_parse_interfaces(char *intf_str,
+ struct lnet_dlc_network_descr *nw_descr);
+
+/*
+ * lustre_lnet_parse_nids
+ * Parse a set of nids into a locally allocated array and return the
+ * pointer of the array to the caller. The caller is responsible for
+ * freeing the array. If an initial array is provided then copy over
+ * the contents of that array into the new array and append to it the
+ * new content.
+ * The nids can be of the form "nid [,nid, nid, nid]"
+ * nids: nids string to be parsed
+ * array: initial array of content
+ * size: num of elements in the array
+ * out_array: [OUT] new allocated array.
+ * Returns size of array
+ * sets the out_array to NULL on failure.
+ */
+int lustre_lnet_parse_nids(char *nids, char **array, int size,
+ char ***out_array);
+
+#endif /* LIB_LNET_CONFIG_API_H */