All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH iproute2-next] ip: Add violation counters to VF statisctics
@ 2018-07-22 10:31 Eran Ben Elisha
  2018-07-25 17:00 ` David Ahern
  0 siblings, 1 reply; 2+ messages in thread
From: Eran Ben Elisha @ 2018-07-22 10:31 UTC (permalink / raw)
  To: David Ahern, Stephen Hemminger; +Cc: netdev, Eran Ben Elisha

Extend VFs statistics by receive and transmit violation counters.

Example: "ip -s link show dev enp5s0f0"

6: enp5s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether 24:8a:07:a5:28:f0 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast
    0          0        0       0       0       2
    TX: bytes  packets  errors  dropped carrier collsns
    1406       17       0       0       0       0
    vf 0 MAC 00:00:ca:fe:ca:fe, vlan 5, spoof checking off, link-state auto, trust off, query_rss off
    RX: bytes  packets  mcast   bcast   dropped
    1666       29       14         32      0
    TX: bytes  packets   dropped
    2880       44       2412

Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
---
 ip/ipaddress.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 5009bfe6d2e3..ddb8bf876e10 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -562,6 +562,9 @@ static void print_vf_stats64(FILE *fp, struct rtattr *vfstats)
 			   rta_getattr_u64(vf[IFLA_VF_STATS_MULTICAST]));
 		print_u64(PRINT_JSON, "broadcast", NULL,
 			   rta_getattr_u64(vf[IFLA_VF_STATS_BROADCAST]));
+		if (vf[IFLA_VF_STATS_RX_DROPPED])
+			print_u64(PRINT_JSON, "dropped", NULL,
+				  rta_getattr_u64(vf[IFLA_VF_STATS_RX_DROPPED]));
 		close_json_object();
 
 		/* TX stats */
@@ -570,26 +573,39 @@ static void print_vf_stats64(FILE *fp, struct rtattr *vfstats)
 			   rta_getattr_u64(vf[IFLA_VF_STATS_TX_BYTES]));
 		print_u64(PRINT_JSON, "tx_packets", NULL,
 			   rta_getattr_u64(vf[IFLA_VF_STATS_TX_PACKETS]));
+		if (vf[IFLA_VF_STATS_TX_DROPPED])
+			print_u64(PRINT_JSON, "dropped", NULL,
+				  rta_getattr_u64(vf[IFLA_VF_STATS_TX_DROPPED]));
 		close_json_object();
 		close_json_object();
 	} else {
 		/* RX stats */
 		fprintf(fp, "%s", _SL_);
-		fprintf(fp, "    RX: bytes  packets  mcast   bcast %s", _SL_);
+		fprintf(fp, "    RX: bytes  packets  mcast   bcast ");
+		if (vf[IFLA_VF_STATS_RX_DROPPED])
+			fprintf(fp, "  dropped ");
+		fprintf(fp, "%s", _SL_);
 		fprintf(fp, "    ");
 
 		print_num(fp, 10, rta_getattr_u64(vf[IFLA_VF_STATS_RX_BYTES]));
 		print_num(fp, 8, rta_getattr_u64(vf[IFLA_VF_STATS_RX_PACKETS]));
 		print_num(fp, 7, rta_getattr_u64(vf[IFLA_VF_STATS_MULTICAST]));
 		print_num(fp, 7, rta_getattr_u64(vf[IFLA_VF_STATS_BROADCAST]));
+		if (vf[IFLA_VF_STATS_RX_DROPPED])
+			print_num(fp, 8, rta_getattr_u64(vf[IFLA_VF_STATS_RX_DROPPED]));
 
 		/* TX stats */
 		fprintf(fp, "%s", _SL_);
-		fprintf(fp, "    TX: bytes  packets %s", _SL_);
+		fprintf(fp, "    TX: bytes  packets ");
+		if (vf[IFLA_VF_STATS_TX_DROPPED])
+			fprintf(fp, "  dropped ");
+		fprintf(fp, "%s", _SL_);
 		fprintf(fp, "    ");
 
 		print_num(fp, 10, rta_getattr_u64(vf[IFLA_VF_STATS_TX_BYTES]));
 		print_num(fp, 8, rta_getattr_u64(vf[IFLA_VF_STATS_TX_PACKETS]));
+		if (vf[IFLA_VF_STATS_TX_DROPPED])
+			print_num(fp, 8, rta_getattr_u64(vf[IFLA_VF_STATS_TX_DROPPED]));
 	}
 }
 
-- 
1.8.3.1

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

* Re: [PATCH iproute2-next] ip: Add violation counters to VF statisctics
  2018-07-22 10:31 [PATCH iproute2-next] ip: Add violation counters to VF statisctics Eran Ben Elisha
@ 2018-07-25 17:00 ` David Ahern
  0 siblings, 0 replies; 2+ messages in thread
From: David Ahern @ 2018-07-25 17:00 UTC (permalink / raw)
  To: Eran Ben Elisha, Stephen Hemminger; +Cc: netdev

On 7/22/18 4:31 AM, Eran Ben Elisha wrote:
> Extend VFs statistics by receive and transmit violation counters.
> 
> Example: "ip -s link show dev enp5s0f0"
> 
> 6: enp5s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
>     link/ether 24:8a:07:a5:28:f0 brd ff:ff:ff:ff:ff:ff
>     RX: bytes  packets  errors  dropped overrun mcast
>     0          0        0       0       0       2
>     TX: bytes  packets  errors  dropped carrier collsns
>     1406       17       0       0       0       0
>     vf 0 MAC 00:00:ca:fe:ca:fe, vlan 5, spoof checking off, link-state auto, trust off, query_rss off
>     RX: bytes  packets  mcast   bcast   dropped
>     1666       29       14         32      0
>     TX: bytes  packets   dropped
>     2880       44       2412
> 
> Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
> ---
>  ip/ipaddress.c | 20 ++++++++++++++++++--
>  1 file changed, 18 insertions(+), 2 deletions(-)
> 

applied to iproute2-next. Thanks

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

end of thread, other threads:[~2018-07-25 18:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-22 10:31 [PATCH iproute2-next] ip: Add violation counters to VF statisctics Eran Ben Elisha
2018-07-25 17:00 ` David Ahern

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.