Skip to content

Commit 095098e

Browse files
tkiskydavem330
authored andcommitted
net: fec: fix rx error counts
On an overrun, the other flags are not valid, so don't check them. Also, don't pass bad frames up the stack. Signed-off-by: Troy Kisky <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 55cd48c commit 095098e

File tree

1 file changed

+15
-21
lines changed

1 file changed

+15
-21
lines changed

drivers/net/ethernet/freescale/fec_main.c

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,37 +1408,31 @@ fec_enet_rx_queue(struct net_device *ndev, int budget, u16 queue_id)
14081408
break;
14091409
pkt_received++;
14101410

1411-
/* Since we have allocated space to hold a complete frame,
1412-
* the last indicator should be set.
1413-
*/
1414-
if ((status & BD_ENET_RX_LAST) == 0)
1415-
netdev_err(ndev, "rcv is not +last\n");
1416-
14171411
writel(FEC_ENET_RXF, fep->hwp + FEC_IEVENT);
14181412

14191413
/* Check for errors. */
1414+
status ^= BD_ENET_RX_LAST;
14201415
if (status & (BD_ENET_RX_LG | BD_ENET_RX_SH | BD_ENET_RX_NO |
1421-
BD_ENET_RX_CR | BD_ENET_RX_OV)) {
1416+
BD_ENET_RX_CR | BD_ENET_RX_OV | BD_ENET_RX_LAST |
1417+
BD_ENET_RX_CL)) {
14221418
ndev->stats.rx_errors++;
1423-
if (status & (BD_ENET_RX_LG | BD_ENET_RX_SH)) {
1419+
if (status & BD_ENET_RX_OV) {
1420+
/* FIFO overrun */
1421+
ndev->stats.rx_fifo_errors++;
1422+
goto rx_processing_done;
1423+
}
1424+
if (status & (BD_ENET_RX_LG | BD_ENET_RX_SH
1425+
| BD_ENET_RX_LAST)) {
14241426
/* Frame too long or too short. */
14251427
ndev->stats.rx_length_errors++;
1428+
if (status & BD_ENET_RX_LAST)
1429+
netdev_err(ndev, "rcv is not +last\n");
14261430
}
1427-
if (status & BD_ENET_RX_NO) /* Frame alignment */
1428-
ndev->stats.rx_frame_errors++;
14291431
if (status & BD_ENET_RX_CR) /* CRC Error */
14301432
ndev->stats.rx_crc_errors++;
1431-
if (status & BD_ENET_RX_OV) /* FIFO overrun */
1432-
ndev->stats.rx_fifo_errors++;
1433-
}
1434-
1435-
/* Report late collisions as a frame error.
1436-
* On this error, the BD is closed, but we don't know what we
1437-
* have in the buffer. So, just drop this frame on the floor.
1438-
*/
1439-
if (status & BD_ENET_RX_CL) {
1440-
ndev->stats.rx_errors++;
1441-
ndev->stats.rx_frame_errors++;
1433+
/* Report late collisions as a frame error. */
1434+
if (status & (BD_ENET_RX_NO | BD_ENET_RX_CL))
1435+
ndev->stats.rx_frame_errors++;
14421436
goto rx_processing_done;
14431437
}
14441438

0 commit comments

Comments
 (0)