naccyde / rpms / iproute

Forked from rpms/iproute 10 months ago
Clone

Blame SOURCES/0055-ip-Add-violation-counters-to-VF-statisctics.patch

99be8f
From 1e22b512374d25b547212bdbe1530ac8de1defdf Mon Sep 17 00:00:00 2001
99be8f
From: Andrea Claudi <aclaudi@redhat.com>
99be8f
Date: Mon, 18 Mar 2019 11:23:40 +0100
99be8f
Subject: [PATCH] ip: Add violation counters to VF statisctics
99be8f
99be8f
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1471680
99be8f
Upstream Status: unknown commit 8c7acf3a
99be8f
Conflicts: manually applied due to JSON support
99be8f
99be8f
commit 8c7acf3a7ac265badc287f064614d60119a8072d
99be8f
Author: Eran Ben Elisha <eranbe@mellanox.com>
99be8f
Date:   Sun Jul 22 13:31:12 2018 +0300
99be8f
99be8f
    ip: Add violation counters to VF statisctics
99be8f
99be8f
    Extend VFs statistics by receive and transmit violation counters.
99be8f
99be8f
    Example: "ip -s link show dev enp5s0f0"
99be8f
99be8f
    6: enp5s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
99be8f
        link/ether 24:8a:07:a5:28:f0 brd ff:ff:ff:ff:ff:ff
99be8f
        RX: bytes  packets  errors  dropped overrun mcast
99be8f
        0          0        0       0       0       2
99be8f
        TX: bytes  packets  errors  dropped carrier collsns
99be8f
        1406       17       0       0       0       0
99be8f
        vf 0 MAC 00:00:ca:fe:ca:fe, vlan 5, spoof checking off, link-state auto, trust off, query_rss off
99be8f
        RX: bytes  packets  mcast   bcast   dropped
99be8f
        1666       29       14         32      0
99be8f
        TX: bytes  packets   dropped
99be8f
        2880       44       2412
99be8f
99be8f
    Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
99be8f
    Signed-off-by: David Ahern <dsahern@gmail.com>
99be8f
---
99be8f
 ip/ipaddress.c | 14 ++++++++++++--
99be8f
 1 file changed, 12 insertions(+), 2 deletions(-)
99be8f
99be8f
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
d30c09
index 14e9e224dfa87..44111a27501a9 100644
99be8f
--- a/ip/ipaddress.c
99be8f
+++ b/ip/ipaddress.c
99be8f
@@ -471,21 +471,31 @@ static void print_vf_stats64(FILE *fp, struct rtattr *vfstats)
99be8f
 
99be8f
 	/* RX stats */
99be8f
 	fprintf(fp, "%s", _SL_);
99be8f
-	fprintf(fp, "    RX: bytes  packets  mcast   bcast %s", _SL_);
99be8f
+	fprintf(fp, "    RX: bytes  packets  mcast   bcast ");
99be8f
+	if (vf[IFLA_VF_STATS_RX_DROPPED])
99be8f
+		fprintf(fp, "  dropped ");
99be8f
+	fprintf(fp, "%s", _SL_);
99be8f
 	fprintf(fp, "    ");
99be8f
 
99be8f
 	print_num(fp, 10,  rta_getattr_u64(vf[IFLA_VF_STATS_RX_BYTES]));
99be8f
 	print_num(fp, 8, rta_getattr_u64(vf[IFLA_VF_STATS_RX_PACKETS]));
99be8f
 	print_num(fp, 7, rta_getattr_u64(vf[IFLA_VF_STATS_MULTICAST]));
99be8f
 	print_num(fp, 7, rta_getattr_u64(vf[IFLA_VF_STATS_BROADCAST]));
99be8f
+	if (vf[IFLA_VF_STATS_RX_DROPPED])
99be8f
+		print_num(fp, 8, rta_getattr_u64(vf[IFLA_VF_STATS_RX_DROPPED]));
99be8f
 
99be8f
 	/* TX stats */
99be8f
 	fprintf(fp, "%s", _SL_);
99be8f
-	fprintf(fp, "    TX: bytes  packets %s", _SL_);
99be8f
+	fprintf(fp, "    TX: bytes  packets ");
99be8f
+	if (vf[IFLA_VF_STATS_TX_DROPPED])
99be8f
+		fprintf(fp, "  dropped ");
99be8f
+	fprintf(fp, "%s", _SL_);
99be8f
 	fprintf(fp, "    ");
99be8f
 
99be8f
 	print_num(fp, 10, rta_getattr_u64(vf[IFLA_VF_STATS_TX_BYTES]));
99be8f
 	print_num(fp, 8, rta_getattr_u64(vf[IFLA_VF_STATS_TX_PACKETS]));
99be8f
+	if (vf[IFLA_VF_STATS_TX_DROPPED])
99be8f
+		print_num(fp, 8, rta_getattr_u64(vf[IFLA_VF_STATS_TX_DROPPED]));
99be8f
 }
99be8f
 
99be8f
 static void print_link_stats64(FILE *fp, const struct rtnl_link_stats64 *s,
99be8f
-- 
d30c09
2.21.0
99be8f