]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
sky2: check drop truncated packets
authorStephen Hemminger <shemminger@linux-foundation.org>
Mon, 9 Jul 2007 22:33:40 +0000 (15:33 -0700)
committerJeff Garzik <jeff@garzik.org>
Tue, 10 Jul 2007 16:22:29 +0000 (12:22 -0400)
If packet larger than MTU is received, the driver uses hardware to
truncate the packet. Use the status registers to catch/drop them.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/net/sky2.c

index 99a999383e9b4352e48126a64c6e5a1685107292..4e0b839de7e4d4ac918579ac5ce735687e73646c 100644 (file)
@@ -2109,6 +2109,9 @@ static struct sk_buff *sky2_receive(struct net_device *dev,
        if (!(status & GMR_FS_RX_OK))
                goto resubmit;
 
+       if (status >> 16 != length)
+               goto len_mismatch;
+
        if (length < copybreak)
                skb = receive_copy(sky2, re, length);
        else
@@ -2118,6 +2121,11 @@ resubmit:
 
        return skb;
 
+len_mismatch:
+       /* Truncation of overlength packets
+          causes PHY length to not match MAC length */
+       ++sky2->net_stats.rx_length_errors;
+
 error:
        ++sky2->net_stats.rx_errors;
        if (status & GMR_FS_RX_FF_OV) {