Skip to content

Commit

Permalink
gianfar: Only process completed frames
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andy Fleming authored and Jeff Garzik committed Mar 26, 2008
1 parent faa8957 commit 99da500
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/net/gianfar.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand Down
3 changes: 3 additions & 0 deletions drivers/net/gianfar.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 99da500

Please sign in to comment.