ethtool: correct format strings according to the arguments

Message ID 20220324053124.8085-1-huzaifa.rahman@emumba.com (mailing list archive)
State Changes Requested, archived
Delegated to: Thomas Monjalon
Headers
Series ethtool: correct format strings according to the arguments |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/github-robot: build success github build: passed
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-broadcom-Functional fail Functional Testing issues
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS

Commit Message

Huzaifa Rahman March 24, 2022, 5:31 a.m. UTC
  The corrected format strings are not consistent with the
given arguments. So they are changed accordingly.

Signed-off-by: huzaifa.rahman <huzaifa.rahman@emumba.com>
---
 examples/ethtool/ethtool-app/main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Comments

Huzaifa Rahman May 27, 2022, 5:14 a.m. UTC | #1
Hi,

The following tests are failing but my patch is not related to anything
related to these. Please re-run the tests.

Failed Tests:
		- mtu_update
		- scatter


Thanks,

Huzaifa


On Thu, Mar 24, 2022 at 10:31 AM huzaifa.rahman <huzaifa.rahman@emumba.com>
wrote:

> The corrected format strings are not consistent with the
> given arguments. So they are changed accordingly.
>
> Signed-off-by: huzaifa.rahman <huzaifa.rahman@emumba.com>
> ---
>  examples/ethtool/ethtool-app/main.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/examples/ethtool/ethtool-app/main.c
> b/examples/ethtool/ethtool-app/main.c
> index 1f011a9321..ea8332e49c 100644
> --- a/examples/ethtool/ethtool-app/main.c
> +++ b/examples/ethtool/ethtool-app/main.c
> @@ -208,7 +208,7 @@ static int worker_main(__rte_unused void *ptr_data)
>                                         &ptr_port->mac_addr);
>                                 if (ret != 0) {
>
> rte_spinlock_unlock(&ptr_port->lock);
> -                                       printf("Failed to get MAC address
> (port %u): %s",
> +                                       printf("Failed to get MAC address
> (port %i): %s",
>                                                ptr_port->idx_port,
>                                                rte_strerror(-ret));
>                                         return ret;
> @@ -284,11 +284,11 @@ int main(int argc, char **argv)
>                 rte_exit(EXIT_FAILURE, "rte_eal_init(): Failed");
>
>         cnt_ports = rte_eth_dev_count_avail();
> -       printf("Number of NICs: %i\n", cnt_ports);
> +       printf("Number of NICs: %u\n", cnt_ports);
>         if (cnt_ports == 0)
>                 rte_exit(EXIT_FAILURE, "No available NIC ports!\n");
>         if (cnt_ports > MAX_PORTS) {
> -               printf("Info: Using only %i of %i ports\n",
> +               printf("Info: Using only %u of %i ports\n",
>                         cnt_ports, MAX_PORTS
>                         );
>                 cnt_ports = MAX_PORTS;
> --
> 2.25.1
>
>
  
Stephen Hemminger July 3, 2023, 10:32 p.m. UTC | #2
On Thu, 24 Mar 2022 10:31:24 +0500
"huzaifa.rahman" <huzaifa.rahman@emumba.com> wrote:

> The corrected format strings are not consistent with the
> given arguments. So they are changed accordingly.
> 
> Signed-off-by: huzaifa.rahman <huzaifa.rahman@emumba.com>
> ---
>  examples/ethtool/ethtool-app/main.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/examples/ethtool/ethtool-app/main.c b/examples/ethtool/ethtool-app/main.c
> index 1f011a9321..ea8332e49c 100644
> --- a/examples/ethtool/ethtool-app/main.c
> +++ b/examples/ethtool/ethtool-app/main.c
> @@ -208,7 +208,7 @@ static int worker_main(__rte_unused void *ptr_data)
>  					&ptr_port->mac_addr);
>  				if (ret != 0) {
>  					rte_spinlock_unlock(&ptr_port->lock);
> -					printf("Failed to get MAC address (port %u): %s",
> +					printf("Failed to get MAC address (port %i): %s",
>  					       ptr_port->idx_port,

It is a bigger change, but idx_port should be uint16_t not int.


>  					       rte_strerror(-ret));
>  					return ret;
> @@ -284,11 +284,11 @@ int main(int argc, char **argv)
>  		rte_exit(EXIT_FAILURE, "rte_eal_init(): Failed");
>  
>  	cnt_ports = rte_eth_dev_count_avail();
> -	printf("Number of NICs: %i\n", cnt_ports);
> +	printf("Number of NICs: %u\n", cnt_ports);

Correct

>  	if (cnt_ports == 0)
>  		rte_exit(EXIT_FAILURE, "No available NIC ports!\n");
>  	if (cnt_ports > MAX_PORTS) {
> -		printf("Info: Using only %i of %i ports\n",
> +		printf("Info: Using only %u of %i ports\n",
>  			cnt_ports, MAX_PORTS

Both can be %u


>  			);
>  		cnt_ports = MAX_PORTS;
  

Patch

diff --git a/examples/ethtool/ethtool-app/main.c b/examples/ethtool/ethtool-app/main.c
index 1f011a9321..ea8332e49c 100644
--- a/examples/ethtool/ethtool-app/main.c
+++ b/examples/ethtool/ethtool-app/main.c
@@ -208,7 +208,7 @@  static int worker_main(__rte_unused void *ptr_data)
 					&ptr_port->mac_addr);
 				if (ret != 0) {
 					rte_spinlock_unlock(&ptr_port->lock);
-					printf("Failed to get MAC address (port %u): %s",
+					printf("Failed to get MAC address (port %i): %s",
 					       ptr_port->idx_port,
 					       rte_strerror(-ret));
 					return ret;
@@ -284,11 +284,11 @@  int main(int argc, char **argv)
 		rte_exit(EXIT_FAILURE, "rte_eal_init(): Failed");
 
 	cnt_ports = rte_eth_dev_count_avail();
-	printf("Number of NICs: %i\n", cnt_ports);
+	printf("Number of NICs: %u\n", cnt_ports);
 	if (cnt_ports == 0)
 		rte_exit(EXIT_FAILURE, "No available NIC ports!\n");
 	if (cnt_ports > MAX_PORTS) {
-		printf("Info: Using only %i of %i ports\n",
+		printf("Info: Using only %u of %i ports\n",
 			cnt_ports, MAX_PORTS
 			);
 		cnt_ports = MAX_PORTS;