Skip to contentSkip to conversation

New: smsc911x.c drops long packets with VLAN tags

Bugme-new Applied Andrew Morton 4 participants 4 messages Mar 2, 2011 – Mar 8, 2011 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]/

#1 lore raw

(switched to email. Please respond via emailed reply-to-all, not via the bugzilla web interface).

Quoted 26 lines · On Mon, 28 Feb 2011 15:57:14 GMT [email protected] wrote:

https://bugzilla.kernel.org/show_bug.cgi?id=30092

           Summary: smsc911x.c drops long packets with VLAN tags
           Product: Drivers
           Version: 2.5
    Kernel Version: 2.6.36.4
          Platform: All
        OS/Version: Linux
              Tree: Mainline
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Network
        AssignedTo: [email protected]
        ReportedBy: [email protected]
        Regression: No

The smsc911x.c driver can't receive packets of the maximum MTU if they have a 802.1q tag. Testing with ping -s 1500 shows that the frame with the first IP segment is dropped.

The source of the problem is this line at smsc911x.c:1023 (smsc911x_poll):

  if (unlikely(rxstat & RX_STS_ES_)) {
Quoted 9 lines

The datasheet at
http://www.smsc.com/media/Downloads_Public/Data_Sheets/9221.pdf describes this bit as a logical OR of bits 11, 7, 6 and 1. The problem is that bit 7 is set if the packet is longer than 1518 bytes, which is true for the 802.1q tagged packets. As a quick and dirty solution, I replaced RX_STS_ES_ with (1<<11|1<<6|1<<1), and now 802.1q tagged packets are received just fine.

This was tested on an IGEPv2, which has a SMSC LAN9221i.

Thanks. Become famous, get more girls: send us a patch as per Documentation/SubmittingPatches :)

#2 lore raw
Quoted 10 lines · Andrew Morton

(switched to email. Please respond via emailed reply-to-all, not via the bugzilla web interface).

Quoted 2 lines · On Mon, 28 Feb 2011 15:57:14 GMT [email protected] wrote:

https://bugzilla.kernel.org/show_bug.cgi?id=30092

Thanks. Become famous, get more girls: send us a patch as per Documentation/SubmittingPatches :)

There's a register called VLAN1 that wasn't being configured. Setting it to 0x8100 fixes the problem I reported. There's also a VLAN2 register, possibly meant for stacked VLANs, but the description in the datasheet doesn't make sense to me, and I can't test stacked VLANs, so I'm not going to change it.

Subject: [PATCH] net/smsc911x.c: Set the VLAN1 register to fix VLAN MTU problem
From: Göran Weinholt <[email protected]>

The smsc911x driver would drop frames longer than 1518 bytes, which is a problem for networks with VLAN tagging. The VLAN1 tag register is used to increase the legal frame size to 1522 when a VLAN tag is identified.

---

drivers/net/smsc911x.c +5 -0
diff -uprN linux-2.6.36.4-vanilla/drivers/net/smsc911x.c linux-2.6.36.4/drivers/net/smsc911x.c
@@ -1178,6 +1178,11 @@ static int smsc911x_open(struct net_devi
 	smsc911x_reg_write(pdata, HW_CFG, 0x00050000);
 	smsc911x_reg_write(pdata, AFC_CFG, 0x006E3740);
 
+	/* Increase the legal frame size of VLAN tagged frames to 1522 bytes */
+	spin_lock_irq(&pdata->mac_lock);
+	smsc911x_mac_write(pdata, VLAN1, ETH_P_8021Q);
+	spin_unlock_irq(&pdata->mac_lock);
+
 	/* Make sure EEPROM has finished loading before setting GPIO_CFG */
 	timeout = 50;
 	while ((smsc911x_reg_read(pdata, E2P_CMD) & E2P_CMD_EPC_BUSY_) &&
Signature · 3 lines
Göran Weinholt
Network Administrator
Chalmers Studentbostäder (AS48514)
maintainer Applied
#3 lore raw

From: [email protected] (Göran Weinholt)
Date: Wed, 02 Mar 2011 15:07:21 +0100

Quoted 8 lines

Subject: [PATCH] net/smsc911x.c: Set the VLAN1 register to fix VLAN MTU problem
From: Göran Weinholt <[email protected]>

The smsc911x driver would drop frames longer than 1518 bytes, which is a problem for networks with VLAN tagging. The VLAN1 tag register is used to increase the legal frame size to 1522 when a VLAN tag is identified.

Applied, thanks.

#4 lore raw
Quoted 1 line
Quoted 1 line

Subject: [PATCH] net/smsc911x.c: Set the VLAN1 register to fix VLAN

MTU problem

Quoted 3 lines
Quoted 3 lines

From: Göran Weinholt <[email protected]>

The smsc911x driver would drop frames longer than 1518 bytes, which is

a

Quoted 2 lines
Quoted 2 lines

problem for networks with VLAN tagging. The VLAN1 tag register is used to increase the legal frame size to 1522 when a VLAN tag is

identified.

Quoted 4 lines
Quoted 2 lines

Applied, thanks.

Thanks David, I was just about to ack this but you beat me to it :-)

As Göran said, the datasheet is a little vague. I've checked here, and there aren't any bad implications of always turning this option on.