[patch] sys/dev/nfe/if_nfe.c

Paul A. Patience paul-a.patience at polymtl.ca
Thu Oct 3 07:14:06 UTC 2013


Hello,

I _may_ have found another bug in nfe(4).
If the goal in nfe_stats_clear() is to read all
the stats registers, then it is doing it wrong.
It currently reads every fourth register.
Here is a patch to fix this behaviour:

--- if_nfe.c.original	Thu Oct  3 03:10:11 2013
+++ if_nfe.c	Thu Oct  3 03:11:10 2013
@@ -3205,8 +3205,8 @@
 	else
 		return;
 
-	for (i = 0; i < mib_cnt; i += sizeof(uint32_t))
-		NFE_READ(sc, NFE_TX_OCTET + i);
+	for (i = 0; i < mib_cnt; i++)
+		NFE_READ(sc, NFE_TX_OCTET + i*sizeof(uint32_t));
 
 	if ((sc->nfe_flags & NFE_MIB_V3) != 0) {
 		NFE_READ(sc, NFE_TX_UNICAST);

--
pap


More information about the freebsd-drivers mailing list