* [PATCH] mpc52xx: Correct calculation of FEC RX errors.
@ 2007-05-24 22:01 Grzegorz Bernacki
2007-05-28 19:04 ` Sylvain Munaut
0 siblings, 1 reply; 2+ messages in thread
From: Grzegorz Bernacki @ 2007-05-24 22:01 UTC (permalink / raw)
To: linuxppc-embedded
'ifconfig eth0' command for mpc5200B-based cards shows error for RX.
However none of RX MIB counters is set to value greater than zero.
Number of errors is equal to number of multicast packet. In linux 2.4
calculation of RX errors is slightly different and takes into account
number of multicast packet. This change is a port of calculation method
of RX errors for FEC controller from linux 2.4 to 2.6.
Signed-off-by: Grzegorz Bernacki <gjb@semihalf.com>
---
drivers/net/fec_mpc52xx/fec.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/net/fec_mpc52xx/fec.c b/drivers/net/fec_mpc52xx/fec.c
index f0ce87e..d2087f6 100644
--- a/drivers/net/fec_mpc52xx/fec.c
+++ b/drivers/net/fec_mpc52xx/fec.c
@@ -395,7 +395,9 @@ static struct net_device_stats *fec_get_stats(struct
net_device *dev)
stats->rx_bytes = in_be32(&fec->rmon_r_octets);
stats->rx_packets = in_be32(&fec->rmon_r_packets);
- stats->rx_errors = stats->rx_packets -
in_be32(&fec->ieee_r_frame_ok);
+ stats->rx_errors = stats->rx_packets - (
+ in_be32(&fec->ieee_r_frame_ok) +
+ in_be32(&fec->rmon_r_mc_pkt));
stats->tx_bytes = in_be32(&fec->rmon_t_octets);
stats->tx_packets = in_be32(&fec->rmon_t_packets);
stats->tx_errors = stats->tx_packets - (
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mpc52xx: Correct calculation of FEC RX errors.
2007-05-24 22:01 [PATCH] mpc52xx: Correct calculation of FEC RX errors Grzegorz Bernacki
@ 2007-05-28 19:04 ` Sylvain Munaut
0 siblings, 0 replies; 2+ messages in thread
From: Sylvain Munaut @ 2007-05-28 19:04 UTC (permalink / raw)
To: Grzegorz Bernacki; +Cc: linuxppc-embedded
Nice catch,
I knew something was wrong ( 4 billion errors ;) but I never bothered to
look
it up.
Sylvain
Grzegorz Bernacki wrote:
> 'ifconfig eth0' command for mpc5200B-based cards shows error for RX.
> However none of RX MIB counters is set to value greater than zero.
> Number of errors is equal to number of multicast packet. In linux 2.4
> calculation of RX errors is slightly different and takes into account
> number of multicast packet. This change is a port of calculation method
> of RX errors for FEC controller from linux 2.4 to 2.6.
>
> Signed-off-by: Grzegorz Bernacki <gjb@semihalf.com>
> ---
>
> drivers/net/fec_mpc52xx/fec.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/fec_mpc52xx/fec.c b/drivers/net/fec_mpc52xx/fec.c
> index f0ce87e..d2087f6 100644
> --- a/drivers/net/fec_mpc52xx/fec.c
> +++ b/drivers/net/fec_mpc52xx/fec.c
> @@ -395,7 +395,9 @@ static struct net_device_stats *fec_get_stats(struct
> net_device *dev)
>
> stats->rx_bytes = in_be32(&fec->rmon_r_octets);
> stats->rx_packets = in_be32(&fec->rmon_r_packets);
> - stats->rx_errors = stats->rx_packets -
> in_be32(&fec->ieee_r_frame_ok);
> + stats->rx_errors = stats->rx_packets - (
> + in_be32(&fec->ieee_r_frame_ok) +
> + in_be32(&fec->rmon_r_mc_pkt));
> stats->tx_bytes = in_be32(&fec->rmon_t_octets);
> stats->tx_packets = in_be32(&fec->rmon_t_packets);
> stats->tx_errors = stats->tx_packets - (
>
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-05-28 19:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-24 22:01 [PATCH] mpc52xx: Correct calculation of FEC RX errors Grzegorz Bernacki
2007-05-28 19:04 ` Sylvain Munaut
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).