Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Feb 2000 00:26:56 -0500
From:      "C. Stephen Gunn" <csg@dustdevil.waterspout.com>
To:        freebsd-net@freebsd.org
Cc:        wollman@freebsd.org, wpaul@freebsd.org, mdodd@freebsd.org, csg@waterspout.com
Subject:   Re: 802.1Q VLANs
Message-ID:  <20000214002656.A12799@dustdevil.waterspout.com>
In-Reply-To: <200002031847.NAA62013@khavrinen.lcs.mit.edu>
References:  <Pine.OSF.4.21.0002031711230.1338-100000@haddock.euitt.upm.es> <Pine.BSF.4.21.0002031236160.479-100000@sasami.jurai.net> <200002031847.NAA62013@khavrinen.lcs.mit.edu>

next in thread | previous in thread | raw e-mail | index | archive | help

Oh yeah.. Here's the patch:

Index: if_xl.c
===================================================================
RCS file: /project/cvs/FreeBSD/src/sys/pci/if_xl.c,v
retrieving revision 1.22.2.24
diff -c -r1.22.2.24 if_xl.c
*** if_xl.c     1999/12/17 15:58:13     1.22.2.24
--- if_xl.c     2000/02/10 18:35:19
***************
*** 117,122 ****
--- 117,127 ----
  #include <net/bridge.h>
  #endif

+ #include "vlan.h"
+ #if NVLAN > 0
+ #include <net/if_vlan_var.h>
+ #endif
+
  #include <vm/vm.h>              /* for vtophys */
  #include <vm/pmap.h>            /* for vtophys */
  #include <machine/clock.h>      /* for DELAY */
***************
*** 1805,1810 ****
--- 1810,1830 ----
        if_attach(ifp);
        ether_ifattach(ifp);

+ #if NVLAN > 0
+       /*
+        * XXX: If this is a 3C905B card, we program the card to accept
+        * ETHERMTU + ETHER_HDR_LEN +EVL_ENCAPLEN packets.  This allows
+        * VLAN interfaces to operate with 1500 byte MTUs.
+        */
+       if (sc->xl_type == XL_TYPE_905B) {
+               XL_SEL_WIN(3);
+               CSR_WRITE_2(sc, XL_W3_MAXPKTSIZE,
+                       ETHERMTU + ETHER_HDR_LEN + EVL_ENCAPLEN);
+               printf("xl%d: VLANs Enabled - set MAXPKTSIZE= %d\n",
+                       sc->xl_unit, ETHERMTU + ETHER_HDR_LEN + EVL_ENCAPLEN);
+       }
+ #endif /* NVLAN */
+
  #if NBPFILTER > 0
        bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
  #endif
***************
*** 3017,3022 ****
--- 3037,3059 ----
        case SIOCGIFADDR:
        case SIOCSIFMTU:
                error = ether_ioctl(ifp, command, data);
+ #if NVLAN > 0
+               /*
+                * XXX: If this is a 3C905B Card, adjust the onboard MAXPKTSIZE
+                * register to allow (mtu + ETHER_HDR_LEN +EVL_ENCAPLEN) size
+                * frames. The hardware rejects larger frames as giants.
+                * This makes room for VLAN Tags in the ethernet header on
+                * 802.1Q-tagged links.
+                */
+               if ((error == 0) && (sc->xl_type == XL_TYPE_905B)) {
+                       XL_SEL_WIN(3);
+                       CSR_WRITE_2(sc, XL_W3_MAXPKTSIZE,
+                               ifr->ifr_mtu + ETHER_HDR_LEN + EVL_ENCAPLEN);
+                       printf("xl%d: VLANs Enabled - changed MAXPKTSIZE= %d\n",
+                               sc->xl_unit,
+                               ifr->ifr_mtu + ETHER_HDR_LEN + EVL_ENCAPLEN);
+ #endif /* NVLAN */
+               }
                break;
        case SIOCSIFFLAGS:
                XL_SEL_WIN(5);
Index: if_xlreg.h
===================================================================
RCS file: /project/cvs/FreeBSD/src/sys/pci/if_xlreg.h,v
retrieving revision 1.9.2.10
diff -c -r1.9.2.10 if_xlreg.h
*** if_xlreg.h  1999/12/17 15:58:14     1.9.2.10
--- if_xlreg.h  2000/02/10 15:58:09
***************
*** 256,261 ****
--- 256,262 ----
  #define XL_W3_FREE_TX         0x0C
  #define XL_W3_FREE_RX         0x0A
  #define XL_W3_MAC_CTRL                0x06
+ #define XL_W3_MAXPKTSIZE      0x04

  #define XL_ICFG_CONNECTOR_MASK        0x00F00000
  #define XL_ICFG_CONNECTOR_BITS        20


--
C. Stephen Gunn                          URL: http://www.waterspout.com/
WaterSpout Communications, Inc.        Email: csg@waterspout.com
427 North 6th Street                   Phone: +1 765.742.6628
Lafayette, IN  47901                     Fax: +1 765.742.0646


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000214002656.A12799>