[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-vlan
Subject:    Re: [VLAN] Large VLAN packets
From:       damiank () anobi-asp ! com
Date:       2002-01-03 23:21:00
[Download RAW message or body]

I had the exact same problem with my 3c905c.  This patch will patch the
3c59x driver included with the kernel source.  This is the driver used with
the 3c905c card. Save the patch to a file (i.e. 3c59x-vlanpatch and type:
patch /path-to-driverfile/3c59x.c /path-to-patchfile/3c59x-vlanpatch

Let me know how it goes
Damian Kohlfeld

Here is the patch (cut-n-paste between the /**********/'s):

/*************************************************************/

--- 3c59x.c.backuporiginal Thu Jan  3 16:29:53 2002
+++ 3c59x.c Thu Jan  3 16:30:17 2002
@@ -308,6 +308,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 ETH_P_8021Q     0x8100          /* 802.1Q VLAN Extended Header  */
+
 #define PFX DRV_NAME ": "


@@ -651,7 +654,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)  \
@@ -679,7 +682,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 {
@@ -776,7 +780,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;
@@ -844,6 +849,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
 
 /* This driver uses 'options' to pass the media type, full-duplex flag,
etc. */
 /* Option count limit only -- unlimited interfaces are supported. */
@@ -1030,6 +1038,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;
@@ -1461,7 +1470,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);

@@ -1545,6 +1554,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);
@@ -1680,7 +1693,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)
@@ -1900,6 +1913,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);
   }
@@ -2497,6 +2514,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);
@@ -2761,6 +2783,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(ETH_P_8021Q, 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
    MDIO protocol.  See the MII specifications or DP83840A data sheet



/*************************************************************/










----- Original Message -----
From: "Maciej Bogucki" <maciej.bogucki@efigence.com>
To: <vlan@Scry.WANfear.com>
Sent: Wednesday, January 02, 2002 10:16 AM
Subject: Re: [VLAN] Large VLAN packets


> [cut here]
> >         I have tried using ping to send larger packets, and have noticed
> >         that:
> >         'ping -s 1468' works
> >         'ping -s 1470' does not work (pinging with the size set to an
> >         odd number does not work anyway, even without the vlan stuff
> >         etc, though I'm not sure if that is documented with ping)
> >
> >         I suspect that it is not splitting the larger packets correctly.
> >         I tried the ping tests above, without using vlans and that
> >         worked fine.
> >
> >         Please let me know if you would like me to supply any further
> >         information.
> It sounds like 3com driver problem. Patch is available here:
> http://www.myipv6.de/patches/vlan/ or in archive.
>
> Best Regards
> Maciej Bogucki
>
> ---
> efigence                              http://www.efigence.com/
> ---------------------------------------------------------------
> doswiadczenie ktore zapewnia sukces   tel: +48 22 646 60 96
> ul.Goszczynskiego 10                  02-616 Warszawa
> _______________________________________________
> VLAN mailing list  -  VLAN@Scry.WANfear.com
> http://www.WANfear.com/mailman/listinfo/vlan
> VLAN Page:  http://scry.wanfear.com/~greear/vlan.html
>

_______________________________________________
VLAN mailing list  -  VLAN@Scry.WANfear.com
http://www.WANfear.com/mailman/listinfo/vlan
VLAN Page:  http://scry.wanfear.com/~greear/vlan.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic