#include <fcntl.h>
#include <ifaddrs.h>
#include "liblnetconfig.h"
-#include "cyaml.h"
#define CONFIG_CMD "configure"
#define UNCONFIG_CMD "unconfigure"
void lustre_lnet_init_nw_descr(struct lnet_dlc_network_descr *nw_descr)
{
if (nw_descr != NULL) {
+ nw_descr->nw_id = 0;
INIT_LIST_HEAD(&nw_descr->network_on_rule);
INIT_LIST_HEAD(&nw_descr->nw_intflist);
}
int lustre_lnet_config_lib_init(void)
{
- return register_ioc_dev(LNET_DEV_ID, LNET_DEV_PATH,
- LNET_DEV_MAJOR, LNET_DEV_MINOR);
+ return register_ioc_dev(LNET_DEV_ID, LNET_DEV_PATH);
}
void lustre_lnet_config_lib_uninit(void)
snprintf(err_str, sizeof(err_str), "\"success\"");
- if (ip2net == NULL && nw_descr == NULL) {
+ if (ip2net == NULL && (nw_descr == NULL || nw_descr->nw_id == 0 ||
+ list_empty(&nw_descr->nw_intflist))) {
snprintf(err_str,
sizeof(err_str),
- "\"mandatory parameters not specified.\"");
+ "\"missing mandatory parameters\"");
rc = LUSTRE_CFG_RC_MISSING_PARAM;
goto out;
}
snprintf(err_str, sizeof(err_str), "\"success\"");
- if (nw_descr == NULL) {
+ if (nw_descr == NULL || nw_descr->nw_id == 0 ||
+ list_empty(&nw_descr->nw_intflist)) {
snprintf(err_str,
sizeof(err_str),
"\"missing mandatory parameter\"");
peer_info.prcfg_mr ? "True" : "False")
== NULL)
goto out;
+ /*
+ * print out the state of the peer only if details are
+ * requested
+ */
+ if (detail >= 3) {
+ if (cYAML_create_number(peer, "peer state",
+ peer_info.prcfg_state)
+ == NULL)
+ goto out;
+ }
tmp = cYAML_create_seq(peer, "peer ni");
if (tmp == NULL)
show_rc, err_rc);
}
+static int handle_yaml_config_numa(struct cYAML *tree, struct cYAML **show_rc,
+ struct cYAML **err_rc)
+{
+ struct cYAML *seq_no, *range;
+
+ seq_no = cYAML_get_object_item(tree, "seq_no");
+ range = cYAML_get_object_item(tree, "range");
+
+ return lustre_lnet_config_numa_range(range ? range->cy_valueint : -1,
+ seq_no ? seq_no->cy_valueint : -1,
+ err_rc);
+}
+
+static int handle_yaml_del_numa(struct cYAML *tree, struct cYAML **show_rc,
+ struct cYAML **err_rc)
+{
+ struct cYAML *seq_no;
+
+ seq_no = cYAML_get_object_item(tree, "seq_no");
+
+ return lustre_lnet_config_numa_range(0, seq_no ? seq_no->cy_valueint : -1,
+ err_rc);
+}
+
+static int handle_yaml_show_numa(struct cYAML *tree, struct cYAML **show_rc,
+ struct cYAML **err_rc)
+{
+ struct cYAML *seq_no;
+
+ seq_no = cYAML_get_object_item(tree, "seq_no");
+
+ return lustre_lnet_show_numa_range(seq_no ? seq_no->cy_valueint : -1,
+ show_rc, err_rc);
+}
+
static int handle_yaml_config_global_settings(struct cYAML *tree,
struct cYAML **show_rc,
struct cYAML **err_rc)
{ .name = "buffers", .cb = handle_yaml_config_buffers },
{ .name = "statistics", .cb = handle_yaml_no_op },
{ .name = "global", .cb = handle_yaml_config_global_settings},
+ { .name = "numa", .cb = handle_yaml_config_numa },
{ .name = "ping", .cb = handle_yaml_no_op },
{ .name = "discover", .cb = handle_yaml_no_op },
{ .name = NULL } };
{ .name = "buffers", .cb = handle_yaml_no_op },
{ .name = "statistics", .cb = handle_yaml_no_op },
{ .name = "global", .cb = handle_yaml_del_global_settings},
+ { .name = "numa", .cb = handle_yaml_del_numa },
{ .name = "ping", .cb = handle_yaml_no_op },
{ .name = "discover", .cb = handle_yaml_no_op },
{ .name = NULL } };
{ .name = "buffers", .cb = handle_yaml_show_routing },
{ .name = "statistics", .cb = handle_yaml_show_stats },
{ .name = "global", .cb = handle_yaml_show_global_settings},
+ { .name = "numa", .cb = handle_yaml_show_numa },
{ .name = "ping", .cb = handle_yaml_no_op },
{ .name = "discover", .cb = handle_yaml_no_op },
{ .name = NULL } };
{ .name = "buffers", .cb = handle_yaml_no_op },
{ .name = "statistics", .cb = handle_yaml_no_op },
{ .name = "global", .cb = handle_yaml_no_op },
+ { .name = "numa", .cb = handle_yaml_no_op },
{ .name = "ping", .cb = handle_yaml_ping },
{ .name = "discover", .cb = handle_yaml_discover },
{ .name = NULL } };