* [PATCH] at91_ether: late collistions are counted twice
@ 2008-05-08 15:39 Marc Pignat
2008-05-08 19:40 ` Andrew Victor
0 siblings, 1 reply; 2+ messages in thread
From: Marc Pignat @ 2008-05-08 15:39 UTC (permalink / raw)
To: linux-arm-kernel; +Cc: netdev, linux
According to the at91rm9200 datasheet, table 36-6, late collisions
(AT91_EMAC_LCOL) are already counted in the collision register (in scol, mcol or
ecol , depending on the type of error).
So don't count them twice in stats.collisions.
Signed-off-by: Marc Pignat <marc.pignat@hevs.ch>
---
Hello!
After reviewing the "at91_ether: use netstats in net_device structure" patch, I
had a look the the datasheet and found this small error.
This is really a small error (in statistics) and I will never have collisions,
I'm connected to a switch, but I've no reason not fixing it :)
Best regards
Marc
patch against v2.6.26-rc1 + "[PATCH v2] at91_ether: use netstats in net_device structure"
--- a/drivers/net/arm/at91_ether.c
+++ b/drivers/net/arm/at91_ether.c
@@ -843,7 +843,7 @@ static int at91ether_tx(struct sk_buff *skb, struct net_device *dev)
*/
static struct net_device_stats *at91ether_stats(struct net_device *dev)
{
- int ale, lenerr, seqe, lcol, ecol;
+ int ale, lenerr, seqe, ecol;
if (netif_running(dev)) {
dev->stats.rx_packets += at91_emac_read(AT91_EMAC_OK); /* Good frames received */
@@ -862,12 +862,11 @@ static struct net_device_stats *at91ether_stats(struct net_device *dev)
dev->stats.tx_carrier_errors += at91_emac_read(AT91_EMAC_CSE); /* Carrier Sense errors */
dev->stats.tx_heartbeat_errors += at91_emac_read(AT91_EMAC_SQEE);/* Heartbeat error */
- lcol = at91_emac_read(AT91_EMAC_LCOL);
+ dev->stats.tx_window_errors += at91_emac_read(AT91_EMAC_LCOL); /* Late collisions */
ecol = at91_emac_read(AT91_EMAC_ECOL);
- dev->stats.tx_window_errors += lcol; /* Late collisions */
dev->stats.tx_aborted_errors += ecol; /* 16 collisions */
- dev->stats.collisions += (at91_emac_read(AT91_EMAC_SCOL) + at91_emac_read(AT91_EMAC_MCOL) + lcol + ecol);
+ dev->stats.collisions += (at91_emac_read(AT91_EMAC_SCOL) + at91_emac_read(AT91_EMAC_MCOL) + ecol);
}
return &dev->stats;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] at91_ether: late collistions are counted twice
2008-05-08 15:39 [PATCH] at91_ether: late collistions are counted twice Marc Pignat
@ 2008-05-08 19:40 ` Andrew Victor
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Victor @ 2008-05-08 19:40 UTC (permalink / raw)
To: Marc Pignat; +Cc: linux-arm-kernel, netdev, linux
hi,
> According to the at91rm9200 datasheet, table 36-6, late collisions
> (AT91_EMAC_LCOL) are already counted in the collision register (in scol, mcol or
> ecol , depending on the type of error).
>
> So don't count them twice in stats.collisions.
>
> Signed-off-by: Marc Pignat <marc.pignat@hevs.ch>
Acked-by: Andrew Victor <linux@maxim.org.za>
Regards,
Andrew Victor
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-05-08 19:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-08 15:39 [PATCH] at91_ether: late collistions are counted twice Marc Pignat
2008-05-08 19:40 ` Andrew Victor
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).