[dpdk-dev] [PATCH v2 4/5] app/testpmd: add command to test NIC reset

Wu, Jingjing jingjing.wu at intel.com
Wed Jun 28 11:10:50 CEST 2017



> -----Original Message-----
> From: Dai, Wei
> Sent: Tuesday, June 27, 2017 10:07 PM
> To: thomas at monjalon.net; Lu, Wenzhuo <wenzhuo.lu at intel.com>; Ananyev,
> Konstantin <konstantin.ananyev at intel.com>; Zhang, Helin
> <helin.zhang at intel.com>; Wu, Jingjing <jingjing.wu at intel.com>
> Cc: dev at dpdk.org; Dai, Wei <wei.dai at intel.com>
> Subject: [PATCH v2 4/5] app/testpmd: add command to test NIC reset
> 
> When a NIC is reset, a message will show it.
> And then user can run the command "reset_port port_id"
> to process it.
> 
> Signed-off-by: Wei Dai <wei.dai at intel.com>
> ---
>  app/test-pmd/cmdline.c | 31 +++++++++++++++++++++++++++++++  app/test-
> pmd/config.c  | 13 +++++++++++++  app/test-pmd/testpmd.h |  1 +
>  3 files changed, 45 insertions(+)
> 
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> ff8ffd2..90f6bde 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -2588,6 +2588,36 @@ cmdline_parse_inst_t cmd_stop = {
>  	},
>  };
> 
> +/* *** reset a port *** */
> +struct cmd_reset_port_result {
> +	cmdline_fixed_string_t command;
> +	uint8_t port_id;
> +};
> +
> +static void cmd_reset_port_parsed(__attribute__((unused)) void
> *parsed_result,
> +			    __attribute__((unused)) struct cmdline *cl,
> +			    __attribute__((unused)) void *data) {
> +	struct cmd_reset_port_result *res = parsed_result;
> +	reset_port(res->port_id);
> +}
> +
> +cmdline_parse_token_string_t cmd_reset_port_cmd =
> +	TOKEN_STRING_INITIALIZER(struct cmd_reset_port_result, command,
> +"reset_port"); cmdline_parse_token_num_t cmd_reset_port_id =
> +	TOKEN_NUM_INITIALIZER(struct cmd_reset_port_result, port_id,
> UINT8);
> +
> +cmdline_parse_inst_t cmd_reset_port = {
> +	.f = cmd_reset_port_parsed,
> +	.data = NULL,
> +	.help_str = "reset_port <port_id>",

You can just add one more option in the commands
"port start|stop|close <port_id>" and " port start|stop|close all"
To "port start|stop|close|reset <port_id>" and " port start|stop|close|reset all" instead of defining a new one.



More information about the dev mailing list