[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <6ce14d1a-11cc-37be-e6ca-b9ec4afb01a8@linux.vnet.ibm.com>
Date: Mon, 2 Oct 2017 15:31:39 -0500
From: John Allen <jallen@...ux.vnet.ibm.com>
To: netdev@...r.kernel.org, Thomas Falcon <tlfalcon@...ux.vnet.ibm.com>
Subject: [PATCH net-next] ibmvnic: Improve output for unsupported stats
The vnic server can report -1 in the event that a given statistic is not
supported. Currently, the -1 value is implicitly cast to an unsigned
integer and appears through the ethtool -S output as a very large number.
This patch improves this behavior by reporting 0 in the event that a
given statistic is not supported.
Signed-off-by: John Allen <jallen@...ux.vnet.ibm.com>
---
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index cb8182f..b8ad2db 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -1862,6 +1862,7 @@ static void ibmvnic_get_ethtool_stats(struct net_device *dev,
{
struct ibmvnic_adapter *adapter = netdev_priv(dev);
union ibmvnic_crq crq;
+ u64 stat;
int i, j;
memset(&crq, 0, sizeof(crq));
@@ -1876,9 +1877,11 @@ static void ibmvnic_get_ethtool_stats(struct net_device *dev,
ibmvnic_send_crq(adapter, &crq);
wait_for_completion(&adapter->stats_done);
- for (i = 0; i < ARRAY_SIZE(ibmvnic_stats); i++)
- data[i] = be64_to_cpu(IBMVNIC_GET_STAT(adapter,
- ibmvnic_stats[i].offset));
+ for (i = 0; i < ARRAY_SIZE(ibmvnic_stats); i++) {
+ stat = be64_to_cpu(IBMVNIC_GET_STAT(adapter,
+ ibmvnic_stats[i].offset));
+ data[i] = stat == -1 ? 0 : stat;
+ }
for (j = 0; j < adapter->req_tx_queues; j++) {
data[i] = adapter->tx_stats_buffers[j].packets;
Powered by blists - more mailing lists