* [PATCH net-next] ibmvnic: Improve output for unsupported stats
@ 2017-10-02 20:31 John Allen
2017-10-02 21:57 ` Andrew Lunn
0 siblings, 1 reply; 3+ messages in thread
From: John Allen @ 2017-10-02 20:31 UTC (permalink / raw)
To: netdev, Thomas Falcon
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@linux.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;
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net-next] ibmvnic: Improve output for unsupported stats
2017-10-02 20:31 [PATCH net-next] ibmvnic: Improve output for unsupported stats John Allen
@ 2017-10-02 21:57 ` Andrew Lunn
2017-10-02 23:03 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Lunn @ 2017-10-02 21:57 UTC (permalink / raw)
To: John Allen; +Cc: netdev, Thomas Falcon
On Mon, Oct 02, 2017 at 03:31:39PM -0500, John Allen wrote:
> 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.
Hi John
If it does not exist, why not skip it altogether?
ibmvnic_get_sset_count() could walk the list and count the valid ones.
ibmvnic_get_strings() could only return the name of the valid onces.
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH net-next] ibmvnic: Improve output for unsupported stats
2017-10-02 21:57 ` Andrew Lunn
@ 2017-10-02 23:03 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2017-10-02 23:03 UTC (permalink / raw)
To: andrew; +Cc: jallen, netdev, tlfalcon
From: Andrew Lunn <andrew@lunn.ch>
Date: Mon, 2 Oct 2017 23:57:23 +0200
> On Mon, Oct 02, 2017 at 03:31:39PM -0500, John Allen wrote:
>> 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.
>
> Hi John
>
> If it does not exist, why not skip it altogether?
> ibmvnic_get_sset_count() could walk the list and count the valid ones.
> ibmvnic_get_strings() could only return the name of the valid onces.
Agreed, skipping would be preferable to printing zero values.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-10-02 23:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-02 20:31 [PATCH net-next] ibmvnic: Improve output for unsupported stats John Allen
2017-10-02 21:57 ` Andrew Lunn
2017-10-02 23:03 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox