netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: systemport: Fix software statistics for SYSTEMPORT Lite
@ 2017-08-08 21:39 Florian Fainelli
  2017-08-08 21:44 ` Florian Fainelli
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Fainelli @ 2017-08-08 21:39 UTC (permalink / raw)
  To: netdev; +Cc: davem, Florian Fainelli

With SYSTEMPORT Lite we have holes in our statistics layout that make us
skip over the hardware MIB counters, bcm_sysport_get_stats() was not
taking that into account, resulting in reporting 0 for all SW-maintained
statistics, fix this by skipping accordingly.

Fixes: 44a4524c54af ("net: systemport: Add support for SYSTEMPORT Lite")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/broadcom/bcmsysport.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 5333601f855f..abf175372719 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -449,6 +449,10 @@ static void bcm_sysport_get_stats(struct net_device *dev,
 			p = (char *)&dev->stats;
 		else
 			p = (char *)priv;
+
+		if (priv->is_lite && !bcm_sysport_lite_stat_valid(s->type))
+			continue;
+
 		p += s->stat_offset;
 		data[j] = *(unsigned long *)p;
 		j++;
@@ -608,8 +612,8 @@ static struct sk_buff *bcm_sysport_rx_refill(struct bcm_sysport_priv *priv,
 
 	/* Allocate a new SKB for a new packet */
 	skb = netdev_alloc_skb(priv->netdev, RX_BUF_LENGTH);
+	priv->mib.alloc_rx_buff_failed++;
 	if (!skb) {
-		priv->mib.alloc_rx_buff_failed++;
 		netif_err(priv, rx_err, ndev, "SKB alloc failed\n");
 		return NULL;
 	}
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: systemport: Fix software statistics for SYSTEMPORT Lite
  2017-08-08 21:39 [PATCH] net: systemport: Fix software statistics for SYSTEMPORT Lite Florian Fainelli
@ 2017-08-08 21:44 ` Florian Fainelli
  2017-08-08 21:54   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Fainelli @ 2017-08-08 21:44 UTC (permalink / raw)
  To: netdev; +Cc: davem

On 08/08/2017 02:39 PM, Florian Fainelli wrote:
> With SYSTEMPORT Lite we have holes in our statistics layout that make us
> skip over the hardware MIB counters, bcm_sysport_get_stats() was not
> taking that into account, resulting in reporting 0 for all SW-maintained
> statistics, fix this by skipping accordingly.
> 
> Fixes: 44a4524c54af ("net: systemport: Add support for SYSTEMPORT Lite")
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

David, please ignore this version, I accidentally sent it with the
debugging left.
-- 
Florian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: systemport: Fix software statistics for SYSTEMPORT Lite
  2017-08-08 21:44 ` Florian Fainelli
@ 2017-08-08 21:54   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2017-08-08 21:54 UTC (permalink / raw)
  To: f.fainelli; +Cc: netdev

From: Florian Fainelli <f.fainelli@gmail.com>
Date: Tue, 8 Aug 2017 14:44:40 -0700

> On 08/08/2017 02:39 PM, Florian Fainelli wrote:
>> With SYSTEMPORT Lite we have holes in our statistics layout that make us
>> skip over the hardware MIB counters, bcm_sysport_get_stats() was not
>> taking that into account, resulting in reporting 0 for all SW-maintained
>> statistics, fix this by skipping accordingly.
>> 
>> Fixes: 44a4524c54af ("net: systemport: Add support for SYSTEMPORT Lite")
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> 
> David, please ignore this version, I accidentally sent it with the
> debugging left.

Ok.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-08-08 21:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-08 21:39 [PATCH] net: systemport: Fix software statistics for SYSTEMPORT Lite Florian Fainelli
2017-08-08 21:44 ` Florian Fainelli
2017-08-08 21:54   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).