Skip to contentSkip to conversation

net: systemport: Fix software statistics for SYSTEMPORT Lite

PATCH Superseded Florian Fainelli 2 participants 3 messages Aug 8, 2017

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: systemport: Fix software statistics for SYSTEMPORT Lite

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")
---
 drivers/net/ethernet/broadcom/bcmsysport.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bcmsysport.c +5 -1
index 5333601f855f..abf175372719 100644
@@ -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;
 	}
Signature · 1 line
2.9.3
#1 lore raw
Quoted 7 lines · 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")

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

Signature · 1 line
Florian
maintainer
#2 lore raw

From: Florian Fainelli <[email protected]>
Date: Tue, 8 Aug 2017 14:44:40 -0700

Quoted 11 lines · Florian Fainelli
Quoted 7 lines

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")

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

Ok.