naccyde / rpms / iproute

Forked from rpms/iproute 7 months ago
Clone

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

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