+ rc = lustre_lnet_config_drop_asym_route(value, -1, &err_rc);
+ if (rc != LUSTRE_CFG_RC_NO_ERR)
+ cYAML_print_tree2file(stderr, err_rc);
+
+ cYAML_free_tree(err_rc);
+
+ return rc;
+}
+
+static int jt_set_tiny(int argc, char **argv)
+{
+ long int value;
+ int rc;
+ struct cYAML *err_rc = NULL;
+
+ rc = check_cmd(set_cmds, "set", "tiny_buffers", 2, argc, argv);
+ if (rc)
+ return rc;
+
+ rc = parse_long(argv[1], &value);
+ if (rc != 0) {
+ cYAML_build_error(-1, -1, "parser", "set",
+ "cannot parse tiny_buffers value", &err_rc);
+ cYAML_print_tree2file(stderr, err_rc);
+ cYAML_free_tree(err_rc);
+ return -1;
+ }
+
+ rc = lustre_lnet_config_buffers(value, -1, -1, -1, &err_rc);
+ if (rc != LUSTRE_CFG_RC_NO_ERR)
+ cYAML_print_tree2file(stderr, err_rc);
+
+ cYAML_free_tree(err_rc);
+
+ return rc;
+}
+
+static int jt_set_small(int argc, char **argv)
+{
+ long int value;
+ int rc;
+ struct cYAML *err_rc = NULL;
+
+ rc = check_cmd(set_cmds, "set", "small_buffers", 2, argc, argv);
+ if (rc)
+ return rc;
+
+ rc = parse_long(argv[1], &value);
+ if (rc != 0) {
+ cYAML_build_error(-1, -1, "parser", "set",
+ "cannot parse small_buffers value", &err_rc);
+ cYAML_print_tree2file(stderr, err_rc);
+ cYAML_free_tree(err_rc);
+ return -1;
+ }
+
+ rc = lustre_lnet_config_buffers(-1, value, -1, -1, &err_rc);
+ if (rc != LUSTRE_CFG_RC_NO_ERR)
+ cYAML_print_tree2file(stderr, err_rc);
+
+ cYAML_free_tree(err_rc);
+
+ return rc;
+}
+
+static int jt_set_large(int argc, char **argv)
+{
+ long int value;
+ int rc;
+ struct cYAML *err_rc = NULL;
+
+ rc = check_cmd(set_cmds, "set", "large_buffers", 2, argc, argv);
+ if (rc)
+ return rc;
+
+ rc = parse_long(argv[1], &value);
+ if (rc != 0) {
+ cYAML_build_error(-1, -1, "parser", "set",
+ "cannot parse large_buffers value", &err_rc);
+ cYAML_print_tree2file(stderr, err_rc);
+ cYAML_free_tree(err_rc);
+ return -1;
+ }
+
+ rc = lustre_lnet_config_buffers(-1, -1, value, -1, &err_rc);
+ if (rc != LUSTRE_CFG_RC_NO_ERR)
+ cYAML_print_tree2file(stderr, err_rc);
+
+ cYAML_free_tree(err_rc);
+
+ return rc;
+}
+
+static int jt_set_routing(int argc, char **argv)
+{
+ long int value;
+ struct cYAML *err_rc = NULL;
+ int rc;
+
+ rc = check_cmd(set_cmds, "set", "routing", 2, argc, argv);
+ if (rc)
+ return rc;
+
+ rc = parse_long(argv[1], &value);
+ if (rc != 0 || (value != 0 && value != 1)) {
+ cYAML_build_error(-1, -1, "parser", "set",
+ "cannot parse routing value.\n"
+ "must be 0 for disable or 1 for enable",
+ &err_rc);
+ cYAML_print_tree2file(stderr, err_rc);
+ cYAML_free_tree(err_rc);
+ return -1;
+ }
+
+ rc = lustre_lnet_enable_routing(value, -1, &err_rc);
+
+ if (rc != LUSTRE_CFG_RC_NO_ERR)
+ cYAML_print_tree2file(stderr, err_rc);
+
+ cYAML_free_tree(err_rc);
+
+ return rc;
+}
+
+static int jt_config_lnet(int argc, char **argv)
+{
+ struct cYAML *err_rc = NULL;
+ bool load_mod_params = false;
+ int rc, opt;
+
+ const char *const short_options = "a";
+ static const struct option long_options[] = {
+ { .name = "all", .has_arg = no_argument, .val = 'a' },
+ { .name = NULL }
+ };
+
+ rc = check_cmd(lnet_cmds, "lnet", "configure", 0, argc, argv);
+ if (rc)
+ return rc;
+
+ while ((opt = getopt_long(argc, argv, short_options,
+ long_options, NULL)) != -1) {
+ switch (opt) {
+ case 'a':
+ load_mod_params = true;
+ break;
+ default:
+ return 0;
+ }
+ }
+
+ rc = lustre_lnet_config_ni_system(LNET_CONFIGURE, load_mod_params,
+ -1, &err_rc);
+
+ if (rc != LUSTRE_CFG_RC_NO_ERR)
+ cYAML_print_tree2file(stderr, err_rc);
+
+ cYAML_free_tree(err_rc);
+
+ return rc;
+}
+
+static int jt_unconfig_lnet(int argc, char **argv)
+{
+ struct cYAML *err_rc = NULL;
+ int rc;
+
+ rc = check_cmd(lnet_cmds, "lnet", "unconfigure", 0, argc, argv);
+ if (rc)
+ return rc;
+
+ rc = lustre_lnet_config_ni_system(LNET_UNCONFIGURE, 0, -1, &err_rc);
+
+ if (rc != LUSTRE_CFG_RC_NO_ERR)
+ cYAML_print_tree2file(stderr, err_rc);
+
+ cYAML_free_tree(err_rc);
+
+ return rc;
+}
+static int jt_add_route(int argc, char **argv)
+{
+ char *network = NULL, *gateway = NULL;
+ long int hop = -1, prio = -1, sen = -1;
+ struct cYAML *err_rc = NULL;
+ int rc, opt;
+
+ const char *const short_options = "n:g:c:p:";
+ static const struct option long_options[] = {
+ { .name = "net", .has_arg = required_argument, .val = 'n' },
+ { .name = "gateway", .has_arg = required_argument, .val = 'g' },
+ { .name = "hop-count", .has_arg = required_argument, .val = 'c' },
+ { .name = "priority", .has_arg = required_argument, .val = 'p' },
+ { .name = "health_sensitivity", .has_arg = required_argument, .val = 's' },
+ { .name = NULL } };
+
+ rc = check_cmd(route_cmds, "route", "add", 0, argc, argv);
+ if (rc)
+ return rc;
+
+ while ((opt = getopt_long(argc, argv, short_options,
+ long_options, NULL)) != -1) {
+ switch (opt) {
+ case 'n':
+ network = optarg;
+ break;
+ case 'g':
+ gateway = optarg;
+ break;
+ case 'c':
+ rc = parse_long(optarg, &hop);
+ if (rc != 0) {
+ /* ignore option */
+ hop = -1;
+ continue;
+ }
+ break;
+ case 'p':
+ rc = parse_long(optarg, &prio);
+ if (rc != 0) {
+ /* ingore option */
+ prio = -1;
+ continue;
+ }
+ break;
+ case 's':
+ rc = parse_long(optarg, &sen);
+ if (rc != 0) {
+ /* ingore option */
+ sen = -1;
+ continue;
+ }
+ break;
+
+ case '?':
+ print_help(route_cmds, "route", "add");
+ default:
+ return 0;
+ }
+ }
+
+ rc = lustre_lnet_config_route(network, gateway, hop, prio, sen, -1,
+ &err_rc);
+
+ if (rc != LUSTRE_CFG_RC_NO_ERR)
+ cYAML_print_tree2file(stderr, err_rc);
+
+ cYAML_free_tree(err_rc);
+
+ return rc;
+}
+
+static int jt_add_ni(int argc, char **argv)
+{
+ char *ip2net = NULL;
+ long int pto = -1, pc = -1, pbc = -1, cre = -1;
+ struct cYAML *err_rc = NULL;
+ int rc, opt, cpt_rc = -1;
+ struct lnet_dlc_network_descr nw_descr;
+ struct cfs_expr_list *global_cpts = NULL;
+ struct lnet_ioctl_config_lnd_tunables tunables;
+ bool found = false;
+
+ memset(&tunables, 0, sizeof(tunables));
+ lustre_lnet_init_nw_descr(&nw_descr);
+
+ const char *const short_options = "n:i:p:t:c:b:r:s:";
+ static const struct option long_options[] = {
+ { .name = "net", .has_arg = required_argument, .val = 'n' },
+ { .name = "if", .has_arg = required_argument, .val = 'i' },
+ { .name = "ip2net", .has_arg = required_argument, .val = 'p' },
+ { .name = "peer-timeout", .has_arg = required_argument, .val = 't' },
+ { .name = "peer-credits", .has_arg = required_argument, .val = 'c' },
+ { .name = "peer-buffer-credits",
+ .has_arg = required_argument, .val = 'b' },
+ { .name = "credits", .has_arg = required_argument, .val = 'r' },
+ { .name = "cpt", .has_arg = required_argument, .val = 's' },
+ { .name = NULL } };
+
+ rc = check_cmd(net_cmds, "net", "add", 0, argc, argv);
+ if (rc)
+ return rc;
+
+ while ((opt = getopt_long(argc, argv, short_options,
+ long_options, NULL)) != -1) {
+ switch (opt) {
+ case 'n':
+ nw_descr.nw_id = libcfs_str2net(optarg);
+ break;
+ case 'i':
+ rc = lustre_lnet_parse_interfaces(optarg, &nw_descr);
+ if (rc != 0) {