netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Need help with MCS7830 driver and 802.1q VLAN Tagging
@ 2008-08-07 15:36 Marc Haber
  2008-08-07 17:06 ` Ben Hutchings
  0 siblings, 1 reply; 4+ messages in thread
From: Marc Haber @ 2008-08-07 15:36 UTC (permalink / raw)
  To: netdev

Hi,

I am having difficulties with the MCS7830 driver in recent Linux
versions (last version I tried was 2.6.26.1, didn't try 2.6.26.2 yet).
It looks like the MCS7830 has an issue which prevents VLAN tagged
ethernet frames from being transmitted and/or received when the frame
size is near the ethernet MTU.

This behavior was known around the millennium for a lot of ethernet
drivers (including tulip) drivers. The host OS does not know that the
frame is destined to go out via a VLAN tagged interface and thus
builds frames with a size of up to 1500 octets. Then the VLAN tag gets
added, which results in a 1504 octet frame, which seems to be dropped
either by the MCS7830 hardware or its driver.

In some drivers, all was necessary to repair this was to replace a
1500 byte buffer size with 1504; on other interfaces it is necessary
to differently configure the chip.

The MCS7830 does 802.1q with smaller MTUs just fine, and passes tagged
frames. It only fails when the size is larger than MTU-3.

Arnd Bergmann, the original author of the MCS7830 does not have the
resources to debug this at the moment, and unfortunately, my low-level
programming skills are next to existent. I can apply patches,
recompile and try, since i have the hardware available. Can anybody
help with the code?

Greetings
Marc

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany  |  lose things."    Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature |  How to make an American Quilt | Fax: *49 3221 2323190

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Need help with MCS7830 driver and 802.1q VLAN Tagging
  2008-08-07 15:36 Need help with MCS7830 driver and 802.1q VLAN Tagging Marc Haber
@ 2008-08-07 17:06 ` Ben Hutchings
  2008-08-12 12:01   ` Marc Haber
  2008-08-19 13:47   ` Marc Haber
  0 siblings, 2 replies; 4+ messages in thread
From: Ben Hutchings @ 2008-08-07 17:06 UTC (permalink / raw)
  To: Marc Haber; +Cc: netdev

Marc Haber wrote:
> Hi,
> 
> I am having difficulties with the MCS7830 driver in recent Linux
> versions (last version I tried was 2.6.26.1, didn't try 2.6.26.2 yet).
> It looks like the MCS7830 has an issue which prevents VLAN tagged
> ethernet frames from being transmitted and/or received when the frame
> size is near the ethernet MTU.
> 
> This behavior was known around the millennium for a lot of ethernet
> drivers (including tulip) drivers. The host OS does not know that the
> frame is destined to go out via a VLAN tagged interface and thus
> builds frames with a size of up to 1500 octets. Then the VLAN tag gets
> added, which results in a 1504 octet frame, which seems to be dropped
> either by the MCS7830 hardware or its driver.
[...]

This could be a general problem with USB Ethernet drivers, as usbnet.c
doesn't seem to take account of VLAN header overhead.

Does the following help?

Ben.

diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 8463efb..d24d22e 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -42,6 +42,7 @@
 #include <linux/mii.h>
 #include <linux/usb.h>
 #include <linux/usb/usbnet.h>
+#include <linux/if_vlan.h>
 
 #define DRIVER_VERSION		"22-Aug-2005"
 
@@ -226,7 +227,7 @@ EXPORT_SYMBOL_GPL(usbnet_skb_return);
 static int usbnet_change_mtu (struct net_device *net, int new_mtu)
 {
 	struct usbnet	*dev = netdev_priv(net);
-	int		ll_mtu = new_mtu + net->hard_header_len;
+	int		ll_mtu = new_mtu + VLAN_HLEN + net->hard_header_len;
 	int		old_hard_mtu = dev->hard_mtu;
 	int		old_rx_urb_size = dev->rx_urb_size;
 
@@ -237,7 +238,7 @@ static int usbnet_change_mtu (struct net_device *net, int new_mtu)
 		return -EDOM;
 	net->mtu = new_mtu;
 
-	dev->hard_mtu = net->mtu + net->hard_header_len;
+	dev->hard_mtu = ll_mtu;
 	if (dev->rx_urb_size == old_hard_mtu) {
 		dev->rx_urb_size = dev->hard_mtu;
 		if (dev->rx_urb_size > old_rx_urb_size)
@@ -1173,7 +1174,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
 	/* rx and tx sides can use different message sizes;
 	 * bind() should set rx_urb_size in that case.
 	 */
-	dev->hard_mtu = net->mtu + net->hard_header_len;
+	dev->hard_mtu = net->mtu + VLAN_HLEN + net->hard_header_len;
 #if 0
 // dma_supported() is deeply broken on almost all architectures
 	// possible with some EHCI controllers
@@ -1208,8 +1209,8 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
 			strcpy(net->name, "wlan%d");
 
 		/* maybe the remote can't receive an Ethernet MTU */
-		if (net->mtu > (dev->hard_mtu - net->hard_header_len))
-			net->mtu = dev->hard_mtu - net->hard_header_len;
+		if (net->mtu > (dev->hard_mtu - VLAN_HLEN - net->hard_header_len))
+			net->mtu = dev->hard_mtu - VLAN_HLEN - net->hard_header_len;
 	} else if (!info->in || !info->out)
 		status = usbnet_get_endpoints (dev, udev);
 	else {

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: Need help with MCS7830 driver and 802.1q VLAN Tagging
  2008-08-07 17:06 ` Ben Hutchings
@ 2008-08-12 12:01   ` Marc Haber
  2008-08-19 13:47   ` Marc Haber
  1 sibling, 0 replies; 4+ messages in thread
From: Marc Haber @ 2008-08-12 12:01 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: netdev

Hi Ben,

On Thu, Aug 07, 2008 at 06:06:36PM +0100, Ben Hutchings wrote:
> This could be a general problem with USB Ethernet drivers, as usbnet.c
> doesn't seem to take account of VLAN header overhead.
> 
> Does the following help?

thanks for your quick answer. It'll be until next week when I'll be
near a VLAN-able setup and the MCS device again, but I'll report back.

Greetings
Marc

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany  |  lose things."    Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature |  How to make an American Quilt | Fax: *49 3221 2323190

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Need help with MCS7830 driver and 802.1q VLAN Tagging
  2008-08-07 17:06 ` Ben Hutchings
  2008-08-12 12:01   ` Marc Haber
@ 2008-08-19 13:47   ` Marc Haber
  1 sibling, 0 replies; 4+ messages in thread
From: Marc Haber @ 2008-08-19 13:47 UTC (permalink / raw)
  To: netdev

On Thu, Aug 07, 2008 at 06:06:36PM +0100, Ben Hutchings wrote:
> Does the following help?

Unfortunately, no. I apologize for taking so long to test. I am now
back at my orkplace and can test on shorter notice.

Greetings
Marc

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany  |  lose things."    Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature |  How to make an American Quilt | Fax: *49 3221 2323190

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-08-19 13:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-07 15:36 Need help with MCS7830 driver and 802.1q VLAN Tagging Marc Haber
2008-08-07 17:06 ` Ben Hutchings
2008-08-12 12:01   ` Marc Haber
2008-08-19 13:47   ` Marc Haber

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).