From: Stephen Hemminger <shemminger@linux-foundation.org>
To: Jeff Garzk <jgarzik@pobox.com>
Cc: netdev@vger.kernel.org, Pierre-Yves Ritschard <pyr@spootnik.org>
Subject: [PATCH 1/6] sky2: fix VLAN receive processing
Date: Wed, 19 Sep 2007 22:06:00 -0700 [thread overview]
Message-ID: <20070920050700.328419933@linux-foundation.org> (raw)
In-Reply-To: 20070920050559.763089637@linux-foundation.org
[-- Attachment #1: sky2-vlan-len.patch --]
[-- Type: text/plain, Size: 2111 bytes --]
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 <pyr@spootnik.org>
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
--- a/drivers/net/sky2.c 2007-09-19 21:35:38.000000000 -0700
+++ b/drivers/net/sky2.c 2007-09-19 21:35:53.000000000 -0700
@@ -2146,6 +2146,13 @@ static struct sk_buff *sky2_receive(stru
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",
@@ -2160,7 +2167,8 @@ static struct sk_buff *sky2_receive(stru
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)
@@ -2176,6 +2184,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;
--- a/drivers/net/sky2.h 2007-09-19 21:35:38.000000000 -0700
+++ b/drivers/net/sky2.h 2007-09-19 21:35:53.000000000 -0700
@@ -1633,7 +1633,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 */
--
Stephen Hemminger <shemminger@linux-foundation.org>
next prev parent reply other threads:[~2007-09-20 5:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-20 5:05 [PATCH 0/6] sky2: merged for netdev-2.6 upstream Stephen Hemminger
2007-09-20 5:06 ` Stephen Hemminger [this message]
2007-09-20 5:06 ` [PATCH 2/6] sky2: ethtool speed report bug Stephen Hemminger
2007-09-20 5:06 ` [PATCH 3/6] sky2: reorganize chip revision features Stephen Hemminger
2007-09-20 5:06 ` [PATCH 4/6] sky2: fe+ chip support Stephen Hemminger
2007-09-20 5:06 ` [PATCH 5/6] sky2: receive FIFO checking Stephen Hemminger
2007-09-20 5:06 ` [PATCH 6/6] sky2: version 1.18 Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070920050700.328419933@linux-foundation.org \
--to=shemminger@linux-foundation.org \
--cc=jgarzik@pobox.com \
--cc=netdev@vger.kernel.org \
--cc=pyr@spootnik.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).