diff mbox series

[iproute2] iplink: report drop stats for VFs

Message ID 20180725162212.26212-1-ivecera@redhat.com
State Rejected, archived
Delegated to: David Ahern
Headers show
Series [iproute2] iplink: report drop stats for VFs | expand

Commit Message

Ivan Vecera July 25, 2018, 4:22 p.m. UTC
Kernel commit c5a9f6f0ab40 ("net/core: Add drop counters to VF
statistics") added support for Rx/Tx packet drops but these stats are
not reported by 'ip link'.

Cc: Eugenia Emantayev <eugenia@mellanox.com>
Cc: Saeed Mahameed <saeedm@mellanox.com>

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
---
 ip/ipaddress.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

Comments

David Ahern July 25, 2018, 5:04 p.m. UTC | #1
On 7/25/18 10:22 AM, Ivan Vecera wrote:
> Kernel commit c5a9f6f0ab40 ("net/core: Add drop counters to VF
> statistics") added support for Rx/Tx packet drops but these stats are
> not reported by 'ip link'.
> 
> Cc: Eugenia Emantayev <eugenia@mellanox.com>
> Cc: Saeed Mahameed <saeedm@mellanox.com>
> 
> Signed-off-by: Ivan Vecera <ivecera@redhat.com>
> ---
>  ip/ipaddress.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 

duplicates a patch from Eran which I just committed to iproute2-next
Ivan Vecera July 25, 2018, 7:11 p.m. UTC | #2
On 25.7.2018 19:04, David Ahern wrote:
> On 7/25/18 10:22 AM, Ivan Vecera wrote:
>> Kernel commit c5a9f6f0ab40 ("net/core: Add drop counters to VF
>> statistics") added support for Rx/Tx packet drops but these stats are
>> not reported by 'ip link'.
>>
>> Cc: Eugenia Emantayev <eugenia@mellanox.com>
>> Cc: Saeed Mahameed <saeedm@mellanox.com>
>>
>> Signed-off-by: Ivan Vecera <ivecera@redhat.com>
>> ---
>>  ip/ipaddress.c | 11 +++++++++--
>>  1 file changed, 9 insertions(+), 2 deletions(-)
>>
> 
> duplicates a patch from Eran which I just committed to iproute2-next
> 
Oops, I missed it :-)

I.
diff mbox series

Patch

diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index ea8211c1..1b5ec02a 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -558,6 +558,8 @@  static void print_vf_stats64(FILE *fp, struct rtattr *vfstats)
 			   rta_getattr_u64(vf[IFLA_VF_STATS_RX_BYTES]));
 		print_u64(PRINT_JSON, "packets", NULL,
 			   rta_getattr_u64(vf[IFLA_VF_STATS_RX_PACKETS]));
+		print_u64(PRINT_JSON, "dropped", NULL,
+			   rta_getattr_u64(vf[IFLA_VF_STATS_RX_DROPPED]));
 		print_u64(PRINT_JSON, "multicast", NULL,
 			   rta_getattr_u64(vf[IFLA_VF_STATS_MULTICAST]));
 		print_u64(PRINT_JSON, "broadcast", NULL,
@@ -570,26 +572,31 @@  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]));
+		print_u64(PRINT_JSON, "tx_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  dropped mcast   bcast %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_RX_DROPPED]));
 		print_num(fp, 7, rta_getattr_u64(vf[IFLA_VF_STATS_MULTICAST]));
 		print_num(fp, 7, rta_getattr_u64(vf[IFLA_VF_STATS_BROADCAST]));
 
 		/* TX stats */
 		fprintf(fp, "%s", _SL_);
-		fprintf(fp, "    TX: bytes  packets %s", _SL_);
+		fprintf(fp, "    TX: bytes  packets  dropped %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]));
+		print_num(fp, 7, rta_getattr_u64(vf[IFLA_VF_STATS_TX_DROPPED]));
 	}
 }