summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAndy Fleming <afleming@freescale.com>2008-03-24 16:53:27 +0100
committerJeff Garzik <jeff@garzik.org>2008-03-26 05:44:39 +0100
commit99da5003a5b085c12d996da1010e276e9b88672f (patch)
tree23fb14628162cfd1c64092e1c61327a098b1edf8 /drivers
parentgianfar: Fix frame size calculation when hardware VLAN acceleration is on (diff)
downloadlinux-99da5003a5b085c12d996da1010e276e9b88672f.tar.xz
linux-99da5003a5b085c12d996da1010e276e9b88672f.zip
gianfar: Only process completed frames
If the LAST bit is not set in the RxBD, it's possible we're processing an incomplete frame, which is bad. While we're at it, add a constant for the error bitmask, so the whole if-clause fits on one line, and is more legible. Signed-off-by: Dai Haruki <dai.haruki@freescale.com> Signed-off-by: Andy Fleming <afleming@freescale.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/gianfar.c4
-rw-r--r--drivers/net/gianfar.h3
2 files changed, 4 insertions, 3 deletions
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 0ab4b26c79a5..a59edf7eacdc 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -1526,9 +1526,7 @@ int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit)
rmb();
skb = priv->rx_skbuff[priv->skb_currx];
- if (!(bdp->status &
- (RXBD_LARGE | RXBD_SHORT | RXBD_NONOCTET
- | RXBD_CRCERR | RXBD_OVERRUN | RXBD_TRUNCATED))) {
+ if ((bdp->status & RXBD_LAST) && !(bdp->status & RXBD_ERR)) {
/* Increment the number of packets */
dev->stats.rx_packets++;
howmany++;
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h
index 5b8991d822fc..fcfa1bd57280 100644
--- a/drivers/net/gianfar.h
+++ b/drivers/net/gianfar.h
@@ -340,6 +340,9 @@ extern const char gfar_driver_version[];
#define RXBD_OVERRUN 0x0002
#define RXBD_TRUNCATED 0x0001
#define RXBD_STATS 0x01ff
+#define RXBD_ERR (RXBD_LARGE | RXBD_SHORT | RXBD_NONOCTET \
+ | RXBD_CRCERR | RXBD_OVERRUN \
+ | RXBD_TRUNCATED)
/* Rx FCB status field bits */
#define RXFCB_VLN 0x8000