From: Bernard Iremonger Date: Tue, 14 Jun 2016 15:35:37 +0000 (+0100) Subject: app/testpmd: separate forward config setup from display X-Git-Tag: spdx-start~6736 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=0c0db76f42ed;p=dpdk.git app/testpmd: separate forward config setup from display Add call to fwd_config_setup to init_config. Add call to fwd_config_setup for corelist, coremask and nbcore setup. Add call to fwd_config_setup for portlist, portmask and nbport setup. Add call to fwd_config_setup for rxq, txq, rxd and txd setup. Remove fwd_config_setup from fwd_config_display. Call the pkt_fwd_config_display function directly, and remove the fwd_config_display wrapper function. Signed-off-by: Bernard Iremonger Acked-by: Pablo de Lara --- diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index fd389ac0d3..73a5a4788c 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -1223,6 +1223,8 @@ cmd_config_rx_tx_parsed(void *parsed_result, return; } + fwd_config_setup(); + init_port_config(); cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); @@ -2520,16 +2522,20 @@ static void cmd_set_list_parsed(void *parsed_result, nb_item = parse_item_list(res->list_of_items, "core", RTE_MAX_LCORE, parsed_items.lcorelist, 1); - if (nb_item > 0) + if (nb_item > 0) { set_fwd_lcores_list(parsed_items.lcorelist, nb_item); + fwd_config_setup(); + } return; } if (!strcmp(res->list_name, "portlist")) { nb_item = parse_item_list(res->list_of_items, "port", RTE_MAX_ETHPORTS, parsed_items.portlist, 1); - if (nb_item > 0) + if (nb_item > 0) { set_fwd_ports_list(parsed_items.portlist, nb_item); + fwd_config_setup(); + } } } @@ -2573,10 +2579,13 @@ static void cmd_set_mask_parsed(void *parsed_result, printf("Please stop forwarding first\n"); return; } - if (!strcmp(res->mask, "coremask")) + if (!strcmp(res->mask, "coremask")) { set_fwd_lcores_mask(res->hexavalue); - else if (!strcmp(res->mask, "portmask")) + fwd_config_setup(); + } else if (!strcmp(res->mask, "portmask")) { set_fwd_ports_mask(res->hexavalue); + fwd_config_setup(); + } } cmdline_parse_token_string_t cmd_setmask_set = @@ -2613,11 +2622,13 @@ static void cmd_set_parsed(void *parsed_result, __attribute__((unused)) void *data) { struct cmd_set_result *res = parsed_result; - if (!strcmp(res->what, "nbport")) + if (!strcmp(res->what, "nbport")) { set_fwd_ports_number(res->value); - else if (!strcmp(res->what, "nbcore")) + fwd_config_setup(); + } else if (!strcmp(res->what, "nbcore")) { set_fwd_lcores_number(res->value); - else if (!strcmp(res->what, "burst")) + fwd_config_setup(); + } else if (!strcmp(res->what, "burst")) set_nb_pkt_per_burst(res->value); else if (!strcmp(res->what, "verbose")) set_verbose_level(res->value); @@ -5413,7 +5424,7 @@ static void cmd_showcfg_parsed(void *parsed_result, else if (!strcmp(res->what, "cores")) fwd_lcores_config_display(); else if (!strcmp(res->what, "fwd")) - fwd_config_display(); + pkt_fwd_config_display(&cur_fwd_config); else if (!strcmp(res->what, "txpkts")) show_tx_pkt_segments(); } diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index f43499904f..24eac3cc63 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -1381,7 +1381,7 @@ fwd_config_setup(void) simple_fwd_config_setup(); } -static void +void pkt_fwd_config_display(struct fwd_config *cfg) { struct fwd_stream *fs; @@ -1420,14 +1420,6 @@ pkt_fwd_config_display(struct fwd_config *cfg) printf("\n"); } - -void -fwd_config_display(void) -{ - fwd_config_setup(); - pkt_fwd_config_display(&cur_fwd_config); -} - int set_fwd_lcores_list(unsigned int *lcorelist, unsigned int nb_lc) { diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 6f68a18b2f..5afce2739f 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -591,6 +591,8 @@ init_config(void) /* Configuration of packet forwarding streams. */ if (init_fwd_streams() < 0) rte_exit(EXIT_FAILURE, "FAIL from init_fwd_streams()\n"); + + fwd_config_setup(); } diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 50f81d70f8..df66d8dfb1 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -472,7 +472,7 @@ void port_infos_display(portid_t port_id); void rx_queue_infos_display(portid_t port_idi, uint16_t queue_id); void tx_queue_infos_display(portid_t port_idi, uint16_t queue_id); void fwd_lcores_config_display(void); -void fwd_config_display(void); +void pkt_fwd_config_display(struct fwd_config *cfg); void rxtx_config_display(void); void fwd_config_setup(void); void set_def_fwd_config(void);