Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d6532232cd3de79c852685823a9c52f723816d0a
Commit:     d6532232cd3de79c852685823a9c52f723816d0a
Parent:     680e9fe9d69ea86e81c859932bfd751be91cc0e0
Author:     Stephen Hemminger <[EMAIL PROTECTED]>
AuthorDate: Wed Sep 19 15:36:42 2007 -0700
Committer:  Jeff Garzik <[EMAIL PROTECTED]>
CommitDate: Thu Sep 20 15:22:59 2007 -0400

    sky2: fix VLAN receive processing (resend)
    
    The length check for truncated frames was not correctly handling
    the case where VLAN acceleration had already read the tag.
    Also, the Yukon EX has some features that use high bit of status
    as security tag.
    
    Signed-off-by: Pierre-Yves Ritschard <[EMAIL PROTECTED]>
    Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]>
    Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>
---
 drivers/net/sky2.c |   14 +++++++++++++-
 drivers/net/sky2.h |    2 +-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 5d812de..8b15654 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -2103,6 +2103,13 @@ static struct sk_buff *sky2_receive(struct net_device 
*dev,
        struct sky2_port *sky2 = netdev_priv(dev);
        struct rx_ring_info *re = sky2->rx_ring + sky2->rx_next;
        struct sk_buff *skb = NULL;
+       u16 count = (status & GMR_FS_LEN) >> 16;
+
+#ifdef SKY2_VLAN_TAG_USED
+       /* Account for vlan tag */
+       if (sky2->vlgrp && (status & GMR_FS_VLAN))
+               count -= VLAN_HLEN;
+#endif
 
        if (unlikely(netif_msg_rx_status(sky2)))
                printk(KERN_DEBUG PFX "%s: rx slot %u status 0x%x len %d\n",
@@ -2117,7 +2124,8 @@ static struct sk_buff *sky2_receive(struct net_device 
*dev,
        if (!(status & GMR_FS_RX_OK))
                goto resubmit;
 
-       if (status >> 16 != length)
+       /* if length reported by DMA does not match PHY, packet was truncated */
+       if (length != count)
                goto len_mismatch;
 
        if (length < copybreak)
@@ -2133,6 +2141,10 @@ len_mismatch:
        /* Truncation of overlength packets
           causes PHY length to not match MAC length */
        ++sky2->net_stats.rx_length_errors;
+       if (netif_msg_rx_err(sky2) && net_ratelimit())
+               pr_info(PFX "%s: rx length mismatch: length %d status %#x\n",
+                       dev->name, length, status);
+       goto resubmit;
 
 error:
        ++sky2->net_stats.rx_errors;
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h
index 72e12b7..3baae48 100644
--- a/drivers/net/sky2.h
+++ b/drivers/net/sky2.h
@@ -1668,7 +1668,7 @@ enum {
 
 /* Receive Frame Status Encoding */
 enum {
-       GMR_FS_LEN      = 0xffff<<16, /* Bit 31..16:    Rx Frame Length */
+       GMR_FS_LEN      = 0x7fff<<16, /* Bit 30..16:    Rx Frame Length */
        GMR_FS_VLAN     = 1<<13, /* VLAN Packet */
        GMR_FS_JABBER   = 1<<12, /* Jabber Packet */
        GMR_FS_UN_SIZE  = 1<<11, /* Undersize Packet */
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to