X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=app%2Ftest-pmd%2Fcmdline.c;h=52e9f5fad12c171666ab16c051fd152d38333ebe;hb=693f715da45c48ec1ec0fe4ba2f3b5ffd11ba53e;hp=2d43efaff4e9bf9a6e2bd91c9a78e9427019d301;hpb=2892fcc14e9b25e03b5f1fe3d62350685fcd2b07;p=dpdk.git diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 2d43efaff4..52e9f5fad1 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -90,6 +90,8 @@ #include "testpmd.h" +static struct cmdline *testpmd_cl; + static void cmd_reconfig_device_queue(portid_t id, uint8_t dev, uint8_t queue); #ifdef RTE_NIC_BYPASS @@ -199,7 +201,10 @@ static void cmd_help_long_parsed(void *parsed_result, "clear port (info|stats|xstats|fdir|stat_qmap) (port_id|all)\n" " Clear information for port_id, or all.\n\n" - "show config (rxtx|cores|fwd)\n" + "show (rxq|txq) info (port_id) (queue_id)\n" + " Display information for configured RX/TX queue.\n\n" + + "show config (rxtx|cores|fwd|txpkts)\n" " Display the given configuration.\n\n" "read rxd (port_id) (queue_id) (rxd_id)\n" @@ -246,7 +251,12 @@ static void cmd_help_long_parsed(void *parsed_result, "set txpkts (x[,y]*)\n" " Set the length of each segment of TXONLY" - " packets.\n\n" + " and optionally CSUM packets.\n\n" + + "set txsplit (off|on|rand)\n" + " Set the split policy for the TX packets." + " Right now only applicable for CSUM and TXONLY" + " modes\n\n" "set corelist (x[,y]*)\n" " Set the list of forwarding cores.\n\n" @@ -2410,11 +2420,11 @@ parse_item_list(char* str, const char* item_name, unsigned int max_items, } if (c != ',') { printf("character %c is not a decimal digit\n", c); - return (0); + return 0; } if (! value_ok) { printf("No valid value before comma\n"); - return (0); + return 0; } if (nb_item < max_items) { parsed_items[nb_item] = value; @@ -2426,11 +2436,11 @@ parse_item_list(char* str, const char* item_name, unsigned int max_items, if (nb_item >= max_items) { printf("Number of %s = %u > %u (maximum items)\n", item_name, nb_item + 1, max_items); - return (0); + return 0; } parsed_items[nb_item++] = value; if (! check_unique_values) - return (nb_item); + return nb_item; /* * Then, check that all values in the list are differents. @@ -2441,11 +2451,11 @@ parse_item_list(char* str, const char* item_name, unsigned int max_items, if (parsed_items[j] == parsed_items[i]) { printf("duplicated %s %u at index %u and %u\n", item_name, parsed_items[i], i, j); - return (0); + return 0; } } } - return (nb_item); + return nb_item; } struct cmd_set_list_result { @@ -2644,6 +2654,47 @@ cmdline_parse_inst_t cmd_set_txpkts = { }, }; +/* *** SET COPY AND SPLIT POLICY ON TX PACKETS *** */ + +struct cmd_set_txsplit_result { + cmdline_fixed_string_t cmd_keyword; + cmdline_fixed_string_t txsplit; + cmdline_fixed_string_t mode; +}; + +static void +cmd_set_txsplit_parsed(void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_set_txsplit_result *res; + + res = parsed_result; + set_tx_pkt_split(res->mode); +} + +cmdline_parse_token_string_t cmd_set_txsplit_keyword = + TOKEN_STRING_INITIALIZER(struct cmd_set_txsplit_result, + cmd_keyword, "set"); +cmdline_parse_token_string_t cmd_set_txsplit_name = + TOKEN_STRING_INITIALIZER(struct cmd_set_txsplit_result, + txsplit, "txsplit"); +cmdline_parse_token_string_t cmd_set_txsplit_mode = + TOKEN_STRING_INITIALIZER(struct cmd_set_txsplit_result, + mode, NULL); + +cmdline_parse_inst_t cmd_set_txsplit = { + .f = cmd_set_txsplit_parsed, + .data = NULL, + .help_str = "set txsplit on|off|rand", + .tokens = { + (void *)&cmd_set_txsplit_keyword, + (void *)&cmd_set_txsplit_name, + (void *)&cmd_set_txsplit_mode, + NULL, + }, +}; + /* *** ADD/REMOVE ALL VLAN IDENTIFIERS TO/FROM A PORT VLAN RX FILTER *** */ struct cmd_rx_vlan_filter_all_result { cmdline_fixed_string_t rx_vlan; @@ -5256,6 +5307,8 @@ static void cmd_showcfg_parsed(void *parsed_result, fwd_lcores_config_display(); else if (!strcmp(res->what, "fwd")) fwd_config_display(); + else if (!strcmp(res->what, "txpkts")) + show_tx_pkt_segments(); } cmdline_parse_token_string_t cmd_showcfg_show = @@ -5264,12 +5317,12 @@ cmdline_parse_token_string_t cmd_showcfg_port = TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, cfg, "config"); cmdline_parse_token_string_t cmd_showcfg_what = TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, what, - "rxtx#cores#fwd"); + "rxtx#cores#fwd#txpkts"); cmdline_parse_inst_t cmd_showcfg = { .f = cmd_showcfg_parsed, .data = NULL, - .help_str = "show config rxtx|cores|fwd", + .help_str = "show config rxtx|cores|fwd|txpkts", .tokens = { (void *)&cmd_showcfg_show, (void *)&cmd_showcfg_port, @@ -8019,14 +8072,14 @@ str2flowtype(char *string) return RTE_ETH_FLOW_UNKNOWN; } -static uint8_t +static enum rte_eth_fdir_tunnel_type str2fdir_tunneltype(char *string) { uint8_t i = 0; static const struct { char str[32]; - uint8_t type; + enum rte_eth_fdir_tunnel_type type; } tunneltype_str[] = { {"NVGRE", RTE_FDIR_TUNNEL_TYPE_NVGRE}, {"VxLAN", RTE_FDIR_TUNNEL_TYPE_VXLAN}, @@ -9597,6 +9650,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_reset, (cmdline_parse_inst_t *)&cmd_set_numbers, (cmdline_parse_inst_t *)&cmd_set_txpkts, + (cmdline_parse_inst_t *)&cmd_set_txsplit, (cmdline_parse_inst_t *)&cmd_set_fwd_list, (cmdline_parse_inst_t *)&cmd_set_fwd_mask, (cmdline_parse_inst_t *)&cmd_set_fwd_mode, @@ -9726,17 +9780,21 @@ cmdline_parse_ctx_t main_ctx[] = { void prompt(void) { - struct cmdline *cl; - /* initialize non-constant commands */ cmd_set_fwd_mode_init(); - cl = cmdline_stdin_new(main_ctx, "testpmd> "); - if (cl == NULL) { + testpmd_cl = cmdline_stdin_new(main_ctx, "testpmd> "); + if (testpmd_cl == NULL) return; - } - cmdline_interact(cl); - cmdline_stdin_exit(cl); + cmdline_interact(testpmd_cl); + cmdline_stdin_exit(testpmd_cl); +} + +void +prompt_exit(void) +{ + if (testpmd_cl != NULL) + cmdline_quit(testpmd_cl); } static void