All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 iproute2-next] ip-address: Fix negative prints of large TX rate limits
@ 2018-03-08 16:08 Tariq Toukan
  2018-03-08 18:16 ` David Ahern
  2018-03-10 17:01 ` Stephen Hemminger
  0 siblings, 2 replies; 3+ messages in thread
From: Tariq Toukan @ 2018-03-08 16:08 UTC (permalink / raw)
  To: Stephen Hemminger, David Ahern; +Cc: netdev, Tariq Toukan

TX rate limit fields are unsigned (__u32).
Use %u and print_uint when printing.

Tested:
$ ip link set ens1 vf 1 rate 2294967296
$ ip link show |grep -iE "vf 1" | grep rate

before:
vf 1 MAC 00:00:00:00:00:00, tx rate -2000000000 (Mbps), max_tx_rate -2000000000Mbps, ...

after:
vf 1 MAC 00:00:00:00:00:00, tx rate 2294967296 (Mbps), max_tx_rate 2294967296Mbps, ...

Fixes: 3fd86630876a ("iproute2: rework SR-IOV VF support")
Fixes: 8c29ae7cc249 ("ip link: Fix crash on older kernels when show VF dev")
Fixes: f89a2a05ffa9 ("Add support to configure SR-IOV VF minimum and maximum Tx rate through ip tool")
Fixes: ae7229d5f99e ("ip: Add support for setting and showing SR-IOV virtual funtion link params")
Fixes: d0e720111aad ("ip: ipaddress.c: add support for json output")
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
---

v1 -> v2:
Fixed JSON output (print_uint) as well.
Updated commit message.

 ip/ipaddress.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index d01d7030b442..0f4e1cd526bb 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -416,10 +416,10 @@ static void print_vfinfo(FILE *fp, struct rtattr *vfinfo)
 	}
 
 	if (vf_tx_rate->rate)
-		print_int(PRINT_ANY,
-			  "tx_rate",
-			  ", tx rate %d (Mbps)",
-			  vf_tx_rate->rate);
+		print_uint(PRINT_ANY,
+			   "tx_rate",
+			   ", tx rate %u (Mbps)",
+			   vf_tx_rate->rate);
 
 	if (vf[IFLA_VF_RATE]) {
 		struct ifla_vf_rate *vf_rate = RTA_DATA(vf[IFLA_VF_RATE]);
@@ -428,14 +428,14 @@ static void print_vfinfo(FILE *fp, struct rtattr *vfinfo)
 
 		if (is_json_context()) {
 			open_json_object("rate");
-			print_int(PRINT_JSON, "max_tx", NULL, max_tx);
-			print_int(PRINT_ANY, "min_tx", NULL, min_tx);
+			print_uint(PRINT_JSON, "max_tx", NULL, max_tx);
+			print_uint(PRINT_ANY, "min_tx", NULL, min_tx);
 			close_json_object();
 		} else {
 			if (max_tx)
-				fprintf(fp, ", max_tx_rate %dMbps", max_tx);
+				fprintf(fp, ", max_tx_rate %uMbps", max_tx);
 			if (min_tx)
-				fprintf(fp, ", min_tx_rate %dMbps", min_tx);
+				fprintf(fp, ", min_tx_rate %uMbps", min_tx);
 		}
 	}
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH V2 iproute2-next] ip-address: Fix negative prints of large TX rate limits
  2018-03-08 16:08 [PATCH V2 iproute2-next] ip-address: Fix negative prints of large TX rate limits Tariq Toukan
@ 2018-03-08 18:16 ` David Ahern
  2018-03-10 17:01 ` Stephen Hemminger
  1 sibling, 0 replies; 3+ messages in thread
From: David Ahern @ 2018-03-08 18:16 UTC (permalink / raw)
  To: Tariq Toukan, Stephen Hemminger; +Cc: netdev

On 3/8/18 9:08 AM, Tariq Toukan wrote:
> TX rate limit fields are unsigned (__u32).
> Use %u and print_uint when printing.
> 
> Tested:
> $ ip link set ens1 vf 1 rate 2294967296
> $ ip link show |grep -iE "vf 1" | grep rate
> 
> before:
> vf 1 MAC 00:00:00:00:00:00, tx rate -2000000000 (Mbps), max_tx_rate -2000000000Mbps, ...
> 
> after:
> vf 1 MAC 00:00:00:00:00:00, tx rate 2294967296 (Mbps), max_tx_rate 2294967296Mbps, ...
> 
> Fixes: 3fd86630876a ("iproute2: rework SR-IOV VF support")
> Fixes: 8c29ae7cc249 ("ip link: Fix crash on older kernels when show VF dev")
> Fixes: f89a2a05ffa9 ("Add support to configure SR-IOV VF minimum and maximum Tx rate through ip tool")
> Fixes: ae7229d5f99e ("ip: Add support for setting and showing SR-IOV virtual funtion link params")
> Fixes: d0e720111aad ("ip: ipaddress.c: add support for json output")
> Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
> ---
> 
> v1 -> v2:
> Fixed JSON output (print_uint) as well.
> Updated commit message.
> 

change looks fine to me.

As a bug fix seems like this should go to iproute2-master not -next.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH V2 iproute2-next] ip-address: Fix negative prints of large TX rate limits
  2018-03-08 16:08 [PATCH V2 iproute2-next] ip-address: Fix negative prints of large TX rate limits Tariq Toukan
  2018-03-08 18:16 ` David Ahern
@ 2018-03-10 17:01 ` Stephen Hemminger
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2018-03-10 17:01 UTC (permalink / raw)
  To: Tariq Toukan; +Cc: David Ahern, netdev

On Thu,  8 Mar 2018 18:08:26 +0200
Tariq Toukan <tariqt@mellanox.com> wrote:

> TX rate limit fields are unsigned (__u32).
> Use %u and print_uint when printing.
> 
> Tested:
> $ ip link set ens1 vf 1 rate 2294967296
> $ ip link show |grep -iE "vf 1" | grep rate
> 
> before:
> vf 1 MAC 00:00:00:00:00:00, tx rate -2000000000 (Mbps), max_tx_rate -2000000000Mbps, ...
> 
> after:
> vf 1 MAC 00:00:00:00:00:00, tx rate 2294967296 (Mbps), max_tx_rate 2294967296Mbps, ...
> 
> Fixes: 3fd86630876a ("iproute2: rework SR-IOV VF support")
> Fixes: 8c29ae7cc249 ("ip link: Fix crash on older kernels when show VF dev")
> Fixes: f89a2a05ffa9 ("Add support to configure SR-IOV VF minimum and maximum Tx rate through ip tool")
> Fixes: ae7229d5f99e ("ip: Add support for setting and showing SR-IOV virtual funtion link params")
> Fixes: d0e720111aad ("ip: ipaddress.c: add support for json output")
> Signed-off-by: Tariq Toukan <tariqt@mellanox.com>

Applied to master.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-03-10 17:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-08 16:08 [PATCH V2 iproute2-next] ip-address: Fix negative prints of large TX rate limits Tariq Toukan
2018-03-08 18:16 ` David Ahern
2018-03-10 17:01 ` Stephen Hemminger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.