Whamcloud - gitweb
LU-7734 lnet: configure local NI from DLC
[fs/lustre-release.git] / lnet / utils / lnetconfig / liblnetconfig.h
index 38dce8c..8eebfc2 100644 (file)
 #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/libcfs_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;
@@ -47,6 +64,12 @@ 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.
  *
@@ -108,39 +131,36 @@ int lustre_lnet_show_route(char *nw, char *gw,
                           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 lnet_ioctl_config_lnd_tunables *lnd_tunables,
-                          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
@@ -289,4 +309,34 @@ int lustre_yaml_del(char *f, struct cYAML **err_rc);
 int lustre_yaml_show(char *f, struct cYAML **show_rc,
                     struct cYAML **err_rc);
 
+/*
+ * 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_send_dbg_task
+ *     send a debug task to be carried out in the kernel. This API will
+ *     not be exposed to the user through lnetctl utility. It can only be
+ *     executed by being called directly.
+ *             dbg_task: The task to be carried out
+ *             dbg_info: task specific information
+ */
+int lustre_lnet_send_dbg_task(enum lnet_dbg_task dbg_task,
+                             struct lnet_dbg_task_info *dbg_info,
+                             struct cYAML **show_rc,
+                             struct cYAML **err_rc);
+
 #endif /* LIB_LNET_CONFIG_API_H */