summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorTroy Kisky <troy.kisky@boundarydevices.com>2012-12-01 13:58:30 -0700
committerJustin Waters <justin.waters@timesys.com>2013-11-07 12:19:30 -0500
commit69cfc026d76d8180ab25564d9ffcb8a674c3dbaa (patch)
treeb6bec2818f0f6e5acee73ed3e2e0a7e871f4866d /drivers
parent463e3be9b51d25b714db672d2331421366a525e1 (diff)
fec: fix rx error counts
On an overrun, the other flags are not valid, so don't check them. Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com> Signed-off-by: Christian Hemp <c.hemp@phytec.de>
Diffstat (limited to 'drivers')
-rwxr-xr-xdrivers/net/fec.c43
1 files changed, 24 insertions, 19 deletions
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index e47a4d658f4c..4f9ea97c2c5a 100755
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -603,28 +603,33 @@ static int fec_rx_poll(struct napi_struct *napi, int budget)
goto rx_processing_done;
/* Check for errors. */
+ status ^= BD_ENET_RX_LAST;
if (status & (BD_ENET_RX_LG | BD_ENET_RX_SH | BD_ENET_RX_NO |
- BD_ENET_RX_CR | BD_ENET_RX_OV)) {
+ BD_ENET_RX_CR | BD_ENET_RX_OV | BD_ENET_RX_LAST |
+ BD_ENET_RX_CL)) {
ndev->stats.rx_errors++;
- if (status & (BD_ENET_RX_LG | BD_ENET_RX_SH)) {
- /* Frame too long or too short. */
- ndev->stats.rx_length_errors++;
- }
- if (status & BD_ENET_RX_NO) /* Frame alignment */
- ndev->stats.rx_frame_errors++;
- if (status & BD_ENET_RX_CR) /* CRC Error */
- ndev->stats.rx_crc_errors++;
- if (status & BD_ENET_RX_OV) /* FIFO overrun */
- ndev->stats.rx_fifo_errors++;
- }
- /* Report late collisions as a frame error.
- * On this error, the BD is closed, but we don't know what we
- * have in the buffer. So, just drop this frame on the floor.
- */
- if (status & BD_ENET_RX_CL) {
- ndev->stats.rx_errors++;
- ndev->stats.rx_frame_errors++;
+ if (status & BD_ENET_RX_OV) {
+ /* FIFO overrun */
+ ndev->stats.rx_fifo_errors++;
+ } else {
+ if (status & (BD_ENET_RX_LG | BD_ENET_RX_SH
+ | BD_ENET_RX_LAST)) {
+ /* Frame too long or too short. */
+ ndev->stats.rx_length_errors++;
+ if (status & BD_ENET_RX_LAST)
+ dev_err(&ndev->dev,
+ "rcv is not +last, "
+ "0x%x\n", status);
+ }
+ if (status & BD_ENET_RX_CR) /* CRC Error */
+ ndev->stats.rx_crc_errors++;
+ /*
+ * Report late collisions as a frame error.
+ */
+ if (status & (BD_ENET_RX_NO | BD_ENET_RX_CL))
+ ndev->stats.rx_frame_errors++;
+ }
goto rx_processing_done;
}