diff mbox

[RFT] sky2: fix status length check on older chips

Message ID 20120427135514.48b03ce8@nehalam.linuxnetplumber.net
State RFC, archived
Delegated to: David Miller
Headers show

Commit Message

stephen hemminger April 27, 2012, 8:55 p.m. UTC
Mirko and I were working on a related issue, here is his fix.
I proposed a similar alternative, but he was unavailable to test it,
and therefore was still pending.  Does this fix your problem?

Resend with missing bits.

The cleaner alternative is to not use the boolean flag, but instead
put tag on skb directly (eliminating rx_tag and rx_vlan from
data structure).
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Niccolò Belli April 27, 2012, 11:05 p.m. UTC | #1
It doesn't compile against 3.4-rc4:

   CC [M]  drivers/net/ethernet/intel/e1000e/param.o
   CC [M]  drivers/net/ethernet/marvell/sky2.o
   CC [M]  drivers/net/ethernet/intel/e1000e/ethtool.o
   CC [M]  net/sunrpc/svc_xprt.o
drivers/net/ethernet/marvell/sky2.c: In function ‘sky2_status_intr’:
drivers/net/ethernet/marvell/sky2.c:2769:4: warning: passing argument 2 
of ‘sky2_skb_rx’ makes pointer from integer without a cast
drivers/net/ethernet/marvell/sky2.c:2649:20: note: expected ‘struct 
sk_buff *’ but argument is of type ‘u32’
drivers/net/ethernet/marvell/sky2.c:2769:4: error: too many arguments to 
function ‘sky2_skb_rx’
drivers/net/ethernet/marvell/sky2.c:2649:20: note: declared here
make[4]: *** [drivers/net/ethernet/marvell/sky2.o] Errore 1
make[3]: *** [drivers/net/ethernet/marvell] Errore 2
make[3]: *** Attesa dei processi non terminati....
   CC [M]  net/sunrpc/backchannel_rqst.o
   CC [M]  drivers/net/ethernet/intel/e1000e/netdev.o


Niccolò
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
stephen hemminger April 28, 2012, 2:46 a.m. UTC | #2
Are you using VLAN's? the whole problem report only applies if using VLAN
on old hardware.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Niccolò Belli April 28, 2012, 10:25 a.m. UTC | #3
Il 28/04/2012 04:46, Stephen Hemminger ha scritto:
> Are you using VLAN's? the whole problem report only applies if using VLAN
> on old hardware.

No, I don't use VLANs. There are VLANs in my network but I simply 
connect to the default one from my laptop.

Niccolò
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
stephen hemminger April 30, 2012, 4:19 p.m. UTC | #4
On Sat, 28 Apr 2012 12:25:33 +0200
Niccolò Belli <darkbasic@linuxsystems.it> wrote:

> Il 28/04/2012 04:46, Stephen Hemminger ha scritto:
> > Are you using VLAN's? the whole problem report only applies if using VLAN
> > on old hardware.
> 
> No, I don't use VLANs. There are VLANs in my network but I simply 
> connect to the default one from my laptop.

Still your laptop will receive vlan frames (even just broadcasts).
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Niccolò Belli April 30, 2012, 6:23 p.m. UTC | #5
Il 30/04/2012 18:19, Stephen Hemminger ha scritto:
> Still your laptop will receive vlan frames (even just broadcasts).

Right, so I tested it with a point2point connection: I have the very 
same problem.

Niccolò
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ivan Minev Sept. 17, 2012, 2:20 p.m. UTC | #6
Still vlan don't work and have rx lenght errors chipset:88E8072 rev 10

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

=================

From: From: Mirko Lindner <mlindner@marvell.com>

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: The driver uses only VLAN information included in VLAN status list elements,
that signals that the VLAN tag field is valid. It must ignore the VLAN bit in the
MAC RX Status Word. An additional variable set when evaluating the VLAN opcodes
is used to indicate that the received packet is a VLAN packet and a packet length
correction (subtraction of VLAN header length) must be done.

Signed-off-by: Mirko Lindner <mlindner@marvell.com>
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

---
--- a/drivers/net/ethernet/marvell/sky2.c	2012-04-18 23:44:40.637276647 -0700
+++ b/drivers/net/ethernet/marvell/sky2.c	2012-04-27 13:52:06.154756866 -0700
@@ -2580,7 +2580,7 @@  static struct sk_buff *sky2_receive(stru
 	struct sk_buff *skb = NULL;
 	u16 count = (status & GMR_FS_LEN) >> 16;
 
-	if (status & GMR_FS_VLAN)
+	if (sky2->rx_vlan)
 		count -= VLAN_HLEN;	/* Account for vlan tag */
 
 	netif_printk(sky2, rx_status, KERN_DEBUG, dev,
@@ -2646,11 +2646,13 @@  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)
+static inline void sky2_skb_rx(struct sky2_port *sky2,
+				struct sk_buff *skb)
 {
-	if (status & GMR_FS_VLAN)
+	if (sky2->rx_vlan) {
 		__vlan_hwaccel_put_tag(skb, be16_to_cpu(sky2->rx_tag));
+		sky2->rx_vlan = 0;
+	}
 
 	if (skb->ip_summed == CHECKSUM_NONE)
 		netif_receive_skb(skb);
@@ -2772,10 +2774,12 @@  static int sky2_status_intr(struct sky2_
 			break;
 
 		case OP_RXVLAN:
+			sky2->rx_vlan = 1;
 			sky2->rx_tag = length;
 			break;
 
 		case OP_RXCHKSVLAN:
+			sky2->rx_vlan = 1;
 			sky2->rx_tag = length;
 			/* fall through */
 		case OP_RXCHKS:
--- a/drivers/net/ethernet/marvell/sky2.h	2012-02-13 09:23:53.642447236 -0800
+++ b/drivers/net/ethernet/marvell/sky2.h	2012-04-27 13:36:07.487834432 -0700
@@ -2242,6 +2242,7 @@  struct sky2_port {
 	u16		     rx_data_size;
 	u16		     rx_nfrags;
 	u16		     rx_tag;
+	u8		     rx_vlan;
 
 	struct {
 		unsigned long last;