public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* vlan dotQ vs 2.4.19pre8-ac5 vs big packets trouble
@ 2002-05-28 16:59 Alexander Trotsai
  2002-05-28 20:09 ` Paul P Komkoff Jr
  0 siblings, 1 reply; 4+ messages in thread
From: Alexander Trotsai @ 2002-05-28 16:59 UTC (permalink / raw)
  To: linux-kernel

Hi

I try to use vlan with 2.4.19pre8-ac5 and
00:10.0 Ethernet controller: 3Com Corporation 3c905C-TX/TX-M
[Tornado] (rev 74)
network card

I successfully setup vlan and got ping's (traffic)
But only with small packets

At main interface all work good
[root@watcher linux]# ping -s 1480 x.x.x.1
PING x.x.x.1 (x.x.x.1) from x.x.x.11 : 1480(1508) bytes of data.
1488 bytes from x.x.x.1: icmp_seq=1 ttl=255 time=6.93 ms
1488 bytes from x.x.x.1: icmp_seq=2 ttl=255 time=3.05 ms

--- x.x.x.1 ping statistics ---
2 packets transmitted, 2 received, 0% loss, time 1007ms
rtt min/avg/max/mdev = 3.056/4.993/6.930/1.937 ms

Vlan interface
[root@watcher linux]# ping -s 1480 x.x.x.242
PING x.x.x.242 (x.x.x.242) from x.x.x.244 : 1480(1508) bytes of data.

--- x.x.x.242 ping statistics ---
3 packets transmitted, 0 received, 100% loss, time 2017ms

Both pinged addresses in same subnet for approved interface
And vlan is work
[root@watcher linux]# ping -s 1400 x.x.x.242
PING x.x.x.242 (x.x.x.242) from x.x.x.244 : 1400(1428) bytes of data.
1408 bytes from x.x.x.242: icmp_seq=1 ttl=255 time=2.31 ms
1408 bytes from x.x.x.242: icmp_seq=2 ttl=255 time=1.79 ms

--- x.x.x.242 ping statistics ---
2 packets transmitted, 2 received, 0% loss, time 1010ms
rtt min/avg/max/mdev = 1.794/2.056/2.319/0.266 ms

I'm try to search information about this trouble found such
patch

# My 3C59X has MTU problems.

Edit the 3C59x.c, find the place where it says:

static const int mtu = 1500;
and replace 1500 with
static const int mtu = 1504;

but I got same trouble with this patch

-- 
Best regard, Alexander Trotsai aka MAGE-RIPE aka MAGE-UANIC
My PGP at ftp://blackhole.adamant.net/pgp/trotsai.key[.asc]
Big trouble - Post-it Note Sludge leaked into the monitor.

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

* Re: vlan dotQ vs 2.4.19pre8-ac5 vs big packets trouble
  2002-05-28 16:59 vlan dotQ vs 2.4.19pre8-ac5 vs big packets trouble Alexander Trotsai
@ 2002-05-28 20:09 ` Paul P Komkoff Jr
  2002-05-29  7:03   ` Alexander Trotsai
  0 siblings, 1 reply; 4+ messages in thread
From: Paul P Komkoff Jr @ 2002-05-28 20:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: Alexander Trotsai

Replying to Alexander Trotsai:
> # My 3C59X has MTU problems.
> 
> Edit the 3C59x.c, find the place where it says:
> 
> static const int mtu = 1500;
> and replace 1500 with
> static const int mtu = 1504;
> 
> but I got same trouble with this patch

It seems that you use broken by design way. I believe that the following IS
correct (sigh)

===== 3c59x.c 1.14 vs 1.15 =====
--- 1.14/drivers/net/3c59x.c	Sat May 25 16:11:31 2002
+++ 1.15/drivers/net/3c59x.c	Mon May 27 19:49:49 2002
@@ -322,6 +322,9 @@
    code size of a per-interface flag is not worthwhile. */
 static char mii_preamble_required;
 
+/* The Ethernet Type used for 802.1q tagged frames */
+#define VLAN_ETHER_TYPE 0x8100
+
 #define PFX DRV_NAME ": "
 
 
@@ -665,7 +668,7 @@
 	Wn2_ResetOptions=12,
 };
 enum Window3 {			/* Window 3: MAC/config bits. */
-	Wn3_Config=0, Wn3_MAC_Ctrl=6, Wn3_Options=8,
+	Wn3_Config=0, Wn3_MaxPktSize=4, Wn3_MAC_Ctrl=6, Wn3_Options=8,
 };
 
 #define BFEXT(value, offset, bitcount)  \
@@ -693,7 +696,8 @@
 	Media_LnkBeat = 0x0800,
 };
 enum Window7 {					/* Window 7: Bus Master control. */
-	Wn7_MasterAddr = 0, Wn7_MasterLen = 6, Wn7_MasterStatus = 12,
+	Wn7_MasterAddr = 0, Wn7_VlanEtherType=4, Wn7_MasterLen = 6,
+	Wn7_MasterStatus = 12,
 };
 /* Boomerang bus master control registers. */
 enum MasterCtrl {
@@ -790,7 +794,8 @@
 		pm_state_valid:1,				/* power_state[] has sane contents */
 		open:1,
 		medialock:1,
-		must_free_region:1;				/* Flag: if zero, Cardbus owns the I/O region */
+		must_free_region:1,				/* Flag: if zero, Cardbus owns the I/O region */
+		large_frames:1;			/* accept large frames */
 	int drv_flags;
 	u16 status_enable;
 	u16 intr_enable;
@@ -858,6 +863,9 @@
 static int vortex_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
 static void vortex_tx_timeout(struct net_device *dev);
 static void acpi_set_WOL(struct net_device *dev);
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
+static void set_8021q_mode(struct net_device *dev, int enable);
+#endif
 \f
 /* This driver uses 'options' to pass the media type, full-duplex flag, etc. */
 /* Option count limit only -- unlimited interfaces are supported. */
@@ -1049,6 +1057,7 @@
 	dev->base_addr = ioaddr;
 	dev->irq = irq;
 	dev->mtu = mtu;
+	vp->large_frames = mtu > 1500;
 	vp->drv_flags = vci->drv_flags;
 	vp->has_nway = (vci->drv_flags & HAS_NWAY) ? 1 : 0;
 	vp->io_size = vci->io_size;
@@ -1489,7 +1498,7 @@
 
 	/* Set the full-duplex bit. */
 	outw(	((vp->info1 & 0x8000) || vp->full_duplex ? 0x20 : 0) |
-		 	(dev->mtu > 1500 ? 0x40 : 0) |
+		 	(vp->large_frames ? 0x40 : 0) |
 			((vp->full_duplex && vp->flow_ctrl && vp->partner_flow_ctrl) ? 0x100 : 0),
 			ioaddr + Wn3_MAC_Ctrl);
 
@@ -1573,6 +1582,10 @@
 	}
 	/* Set receiver mode: presumably accept b-case and phys addr only. */
 	set_rx_mode(dev);
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
+	/* enable 802.1q tagged frames */
+	set_8021q_mode(dev, 1);
+#endif
 	outw(StatsEnable, ioaddr + EL3_CMD); /* Turn on statistics. */
 
 //	issue_and_wait(dev, SetTxStart|0x07ff);
@@ -1710,7 +1723,7 @@
 						/* Set the full-duplex bit. */
 						EL3WINDOW(3);
 						outw(	(vp->full_duplex ? 0x20 : 0) |
-								(dev->mtu > 1500 ? 0x40 : 0) |
+								(vp->large_frames ? 0x40 : 0) |
 								((vp->full_duplex && vp->flow_ctrl && vp->partner_flow_ctrl) ? 0x100 : 0),
 								ioaddr + Wn3_MAC_Ctrl);
 						if (vortex_debug > 1)
@@ -1932,6 +1945,10 @@
 			issue_and_wait(dev, RxReset|0x07);
 			/* Set the Rx filter to the current state. */
 			set_rx_mode(dev);
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
+			/* enable 802.1q VLAN tagged frames */
+			set_8021q_mode(dev, 1);
+#endif
 			outw(RxEnable, ioaddr + EL3_CMD); /* Re-enable the receiver. */
 			outw(AckIntr | HostError, ioaddr + EL3_CMD);
 		}
@@ -2529,6 +2546,11 @@
 	outw(RxDisable, ioaddr + EL3_CMD);
 	outw(TxDisable, ioaddr + EL3_CMD);
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
+	/* Disable receiving 802.1q tagged frames */
+	set_8021q_mode(dev, 0);
+#endif
+
 	if (dev->if_port == XCVR_10base2)
 		/* Turn off thinnet power.  Green! */
 		outw(StopCoax, ioaddr + EL3_CMD);
@@ -2791,6 +2813,50 @@
 
 	outw(new_mode, ioaddr + EL3_CMD);
 }
+
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
+/* Setup the card so that it can receive frames with an 802.1q VLAN tag.
+   Note that this must be done after each RxReset due to some backwards
+   compatibility logic in the Cyclone and Tornado ASICs */
+static void set_8021q_mode(struct net_device *dev, int enable)
+{
+	struct vortex_private *vp = (struct vortex_private *)dev->priv;
+	long ioaddr = dev->base_addr;
+	int old_window = inw(ioaddr + EL3_CMD);
+	int mac_ctrl;
+	
+	if (vp->drv_flags&IS_CYCLONE || vp->drv_flags&IS_TORNADO) {
+		/* cyclone and tornado chipsets can recognize 802.1q
+		 * tagged frames and treat them correctly */
+
+		int max_pkt_size = dev->mtu+14;	/* MTU+Ethernet header */
+		if (enable)
+			max_pkt_size += 4;	/* 802.1Q VLAN tag */
+
+		EL3WINDOW(3);
+		outw(max_pkt_size, ioaddr+Wn3_MaxPktSize);
+
+		/* set VlanEtherType to let the hardware checksumming
+		   treat tagged frames correctly */
+		EL3WINDOW(7);
+		outw(VLAN_ETHER_TYPE, ioaddr+Wn7_VlanEtherType);
+	} else {
+		/* on older cards we have to enable large frames */
+
+		vp->large_frames = dev->mtu > 1500 || enable;
+
+		EL3WINDOW(3);
+		mac_ctrl = inw(ioaddr+Wn3_MAC_Ctrl);
+		if (vp->large_frames)
+			mac_ctrl |= 0x40;
+		else
+			mac_ctrl &= ~0x40;
+		outw(mac_ctrl, ioaddr+Wn3_MAC_Ctrl);
+	}
+
+	EL3WINDOW(old_window);
+}
+#endif
 
 /* MII transceiver control section.
    Read and write the MII registers using software-generated serial





> 
> -- 
> Best regard, Alexander Trotsai aka MAGE-RIPE aka MAGE-UANIC
> My PGP at ftp://blackhole.adamant.net/pgp/trotsai.key[.asc]
> Big trouble - Post-it Note Sludge leaked into the monitor.
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 
Paul P 'Stingray' Komkoff 'Greatest' Jr /// (icq)23200764 /// (http)stingr.net
  When you're invisible, the only one really watching you is you (my keychain)

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

* Re: Re: vlan dotQ vs 2.4.19pre8-ac5 vs big packets trouble
  2002-05-28 20:09 ` Paul P Komkoff Jr
@ 2002-05-29  7:03   ` Alexander Trotsai
  2002-05-29 15:33     ` Paul P Komkoff Jr
  0 siblings, 1 reply; 4+ messages in thread
From: Alexander Trotsai @ 2002-05-29  7:03 UTC (permalink / raw)
  To: linux-kernel

Thanks, it work

PS. Why this patch not in mainstream???

-- 
Best regard, Alexander Trotsai aka MAGE-RIPE aka MAGE-UANIC
My PGP at ftp://blackhole.adamant.net/pgp/trotsai.key[.asc]
Big trouble - Repeated reboots of the system failed to solve problem

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

* Re: Re: vlan dotQ vs 2.4.19pre8-ac5 vs big packets trouble
  2002-05-29  7:03   ` Alexander Trotsai
@ 2002-05-29 15:33     ` Paul P Komkoff Jr
  0 siblings, 0 replies; 4+ messages in thread
From: Paul P Komkoff Jr @ 2002-05-29 15:33 UTC (permalink / raw)
  To: linux-kernel

Replying to Alexander Trotsai:
> Thanks, it work
> 
> PS. Why this patch not in mainstream???

And why tulip and eepro100 not in mainline too ? :) questions ...

(eepro100 one really isn't needed anymore due to e100)

-- 
Paul P 'Stingray' Komkoff 'Greatest' Jr /// (icq)23200764 /// (http)stingr.net
  When you're invisible, the only one really watching you is you (my keychain)

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

end of thread, other threads:[~2002-05-29 15:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-28 16:59 vlan dotQ vs 2.4.19pre8-ac5 vs big packets trouble Alexander Trotsai
2002-05-28 20:09 ` Paul P Komkoff Jr
2002-05-29  7:03   ` Alexander Trotsai
2002-05-29 15:33     ` Paul P Komkoff Jr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox