{"--net", jt_opt_net, 0, "run <command> after selecting network <net>\n"
"usage: --net <tcp/o2ib/...> <command>"},
{"network", jt_ptl_network, 0, "configure LNET\n"
- "usage: network up|down"},
+ "usage: network [Network] <up|down> [-l]\n"
+ " -l: Override existing, else it will create new\n"},
{"net", jt_ptl_network, 0, "configure LNET\n"
- "usage: net up|down"},
+ "usage: net [Network] <up|down> [-l]\n"
+ " -l: Override existing, else it will create new\n"},
{"list_nids", jt_ptl_list_nids, 0, "list local NIDs\n"
"usage: list_nids [all]"},
{"which_nid", jt_ptl_which_nid, 0, "choose a NID\n"
#include <linux/types.h>
#include <libcfs/util/ioctl.h>
+#include <libcfs/util/parser.h>
#include <linux/lnet/libcfs_debug.h>
#include <linux/lnet/lnet-dlc.h>
#include <linux/lnet/lnetctl.h>
const char *msg = NULL;
int rc;
- if (argc > 3) {
- fprintf(stderr, "usage: %s <net>|up|down [-l]\n", argv[0]);
- return -1;
- }
+ if (argc > 3 || argc <= 1)
+ return CMD_HELP;
if (!strcmp(argv[1], "unconfigure") || !strcmp(argv[1], "down")) {
rc = yaml_lnet_configure(0, &msg);
errno, strerror(errno));
return -1;
} else if (!strcmp(argv[1], "configure") || !strcmp(argv[1], "up")) {
- int flags = NLM_F_CREATE;
+ int flags = NLM_F_CREATE; /* Create, if it does not exist */
if (argc == 3 && argv[2] && !strcmp(argv[2], "-l"))
- flags |= NLM_F_REPLACE;
+ flags |= NLM_F_REPLACE; /* Override existing */
rc = yaml_lnet_configure(flags, &msg);
if (rc != -EOPNOTSUPP) {
switch (rc) {
case 0:
- printf("LNET configured\n");
+ if (flags & NLM_F_REPLACE)
+ printf("LNET configured: Overridden existing one\n");
+ else
+ printf("LNET configured: New Created\n");
break;
default:
fprintf(stderr, "LNET configure error %u: %s\n",