aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennert Buytenhek <buytenh@wantstofly.org>2009-04-29 07:58:18 -0400
committerDavid S. Miller <davem@davemloft.net>2009-04-29 20:24:19 -0400
commit93af7aca44f0e82e67bda10a0fb73d383edcc8bd (patch)
treee5d336ee7b7eac1b2e0091e948085de284ae344c
parent1319ebadf185933e6b7ff95211d3cef9004e9754 (diff)
mv643xx_eth: 64bit mib counter read fix
On several mv643xx_eth hardware versions, the two 64bit mib counters for 'good octets received' and 'good octets sent' are actually 32bit counters, and reading from the upper half of the register has the same effect as reading from the lower half of the register: an atomic read-and-clear of the entire 32bit counter value. This can under heavy traffic occasionally lead to small numbers being added to the upper half of the 64bit mib counter even though no 32bit wrap has occured. Since we poll the mib counters at least every 30 seconds anyway, we might as well just skip the reads of the upper halves of the hardware counters without breaking the stats, which this patch does. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Cc: stable@kernel.org Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/mv643xx_eth.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 038beff7da80..a400d7115f78 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -1255,7 +1255,6 @@ static void mib_counters_update(struct mv643xx_eth_private *mp)
1255 1255
1256 spin_lock_bh(&mp->mib_counters_lock); 1256 spin_lock_bh(&mp->mib_counters_lock);
1257 p->good_octets_received += mib_read(mp, 0x00); 1257 p->good_octets_received += mib_read(mp, 0x00);
1258 p->good_octets_received += (u64)mib_read(mp, 0x04) << 32;
1259 p->bad_octets_received += mib_read(mp, 0x08); 1258 p->bad_octets_received += mib_read(mp, 0x08);
1260 p->internal_mac_transmit_err += mib_read(mp, 0x0c); 1259 p->internal_mac_transmit_err += mib_read(mp, 0x0c);
1261 p->good_frames_received += mib_read(mp, 0x10); 1260 p->good_frames_received += mib_read(mp, 0x10);
@@ -1269,7 +1268,6 @@ static void mib_counters_update(struct mv643xx_eth_private *mp)
1269 p->frames_512_to_1023_octets += mib_read(mp, 0x30); 1268 p->frames_512_to_1023_octets += mib_read(mp, 0x30);
1270 p->frames_1024_to_max_octets += mib_read(mp, 0x34); 1269 p->frames_1024_to_max_octets += mib_read(mp, 0x34);
1271 p->good_octets_sent += mib_read(mp, 0x38); 1270 p->good_octets_sent += mib_read(mp, 0x38);
1272 p->good_octets_sent += (u64)mib_read(mp, 0x3c) << 32;
1273 p->good_frames_sent += mib_read(mp, 0x40); 1271 p->good_frames_sent += mib_read(mp, 0x40);
1274 p->excessive_collision += mib_read(mp, 0x44); 1272 p->excessive_collision += mib_read(mp, 0x44);
1275 p->multicast_frames_sent += mib_read(mp, 0x48); 1273 p->multicast_frames_sent += mib_read(mp, 0x48);