app/testpmd: fix identifier size for port attach
[dpdk.git] / app / test-pmd / cmdline.c
index 06672fd..a037a55 100644 (file)
@@ -1446,7 +1446,7 @@ cmdline_parse_inst_t cmd_set_port_setup_on = {
 struct cmd_operate_attach_port_result {
        cmdline_fixed_string_t port;
        cmdline_fixed_string_t keyword;
-       cmdline_fixed_string_t identifier;
+       cmdline_multi_string_t identifier;
 };
 
 static void cmd_operate_attach_port_parsed(void *parsed_result,
@@ -1469,7 +1469,7 @@ cmdline_parse_token_string_t cmd_operate_attach_port_keyword =
                        keyword, "attach");
 cmdline_parse_token_string_t cmd_operate_attach_port_identifier =
        TOKEN_STRING_INITIALIZER(struct cmd_operate_attach_port_result,
-                       identifier, NULL);
+                       identifier, TOKEN_STRING_MULTI);
 
 cmdline_parse_inst_t cmd_operate_attach_port = {
        .f = cmd_operate_attach_port_parsed,
@@ -1497,10 +1497,12 @@ static void cmd_operate_detach_port_parsed(void *parsed_result,
 {
        struct cmd_operate_detach_port_result *res = parsed_result;
 
-       if (!strcmp(res->keyword, "detach"))
+       if (!strcmp(res->keyword, "detach")) {
+               RTE_ETH_VALID_PORTID_OR_RET(res->port_id);
                detach_port_device(res->port_id);
-       else
+       } else {
                printf("Unknown parameter\n");
+       }
 }
 
 cmdline_parse_token_string_t cmd_operate_detach_port_port =
@@ -1539,7 +1541,7 @@ static void cmd_operate_detach_device_parsed(void *parsed_result,
        struct cmd_operate_detach_device_result *res = parsed_result;
 
        if (!strcmp(res->keyword, "detach"))
-               detach_device(res->identifier);
+               detach_devargs(res->identifier);
        else
                printf("Unknown parameter\n");
 }
@@ -7089,6 +7091,7 @@ cmd_priority_flow_ctrl_set_parsed(void *parsed_result,
                {RTE_FC_NONE, RTE_FC_TX_PAUSE}, {RTE_FC_RX_PAUSE, RTE_FC_FULL}
        };
 
+       memset(&pfc_conf, 0, sizeof(struct rte_eth_pfc_conf));
        rx_fc_enable = (!strncmp(res->rx_pfc_mode, "on",2)) ? 1 : 0;
        tx_fc_enable = (!strncmp(res->tx_pfc_mode, "on",2)) ? 1 : 0;
        pfc_conf.fc.mode       = rx_tx_onoff_2_pfc_mode[rx_fc_enable][tx_fc_enable];