* [PATCH 0/2] sky2 patches
@ 2012-04-30 15:49 Stephen Hemminger
2012-04-30 15:49 ` [PATCH 1/2] sky2: propogate rx hash when packet is copied Stephen Hemminger
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Stephen Hemminger @ 2012-04-30 15:49 UTC (permalink / raw)
To: davem; +Cc: netdev
These are both patches against net-next but should be
applied to -net and stable as well.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] sky2: propogate rx hash when packet is copied
2012-04-30 15:49 [PATCH 0/2] sky2 patches Stephen Hemminger
@ 2012-04-30 15:49 ` Stephen Hemminger
2012-04-30 16:47 ` [PATCH 2/2] [PATCH] sky2: fix receive length error in mixed non-VLAN/VLAN traffic Stephen Hemminger
2012-05-01 17:39 ` [PATCH 0/2] sky2 patches David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2012-04-30 15:49 UTC (permalink / raw)
To: davem; +Cc: netdev, Mirko Lindner
[-- Attachment #1: sky2-rxhash.patch --]
[-- Type: text/plain, Size: 935 bytes --]
When a small packet is received, the driver copies it to a new skb to allow
reusing the full size Rx buffer. The copy was propogating the checksum offload
but not the receive hash information. The bug is impact was mostly harmless
and therefore not observed until reviewing this area of code.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/ethernet/marvell/sky2.c 2012-04-30 08:19:56.225976395 -0700
+++ b/drivers/net/ethernet/marvell/sky2.c 2012-04-30 08:21:05.395136397 -0700
@@ -2494,8 +2494,11 @@ static struct sk_buff *receive_copy(stru
skb_copy_from_linear_data(re->skb, skb->data, length);
skb->ip_summed = re->skb->ip_summed;
skb->csum = re->skb->csum;
+ skb->rxhash = re->skb->rxhash;
+
pci_dma_sync_single_for_device(sky2->hw->pdev, re->data_addr,
length, PCI_DMA_FROMDEVICE);
+ re->skb->rxhash = 0;
re->skb->ip_summed = CHECKSUM_NONE;
skb_put(skb, length);
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] [PATCH] sky2: fix receive length error in mixed non-VLAN/VLAN traffic
2012-04-30 15:49 [PATCH 0/2] sky2 patches Stephen Hemminger
2012-04-30 15:49 ` [PATCH 1/2] sky2: propogate rx hash when packet is copied Stephen Hemminger
@ 2012-04-30 16:47 ` Stephen Hemminger
2012-05-01 17:39 ` [PATCH 0/2] sky2 patches David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2012-04-30 16:47 UTC (permalink / raw)
To: Stephen Hemminger, Niccolò Belli, Mirko Lindner; +Cc: davem, netdev
Bug: The VLAN bit of the MAC RX Status Word is unreliable in several older
supported chips. Sometimes the VLAN bit is not set for valid VLAN packets
and also sometimes the VLAN bit is set for non-VLAN packets that came after
a VLAN packet. This results in a receive length error when VLAN hardware
tagging is enabled.
Fix: Variation on original fix proposed by Mirko.
The VLAN information is decoded in the status loop, and can be
applied to the received SKB there. This eliminates the need for the
separate tag field in the interface data structure. The tag has to
be copied and cleared if packet is copied. This version checked out
with vlan and normal traffic.
Note: vlan_tx_tag_present should be renamed vlan_tag_present, but that
is outside scope of this.
Reported-by: Mirko Lindner <mlindner@marvell.com>
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/ethernet/marvell/sky2.c 2012-04-30 08:21:05.395136397 -0700
+++ b/drivers/net/ethernet/marvell/sky2.c 2012-04-30 08:22:27.328472831 -0700
@@ -2495,9 +2495,11 @@ static struct sk_buff *receive_copy(stru
skb->ip_summed = re->skb->ip_summed;
skb->csum = re->skb->csum;
skb->rxhash = re->skb->rxhash;
+ skb->vlan_tci = re->skb->vlan_tci;
pci_dma_sync_single_for_device(sky2->hw->pdev, re->data_addr,
length, PCI_DMA_FROMDEVICE);
+ re->skb->vlan_tci = 0;
re->skb->rxhash = 0;
re->skb->ip_summed = CHECKSUM_NONE;
skb_put(skb, length);
@@ -2583,9 +2585,6 @@ static struct sk_buff *sky2_receive(stru
struct sk_buff *skb = NULL;
u16 count = (status & GMR_FS_LEN) >> 16;
- if (status & GMR_FS_VLAN)
- count -= VLAN_HLEN; /* Account for vlan tag */
-
netif_printk(sky2, rx_status, KERN_DEBUG, dev,
"rx slot %u status 0x%x len %d\n",
sky2->rx_next, status, length);
@@ -2593,6 +2592,9 @@ static struct sk_buff *sky2_receive(stru
sky2->rx_next = (sky2->rx_next + 1) % sky2->rx_pending;
prefetch(sky2->rx_ring + sky2->rx_next);
+ if (vlan_tx_tag_present(re->skb))
+ count -= VLAN_HLEN; /* Account for vlan tag */
+
/* This chip has hardware problems that generates bogus status.
* So do only marginal checking and expect higher level protocols
* to handle crap frames.
@@ -2650,11 +2652,8 @@ static inline void sky2_tx_done(struct n
}
static inline void sky2_skb_rx(const struct sky2_port *sky2,
- u32 status, struct sk_buff *skb)
+ struct sk_buff *skb)
{
- if (status & GMR_FS_VLAN)
- __vlan_hwaccel_put_tag(skb, be16_to_cpu(sky2->rx_tag));
-
if (skb->ip_summed == CHECKSUM_NONE)
netif_receive_skb(skb);
else
@@ -2708,6 +2707,14 @@ static void sky2_rx_checksum(struct sky2
}
}
+static void sky2_rx_tag(struct sky2_port *sky2, u16 length)
+{
+ struct sk_buff *skb;
+
+ skb = sky2->rx_ring[sky2->rx_next].skb;
+ __vlan_hwaccel_put_tag(skb, be16_to_cpu(length));
+}
+
static void sky2_rx_hash(struct sky2_port *sky2, u32 status)
{
struct sk_buff *skb;
@@ -2766,8 +2773,7 @@ static int sky2_status_intr(struct sky2_
}
skb->protocol = eth_type_trans(skb, dev);
-
- sky2_skb_rx(sky2, status, skb);
+ sky2_skb_rx(sky2, skb);
/* Stop after net poll weight */
if (++work_done >= to_do)
@@ -2775,11 +2781,11 @@ static int sky2_status_intr(struct sky2_
break;
case OP_RXVLAN:
- sky2->rx_tag = length;
+ sky2_rx_tag(sky2, length);
break;
case OP_RXCHKSVLAN:
- sky2->rx_tag = length;
+ sky2_rx_tag(sky2, length);
/* fall through */
case OP_RXCHKS:
if (likely(dev->features & NETIF_F_RXCSUM))
--- a/drivers/net/ethernet/marvell/sky2.h 2012-04-30 08:19:56.000000000 -0700
+++ b/drivers/net/ethernet/marvell/sky2.h 2012-04-30 08:21:40.595714908 -0700
@@ -2241,7 +2241,6 @@ struct sky2_port {
u16 rx_pending;
u16 rx_data_size;
u16 rx_nfrags;
- u16 rx_tag;
struct {
unsigned long last;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] sky2 patches
2012-04-30 15:49 [PATCH 0/2] sky2 patches Stephen Hemminger
2012-04-30 15:49 ` [PATCH 1/2] sky2: propogate rx hash when packet is copied Stephen Hemminger
2012-04-30 16:47 ` [PATCH 2/2] [PATCH] sky2: fix receive length error in mixed non-VLAN/VLAN traffic Stephen Hemminger
@ 2012-05-01 17:39 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2012-05-01 17:39 UTC (permalink / raw)
To: shemminger; +Cc: netdev
From: Stephen Hemminger <shemminger@vyatta.com>
Date: Mon, 30 Apr 2012 08:49:44 -0700
> These are both patches against net-next but should be
> applied to -net and stable as well.
Both applied to 'net' and queued up for -stable, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-05-01 17:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-30 15:49 [PATCH 0/2] sky2 patches Stephen Hemminger
2012-04-30 15:49 ` [PATCH 1/2] sky2: propogate rx hash when packet is copied Stephen Hemminger
2012-04-30 16:47 ` [PATCH 2/2] [PATCH] sky2: fix receive length error in mixed non-VLAN/VLAN traffic Stephen Hemminger
2012-05-01 17:39 ` [PATCH 0/2] sky2 patches David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.