Whamcloud - gitweb
LU-9078 lnet: Fix route hops print
[fs/lustre-release.git] / lnet / utils / lnetconfig / liblnetconfig.c
index d32ce27..37d254c 100644 (file)
@@ -584,17 +584,6 @@ int lustre_lnet_config_route(char *nw, char *gw, int hops, int prio,
                goto out;
        }
 
-       if (LNET_NETTYP(net) == CIBLND    ||
-           LNET_NETTYP(net) == OPENIBLND ||
-           LNET_NETTYP(net) == IIBLND    ||
-           LNET_NETTYP(net) == VIBLND) {
-               snprintf(err_str,
-                        sizeof(err_str),
-                        "\"obselete LNet type '%s'\"", libcfs_lnd2str(net));
-               rc = LUSTRE_CFG_RC_BAD_PARAM;
-               goto out;
-       }
-
        gateway_nid = libcfs_str2nid(gw);
        if (gateway_nid == LNET_NID_ANY) {
                snprintf(err_str,
@@ -678,17 +667,6 @@ int lustre_lnet_del_route(char *nw, char *gw,
                goto out;
        }
 
-       if (LNET_NETTYP(net) == CIBLND    ||
-           LNET_NETTYP(net) == OPENIBLND ||
-           LNET_NETTYP(net) == IIBLND    ||
-           LNET_NETTYP(net) == VIBLND) {
-               snprintf(err_str,
-                        sizeof(err_str),
-                        "\"obselete LNet type '%s'\"", libcfs_lnd2str(net));
-               rc = LUSTRE_CFG_RC_BAD_PARAM;
-               goto out;
-       }
-
        gateway_nid = libcfs_str2nid(gw);
        if (gateway_nid == LNET_NID_ANY) {
                snprintf(err_str,
@@ -745,17 +723,6 @@ int lustre_lnet_show_route(char *nw, char *gw, int hops, int prio, int detail,
                        goto out;
                }
 
-               if (LNET_NETTYP(net) == CIBLND    ||
-                   LNET_NETTYP(net) == OPENIBLND ||
-                   LNET_NETTYP(net) == IIBLND    ||
-                   LNET_NETTYP(net) == VIBLND) {
-                       snprintf(err_str,
-                                sizeof(err_str),
-                                "\"obsolete LNet type '%s'\"",
-                                libcfs_lnd2str(net));
-                       rc = LUSTRE_CFG_RC_BAD_PARAM;
-                       goto out;
-               }
        } else {
                /* show all routes without filtering on net */
                net = LNET_NIDNET(LNET_NID_ANY);
@@ -840,8 +807,8 @@ int lustre_lnet_show_route(char *nw, char *gw, int hops, int prio, int detail,
 
                if (detail) {
                        if (cYAML_create_number(item, "hop",
-                                               data.cfg_config_u.cfg_route.
-                                                       rtr_hop) ==
+                                               (int) data.cfg_config_u.
+                                               cfg_route.rtr_hop) ==
                            NULL)
                                goto out;
 
@@ -3058,35 +3025,32 @@ struct lookup_cmd_hdlr_tbl {
 };
 
 static struct lookup_cmd_hdlr_tbl lookup_config_tbl[] = {
-       {"route", handle_yaml_config_route},
-       {"net", handle_yaml_config_ni},
-       {"ip2nets", handle_yaml_config_ip2nets},
-       {"peer", handle_yaml_config_peer},
-       {"routing", handle_yaml_config_routing},
-       {"buffers", handle_yaml_config_buffers},
-       {"numa", handle_yaml_config_numa},
-       {NULL, NULL}
-};
+       { .name = "route",      .cb = handle_yaml_config_route },
+       { .name = "net",        .cb = handle_yaml_config_ni },
+       { .name = "ip2nets",    .cb = handle_yaml_config_ip2nets },
+       { .name = "peer",       .cb = handle_yaml_config_peer },
+       { .name = "routing",    .cb = handle_yaml_config_routing },
+       { .name = "buffers",    .cb = handle_yaml_config_buffers },
+       { .name = "numa",       .cb = handle_yaml_config_numa },
+       { .name = NULL } };
 
 static struct lookup_cmd_hdlr_tbl lookup_del_tbl[] = {
-       {"route", handle_yaml_del_route},
-       {"net", handle_yaml_del_ni},
-       {"peer", handle_yaml_del_peer},
-       {"routing", handle_yaml_del_routing},
-       {"numa", handle_yaml_del_numa},
-       {NULL, NULL}
-};
+       { .name = "route",      .cb = handle_yaml_del_route },
+       { .name = "net",        .cb = handle_yaml_del_ni },
+       { .name = "peer",       .cb = handle_yaml_del_peer },
+       { .name = "routing",    .cb = handle_yaml_del_routing },
+       { .name = "numa",       .cb = handle_yaml_del_numa },
+       { .name = NULL } };
 
 static struct lookup_cmd_hdlr_tbl lookup_show_tbl[] = {
-       {"route", handle_yaml_show_route},
-       {"net", handle_yaml_show_net},
-       {"buffers", handle_yaml_show_routing},
-       {"routing", handle_yaml_show_routing},
-       {"peer", handle_yaml_show_peers},
-       {"statistics", handle_yaml_show_stats},
-       {"numa", handle_yaml_show_numa},
-       {NULL, NULL}
-};
+       { .name = "route",      .cb = handle_yaml_show_route },
+       { .name = "net",        .cb = handle_yaml_show_net },
+       { .name = "buffers",    .cb = handle_yaml_show_routing },
+       { .name = "routing",    .cb = handle_yaml_show_routing },
+       { .name = "peer",       .cb = handle_yaml_show_peers },
+       { .name = "statistics", .cb = handle_yaml_show_stats },
+       { .name = "numa",       .cb = handle_yaml_show_numa },
+       { .name = NULL } };
 
 static cmd_handler_t lookup_fn(char *key,
                               struct lookup_cmd_hdlr_tbl *tbl)