[PATCH v3 05/14] testpmd: fix whitespace

Zhang, Yuying yuying.zhang at intel.com
Fri Nov 11 07:30:04 CET 2022



> -----Original Message-----
> From: Stephen Hemminger <stephen at networkplumber.org>
> Sent: 2022年11月10日 7:25
> To: dev at dpdk.org
> Cc: Stephen Hemminger <stephen at networkplumber.org>; Singh, Aman Deep
> <aman.deep.singh at intel.com>; Zhang, Yuying <yuying.zhang at intel.com>
> Subject: [PATCH v3 05/14] testpmd: fix whitespace
> 
> Add space after keywords.
> 
> Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
Reviewed-off-by: Yuying Zhang <yuying.zhang at intel.com>

> ---
>  app/test-pmd/cmdline.c    | 31 ++++++++++++++++---------------
>  app/test-pmd/parameters.c | 10 ++++++----
>  app/test-pmd/testpmd.c    |  2 +-
>  3 files changed, 23 insertions(+), 20 deletions(-)
> 
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> 8dc60e938830..7721006cc310 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -2730,11 +2730,12 @@ parse_reta_config(const char *str,
> 
>  	while ((p = strchr(p0,'(')) != NULL) {
>  		++p;
> -		if((p0 = strchr(p,')')) == NULL)
> +		p0 = strchr(p, ')');
> +		if (p0 == NULL)
>  			return -1;
> 
>  		size = p0 - p;
> -		if(size >= sizeof(s))
> +		if (size >= sizeof(s))
>  			return -1;
> 
>  		snprintf(s, sizeof(s), "%.*s", size, p); @@ -3242,15 +3243,15
> @@ cmd_config_thresh_parsed(void *parsed_result,
> 
>  	if (!strcmp(res->name, "txpt"))
>  		tx_pthresh = res->value;
> -	else if(!strcmp(res->name, "txht"))
> +	else if (!strcmp(res->name, "txht"))
>  		tx_hthresh = res->value;
> -	else if(!strcmp(res->name, "txwt"))
> +	else if (!strcmp(res->name, "txwt"))
>  		tx_wthresh = res->value;
> -	else if(!strcmp(res->name, "rxpt"))
> +	else if (!strcmp(res->name, "rxpt"))
>  		rx_pthresh = res->value;
> -	else if(!strcmp(res->name, "rxht"))
> +	else if (!strcmp(res->name, "rxht"))
>  		rx_hthresh = res->value;
> -	else if(!strcmp(res->name, "rxwt"))
> +	else if (!strcmp(res->name, "rxwt"))
>  		rx_wthresh = res->value;
>  	else {
>  		fprintf(stderr, "Unknown parameter\n"); @@ -4088,8 +4089,8
> @@ cmd_vlan_offload_parsed(void *parsed_result,
>  	len = strnlen(str, STR_TOKEN_SIZE);
>  	i = 0;
>  	/* Get port_id first */
> -	while(i < len){
> -		if(str[i] == ',')
> +	while (i < len) {
> +		if (str[i] == ',')
>  			break;
> 
>  		i++;
> @@ -4097,7 +4098,7 @@ cmd_vlan_offload_parsed(void *parsed_result,
>  	str[i]='\0';
>  	tmp = strtoul(str, NULL, 0);
>  	/* If port_id greater that what portid_t can represent, return */
> -	if(tmp >= RTE_MAX_ETHPORTS)
> +	if (tmp >= RTE_MAX_ETHPORTS)
>  		return;
>  	port_id = (portid_t)tmp;
> 
> @@ -4108,17 +4109,17 @@ cmd_vlan_offload_parsed(void *parsed_result,
> 
>  	if (!strcmp(res->what, "strip"))
>  		rx_vlan_strip_set(port_id,  on);
> -	else if(!strcmp(res->what, "stripq")){
> +	else if (!strcmp(res->what, "stripq")) {
>  		uint16_t queue_id = 0;
> 
>  		/* No queue_id, return */
> -		if(i + 1 >= len) {
> +		if (i + 1 >= len) {
>  			fprintf(stderr, "must specify (port,queue_id)\n");
>  			return;
>  		}
>  		tmp = strtoul(str + i + 1, NULL, 0);
>  		/* If queue_id greater that what 16-bits can represent, return */
> -		if(tmp > 0xffff)
> +		if (tmp > 0xffff)
>  			return;
> 
>  		queue_id = (uint16_t)tmp;
> @@ -7207,7 +7208,7 @@ static void cmd_mac_addr_parsed(void
> *parsed_result,
>  		ret = rte_eth_dev_mac_addr_remove(res->port_num, &res-
> >address);
> 
>  	/* check the return value and print it if is < 0 */
> -	if(ret < 0)
> +	if (ret < 0)
>  		fprintf(stderr, "mac_addr_cmd error: (%s)\n", strerror(-ret));
> 
>  }
> @@ -7780,7 +7781,7 @@ static void cmd_vf_mac_addr_parsed(void
> *parsed_result,
>  						res->vf_num);
>  #endif
> 
> -	if(ret < 0)
> +	if (ret < 0)
>  		fprintf(stderr, "vf_mac_addr_cmd error: (%s)\n", strerror(-ret));
> 
>  }
> diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index
> aed4cdcb8485..7fc6d91f0210 100644
> --- a/app/test-pmd/parameters.c
> +++ b/app/test-pmd/parameters.c
> @@ -306,11 +306,12 @@ parse_portnuma_config(const char *q_arg)
>  	/* reset from value set at definition */
>  	while ((p = strchr(p0,'(')) != NULL) {
>  		++p;
> -		if((p0 = strchr(p,')')) == NULL)
> +		p0 = strchr(p, ')');
> +		if (p0 == NULL)
>  			return -1;
> 
>  		size = p0 - p;
> -		if(size >= sizeof(s))
> +		if (size >= sizeof(s))
>  			return -1;
> 
>  		snprintf(s, sizeof(s), "%.*s", size, p); @@ -366,11 +367,12 @@
> parse_ringnuma_config(const char *q_arg)
>  	/* reset from value set at definition */
>  	while ((p = strchr(p0,'(')) != NULL) {
>  		++p;
> -		if((p0 = strchr(p,')')) == NULL)
> +		p0 = strchr(p, ')');
> +		if (p0 == NULL)
>  			return -1;
> 
>  		size = p0 - p;
> -		if(size >= sizeof(s))
> +		if (size >= sizeof(s))
>  			return -1;
> 
>  		snprintf(s, sizeof(s), "%.*s", size, p); diff --git a/app/test-
> pmd/testpmd.c b/app/test-pmd/testpmd.c index aa7ea29f15ba..04b078a2938b
> 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -2406,7 +2406,7 @@ start_packet_forwarding(int with_tx_first)
> 
>  	test_done = 0;
> 
> -	if(!no_flush_rx)
> +	if (!no_flush_rx)
>  		flush_fwd_rx_queues();
> 
>  	rxtx_config_display();
> --
> 2.35.1



More information about the dev mailing list